       • To: mathgroup at smc.vnet.net
• Subject: [mg73841] About Mathematica Evaluation...
• From: Juha Pahkala <jpahka at welho.com>
• Date: Fri, 2 Mar 2007 06:20:45 -0500 (EST)

```Hi,

In the Mathematica code below, I'm trying to use a Cubic Spline
function, using FindRoot to search the x point related to the spline
parameter. There's two slightly different implementations, one of which
produces correct and the other obviously incorrect result. I don't
understand why the latter method (ie. not defining an intermediate
function) does not work. Could someone kindly elaborate?

Juhis

In:=
<<NumericalMath`SplineFit`

In:=
pts={{1,37.8505},{2,60.6265},{3,93.377},{5,159.351},{7,207.2515}};

In:=
sr=SplineFit[pts, Cubic]

Out=
SplineFunction[Cubic, {0.,4.}, <>]

In:=
tmp[q_?NumericQ]:=sr[q][];

In:=
FindRoot[tmp[y]==6,{y,0,4}]

Out=
{y->3.4865}

In:=
FindRoot[sr[y][]==6,{y,0,4}]

Out=
{y->6.}

```

• Prev by Date: Re: Hold and Equal
• Next by Date: Number of digits
• Previous by thread: Re: Integrals involving square roots
• Next by thread: Number of digits