[SciPy-user] Finding min/max of a B-Spline
dmitrey
openopt@ukr....
Fri Aug 17 13:32:02 CDT 2007
you'd better to inform about exact n and time demands.
As for me I would try to use any smooth or non-smooth optimization
solver, however, I don't know what are your requirements for speed.
Regards, D.
P.S. I can't run the example because each time I install scipy it has
problems with scipy.interpolate._fitpack.so (unknown unicode symbol).
Willi Richert wrote:
> Hi,
>
> I have a sequence of n-dim points for which I approximate a spline via splrep
> and splev. For splev I can specify der=1 to get the first derivative
> evaluated. And there is sproot, which finds the roots of the originially
> created spline. However, with these methods I cannot find the roots of the
> first derivative to get the minima and maxima of the spline. How can that be
> achieved?
>
> As an example take the 2-dim case (scipy 0.5.2):
>
> =========================
> from pylab import *
> from scipy.interpolate import splrep, splev, sproot, spalde
> import pylab
>
> x=linspace(0,2*pi, 100)
> y=sin(linspace(0,2*pi, 100))
>
> rep=splrep(x, y, k=3, s=1)
> ynew = splev(x, rep)
>
> raw_points = plot(x,y)
> spline_points = plot(x, ynew)
>
> y_der = splev(x, rep, der=1)
> p_der = plot(x, y_der)
>
> # x,y_der now contain the evaluated data for the first derivative.
> # The only chance to get the root would be to again fit a polynomial
> # to the data. However, that might be overkill. What else?
>
> legend([raw_points, spline_points, p_der], \
> ["raw", "spline", "derivative"], "upper left")
>
> grid()
> show()
> =========================
>
> Best regards,
> wr
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>
>
More information about the SciPy-user
mailing list