dharr

Dr. David Harrington

2403 Reputation

15 Badges

17 years, 146 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 professor of chemistry at the University of Victoria, BC, Canada, where 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

Interesting - it worked in version 2015. Probably evalc(abs(...)) would force it.

interface(version)

`Standard Worksheet Interface, Maple 2015.1, Windows 8, June 4 2015 Build ID 1049007`

restart;

v:=1/16*(I*5^(1/2)+I-4*sin(1/5*Pi))*2^(3/10)*(5-5^(1/2))^(1/2)-1/8*2^(4/5)*((I*5^(1/2)+I)*sin(1/5*Pi)+1/2*5^(1/2)+3/2)

(1/16)*(I*5^(1/2)+I-4*sin((1/5)*Pi))*2^(3/10)*(5-5^(1/2))^(1/2)-(1/8)*2^(4/5)*((I*5^(1/2)+I)*sin((1/5)*Pi)+(1/2)*5^(1/2)+3/2)

abs(v)

((-(1/4)*(5-5^(1/2))^(1/2)*2^(3/10)*sin((1/5)*Pi)-(1/8)*2^(4/5)*((1/2)*5^(1/2)+3/2))^2+((1/16)*(5-5^(1/2))^(1/2)*2^(3/10)*(5^(1/2)+1)-(1/8)*2^(4/5)*(5^(1/2)+1)*sin((1/5)*Pi))^2)^(1/2)

sqrt( Re(v)^2 + Im(v)^2 );

((-(1/4)*(5-5^(1/2))^(1/2)*2^(3/10)*sin((1/5)*Pi)-(1/8)*2^(4/5)*((1/2)*5^(1/2)+3/2))^2+((1/16)*(5-5^(1/2))^(1/2)*2^(3/10)*(5^(1/2)+1)-(1/8)*2^(4/5)*(5^(1/2)+1)*sin((1/5)*Pi))^2)^(1/2)

 

Download complex.mw

Perhaps this is what you want. The default is standard in earlier versions of Maple, but extended in more recent versions.

Use of Typesetting:-RuleAssistant(); (or view->typesetting from the menu) gives you finer control, or commands from the Typesetting package.

restart;

interface(typesetting=standard):

BesselJ(nu,z);

BesselJ(nu, z)

interface(typesetting=extended):

BesselJ(nu,z);

BesselJ(nu, z)

 

Download typesetting.mw

On my windows system and Maple 2015, copying a 2D plot only gives bitmap options under paste special (in CorelDraw). But using the right-click menu to export the plot as an eps file gives a vector graphics file that I can import into CorelDraw and edit. For my version of Maple, this doesn't work with 3D plots, but that might be fixed in later versions.

You aren't clear about what you want or what you have tried. If I assume that omega^2 are the eigenvalues (and not the lambdas), then this is a generalized eigenvalue problem for which Maple's Eigenvectors routine gives an answer in a straighforward way. I then forced a change of algorithm whch makes some of the apparently infinite eigenvalues to change to zero, but everything else looks the same.
 

restart;

interface(version);with(LinearAlgebra):

`Standard Worksheet Interface, Maple 2015.1, Windows 8, June 4 2015 Build ID 1049007`

M:=4;N:=2;
gen:=generator=-5.0..5.0;
gen2:=generator=1..10; #positive

4

2

generator = -5.0 .. 5.0

generator = 1 .. 10

Generate positive definite matrices

U:=RandomMatrix(M,gen):
v:=RandomVector(M,gen2):
K11:=U.DiagonalMatrix(v).U^+;
IsDefinite(K11,query=positive_definite);

K11 := Matrix(4, 4, {(1, 1) = 474.7658127874699, (1, 2) = -394.5805117919539, (1, 3) = 351.8490779680129, (1, 4) = 198.4791447697421, (2, 1) = -394.5805117919539, (2, 2) = 360.93618001079045, (2, 3) = -217.9024802412394, (2, 4) = -174.93938764201536, (3, 1) = 351.8490779680129, (3, 2) = -217.9024802412394, (3, 3) = 505.123761706797, (3, 4) = 265.84210885475943, (4, 1) = 198.4791447697421, (4, 2) = -174.93938764201536, (4, 3) = 265.84210885475943, (4, 4) = 470.4006207069442}, datatype = float[8])

