David Huard david.huard at gmail.com
Mon Dec 5 10:44:57 CST 2005

```Use
x = linspace(0,2pi)
y = sin(x)

If you want to scale your function on (0,1), then you got to insert a factor
1/2/pi in the sinus function, and the derivative won't be 1 anymore. In the
example you give, you artificially scale the sinus function by using an
artificial x vector.

David

On 12/4/05, Darren Dale <dd55 at cornell.edu> wrote:
>
> I have a question about the interpolate.splrep and interpolate.splev
> functions, which I am using to find the inflection point in some data.
> I am testing these functions with a sine curve, just finding the spline
> representations and then evaluating them:
>
> from scipy import *
>
> n=1000
> xmin, xmax = 0,1
> x = linspace(xmin,xmax,n)
> ymin, ymax = 0, 2*pi
> y = sin(linspace(ymin,ymax,n))
>
> weights = ones(n)/0.00001 # 1/stdev for noisy data
> derivative = 2
> print interpolate.splev(x,interpolate.splrep
> (x,y,s=n,w=weights),derivative).max()
>
> If I were using this tool correctly, the reported maximum would be
> very close to 1 for any derivative. derivative=0 does yield a good
> approximation. If derivative is not 0, the amplitude of the result can
> be off by orders of magnitude. The amplitude of the derivative
> curve is effected by the limits of x and y, which I don't understand.
>
> I must have overlooked something, does anyone have a suggestion?
>
> Thanks,
> Darren
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20051205/6af257dd/attachment.htm
```