Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am trying to draw the Poincare section diagram related pendulum problem, article is shared below. I can not understand and code gives error, can you help me to draw Poincare section Fig. 4 of attached article?7._Energy_distribution_in_intrinsically_coupled_system [moderator: URL changed to respect IP, as per Mapleprimes Terms of Use]

pendulum.mw

Hello everyone,

I have created a Maple worksheet titled "ΕΜΒΑΔΟΝ ΕΠΙΠΕΔΟΥ ΧΩΡΙΟΥ", designed to help my students prepare for their final exams as they qualify for university. This worksheet focuses on area calculations in plane geometry, using Maple to visualize and solve problems efficiently.

This worksheet is aimed at high school students preparing for university entrance exams, as well as teachers who want to integrate Maple into their teaching.

I would love to hear your thoughts and feedback!

Have you used Maple for similar exam preparation?
εμβαδόν_χωρίου.mw

I believe I found I bug.

The 'next' statement for loop control will not work in 2D Input but it does in Code Edit Region.

From the documentation on 'next', I copied the following code into a 2D input in a document. 

Running it results in Error, invalid expression for eval; id=54 which is a missing help page.

for i to 4 do
    for j to 4 do
       print([i, j]);
         if i = j then next i;
        end if;
   end do;
end do

However 'next' without a following integer/name works fine in both 2D Input and Code Edit Region.

So is there only a subset of Maple code that will work in 2D Input?

I have calculated an expression which depends on functions. I would now like to calculate the derivative withe respect to a function  but when I try to do so I get the error “Deriving a functional ”Error, invalid input: diff received fA(r), which is not valid for its 2nd argument. There is no help page available for this error, so maybe someone knows what I am doing wrong .

I get this is because die diff function might not be able to handel a function as an argument, but how would I do it? 

L := -r^2*((-fA(r)^4+(-2*fB(r)^2-2*fC(r)^2+2)*fA(r)^2+4*(D(fB))(r)*fA(r)*fC(r)*r-fB(r)^4+(-2*fC(r)^2+2)*fB(r)^2-4*fB(r)*fC(r)*(D(fA))(r)*r-2*r^2*(D(fA))(r)^2-1-2*r^2*(D(fB))(r)^2)/(2*g^2*r^4)+(r*(fB(r)^2+(1/2)*fC(r)^2+fA(r)^2-2*fA(r)+1)*H(r)^2+(-(D(K))(r)*r^2*fC(r)-2*K(r)*fB(r)*r)*H(r)+(1/2)*K(r)^2*fC(r)^2*r+(D(H))(r)*K(r)*r^2*fC(r)+r*((fB(r)^2+fA(r)^2)*K(r)^2+(1/2)*r^2*((D(H))(r)^2+(D(K))(r)^2)))*v^2/(r^2)^(3/2)-lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2)

-r^2*((1/2)*(-fA(r)^4+(-2*fB(r)^2-2*fC(r)^2+2)*fA(r)^2+4*(D(fB))(r)*fA(r)*fC(r)*r-fB(r)^4+(-2*fC(r)^2+2)*fB(r)^2-4*fB(r)*fC(r)*(D(fA))(r)*r-2*r^2*(D(fA))(r)^2-1-2*r^2*(D(fB))(r)^2)/(g^2*r^4)+(r*(fB(r)^2+(1/2)*fC(r)^2+fA(r)^2-2*fA(r)+1)*H(r)^2+(-(D(K))(r)*r^2*fC(r)-2*K(r)*fB(r)*r)*H(r)+(1/2)*K(r)^2*fC(r)^2*r+(D(H))(r)*K(r)*r^2*fC(r)+r*((fB(r)^2+fA(r)^2)*K(r)^2+(1/2)*r^2*((D(H))(r)^2+(D(K))(r)^2)))*v^2/(r^2)^(3/2)-lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2)

(1)

diff(L, fA(r))

Error, invalid input: diff received fA(r), which is not valid for its 2nd argument

 
 

``

Download test_funtion.mw

Hi,

Is there a way to vary C in steps of fractions of Pi ? Thanks

Q_Pi_scaling.mw

For practice, I would like to calculate the left-hand limit according to the attached file. The computer does not finish. The result pi^2/6 is known from a calculation "on foot".

restart

``

limit((1-t)^2*(sum(k*t^k/(1-t^k), k = 1 .. infinity)), t = 1, left)

limit((1-t)^2*(sum(k*t^k/(1-t^k), k = 1 .. infinity)), t = 1, left)

(1)

"(->)"``

``

Download test.mwtest.mw

Hello, an interesting issue about set equivalence.

Logically, the two sets are equivalent by derivation.

The first principal case, for set A, k=0, the element values ​​are Pi/6 and 5*Pi/6, which corresponds to the case of k=0 (element value is Pi/6) and k=1 (element value is 5*Pi/6) in set B. Obviously, the k value is not one-to-one correspondence, but just a letter representing a positive integer. As for the second general case, it is the same steps I thought.

So, how to verify that the two sets are equivalent? I know Maple cannot do it in one step, but I don't know how to do it?

A := solve(sin(x) = 1/2, allsolutions = true)

(1/6)*Pi+2*Pi*_Z5, (5/6)*Pi+2*Pi*_Z5

(1)

