Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#660 double factorial defn incorrect for noninteger operand

closed
nobody
Lisp Core (472)
3
2008-09-27
2004-12-30
Robert Dodier
No

The double factorial x!! yields an incorrect result for
x other than an integer. It appears that x!! is
computed as the product x*(x-2)*(x-4)*...*y, where y is
the least term (x-2*k) s.t. x-2*k > 1. This agrees with
published defns (Arfken, Mathworld) for positive
integers but not otherwise.

Mathworld
(http://mathworld.wolfram.com/DoubleFactorial.html)
states a formula for z!!, z complex, translated into
Maxima as follows --

doublefact (z) := block ([a: 1+2*z-cos(%pi*z), b:
cos(%pi*z)-1], 2^(a/4) * %pi^(b/4) * gamma(1+z/2));

It seems that Maxima could evaluate this function for
noninteger arguments.

Note that Maxima translates input x!! into an noun form
genfact (x, x/2, 2).

Discussion

  • Dieter Kaiser
    Dieter Kaiser
    2008-09-21

    In a first step (asum.lisp, Rev. 1.30) the numerical evaluation of the function genfact(x,y,z) is specialized to integer arguments within the following range

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

    For non valid integers a Maxima error is thrown. For all other numbers Maxima returns a noun form.

    With this changes Maxima no longer calculate wrong results.

    To get more general results for real and complex values for the Double factorial function a new function factorial_double has been suggested on the mailing list.

    Because Maxima no longer gets incorrect results this bug report could be closed.

    Dieter Kaiser

     
  • Dieter Kaiser
    Dieter Kaiser
    2008-09-27

    • status: open --> closed
     
  • Dieter Kaiser
    Dieter Kaiser
    2008-09-27

    Closing this bug report. The function $genfact(x,y,z) no longer gives wrong results.

    A function factorial_double has been implemented.

    Dieter Kaiser

     
  • Dieter Kaiser
    Dieter Kaiser
    2008-09-27

    Change resolution to "fixed".