I'm updating the specfun package and I'm seeking input on two
problems and taking suggestions for new features. First, the
problems.
--------------------------------------------------------------
1. Numerical Accuracy
The new code uses running error analysis to determine an upper bound for
the error of floating results. The *experimental* version uses a global
variable
specfun_float_error to store the error estimate for the *last* numerical
evaluation; here's a short demonstration
(C1) hermite(10,0.1);
...error estimate <= 1.7019644352535596e-10
(D1) - 27256.15895029764
(C2) specfun_float_error;
(D2) 1.70196443525356e-10
(C3) laguerre(20,0.8);
...error estimate <= 4.144101532731857e-15
(D3) .2253727472612855
(C4) specfun_float_error;
(D4) 4.14410153273186e-15
This approach isn't very good; I'd much prefer that Maxima support a
datatype "float-point-interval". Is somebody interested
and willing to blend a floating-point-interval type into Maxima? Or does
somebody have a better idea for handling floating point errors?
Until I have a decent solution, I don't want to release a new version.
---------------------------------------------------------
2. 0^0 errors in summations
Inside a summation, we'd almost always like 0^0 to evaluate to 1; (see
Knuth, "Concrete Mathematics")
however, this isn't the case in Maxima
(C8) sum(x^k,k,0,n);
n
====
\ k
(D8) > x
/
====
k = 0
(C9) [subst(0,x,%),ratsubst(0,x,%),ev(%,x=0)];
(D9) [0, 0, 0]
(C10)
Does anybody have a fix?
I encountered this problem because specfun (when requested) returns a
summation; this feature (potentially) allows specfun to simplify special
values of the orthogonal polynomials (legendre_p(n,1) => 1).
Would it be better to scrap the series representation and define a
simplification function for each orthogonal polynomial that "knows" the
special values? I'm leaning towards this solution; one downside is that
it increases the number of special cases -- and the possibility
for bugs. [In the new version, functions hypergeo11 and hypergeo21 do
most of
the work.]
---------------------------------------------------------
If you have suggestions for the new version, let me know. Currently, new
or
improved features (partially finished) of specfun include
(i) improved floating point algorithms with error bounds,
(ii) TeX and displa support for each function
(C1) legendre_p(m,x);
(D1) P (x)
m
(C2) tex(%);
$$P_{m}\left(x\right)$$
(D2) FALSE
(iii) "knowledge" of some recursion relations
(C3) legendre_p_recur(m,x);
(2 m - 1) P (x) x + (1 - m) P (x)
m - 1 m - 2
(D3) P (x) = -----------------------------------------
m m
(iv) improved handling of unknown derivatives
(C5) diff(legendre_p(m,x),m);
Maxima doesn't know the derivative of legendre_p with respect the first
argument
-- an error. Quitting. To debug this try DEBUGMODE(TRUE);)
(C6)
Incidentally, commercial Macsyma miss-handles this case and it causes a
bug:
(c9) legendre_p[n](n);
(d9) legendre_p (n)
n
(c10) diff(%,n);
n (legendre_p (n) - n legendre_p (n))
d n - 1 n
(d10) -- (legendre_p (n)) + -----------------------------------------
dn n 2
1 - n
(c11) diff(%,n);
2
d d
(d11) --- (legendre_p (n)) + n (- n (-- (legendre_p (n)) + ....
2 n dn n
dn
(v) updated user documentation.
One last thing: I think orthopoly is better name than is specfun;
would it be okay to change it?
Barton