dharr

Dr. David Harrington

8270 Reputation

22 Badges

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

0 means an exact result. In general in Maple, numbers with a decimal point are approximate (floats) and without are exact. So if the numbers in your guesses were entered as, e.g., 3. instead of 3 or with an e (1e3 instead of 1000), then you will get an approximate result which will be displayed with a decimal point. evalf() will convert an exact expression to an approximate one ("f" for float).

Minpoly looks for the monic polynomial of least degree that has the expression as a root.

restart

y_1 := RootOf(_Z^5-2*_Z^4+9*_Z^3-14*_Z^2+9*_Z-2, .4687 .. .4727); y_2 := 2*RootOf(2*_Z^5-9*_Z^4+14*_Z^3-9*_Z^2+2*_Z-1, 2.109 .. 2.118)^4-9*RootOf(2*_Z^5-9*_Z^4+14*_Z^3-9*_Z^2+2*_Z-1, 2.109 .. 2.118)^3+14*RootOf(2*_Z^5-9*_Z^4+14*_Z^3-9*_Z^2+2*_Z-1, 2.109 .. 2.118)^2-9*RootOf(2*_Z^5-9*_Z^4+14*_Z^3-9*_Z^2+2*_Z-1, 2.109 .. 2.118)+2

evala(Normal(y_1-y_2))

0

Show that y_1 is the index=1 root.

convert(y_1, RootOf, form = index); evalf(%)

RootOf(_Z^5-2*_Z^4+9*_Z^3-14*_Z^2+9*_Z-2, index = 1)

.4723554543

RootOf(evala(Minpoly(y_2, _Z))); evalf(%)

RootOf(_Z^5-2*_Z^4+9*_Z^3-14*_Z^2+9*_Z-2)

.4723554543

``

