rzarouf

45 Reputation

3 Badges

1 years, 135 days

MaplePrimes Activity


These are questions asked by rzarouf

 

Hi, I am searching for an exercise in MapleLearn, which I would like to give to my students in the second year of a mathematics degree. The aim is to make them work only with Maple Learn during 15-20 minutes. So the exercise should be rather short. The original idea that I had was to give them the Fibonacci sequence equation to solve : F(n+2)=F(n+1)+F(n). I would like to transform the sequence using a 2x2 matrix, which is classical. Diagonalize the matrix, compute the powers and so on. This is very easy with Maple, but how can I do that with MapleLearn? I could enter the corresponding  2x2 matrix, compute its eigenvalues but that's it. I could not diagonalize it, compute its powers and so on. Maybe someone knows how to do that with MapleLearn? Else I would be happy to discover other exercises with MapleLearn. 

Apart from introducing the software to french universities, the aim is also to make a research experiment (it is an official collaboration with Maplesoft)

Hi, I have a very concrete task, which is to find the singular vector associated with the largest singular matrix of the matrix M below. Here, a is an arbitrary complex number, l is of magnitude stritcly less than 1, and k>0. The command 'SingularValues' returns the 2 singular values of M. But when I search for the corresponding singular vectors, there is a bug. Those vectors are the eigenvectors of M*M. When I use the command Eigenvectors, the second argument returned is the 2 by 2 null matrix. And when I use the command eigenvects I have an error message (see below). Anyone could help me to fix this issue please?

Many thanks in advance. 

with(LinearAlgebra); assume(k > 0); assume(abs(l) < 1); M := Matrix(2, 2, {(1, 1) = l-(1-l*conjugate(l))*k, (1, 2) = -a*(1-l*conjugate(l))*k, (2, 1) = 0, (2, 2) = l+(1-l*conjugate(l))*k})

Matrix(%id = 36893488151898158132)

(1)

simplify(SingularValues(M)[1])

(1/2)*(2*(-abs(l)^2+1)*k*(k^2*(abs(l)-1)^2*(abs(l)+1)^2*abs(a)^4+(4*k^2*abs(l)^4+(-8*k^2+4)*abs(l)^2+4*k^2)*abs(a)^2+4*l^2+8*abs(l)^2+4*conjugate(l)^2)^(1/2)+2*k^2*(abs(a)^2+2)*abs(l)^4+4*(-abs(a)^2*k^2-2*k^2+1)*abs(l)^2+2*k^2*(abs(a)^2+2))^(1/2)

(2)

MatrixMatrixMultiply(HermitianTranspose(M), M)

Matrix(%id = 36893488151996380692)

(3)

Eigenvectors(MatrixMatrixMultiply(HermitianTranspose(M), M))

Vector[column](%id = 36893488151975984532), Matrix(%id = 36893488151975984652)

(4)

with(linalg)

eigenvectors(Matrix(2, 2, {(1, 1) = (l-(1-l*conjugate(l))*k)*conjugate(l-(1-l*conjugate(l))*k), (1, 2) = -conjugate(l-(1-l*conjugate(l))*k)*a*(1-l*conjugate(l))*k, (2, 1) = -k*conjugate(a*(1-l*conjugate(l)))*(l-(1-l*conjugate(l))*k), (2, 2) = a*(1-l*conjugate(l))*k^2*conjugate(a*(1-l*conjugate(l)))+(l+(1-l*conjugate(l))*k)*conjugate(l+(1-l*conjugate(l))*k)}))

Error, (in linalg:-eigenvectors) eigenvects only works for a matrix of rationals, rational functions, algebraic numbers, or algebraic functions at present

 
 

``

Download singular_vect_2_by_2_matrix.mwsingular_vect_2_by_2_matrix.mw

Hi, maybe someone knows how to fix this:

"Error, (in assuming) when calling 'assume'. Received: 'question.mw'"

I am attaching the corresponding maple file. I've never met such an error message, and unfortunately the Maplesoft help does not contain any information about such an issue : 

restart; (2^(1/2+1/2+1)*GAMMA(n+1/2+1)*GAMMA(n+1/2+1))/((2*n+1/2+1/2+1)*GAMMA(n+1/2+1/2+1)*factorial(n))

4*GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n))

(1)

JacobiP(n, 1/2, 1/2, 1)

JacobiP(n, 1/2, 1/2, 1)

(2)

evalf(JacobiP(3, 1/2, 1/2, 1))

2.187500000

(3)

f := proc (n, x) options operator, arrow; (1/4)*JacobiP(n, 1/2, 1/2, x)*4^(1/2)/(GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n)))^(1/2) end proc

proc (n, x) options operator, arrow; (1/4)*JacobiP(n, 1/2, 1/2, x)*4^(1/2)/(GAMMA(n+3/2)^2/((2*n+2)*GAMMA(n+2)*factorial(n)))^(1/2) end proc

