ActiveUser

490 Reputation

10 Badges

7 years, 177 days
i would also not like to ask, but if not ask, what should i do?

MaplePrimes Activity


These are replies submitted by ActiveUser

@Carl Love 

if both are the same basically after normalised , then which algorithm ‘s solution is the correct and standard in physics? Floating or fraction or integer? Is there only two algorithms? Or three?

it seems need to care whether algorithm using is consistent in whole operation.

@Carl Love 

when calculating eigenvector after use QR iteration  to calculate eigenvalues,

i use Rayleigh iterations, but eigenvector result is not equal to official function of eigenvector, where is wrong?

 

solve(sqrt(x^2 + x^2 + x^2) = 1, x);
yk := Matrix([[(1/3)*sqrt(3)],[(1/3)*sqrt(3)],[(1/3)*sqrt(3)]]):
evalf(sqrt(yk[1,1]*yk[1,1] + yk[2,1]*yk[2,1] + yk[3,1]*yk[3,1]));
v0 := Matrix([[(1/3)*sqrt(3)],[(1/3)*sqrt(3)],[(1/3)*sqrt(3)]]):

EigenVector2 := proc(e1,e2,e3)
u := e1:
vk := Matrix([[(1/3)*sqrt(3)],[(1/3)*sqrt(3)],[(1/3)*sqrt(3)]]):
for i from 1 to 3 do
yk := MatrixMatrixMultiply(MatrixInverse(M - u*Matrix([[1,0,0],[0,1,0],[0,0,1]])), vk);
vk := yk/sqrt(yk[1,1]*yk[1,1] + yk[2,1]*yk[2,1] + yk[3,1]*yk[3,1]);
Mvk := MatrixMatrixMultiply(M, vk);
u := (Mvk[1,1]*vk[1,1] + Mvk[2,1]*vk[2,1] + Mvk[3,1]*vk[3,1])/(vk[1,1]*vk[1,1] + vk[2,1]*vk[2,1] + vk[3,1]*vk[3,1]); #Rayleigh
od:
v1 := evalf(vk);

u := e2:
vk := Matrix([[(1/3)*sqrt(3)],[(1/3)*sqrt(3)],[(1/3)*sqrt(3)]]):
for i from 1 to 3 do
yk := MatrixMatrixMultiply(MatrixInverse(M - u*Matrix([[1,0,0],[0,1,0],[0,0,1]])), vk);
vk := yk/sqrt(yk[1,1]*yk[1,1] + yk[2,1]*yk[2,1] + yk[3,1]*yk[3,1]);
Mvk := MatrixMatrixMultiply(M, vk);
u := (Mvk[1,1]*vk[1,1] + Mvk[2,1]*vk[2,1] + Mvk[3,1]*vk[3,1])/(vk[1,1]*vk[1,1] + vk[2,1]*vk[2,1] + vk[3,1]*vk[3,1]);
od:
v2 := evalf(vk);

u := e3:
vk := Matrix([[(1/3)*sqrt(3)],[(1/3)*sqrt(3)],[(1/3)*sqrt(3)]]):
for i from 1 to 3 do
yk := MatrixMatrixMultiply(MatrixInverse(M - u*Matrix([[1,0,0],[0,1,0],[0,0,1]])), vk);
vk := yk/sqrt(yk[1,1]*yk[1,1] + yk[2,1]*yk[2,1] + yk[3,1]*yk[3,1]);
Mvk := MatrixMatrixMultiply(M, vk);
u := (Mvk[1,1]*vk[1,1] + Mvk[2,1]*vk[2,1] + Mvk[3,1]*vk[3,1])/(vk[1,1]*vk[1,1] + vk[2,1]*vk[2,1] + vk[3,1]*vk[3,1]);
od:
v3 := evalf(vk);
return [v1, v2, v3];
end proc:

uu := evalf(EigenValues2(M,7))[2];
EigenVector2(uu[1,1],uu[2,2],uu[3,3]); # uu are the eigenvalues

v, e := evalf(Eigenvectors(M));

@tomleslie 

i use QR iterations, 

 --- it can approximate decimal number of eigenvalues, but can not do exact fraction of maple official function do.

 --- QR iterations only return eigenvalues, how about eigenvectors? how do QR iterations do eigenvectors?

@Carl Love 

how to use GivensRotationMatrix in maple 2015?

i use matrix or vector , still return error


        A2 := GivensRotationMatrix(A1, 1, 2);
