dharr

Dr. David Harrington

8215 Reputation

22 Badges

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

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+`ξ__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+`ξ__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

Here I make a table of the coefficients for each monomial and you can pick out which ones you want. The list in your question has repeats, but you can change to what you really want. I'm not sure it makes sense to pick out some coefficients and not others. In the other case the only monomials in the expression were those in the paper.

Download S1.mw

It works with M[sun] rather than M__sun.

restart;

with(ScientificConstants):    

GetConstant(M__Sun)         

Error, (in ScientificConstants:-GetConstant) `M__Sun` is not a known Constant

GetConstant(M[Sun])  

mass_of_Sun, symbol = M[Sun], value = 0.199e31, uncertainty = 0.5e28, units = kg

NULL

Download Msun.mw

You can use a for loop to do this. I didn't wait for it to finish.

Trail-pdetest.mw

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