Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

gen_laguerre wraps maxima's function with the same name. In maxima, if you enter gen_laguerre(5,6,x), for example, you get a polynomial in x, and this is what the sage function is intended for.

If you enter in maxima gen_laguerre(n,a,x) it will accept it and spit gen_laguerre(n,a,x) back at you, and will later know how to differentiate it with respect to x, for example, but this capability is currently not wrapped in sage. You can work directly with maxima objects:

sage: f = maxima('gen_laguerre(n,a,x)')
sage: f.diff(x)
(n*gen_laguerre(n,a,x)-(n+a)*gen_laguerre(n-1,a,x)*unit_step(n))/x

but if you only intend to evaluate your function later, and not use symbolic manipulations (such as diff), you can create a python function instead of a symbolic object:

sage: f = lambda n,a,x:gen_laguerre(n,a,x)
sage: f(3,4,5)
-10/3

BTW, this is the code of gen_laguerre:

sage_eval(maxima.eval('gen_laguerre(%s,%s,x)'%(ZZ(n),a)), locals={'x':x})

so you see that n is evaluated to an integer. If you do

maxima.eval('gen_laguerre(n,a,x)')

instead you will just get a string saying gen_laguerre(n,a,x) which is not very useful.