# Linear algebra methods?

16 views

### Francesca Gandini

Apr 3, 2022, 6:16:41 PMApr 3
to Macaulay2
Hi everyone,

I was trying to do some linear algebra computations in M2 and I found in the documentation some available methods, but my guess is that these are all numerical?

In particular, given a (integer) matrix M
characteristicPolynomial M
is not defined. I quickly wrote a function for this but it really seems like this is something that should be there? Especially since there is already a characteristicPolynomial method but it only works for posets.

Then to compute eigenvalues and eigenvectors, I was able to use the methods eigenvalues and eigenvectors but they provide approximations for all the complex numbers. I had hoped that working in a ring with the appropriate root of unity needed (like QQ[z]/(z^3-1) if we know the eigenvalues will involve third roots of unity) would then give eigenvectors and eigenvalues symbolically in terms of the appropriate root of unity, but it looks like the methods eigenvalues and eigenvectors only work for matrices over basic rings of numbers.

Is there some package am I missing? I guess I am looking for in M2 something like this documentation in SageMath. https://doc.sagemath.org/html/en/constructions/linear_algebra.html
but then I guess the answer is that one needs to call onto Maxima or GAP?

I was also trying to think about writing my own methods for this working with the characteristic polynomial and using "factor" or trying to find "primes" over some ring of algebraic integers but those methods are not implemented for such coefficient fields.

Am I missing something obvious or these are genuinely computationally hard things that have not been implemented yet?

### Francesca Gandini

Apr 3, 2022, 7:20:52 PMApr 3
PS: To make this super concrete, is there a way in which I give M2

R = QQ[z,x]/(z^3-1)
f = x^3 - z^3

and then I get M2 to factor f as (x-z)(x-z^2)(x-z^3)?

I am 70% sure that Maple was able to do this, but I am not sure what algorithm it used.

--
You received this message because you are subscribed to a topic in the Google Groups "Macaulay2" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/macaulay2/CIs70jorIzU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to macaulay2+...@googlegroups.com.

--
 Francesca Gandini, PhD Visiting Assistant Professor of Mathematics, Kalamazoo College Physical Address: OLDU 203E, 1200 Academy St Virtual Office: (password: drg)

### jche...@gmail.com

Apr 3, 2022, 11:34:55 PMApr 3
to Macaulay2
Hi Francesca,

In theory factorization in (rings of integers of) number fields is a special case of primary decomposition and thus can be done in Macaulay2, although in practice this is a bit spotty. One way to handle the example you gave is by using toField:

k = toField(QQ[z]/(z^2+z+1))
R = k[x]
f = x^3 - z^3
toList factor f /value

For comparison, here is a way to do it through primary decomposition:

S = QQ[z,x]/(z^2 + z + 1)
primaryDecomposition ideal(x^3 - z^3)

Re characteristicPolynomial: initially it might be a bit surprising that there is no built-in method for this, but likely the most troublesome part of getting the characteristic polynomial is defining the new variable the polynomial is in (e.g. like how "hilbertPolynomial" with "Projective => false" creates a new variable "i" by default). Once this is done, it's probably quicker to type det(x*id_(k^n) - A)...

Justin