On Oct 7, 8:45 am, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> On Mon, Oct 6, 2008 at 6:50 PM, SK <[EMAIL PROTECTED]> wrote:
> > Now, I try and compute X * (X^(-1)). Instead of getting an identity
> > matrix, I get a complicated matrix in x, y and z. Thinking that the
> > "^" may be the issue, I tried X * (X.inverse()), but got the same
> > issue.
>
> > Am I doing something wrong? Or is there a way to simplify and reduce
> > it to an identity matrix? I tried Y = X * (X.inverse()) and then
> > Y.simplify(), but it did not help.
>
> The simplification routine you want is simplify_rational. This
> notation / simplification comes from Maxima. For example,
>
> sage: x,y,z = var('x,y,z')
> sage: X = matrix( [ [x, y, z], [y, z, x], [z, x, y] ])
> sage: Y = X*X^-1
> sage: Y.simplify_rational()
> [1 0 0]
> [0 1 0]
> [0 0 1]
>
> Note you could do this by calling simplify_rational on each of the
> elements of the matrix. The method that allows you to do this is
> apply_map(). It takes in a function and replaces each entry with the
> result of calling that function on the entry.
>
> sage: Y.apply_map(lambda a: a.simplify_rational())
> [1 0 0]
> [0 1 0]
> [0 0 1]
>
> --Mike
What about this for a not-quite solution?
sage: R.<x,y,z>=QQ[]
sage: X = matrix( [ [x, y, z], [y, z, x], [z, x, y] ])
sage: Y = X*X^-1
sage: Y
[(-1)/(-1) 0 0]
[ 0 (-1)/(-1) 0]
[ 0 0 (-1)/(-1)]
John
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---