Re: NDSolve::ndsz question
- To: mathgroup at smc.vnet.net
- Subject: [mg63724] Re: NDSolve::ndsz question
- From: Peter Pein <petsie at dordos.net>
- Date: Thu, 12 Jan 2006 03:22:32 -0500 (EST)
- References: <dpnqoa$6rh$1@smc.vnet.net> <dpvmjv$ltf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jens-Peer Kuska schrieb:
> Hi,
>
> you may use high-precision computation (avoid 0.5 and 0.1 and use
> 1/2 and 1/10 instead) if you know that your solution has no
> singularity -- otherwise you must program an initial value solver
> that use rational approximations to the function instead of polynomes.
>
> Regards
> Jens
Regarding the use of finite/infinite precision using NDSolve,NSum etc., I do
not fully understand, why the effect is so immense. I encountered the
following some time ago:
s[k_, x_] := ((2*k - x)/(2*k + x))^k - Exp[-x]
Series[s[k, x], {k, Infinity, 3}]//Normal
--> -(x^3/(E^x*(12*k^2)))
Therefore Sum[s[k,x],{k,0,Infinity}] should converge at least for x>0 (due to
s[k,x] there are singularities at nonpositive even integervalues of x).
SetOptions[NIntegrate, SingularityDepth -> 50, MaxRecursion -> 50];
f[x_?NumericQ] := NSum[
s[k, x], {k, 0, â??}, WorkingPrecision -> $MachinePrecision]
without setting WorkingPrecision, the evaluation of f[] fails (*why?*).
f[0.25]
--> ComplexInfinity
f[1/4]
--> 0.2195215
For most Reals x>0, f returns ComplexInfinity, but f[Rationalize[x,0]] returns
a reasonable value.
IMO this behaviour is neither predictable nor desirable.
Peter