RE: interpolation
- To: mathgroup at smc.vnet.net
- Subject: [mg46999] RE: [mg46979] interpolation
- From: David.Annetts at csiro.au
- Date: Fri, 19 Mar 2004 01:35:52 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Amanda, > Is there a way to get Mathematica to display the function it > uses to interpolate a data set (call it inp) > of the form {Number, Number}? > A command like f=Interpolation[inp], for example, just gives assigns > this rule to a function I am calling f. > Is there any way to display this function f that interpolates my data > set, as a function of an independent variable, rather than just > have Mathematica generate values of f given a picked > numerical domain value? The obvious way is to create a table from the InterpolatingFunction ... ord = Range[10]; abs = ord[[#]]^2 & /@ Range[10]; int = Interpolation[Transpose[{ord, abs}]] val = {#, int[#]} & /@ Range[10] Another way is via NumericalMaths`Spline ... Needs["NumericalMath`"] spl = SplineFit[Transpose[{ord, abs}], Cubic] val = spl[#] & /@ Range[0, 9] You can even try val = spl[#] & /@ Range[0, 9, .5] But this will be in error between the sampled points -- continuing the above example dif = {#[[1]], Sqrt[#[[2]]]} & /@ val Regards, Dave. ========================================== Dr. David Annetts EM Modelling Analyst CSIRO DEM Tel: +612 9490 5416 North Ryde Fax: +612 9490 5467 Australia David.Annetts at csiro.au ===========================================