On Mar 9, 2009, at 4:44 AM, David Joyner wrote:

> On Sun, Mar 8, 2009 at 1:43 PM, alex
> <alessandro.bernardini.1...@gmail.com> wrote:
>>
>> How can i compute the matrix multiplication (product) of two symbolic
>> matrices in sage ?
>>
>> I have tried:
>> A = maxima("matrix ([a, b], [c, d])")
>> AI= A.invert()
>>
>> and
>> A * AI
>> gives
>> matrix([a*d/(a*d-b*c),-b^2/(a*d-b*c)],[-c^2/(a*d-b*c),a*d/(a*d-b*c)])
>
>
> Do you want the following?
>
> sage: a,b,c,d = var("a,b,c,d")
> sage: A = matrix ([[a, b], [c, d]])
> sage: AI = A.inverse()
> sage: P = A*AI; P
>
> [a*d/(a*d - b*c) - b*c/(a*d - b*c)                                 0]
> [                                0 a*d/(a*d - b*c) - b*c/(a*d - b*c)]

sage: P.simplify_rational()

[1 0]
[0 1]



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to