Download simplify_symbolic_numbers.mw

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Windows 11, March 24 2025 Build ID 1909157`

restart;

ode:=diff(y(x),x)*(x-ln(diff(y(x),x))) = 1;
maple_sol:=dsolve(ode):

(diff(y(x), x))*(x-ln(diff(y(x), x))) = 1

the_residue:=odetest(maple_sol,ode);

(-x+ln(-1/LambertW(-1/exp(x)))-LambertW(-1/exp(x)))/LambertW(-1/exp(x))

The following suggests we can probably do it by some assumptions.

simplify(the_residue,symbolic);

0

Note LambertW has a bramch point at -exp(-1), which is the argument to LambertW when x=1, so we need to avoid that

simplify(the_residue) assuming x>1;

0

simplify(the_residue) assuming x<1;

0

NULL

Download odetest_challange_may_15_2025.mw

Your lines

P3 = (5/2)*x^3-(3/2)*x;
R3 = GM3*(rho1/rho2)^3*P3/rho2;

should have := rather than = 

This is fixed in Maple 2025

restart

with(inttrans)

mellin(BesselK(0, x), x, p)

2^(p-2)*GAMMA((1/2)*p)^2

mellin(BesselK(0, x^(1/2)), x, p)

2*2^(2*p-2)*GAMMA(p)^2

NULL

Download mellin.mw

It's not clear to me what you mean by simple elements. Normal will simplify the rational function in F11 as below, but the answer is just the reciprocal of your original polynomial. In future please upload your worksheet using the green up-arrow in the Mapleprimes editor so we don't have to retype and can diagnose more subtle issues such as why the parfrac did not work.

restart

`mod`(Berlekamp(x^9+x^6-x+1, x), 11)

{x^2+1, x^2+4*x+9, x^5+7*x^4+6*x^3+2*x^2+5*x+5}

F := `mod`(Factor(x^9+x^6-x+1), 11)

(x^2+4*x+9)*(x^2+1)*(x^5+7*x^4+6*x^3+2*x^2+5*x+5)

G := 1/F

1/((x^2+4*x+9)*(x^2+1)*(x^5+7*x^4+6*x^3+2*x^2+5*x+5))

G2 := `mod`(Normal(G), 11)

1/(x^9+x^6+10*x+1)

`mod`(Normal(F*G2), 11)

1

NULL

Download mod11.mw

collect is really only for polynomials and here the powers are not integer (though it works with a few other things like diff or exp). So you can do it by subs and then collect (the expand you had is essential).

 collect_term.mw

If you don't take the sqrt of the ode (which has consequences for the validity of the assumptions on signs), then many of the odetest's give zero. I didn't check them all.

17-ode.mw

In this case there is a simple solution. But in principle, your question doesn't have a clear answer - what do you want to do with terms that only have only diff(G(xi),xi) for example - do you want to write that as (diff(G(xi),xi)/G(xi))*G(xi) and count it?

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

L := (-6*f^3*g*a[2]+6*f*g^3*a[2]+6*f*g*a[2]^2)*(diff(G(xi), xi))^4/G(xi)^4+(f*g^3*(10*lambda*a[2]+2*a[1])-f^3*g*(10*lambda*a[2]+2*a[1])+12*f*g*a[1]*a[2])*(diff(G(xi), xi))^3/G(xi)^3+(f*g^3*(2*a[2]*lambda^2+3*lambda*a[1]+10*mu*a[2]+2*a[2]*(lambda^2-mu))-4*f*p*a[2]-6*k*l*a[2]-f^3*g*(2*a[2]*lambda^2+3*lambda*a[1]+10*mu*a[2]+2*a[2]*(lambda^2-mu))+6*f*g*(2*a[0]*a[2]+a[1]^2))*(diff(G(xi), xi))^2/G(xi)^2+(f*g^3*(a[1]*(lambda^2-mu)+3*a[1]*mu+6*lambda*a[2]*mu)-4*f*p*a[1]-6*k*l*a[1]-f^3*g*(a[1]*(lambda^2-mu)+3*a[1]*mu+6*lambda*a[2]*mu)+12*f*g*a[0]*a[1])*(diff(G(xi), xi))/G(xi)+f*g^3*(lambda*mu*a[1]+2*mu^2*a[2])-4*f*p*a[0]-6*k*l*a[0]-f^3*g*(lambda*mu*a[1]+2*mu^2*a[2])+6*f*g*a[0]^2

collect and coeff deal with positive and negative powers

L1 := collect(L, {G(xi), diff(G(xi), xi)}, 'distributed')

eqns := coeffs(L1, {G(xi), diff(G(xi), xi)}, 'monomials')

f*g^3*(lambda*mu*a[1]+2*mu^2*a[2])-4*f*p*a[0]-6*k*l*a[0]-f^3*g*(lambda*mu*a[1]+2*mu^2*a[2])+6*f*g*a[0]^2, -6*f^3*g*a[2]+6*f*g^3*a[2]+6*f*g*a[2]^2, f*g^3*(10*lambda*a[2]+2*a[1])-f^3*g*(10*lambda*a[2]+2*a[1])+12*f*g*a[1]*a[2], f*g^3*(3*lambda*a[1]+2*a[2]*lambda^2+10*mu*a[2]+2*a[2]*(lambda^2-mu))-4*f*p*a[2]-6*k*l*a[2]-f^3*g*(3*lambda*a[1]+2*a[2]*lambda^2+10*mu*a[2]+2*a[2]*(lambda^2-mu))+6*f*g*(2*a[0]*a[2]+a[1]^2), f*g^3*(a[1]*(lambda^2-mu)+3*a[1]*mu+6*a[2]*lambda*mu)-4*f*p*a[1]-6*k*l*a[1]-f^3*g*(a[1]*(lambda^2-mu)+3*a[1]*mu+6*a[2]*lambda*mu)+12*f*g*a[0]*a[1]

See what the coefficients are of. If this is what you want then eqns has the correct equations.

monomials

1, (diff(G(xi), xi))^4/G(xi)^4, (diff(G(xi), xi))^3/G(xi)^3, (diff(G(xi), xi))^2/G(xi)^2, (diff(G(xi), xi))/G(xi)

NULL

 

Download collect-coe.mw

The error message is clear: "union received [...". Union applies to sets, so changing case1 from a list to a set solves your problem.

ode-not-run.mw

Some of these work for restricted regions, but others are wrong. I didn't work out all the form 2 ones; similar procedures apply.

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

_local(gamma)

declare(G(xi))

G(xi)*`will now be displayed as`*G

NULL

Eq7.

ode := diff(G(xi), xi) = G(xi)*sqrt(A+B*G(xi)^2)

diff(G(xi), xi) = G(xi)*(A+B*G(xi)^2)^(1/2)

Eq 8 for A,B>0. Changed xi[0] to xi__0

S1 := G(xi) = -sqrt(A/B)*csch(sqrt(A)*(xi+`&xi;__0`))

G(xi) = -(A/B)^(1/2)*csch(A^(1/2)*(xi+xi__0))

This one isn't zero, so solution is not correct.

res := `assuming`([simplify(odetest(S1, ode))], [A > 0, B > 0, sqrt(A)*(xi+`&xi;__0`) > 0])

2*A*csch(A^(1/2)*(xi+xi__0))*coth(A^(1/2)*(xi+xi__0))/B^(1/2)

Only zero at infinity

plot(csch(x)*coth(x))

Eq 9 for A<0,B>0

S2 := G(xi) = sqrt(-A/B)*sec(sqrt(-A)*(xi+`&xi;__0`))

G(xi) = (-A/B)^(1/2)*sec((-A)^(1/2)*(xi+xi__0))

So this almost works.

res := `assuming`([simplify(odetest(S2, ode))], [A < 0, B > 0])

A*sec((-A)^(1/2)*(xi+xi__0))*tan((-A)^(1/2)*(xi+xi__0))*(csgn(tan((-A)^(1/2)*(xi+xi__0)))-1)/B^(1/2)

One possibility is assuming tan(sqrt(-A)*(xi+`&xi;__0`)) > 0or just choose a range that makes that true

res := `assuming`([simplify(odetest(S2, ode))], [A < 0, B > 0, sqrt(-A)*(xi+`&xi;__0`) > 0, sqrt(-A)*(xi+`&xi;__0`) < (1/2)*Pi])

0

So can we convert this to see what Eq 8 should have been?

`assuming`([convert(S2, csch)], [A > 0, B > 0])

G(xi) = I*(-A/B)^(1/2)*csch(I*((-A)^(1/2)*(xi+xi__0)+(1/2)*Pi))

Eq 10 for A>0,B<0

S3 := G(xi) = sqrt(-A/B)*sech(sqrt(A)*(xi+`&xi;__0`))

G(xi) = (-A/B)^(1/2)*sech(A^(1/2)*(xi+xi__0))

Find need sqrt(A)*(xi+`&xi;__0`) < 0- not realistic?

res := `assuming`([simplify(odetest(S3, ode))], [A > 0, B < 0, sqrt(A)*(xi+`&xi;__0`) < 0])

0

Eq 11 for A<0,B>0

S4 := G(xi) = sqrt(-A/B)*csc(sqrt(-A)*(xi+`&xi;__0`))

G(xi) = (-A/B)^(1/2)*csc((-A)^(1/2)*(xi+xi__0))

res := `assuming`([simplify(odetest(S4, ode))], [A < 0, B > 0])

A*csc((-A)^(1/2)*(xi+xi__0))*cot((-A)^(1/2)*(xi+xi__0))*(csgn(cot((-A)^(1/2)*(xi+xi__0)))+1)/B^(1/2)

So

res := `assuming`([simplify(odetest(S4, ode))], [A < 0, B > 0, cot(sqrt(-A)*(xi+`&xi;__0`)) < 0])

0

Eq 12 for A<0, B>0. Eq 12 has an I in.

S5 := G(xi) = cos(sqrt(-A)*(xi+`&xi;__0`))+I*sin(sqrt(-A)*(xi+`&xi;__0`))

G(xi) = cos((-A)^(1/2)*(xi+xi__0))+I*sin((-A)^(1/2)*(xi+xi__0))

This one is wrong

res := `assuming`([simplify(odetest(S5, ode))], [A < 0, B > 0]); eval(res, {`&xi;__0` = 1., A = -1, B = -2, xi = 1})

(cos((-A)^(1/2)*(xi+xi__0))+I*sin((-A)^(1/2)*(xi+xi__0)))*(-(I*B*sin(2*(-A)^(1/2)*(xi+xi__0))+B*cos(2*(-A)^(1/2)*(xi+xi__0))+A)^(1/2)+I*(-A)^(1/2))

.2063024051-.9637957172*I

Eq 13. for A=0,B>0

S6 := G(xi) = 1/(sqrt(B)*(xi+`&xi;__0`))

G(xi) = 1/(B^(1/2)*(xi+xi__0))

This one is wrong.

`assuming`([odetest(S6, subs(A = 0, ode))], [B > 0, xi+`&xi;__0` > 0])

-2/(B^(1/2)*(xi+xi__0)^2)

Eq 14. A=0, B<0

S7 := G(xi) = 1/(sqrt(-B)*(xi+`&xi;__0`))

G(xi) = 1/((-B)^(1/2)*(xi+xi__0))

Also wrong

`assuming`([odetest(S7, subs(A = 0, ode))], [B < 0, xi+`&xi;__0` > 0])

-1/((-B)^(1/2)*(xi+xi__0)^2)-I/((-B)^(1/2)*(xi+xi__0)^2)

``

Download Z1.mw

restart

with(PDEtools)

declare(P(mu))

P(mu)*`will now be displayed as`*P

Corrected version A^2+r -> A^2

Psol := P(mu) = 2*A*lambda/(A^2*exp(lambda*rho*mu)+r*exp(-lambda*rho*mu))

P(mu) = 2*A*lambda/(A^2*exp(lambda*rho*mu)+r*exp(-lambda*rho*mu))

Corrected for sign to correspond to above solution

ode := (diff(P(mu), mu))^2-rho^2*P(mu)^2*(1-r*P(mu)^2) = 0

(diff(P(mu), mu))^2-rho^2*P(mu)^2*(1-r*P(mu)^2) = 0

Since lambda = +/-1 the following is zero

res := simplify(odetest(Psol, ode)); eval(res, lambda = 1); eval(res, lambda = -1)

0

0

 

P_hyper := P(mu) = 2*A*lambda/((A^2+r)*cosh(rho*mu)+(A^2-r)*sinh(rho*mu))

P(mu) = 2*A*lambda/((A^2+r)*cosh(rho*mu)+(A^2-r)*sinh(rho*mu))

res_hyper := simplify(odetest(P_hyper, ode)); eval(res_hyper, lambda = 1); eval(res_hyper, lambda = -1)

16*rho^2*(lambda^4-lambda^2)*r*A^4/((A^2+r)*cosh(rho*mu)+(A^2-r)*sinh(rho*mu))^4

0

0

 

NULL

Download ode.m

subs is best for substituting name=expression. When you don't have a name on the left, it can still work if the left-hand side is an "indet" of the target. In this case it is not. The lhs has the sqrt, but the target has 1/sqrt and they are not the same.

Algsubs can sometimes solve this problem, but not when there are square roots. The simplest solution here is probably to take the reciprocal, do the substitution, and take the reciprocal of the answer. When doing substitutions involving derivatives, dsubs is preferred, though here it give the same answer.

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

NULL

S := (diff(G(xi), xi))^2-r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2) = 0

(diff(G(xi), xi))^2-r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2) = 0

SS := diff(G(xi), xi) = sqrt(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))

diff(G(xi), xi) = (r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

Se := sqrt(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2)) = diff(G(xi), xi)

(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2) = diff(G(xi), xi)

dub := diff(SS, xi)

diff(diff(G(xi), xi), xi) = (1/2)*(2*r^2*G(xi)*(a+b*G(xi)+l*G(xi)^2)*(diff(G(xi), xi))+r^2*G(xi)^2*(b*(diff(G(xi), xi))+2*l*G(xi)*(diff(G(xi), xi))))/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

Dubl2 := simplify(diff(diff(G(xi), xi), xi) = (1/2)*(2*r^2*G(xi)*(a+b*G(xi)+l*G(xi)^2)*(diff(G(xi), xi))+r^2*G(xi)^2*(b*(diff(G(xi), xi))+2*l*G(xi)*(diff(G(xi), xi))))/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2))

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(diff(G(xi), xi))*(4*l*G(xi)^2+3*b*G(xi)+2*a)/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

subs(Se, Dubl2)

diff(diff(G(xi), xi), xi) = (1/2)*r^2*G(xi)*(diff(G(xi), xi))*(4*l*G(xi)^2+3*b*G(xi)+2*a)/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2)

indets(Se); indets(Dubl2)

{a, b, l, r, xi, (r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2), G(xi), diff(G(xi), xi)}

{a, b, l, r, xi, 1/(r^2*G(xi)^2*(a+b*G(xi)+l*G(xi)^2))^(1/2), G(xi), diff(G(xi), xi), diff(diff(G(xi), xi), xi)}

1/subs(Se, 1/rhs(Dubl2))

(1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

1/dsubs(Se, 1/rhs(Dubl2))

(1/2)*r^2*G(xi)*(4*l*G(xi)^2+3*b*G(xi)+2*a)

NULL

Download subs.mw

In Maple, you cannot incorporate two values into one variable by using +/-. You can of course do this manually, e.g. A+pm*B and later set pm to +1 or -1.

To get the exp form, use simplify. (But you will need to set a value of c__1 first to get the form in the paper.) I do not know how to get the sech/tanh form. For these sorts of things I usually enter it manually and then simplify the difference to check it is zero and you haven't entered it incorrectly.

See attached file (not displaying in Mapleprimes right now).

Download eigenvectors.mw

2 3 4 5 6 7 8 Last Page 4 of 82