Re: Fitting data with Splines

*To*: mathgroup at smc.vnet.net*Subject*: [mg3293] Re: Fitting data with Splines*From*: withoff (David Withoff)*Date*: Sat, 24 Feb 1996 03:20:18 -0500*Organization*: Wolfram Research, Inc.*Sender*: owner-wri-mathgroup at wolfram.com

In article <4fpdra$f9r at dragonfly.wolfram.com> aak at rmb.co.za (Ant Man) writes: > Hi all > > I have some data which I fit using the SplineFit function. > > I worked through the examplke given in the "Guide to Standard > > Mathematica Packages" on page 357 and everything works fine. > > Now say one has the function > > spline = SplineFit[your points, Cubic] > > and then > > spline[some point on curve] > > gives the x and y coordinates for this point on the spline curve. > > Is there some way in which one can just specify the x value so that > > the y value is returned? > > > Thanks > > Antonie Kotze The SplineFit function does cubic splines separately for the x and y coordinates in terms of a parameter. You could in theory eliminate the parameter to get y in terms of x, but this is not the intended use of SplineFit, and for about half a dozen reasons (it's difficult, the result wouldn't be a spline, the result wouldn't in general be single valued, and so forth) this is almost certainly not what you want to do. Probably what you want to do is to fit a single cubic spline to your data, rather than separate cubic splines to y and x. You can find a description of how to do that in books on interpolation or numerical analysis, and there is at least one package on MathSource that includes a short program to do it. Search for "spline" on MathSource and you should find the relevant items. Dave Withoff Research and Development Wolfram Research ==== [MESSAGE SEPARATOR] ====