dharr

Dr. David Harrington

8455 Reputation

22 Badges

21 years, 29 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

[Edited based on Carl's comment]. At least for real parameters (where the Matrix is Hermitian), there must be four eigenvectors.Not setting phi=Pi circumvents the OPs error message, and 4 eigenvectors are found, but then substituting phi=Pi leads to an error.


 

restart;

with(LinearAlgebra):

assume(k1,real,k2,real,m1,real,m2,real,phi,real);

Leave phi unspecified for now

A := <
          <0, 0, exp(I*k1) + m1, exp(I*k2) + m2>|
          <0, 0, exp(I*phi)*(exp(-I*k2) + m2), exp(-I*k1) + m1>|
          <exp(-I*k1) + m1, exp(-I*phi)*(m2 + exp(I*k2)), 0, 0>|
          <exp(-I*k2) + m2, exp(I*k1) + m1, 0, 0>
     >;

A := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = exp(-I*k1)+m1, (1, 4) = exp(-I*k2)+m2, (2, 1) = 0, (2, 2) = 0, (2, 3) = exp(-I*phi)*(exp(I*k2)+m2), (2, 4) = exp(I*k1)+m1, (3, 1) = exp(I*k1)+m1, (3, 2) = exp(I*phi)*(exp(-I*k2)+m2), (3, 3) = 0, (3, 4) = 0, (4, 1) = exp(I*k2)+m2, (4, 2) = exp(-I*k1)+m1, (4, 3) = 0, (4, 4) = 0})

Under the assumptions that the parameters are real, the Matrix is Hermitian and so must have 4 eigenvectors

simplify(A-A^%H);

Matrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])

If we specifiy phi=Pi, we get the OP's error

evals,evecs:=LinearAlgebra:-Eigenvectors(eval(A,phi=Pi)):

Error, (in LinearAlgebra:-Eigenvectors) multiplicity mismatch

If we leave phi unspecified, then we don't get the error message, and get 4 eigenvectors

evals,evecs:=LinearAlgebra:-Eigenvectors(A):
nops(evals),nops(evecs);  #nops always reterns 3, as Carl points out
numelems(evals),numelems(evecs);

3, 3

4, 16

Now specify phi=Pi. Works for the eigenvalues, but not for the eigenvectors. Perhaps some manipulation could improve this, but I'm not sure

evals2:=eval(evals,phi=Pi);
eval(evecs,phi=Pi);

evals2 := Vector(4, {(1) = (2+m1^2+m2^2+2*m1*cos(k1)+2*m2*cos(k2))^(1/2), (2) = -(2+m1^2+m2^2+2*m1*cos(k1)+2*m2*cos(k2))^(1/2), (3) = (2+m1^2+m2^2+2*m1*cos(k1)+2*m2*cos(k2))^(1/2), (4) = -(2+m1^2+m2^2+2*m1*cos(k1)+2*m2*cos(k2))^(1/2)})

Error, numeric exception: division by zero

 


 

Download Hermitian2.mw

When legend is a list there need to be multiple curves, but you had one curve with 3 points. One way to do this is:

display(pointplot([28,.6481496576],color=blue),pointplot([28,.648149657615473],color=orange),pointplot([28,.6512873548],color=red),style=point,labels = ["k", "y(k)"], legend = ["10-digit precision", "15-digit precision", "Floating-point iteration"] ,legendstyle = [font = ["HELVETICA", 9], location = right]);
 

 

Not entirely certain I know what you want, but this may be a start.

[Edit: I changed pi (just a symbol) to Pi (the circle constant thing)]

At the beginning I define i to be sqrt(-1) as you want and D to be a regular variable rather than the differential operator.

Maple gives the answer as a sum over roots of a quartic polynomial. To get a simpler formula, you will need to give values to some variables or parhaps tell Maple their signs (using assuming)

Download Linear_System.mw

As well as Joe's corrections, you need to assign to y (y:=1). 
 

r:=proc(x)
    local y;
    if (x=1)
    then    
    y:=1;
    else
        y:=0;
    end if;
    return y
    end proc;    
 

proc (x) local y; if x = 1 then y := 1 else y := 0 end if; return y end proc

h:=proc(x);
    if (x= infinity)
    then    
    return 1 ;
    else
        return 0;
        end if;
    end proc

proc (x) if x = infinity then return 1 else return 0 end if end proc

r(1);r(2);

1

0

h(1);h(infinity);

0

1

 


 

Download ww.mw

 

I suspect you want gcdex(x^9-a, b*x^6-c, x); but the answer is 1. You may need to specify the numerical value of more of the coefficients.

Try

T := unapply('fsolve'(m(t, c) = -1, t = 0 .. (1/2)*Pi), c, numeric);

In general use unapply to make functions from expressions earlier in the worksheet. The numeric option means that plot and other functions evaluated with a symbolic value will not throw an error.

So the constant _C3 means another condition is required. Presumably you want the solution to drop off at y=infinity.

