Re: //N bug, but WHY?
- To: mathgroup at smc.vnet.net
- Subject: [mg58650] Re: [mg58634] //N bug, but WHY?
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 12 Jul 2005 05:21:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
It's because the second expression is numerically meaningless with machine
precision numbers. The two terms are nearly equal and opposite. Observe...
N[{Cosh[(43*Pi)/Sqrt[2]], (1 - Cosh[43*Sqrt[2]*Pi])*Csch[43*Sqrt[2]*Pi]*
Sinh[(43*Pi)/Sqrt[2]]}, 100]
Plus @@ %
{1.5263010243767668658026837562551913006201477453400952790176417034559634087
44
7565329239768148460217896689984877687881804`100.*^41,
-1.5263010243767668658026837562551913006201477453400952790176417034559634087
447565328584589396674783495284979080869067972`100.00000000000003*^41}
6.55178751785434401405005796818813832`17.331689612939737*^-42
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: symbio [mailto:symbio at has.com]
To: mathgroup at smc.vnet.net
Evaluating (using //N) two exact same expressions, gives wrong answer unless
fullsimplify is used first, I spent 2 days on a problem thinking my answer
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? Please
help!!!
cut and paste below to see the test case:
In[243]:=
\!\(\(Cosh[\(43\ \[Pi]\)\/\@2] + \((1 - Cosh[43\ \@2\ \[Pi]])\)\ Csch[
43\ \@2\ \[Pi]]\ Sinh[\(43\ \[Pi]\)\/\@2] // FullSimplify\) //
N\[IndentingNewLine]
Cosh[\(43\ \[Pi]\)\/\@2] + \((1 - Cosh[43\ \@2\ \[Pi]])\)\ Csch[
43\ \@2\ \[Pi]]\ Sinh[\(43\ \[Pi]\)\/\@2] // N\)
Out[243]=
\!\(6.551787517854307`*^-42\)
Out[244]=
\!\(\(-1.9342813113834067`*^25\)\)
thanks,