matrix inverse for a matrix of variables

524 views
Skip to first unread message

Amelia Taylor

unread,
Nov 6, 2009, 12:46:46 PM11/6/09
to Macaulay2

Hi.

I am translating some work from Mathematica to M2 (better for many
reasons, except 1) and I need to be able to compute the inverse of a
matrix of variables. The current implementation of matrix inverse in
M2 won't allow this, it returns the message "error: matrix not
invertible". This is, of course true, if I put in the wrong entries,
but generically the matrix is invertible and I need to see it and,
actually perform other operations on that matrix.

Thoughts? I'm stuck with Mathematica until we find a way to do
this...

Thanks,
Amelia

Baptiste Calmès

unread,
Nov 6, 2009, 1:04:26 PM11/6/09
to maca...@googlegroups.com
Hi,

Le 6 nov. 2009 à 17:46, Amelia Taylor a écrit :
> Hi.
>
> I am translating some work from Mathematica to M2 (better for many
> reasons, except 1) and I need to be able to compute the inverse of a
> matrix of variables. The current implementation of matrix inverse in
> M2 won't allow this,

I'm not sure what you mean by that. Macaulay 2 matrices have
coefficients in a ring, and it will try to invert the matrix in that
ring. If you want to work with a matrix with generic coefficients and
invert it, you probably need to work over the fraction field of the
ring of polynomials with coefficients as indeterminates, as in the
following session:

i1 : R=QQ[a,b,c,d]

o1 = R

o1 : PolynomialRing

i2 : S = frac R

o2 = S

o2 : FractionField

i3 : M=matrix{{a,b},{c,d}}

o3 = | a b |
| c d |

2 2
o3 : Matrix S <--- S

i4 : inverse M

o4 = {1} | -d/(bc-ad) b/(bc-ad) |
{1} | c/(bc-ad) -a/(bc-ad) |

2 2
o4 : Matrix S <--- S

I hope this helps.

Baptiste

Amelia Taylor

unread,
Nov 6, 2009, 2:24:28 PM11/6/09
to Macaulay2

Of course that is what I mean and is exactly what I need to do.

Thanks. Silly me.

- ameia

Greg

unread,
Nov 9, 2009, 12:01:33 PM11/9/09
to Macaulay2
Sometimes one wants to work over a polynomial ring rather than its
fractions field.
In this case, one can often replace the inverse of a generic matrix G
with its classical
adjoint, namely det(G)*G^{-1}. The second problem in fourth chapter
of Computations
in algebraic geometry with Macaulay 2 book illustrates this idea; see

http://www.math.uiuc.edu/Macaulay2/Book/ComputationsBook/chapters/schemes/chapter-wrapper.pdf


-- Greg.

Daniel R. Grayson

unread,
Nov 9, 2009, 12:08:02 PM11/9/09
to maca...@googlegroups.com
Following up on that idea, to compute the classical adjoint, it might
be quicker to compute the n-1-st exterior power (see exteriorPower),
and then correct the signs and the indexing.
Reply all
Reply to author
Forward
0 new messages