Re: How to increase Working Precision?
- From: Daniel Lichtblau <danl@xxxxxxxxxxx>
- Date: Mon, 10 Mar 2008 09:05:37 -0700 (PDT)
On Mar 9, 9:54 pm, rjf <fate...@xxxxxxxxx> wrote:
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.
People have done these problems to 100 and more digits. Actually I
think all but one have been done to 10,000 digits.
Problem 2 benefits nicely from significance arithmetic.
Problem 7, if done with a conjugate gradient solver, will benefit from
fixed precision. A few of the others (6,8,10) can also be approached
via linear algebra solvers and, when done in that way, are probably
better off using fixed precision. But frankly I'd be surprised if any
of them can be solved to more than a few dozen correct digits via
numerical linear algebra.
Problem 4 solutions can be verified via interval arithmetic. Offhand I
am not certain whether such a verification can be attempted using
significance arithmetic. I am quite sure fixed precision would be
helpless here.
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[...]
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.
When going to higher precision, some of the software assistance of
importance is in numerical evaluation of various special functions to
high precision. This does not involve significance arithmetic per se,
but rather the capability to obtain correct high precision results
from such evaluations. One might attempt this using fixed precision
code, along with the tactic you espouse (below), of raising precision
and checking for stabilization of digits. This usually works (though
there are interesting, if pathological, counterexamples in the
literature). But if Mathematica is used directly, internal algorithms
that use precision ratcheting and various expansions tend to be quite
reliable, at least for those special function evaluations required to
do several of the Trefethen's SIAM challenge problems to high
recision. I regard these methods of function evaluation to be an
extension of significance arithmetic; I will grant you that is simply
an opinion.
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.
This sort of computation tends not to be terribly pessimistic. I'm not
sure the speed hit for significance arithmetic was terribly high
either. (I have seen computations where I believe it is high, but this
was not one of them.)
[...]
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 will point out (you both probably realize this) that the issue here
is unrelated to use of significance arithmetic. It is a part of the
effort to have "seamless" arithmetic, so when machine arithmetic fails
Mathematica resorts to arbitrary precision.
The fact that significance arithmetic is used for the arbitrary
precision computations could be viewed as a further degradation of
what the user wants. One sees this effect in the gradual lowering of
precision in the last few results of that NestList. As I imagine you
both realize, tehre are fairly straightforward workarounds. But I
agree there may be cases where the automatic behavior is not to
everyone's liking.
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 assume by "ordinary" you mean fixed precision, that is, no error
tracking. Yes, there are iterations where resetting precision, or use
of a fixed precision block, as pointed out a few notes back in this
thread, is required. I will say that I do not run across them too
often, but then I tend not to get the most hard core of numerical
programming queries.
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
Ummmm, that last would be an opinion, no? I really do not think you
have presented a case whereby everyone will automatically agree with
that assessment.
Daniel Lichtblau
Wolfram Research
.
- Follow-Ups:
- Re: How to increase Working Precision?
- From: Richard J. Fateman
- Re: How to increase Working Precision?
- References:
- How to increase Working Precision?
- From: Paul J Salmon
- Re: How to increase Working Precision?
- From: Nasser Abbasi
- Re: How to increase Working Precision?
- From: rjf
- Re: How to increase Working Precision?
- From: Nasser Abbasi
- Re: How to increase Working Precision?
- From: sashap
- Re: How to increase Working Precision?
- From: rjf
- Re: How to increase Working Precision?
- From: marks@xxxxxxxxxxx
- Re: How to increase Working Precision?
- From: Christopher Creutzig
- Re: How to increase Working Precision?
- From: rjf
- Re: How to increase Working Precision?
- From: mcmcclur
- Re: How to increase Working Precision?
- From: rjf
- Re: How to increase Working Precision?
- From: mcmcclur
- Re: How to increase Working Precision?
- From: rjf
- How to increase Working Precision?
- Prev by Date: Re: How to increase Working Precision?
- Next by Date: Re: How to increase Working Precision?
- Previous by thread: Re: How to increase Working Precision?
- Next by thread: Re: How to increase Working Precision?
- Index(es):
Relevant Pages
|