       Re: FindRoot & NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg64668] Re: [mg64650] FindRoot & NDSolve
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Sun, 26 Feb 2006 05:07:51 -0500 (EST)
• References: <200602250753.CAA13936@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On 25 Feb 2006, at 08:53, Takashi Inoue wrote:

> Hi all,
>
> This is my first post to here.
> I have a problem and want your help.
>
> Mathematica 4 did the following calculation with no pleblem,
> while Mathematica 5(.2)  cannot do it.
>
> FindRoot[
>  (f /.NDSolve[ {D[f[x], {x,1}] - 2 x - a == 0, f == 0}, f, {x,
> -3, 3}
> ][]) == 4,
>  {a, -10, 10}
>               ]
>
> Does anyone know solution or altanative way to do it?
>
> Takashi Inoue,
> Dept. Phys. Sophia University
>

In:=
g[(a_)?NumericQ] :=
f /. NDSolve[
{D[f[x], {x, 1}] - 2*x -
a == 0, f == 0}, f,
{x, -3, 3}][]

In:=
FindRoot[g[a] == 4,
{a, -10, 10}]

Out=
{a -> -7.3171562090692666*^-9}

Another possible approach is to evaluate

Developer`SetSystemOptions["EvaluateNumericalFunctionArgument" ->
False];

Once you have done this your original code will work fine.

Andrzej Kozlowski
Tokyo,  Japan

```

• Prev by Date: Re: FindRoot & NDSolve
• Next by Date: Re: 3D Graphics suggestions?
• Previous by thread: Re: FindRoot & NDSolve
• Next by thread: Re: FindRoot & NDSolve