comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Derivatives
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Derivatives [message #86553] Tue, 19 November 2013 02:20 Go to next message
fd_luni is currently offline  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 #86555 is a reply to message #86553] Tue, 19 November 2013 02:49 Go to previous messageGo to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
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.
Re: Derivatives [message #86561 is a reply to message #86555] Tue, 19 November 2013 07:23 Go to previous messageGo to next message
fd_luni is currently offline  fd_luni
Messages: 66
Registered: January 2013
Member
Sorry it's 1 dimension array not two. I wrote it wrong before.

derivative=array[2000]

I want to make it derivative=array[2001] because I will multiply it later.

I did the same before when I did integration but I am not sure if it make sense to add a zero in derivatives.
Re: Derivatives [message #86565 is a reply to message #86555] Tue, 19 November 2013 18:45 Go to previous message
Craig Markwardt is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Time conversion for .nc file
Next Topic: _EXTRA KEYWORD

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:47:17 PDT 2025

Total time taken to generate the page: 0.00561 seconds