Items tagged with matrix matrix Tagged Items Feed

i have a work on Magic Squares , and i need to rotate or flip them to all 8 possible directions .
but i am confused to find such special commands in maple for doing my purpose !

may you guide me how can i do this programmaticaly ?

 

order4 := Array(1 .. 4, 1 .. 4, {(1, 1) = 8, (1, 2) = 11, (1, 3) = 14, (1, 4) = 1, (2, 1) = 13, (2, 2) = 2, (2, 3) = 7, (2, 4) = 12, (3, 1) = 3, (3, 2) = 16, (3, 3) = 9, (3, 4) = 6, (4, 1) = 10, (4, 2) = 5, (4, 3) = 4, (4, 4) = 15}, datatype = anything, storage = rectangular, order = Fortran_order)

order4 := Array(1..4, 1..4, {(1, 1) = 8, (1, 2) = 11, (1, 3) = 14, (1, 4) = 1, (2, 1) = 13, (2, 2) = 2, (2, 3) = 7, (2, 4) = 12, (3, 1) = 3, (3, 2) = 16, (3, 3) = 9, (3, 4) = 6, (4, 1) = 10, (4, 2) = 5, (4, 3) = 4, (4, 4) = 15})

(1)

``


Download magicsquare4.mw

Basically I have to find omega by solving determinant of the following matrix:

M := Matrix(4, 4, {(1, 1) = 0, (1, 2) = -1, (1, 3) = 0, (1, 4) = 1, (2, 1) = -EI*beta^3, (2, 2) = -m*omega^2, (2, 3) = EI*beta^3, (2, 4) = -m*omega^2, (3, 1) = EI*sin(147*beta)*beta+k_r*cos(147*beta)+I*c_r*omega*cos(147*beta), (3, 2) = EI*cos(147*beta)*beta-k_r*sin(147*beta)-I*c_r*omega*sin(147*beta), (3, 3) = -EI*sinh(147*beta)*beta+k_r*cosh(147*beta)+I*c_r*omega*cosh(147*beta), (3, 4) = -EI*cosh(147*beta)*beta+k_r*sinh(147*beta)+I*c_r*omega*sinh(147*beta), (4, 1) = -EI*cos(147*beta)*beta^3+sin(147*beta)*k_h, (4, 2) = EI*sin(147*beta)*beta^3+cos(147*beta)*k_h, (4, 3) = EI*cosh(147*beta)*beta^3+sinh(147*beta)*k_h, (4, 4) = EI*sinh(147*beta)*beta^3+cosh(147*beta)*k_h}):

The remaining values are:

beta=((5000/10^12)*(omega^2))^(1/4),k_r=3.33*10^10,k_h=1.62*10^9,c_r=3.14*10^9,m=350000,L=147,EI=10^12:

What is the proper way to deal with this problem numerically. Or maybe it is even possible to get a reasonable analytical expression?

Hi,


Is it possible to solve linear matrix inequality in Maple?
For example, using Matlab and yalmip we can easily
solve Lyapunov equation
  
    A'P + P * A <0, P> 0

Is it possible to solve this equation in the Maple?


Regards,

 

Hi,

RTABLE(151446624,MATRIX([[tf[1,1] = 24110714285.0000/(1000000000000*s+1071534859*218^(1/2))], [tf[2,1] = .843883770817266e20*218^(1/2)/(2500000000000000000000000*s^2+4870187206000000000000*218^(1/2)*s+487482532797170793867)], [tf[1,2] = .841458646091250e19*218^(1/2)/(125000000000000000000000*s^2+350952468875000000000*218^(1/2)*s+50692506828944068713)], [tf[2,2] = 87390625000.0000/(5000000000000*s+3705223967*218^(1/2))]]),Vector[column])

 

How can I read the individual elements tf[1,1], tf[2,1], tf[2,1], tf[2,2] form this RTABLE?

Regards,

if not using

EigenvectorSol := simplify(solve({seq(seq((NewMatrix3 . NewInput3(1..-1,i))[j]=(v[i]* NewInput3(1..-1,i))[j], j=1..3), i=1..3)}, {seq(x||i, i=1..9)}));

and if want to see clearly the steps about how to solve for eignvector, how to do?

