Re: NDSolve problem
- To: mathgroup at smc.vnet.net
- Subject: [mg6531] Re: [mg6511] NDSolve problem
- From: Richard Finley <trfin at fiona.umsmed.edu>
- Date: Mon, 31 Mar 1997 23:01:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
It would seem that there is no real reason to use the original FFunc1[y] since you can easily just use the root: theta = n Pi/y for the n of your choice. If you use this instead of FFunc1[y] in NDSolve there shouldn't be a problem. At 02:43 AM 3/27/97 -0500, you 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 > >