Error, (in LinearAlgebra:-GivensRotationMatrix) invalid input: LinearAlgebra:-GivensRotationMatrix expects its 1st argument, V, to be of type Vector() but received A1


        with(LinearAlgebra):

A := array(0 .. 2, 0 .. 2, [[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
A1 := convert(A, vector);
A := Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
A1 := convert(A, vector);

A2 := GivensRotationMatrix(A1, 1, 2);

@Carl Love 

 

with(Groebner):
sol := [{a*b = 1, c*d = 1, conjugate(a*c) - b*d = 0, a*d-b*c = sqrt(3)*I}, {}];
K := {(rhs(sol[1][1])-lhs(sol[1][1]))-x1,(rhs(sol[1][2])-lhs(sol[1][2]))-x2,(rhs(sol[1][3])-lhs(sol[1][3]))-x3,(rhs(sol[1][4])-lhs(sol[1][4]))-x4};
G := Basis(K, 'tord', degrevlex(x1,x2,x3,x4));
R1 := eliminate(G, {x1,x2,x3,x4}); # eliminate is the reverse of Basis
nops(G);
nops(K);
Ga := Basis({a*G[1],a*G[2],a*G[3],a*G[4], (1-a)*K[1], (1-a)*K[2], (1-a)*K[3], (1-a)*K[4]}, 'tord', deglex(a,x1,x2,x3,x4));
Ga := remove(has, Ga, [u1,u2,u3,u4,a]);

 

i tried this method , but it return [1] ,

is there method to find the rest ?

@Carl Love 

how to correctly use eliminate for this example?

i tried eliminate but it return another set of a,b,c,d

isn't it to use input set and output set or/and the rest properties ?

m5 := eliminate([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, Jesus2[1,1]=a, Jesus2[1,2]=b, Jesus2[2,1]=c, Jesus2[2,2]=d],[a,b,c,d]);
m5 := eliminate([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, Jesus2[1,1]=a, Jesus2[1,2]=b, Jesus2[2,1]=c, Jesus2[2,2]=d,a*b = 1, c*d = 1, conjugate(a*c)-b*d = 0],[a,b,c,d]);

 

m5 := [{a = -(1/2)*(3439+(1145*I)*sqrt(3))/(1+(1146*I)*sqrt(3)), b = -(1/2)*(-3439+(1145*I)*sqrt(3))/(-1+(1146*I)*sqrt(3)), c = -(1/2)*(-3942243+(1311025*I)*sqrt(3))/(-2292+(1313317*I)*sqrt(3)), d = -(1/2)*(3942243+(1311025*I)*sqrt(3))/(2292+(1313317*I)*sqrt(3))}, {AA[1, 1], AA[1, 2], AA[2, 1], AA[2, 2]}]

@Carl Love 

i try sylvester solve(jesus7, jesus7, matrix([[0,0],[0,0]]) in maple 2015

but it return 0 matrix , why can not solve ?

but it actually has solution.

 

@Carl Love 

i have tried eliminiate but no solution return

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a= Jesus2[1,1], b=Jesus2[1,2], c=Jesus2[2,1], d=Jesus2[2,2], a*b = 1, c*d = 1, conjugate(a*c)-b*d = 0,a*d-b*c=sqrt(3)*I],[a,b,c,d]);

Original question is how to solve a, b, c and d for below equations:

Both known Matrix and solution Matrix Properties

Matrix([[a,b],[c,d]]);
a*b = 1
c*d = 1

conjugate(a*c)-b*d = 0
Determinant(Matrix([[a,b],[c,d]])) = sqrt(3)*I
a*d-b*c = sqrt(3)*I

How to solve system AA when known Jesus7 to find Jesus2 which is Matrix([[a,b],[c,d]]) ?


Jesus7 := Matrix(2, 2, {(1, 1) = (1296309/5)*(22243/5+((7358/5)*I)*sqrt(3))/((-384813/10+((33701837/10)*I)*sqrt(3))*(-2277/10+((13/10)*I)*sqrt(3))), (1, 2) = (1296309/5)*(22243/5-((7358/5)*I)*sqrt(3))/((-384813/10-((33701837/10)*I)*sqrt(3))*(-2277/10-((13/10)*I)*sqrt(3))), (2, 1) = -(1/5)*(-25372581+(8329256*I)*sqrt(3))/(-384813/10+((33701837/10)*I)*sqrt(3)), (2, 2) = -(1/5)*(-25372581-(8329256*I)*sqrt(3))/(-384813/10-((33701837/10)*I)*sqrt(3))});

AA := simplify(MatrixMatrixMultiply(Matrix([[a,b],[c,d]]),Jesus7)- MatrixMatrixMultiply(Jesus7,Matrix([[a,b],[c,d]]))):

I am using different properties and even full properties , still can not find the solution equal to exact solution, but number of equations had already been more than number of variables? where is incorrect?

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a*b = 1, c*d = 1, conjugate(a*c)-b*d = 0,a*d-b*c=sqrt(3)*I],[a,b,c,d]);

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a*b = 1, c*d = 1, a*d-b*c=sqrt(3)*I],[a,b,c,d]);

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a*b = 1, c*d = 1, conjugate(a*c)-b*d = 0],[a,b,c,d]);

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a*b = 1, c*d = 1],[a,b,c,d]);

