[SciPy-user] question about splines
david.huard at gmail.com
Mon Dec 5 10:44:57 CST 2005
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.
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 *
> 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
> 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?
> SciPy-user mailing list
> SciPy-user at scipy.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user