A := `assuming`([`union`({(1/6)*Pi+2*k*Pi}, {Pi-(1/6)*Pi+2*k*Pi})], [k::integer])

{(1/6)*Pi+2*k*Pi, (5/6)*Pi+2*k*Pi}

(2)

B := `assuming`([{k*Pi+(1/6)*(-1)^k*Pi}], [k::integer])

{k*Pi+(1/6)*(-1)^k*Pi}

(3)

is(A = B)

false

(4)

restart

alpha = 'alpha'

alpha = alpha

(5)

solve(sin(x) = alpha, x, allsolutions = true)

2*Pi*_Z1+arcsin(alpha), -arcsin(alpha)+Pi+2*Pi*_Z1

(6)

A := `assuming`([`union`({arcsin(alpha)+2*k*Pi}, {Pi-arcsin(alpha)+2*k*Pi})], [k::integer])

{arcsin(alpha)+2*k*Pi, Pi-arcsin(alpha)+2*k*Pi}

(7)

B := `assuming`([{k*Pi+(-1)^k*arcsin(alpha)}], [k::integer])

{k*Pi+(-1)^k*arcsin(alpha)}

(8)

is(A = B)

false

(9)
 

NULL

Download verify_set_A_and_set_B_is_equivalent.mw

I have Maple 2024 and successfully loaded the FeynmanIntegral package with:

with(Physics); with(FeynmanIntegral);

Maple confirms that FeynmanIntegral is loaded by displaying:

[Evaluate, ExpandDimension, FromAbstractRepresentation, Parametrize, Series, SumLookup, TensorBasis, TensorReduce, ToAbstractRepresentation, epsilon, varepsilon]

However, when I attempt to evaluate a Feynman integral, Maple only displays the unevaluated expression instead of computing it:

Delta(q); %FeynmanIntegral(1/p^2*1/(p + q)^2, p);

And explicitly calling Evaluate() does not compute the result:

Evaluate(Delta(q));

  1. Using Evaluate() explicitly:

    FeynmanIntegral:-Evaluate(1 / (p^2 * (p + q)^2), p);

    Result: No evaluation, only displays the input.

  2. Assigning the integral to a variable before evaluating:

    I := FeynmanIntegral(1 / (p^2 * (p + q)^2), p); Evaluate(I);

    Result: Still does not evaluate.

  3. Using dimension= instead of d= when specifying the spacetime dimension:

    FeynmanIntegral:-Evaluate(1 / (p^2 * (p + q)^2), p, dimension = 4 - 2*epsilon);

    Result: No evaluation.

  4. Checking if FeynmanIntegral functions exist:

    showstat(FeynmanIntegral);

    Result: The package seems loaded, but it does not execute calculations.

I expect FeynmanIntegral:-Evaluate(...) to automatically compute the dimensional integral using Feynman rules and return a result.

  1. Is FeynmanIntegral:-Evaluate() broken in Maple 2024?
  2. Are there additional setup steps needed to enable full functionality?
  3. Has anyone successfully used FeynmanIntegral for automatic dimensional integration?
  4. Are there alternative Maple functions/packages for computing Feynman integrals in dimensional regularization?

Any help would be greatly appreciated!

this function i have is so long and my parameter are twenty they are two much when i make a change in explore i the change is so slow and i can't see some of this parameter how act to figure when i change becuase the placement of parameters i want some of parameter being in right  and some of them being in right  and figure be in the middle for see them together can we do something like that?

figure.mw

How do we simplify the arguments of the exponential in (1)? Further how to express (1) into hyperbolic/trig functions? 
 

restart

with(LinearAlgebra)

