NDSolve with a function which calls N
- To: mathgroup at smc.vnet.net
- Subject: [mg25459] NDSolve with a function which calls N
- From: Carl Woll <carlw at u.washington.edu>
- Date: Sun, 1 Oct 2000 02:44:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I'm trying to use NDSolve with a rather complicated function, and with a working precision greater than 16. Call the working precision I use ndprec. In computing the complicated function, I need to temporarily set the precision of some my arguments to a much higher value than the working precision in NDSolve. When I try to use the function N within my function with this higher precision, for example N[x,ndprec+10], Mathematica complains that the precision I requested (ndprec+10) is greater than $MaxPrecision, where Mathematica's internal routines have set $MaxPrecision to ndprec. To solve this problem, I tried to reset $MaxPrecision to a higher value, but Mathematica complains that $MaxPrecision has been locked by internal routines. Below I present a simplified example to demonstrate the problem. Any suggestions on how I can use N within the function a would be much appreciated. Carl In[36]:= Clear[a] a[x_?NumericQ]:=Module[{}, N[\[Pi],30]; 1] In[38]:= NDSolve[ {f'[x]+a[x]f[x]==1,f[0]==1/2}, f, {x,0,1}, WorkingPrecision->24] N::preclg: Requested precision 30 is larger than $MaxPrecision. Using current $MaxPrecision of 24 . instead. $MaxPrecision = Infinity specifies that any precision should be allowed. N::preclg: Requested precision 30 is larger than $MaxPrecision. Using current $MaxPrecision of 24 . instead. $MaxPrecision = Infinity specifies that any precision should be allowed. N::preclg: Requested precision 30 is larger than $MaxPrecision. Using current $MaxPrecision of 24 . instead. $MaxPrecision = Infinity specifies that any precision should be allowed. General::stop: Further output of N::preclg will be suppressed during this calculation. Out[38]= {{f -> InterpolatingFunction[{{0, 1.00000000000000000000000}}, <>]}}