2
$\begingroup$

I am trying to solve a system of polynomial functions:

$$x^T T_1 X = x_1 , \\ x^T T_2 x = x_2,\\ \vdots\\x^T T_l x =x_l$$

where $\{T_i\}$ is a given set of $l \times l$ matrices And I require a solution for vector $x=[x_1,\ldots x_l$]

The following code works nicely, for a given size $l=3$

S = Solve[{x.T[[1]][[1]].x == x1, x.T[[1]][[2]].x == x2,x.T[[1]][[3]].x == x3}, x]

The varible $T$ is a tensor which includes the set of matrices $T_1,\ldots,T_l$ along its third dimension.

The problem is - what can I do if the size of the input variables and the number of equations are unknown in advance? Is there a way to create an input expression to the Solve function with some kind of a for loop?
Thanks in advance!

Ariel

$\endgroup$
  • $\begingroup$ Under some assumptions your problem has analytic solution: if all matrices $T_i$ commute they are simultaneously diagonalizable. After such transformation ($T_i'=P T_i P^{-1}$, $x'=P x$) you can a set of linear equations for $y=x'^2$ that can be solved by standard methods. $\endgroup$ – yarchik Sep 7 '16 at 9:50
  • $\begingroup$ In Mathematica, you don't need a for-loop. Use functions (Table) instead. $\endgroup$ – user202729 Sep 7 '16 at 10:29
  • $\begingroup$ Thanks for the comment, however, I don't want to limit myself for a specific case. $\endgroup$ – Ariel Sep 7 '16 at 10:52
  • $\begingroup$ are you simplybasking how to construct that Solve expression for arbitrary l ? $\endgroup$ – george2079 Sep 7 '16 at 11:36
  • $\begingroup$ can you provide an example T to demonstrate your example working? $\endgroup$ – george2079 Sep 7 '16 at 13:55
1
$\begingroup$

I'd suggest to write the system as follows. Suppose that you have l matrices of dimensions {d, d}. Then your array T will have dimensions {l, d, d}. The list X of unknowns will have length d, and the list H of homogeneous terms will have length l. For example:

l = 3;
d = 3;

T = RandomInteger[10, {l, d, d}];
H = RandomInteger[10, l];
X = Array[x, d];

Then you can write and solve the system as

Solve[ T.X.X == H, X ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.