Bans := -8*delta2*delta4*delta1*(delta3^2+delta4^2)*exp((-(2*I)*y*a*(delta3^2+delta4^2)*delta1^3+((2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+((2*I)*y*delta4^2*a-I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2-(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1+(2*(I*y*delta3^3*a+(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-I*t*(1/2)+I*y*delta4^2*a)*delta3+(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4)))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-8*delta2*delta3*delta4*(delta1^2+delta2^2)*exp(((2*I)*y*a*(delta3^2+delta4^2)*delta1^3+(-(2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-(2*I)*y*delta4^2*a+I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2+(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1-(2*(I*y*delta3^3*a-(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-I*t*(1/2)+I*y*delta4^2*a)*delta3-(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4)))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))+(delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B1+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B3))*delta2^2-(2*(delta3^2+delta4^2))*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B1+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B1+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))+(delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B2+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B3))*delta2^2+(2*(delta3^2+delta4^2))*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B2+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B2+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-(delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B1+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B4))*delta2^2-(2*(delta3^2+delta4^2))*(y*a*delta1^2+(1/2)*t)*delta2+(2*(y*delta4^3*a+(x+y+t)^2*(B1+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B1+B4)))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-(delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B2+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B4))*delta2^2+(2*(delta3^2+delta4^2))*(y*a*delta1^2+(1/2)*t)*delta2+(2*(y*delta4^3*a+(x+y+t)^2*(B2+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B2+B4)))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))

-8*delta2*delta4*delta1*(delta3^2+delta4^2)*exp((-(2*I)*y*a*(delta3^2+delta4^2)*delta1^3+((2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+((2*I)*y*delta4^2*a-I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2-(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1+2*(I*y*delta3^3*a+(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+I*y*delta4^2*a)*delta3+(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-8*delta2*delta3*delta4*(delta1^2+delta2^2)*exp(((2*I)*y*a*(delta3^2+delta4^2)*delta1^3+(-(2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-(2*I)*y*delta4^2*a+I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2+(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1-2*(I*y*delta3^3*a-(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+I*y*delta4^2*a)*delta3-(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))+(delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B1+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B3))*delta2^2-2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B1+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B1+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))+(delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B2+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B3))*delta2^2+2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B2+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B2+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-(delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B1+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B4))*delta2^2-2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*(y*delta4^3*a+(x+y+t)^2*(B1+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B1+B4))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))-(delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B2+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B4))*delta2^2+2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*(y*delta4^3*a+(x+y+t)^2*(B2+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B2+B4))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))

(1)

argexp1 := simplify((-(2*I)*y*a*(delta3^2+delta4^2)*delta1^3+((2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+((2*I)*y*delta4^2*a-I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2-(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1+(2*(I*y*delta3^3*a+(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-I*t*(1/2)+I*y*delta4^2*a)*delta3+(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4)))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)), size)

(-(2*I)*y*a*(delta3^2+delta4^2)*delta1^3+((2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+((2*I)*y*delta4^2*a-I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2-(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1+2*(y*delta3^3*a*I+(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+y*delta4^2*a*I)*delta3+(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+delta2*I)*(delta4*I-delta3)*(delta3+delta4*I)*(delta2*I-delta1))

(2)

 

argexp2 := ((2*I)*y*a*(delta3^2+delta4^2)*delta1^3+(-(2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-(2*I)*y*delta4^2*a+I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2+(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1-(2*(I*y*delta3^3*a-(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-I*t*(1/2)+I*y*delta4^2*a)*delta3-(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4)))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))

((2*I)*y*a*(delta3^2+delta4^2)*delta1^3+(-(2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-(2*I)*y*delta4^2*a+t*I)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2+(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1-2*(y*delta3^3*a*I-(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+y*delta4^2*a*I)*delta3-(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+delta2*I)*(delta4*I-delta3)*(delta3+delta4*I)*(delta2*I-delta1))

(3)

simplify(argexp1+argexp2)

2*(x+y+t)^2*(B2+B1+B3+B4)

(4)

terms := op(Bans)

-8*delta2*delta4*delta1*(delta3^2+delta4^2)*exp((-(2*I)*y*a*(delta3^2+delta4^2)*delta1^3+((2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+((2*I)*y*delta4^2*a-I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2-(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1+2*(I*y*delta3^3*a+(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+I*y*delta4^2*a)*delta3+(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))), -8*delta2*delta3*delta4*(delta1^2+delta2^2)*exp(((2*I)*y*a*(delta3^2+delta4^2)*delta1^3+(-(2*I)*y*delta3^3*a+(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-(2*I)*y*delta4^2*a+I*t)*delta3+delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta1^2+(2*I)*(y*delta2^2*a-(1/2)*t)*(delta3^2+delta4^2)*delta1-2*(I*y*delta3^3*a-(1/2)*(x+y+t)^2*(B2+B1+B3+B4)*delta3^2+(-((1/2)*I)*t+I*y*delta4^2*a)*delta3-(1/2)*delta4^2*(x+y+t)^2*(B2+B1+B3+B4))*delta2^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))), (delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B1+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B3))*delta2^2-2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B1+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B1+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))), (delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((delta3+I*delta4)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(delta4^2+I*delta4*delta1+delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(-2*y*delta4^3*a+2*(x+y+t)^2*(B2+B3)*delta4^2+(-2*a*delta3^2*y-t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B3))*delta2^2+2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*delta1^2*(-y*delta4^3*a+(x+y+t)^2*(B2+B3)*delta4^2+(-(1/2)*t-y*a*delta3^2)*delta4+delta3^2*(x+y+t)^2*(B2+B3)))/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))), -(delta2^2+2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(-I*delta3^2-I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((-2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B1+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B1+B4))*delta2^2-2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*(y*delta4^3*a+(x+y+t)^2*(B1+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B1+B4))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1))), -(delta2^2-2*delta4*delta2+delta4^2+(delta3-delta1)^2)*((I*delta4-delta3)*delta2^2+(I*delta3^2+I*delta4^2)*delta2+delta1*(-delta4^2+I*delta4*delta1-delta3*(delta3+delta1)))*exp((2*y*a*(delta3^2+delta4^2)*delta2^3+(2*y*delta4^3*a+2*(x+y+t)^2*(B2+B4)*delta4^2+(2*a*delta3^2*y+t)*delta4+2*delta3^2*(x+y+t)^2*(B2+B4))*delta2^2+2*(delta3^2+delta4^2)*(y*a*delta1^2+(1/2)*t)*delta2+2*(y*delta4^3*a+(x+y+t)^2*(B2+B4)*delta4^2+(y*a*delta3^2+(1/2)*t)*delta4+delta3^2*(x+y+t)^2*(B2+B4))*delta1^2)/((delta1+I*delta2)*(I*delta4-delta3)*(delta3+I*delta4)*(I*delta2-delta1)))

(5)

NULL


 

Download argument.mw

Hi everyone,

I'm trying to compute the cohomology group of some Lie algebras using the LieAlgebra package, but it appears that the Cohomology command doesn't provide the correct basis for the higher dimensional cohomology group, instead repeating up to the correct dimension only one element.

For example, with the following Lie algebra

L1:=_DG([["LieAlgebra", Alg1, [6]], [[[1, 3, 2], 1], [[1, 2, 3], -1], [[4, 6, 5], 1], [[4, 5, 6], -1]]])
DGSetup(L1)

the command

C := RelativeChains([])

does provide the correct k-forms on Alg1, but then

H := Cohomology(C)
provides
[[theta4,theta1],[theta1 &w theta4, theta1 &w theta4, theta1 &w theta4],[theta1 &w theta2 &w theta3,theta1 &w theta2 &w theta3,theta1 &w theta2 &w theta3,theta1 &w theta2 &w theta3], [theta1 &w theta2 &w theta3 &w theta4,theta1 &w theta2 &w theta3 &w theta4,theta1 &w theta2 &w theta3 &w theta4],[theta1 &w theta2 &w theta3 &w theta4 &w theta5 &w theta6, theta1 &w theta2 &w theta3 &w theta4 &w theta5 &w theta6], [theta1 &w theta2 &w theta3 &w theta4 &w theta5 &w theta6]

A similar thing does happen for the examples provided in the online help (e.g. example 1 from https://de.maplesoft.com/support/help/Maple/view.aspx?path=DifferentialGeometry/LieAlgebras/Cohomology). Is the command broken?

Any help is really appreciated.

when i use change maple to latex most of that equation when i want to change the place of term are change how i can fix that for example in (R) if watch in exponential the x is first term but after changing to latex are change which i have to change by hand how i can fix this issue?

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

_local(gamma)

Warning, A new binding for the name `gamma` has been created. The global instance of this name is still accessible using the :- prefix, :-`gamma`.  See ?protect for details.

 

undeclare(prime)

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

(1)

NULL

declare(u(x, y, z, t))

u(x, y, z, t)*`will now be displayed as`*u

(2)

declare(f(x, y, z, t))

f(x, y, z, t)*`will now be displayed as`*f

(3)

NULL

W := Lambda = k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i]

Lambda = k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i]

(4)

latex(W)

\Lambda = k_{i} \left(w_{i} t +y l_{i}+r_{i} z +x \right)+\eta_{i}

 

Lambda[1] := k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i]

k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i]

(5)

Q := f = 1+exp(Lambda[1])

f = 1+exp(k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i])

(6)

Q1 := subs(W, Q)

f = 1+exp(k[i]*(t*w[i]+y*l[i]+z*r[i]+x)+eta[i])

(7)

latex(Q1)

f =
1+{\mathrm e}^{k_{i} \left(w_{i} t +y l_{i}+r_{i} z +x \right)+\eta_{i}}

 

eq15 := w[i] = (-1+sqrt(-4*beta*mu*l[i]-4*delta*mu*r[i]-4*mu*k[i]^2-4*alpha*mu+1))/(2*mu)

w[i] = (1/2)*(-1+(-4*beta*mu*l[i]-4*delta*mu*r[i]-4*mu*k[i]^2-4*alpha*mu+1)^(1/2))/mu

(8)

latex(eq15)

w_{i} =
\frac{-1+\sqrt{-4 \beta  \mu  l_{i}-4 \delta  \mu  r_{i}-4 \mu  k_{i}^{2}-4 \alpha  \mu +1}}{2 \mu}

 

R := f(x, y, z, t) = 1+exp(k[i]*(x+l[i]*y+r[i]*z+(-1+sqrt(-4*beta*mu*l[i]-4*delta*mu*r[i]-4*mu*k[i]^2-4*alpha*mu+1))*t/(2*mu))+eta[i])

f(x, y, z, t) = 1+exp(k[i]*((1/2)*(-1+(-4*beta*mu*l[i]-4*delta*mu*r[i]-4*mu*k[i]^2-4*alpha*mu+1)^(1/2))*t/mu+y*l[i]+r[i]*z+x)+eta[i])

(9)

latex(R)

f =
1+{\mathrm e}^{k_{i} \left(\frac{\left(-1+\sqrt{-4 \beta  \mu  l_{i}-4 \delta  \mu  r_{i}-4 \mu  k_{i}^{2}-4 \alpha  \mu +1}\right) t}{2 \mu}+y l_{i}+r_{i} z +x \right)+\eta_{i}}

 
 

NULL

Download latex.mw

For the following task I only get the numerical solution 2.356... :
sum(n=1 to oo)[arctan(2/n^2)]
The known "closed" result is 3*pi/4.

Dear team,

Here below you can see a simple program containing 3 loops. The problem is  that even for low iterations the execution time seems endless. I kept this program running for over 10 minutes to no avail.   Could you help me? 

Here you are the technical details of my HP laptopper

 

Recently, @zenterix asked a question related to solving the quantum mechanics of the finite-wall-height particle-in-a-box problem. In the last two decades or so I've been teaching a quantum mechanics course every second year, in which I sketch the method of solution of this problem for the class, I but do not get into the mathematical details. A few times I've started to work on it in Maple, but abandoned it because of lack of time. So I decided to persist this time.

This post is more about some of the challenges and tradeoffs in making it work, hence the title. The title is also a nod to the fact that this problem appears in Engel's textbook [1] in a chapter entitled "Applying the particle in a box model to real-world topics". You don't need to know much about quantum mechanics to understand it. From the mathematical point of view you are solving three ordinary differential equations (in three regions) and stitching the solutions together so that the solution, a wavefunction, is continuous with continuous derivative and tends to zero at plus infinity and minus infinity.

The three regions and the wavefunctions for three eigenvalues (energies) are shown here in the figure, which is the final output of the worksheet. Next is the worksheet and I'll comment further on it below.

(It's a quirk of quantum mechanics that we plot two things with different units (wavefunctions and energy) on the same axis, and worse, we offset one by the other.)

Bound states for particle in finite height box of wall height
V(x) = piecewise(x < -(1/2)*a, V__0, -(1/2)*a <= x and x <= (1/2)*a, 0, (1/2)*a < x, V__0)
I'll call these regions left, box and right respectively.

restart

Schroedinger equation. Here as elsewhere "=0" is implied.

Schroedinger := -`&hbar;`^2*(diff(psi(x), x, x))/(2*m)+V*psi(x)-E*psi(x)

-(1/2)*`&hbar;`^2*(diff(diff(psi(x), x), x))/m+V*psi(x)-E*psi(x)

(1)

Nondimensionalize length as units of box length, X = x/a. Since psi(x)^2*dx is unitless probability, psi(x) has dimensions 1/length^(1/2)so we define a dimensionless Phi = a^(1/2)*psi

tr := {x = a*X, psi(x) = Phi(X)/sqrt(a)}; NDSchroedinger := PDETools:-dchange(tr, Schroedinger, [X, Phi(X)], params = [`&hbar;`, m, a], simplify)

{x = a*X, psi(x) = Phi(X)/a^(1/2)}

 

-((1/2)*`&hbar;`^2*(diff(diff(Phi(X), X), X))+a^2*m*Phi(X)*(E-V))/(a^(5/2)*m)

(2)

This will also change the normalization integrals, e.g., over the box region:

normint := Int(psi(x)^2, x = -(1/2)*a .. (1/2)*a); NDnormint := PDETools:-dchange(tr, normint, [X, Phi(X)], params = [`&hbar;`, m, a], simplify)

Int(psi(x)^2, x = -(1/2)*a .. (1/2)*a)

 

Int(Phi(X)^2, X = -1/2 .. 1/2)

(3)

Outside the box we have 0 <= E and E < V with V = V__0. Define a dimensionless positive constant kappa:

`&kappa;__eqn` := kappa = a*sqrt(2*m*(V__0-E)/`&hbar;`^2); de_outside := simplify(sqrt(a)*kappa^2*(eval(NDSchroedinger, {isolate(`&kappa;__eqn`, m), V = V__0}))/(E-V__0)); outside := rhs(dsolve(de_outside))

kappa = a*2^(1/2)*(m*(V__0-E)/`&hbar;`^2)^(1/2)

 

diff(diff(Phi(X), X), X)-kappa^2*Phi(X)

 

c__1*exp(-kappa*X)+c__2*exp(kappa*X)

(4)

Inside the box we have V = 0 and E > 0. Define a dimensionless positive constant k.

k__eqn := k = a*sqrt(2*m*E/`&hbar;`^2); de_box := simplify(-sqrt(a)*k^2*(eval(NDSchroedinger, {isolate(k__eqn, m), V = 0}))/E); box := rhs(eval(dsolve(de_box), {c__1 = A, c__2 = B}))

k = a*2^(1/2)*(m*E/`&hbar;`^2)^(1/2)

 

diff(diff(Phi(X), X), X)+k^2*Phi(X)

 

A*sin(k*X)+B*cos(k*X)

(5)

We have seven unknowns {A, B, E, c__1(L), c__1(R), c__2(L), c__2(R)}, where for example c__1(L) means Maple's c__1 for the left region. We need seven equations: goes to 0 at x = -infinityand at x = infinity(or Phi(X) wouldn't be square integrable), continuity at the two box boundaries, slopes continuous at the two box boundaries, and normalization. We deal with the ones at `&+-`(infinity)first.

At X = -infinity the wavefunction will be unbounded unless one of the constants goes to zero. We'll rename the other one A__L or A__R. The code here is just to handle the fact that c__1 and c__2 can be the the opposite way around, depending on the session.

`assuming`(['limit(outside, X = -infinity)' = limit(outside, X = -infinity)], [kappa > 0]); left0 := eval(outside, `~`[`=`](`minus`(indets(rhs(%), name), {infinity}), 0)); left1 := eval(left0, `~`[`=`](indets(left0, suffixed(c)), A__L)); `assuming`(['limit(outside, X = infinity)' = limit(outside, X = infinity)], [kappa > 0]); right0 := eval(outside, `~`[`=`](`minus`(indets(rhs(%), name), {infinity}), 0)); right1 := eval(right0, `~`[`=`](indets(right0, suffixed(c)), A__R))

limit(c__1*exp(-kappa*X)+c__2*exp(kappa*X), X = -infinity) = signum(c__1)*infinity

 

A__L*exp(kappa*X)

 

limit(c__1*exp(-kappa*X)+c__2*exp(kappa*X), X = infinity) = signum(c__2)*infinity

 

A__R*exp(-kappa*X)

(6)

Now we have five unknowns {A, A__L, A__R, B, E}. The strategy will be to eliminate A, A__L, A__R and then find the eigenvalues E. Then we will have expressions for all three regions containing the unknown B, which we will find by the normalization condition (The normalization condition fixes the scale of the wavefunction so that the probability of finding the particle somewhere is one.)

Continuity of the wavefunction and its derivative at the left boundary are below
We eliminate A__L and A using this boundary

bcleft := {eval(left1-box, X = -1/2), eval(diff(left1, X)-(diff(box, X)), X = -1/2)}; sol := solve(bcleft, {A, A__L}); left2 := eval(left1, sol); box2 := eval(box, sol)

{A__L*exp(-(1/2)*kappa)+A*sin((1/2)*k)-B*cos((1/2)*k), A__L*kappa*exp(-(1/2)*kappa)-A*k*cos((1/2)*k)-B*k*sin((1/2)*k)}

 

{A = -B*(sin((1/2)*k)*k-cos((1/2)*k)*kappa)/(sin((1/2)*k)*kappa+cos((1/2)*k)*k), A__L = B*k*(sin((1/2)*k)^2+cos((1/2)*k)^2)/(exp(-(1/2)*kappa)*(sin((1/2)*k)*kappa+cos((1/2)*k)*k))}

 

B*k*(sin((1/2)*k)^2+cos((1/2)*k)^2)*exp(kappa*X)/(exp(-(1/2)*kappa)*(sin((1/2)*k)*kappa+cos((1/2)*k)*k))

 

-B*(sin((1/2)*k)*k-cos((1/2)*k)*kappa)*sin(k*X)/(sin((1/2)*k)*kappa+cos((1/2)*k)*k)+B*cos(k*X)

(7)

Eliminate A__R at the right box boundary

bcright := {eval(box2-right1, X = 1/2), eval(diff(box2, X)-(diff(right1, X)), X = 1/2)}; elim := eliminate(bcright, A__R); right2 := eval(right1, elim[1]); energy_eqn := elim[2][]/B

{-B*(sin((1/2)*k)*k-cos((1/2)*k)*kappa)*sin((1/2)*k)/(sin((1/2)*k)*kappa+cos((1/2)*k)*k)+B*cos((1/2)*k)-A__R*exp(-(1/2)*kappa), -B*(sin((1/2)*k)*k-cos((1/2)*k)*kappa)*k*cos((1/2)*k)/(sin((1/2)*k)*kappa+cos((1/2)*k)*k)-B*k*sin((1/2)*k)+A__R*kappa*exp(-(1/2)*kappa)}

 

[{A__R = B*(2*sin((1/2)*k)*cos((1/2)*k)*kappa+2*cos((1/2)*k)^2*k-k)/(exp(-(1/2)*kappa)*(sin((1/2)*k)*kappa+cos((1/2)*k)*k))}, {-2*(sin((1/2)*k)*cos((1/2)*k)*k^2-sin((1/2)*k)*cos((1/2)*k)*kappa^2-2*cos((1/2)*k)^2*k*kappa+k*kappa)*B}]

 

B*(2*sin((1/2)*k)*cos((1/2)*k)*kappa+2*cos((1/2)*k)^2*k-k)*exp(-kappa*X)/(exp(-(1/2)*kappa)*(sin((1/2)*k)*kappa+cos((1/2)*k)*k))

 

-2*sin((1/2)*k)*cos((1/2)*k)*k^2+2*sin((1/2)*k)*cos((1/2)*k)*kappa^2+4*cos((1/2)*k)^2*k*kappa-2*k*kappa

(8)

Now we will get the quantized energies by finding which values will make energy_eqn zero. We recall the relationships of `&kappa;__` and k to energy:

k__eqn; `&kappa;__eqn;`

k = a*2^(1/2)*(m*E/`&hbar;`^2)^(1/2)

 

kappa = a*2^(1/2)*(m*(V__0-E)/`&hbar;`^2)^(1/2)

(9)

The energy scale is set by V__0, so can get a non-dimensionalized energy e = E/V__0 and a non-dimensional parameter b = a*sqrt(2*m*V__0/`&hbar;`^2).

b__eqn := b = a*sqrt(2*m*V__0/`&hbar;`^2); e__eqn := e = E/V__0; eqns := `assuming`([{simplify(eval(eval(k__eqn, isolate(e__eqn, E)), isolate(b__eqn, V__0))), simplify(eval(eval(`&kappa;__eqn`, isolate(e__eqn, E)), isolate(b__eqn, V__0)))}], [a > 0])

b = a*2^(1/2)*(m*V__0/`&hbar;`^2)^(1/2)

 

e = E/V__0

 

{k = (e*b^2)^(1/2), kappa = (-b^2*(e-1))^(1/2)}

(10)

So now for any values of the box length and height, one finds the parameter b describing the problem and solves for the possible e values.

energy_eqn2 := `assuming`([simplify((eval(energy_eqn, eqns))/b^2)], [b > 0, e > 0, e < 1])

2*e^(1/2)*(-e+1)^(1/2)*cos(b*e^(1/2))-2*e*sin(b*e^(1/2))+sin(b*e^(1/2))

(11)

Maple cannot find an analytical solution, so we will find the eigenvalues numerically. The zero solution is unphysical.

solve(energy_eqn2, e)

0, RootOf(-2*(-(_Z^2-b^2)/b^2)^(1/2)*(_Z^2/b^2)^(1/2)*b^2+2*tan(_Z)*_Z^2-tan(_Z)*b^2)^2/b^2

(12)

For any b, read off the possible energies off the vertical line for that b, e.g. there are 3 bound states for b = 9. For other values, choose bval and nsols on the next line appropriately.

bval := 9; nsols := 3; plots:-implicitplot([b = bval, energy_eqn2], b = 0 .. 15, e = 0 .. 1)

9

 

3

 

 

evals := [fsolve(eval(energy_eqn2, b = bval), e = 0 .. 1, maxsols = nsols)]

[0.8115199822e-1, .3189598393, .6884466500]

(13)

In terms of the parameters b and e and normalization constant B, the non-dimensionalized wavefunctions of the 3 regions are as below. The scale factor gives a simpler form and prevents 0/0 problems later in the calculation.

scale := `assuming`([denom(simplify(eval(left2, eqns)))], [positive]); left3 := `assuming`([simplify(eval(scale*left2, eqns))], [positive]); box3 := `assuming`([simplify(eval(scale*box2, eqns))], [positive]); right3 := `assuming`([simplify(eval(scale*right2, eqns))], [positive])

sin((1/2)*b*e^(1/2))*(-e+1)^(1/2)+cos((1/2)*b*e^(1/2))*e^(1/2)

 

B*e^(1/2)*exp((1/2)*b*(-e+1)^(1/2)*(2*X+1))

 

-(sin((1/2)*b*e^(1/2))*(e^(1/2)*sin(b*e^(1/2)*X)-(-e+1)^(1/2)*cos(b*e^(1/2)*X))-cos((1/2)*b*e^(1/2))*(cos(b*e^(1/2)*X)*e^(1/2)+sin(b*e^(1/2)*X)*(-e+1)^(1/2)))*B

 

B*exp(-(1/2)*b*(-e+1)^(1/2)*(-1+2*X))*(e^(1/2)*cos(b*e^(1/2))+(-e+1)^(1/2)*sin(b*e^(1/2)))

(14)

It remains to find the normalization constant B. The three parts of the normalization integral are:

P__L := `assuming`([int(left3^2, X = -infinity .. -1/2)], [positive]); P__box := `assuming`([int(box3^2, X = -1/2 .. 1/2)], [positive]); P__R := `assuming`([int(right3^2, X = 1/2 .. infinity)], [positive])

(1/2)*B^2*e/(b*(-e+1)^(1/2))

 

-(1/4)*B^2*(2*e^(1/2)*(-e+1)^(1/2)*cos(2*b*e^(1/2))-2*e^(1/2)*(-e+1)^(1/2)-2*b*e^(1/2)-2*e*sin(2*b*e^(1/2))+sin(2*b*e^(1/2)))/(b*e^(1/2))

 

(1/2)*B^2*(e^(1/2)*cos(b*e^(1/2))+(-e+1)^(1/2)*sin(b*e^(1/2)))^2/(b*(-e+1)^(1/2))

(15)

Solve for B. There are two (messy) solutions for B of opposite sign; it is conventional to choose the sign such that the ground state has positive values.

Bval := sort([solve(P__L+P__box+P__R = 1, B)])[2]

Assemble it into a single piecewise function.

`&Phi;__all` := eval(piecewise(X < -1/2, left3, `and`(X >= -1/2, X <= 1/2), box3, X > 1/2, right3), B = Bval)

Plot. Plots offset vertically by the energy as usual

Xmax := 1.5; psiscale := .15; colors := [red, blue, magenta]; wavefns := plot([seq(eval(psiscale*`&Phi;__all`, {b = bval, e = evals[i]})+evals[i], i = 1 .. nsols)], X = -Xmax .. Xmax, color = colors); walls := plot([-1/2, y, y = 0 .. 1], color = black), plot([1/2, y, y = 0 .. 1], color = black), plot(1, X = -Xmax .. -1/2, color = black), plot(0, X = -1/2 .. 1/2, color = black), plot(1, X = 1/2 .. Xmax, color = black); evalplot := plot(evals, X = -Xmax .. Xmax, linestyle = dash, color = colors); plots:-display(wavefns, walls, evalplot, axes = boxed, labels = [X, psiscale*Phi+E/V__0])

 

NULL

Download finite_box_non-dim2.mw

Comments
1. The first general comment is about the issue of how much Maple can do. In principle one should be able to give dsolve the three ODEs and the boundary conditions and it should output the result. We are still far away from that. Even for one region, the boundary conditions at infinity are not handled by dsolve. The other extreme is to solve the ODEs for their general solutions, and follow the algebraic manipulations for implementing the boundary conditions as one might do it on paper. Engel for example has a comment "At this point we notice that by dividing the equations in each pair, the coefficients can be eliminated to give [...]". Maple will not easily do that trick or the manipulations that led to the special form on which the trick is applied. Levine's textbook [2] gives a different non-intuitive set of steps.

But Maple can solve complicated equations, so I wanted a more general strategy that avoids as much as possible the requirement to manipulate into special forms. On the other hand, it is tempting (as @zenterix tried) to just give the three general solutions with 6 arbitrary constants and the boundary conditions to Maple's solve, and solve for the six constants. One finds that all six are zero. This us a consequence of the fact that the ODEs are linear, and misses the crucial point that it is an eigenvalue problem. So there must be some sort of step-by-step guidance for Maple and there is a general but non-obvious strategy to solving such problems.

2. The second general comment is that there is a trade-off between presenting the solution steps without any arcane Maple code, and getting to the solution efficiently and programmatically, without too many manual manipulations. One of my suggestions to @zenterix involved manually dividing both sides of an equations by a fairly complicated expression, to which @acer expressed a preference for programmatic solutions. At the time, I mainly did that to keep close the to existing solution, and was thinking that I usually set things up so that is not necessary. But I found here that I do it a lot, and it is a natural consequence of the interactive way I use Maple. Here's two examples:

In the second line of label (4), I originally got a more complicated form of de_outside, then manually figured out the factor to put inside simplify to get the form you see. I do this frequently with Maple, especially when I use dchange.

In the last line of label (8), I manually divided by B to remove it. Had B been in the denominator, I could have removed it programmatically with numer (an operation I use frequently, though it somewhat recklessly ignores denominator zeroes).

Programmatically doing things can be relatively unreadable and disrupt the readability for the non-Maple reader. For example in label (6) there is "extraneous" code to find which coefficient to set to zero so that the solution goes to zero at +/- infinity. This was forced on me since after generating the nice figure I re-ran the worksheet only to have multiple errors. I originally used eval(outside, {c__1 = B__L, c__2 = A__L}); to change Maple's dsolve constants to read the way I wanted. But I realized that dsolve does not reproducibly assign c__1 and c__2 to the same term each time, raising the general issue of: 

3. Session to session reproducibility. If I am only going to use a worksheet myself, I don't usually worry too much about this, since I can usually debug this fairly easily. On the other hand if the worksheet is for others, it needs to be foolproof. I have taken to always sorting the output of solve, e.g., the assignment to bval in the execution group after label (15). The code added for the dsolve constants works, but is non-trivial Maple (suffixed type testing). (Solving this issue for Eigenvectors is yet more difficult.)

4. Some efforts to make the worksheet more readable were hard to do.

- For some reason, Engel chose to call the two constants in the left region B and B'. Entering B*exp(-k*x) + B'*exp(k*x) in 2D leads to B(x)*exp(-k*x) + diff(B(x), x)*exp(k*x). No doubt this can be fixed, but I didn't pursue this.

- I would normally use upper case Psi for the non-dimensionalized psi, but Psi is the name of a special function in Maple. But wait, now we can use "local Psi;" to solve this problem. However diff(Psi(x),x,x) displays as Psi(2,x), so I had to settle for Phi. (SCR submitted.)

- I build up the left wavefunctions incrementally as expressions assigned to left1, left2, etc, which is rather ugly. Why not use arrow procedures so we can use psi(x), D(psi)(x) etc. Aside from some awkwardness in updating such procedures by redefining them as needed, I ran into the following problem:

limit(A*exp(-k*x) + B*exp(k*x), x = infinity) assuming k > 0; gives as expected
signum(B)*infinity;

but

psi := x -> A*exp(-k*x) + B*exp(k*x);
limit(psi(x), x = infinity) assuming k > 0;
returns unevaluated. What happened to full evaluation?

- I'm used to entering hbar as hbar in 1D; it displays as h with the bar through. In 2-D entering hbar^2 is displayed nicely, but internally it is `&hbar;`. We can have the following puzzle:

(hbar/m)^2-`&hbar;`^2/m^2

hbar^2/m^2-`&hbar;`^2/m^2

NULL

- I originally wanted a vertical axis label Psi, E/V__0, but labels = [X, Psi, E/V__0] obviously won't work. It took some time to figure out the answer is to make "Psi, E/V__0" an atomic variable. I finally settled on the more honest, if cryptic, label shown.

5. solve gives an "invalid" solution. Originally I worked with solutions left2 etc (see label (6)) after simplify(eval(left2, eqns)). Every second wavefunction was about 10^9 times higher than the others, which was difficult to debug. It turns out the denominator of those wavefunctions was exactly zero but numerically 10^(-10), meaning they plotted as large-scaled versions of the right shape, without any division-by-zero error. The fix is to remove the denominators by scaling (see label (14)).

This is just a consequence of Maple giving generic solutions, and the only way around it is to be aware of it.

Summary

To solve such problems with Maple requires one to play around in an interactive way. After hacking to a solution, it can take some effort to make it presentable and usable to others. But the final result is pleasing, and is certainly much easier than working through the problem on paper. The ability to manipulate complicated expressions means circumventing tricks that might be needed in manual solutions. 

References
[1] T. Engel, Quantum Chemistry and spectroscopy. Pearson 2019, 4th ed. Sec. 5.1, Prob. 5.3. 
[2] I. N. Levine, Quantum Chemistry. Pearson 2009, 6th ed. Sec. 2.4. 

First 26 27 28 29 30 31 32 Last Page 28 of 2215