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

Home » Public Forums » archive » partial differential equation
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
partial differential equation [message #93980] Tue, 13 December 2016 00:49 Go to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
Hi,

If
lm=[623.2,624.5,665.3,778.2]
S=ss[0:300,0:400,0:18,0] ;;; an image
compute

x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image

How can I do it using IDL?
Re: partial differential equation [message #93982 is a reply to message #93980] Tue, 13 December 2016 07:24 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, December 13, 2016 at 3:49:42 AM UTC-5, AGW wrote:
> Hi,
>
> If
> lm=[623.2,624.5,665.3,778.2]
> S=ss[0:300,0:400,0:18,0] ;;; an image
> compute
>
> x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image
>
> How can I do it using IDL?

So S has 19 slices but lm only has 4 elements? How is that supposed to work? You can check out Wikipedia's article on finite differences.
Re: partial differential equation [message #93985 is a reply to message #93980] Tue, 13 December 2016 09:18 Go to previous messageGo to next message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, December 13, 2016 at 10:49:42 AM UTC+2, AGW wrote:
> Hi,
>
> If
> lm=[623.2,624.5,665.3,778.2]
> S=ss[0:300,0:400,0:18,0] ;;; an image
> compute
>
> x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image
>
> How can I do it using IDL?

lm have 19 value, but I did not write all values, suppose
lm=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]

else
x=∑_i[(∂^2(s))/(∂ lm^2 )]]_i
Re: partial differential equation [message #93987 is a reply to message #93985] Tue, 13 December 2016 09:35 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, December 13, 2016 at 12:18:32 PM UTC-5, AGW wrote:
> On Tuesday, December 13, 2016 at 10:49:42 AM UTC+2, AGW wrote:
>> Hi,
>>
>> If
>> lm=[623.2,624.5,665.3,778.2]
>> S=ss[0:300,0:400,0:18,0] ;;; an image
>> compute
>>
>> x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image
>>
>> How can I do it using IDL?
>
> lm have 19 value, but I did not write all values, suppose
> lm=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
>
> else
> x=∑_i[(∂^2(s))/(∂ lm^2 )]]_i


Well, it's easy and it's hard. If you read the Wikipedia article about finite differences, it's easy. The expression for finite differences is,
∂^2(s))/(∂ lm^2) = ( s(lm+h) - 2 s(lm) + s(lm-h) ) /h^2
That's easy to express in IDL,
d2s_dlm2 = s*0 ;; Initialize to blank array
for i = 1, 17 do begin
h2 = (lm[i]-lm[i-1])*(lm[i+1]-lm[i]) ;; compute h^2 term
d2s_dlm2[*,*,i] = (s[*,*,i+1]-2*s[*,*,i]+s[i-1]) / h2
endfor

Note that it's not possible to compute the finite difference second derivative at the first and last LM position because there's not enough data to estimate it.

Now you want to sum it. That's easy too,
x = total(d2s_dlm2,3)

But the problem is that the sum of a second derivative is more or less equivalent to the integral of a second derivative, i.e. just a single derivative. It's really equivalent to computing the mean slope of S. You don't have to do any of the second derivative stuff to do this. You should basically get the same answer by doing,
x = (s(*,*,18) - s(*,*,0))/(lm(18)-lm(0))
This is not quite true if LM is unevenly spaced.

So you really have to decide if this is what you want.

Did you mean to take an absolute value? Or square the second derivative before summing it?

CM
Re: partial differential equation [message #93988 is a reply to message #93980] Tue, 13 December 2016 09:50 Go to previous message
Ali Gamal is currently offline  Ali Gamal
Messages: 98
Registered: June 2013
Member
On Tuesday, December 13, 2016 at 10:49:42 AM UTC+2, AGW wrote:
> Hi,
>
> If
> lm=[623.2,624.5,665.3,778.2]
> S=ss[0:300,0:400,0:18,0] ;;; an image
> compute
>
> x=∑[(∂^2 (s))/(∂(lm)^2)] ;;; image
>
> How can I do it using IDL?

Thanks

Of course I want absolute value of [(∂^2 (s))/(∂(lm)^2)]

.....
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Partial Differential Equation
Next Topic: histogram problem

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

Current Time: Wed Oct 08 15:06:17 PDT 2025

Total time taken to generate the page: 0.00473 seconds