Accuracy and error analysis (was Re: [Maxima] primes)
Subject: Accuracy and error analysis (was Re: [Maxima] primes)
From: Richard Fateman
Date: Thu, 12 May 2005 10:47:40 -0700
ok, long explanation.
Consider the maxima definition
f[i,n]:=f[i-1,n]- (f[i-1,n]^2-n)/(2*f[i-1,n]);
This is a newton iteration for square root of n
Compute the square root of 1+d this way..
f[0,3]:1;
f[9,3]; --> 9 iterations towards sqrt(3).
next.. sqrt(1+d)
f[0,1+d]:1 /* initial guess */
f[2,1+d]; /*after 2 iterations */
(d/2) - (( - d + ((d/2) + 1)^2 - 1)/(2 * ((d/2) + 1))) + 1
which you can understand by
taylor(%,d,0,3) --> 1 +d/2 -d^2/8 + ....
so it is getting what I said it should get.
But look again at the formula. It takes advantage of
the fact that each occurrence of "d" is the same "d", and
thus d-d/2 is d/2. and other formulas might
make use of simplifications like (1-d)*(1+d) = 1-d^2.
In general, if maxima is doing
interval arithmetic with uncertainties, there is not just
one d. Each d is different. e.g. if you are talking about
one unit in the last place, then d might be a shorthand for something
like any number in [-1.0e-18, +1.0e-18]
In such a case d[1] -d[2]/2 is not d[3]/2 but a number in
an interval like [d/2, 3d/2].
and (1-d)^2 is (1-d[1])*(1-d[2]). Instead of getting
1-2d+d^2, you get something like +-(1+2|d| +d^2), which is
cruder than you'd like.
I hope I've conveyed a little of the problem.
Oh, and solving the newton iteration problem
so that you just solve that
one example does not automate all of error analysis...