MathGroup Archive 2008

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

Search the Archive

Re: Precision in Mathematica 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92299] Re: Precision in Mathematica 6
  • From: Mark Westwood <markc.westwood at gmail.com>
  • Date: Sat, 27 Sep 2008 06:48:51 -0400 (EDT)
  • References: <gbflpa$69g$1@smc.vnet.net>

Hi Cave

Your immediate issue might be resolved by playing around with the
option WorkingPrecision, which you'll find covered in the
documentation for the FindRoot function.

If you don't want a lecture from an old-hand, stop reading NOW, ...

More generally, if you are ever to come to be able to use Mathematica
effectively for your work you're going to have to figure out:
- what accuracy and precision mean (which are numerical analysis
issues, not just Mathematica issues);
- how Mathematica deals with accuracy and precision, by default, and
what options you have for over-riding the defaults;
- the limitations of trying to do infinite mathematics (such as
calculus) on a finite machine.

Most of us who have been using the tool for a while have gone through
at least some head-scratching on these issues (how much usually
depends on whether we encountered Mathematica before studying
numerical analysis or after).  Once you're through that phase you'll
understand that the system is not absolutely unpredictable, but some
times you need to understand what it's doing rather better than you do
yet.

And as for your assertion that there is no documentation -- well, I
disagree, there's a lot of on-line documentation provided by Wolfram
Research and there are libraries full of books on computer mathematics
and a lot of good on-line resources too.

Regards

Mark Westwood


On 25 Sep, 10:31, CaveSnow <caves... at gmail.com> 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}]
>
> 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



  • Prev by Date: How to debug init.m?
  • Next by Date: Re: Help
  • Previous by thread: Re: Precision in Mathematica 6
  • Next by thread: Re: Precision in Mathematica 6