Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2008

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

Search the Archive

Re: Precision in Mathematica 6

  • To: mathgroup at
  • Subject: [mg92279] Re: Precision in Mathematica 6
  • From: Bill Rowe <readnews at>
  • Date: Fri, 26 Sep 2008 06:24:17 -0400 (EDT)

On 9/25/08 at 5:31 AM, cavesnow at (CaveSnow) 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

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

It is much better to covert cells to InputForm before pasting
them into email. That makes them much more readable and you will
likely get more and better responses to your post.

>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).

This isn't quite right. By default FindRoot returns a
MachinePrecision number. Also, by default Mathematica only
displays 6 digits even though there are more meaningful digits
in the answer.

In[25]:= ans = t /. FindRoot[SinIntegral[t] == 1, {t, 1}]

Out[25]= 1.06484

returning the result you got

In[26]:= ans // FullForm

Out[26]//FullForm= 1.0648397255365585`

showing there really are more digits. And to get Mathematica to
display 10 digits

In[27]:= NumberForm[ans, 10]

Out[27]//NumberForm= 1.064839726

>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].

The purpose of N is to convert an exact number to a number with
the precision you specify. Or to convert a high precision number
to a lower precision. It is *not* a function to tell Mathematica
how many digits to display nor is it designed to convert a low
precision number to a higher precision.

That is

In[36]:= a = N[Pi, 20];

Out[37]= 20.


In[38]:= Precision[N[a, 10]]

Out[38]= 10.

=46inally, if you want FindRoot to return more than machine
precision use the options of FindRoot to get more precision. For example,

In[39]:= FindRoot[SinIntegral[t] == 1, {t, 1},
  WorkingPrecision -> 20]

Out[39]= {t->1.0648397255365608896}

In[40]:= Precision[t /. %]

Out[40]= 20.

All of the above is fairly well documented online. Use the
Document Center to look up Precision and read the documentation,
particularly the tutorial on precision. See the link near the
bottom of the documentation for precision.

  • Prev by Date: Re: Function changes in a program [CORRECTION]
  • Next by Date: Re: Precision in Mathematica 6
  • Previous by thread: Precision in Mathematica 6
  • Next by thread: Re: Precision in Mathematica 6