dharr

Dr. David Harrington

8205 Reputation

22 Badges

20 years, 336 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

As in the help page, Maple outputs the normal form without the D. As per the Wikipedia page, the D can be found from L by taking the squares of the diagonal entries. Following the prescription there, if L is the matrix from Maple's output:

S := DiagonalMatrix([seq(L[i, i], i = 1 .. Dimension(L)[1])]);

D:=S^2;

New L:

Lnew:=L.S^(-1);

 

 

Following Carl's suggestion, the algorithm seems to give eigenvectors with the symmetry you want, except for those corresponding to the pair of zero eigenvalues, and the matrix of eigenvectors produced is orthogonal (as expected for a symmetric matrix). Furthermore the eigenvectors corresponding to the zero eigenvalues both seem to have their 2nd half entries the negative of the first half entries (see below for an example), say [x,-x] and [y,-y] (this is sloppy notation for column vectors stacked above each other).

Now the only possibility is that there are linear combinations of the eigenvectors for the zero eigenvalues that have the symmetry you want. Now any linear combination of [x,-x] and [y,-y] is [z,-z] and so any two orthogonal linear combinations must be [z,-z] and [z2,-z2]. But you want these [v1,v2] and [v2,v1] which can only occur if v2=-v1 so [v1,-v1] and [-v1,v1]. But these are multiples of each other and so not linearly independent.

Perhaps I'm missing something, but are you sure that this is possible?

restart;with(LinearAlgebra):

A:=Matrix(4,4,shape=symmetric,[[2],[3,3],[5,1,0],[6,2,-1,0]]);
B:=Matrix(4,4,shape=skewsymmetric,[[1],[0,2],[5,1,0],[1,-2,1,2]]);
Rank(A);Rank(B);

A := Matrix(4, 4, {(1, 1) = 2, (1, 2) = 3, (1, 3) = 5, (1, 4) = 6, (2, 2) = 3, (2, 3) = 1, (2, 4) = 2, (3, 3) = 0, (3, 4) = -1, (4, 4) = 0}, storage = triangular[upper], shape = [symmetric])

B := Matrix(4, 4, {(1, 2) = 0, (1, 3) = -5, (1, 4) = -1, (2, 3) = -1, (2, 4) = 2, (3, 4) = -1, }, storage = triangular[upper,strict], shape = [skewsymmetric])

4

4

If the Matrix is specified with shape=symmetric, then the algorithm produces eigenvalues that are sorted, and a matrix of eigenvalues that is orthogonal

The eigenvectors have the required symmetry except for the ones corresponding to the zero eigenvalues, which are each of the form [x,-x]^T

M:=Matrix(shape=symmetric,<<A|B>,<-B|-A>>,datatype=float[8]);
evalsM,U:=Eigenvectors(M):
map(fnormal,evalsM);
U;

