Re: Numerical precision problem
- To: mathgroup at smc.vnet.net
- Subject: [mg43050] Re: Numerical precision problem
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 9 Aug 2003 02:57:50 -0400 (EDT)
- Organization: The University of Western Australia
- References: <bgv9nf$5ln$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bgv9nf$5ln$1 at smc.vnet.net>,
"Gareth J. Russell" <gjr2008 at columbia.edu> wrote:
> I have the following expression (in the form of a function):
>
> f[r_, {t1_, t2_}, {d1_, d2_}] := (2*E^(d1*r) - 2*E^(d2*r) - (d1 -
> d2)*E^(r*t2)*r*(2 + r*(d1 + d2 - 2*t2)))/(2*(d1 - d2)*
> E^(r*t2)*r^2*(-t1 + t2))
>
> r is a rate parameter, with values 0 to infinity. The expression goes to
> 0 in the limit as r goes to 0.
>
> The problem is that as r gets smaller (roughly, smaller than about 0.
> 0001), significant numerical errors appear and then get huge:
Series expansion with respect to r about r=0 will give you an expression
valid for small r.
f[r,{t1,t2},{d1,d2}] + O[r]^2 // Normal // Simplify
-((r*(d1^2 + (d2 - 3*t2)*d1 + d2^2 + 3*t2^2 - 3*d2*t2))/(6*(t1 - t2)))
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul