Sage does have the Gamma function implemented for real and complex arguments, but it does not seem able to treat it as a symbolic function which can be passed to maxima. Is that something which could be changed?
sage: factorial(5) 120 sage: factorial(5) == gamma(6) True sage: gamma(2.3) 1.16671190519816 sage: gamma(2.3+4.5*I) 0.00134894116108760 - 0.0333573062633992*I sage: gamma(x) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) (etc) John 2008/4/23 William Stein <[EMAIL PROTECTED]>: > > > On Tue, Apr 22, 2008 at 5:47 PM, Helio Perroni Filho <[EMAIL PROTECTED]> > wrote: > > Hello all, > > > > I've been trying to use SAGE to find the positive infinity limit of this > > function: > > > > f(x) = ln(x^x) / ln(x!) > > > > However, if I try defining it in SAGE like this: > > > > f(x) = ln(x^x) / ln(factorial(x)) > > > > I get the following error message: > > > > --------------------------------------------------------------------------- > > <type 'exceptions.TypeError'> Traceback (most recent call > last) > > > > /Users/erios/<ipython console> in <module>() > > > > /Applications/SAGE/local/lib/python2.5/site-packages/sage/rings/arith.py in > > factorial(n, algorithm) > > 273 Z = integer_ring.ZZ > > 274 if algorithm == 'gmp': > > --> 275 return Z(n).factorial() > > 276 elif algorithm == 'pari': > > 277 return Z(pari('%s!'%Z(n))) > > > > /Users/erios/integer_ring.pyx in > > sage.rings.integer_ring.IntegerRing_class.__call__() > > > > <type 'exceptions.TypeError'>: unable to convert x (=x) to an integer > > > > I have tried several variations of the above code, including alternative > > ways to define the function, but they all stumble, one way or the other, in > > an apparent inability of SAGE to convert a SymbolicVariable into an > Integer. > > Is there some way to corner SAGE into converting a SymbolicVariable into an > > Integer, or to avoid having to – perhaps with a symbolic-calculus-friendly > > factorial function? > > Unfortunately, there is currently no support for a symbolic version > of factorial in Sage. Even if there were one, Maxima (which sage uses > in this case to compute the limit) asks all kinds of (annoying) interactive > questions. So here's how to do it in Maxima (which comes with Sage), > where I literally type "positive;" below in each case. > > sage: !maxima > (%i2) limit(log(x^x)/log(x!), x, inf); > Is x! positive or negative? > positive; > Is x (2 log(x) - 2) + log(x) positive, negative, or zero? > positive; > (%o2) 1 > (%i3) > > Yes, the interactive nature of Maxima above is incredibly clunky. > It is on our list to somehow deal with this in a much better way. > > -- William > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---