Hi,

I have written some code for the Maxima interface.
You can find the patches at:
  http://www.math.tugraz.at/~huss/sage

calculus1.patch implements the conversion from Maxima
matrices to Sage matrices.

calculus2.patch adds symbolic gamma and factorial functions.
(The factorial is named fact() so it doesn't clash with the
factorial in sage.rings.arith)

Finally calculus3.patch renames the symbolic factorial to factorial(),
and changes all imports of sage.rings.arith.factorial to
sage.calculus.calculus.factorial. I had to keep a renamed version
of the factorial function in sage.rings.arith to avoid circular
imports at startup.

The patches are against 3.2-alpha1, after applying all 3 patches
all tests passed.

Here is a sample session with the new functionality:

sage: var('x,y')
sage: v = maxima('v: vandermonde_matrix([x, y, 1/2])')
sage: v
matrix([1,x,x^2],[1,y,y^2],[1,1/2,1/4])
sage: type(v)
<class 'sage.interfaces.maxima.MaximaElement'>
sage: v.sage()

[  1   x x^2]
[  1   y y^2]
[  1 1/2 1/4]
sage: mlist = maxima('[v, sin(x), 1, v.v]').sage()
sage: mlist

[[  1   x x^2]
[  1   y y^2]
[  1 1/2 1/4],
    sin(x),
    1,
    [       x^2 + x + 1    x*y + x^2/2 + x    x*y^2 + 5*x^2/4]
[       y^2 + y + 1        3*y^2/2 + x  y^3 + y^2/4 + x^2]
[               7/4      y/2 + x + 1/8 y^2/2 + x^2 + 1/16]]
sage: [parent(i) for i in mlist]

[Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring,
    Symbolic Ring,
    Symbolic Ring,
    Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring]

sage: gamma(x/2)(x=5)
3*sqrt(pi)/4

sage: f = factorial(x + factorial(y))
sage: maxima(f).sage()
factorial(factorial(y) + x)

sage: f(y=x)(x=3)
362880

I hope it is useful.

Greetings,
Wilfried Huss

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to