>>> (v[x-1] - v[x]) + (v[x] - v[x+1]) =
>>
>> That should be a "-" in the middle, because you are taking the
>> differential of the differential.
>
> The above formula is only meant to be the 1st derivative. I run it twice
> to get the second derivative.
To get the 1st derivative you just need:
v[x+1] - v[x]
What you are doing is to essentially average the differential of one point
and the point before, which is going to blur out any sharp gradients. (eg
if you have points 5 0 5 the gradient your way will come out as zero)
Post a reply to this message
|