Hello, I am using a matrix and finding roots of a polynomial, where the coefficients are based of different combinations of the entries in the matrix. If ln(1), Ln(2), ln(3), ln(4) are on the main diagonal, the answer should be the same as the answer for ln(2), Ln(1), ln(3), ln(4) on the main diagonal. However I am getting two different answers. All math is multiplication and addition so it should be communicative and yield the same answers. Here is my Code, any ideas to a solution?(adsbygoogle = window.adsbygoogle || []).push({});

roots[W_] := ((*This function takes in a Work of Charging matrix that is all \

numbers and yeilds the roots of the Binding Polynomial.*)

fu[X_, x_, y_] := X[[x]][[y]];

W11 = fu[W, 1, 1];

W22 = fu[W, 2, 2];

W33 = fu[W, 3, 3];

W44 = fu[W, 4, 4];

W12 = fu[W, 1, 2];

W13 = fu[W, 1, 3];

W23 = fu[W, 2, 3];

W14 = fu[W, 1, 4];

W24 = fu[W, 2, 4];

W34 = fu[W, 3, 4];

C0 = 1;

C1 = E^(-W11) + E^(-W22) + E^(-W33) + E^(-W44) // N;

Print["C1: ", C1];

C2 = E^(-(W11 + W22 + (2*W12))) + E^(-(W22 + W33 + (2*W23))) +

E^(-(W33 + W44 + (2*W34))) + E^(-(W11 + W33 + (2*W13))) +

E^(-(W11 + W44 + (2*W14))) + E^(-(W22 + W44 + (2*W24))) // N;

Print["C2: ", C2];

C3 = E^(-(W11 + W22 + W33 + (2*W12) + (2*W13) + (2*W23))) +

E^(-(W22 + W33 + W44 + (2*W23) + (2*W24) + (2*W34))) +

E^(-(W33 + W44 + W11 + (2*W34) + (2*W13) + (2*W14))) +

E^(-(W11 + W22 + W44 + (2*W12) + (2*W14) + (2*W24))) // N;

Print["C3: ", C3];

C4 = E^(-(W11 + W22 + W33 + W44)) // N;

Print["C4: ", C4];

answer =

Solve[Evaluate[C4]*(x^4) + Evaluate[C3]*(x^3) +

Evaluate[C2]*(x^2) + Evaluate[C1]*x + Evaluate[C0] == 0, x] //

N;

finalAnswer = Flatten[Evaluate[x /. answer]]);

(*End of Function.*)

A = {{Evaluate[Log[1]], 0, 0, 0}, {0, Evaluate[Log[2]], 0, 0}, {0, 0,

Evaluate[Log[3]], 0}, {0, 0, 0, Evaluate[Log[4]]}};(*//MatrixForm*)

roots[A]

Thanks,

Lauren

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica-Commutive answers not equal

**Physics Forums | Science Articles, Homework Help, Discussion**