Re: FindRoot and Interpolating function
- To: mathgroup at smc.vnet.net
- Subject: [mg80297] Re: FindRoot and Interpolating function
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 16 Aug 2007 07:27:04 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <fa13fn$nr7$1@smc.vnet.net>
vmany wrote:
> FindRoot[S[a[1]] == 0.0018, {a[1], 50}]
>
> where S[a[1]] below contains an interpolating function.
>
> \!\(\*
> RowBox[{\(0.00001799999999999999`\ \[ExponentialE]\^\(1\/4\ \((50 -
> a[1])\)\
> \)\), "+",
> FractionBox[
> RowBox[{"0.09999999999999998`", " ", \(\[ExponentialE]\^\(\
> (-0.25`\)\ a[
> 1.`]\)\), " ", \((\(-50.`\) + a[1])\), " ",
> RowBox[{"(",
> RowBox[{\(\(1216.24812344918`\)\(\[InvisibleSpace]\)\),
> "+",
> RowBox[{\(\[ExponentialE]\^\(0.25`\ a[1.`]\)\), " ",
> RowBox[{
> TagBox[\(InterpolatingFunction[{{0.`, 89.`}}, "<>"]\),
> False,
> Editable->False],
> "[", \(\(\(0.`\)\(\[InvisibleSpace]\)\) + a[1.`]\),
> "]"}]}]}], ")"}]}], \(\(-50.`\) + a[1.`]\)]}]\)
>
> FindRoot gives the following error:
> FindRoot::nlnum: The function value ...is not a list of numbers with
> dimensions {1} at {a[1]} = {55.}
>
> How do I deal with this?
The second argument of FindRoot must be a symbol (i.e. an atomic
expression) for the name of the variable. So, say, x is fine, whereas
x[1] is not (x[1] is not a symbol).
So, either you change a[1] by the name of a variable which is atomic, or
you can use the Symbolize function to transform a[1] into a symbol. See
Notation/tutorial/NotationSymbolizeAndInfixNotation in the documentation
center for more information.
Regards,
--
Jean-Marc