true

U:=RandomMatrix(M,gen):
v:=RandomVector(M,gen2):
M11:=U.DiagonalMatrix(v).U^+;
IsDefinite(M11,query=positive_definite);

M11 := Matrix(4, 4, {(1, 1) = 272.44547278749656, (1, 2) = 22.899421458964056, (1, 3) = 159.030669014186, (1, 4) = -83.8538688915777, (2, 1) = 22.899421458964042, (2, 2) = 68.239163210607, (2, 3) = 99.66785764378282, (2, 4) = 53.80202849499173, (3, 1) = 159.030669014186, (3, 2) = 99.66785764378282, (3, 3) = 274.1189955623002, (3, 4) = 48.57077391674729, (4, 1) = -83.8538688915777, (4, 2) = 53.80202849499173, (4, 3) = 48.570773916747285, (4, 4) = 158.7300008588166}, datatype = float[8])

true

Assemble K and M matrices

K12:=RandomMatrix(M,N,gen):
KK1:=Matrix(<<K11|K12>,<K12^+|Matrix(N,N,0)>>,shape=symmetric);
IsDefinite(KK1,query=positive_semidefinite);

KK1 := Matrix(6, 6, {(1, 1) = HFloat(474.7658127874699), (1, 2) = HFloat(-394.5805117919539), (1, 3) = HFloat(351.8490779680129), (1, 4) = HFloat(198.4791447697421), (1, 5) = 1.79702676853674781, (1, 6) = 1.46313010111264674, (2, 2) = HFloat(360.93618001079045), (2, 3) = HFloat(-217.9024802412394), (2, 4) = HFloat(-174.93938764201536), (2, 5) = -2.23974923001421633, (2, 6) = -.544137992891005062, (3, 3) = HFloat(505.123761706797), (3, 4) = HFloat(265.84210885475943), (3, 5) = 2.54686681982360863, (3, 6) = -.102356042117689228, (4, 4) = HFloat(470.4006207069442), (4, 5) = 2.09364830858072537, (4, 6) = -3.13127395445621381, (5, 5) = 0, (5, 6) = 0, (6, 6) = 0}, storage = triangular[upper], shape = [symmetric])

false

MM1:=Matrix(<<M11|Matrix(M,N,0)>,<Matrix(N,M,0)|Matrix(N,N,0)>>,shape=symmetric);
IsDefinite(MM1,query=positive_semidefinite);

MM1 := Matrix(6, 6, {(1, 1) = HFloat(272.44547278749656), (1, 2) = HFloat(22.899421458964056), (1, 3) = HFloat(159.030669014186), (1, 4) = HFloat(-83.8538688915777), (1, 5) = 0, (1, 6) = 0, (2, 2) = HFloat(68.239163210607), (2, 3) = HFloat(99.66785764378282), (2, 4) = HFloat(53.80202849499173), (2, 5) = 0, (2, 6) = 0, (3, 3) = HFloat(274.1189955623002), (3, 4) = HFloat(48.57077391674729), (3, 5) = 0, (3, 6) = 0, (4, 4) = HFloat(158.7300008588166), (4, 5) = 0, (4, 6) = 0, (5, 5) = 0, (5, 6) = 0, (6, 6) = 0}, storage = triangular[upper], shape = [symmetric])

true

Solve the generalized eigenvector problem. I expected shape=symmetric to have forced floating eigenvalues, but got complex with zero imaginary parts.

a,A:=Eigenvectors(KK1,MM1):
a:=simplify(a,zero); #omega^2
A:=simplify(A,zero); #Matrix of eigenvectors

a := Vector(6, {(1) = Float(infinity), (2) = .2149302052, (3) = 2.116223628, (4) = Float(infinity), (5) = Float(infinity), (6) = Float(infinity)})

