ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Nov 2017 22:45:59 +0100Random matrix satisfying a given polynomialhttps://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/ If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0?
I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.Wed, 22 Nov 2017 11:38:13 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/Comment by dan_fulea for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39722#post-id-39722Let us just consider a simple example, $f(x)=x^2+1$. It is relatively simple to construct matrices of any order **over $\mathbb C$** having a diagonal normal form with only $+\pm 1$ on the diagonal. But if we insist to have a $1\times 1$ or a $3\times 3$ matrix with **real** entries and a minimal polynom dividing $x^2+1$\dots well, there are Galois theory obstructions. For instance, for a $3\times 3$ real matrix $A$, we build its characteristic polynomial, $f_A$, say, get $f_A(A)=0$. Suppose we also have $f(A)=AA+1=0$, $f(x)=x^2+1$ as above. Then division with rest of $f_A\in \mathbb R[x]$ by $f$ cannot give a rest of degree one, or of degree zero (constant), because such a polynomial cannot have a root $\pm i$. If the rest is $0$, then the third root is real. Please restate the question.Wed, 22 Nov 2017 11:53:47 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39722#post-id-39722Comment by tmonteil for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39723#post-id-39723When you write "random", do you mean that you want to be able to sample various matrices w.r.t some distribution or do you just want to find one particular solution ?Wed, 22 Nov 2017 12:34:36 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39723#post-id-39723Comment by Deepak Sarma for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39728#post-id-39728I want a particular solution. Suppose I want to get an example of a $5 \times 5$ matrix $A$ with real entries that satisfies $A^4+3*A-2*A+I=0$Wed, 22 Nov 2017 18:06:58 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39728#post-id-39728Comment by dan_fulea for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39729#post-id-39729Whichi is exactly the given polynomial of degree four?
- $f=x^4+3x^3-2x+1$ or
- $f=x^4+3x^2-2x+1$ or
- $f=x^4+3x-2x+1$ ?Wed, 22 Nov 2017 18:30:52 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39729#post-id-39729Comment by Deepak Sarma for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39731#post-id-39731Sorry, I typed it wrong, I meant of the first polynomial you have written. But its immaterial, I just need an example how to construct such an example. you can consider any of the above polynomial(or any other suitable polynomial) to illustrate.Wed, 22 Nov 2017 19:28:36 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39731#post-id-39731Comment by dan_fulea for <p>If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0? </p>
<p>I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.</p>
https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39736#post-id-39736The roots of the polynomial $f=x^4+3x^3-2x+1$ are as follows:
sage: f = x^4 + 3*x^3 - 2*x + 1
sage: f.roots( ring=CC, multiplicities=False )
[-2.66577432841770,
-1.26914313016883,
0.467458729293263 - 0.277589969280687*I,
0.467458729293263 + 0.277589969280687*I]
We are searching a matrix $A\in M_{5\times 5}(R)$, $R\subseteq \mathbb C$ some field, with $f(A)=0$.
Then:
- for $R=\mathbb C$ we can simply find a matrix $A$ by conjugating a random diagonal matrix $D$ with diagonal entries in the above list.
- for $R=\mathbb Q$ there is no solution, Galois theory,
- for $R=\mathbb R$ we may use only the real eigenvalues, simple again, or also one / two pairs of conjugated roots. Is this last option needed?
We must work over an **exact field**, e.g. `AA`?Wed, 22 Nov 2017 22:45:59 +0100https://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/?comment=39736#post-id-39736