because i use solve, it has error

InputMatrix3 := Matrix([[31.25,30.8,30.5],[30.8,30.5,0],[30.5,0,0]]);

NewInput3 := MatrixMatrixMultiply(Transpose(InputMatrix3), InputMatrix3);

FirstEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[1]; # find back eigenvalue from eigenvector

SecondEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[2]; # find back eigenvalue from eigenvector

ThirdEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[3]; # find back eigenvalue from eigenvector

v:=[ FirstEigenValue, SecondEigenValue, ThirdEigenValue];

NewMatrix3 := Matrix([[x1,x2,x3], [x4,x5,x6], [x7,x8,x9]]);

EigenvectorSol := simplify(solve({seq(seq((NewMatrix3 . NewInput3(1..-1,i))[j]=(v[i]* NewInput3(1..-1,i))[j], j=1..3), i=1..3)}, {seq(x||i, i=1..9)}));

EigenvectorT := Matrix([[rhs(EigenvectorSol[1]), rhs(EigenvectorSol[2]), rhs(EigenvectorSol[3])],[ rhs(EigenvectorSol[4]), rhs(EigenvectorSol[5]), rhs(EigenvectorSol[6])],[ rhs(EigenvectorSol[7]), rhs(EigenvectorSol[8]), rhs(EigenvectorSol[9])]]);

Old_Asso_eigenvector := Eigenvectors(MatrixMatrixMultiply(Transpose(InputMatrix3), InputMatrix3));

 

sys1:=MatrixMatrixMultiply(NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]),Matrix([[x],[y],[z]]));

sys1a := NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]);

 

fsolve({sys1[1][1]=0,sys1[2][1]=0,sys1[3][1]=0}, {x,y,z});

solve([sys1[1][1]=0,sys1[2][1]=0,sys1[3][1]=0], [x,y,z]);

solve([sys1[1]=0,sys1[2]=0,sys1[3]=0], [x,y,z]);

> solve([sys1[1] = 0, sys1[2] = 0, sys1[3] = 0], [x, y, z]);

Error, invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({set, list})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received [(Vector[row](1, {(1) = HFloat(2571.1332294000003)*x+HFloat(1901.9)*y+HFloat(953.125)*z})) = 0, (Vector[row](1, {(1) = HFloat(1901.9)*x+HFloat(1594.5707294000001)*y+HFloat(939.4)*z})) = 0, (Vector[row](1, {(1) = HFloat(953.125)*x+HFloat(939.4)*y+HFloat(645.9307294)*z})) = 0]

 

 

v1 := <sys1a[1,1] | sys1a[1,2] | sys1a[1,3]>;

v2 := <sys1a[2,1] | sys1a[2,2] | sys1a[2,3]>;

v3 := <sys1a[3,1] | sys1a[3,2] | sys1a[3,3]>;

 

v1 := <sys1a[1,1] | sys1a[2,1] | sys1a[3,1]>;

v2 := <sys1a[1,2] | sys1a[2,2] | sys1a[3,2]>;

v3 := <sys1a[1,3] | sys1a[2,3] | sys1a[3,3]>;

eigenvector1 := Basis([v1, v2, v2]);

eliminate({sys1[1][1]=0,sys1[2][1]=0,sys1[3][1]=0},{x,y,z});

eliminate({sys1[1][1]=0,sys1[1][2]=0,sys1[1][3]=0},{x,y,z});

 

sys1:=MatrixMatrixMultiply(NewInput3-Matrix([[SecondEigenValue, 0, 0], [0, SecondEigenValue, 0], [0, 0, SecondEigenValue]]),Matrix([[x],[y],[z]]));

solve([sys1[1][1]=0,sys1[2][1]=0,sys1[3][1]=0], [x,y,z]);

sys1:=MatrixMatrixMultiply(NewInput3-Matrix([[ThirdEigenValue, 0, 0], [0, ThirdEigenValue, 0], [0, 0, ThirdEigenValue]]),Matrix([[x],[y],[z]]));

solve([sys1[1][1]=0,sys1[2][1]=0,sys1[3][1]=0], [x,y,z]);

 

x: =Matrix([[a1,a2],[a3,a4]])

after some calculation,

