Question: how to create a matrix

Hi!

 

I still have a problem and im looking forward to any suggestions

this is the previous code that i have wrote

P := array([[8, 4], [8, 3], [8, 2], [7, 1], [6, 0], [5, 0], [4, 0], [2, 1], [1, 1], [1, 4]]);


> for j from 2 to 5 do k[j] := j+1;

x[j] := add(P[j, 1], j = j-1 .. j+2);

X[j] := add(P[j, 1]^2, j = j-1 .. j+2);

y[j] := add(P[j, 2], j = j-1 .. j+2);

Y[j] := add(P[j, 2]^2, j = j-1 .. j+2);

xy[j] := add(P[j, 1]*P[j, 2], j = j-1 .. j+2);

cx[j] := evalf(x[j]/k[j]);

cy[j] := evalf(y[j]/k[j]);

c11[j] := evalf(X[j]/k[j]-cx[j]^2);

c22[j] := evalf(Y[j]/k[j]-cy[j]^2);

c12[j] := evalf(xy[j]/k[j]-cx[j]*cy[j]);

C[j] := evalf(Matrix(2, 2, [[c11[j], c12[j]], [c12[j], c22[j]]]));

E[j] := simplify(fnormal(LinearAlgebra[Eigenvalues](C[j])));

if E[j][1] > E[j][2] then a[j] := E[j][2]/(E[j][1]+E[j][2]) else b[j] := E[j][1]/(E[j][1]+E[j][2])

 end if;

a[j];b[j]

 end do;

 

now, my question is how to put the output from the above looping in a  matrix form.

in my matrix, i need to call a[j],b[j], E[j][1], E[j][2] and the coordinate points. so my matrix dimension 4 x 5

I guess its a simple task but i tried hard and didnt get it worked.

thank you.

 

Please Wait...