Message Boards Message Boards

0
|
6265 Views
|
12 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Solving polynomial with matrix coefficients

Posted 10 years ago

I have a polynomial B in u that I want to solve, where u is an operator. It's of degree three so there will be three operators that solve it, and I want the solutions given as matricies.

My current code is

L[u_] = Array[L, {3, 3}] + {{u, 0, 0}, {0, u, 0}, {0, 0, u}}

t[\[Epsilon]] = {{1, \[Epsilon]1, \[Epsilon]2}, {-\[Epsilon]1, 
   1, \[Epsilon]3}, {-\[Epsilon]2, -\[Epsilon]3, 1}}

T[u_] = L[u].t[\[Epsilon]]

The polynomial for B is

B = T[u][[2, 3]] (T[u][[1, 2]] T[u - I][[2, 3]] - 
     T[u][[1, 3]] T[u - I][[2, 2]]) - 
  T[u][[1, 3]] (T[u][[1, 3]] T[u - I][[2, 1]] - 
     T[u][[1, 1]] T[u - I][[2, 3]])

The L[i, j] are also matricies given by

L[1, 1] = I/3 {{2, 0, 0}, {0, -1, 0}, {0, 0, -1}}
L[2, 2] = I/3 {{-1, 0, 0}, {0, 2, 0}, {0, 0, -1}}
L[3, 3] = I/3 {{-1, 0, 0}, {0, -1, 0}, {0, 0, 2}}
L[1, 2] = I {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}}
L[1, 3] = I {{0, 0, 0}, {0, 0, 0}, {1, 0, 0}}
L[2, 1] = I {{0, 1, 0}, {0, 0, 0}, {0, 0, 0}}
L[2, 3] = I {{0, 0, 0}, {0, 0, 0}, {0, 1, 0}}
L[3, 1] = I {{0, 0, 1}, {0, 0, 0}, {0, 0, 0}}
L[3, 2] = I {{0, 0, 0}, {0, 0, 1}, {0, 0, 0}}

I tried don't know how to tell it that u is a 3x3 matrix and how to find that matrix. Up until now I was writing u= x {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} and B resulted in me having a 3x3 matrix with a polynomial of degree 3 on each element of the diagonal which isn't what I want.

Any help appreciated, thanks.

POSTED BY: Paul Ryan
12 Replies

You might consider using the function MatrixFunction.

POSTED BY: Anton Antonov
Posted 10 years ago

I've tried using it, I put

m = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}

and set f[u] = MatrixFunction[B[#] &, u] (note I fixed the definition of B in the first post and wrote in as B[u]

and then used the usual solve function for f[u]=m, and got some crazy answer it took about two minutes to compute.

Earlier up I did write u as u = Array[x, {3, 3}], so I'm not sure if that's causing issues or not...

POSTED BY: Paul Ryan

Can you attach a notebook with your code to the discussion?

It seems that your matrix equation can be unfolded into a set of equations using Thread and giving the equations and the corresponding variables to Reduce.

POSTED BY: Anton Antonov
Posted 10 years ago

Sure. Attached.

Attachments:
POSTED BY: Paul Ryan

This is not very clear to me. Are you trying to do this?

sol = u /. Solve[Flatten[B[u]] == Flatten[m], Flatten[u]];

That gives many solution matrices expressed in terms of the epsilons.

POSTED BY: Daniel Lichtblau
Posted 10 years ago

It might be what I'm trying to do... I want to get matricies u that solve B[u]=0. I put your code into mine but it didn't work - may I see your code please?

POSTED BY: Paul Ryan

"My" code is just your code. I didn't change anything that I recall.

L[u_] = Array[L, {3, 3}] + {{u, 0, 0}, {0, u, 0}, {0, 0, u}};
t[\[Epsilon]] = {{1, \[Epsilon]1, \[Epsilon]2}, {-\[Epsilon]1, 
    1, \[Epsilon]3}, {-\[Epsilon]2, -\[Epsilon]3, 1}};
T[u_] = L[u].t[\[Epsilon]];
B[u_] := T[u][[2, 3]] (T[u][[1, 2]] T[u - v][[2, 3]] - 
      T[u][[1, 3]] T[u - v][[2, 2]]) - 
   T[u][[1, 3]] (T[u][[1, 3]] T[u - v][[2, 1]] - 
      T[u][[1, 1]] T[u - v][[2, 3]]);
L[1, 1] = I/3 {{2, 0, 0}, {0, -1, 0}, {0, 0, -1}};
L[2, 2] = I/3 {{-1, 0, 0}, {0, 2, 0}, {0, 0, -1}};
L[3, 3] = I/3 {{-1, 0, 0}, {0, -1, 0}, {0, 0, 2}};
L[1, 2] = I {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}};
L[1, 3] = I {{0, 0, 0}, {0, 0, 0}, {1, 0, 0}};
L[2, 1] = I {{0, 1, 0}, {0, 0, 0}, {0, 0, 0}};
L[2, 3] = I {{0, 0, 0}, {0, 0, 0}, {0, 1, 0}};
L[3, 1] = I {{0, 0, 1}, {0, 0, 0}, {0, 0, 0}};
L[3, 2] = I {{0, 0, 0}, {0, 0, 1}, {0, 0, 0}};
u = Array[x, {3, 3}];
v = I {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};

sol = u /. Solve[Flatten[B[u]] == 0, Flatten[u]];
Length[sol]

(* Out[18]= 432 *)

Here is one of them.

sol[[1]]

(* Out[19]= {{-((2*I)/3), 0, 0}, {0, I/3, 0}, 
{-((I*(2*\[Epsilon]1*\[Epsilon]2 - \[Epsilon]2^2*\[Epsilon]3 - \[Epsilon]3^3 - 
         I*\[Epsilon]3*Sqrt[4*\[Epsilon]1^2 - \[Epsilon]2^4 - 
            2*\[Epsilon]2^2*\[Epsilon]3^2 - \[Epsilon]3^4]))/
          (2*(\[Epsilon]1*\[Epsilon]2^2 + \[Epsilon]1*\[Epsilon]3^2))), 0, I/3}} *)
POSTED BY: Daniel Lichtblau
Posted 10 years ago

When I change from

u=Array[x,{3,3}] 

to

u={{-((2*I)/3), 0, 0}, {0, I/3, 0}, 
{-((I*(2*\[Epsilon]1*\[Epsilon]2 - \[Epsilon]2^2*\[Epsilon]3 - \[Epsilon]3^3 - 
         I*\[Epsilon]3*Sqrt[4*\[Epsilon]1^2 - \[Epsilon]2^4 - 
            2*\[Epsilon]2^2*\[Epsilon]3^2 - \[Epsilon]3^4]))/
          (2*(\[Epsilon]1*\[Epsilon]2^2 + \[Epsilon]1*\[Epsilon]3^2))), 0, I/3}}

B[u] doesn't equal zero though?

POSTED BY: Paul Ryan

Properly substituted, you should get zero.

Together[B[u] /. Thread[Flatten[u] -> Flatten[sol[[1]]]]]

(* Out[20]= {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} *)
POSTED BY: Daniel Lichtblau
Posted 10 years ago

I see. Why is it not sufficient to just put it in normally? Sorry for not following - I've never seen the Flatten stuff before.

POSTED BY: Paul Ryan

I guess I made it too complicated. You are correct that a direct substitution can be done. Here is what I should have shown:

B[sol[[1]]] // Together

(* Out[24]= {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} *)
POSTED BY: Daniel Lichtblau
Posted 10 years ago

Ah okay. Thank you very much! Why can't the solution be substituted into B[u] normally though?

POSTED BY: Paul Ryan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract