# [Maxima] Maxima 5.17.1 regressions for Sage

Dieter Kaiser drdieterkaiser at web.de
Mon Dec 22 11:41:12 CST 2008

```I have introduced the argument check for genfact to restrict the calculation to
a valid range of integers. The reason was that we have got wrong results for
general integers or float values.

This was the explanation for the restriction on the mailing list:

--------------------------
We know from the algorithm that the general factorial is evaluated as

genfact(x,y,z) := product(x-k*z, k, 0, y-1)

The argument z can be interpreted as a stepsize and the argument y as the number
of terms for which we have to expand the product.

We get for n a positve integer and a stepsize of 1 the following:

genfact(n,n,1)     = n!;
genfact(n,(n-1),1) = n! / 1;
genfact(n,(n-2),1) = n! / (1 * 2);
genfact(n,(n-3),1) = n! / (1 * 2 * 3);
.
.
.
genfact(n,(n-(n-1),1) = n;
genfact(n,0,1)        = 1;

For a stepsize of 2 we get results which correspond to the Double factorial for
n a positive integer.

I think the function genfact(x,y,z) is defineable for the following ranges of
values:

x,y,z positive integer and z <= x and y <= x/z.
--------------------------

For integers not in the range above, the algorithm calculate a result, but it is
wrong. When I am correct an error of genfact shows a call with wrong arguments.
This has been corrected for the function spherical_harmonic.

Dieter Kaiser

-----Ursprüngliche Nachricht-----
Von: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] Im
Auftrag von Barton Willis
Gesendet: Montag, 22. Dezember 2008 17:38
An: Robert Dodier
Cc: Maxima List; Michael Abshoff; William Stein
Betreff: Re: [Maxima] Maxima 5.17.1 regressions for Sage

Reported and fixed sometime ago:

(%i3) spherical_harmonic(3,2,x,y);
(%o3) 15*sqrt(7)*cos(x)*sin(x)^2*%e^(2*%i*y)/(4*sqrt(30)*sqrt(%pi))
(%i4) build_info();

Maxima version: 5.16post
Maxima build date: 6:30 12/19/2008
host type: i686-pc-mingw32
lisp-implementation-type: SBCL
lisp-implementation-version: 1.0.22

Barton

```