dharr

Dr. David Harrington

8837 Reputation

22 Badges

21 years, 122 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 replies submitted by dharr

@SHIVAS 

For your new equation,

pdsolve(OdeSys, Theta(X, tau))

gives no solution so it is unlikely that one exists.

@2cUniverse 

I put almost all the code in the startup code region, and in the click, changed etc code regions I just call a procedure defined in the startup region. This means you aren't debugging multiple bits of code in multple locations, and you can have extensive code without any problem.

I loaded the packages in the startup region and it seemed to work consistently.

pb-App_0.1.mw

@mmcdara Interesting approach. In the small amount of reading I did, I recall something about the fact that values need not be near the corresponding eigenvalue. For contour plots, I'm not sure the results are invalid, just that you might need very fine countours to catch the unusual locations?

@rzarouf These sorts of full evaluation problems for making plots are common and are best solved by using the procedure form of the plot call, though you also found a bug in Norm, for which I will submit an SCR.

restart

with(LinearAlgebra):with(plots):

A := LinearAlgebra:-DiagonalMatrix([-1., I + 1., -I]);

Matrix(3, 3, {(1, 1) = -1., (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1.+1.*I, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -I})

After replacing the regular inverse with the matrix inverse, we still have a problem

implicitplot((0.1)^(-1) < Norm(MatrixInverse((x + y*I)*IdentityMatrix(3) - A), 2), x = -1 .. 1, y = -1 .. 1);

Error, (in factor/remember) floating point coefficients are incompatible with field extension; use 'real' or 'complex' instead

Track it down

B:=MatrixInverse((x + y*I)*IdentityMatrix(3) - A);

Matrix(3, 3, {(1, 1) = 1/(x+I*y+1.), (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1/(x+I*y+(-1.-1.*I)), (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1/(x+I*y+I)})

Next is a bug in Norm

Norm(B,2);

Error, (in factor/remember) floating point coefficients are incompatible with field extension; use 'real' or 'complex' instead

But if we have values for x and y it works

Norm(eval(B,{x=0.1,y=0.2}),2);

.8944271910

Aside from the bug, we don't want to do the inverse symbolically and then put numbers in (except for very small matrices perhaps). We solve this problem, really a full evaluation issue, by making a procedure.

f:=(x,y)->Norm(MatrixInverse((x + y*I)*IdentityMatrix(3) - A), 2)-(0.1)^(-1);

proc (x, y) options operator, arrow; LinearAlgebra:-Norm(LinearAlgebra:-MatrixInverse((x+I*y)*LinearAlgebra:-IdentityMatrix(3)-A), 2)-0.1e2 end proc

implicitplot(f, -2 .. 2, -2 .. 2,axes=boxed);

Doing it by singular values is more efficient; in general evaluation of matrix inverse should be avoided. The 2-norm of the resolvent (z*I-A)^(-1) is the reciprocal of the minimum singular value of z*I-A. I didn't track the following error down, but again we should avoid full evaluation by making a procedure.

implicitplot((0.1)^(-1) < 1/min(SingularValues((x + y*I)*IdentityMatrix(3) - A)), x = -1 .. 1, y = -1 .. 1);

Error, (in LinearAlgebra:-Eigenvalues) expecting either Matrices of rationals, rational functions, radical functions, algebraic numbers, or algebraic functions, or Matrices of complex(numeric) values

fs:= (x,y)->1/min(SingularValues((x + y*I)*IdentityMatrix(3) - A))-(0.1)^(-1);

proc (x, y) options operator, arrow; 1/min(LinearAlgebra:-SingularValues((x+I*y)*LinearAlgebra:-IdentityMatrix(3)-A))-0.1e2 end proc

implicitplot(fs, -2 .. 2, -2 .. 2,axes=boxed);

We could avoid some reciprocals by doing

fs2:= (x,y)->min(SingularValues((x + y*I)*IdentityMatrix(3) - A))-(0.1);

proc (x, y) options operator, arrow; min(LinearAlgebra:-SingularValues((x+I*y)*LinearAlgebra:-IdentityMatrix(3)-A))-.1 end proc

implicitplot(fs2, -2 .. 2, -2 .. 2,axes=boxed);

NULL

Download pseudospectrum2.mw

@Carl Love Thanks. Sometimes I hope the OPs provide at least some information to help. (If it's not in Horn and Johnson it seems it must be a bit exotic.) Turns out it was easier than I thought to calculate.

Please explain what a pseudospectrum is. If you just mean to plot the eigenvalues of a matrix in the complex plane, that can easily be done with complexplot.

@SHIVAS You need to solve and create the plots in a loop and then combine them with plots:-display. For example if your plots for different Nr are eta[1],eta[2] etc, then they are combined by something like plots:-display([seq(eta[i],i=1..3)])

@treverona Once you have a symbolic power like your d then Maple doesn't consider it as a polynomial, so the usual commands to find degrees don't work.

@sursumCorda OP said multivariable polynomial, and I think it is OK for that. I suppose it would be more robust if you expanded p first, but the meaning of the answer depends on the order of the terms that is given, so I assumed that it was given as a sum of terms.

@SHIVAS Ans[k] is the output from pdsolve, which is a module - it can't be used in the same way as the output from dsolve. See the help page ?pdsolve,numeric for how to use the module to create plots and find values.

@Tamour_Zubair 

solve(subs(y(t)=y,sol),t); gives t as a function of y.

@Tamour_Zubair There isn't an analytical solution for y as a function of t; the RootOf is the best you can do. On the other hand, from the implicit solution you can get t as an analytical function of y. 

Please check your boundary condition D(f)(0) = lambda + xi*(D^2)(f)(0). Note that if you wanted the second derivative and not the square of the first derivative, then you need D(f)(0) = lambda + xi*(D@@2)(f)(0)

@NeraSnow Your procedure to upload the worksheet was correct, but the website is not working correctly today, as happens sometimes.

@Carl Love Yes, I tried something like this expecting the new inline loops might be more efficient, but was disappointed (as I've found a couple of times before).

There is also the issue of counts>9, which I missed originally. So "1111111111111" gives "131" in my code, but "11111111111111" in yours.

First 49 50 51 52 53 54 55 Last Page 51 of 95