pdetest suggests your solution does not solve the pde.
 

Download pde.mw

Use := to assign the right-hand side to the left. Some other issues also:

v:= <1 |1| 0>;
w:=<1,1,0>;
M:=<1, 2, 3; 5, 4, 3; 7, 9, 0>;
c:=v.M;
d:=M.w;

v := Vector[row](3, {(1) = 1, (2) = 1, (3) = 0})

w := Vector(3, {(1) = 1, (2) = 1, (3) = 0})

M := Matrix(3, 3, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (2, 1) = 5, (2, 2) = 4, (2, 3) = 3, (3, 1) = 7, (3, 2) = 9, (3, 3) = 0})

c := Vector[row](3, {(1) = 6, (2) = 6, (3) = 6})

d := Vector(3, {(1) = 3, (2) = 9, (3) = 16})

 


 

Download vectors.mw

Try entering in 1D Maple input, e.g. at a > prompt use ctrl-M then `&le;`

You will see that `&le;` is rendered as less-than-or-equals, as it would be in HTML.

Changes in red.
 

 RK2skritt:=proc(FR::procedure,xo,yo,vxo,vyo,h)
 local x, y, vx, vy, r, kx1, kx2, kx3, kx4, ky1, ky2, ky3, ky4, lx1, lx2, lx3, lx4, ly1, ly2, ly3, ly4, tmp;
 r:=sqrt(xo*xo+yo*yo);
 tmp:=-(h*FR(r))/(r);
 lx1:=h*vxo;
 ly1:=h*vyo;
 kx1:=tmp*xo;
 ky1:=tmp*yo;
 lx2:=h*(vxo+0.5*kx1);
 ly2:=h*(vyo+0.5*ky1);
 r:=sqrt((xo+0.5*lx1)^(2)+(yo+0.5*ly1)^(2));
 tmp:=-(h*FR(r))/(r);
 kx2:=tmp*(xo+0.5*lx1);
 ky2:=tmp*(yo+0.5*ly1);
 lx3:=h*(vxo+0.5*kx2);
 ly3:=h*(vyo+0.5*ky2);
 r:=sqrt((xo+0.5*lx2)^(2)+(yo+0.5*ly2)^(2));
 tmp:=-(h*FR(r))/(r);
 kx3:=tmp*(xo+0.5*lx2);
 ky3:=tmp*(yo+0.5*ly2);
 lx4:=h*(vxo+kx3);
 ly4:=h*(vyo+ky3);
 r:=sqrt((xo+lx3)^(2)+(yo+ly3)^(2));
 tmp:=-(h*FR(r))/(r);
 kx4:=tmp*(xo+lx3);
 ky4:=tmp*(yo+ly3);  #edit - one more here
 x:=xo+(lx1+2*lx2+2*lx3+lx4)/(6);
 y:=yo+(ly1+2*ly2+2*ly3+ly4)/(6);
 vx:=vxo+(kx1+2*kx2+2*kx3+kx4)/(6);
 vy:=vyo+(ky1+2*ky2+2*ky3+ky4)/(6);
 [x,y,vx,vy]; end proc:

 

 

Download proc.mw

There is a missing *. The differentiation works in Maple 2017.
 

Download Diff.mw

 

 

restart

Case 1

de1:=diff(U(x),x,x)=0;
bc1:=U(0)=10,U(L)=20;
ans1:=dsolve({de1,bc1},U(x));

diff(diff(U(x), x), x) = 0

U(0) = 10, U(L) = 20

U(x) = 10*x/L+10

Case 2

de2:=diff(U(x),x,x)=-x^2;
bc2:=U(0)=T,D(U)(L)=0;
ans2:=dsolve({de2,bc2},U(x));

diff(diff(U(x), x), x) = -x^2

U(0) = T, (D(U))(L) = 0

U(x) = -(1/12)*x^4+(1/3)*L^3*x+T

 

 


 

Download rod.mw

Like this?

NULL

restart

n := 4; C := proc (K) options operator, arrow; Vector([seq(cos(2*Pi*K*l/n), l = 0 .. n-1)]) end proc; S := proc (K) options operator, arrow; Vector([seq(sin(2*Pi*K*l/n), l = 0 .. n-1)]) end proc

4

proc (K) options operator, arrow; Vector([seq(cos(2*Pi*K*l/n), l = 0 .. n-1)]) end proc

proc (K) options operator, arrow; Vector([seq(sin(2*Pi*K*l/n), l = 0 .. n-1)]) end proc

C(2); S(3)

Vector[column]([[1], [-1], [1], [-1]])

Vector[column]([[0], [-1], [0], [1]])

These two are orthogonal

C(2).S(3)

0

C(2).C(2)

4

 

NULL


 

Download orthogonal.mw

I did G11; the others are similar

Transfer_function.mw

In the File Menu under Document Properties, you should have an attribute named Active which is false for a regular help page and true for an active worksheet.

First 61 62 63 64 65 66 67 Last Page 63 of 83