assign(%)

a1 etc have value,

how to make a1,a2,a3,a4 back to variable in maple 12?

m := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);

m2 := Determinant(m-Matrix([[1,0,0],[0,1,0],[0,0,1]]));

1. which family of polynomials do m2 belong to?

2. how to analyze m2?

 

 

restart;

with(combinat):

symMonomial := proc(test)

h := 0;

for i from 1 to nops(test) do

                h[i] := choose(test,i);

od;

 

c := copy(test);

k := 0;

for k from 1 to nops(test) do

                c[k] := 0;

                for i from 1 to nops(h[k]) do

                                ki := 1;

                                for j from 1 to nops(h[k][i]) do

                                                ki := ki*h[k][i,j];

                                od;

                                c[k] := c[k] + ki;

                od;

od;

return c;

end proc;

 

 

sympoly := proc(test, number_of_roots)

with(combinat):

h := 0;

for i from 1 to nops(test) do

                h[i] := choose(z,i);

od;

 

c := 0;

for k from 1 to nops(test) do

                c[k] := 0;

                for i from 1 to nops(h[k]) do

                                ki := 1;

                                for j from 1 to nops(h[k][i]) do

                                                ki := ki*h[k][i,j];

                                od;

                                c[k] := c[k] + ki;

                od;

od;

poly := x^number_of_roots;

for k from 1 to number_of_roots do

                poly := poly + c[k]*x^(number_of_roots-k);

od;

end proc;

 

z := [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10];

sigma := symMonomial(z);

f := expand(sigma[1]*sigma[2]);

f := expand(sigma[1]*sigma[1]); # two lambda value are the same

f := expand(sigma[1]*sigma[1]*sigma[1]); # three lambda value are the same

 

f := expand(sigma[1]^2+2*sigma[1]*sigma[2]+sigma[2]);

f := subs(x1=3, f);

f := subs(x2=2, f);

f := subs(x3=3, f);

f := subs(x4=4, f);

f := subs(x5=5, f);

f := subs(x6=6, f);

f := subs(x7=7, f);

f := subs(x8=8, f);

f := subs(x9=9, f);

f := subs(x10=lambda, f);

evalf(solve(f, lambda));

if degree(f) = 2 then

                f := f + lambda^3;

                evalf(solve(f, lambda));

end if:

 

how to convert above f back to matrix form such as

 

m := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);

m-Matrix([[lambda,0,0],[0,lambda,0],[0,0,lambda]]);

m2 := Determinant(m-Matrix([[lambda,0,0],[0,lambda,0],[0,0,lambda]]));

 

after tested m2 can not be expressed in terms of shell like polynomial,

it seems that it is from symmetric polynomial and it is from a non-homogenous polynomial which homogenize with a lambda

 

if solve f for new eigenvalue,

can traditional eignvector method calculate new eigenvector for these new kind of eigenvalues method?

A*x = lambda*x

 Hi all,

i want to solve a system of differential equations in maple with "dsolve, numeric",

i got th error message: "Error, (in f) unable to store in Matrix ..."

what is the problem?

thanks a lot

want to export to excel to file from matrix

Error, (in FindLambda) invalid input: `convert/Array` expects its 1st argument, A, to be of type {Array, Matrix, Vector, array, list, listlist}, but received csvfile
csvfile = Matrix(30,7);

print(close3(t+i), rhs(Sol5[1][1]), ratioA, oddsratio, oddsratioSimUp, oddsratioSimDown,1);
csvfile[i+1,1] := close3(t+i);
csvfile[i+1,2] := rhs(Sol5[1][1]);
csvfile[i+1,3] := ratioA;
csvfile[i+1,4] := oddsratio;
csvfile[i+1,5] := oddsratioSimUp;
csvfile[i+1,6] := oddsratioSimDown;
csvfile[i+1,7] := 1;

29.95, 0.03355620525, 0.7651906074, 0.6000000000, 0.5294117647,

0.5714285714, 0
-8
29.95, 0.03361194645, 1.750709592 10 , 0.4444444444,

0.5000000000, 0.6000000000, 0
5
29.6, 0.03432592221, 1.013882143 10 , 0.6000000000, 0.4444444444,

