       Re: //N bug, but WHY?

• To: mathgroup at smc.vnet.net
• Subject: [mg58656] Re: [mg58634] //N bug, but WHY?
• From: yehuda ben-shimol <bsyehuda at gmail.com>
• Date: Tue, 12 Jul 2005 05:21:39 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,
You are trying to substract two very close large numbers, and of course
you are entering to the limits of machine precision.
Cosh[(43*Pi)/Sqrt]//N
returns
1.5263010243767756*^41
and
(1 - Cosh[43*Sqrt*Pi])*Csch[43*Sqrt*Pi]*
Sinh[(43*Pi)/Sqrt]//N
returns
-1.5263010243767758*^41
so if you evaluate the original expression with high precision
N[Cosh[(43*Pi)/Sqrt] + (1 - Cosh[43*Sqrt*Pi])*
Csch[43*Sqrt*Pi]*Sinh[(43*Pi)/Sqrt], 50]
you will get
6.5517875178543440140500579682357879451030334737036144\
2804220253`50.*^-42

Now,
FullSimplify[Cosh[(43*Pi)/Sqrt] + (1 - Cosh[43*Sqrt*Pi])*
Csch[43*Sqrt*Pi]*Sinh[(43*Pi)/Sqrt]]
returns
Sech[(43*Pi)/Sqrt]
And this can be evaluated by //N without suffering precision problems.
Sech[(43*Pi)/Sqrt]//N
6.551787517854306*^-42
I hope this helps
yehuda

On 7/11/05, symbio <symbio at has.com> 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 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:=
> \!\(\(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=
> \!\(6.551787517854307`*^-42\)
> Out=
> \!\(\(-1.9342813113834067`*^25\)\)
>
>
>
> thanks,
>
>

```

• Prev by Date: Re: //N bug, but WHY?
• Next by Date: Re: superscripts
• Previous by thread: Re: //N bug, but WHY?
• Next by thread: Re: //N bug, but WHY?