Dear Sir:
I am still a novice to use the maple. Please give some advice for the
following code. Expecially, I try to construct the final P(3x3) matrix.
In the for-loop, normalized vectors are generated. Then, those are
converted into a matrix. But, I do not know how to write a code.
restart:
with(LinearAlgebra):
interface(displayprecision=4):
mass:=Matrix([[m[1],0,0],[0,m[2],0],[0,0,m[3]]]);
stif:=Matrix([[k[1]+k[2],-k[1],0],[-k[1],k[1]+k[2],-k[2]],[0,-k[2],k[2]]]);
m[1],m[2],m[3],k[1],k[2],k[3]:=4,4,4,4,4,4;
msri:=simplify(MatrixFunction(mass,sqrt(x),x)^(-1));
mass2:=msri.mass.msri; stif2:=msri.stif.msri;
v,C:=evalf(Eigenvectors(stif2));
for i from 1 to 3 do P[1..3,i]:=Normalize(C[1..3,i],Euclidean) end do;
Thanks
Comments
create Matrix P
Your final do-loop assigns columns, in-place, into what you intend to be Matrix P. But you haven't created the Matrix P, yet. Try adding,
P := Matrix(3,3):
before that final do-loop.
You might also think that P should be purely real. You could try simplify(map(fnormal,P)) at the end. But maybe you would rather compute the eigenvectors of a floating-point symmetric version of stif2, instead of doing floating-point evaluation of the eigenvectors of the exact stif2? Ie,,
Eigenvectors(evalf(Matrix(stif2,shape=symmetric)));
acer