Re: How to increase Working Precision?



On Mar 9, 5:41 pm, mcmcc...@xxxxxxxx wrote:
On Mar 9, 6:23 pm, rjf <fate...@xxxxxxxxx> wrote:

As far as providing adequate arithmetic for Trefethen's
challenges, I suspect it is an additional credit to the
providers of solutions in Mathematica that they were
not tripped up by Mathematica's arithmetic;

On the contrary, this goes straight to my main point.
Nine of the ten Trefethen challenge problems require
only machine precision in the solution; the need for
arbitrary precision in applied situations is quite
rare in practice.

I had misremembered the challenge -- I thought it was to get 100
digits of the solution,
not 10 problems, each 10 digits.

The need for arbitrary precision is, I agree, unusual in current
scientific computing practice. And so the need for Mathematica's
arithmetic -- other than ordinary machine arithmetic -- is rare. It
is, of course, a problem doing certain kinds of mathematics with
floats -- exact rationals are sometimes required. Wolfram's first
foray into computer algebra system building, SMP, made the substantial
mistake of approximating rationals with floats, and printing as though
they were rationals. That is, 1/3 was converted to 0.333333...4
but was printed as 1/3. Taylor series with exact coefficients could
not be believed.

So if you and the solvers are simply touting their own cleverness plus
the machine-arithmetic subroutine library of Mathematica, it doesn't
say much about significance arithmetic.


You can look through Stan Wagon's
solutions:http://stanwagon.com/wagon/Misc/SIAMchallenge.html

On several of the problems he used WorkingPrecision
option of NDSolve in a second, check solution or to
obtain even more digits than requested. On only one
problem (#2) was arbitrary precision required to get
the correct solution. That particular problem
involved a photon bouncing off a succession of circular
mirrors; a small error accumulates with each reflection.
Stan solved the problem by simply starting with high
precision input and allowing Mathematica's significance
arithmetic to keep track of the Precision. Via
experimentation, he discovered that a starting
Precision of 50 was sufficient to guarantee a 10
correct digits at the finish. I think this is
exactly what we want significance arithmetic to do.

Well, if he had NOT had significance arithmetic, he could have done
the problem a certain number of times with increasing initial
precision, ( a heuristic recommended to me was to use N digits then N
+sqrt(N), etc) and when two (or maybe more) successive answers were
the same to 10 digits, he could stop.
Now which method would be faster? I would expect the significance
arithmetic would be slower both because each arithmetic operation
would be cluttered with extra computation, and also because the
significance arithmetic, if done "correctly" would be somewhat
pessimistic about how many digits are right, so perhaps more trials
would be needed.






If CAS are to be used for long sequences of
calculations typical of some kinds of scientific
calculation, which are, I contend, more like the
iterations I've suggested than the 1-2 or 3 arithmetic
ops I've done in physics labs, then the arithmetic must
be appropriate for such calculations.

You can iterate the logistic function a million times
if you want. If you start with a machine number, all
subsequent computations will be done in machine
arithmetic; you might as well be using Matlab or C.
High precision has nothing to do with it. Of course,
the results are completely meaningless after 50
iterations or so, since you lose about one bit of
Precision with each step. If you first set the
Precision of the starting point, you'll find that
Mathematica correctly deduces that fewer and fewer
digits of the result are correct.

Now, depending on the function, it certainly can happen
that high precision kicks in. I don't particularly
care for this feature and I suspect that you would
agree. Here's one of my least favorite examples:
f = Compile[x, x^2];
Precision /@ NestList[f, 2.0, 12]

In this example, the first 9 results are machine
precision numbers. Subsequent terms are larger
than $MaxMachineNumber on my 32 bit machine.
Mathematica automatically switches to arbitrary
precision to evaluate the result. Now, why
would I go to the trouble to use Compile, if I
wanted to use arbitrary precision? I would prefer
to catch an error and deal with the problem on my
own.

I think you miss the point. When an iteration (say a Newton-like
iteration) is programmed using ordinary arithmetic, there is a chance
that it will converge when the Mathematica significance version will
not. You do not need some kind of diabolical computation to make
Mathematica fail. You need to be keenly aware of Mathematica's
arithmetic to prevent some (not all) iterations from going awry -- by
erasing all significance erroneously. You have to reset Accuracy "by
hand".



I think we disagree on the big picture. I find
the above example to be a small annoyance in what
is a very large and generally outstanding system.

A large system that messes up arithmetic?

RJF

Mark

.



Relevant Pages

  • Re: A NEW (draft) review of Mathematica (6)
    ... That's what mathematica says, and some people may believe it. ... if 20 digits are known at the start, ... You can also emulate fixed precision calculations: ... Significance arithmetic is inspired by a physics lab where you are ...
    (sci.math.symbolic)
  • Re: 0^0 oh no!
    ... you'd use SetPrecision to tell the system to ... in Mathematica one would typically use SetPrecision if coding ... For languages that work in fixed precision (I think ... think typically one would, at the finish of an iterative algorithm, ...
    (sci.math.symbolic)
  • Re: [OT] Re: Offshore Outsourcing
    ... >> precision of ordinary measurements in the laboratory. ... I was in fact outraged when one of my kid's teachers told me at PTA ... I've just reinvented Mathematica, ... invented by a genius who is a surd in an irrational world, ...
    (comp.programming)
  • Re: How to increase Working Precision?
    ... arbitrary precision in applied situations is quite ... not 10 problems, each 10 digits. ... better off using fixed precision. ... the machine-arithmetic subroutine library of Mathematica, ...
    (sci.math.symbolic)
  • Re: Calculation of critical p-, z-, t- and F-values
    ... attempts to give a result with n-digit precision. ... many figures it did the calculations to. ... Mathematica, may be a Mathematica expert can comment on this. ... point arithmatics as well if you want by setting some global options at the ...
    (sci.stat.math)