Derivatives [message #86553] |
Tue, 19 November 2013 02:20  |
fd_luni
Messages: 66 Registered: January 2013
|
Member |
|
|
Hi
I want to use the simple differentiation formula instead of DERIV function( 3-point, Lagrangian interpolation):
Derivative=change in y/change in x
I wrote my code like this but my results are absolutely wrong and I don't see where my mistake is.
derivative= (A[1:*]-A)/ (t[1:*]-t)
derivative=[0,derivative]
I did the last step i.e. derivative=[0,derivative] because I need an array[2001,1] instead of array[2000,1].
Many Thanks
Mar
|
|
|
|
|
Re: Derivatives [message #86565 is a reply to message #86555] |
Tue, 19 November 2013 18:45  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Tuesday, November 19, 2013 2:49:53 AM UTC-8, Mats Löfdahl wrote:
> Den tisdagen den 19:e november 2013 kl. 11:20:40 UTC+1 skrev fd_...@mail.com:
>
>> Hi
>
>>
>
>> I want to use the simple differentiation formula instead of DERIV function( 3-point, Lagrangian interpolation):
>
>>
>
>> Derivative=change in y/change in x
>
>>
>
>> I wrote my code like this but my results are absolutely wrong and I don't see where my mistake is.
>
>>
>
>> derivative= (A[1:*]-A)/ (t[1:*]-t)
>
>> derivative=[0,derivative]
>
>
>
> Looks OK to me. In what way is the result "absolutely wrong"?
>
>
>
>
>
>> I did the last step i.e. derivative=[0,derivative] because I need an array[2001,1] instead of array[2000,1].
>
>
>
> I'm not sure why you expect a two-dimensional array but adding an element seems appropriate, since you removed one by doing selecting 1:*. I don't know how much sense it makes to add a zero (derivative =[derivative[0],derivative] might be more useful) but you are the only who knows your data.
Why is the original poster deleting their messages? Deleting significantly decreases the value of the discussion.
And why would responders be kind enough to help, if they know the original poster's messages would be deleted, leaving the responders' messages to be taken out of context?
Craig
|
|
|