Typesetting:-mrow(Typesetting:-mi("M", italic = "true", mathvariant = "italic"), Typesetting:-mo(":=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mverbatim("-I'RTABLEG6"6%"5m"pW>uSuY%=-I'MATRIXG6"6#7*7*$""#""!$""$""!$""&""!$""'""!$""!""!$""!""!$!"&""!$!""""!7*$""$""!$""$""!$"""""!$""#""!$""!""!$""!""!$!""""!$""#""!7*$""&""!$"""""!$""!""!$!""""!$""&""!$"""""!$""!""!$!""""!7*$""'""!$""#""!$!""""!$""!""!$"""""!$!"#""!$"""""!$""!""!7*$""!""!$""!""!$""&""!$"""""!$!"#""!$!"$""!$!"&""!$!"'""!7*$""!""!$""!""!$"""""!$!"#""!$!"$""!$!"$""!$!""""!$!"#""!7*$!"&""!$!""""!$""!""!$"""""!$!"&""!$!""""!$""!""!$"""""!7*$!""""!$""#""!$!""""!$""!""!$!"'""!$!"#""!$"""""!$""!""!I'MatrixG6$%*protectedGI(_syslibG6""))

Vector[column]([[-13.06479065], [-7.478956942], [-1.541573335], [-0.], [0.], [1.541573335], [7.478956942], [13.06479065]])

Matrix([[.372087728267745, .442146960077929, 0.716552864407905e-1, -.121514458204212, .443710091875770, -.113015584183814, -.281846512162814, -.597551604649895], [-0.289133379852268e-1, 0.744724933588056e-1, -.365636713581575, .138873666519100, -.507097247858023, .502871793286012, -.509625534715401, -.266262877897865], [-.384750443216120, -.167445910347510, .262811302437603, -.708033369242197, -0.916903144690217e-1, .262811302437604, .167445910347510, -.384750443216120], [-.230331010247727, -.518003132670884, -.189283799017428, 0.123994345106340e-1, -0.452765399873239e-1, -.649272541315961, -.367968422739513, -.289193221914421], [.597551604649894, -.281846512162814, .113015584183814, .121514458204211, -.443710091875770, -0.716552864407900e-1, .442146960077928, -.372087728267744], [.266262877897865, -.509625534715401, -.502871793286012, -.138873666519099, .507097247858024, .365636713581574, 0.744724933588058e-1, 0.289133379852270e-1], [.384750443216120, .167445910347510, -.262811302437605, -.655955744297534, -.281851782415781, -.262811302437604, -.167445910347509, .384750443216120], [.289193221914421, -.367968422739513, .649272541315960, -0.123994345106347e-1, 0.452765399873234e-1, .189283799017428, -.518003132670884, .230331010247727]])

map(fnormal,Transpose(U).U); #U is orthogonal

Matrix([[1.000000000, 0., -0., -0., 0., 0., -0., 0.], [0., 1.000000000, -0., 0., 0., -0., 0., -0.], [-0., -0., 1.000000000, -0., -0., -0., -0., -0.], [-0., 0., -0., 1.000000000, -0., 0., -0., 0.], [0., 0., -0., -0., 1.000000000, -0., -0., 0.], [0., -0., -0., 0., -0., 1.000000000, -0., 0.], [-0., 0., -0., -0., -0., -0., 1.000000000, 0.], [0., -0., -0., 0., 0., -0., 0., 1.000000000]])

map(fnormal,Transpose(U).M.U); #similarity gives the diagonal matrix of eigenvalues

Matrix([[-13.06479065, -0., 0., 0., -0., 0., 0., -0.], [-0., -7.478956942, 0., -0., 0., -0., -0., 0.], [0., 0., -1.541573335, 0., 0., -0., 0., -0.], [0., -0., 0., 0., -0., 0., -0., -0.], [-0., 0., 0., -0., 0., 0., -0., -0.], [0., -0., -0., -0., 0., 1.541573335, -0., -0.], [0., -0., 0., -0., -0., -0., 7.478956942, 0.], [0., 0., -0., -0., -0., -0., 0., 13.06479065]])

 

 


 

Download SymmetryEigenvectors2.mw

Edit: Note that NullSpace(M) also gives eigenvectors of the form [x,-x], so the above isn't an artifact related to the fact that the two eigenvalues are small but not exactly the same.

Use Pi not pi for the mathematical constant 3.1416...; pi is just a symbol without a value. The Greek palette gives Pi not pi. 

Move from Text to Math and then choose 2D Math (not 2D Math input), as shown above.

@Rouben Rostamian's answer has the details. Explore allows you to easily vary y and see what happens to the plot. If you do this to the derivative, you see where the zeroes are:

Explore(plot(diff(x^2+y*(1-x)^(3/4),x),x=0..1),y=0..2.0);

or you can look at the plot and its derivative together:

f:=x^2+y*(1-x)^(3/4):Explore(plots:-display(<plot(f,x=0..1)|plot(diff(f,x),x=0..1)>),y=0..2.0);
 

firint in the DEtools package can calculate first integrals, which may be helpful. For your second order ode, it successfully produces a first order ode.

As I indicated to the OP on the other thread, if fsolve doesn't find an answer, it returns NULL (as in the response by @tomleslie) or unevaluated (as in the response by @mmcdara). If you want to test for both these possibilities, then you want

ans:=fsolve(x=x+1,x);

if ans=NULL or op(0,ans)=`fsolve` then "no" end if;

Note this handles also the multivariable case, where a valid solution won't just be a number or sequence of numbers, but something like {x=1, y=3}.

Testing NULL output from fsolve should work here, though sometimes fsolve just returns unevaluated.

Seems to me it is working, just fsolve is really slow. You can speed it up by using the last solution as the initial estimate (but convergence of your outer loop is still really slow).

Try

Q[h+1] := fsolve(eval(f[3], {R = R[h], S = S[h]}) = 0, Q = Q[h]);
if Q[h+1] = NULL then print("breakQ"); break end if;

 

If you work out Theta[k] and Phi[k] for k=2 nd 3, then you can use a single loop from 4 to M for Theta[k], Phi[k], F[k]. (I shouldn't really cut and paste to duplicate lines here.)

Solution_1-dharr.mw

 

as @mmcdara pointed out, you van specify ranges in which to search for solutions. You can also use the avoid option to not get the same solution, e.g. after ans1:=fsolve({f, g}); you can use fsolve({f, g},{x,y},avoid=ans1); to get the second solution.

plots:-complexplot(exp(I*theta),theta=0..2*Pi);

put the plot in a variable, e.g., p1:=plot(x^2,x=0..3):

and then lprint(p1);

Even though the first two seem to be interpreted as 2-D integrals, the correct syntax for 2D integrals needs the variables and ranges in a list (or nested 1D integrals), like

simplify(Int(integrand, [phi = 0 .. 2*Pi, r = 0 .. 2]));

and then you get the correct answers. 

You have two first order equations, so if you know omega[0] and sigma, you need only two initial conditions. Put them as a sequence not as a list to solve the syntax error. So give omega[0] and sigma values then

ICS:=C(0)=0,A(0)=1:
sol:=dsolve({C_t,A_t,ICS},{C(t),A(t)},type=numeric):
pRange:=0..20:
plots:-odeplot( sol, [t, A(t)],t=pRange, numpoints=10000 );  #note A(t) not A

If you want to find the values of omega[0] and sigma by specifying two additional conditions, then I think that only works with boundary value problems, and you have only initial conditions. Note also the syntax for derivative conditions

is D(C)(0)=0 for derivative zero at time zero 

 

I think dchange existed in Maple V, so try

integral := Int(2*(sin(theta)/cos(theta))^(2*p-1), theta = 0 .. (1/2)*Pi);
PDEtools[dchange]({theta=arctan(t)},integral);
value(%);

gives Pi*csc(Pi*p) (in Maple 2017)

 

First 66 67 68 69 70 71 72 Last Page 68 of 81