MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Version problem with FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97161] Version problem with FindRoot
  • From: "Dr. Robert Kragler" <kragler at hs-weingarten.de>
  • Date: Fri, 6 Mar 2009 05:39:09 -0500 (EST)

Hi, 

according to a short note of Alan Hayes, TJM Vol.3, issue 3 (1993 ! ) 
there is a 3-liner given for solving boundary problems of ODEs with the 
help of the so-called shooting method. The subsequent program

    system[x_]={2 w'[n]+f[n]* w[n]==0,w[n]==v'[n],v[n]==f'[n],w[0]==x 
,v[0]==0,f[0]==0 }

  gun:=(soln=NDSolve[system[#],{w,v,f},{n,0,10}])[[1,2,2]][10.]&

  FindRoot[gun[x]==1,{x,1,.5}]  (* should give x->0.332058 *)

works with earlier Mathematica versions 3.0, 4.2 but NOT for 5.2 (which 
I am currently still using in order to finish a manuscript before I will 
adapt this to version 7.0). In Mathematica version 6.0 and 7.0 FindRoot 
will work again if the following (version 6 ) system option is used :

  SetSystemOptions["EvaluateNumericalFunctionArgument"->False] 

There is no problem to plot the function gun[x]with Plot[gun[x],{x,0,1}] 
in Mathematica.
However, in Mathematica version 5.2 FindRoot gives rise to the following 
(error) message :

NDSolve::"ndinnt": "Initial condition x is not a number or a rectangular 
array of numbers."

FindRoot::nlnum : The function value {-1.+v´[n][10.`] is not a list of 
numbers with
dimensions {1} at {x} = {1.`}.}

Does anybody have an idea what to do in the case of version 5.2 ? Thanks 
for any suggestion.

Robert Kragler

email:   kragler at hs-weingarten.de




  • Prev by Date: Re: Style for function calls?
  • Next by Date: Re: JLink problem, Mathematica 6, OSX, Java SE 6 (64 bit).
  • Previous by thread: Re: typsetting bug still present in Mathematica 7.01
  • Next by thread: Re: Version problem with FindRoot