Hello,

Sympy provides it's own matrices.  As mentioned before, there needs to
be more work done with sympy in Sage so that what you tried does work.
 In the meantime, look at the following example:

sage: import sympy
sage: x = sympy.Symbol('x')
sage: m = sympy.Matrix([[1,x],[x,1]])
sage: m
1 x
x 1
sage: m^int(2)
1 + x**2 2*x
2*x 1 + x**2

--Mike

On Dec 31, 2007 11:00 AM, pgdoyle <[EMAIL PROTECTED]> wrote:
>
>
> > > sage: var(x)
> > > x
> > > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).rational_simplify() for i
> > > in xrange(100))
> > > 200
> > > CPU time: 5.29 s, Wall time: 39.10 s
> > > sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,100)')
> > > 200
> > > CPU time: 0.02 s, Wall time: 0.55 s
> >
> > Those times above are really weird. On my laptop (OSX 10.5.1):
> >
> > sage: var(x)
> > x
> > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).rational_simplify() for i
> > in xrange(100))
> > 200
> > Time: CPU 0.97 s, Wall: 3.20 s
> > sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,100)')
> > 200
> > CPU time: 0.01 s, Wall time: 0.34 s
> >
> > Thus it takes 3.2 seconds wall time instead of 39.10 seconds for me.
> >
>
> This was on an old, slow machine, and maybe there is thrashing because
> there isn't much RAM.
>
>
> >
> > But sympy is still way faster and is symbolic:
> >
> > sage: from sympy import Symbol, sin
> > sage: x = Symbol('x')
> > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).expand() for i in xrange(100))
> > 200
> > Time: CPU 0.09 s, Wall: 0.09 s
> >
> > which is why it's a good thing that sympy is the future of symbolic
> > computation in Sage :-).
> >
>
> This sounds promising.
>
> > And since Sympy comes with Sage, maybe you can use it for
> > your intended application right now?!
> >
>
> My intended application involves working with matrices, and I it looks
> like this isn't going to work with sympy:
>
> sage: from sympy import Symbol
> sage: x = Symbol('x')
> sage: m=matrix([[x]])
> Traceback (most recent call last):
> ...
> AssertionError: <class 'sympy.core.symbol.Symbol'>
>
>
> Cheers,
>
> Peter Doyle
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to