dharr

Dr. David Harrington

8235 Reputation

22 Badges

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

I agree with @nm and @tomleslie that the double underline subscript is better if you just want it to look nice. If you really want an indexed name with index 1d you can enclose it in back quotes: `1d`.

As for why it appears as 1., note that the floating point number 1 can be written as 1e0 or just 1e - see the ?float help page

Surprisingly, 1d does the same as 1e - try 1d3 to get 1000.

I'm guessing this is a holdover from the FORTRAN days, when d would have implied double precision

For example

plots:-complexplot3d(Zeta(z),z=-4-10*I..4+40*I,view=[default,default,-1..3]);


Of course you can play around with the ranges to see different parts. This is the magnitude and the colours give the phase.

Download Zeta.mw

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.4454727874966, (1, 2) = 22.89942145896406, (1, 3) = 159.03066901418603, (1, 4) = -83.8538688915777, (2, 1) = 22.899421458964053, (2, 2) = 68.23916321060702, (2, 3) = 99.66785764378282, (2, 4) = 53.80202849499174, (3, 1) = 159.030669014186, (3, 2) = 99.66785764378282, (3, 3) = 274.1189955623002, (3, 4) = 48.570773916747285, (4, 1) = -83.8538688915777, (4, 2) = 53.80202849499174, (4, 3) = 48.57077391674727, (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) = 2.95199901137063137, (1, 6) = -4.65553919497091240, (2, 2) = HFloat(360.93618001079045), (2, 3) = HFloat(-217.9024802412394), (2, 4) = HFloat(-174.93938764201536), (2, 5) = 2.65516788149002370, (2, 6) = 4.50222048838354993, (3, 3) = HFloat(505.123761706797), (3, 4) = HFloat(265.84210885475943), (3, 5) = -1.18441542906991604, (3, 6) = -1.82900519939139450, (4, 4) = HFloat(470.4006207069442), (4, 5) = -.612556403436017582, (4, 6) = 1.94828622975817023, (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.4454727874966), (1, 2) = HFloat(22.89942145896406), (1, 3) = HFloat(159.03066901418603), (1, 4) = HFloat(-83.8538688915777), (1, 5) = 0, (1, 6) = 0, (2, 2) = HFloat(68.23916321060702), (2, 3) = HFloat(99.66785764378282), (2, 4) = HFloat(53.80202849499174), (2, 5) = 0, (2, 6) = 0, (3, 3) = HFloat(274.1189955623002), (3, 4) = HFloat(48.570773916747285), (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. Shape=symmetric is not enough to force a real calculation and give floating eigenvalues, but get complex eigenvalueswith 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) = 6.793175977, (3) = .9218354408, (4) = Float(infinity), (5) = Float(-infinity), (6) = Float(infinity)})

A := Matrix(6, 6, {(1, 1) = -0.1839610129e-16, (1, 2) = 0.2525244976e-2, (1, 3) = 0.2283298399e-2, (1, 4) = -0.1082838565e-14, (1, 5) = 0.1046046362e-14, (1, 6) = 0.1082838565e-14, (2, 1) = -0.1268034289e-16, (2, 2) = -0.1710091008e-2, (2, 3) = -0.1599152764e-1, (2, 4) = 0.2921824402e-15, (2, 5) = -0.3175431260e-15, (2, 6) = -0.2921824402e-15, (3, 1) = 0.7177805376e-17, (3, 2) = -0.1820461508e-2, (3, 3) = -0.3506659550e-1, (3, 4) = 0.5808392185e-15, (3, 5) = -0.5664836078e-15, (3, 6) = -0.5808392185e-15, (4, 1) = 0.3540019806e-18, (4, 2) = 0.8276992328e-2, (4, 3) = 0.9490588590e-2, (4, 4) = -0.5375652816e-15, (4, 5) = 0.5382732856e-15, (4, 6) = 0.5375652816e-15, (5, 1) = -1., (5, 2) = -.1674559135, (5, 3) = -1., (5, 4) = -1., (5, 5) = -1., (5, 6) = 1., (6, 1) = .8473012185, (6, 2) = 1., (6, 3) = -0.8033014586e-1, (6, 4) = .8473012185, (6, 5) = .8473012185, (6, 6) = -.8473012185})

Force different algorithm by declaring M with positive definite attribute (see Matrix help page). But since it isn't this might not work.
Find the eigenvalues are now real, and some of the infinite ones are now zero. Eigenvectors are just the same.

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

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

Vector[column]([[HFloat(HFloat(infinity))], [0.], [6.79317597683730], [0.], [.921835440824920], [0.]])

Matrix([[-0.1411084663e-17, 0.2525244976e-2, 0.2283298399e-2, -0.1065853548e-14, 0.1063031379e-14, 0.1065853548e-14], [-0.6950197323e-18, -0.1710091008e-2, -0.1599152764e-1, 0.3041677633e-15, -0.3055578028e-15, -0.3041677633e-15], [0.3934212517e-18, -0.1820461508e-2, -0.3506659550e-1, 0.5740548344e-15, -0.5732679919e-15, -0.5740548344e-15], [0.1940313160e-19, 0.8276992328e-2, 0.9490588590e-2, -0.5378998805e-15, 0.5379386867e-15, 0.5378998805e-15], [-1., -.1674559135, -1., -1., -1., 1.], [.8473012185, 1., -0.8033014586e-1, .8473012185, .8473012185, -.8473012185]])

 

 

Download evecs4.mw

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

Eigenvectors needs shape=symmetric for both matrices and only the positive_definite attribute for the second one to produce real eigevalues via the faster algorithm.

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

First 45 46 47 48 49 50 51 Last Page 47 of 81