Opened 6 years ago

Last modified 13 days ago

#17737 new defect

wrap Maxima's factorial/gamma conversions/expansions

Reported by: rws Owned by:
Priority: major Milestone: sage-9.4
Component: symbolics Keywords:
Cc: kcrisman, ktkohl, tmonteil, charpent Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by rws)

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 (8)

comment:1 Changed 6 years ago by rws

  • Description modified (diff)

comment:2 Changed 6 years ago by rws

  • Description modified (diff)

comment:3 Changed 6 years ago by rws

  • Milestone changed from sage-6.5 to sage-wishlist

comment:4 Changed 6 years ago by kcrisman

  • Cc kcrisman added

comment:5 Changed 6 years ago by ktkohl

  • Cc ktkohl added

comment:6 Changed 3 years ago by tmonteil

  • Cc tmonteil 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 3 months ago by charpent

  • Cc charpent added
  • Milestone changed from sage-wishlist to sage-9.3
  • Type changed from enhancement to defect

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 13 days ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

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

Note: See TracTickets for help on using tickets.