(4)

int(f(1, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(5)

int(f(2, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(6)

int(f(3, x)^2*sqrt(-x^2+1), x = -1 .. 1)

1

(7)

c := proc (n) options operator, arrow; int(sqrt(1+x)*f(n, x)*sqrt(-x^2+1), x = -1 .. 0)+int(f(n, x)*sqrt(-x^2+1), x = 0 .. 1) end proc

proc (n) options operator, arrow; int(sqrt(1+x)*f(n, x)*sqrt(-x^2+1), x = -1 .. 0)+int(f(n, x)*sqrt(-x^2+1), x = 0 .. 1) end proc

(8)

c(12)

(2/450225)*(-208+679*2^(1/2))/Pi^(1/2)

(9)

S := proc (N, x) options operator, arrow; evalf(sum(c(n)*f(n, x), n = 0 .. N)) end proc

proc (N, x) options operator, arrow; evalf(sum(c(n)*f(n, x), n = 0 .. N)) end proc

(10)

S(1, 1)

Error, (in assuming) when calling 'assume'. Received: 'contradictory assumptions'

 

NULL

Download question.mw

https://www.maplesoft.com/support/help/errors/view.aspx?path=Error,%20(in%20assuming)%20when%20calling%20%27assume%27.%20Received%3A%20%27contradictory%20assumptions%27

Many thanks in advance

Hi,

The procedure below returns the plots of 3 matrices whose eigenvalues are given and fixed (but chosen randomly). Plots are returned simultaneously via the command display. When I run the procedure 2-3 times, I realize that the drawings are not directly comparable. I have to say that I have naively used the command (three times, i.e. for each plot):

implicitplot("function", -2 .. 2, -2 .. 2, axes = boxed, color = blue, gridrefine = 3, scaling = constrained, resolution = 1000); 

Is there a way to "force" maple to return -- each time I run the procedure -- plots of the same size, same scaling and so on ? I would like also to put names on the axis with consistent writings and fonts. Is it possible ?

Many thanks,

Best,

Rachid

-----

with(plots);
with(LinearAlgebra);
P0 := proc(n, epsilon)
local m, N, D1, Modu, fs, f1, f2, f, q, s, r, t, eps, pp, k;
eps := epsilon;
m := n;
N := eval(RandomMatrix(m, m));
N := N/evalf(Norm(evalf(N), 2));
D1 := DiagonalMatrix(Eigenvalues(N));
pp := pointplot({seq([Re(D1[k, k]), Im(D1[k, k])], k = 1 .. m)});
f := (i, j) -> if i = j then D1[i, i]; elif i = j + 1 then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2); elif j + 1 < i then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2)*mul(-conjugate(D1[t, t]), t = j + 1 .. i - 1); else 0; end if;
Modu := Matrix(m, (i, j) -> f(i, j)); fs := (x, y) -> Norm(1/((x + y*I)*IdentityMatrix(m) - N), 2) - 1/eps;
f1 := (x, y) -> Norm(1/((x + y*I)*IdentityMatrix(m) - D1), 2) - 1/eps;
f2 := (x, y) -> Norm(1/((x + y*I)*IdentityMatrix(m) - Modu), 2) - 1/eps;
s := implicitplot(fs, -2 .. 2, -2 .. 2, axes = boxed, color = blue, gridrefine = 3, scaling = constrained, resolution = 1000);
q := implicitplot(f1, -2 .. 2, -2 .. 2, axes = boxed, gridrefine = 3, scaling = constrained, resolution = 1000);
r := implicitplot(f2, -2 .. 2, -2 .. 2, axes = boxed, color = green, gridrefine = 3, scaling = constrained, resolution = 1000); RETURN(display({q, s, r, pp}));
end proc;

Hi,

In the code below I do not understand why f(3,1) cannot be computed : it returns the conjugate of D1[2,2] although I have defined it as a random number. Maybe you understand this ? Actually I first got an error message of the type "bad index into matrix". Thus I wrote ''D1''[t, t] instead of D1[t, t] to fix the issue in the product. 

Many thanks in advance for your help

with(LinearAlgebra);
D1 := evalf(RandomMatrix(3));
f := (i, j) -> if i = j then D1[i, i]; elif i = j + 1 then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2); elif j + 1 < i then (1 - abs(D1[i, i])^2)^(1/2)*(1 - abs(D1[j, j])^2)^(1/2)*product(-conjugate(''D1''[t, t]), t = j + 1 .. i - 1); else 0; end if;
f(1, 1);
f(1, 2), f(1, 3);
f(2, 2);
f(2, 3);
f(3, 3);
f(2, 1);
f(3, 2);
f(3, 1);
Modu := evalf(Matrix(3, (i, j) -> f(i, j)));

f(3,1) is given by 3222.984487*conjugate(D1[2, 2]): I do not get why the value of D1[2,2] is ignored.

1 2 Page 1 of 2