RE: Problem with hypergeometric function
- To: mathgroup at smc.vnet.net
- Subject: [mg34818] RE: [mg34796] Problem with hypergeometric function
- From: "DrBob" <majort at cox-internet.com>
- Date: Sat, 8 Jun 2002 05:21:32 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
>>switch to arbitrary precision arithmetic in all those cases in which they do not know for sure if the algorithm that is being used will give reliable results in case of using machine size arithmetic WHAT arbitrary-precision numbers would be used in place of the original machine-precision numbers? The process of converting an arbitrary precision quantity to machine precision is well-defined; the reverse is not. For instance, it's easy to see that Pi is approximately 3.141592653589793` --- that's the closest 16-digit approximation to Pi, and there's only ONE such number within the defined distance from Pi. However, if you have a machine-number that displays as 9.86960440108936`, what arbitrary precision number would you replace it with? There are infinitely many algebraic numbers (for instance) within 10^-16 (for instance) of 9.86960440108936`. Quick, now... which one do you choose? Maybe you'd use: Rationalize[9.86960440108936`, 10^-20] 404289898/40963131 Or... you might somehow notice: NumberForm[N[Pi^2], 20] 9.86960440108936 Now... just because Pi^2 is an interesting choice, that's no reason in itself not to choose a nice rational fraction instead, and there's no way to discover the approximation Pi^2... but that's how I got 9.86960440108936` in the first place, so I knew it would work nicely. But, if you knew where the number came from, you'd be using an arbitrary precision version ALREADY. For a problem like the one you describe below, you MAY not get the same answer with two replacements for the same machine-precision number, even though they're both very close. Bobby -----Original Message----- From: Ignacio Rodriguez [mailto:ignacio at sgirmn.pluri.ucm.es] To: mathgroup at smc.vnet.net Subject: [mg34818] [mg34796] Problem with hypergeometric function $Version Microsoft Windows 3.0 (April 25, 1997) Hi all, I have noticed some problems when trying to evaluate numerically certain hypergeometric functions. For example: f=HypergeometricPFQ[{1/2},{1,3/2},-8000] N[f] -1.34969 x 10^57 a bit big, isn't it? $MaxExtraPrecision=200 N[N[f,30]] 0.00586605 This seems more reasonable. The reason for this odd behaviour is related to how this expressions are evaluated. Essencially, N applies itself to any subexpression of f, as if MapAll were used. So, in the first case, HypergeometricPFQ finds machine precission numbers as its arguments, and evaluates itself in the same way. The algorithm is obviously not very fortunate (a series expansion, I guess?), and so is not the result. In the second case, their arguments are arbitrary precision numbers, and even though the same problems are present, using extremely high precision numbers for the intermediate calculation does the trick. My version of Mathematica is a bit old, and I would like to know if this problem remains in newer versions. I would also like to recommend to Mathematica developers to switch to arbitrary precision arithmetic in all those cases in which they do not know for sure if the algorithm that is being used will give reliable results in case of using machine size arithmetic.