format(n,"s")→s
expr(right(s,dim(s)-instring(s,"")))→e
return {n*(10^⁻e),e}
EndFunc
If the list returned by mantexp() is stored to foo, then use foo[1] to get the mantissa, and foo[2] to get
the exponent.
Some examples:
mantexp(0)
returns {0,0}
mantexp(1)
returns {1,0}
mantexp(100)
returns {1,2}
mantexp(1.23E17)
returns {1.23,17}
mantexp(-456E-100)
returns {-4.56,102}
mantexp() works by converting the input argument to a string in scientific notation, then the exponent is
extracted based on the location of the 'E' character in the string. The mantissa is found by dividing the
original argument by 10^(exponent). While the mantissa could also be found from the string in scientific
notation, two least-significant digits would be lost, since the format() function only returns, at most, 12
significant digits.
[6.59] Accelerate series convergence
Most mathematical functions can be expressed as sums of infinite series, but often those series
converge far too slowly to be of computational use. It turns out that there are a variety of methods that
can be used to accelerate the convergence to the limit. Different methods are effective for different
series, and an excellent overview is presented by Gourdon and Sebah in reference [1] below. As that
paper is quite thorough, I will rely on it for background and just present a TI Basic program which
implements one algorithm for accelerating convergence: Aitken's -process.
✑
2
Aitken's method constructs a series of partial sums, which may converge faster then the original terms.
It is basically an extrapolation process which assumes geometric convergence, so, the closer the
convergence is to geometric, the better Aitken's method works. If s
0
, s
1
and s
2
are three successive
partial sums (not terms!) of a series, then Aitken's acceleration of the sum is
s
∏
= s
0
−
s
0
−s
1
2
s
0
−2
$
s
1
+s
2
Some references give a different but algebraically equivalent form of the this equation, but this one is
less susceptible to round-off errors, according to reference [3] below. You can actually repeat this
process on the series of s' terms, but that usually doesn't increase the accuracy much.
aitkend2(l)
Func
©(terms list); returns {sn,delta}
©Accelerate series w/Aitken's δ^2 method
©11jul02/dburkett@infinet.com
local i,n,s,s0,s1,s2,s3,sa,sb
dim(l)→n
seq(sum(left(l,i)),i,1,n)→s © Series of partial sums
6 - 112