A := Matrix(6, 6, {(1, 1) = 0.1000325662e-16, (1, 2) = 0.2174714741e-1, (1, 3) = 0.1631790375e-1, (1, 4) = -0.1958722750e-15, (1, 5) = 0.1958722750e-15, (1, 6) = -0.1958722750e-15, (2, 1) = 0.1420916980e-17, (2, 2) = 0.2120815680e-1, (2, 3) = 0.6383498867e-3, (2, 4) = -0.8702374350e-15, (2, 5) = 0.8702374350e-15, (2, 6) = -0.8702374350e-15, (3, 1) = -0.5014663949e-18, (3, 2) = -0.2073139398e-2, (3, 3) = -0.1760199195e-1, (3, 4) = 0.5795456890e-15, (3, 5) = -0.5795456890e-15, (3, 6) = 0.5795456890e-15, (4, 1) = -0.4691589519e-18, (4, 2) = 0.6543962858e-2, (4, 3) = 0.8089211079e-2, (4, 4) = -0.4920891737e-15, (4, 5) = 0.4920891737e-15, (4, 6) = -0.4920891737e-15, (5, 1) = .2413182421, (5, 2) = -1., (5, 3) = -1., (5, 4) = .2413182421, (5, 5) = -.2413182421, (5, 6) = .2413182421, (6, 1) = 1., (6, 2) = .3145075051, (6, 3) = .6624358604, (6, 4) = 1., (6, 5) = -1., (6, 6) = 1.})

Try to force different algorithm with positive definite attribute (see Matrix help page), but since they are not, this may lead to garbage.
Find the eigenvalues are now real, and some of the infinite ones are now zero. Eigenvectors are just the same.

KK2:=Matrix(KK1,shape=symmetric,attributes=[positive_definite]):
MM2:=Matrix(MM1,shape=symmetric,attributes=[positive_definite]):

a2,A2:=Eigenvectors(KK2,MM2):
a2;
simplify(A2,zero);

Vector[column]([[HFloat(HFloat(infinity))], [0.], [.214930205212523], [0.], [2.11622362773322], [0.]])

Matrix([[0.1000325662e-16, 0.2174714741e-1, 0.1631790375e-1, -0.1958722750e-15, 0.1958722750e-15, -0.1958722750e-15], [0.1420916980e-17, 0.2120815680e-1, 0.6383498867e-3, -0.8702374350e-15, 0.8702374350e-15, -0.8702374350e-15], [-0.5014663949e-18, -0.2073139398e-2, -0.1760199195e-1, 0.5795456890e-15, -0.5795456890e-15, 0.5795456890e-15], [-0.4691589519e-18, 0.6543962858e-2, 0.8089211079e-2, -0.4920891737e-15, 0.4920891737e-15, -0.4920891737e-15], [.2413182421, -1., -1., .2413182421, -.2413182421, .2413182421], [1., .3145075051, .6624358604, 1., -1., 1.]])

 

 

Download evecs2.mw

Edit: noticed the eigenvalues change order but the eigenvectors did not. Interesting.

As @tomleslie says, uploading a worksheet would be helpful. I'm guessing Maple is lacking some information to proceed further, or perhaps you used a=expression rather than a:=expression. evalc can give a value for abs assuming the variables are real:

a := 1/(1+I*omega*tau)

1/(1+I*omega*tau)

Maple doesn't know enough about omega and tau to simplify any further than

abs(a);

1/abs(1+I*omega*tau)

evalc forces evaluation assuming all the indeterminates are real

evalc(abs(a));

1/(omega^2*tau^2+1)^(1/2)

Or the assumptions can be explicitly stated

`assuming`([abs(a)], [positive]);

1/(omega^2*tau^2+1)^(1/2)

 

Download evalc.mw

When you chose the initial condition y(0)=0, the solution returned has "I" in it, and so your main difficulty is that the solutions are complex. If you choose instead y(0)=2, then you can get an implicit plot. Note implicitplot is in the plots package so you need with(plots) first, or use plots:-implicitplot.

with(DEtools, odeadvisor)````NULL

ode := diff(y(x), x) = (-.1*(y(x)-.7)^3-.8*y(x)*(y(x)-.7)^2)/(.7^2-(2*.7)*y(x)+y(x)^2-.7*(.2*.8))

