Opened 8 years ago

Last modified 2 weeks ago

#17737 new defect

wrap Maxima's factorial/gamma conversions/expansions

Reported by: Ralf Stephan Owned by:
Priority: major Milestone: sage-9.8
Component: symbolics Keywords:
Cc: Karl-Dieter Crisman, Karen Kohl, Thierry Monteil, Emmanuel Charpentier Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Ralf Stephan)

To be most clear to the user (and staying in sync with current ticket discussions) I rather propose four functions:

  • gamma_to_factorial - use simplify_full(?)
  • factorial_to_gamma - use makegamma with maxima.eval("gamma_expand:true")
  • expand_gamma - e.g., gamma(n+1) --> n*gamma(n), use makegamma with maxima.eval("gamma_expand:false"), also gamma_expand
  • simplify_gamma - e.g., n*gamma(n) --> gamma(n+1), use makegamma with maxima.eval("gamma_expand:true"). Could be an alias to 2) or left out.

This ticket will *not include one of these in another simplify* function.

Change History (12)

comment:1 Changed 8 years ago by Ralf Stephan

Description: modified (diff)

comment:2 Changed 8 years ago by Ralf Stephan

Description: modified (diff)

comment:3 Changed 8 years ago by Ralf Stephan

Milestone: sage-6.5sage-wishlist

comment:4 Changed 8 years ago by Karl-Dieter Crisman

Cc: Karl-Dieter Crisman added

comment:5 Changed 7 years ago by Karen Kohl

Cc: Karen Kohl added

comment:6 Changed 4 years ago by Thierry Monteil

Cc: Thierry Monteil added

Such a feature would be awesome, in particular in a combinatorial context, it could be nice if Sage were able to transform gamma(n+1/2) into factorial(2n)/(4^n*factorial(n))*sqrt(pi), see e.g.

sage: var('k,n')
(k, n)
sage: assume(n,'integer')
sage: symbolic_product((2*k)^2-1,k,1,n)
2^(2*n + 1)*gamma(n + 3/2)*gamma(n + 1/2)/pi

comment:7 Changed 22 months ago by Emmanuel Charpentier

Cc: Emmanuel Charpentier added
Milestone: sage-wishlistsage-9.3
Type: enhancementdefect

As of 5.44.0, Maxima uses a genfact function that Sage may translate, but does not know how to use/evaluate explicitly :

sage: arccos(x).maxima_methods().powerseries(x,0).subs(x==0)
1/2*pi + sum(0^(2*i7 + 1)*genfact(2*i7 - 1, i7, 2)/((2*i7 + 1)*genfact(2*i7, i7, 2)), i7, 0, +Infinity)
sage: arccos(x).maxima_methods().powerseries(x,0).subs(x==0).simplify()
1/2*pi

sage: arcsin(x).maxima_methods().powerseries(x,0)
sum(x^(2*i2 + 1)*genfact(2*i2 - 1, i2, 2)/((2*i2 + 1)*genfact(2*i2, i2, 2)), i2, 0, +Infinity)
sage: genfact(3,2,2)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-19-b78e3f7f3947> in <module>
----> 1 genfact(Integer(3),Integer(2),Integer(2))

NameError: name 'genfact' is not defined

However, something in Sage seem to have some access to some definition of genfact :

sage: arccos(x).maxima_methods().powerseries(x,0).subs(x==0)
1/2*pi + sum(0^(2*i7 + 1)*genfact(2*i7 - 1, i7, 2)/((2*i7 + 1)*genfact(2*i7, i7, 2)), i7, 0, +Infinity)
sage: arccos(x).maxima_methods().powerseries(x,0).subs(x==0).simplify()
1/2*pi

But I'm unable to find where:

charpent@zen-book-flip:/usr/local/sage-9$ grep -lr genfact *
local/lib/ecl-20.4.24/maxima.fas
local/lib/fricas/target/x86_64-pc-linux-gnu/algebra/GHENSEL.fas
local/lib/maxima/5.44.0/binary-ecl/maxima
local/share/maxima/5.44.0/share/builtins-list.txt
local/share/maxima/5.44.0/share/orthopoly/orthopoly.lisp
local/share/maxima/5.44.0/tests/rtest15.mac
local/share/maxima/5.44.0/tests/rtest_gamma.mac
local/share/maxima/5.44.0/doc/html/index.hhk
local/share/maxima/5.44.0/doc/html/maxima_363.html
local/share/maxima/5.44.0/doc/html/maxima_364.html
local/share/maxima/5.44.0/doc/html/maxima_singlepage.html
local/share/maxima/5.44.0/doc/html/maxima_50.html
local/share/maxima/5.44.0/src/nparse.lisp
local/share/maxima/5.44.0/src/simp.lisp
local/share/maxima/5.44.0/src/series.lisp
local/share/maxima/5.44.0/src/asum.lisp
local/share/maxima/5.44.0/src/suprv1.lisp
local/share/maxima/5.44.0/src/option.lisp
local/share/info/maxima.info-1
local/share/info/maxima-index.lisp
local/share/info/maxima.info
local/share/info/maxima.info-3
local/share/emacs/site-lisp/maxima-font-lock.el

This is a defect, but quite consonant to the current "wishlist". Modifying the ticket as needed.

comment:8 Changed 20 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:9 Changed 15 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:10 Changed 10 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:11 Changed 5 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:12 Changed 2 weeks ago by Matthias Köppe

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.