0.6923076923, 1
29.55, 0.03447081290, -0.000009845029875, 0.7142857143,

0.6000000000, 0.5000000000, 0
29.8, 0.03403562903, 30660.46200, 0.5294117647, 0.4117647059,

0.7142857143, 0
30.4, 0.03327345914, -0.5761838946, 0.6000000000, 0.5714285714,

0.5294117647, 0
30.3, 0.03376575281, 6.256895964, 0.5000000000, 0.6000000000,

0.5000000000, 0
30.95, 0.03231017771, 0.5328449644, 0.6000000000, 0.6000000000,

0.5000000000, 0
31.1, 0.03104289658, -26.93771895, 0.5000000000, 0.5000000000,

0.6000000000, 0
29.2, 0.03366016138, -0.08555779615, 0.4444444444, 0.5000000000,

0.6000000000, 0
28.95, 0.03415453360, 0.4007940838, 0.6000000000, 0.4444444444,

0.6923076923, 0
28.3, 0.03605364033, 0.00001875789432, 0.3750000000,

0.6000000000, 0.5000000000, 0
28.75, 0.03523629490, 0.9740829247, 0.4117647059, 0.7333333333,

0.3750000000, 1
5
29.2, 0.03415861325, -6.244828641 10 , 0.6000000000,

0.7142857143, 0.4117647059, 1
28.8, 0.03514419367, -0.1430744128, 0.06666666667, 0.6000000000,

0.5000000000, 0
29.4, 0.03352191217, 0.1495513336, 0.5000000000, 1.000000000,

0.06666666667, 0
28.95, 0.03433350933, 2.034565984, 0.5000000000, 0.5000000000,

0.6000000000, 0
28.85, 0.03394117064, 16.52857996, 0.7142857143, 0.5000000000,

0.6000000000, 0
28.5, 0.03419513697, -67.32086106, 0.6000000000, 0.7142857143,

0.4117647059, 0
-8
27.05, 0.03748108008, -3.316856585 10 , 0.6000000000,

0.6000000000, 0.5000000000, 0
27.7, 0.03561234996, 0.9992012832, 0.5000000000, 0.5000000000,

0.6000000000, 1
7
27.25, 0.03636057571, -1.891574002 10 , 0.5000000000,

0.5000000000, 0.6000000000, 1
27.0, 0.03696844993, 1.002386970, 0.03225806452, 0.5000000000,

0.6000000000, 0
-8
26.85, 0.03745201461, -5.221638895 10 , 1.000000000,

0.03225806452, 0, 0
26.85, 0.03734798123, 1.050118943, 0.5000000000, 0.06666666667,

1.000000000, 1

The problem is when initializing a Matrix with a list of strings. The worksheet excerpt below shows the normal behavior using a list of integers to initialize a square matrix: the successive list elements fill the matrix by rows.

Then trying the exact same thing with a list of strings instead of integers gives an error message!
This is not right. While it is an odd and likely rare problem, it would be better fixed.

x := [i $ i=1..25];
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Matrix(5,5,x);
Matrix(5,5,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]) 

y := map(convert,x,string);
["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"]
Matrix(5,5,y);
Error, (in Matrix) initializer defines more columns (25) than column dimension parameter specifies (5)

I am trying to find out the stiffness matrix of composite by using iterative loop that sums over each laminate and adds the result to the previously calculated matrix 

D=null matrix

for i to 4 do Dply := evalf(evalm((1/3)*Q[i]*(z(i+1)^3-z(i)^3))); D := evalm(D+Dply) end do;
evalm(D);

although the values are coming out fine but in the diagonalm elements, it shows the true value + _rtable[4456495426] which I am not able to figure out why is it coming?

 

X belongto A, eigenvector(X) = 0

from this statement , 

using linearalgebra package eigenvectors function

the eigenvector matrix [3][1],[3][2],[3][3] are 1 , contradict 1=0

so, need to find another kind of eigenvector in terms of algebra 

using original basic calculation solve, however got error

 

m := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);
eigenvector1 := Eigenvectors(m);
solve(
[eigenvector1[2][1][1]=0, eigenvector1[2][1][2]=0, eigenvector1[2][1][3]=0,
eigenvector1[2][2][1]=0, eigenvector1[2][2][2]=0, eigenvector1[2][2][3]=0,
eigenvector1[2][3][1]=0, eigenvector1[2][3][2]=0, eigenvector1[2][3][3]=0]
);

solve(
[eigenvector1[2][1][1]=0, eigenvector1[2][1][2]=0, eigenvector1[2][1][3]=0,
eigenvector1[2][2][1]=0, eigenvector1[2][2][2]=0, eigenvector1[2][2][3]=0]
);

 

eigenvalue1 :=
(1/6)*(36*a7*a1*a3+108*a7*a2*a6+108*a8*a4*a3+36*a8*a5*a6

...

eigenvalue2 :=
-(1/12)*(36*a7*a1*a3+108*a7*a2*a6+108*a8*a4*a3+36*a8*a5*a6

...

eigenvalue3 :=
-(1/12)*(36*a7*a1*a3+108*a7*a2*a6+

...

 

solve(MatrixMatrixMultiply(Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]])-Matrix([[eigenvalue1,0,0],[0,eigenvalue1,0],[0,0,eigenvalue1]]), Matrix([[x],[y],[z]])),[x,y,z]);
solve(MatrixMatrixMultiply(Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]])-Matrix([[eigenvalue2,0,0],[0,eigenvalue2,0],[0,0,eigenvalue2]]), Matrix([[x],[y],[z]])),[x,y,z]);
solve(MatrixMatrixMultiply(Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]])-Matrix([[eigenvalue3,0,0],[0,eigenvalue3,0],[0,0,eigenvalue3]]), Matrix([[x],[y],[z]])),[x,y,z]);

 

got error when using solve

> solve(MatrixMatrixMultiply(Matrix([[a1, a2, a3], [a4, a5, a6], [a7, a8, a9]])-Matrix([[eigenvalue1, 0, 0], [0, eigenvalue1, 0], [0, 0, eigenvalue1]]), Matrix([[x], [y], [z]])), [x, y, z]);
Error, invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({set, list})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received Matrix(3, 1, {(1, 1) = ((2/3)*a1-(1/6)*(36*a7*a1*a3+108*a7*a2*a6+108*a8*a4*a3+36*a8*a6*a5-72*a7*a3*a5-72*a8*a6*a1-72*a9*a4*a2+48*a9*a5*a1-12*a9*a1^2-12*a5*a1^2+8*a1^3-12*a9^2*a1-12*a5^2*a1-12*a9^2*a5-12*a9*a5^2+36*a8*a6*a9+36*a7*a3*a9+36*a4*a2*a1+36*a4*a2*a5+8*a9^3+8*a5^3+12*(54*a7*a2^2*a6*a4*a1+114*a8*a6*a9*a1*a4*a2+6*a8*a6*a9*a1*a7*a3+54*a8*a4*a3^2*a7*a9-60*a9*a1^2*a8*a6*a5-60*a8*a6*a7*a3*a5^2-60*a8*a6*a4*a2*a9^2-24*a9*a1*a4^2*a2^2+6*...

I have a matrix (1002,2) where first column isthe time and the second is numerical solution of an angle.My angle should be oscillating periodically but I am getting a noise at large times. I need to check if this noise contains certain frequencies in it so I need to plot a power spectrum of my data. How can I do that 

 

I want to create a NxN circulant matrix of a system with fixed boundaries. This is an idea of what I'm trying to do (but it doesn't work):

> N := 8;

> A := Matrix(N, shape = Circulant[[2, VectorCalculus[`-`](1), ZeroVector[row](VectorCalculus[`+`](N, VectorCalculus[`-`](3))), VectorCalculus[`-`](1)]]);

>A[1,N]:=0;

>A[N,1]:=0;

In other words, I want to make a circulant matrix of the elements 2, -1, 0, 0, ..., -1 (with N-3 zeros). Then I want to set the top right and bottom left elements to zero (that's the fixed boundary portion). The first command almost works for N=4 -- except with extra square brackets in the matrix -- but doesn't work for N=8 or 16 (N is always a power of 2). The second and third commands seem to be bad syntax (I haven't really tried to figure them out yet).

1 2 3 4 5 6 7 Last Page 1 of 29