Solution: Matrix([[a,b],[c,d]]) should be
Jesus2 := [[1313319/2 (3439+1145 I sqrt(3))/((-2292+1313317 I sqrt(3)) (-1146+I sqrt(3))),1313319/2 (3439-1145 I sqrt(3))/((-2292-1313317 I sqrt(3)) (-1146-I sqrt(3)))],[-1/2 (-3942243+1311025 I sqrt(3))/(-2292+1313317 I sqrt(3)),-1/2 (-3942243-1311025 I sqrt(3))/(-2292-1313317 I sqrt(3))]];

 

i find this combination of equations has solution

m5 := solve([AA[1,1]=0,AA[1,2]=0,AA[2,1]=0,AA[2,2]=0, a*b = 1, c*d = 1, a*d-b*c=sqrt(3)*I],[a,b,c,d]);

but the solution is not Jesus2, i did not know what inside in solve function, it is like somewhere has evalf it and then change back to fraction, may be my guess is incorrect.

 

@Kitonum 

i edit script and try differen length of variables list, but can not find transpose is Equivalent

how to do correctly?

 

with(LinearAlgebra);
with(combinat):
elementss := proc(AA)
local elements1:
elements1 := [op(indets(AA))];
elements1 := [op(elements1), op(indets(AA,float))];
elements1 := [op(elements1),op(indets(AA,constant))];
return elements1:
end proc:
IsEquivalent:=proc(obj1::Matrix, obj2::Matrix, var::list)
local P, S, i, result, SS;
uses combinat, LinearAlgebra;
P:=permute(var);
#print(P):
S:=[seq(subs(zip(`=`,var,p),obj2), p=P)];
#print(S):
SS := choose(S,2);
result := false:
for i from 1 to nops(SS) do
if `or`(seq(Equal(obj1,s), s=SS[i])) then
 result := true:
end if:
od:
return result:
end proc:
A1 := Matrix([[777,x,x],[77,7,7],[2,y,y]]);
B1 := Transpose(A1);
finish := 0:
for la2 from nops(elementss(A1)) to 2 by -1 do
#print(choose(elementss(A1),la2));
elementbox := choose(elementss(A1),la2):
for la7 from 1 to nops(elementbox) do
if finish = 0 then
result := IsEquivalent(A1, B1, elementbox[la7]):
print(result):
if result = true then
 finish := la2:
end if:
end if:
od:
od:
 

@acer 

i solved after tidy my code

and succeed to verify that there are all one

i use fraction input and simplify output

confirmed that only fraction is exact, it can not use with evalf, evalf has rounding error

@acer 

i sent file to support of maple , phil

You can ask him to give you to look

what is your email?

i can send to you

@acer 

I have replied tom with code 

so not need to retype

You can run with a time series called close3 

then you will see most using fraction as input to eigenvectors are wrong 

@tomleslie 

previous reply from my question,

someone told me to use fraction, but i verify eigenvector result of fraction, it is incorrect

 

originally , start from float value , there is very little difference, not exactly 1.0 after verify then today i test it is exactly one.

 

is it a bug in maple 12 ?

 

@tomleslie 

can you explain why start from fraction and start from floating value, different?

i mean that one columns are all one , another one column is 0.57...,  

which start is the most accurate?

 

why fraction and float are near the same thing, but result has such big difference like totally different thing?

 

which should be used?

 

@ThU 

example is

dsolve([eq2,eq3,eq4,c(t)=fractionoutputofeigenvector],[a(t),b(t),c(t)])

c(t) has result

4 5 6 7 8 9 10 Last Page 6 of 44