# inverse of a matrix with Fraction entries

Wed Nov 24 19:10:10 CET 2010

```>> It's a mathematical problem so no uncertainty is present in the
>> initial values. And even if there was, if there are many orders of
>> magnitude differences between the entries in the matrix floating point
>> does not suffice for various things like eigenvalue calculation and
>> stuff like that.
>
> Well, if you want to do eigenvalue calculations, you are going to have to
> start
> doing numerical approximations anyways. There is no analytical solution for
> matrices larger than 4x4.

Sure! (I didn't explain the whole thing yet, see the other reply where
I actually do.)

> Sympy will do inverses of matrices over rationals for you, though:
>
> |4> from sympy import *
>
> |6> m = Matrix([[S(1)/2, S(1)/3], [S(1)/4, S(1)/5]])
>
> |7> m
> [1/2, 1/3]
> [1/4, 1/5]
>
> |8> m.inv()
> [ 12, -20]
> [-15,  30]

Thanks a lot! This sounds like the simplest solution so far.
I don't need to call Maple after all :)

Cheers,
Daniel

--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

```