Re: //N bug, but WHY?
- To: mathgroup at smc.vnet.net
- Subject: [mg58644] Re: [mg58634] //N bug, but WHY?
- From: Andrzej Kozlowski <akozlowski at gmail.com>
- Date: Tue, 12 Jul 2005 05:21:29 -0400 (EDT)
- References: <200507110819.EAA22908@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Actually, however strange it may seem, there is no bug involved here
at all. You are using machine precision arithemtic and it is quite
normal for machine precision arithemtic to give quite different
answers two algebraically equivalent expressions if one (or both) is
"ill conditioned". It is quite often the case that one form of an
expression is "ill conditioned" and machine precision will give you
an answer that is way off while another form is "well conditioned"
and you will get a pretty good answer even with machine precision.
You can see quite clearly how this happens here. Just evaluate the
same expression but using bignum arithmetic with reasonable precision:
(1 - Cosh[43*Sqrt*Pi])*Csch[43*Sqrt*Pi]*
No problem here.
N[Cosh[(43*Pi)/Sqrt] + (1 - Cosh[43*Sqrt*Pi])*
Internal precision limit
$MaxExtraPrecision =`50. reached while evaluating
The answers are very close but the message tells you that the second
expression is ill conditioned and even high precision aritmetic is
having problems with it. Thus there is no bug here at all, it is just
one of the "facts of life" one has to live with.
On 11 Jul 2005, at 17:19, symbio wrote:
> Evaluating (using //N) two exact same expressions, gives wrong
> answer unless
> fullsimplify is used first, I spent 2 days on a problem thinking my
> was wrong, but turned out Mathematica 5 was giving me buggy answers, I
> debugged it to this point, but WHY in the world is this happening?
> cut and paste below to see the test case:
> \!\(\(Cosh[\(43\ \[Pi]\)\/\@2] + \((1 - Cosh[43\ \@2\ \[Pi]])\)\ Csch[
> 43\ \@2\ \[Pi]]\ Sinh[\(43\ \[Pi]\)\/\@2] //
> FullSimplify\) //
> Cosh[\(43\ \[Pi]\)\/\@2] + \((1 - Cosh[43\ \@2\ \[Pi]])\)\ Csch[
> 43\ \@2\ \[Pi]]\ Sinh[\(43\ \[Pi]\)\/\@2] // N\)
Prev by Date:
Next by Date:
Fw: Re: Set of strings reducing problem
Previous by thread:
//N bug, but WHY?
Next by thread:
Re: //N bug, but WHY?