diff(y(x), x) = (-.1*(y(x)-.7)^3-.8*y(x)*(y(x)-.7)^2)/(.378-1.4*y(x)+y(x)^2)

odeadvisor(ode)

[_quadrature]

ans := dsolve(ode, implicit)

x+2/(-7+10*y(x))+(199/252)*ln(90*y(x)-7)+(9/28)*ln(-7+10*y(x))+_C1 = 0

ic1 := y(0) = 2

y(0) = 2

sol := dsolve([ode, ic1], implicit)

x+2/(-7+10*y(x))+(199/252)*ln(90*y(x)-7)+(9/28)*ln(-7+10*y(x))-2/13-(199/252)*ln(173)-(9/28)*ln(13) = 0

sol2 := subs(y(x) = y, sol)

x+2/(-7+10*y)+(199/252)*ln(90*y-7)+(9/28)*ln(-7+10*y)-2/13-(199/252)*ln(173)-(9/28)*ln(13) = 0

plots:-implicitplot(sol2, x = 0 .. 2, y = 0 .. 2, gridrefine = 2)

``


 

Download implicitode.mw

I would just use series for this - then you take only the first term of the result

E__2 := m__0*c^2/sqrt(1-(v/c)^2)-m__0*c^2;

m__0*c^2/(1-v^2/c^2)^(1/2)-m__0*c^2

series(E__2, v);

series(((1/2)*m__0)*v^2+((3/8)*m__0/c^2)*v^4+O(v^6),v,6)

series(E__2, v, 4);

series(((1/2)*m__0)*v^2+O(v^4),v,4)

taylor(E__2, v);

series(((1/2)*m__0)*v^2+((3/8)*m__0/c^2)*v^4+O(v^6),v,6)

 

Download series.mw

Working from the definition of the coefficients also works here.

Download Taylor.mw

I added an explicit multiplication between )( in the middle of ODE1, I changed D(f)(0)^2 to (D@@2)(f)(0) (not sure what you wanted), and removed Digits:=3. (You want full hardware precision here). Now it is producing output.

FDM_EYRING_POWELL2.mw

One of the examples on the help page shows how to do this.

L := Split("This string has some    extra 		whitespace    in it.");
remove(type, L, "");

 

You didn't upload your worksheet (green up-arrow), so I can't be sure, but I'd guess that you are using the default 2D math and have an extra space between p and (T)=0 i.e. p (T) instead of p(T). The extra space means it is interpreted as multiply rather than as a function. (The error message says pT=0 as though p is multiplied by T).

or perhaps you mean p(0)=0? The variable T isn't mentioned.

Edit:

See Carl's answer.

Most of your examples are polynomials, for which the following works fairly simply. It fails your last two non-polynomial examples, but probably could be fixed with something like frontend or freeze/thaw.

common_factor:=proc(x,z)
  local xn:=x^ldegree(collect(z,x),x);
  if rem(z,xn,x)=0 then xn*quo(z,xn,x) else z end if;
end proc;

Your two variables are many orders of magnitude apart, so you need to force full precision calculations using the fulldigits option, and you need to help by specifying a much narrower search range for p

fsolve({hyper_p31(lambda, 4, 2, 1.0*10^10)-p = 0, `hyper_&lambda;31`(p, 4, 2, 1.0*10^10)-lambda = 0},
 {lambda = 0 .. 1, p = 0 .. 0.1e-5}, fulldigits)

test_temp.mw

A 3d plot is a good way to get an overall picture. 

plot3d(z,x=-1..1,y=-1..1,style=surfacecontour);

If you want specific z values for your contours, you can use the contours option:

plot3d(z,x=-1..1,y=-1..1,style=surfacecontour,contours=[-30,-20,-10,0,10,20,30,40]);

 

I think you wanted print(p) in B. But I agree there are no output plot files generated. (I'm using Maple 2015.) I usually use the interface command to do these plot outputs rather than plotsetup, e.g., interface(plotdevice=ps, etc), and maybe that is a clue. I'm guessing that since it is running headless, that means that none of those interface features work, and so plots cannot be output in this way.

1 2 3 4 5 6 7 Last Page 1 of 35