Re: NDSolve problem
- To: mathgroup at smc.vnet.net
- Subject: [mg6558] Re: [mg6511] NDSolve problem
- From: seanross at worldnet.att.net
- Date: Tue, 1 Apr 1997 19:00:55 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Zahir Bishnani wrote:
>
> Hi,
>
> I am trying to solve a scalar ODE numerically but since evaluating the
> derivative involves a FindRoot operation, I get error messages.
>
> Example:
>
> If the function that gives the derivative is
>
> FFunc1[y_]:= theta /. FindRoot[Cos[y*theta]==0.0, {theta,2,5}];
>
> ( which is pretty much equivalent to FFunc2[y_]:= N[ArcCos[0]/y]; )
>
> Trying NDSolve as follows just spouts out errors
>
> NDSolve[{y'[x]==FFunc1[y[x]], y[0]==1.}, {y}, {x,0,1}]
>
> FindRoot::precw: Warning: The precision of the argument function
> (Cos[y[x] theta] - 0.) is less than WorkingPrecision (16).
> FindRoot::frnum: Function {Cos[2. y[x]]} is not a length 1 list
> of numbers at theta = 2..
> ReplaceAll::reps: {FindRoot[Cos[y[x] theta] == 0., {theta, 2, 5}]}
> is neither a list of replacement rules nor a valid dispatch
> table, and so cannot be used for replacing.
>
> Does anyone know how I could get around this problem?
>
> Cheers,
>
> Zahir
You might try making a table of values, an interpolated function or a
fit polynomial for the theta[y]. If that doesn't work, you may have to
dust off your numerical recipes book and use a Runga Kutta method.