MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Precision in Mathematica 6

  • To: mathgroup at
  • Subject: [mg92281] Re: [mg92265] Precision in Mathematica 6
  • From: Bob Hanlon <hanlonr at>
  • Date: Fri, 26 Sep 2008 06:24:40 -0400 (EDT)
  • Reply-to: hanlonr at

int = Integrate[Sin[x]/x, {x, 0, t}]


soln = FindRoot[int == 1, {t, 1}]


The output defaults to displaying six digits; however, there are actually many more

soln // InputForm

{t -> 1.0648397255365585}

int - 1 /. soln


If you need more precision than machine precision

soln2 = FindRoot[int == 1, {t, 1}, WorkingPrecision -> 20]


int - 1 /. soln2


N is used to force numerical evaluation of an exact number



SinIntegral[1] // N


% // InputForm


If you want to change the display of numbers, look up NumberForm

Bob Hanlon

---- CaveSnow <cavesnow at> wrote: 

Hey guys! I have just started using Mathematica (I'm using v. 6) and I
hate to admit that there are some strange things happening. I have
already tried for quit a lot to figure things out but everything works
in a strange way.

this is the things I written in my notebook

\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(t\)]
FractionBox[\(Sin[x]\), \(x\)] \[DifferentialD]x\) == 1, {t, 1}]

N[t, 10] /. %

\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(t\)]
FractionBox[\(Sin[x]\), \(x\)] \[DifferentialD]x\) - 1 /. %%

\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1.0648397255365585`\)]
FractionBox[\(Sin[x]\), \(x\)] \[DifferentialD]x\) - 1

\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(1.06484\)]
FractionBox[\(Sin[x]\), \(x\)] \[DifferentialD]x\) - 1

In other words I used FindRoot to find the t that makes the definite
integral from 0 to t of sinx/x be 1.
As a result I got a certain rule, that had a small amount of digits
(only 6 of them). Then I issued the second command ti get more digits
from the result. But the result, even if I asked 10 digits remained
the same 1.06484.
Then of course I supposed that the problem was that it was actually
the findroot procedure that calculated only those digits. So then I
did this: first I actually calculated the value of the integral using
the /.%% substitution, thus applying the rule, and it gave me one
answer. Then I triedo to copy and paste the value displayed in the
rule but when I did the paste command it had me written many more
digits than the original 6, and the answer was a little different (it
actually displayed 17 digits).

And after that I tried to evaluate the integral with the originally
displayed 1.06484 value and the result of the integral was much more
off than in the other two cases.

The only thing that now I can say that actually the command N[t,10]/.%
actually dowsn't write me those aditional digits and neither does the
sequence of commands t/.%   N[%,10].

What the Hell!!!

I do not understand why these strange things happen. Mathematica is
absolutely unpredictable! Anyway I could find no notice on why using N
doesn't work in this case in the documentation. Is this a bug? Anyway
if it is hard to read the commands in the way I written them I can
send you the nb file. Please help! I already encountered this
seemingly random behavior of mathematica in other occasions and not
having to do only with the precision of numbers. It is rather
annoying, and I am getting rather fed up with this. It may as well be
my fault but there is no documentation to understand why.

Thanks in advance


Bob Hanlon

  • Prev by Date: Re: Precision in Mathematica 6
  • Next by Date: Redirecting input
  • Previous by thread: Re: Precision in Mathematica 6
  • Next by thread: Re: Precision in Mathematica 6