Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi everyone,

I am trying to visualize the integral of x3 over the interval x=−1 to x=1. I tried using:

with(plots):
display(
   plot(x^3, x = -1 .. 1, color = black, thickness = 2),
   shadebetween(x^3, 0, x = -1 .. 1, color = cyan)
);

This works, but I wondered if there’s a better or more elegant way to visualize definite integrals. For example:

  • Can I add transparency to the shaded region?
  • Is there a built-in function that directly plots definite integrals with shading?
  • Any tips for improving the aesthetics of such plots?

Thanks in advance for any help!

Download εμβαδόν_χωρίου.mw

Windows 10. From normal command line window:

"C:\Program Files\Maple 2024\bin.X86_64_WINDOWS\mint.exe" foo.mpl

Gives this

The file foo.mpl is

export module ODE() 
    option object; 
    export ode::`=`;
end module;

Notice the funny looking characters in the output.

Why does it happen?

restart

with(PDEtools)

undeclare(prime, quiet); declare(u(x, y, z, t), quiet); declare(f(x, y, z, t), quiet)

``

(1)

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

eqw := 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)

Bij := proc (i, j) options operator, arrow; -24*mu/(sqrt(1+(-4*beta*l[j]-4*delta*r[j]-4*alpha)*mu)*sqrt(1+(-4*beta*l[i]-4*delta*r[i]-4*alpha)*mu)-1+((2*r[i]+2*r[j])*delta+(2*l[i]+2*l[j])*beta+4*alpha)*mu) end proc

NULL

theta1 := normal(eval(eval(thetai, eqw), i = 1)); theta2 := normal(eval(eval(thetai, eqw), i = 2))

eqf := f(x, y, z, t) = theta1*theta2+Bij(1, 2)

eqfcomplex := collect(evalc(eval(eval(eqf, l[2] = conjugate(l[1])), l[1] = a+I*b)), t)

eq17 := u(x, y, z, t) = 2*(diff(diff(f(x, y, z, t), x), x))/f(x, y, z, t)-2*(diff(f(x, y, z, t), x))^2/f(x, y, z, t)^2; equ := simplify(eval(eq17, eqfcomplex))

So we want to find a substitution that removes the time dependence from u. One way is to find the maximum and see how it moves. Here, the first solution gives what we want.

ans := solve({diff(rhs(equ), x), diff(rhs(equ), y), diff(rhs(equ), z)}, {x, y, z}, explicit)

 

NULL

Download hfz.mw

Hi! An basic and interesting issue.

First, why I run worksheet again and again, I will get different output (even seems understandable)? I guess maybe the memory is not renewed?

Second, how to obtain the periodic solution without adding ```k*Pi``` manually?

`assuming`([solve(sqrt(2)*sin(2*x-(1/6)*Pi) = 1)], [`in`(x, real)])

5/24

(1)

x := solve(sqrt(2)*sin(2*x-(1/6)*Pi) = 1)+k*Pi

5/24+k*Pi

(2)
 

NULL

Download periodic_solution_of_a_simply_Sine_function.mw

i need the result for (eqt33) but i can reach the result there is any  other way for finding? i need to plot 3D of that function but without have the function how i can do explore on it

w1.mw

Is this a bug in mint?

Given this foo.mpl

foo:=proc()
    local x:=2,y:=3;       
        
    if MmaTranslator[Mma][LeafCount](x)<MmaTranslator[Mma][LeafCount](y)  then        
        0;
    else
       1;
    fi;  

end proc;   

It says

Procedure foo() on lines 2 to 11
  These names were used as global names but were not declared:  LeafCount, Mma

But if I rewrite the above using :- instead:

foo:=proc()
    local x:=2,y:=3;       
        
    if MmaTranslator:-Mma:-LeafCount(x)<MmaTranslator:-Mma:-LeafCount(y)  then        
        0;
    else
       1;
    fi;  

end proc;  

Now mint is happy and no message are given.

Is not  MmaTranslator:-Mma:-LeafCount(x)  the same as MmaTranslator[Mma][LeafCount](x) ?

Maple itself is happy with both. So why is mint complaining?

I am finding many problems with mint. Will post more problems found when I have more time.

Is mint still actively  maintained by Maplesoft? 

Hi Guys,

I encountered this rather unexpected behavior of Maple 18 when using the "read" function as shown below, where Maple fails to reduce the answer to 0, especially for (5). I'm curious if there's any deeper reason for this, and if there's a better or more standard solution than mine, that is, to use "parse( convert( expr, string ) )" as in (6)?

Thanks a lot!

``

restart;

 

assume(x>0);

 

f := x^2;

x^2

(1)

 

save f, "read_test.m";

 

restart;

 

f;

f

(2)

 

read "read_test.m";

 

f;

x^2

(3)

 

f - x^2;

-x^2+x^2

(4)

 

assume(x>0);

 

f - x^2;

x^2-x^2

(5)

 

f1 := parse( convert( f, string ) );

x^2

(6)

 

f1;

x^2

(7)

 

f1 - x^2;

0

(8)

 

NULL

Download test1.mw

Hi,

I am creating a multiple-choice questionnaire (MCQ) on functions, but the display of logarithmic functions is automatically converted to natural logarithms. How can I keep the logarithms displayed in base a without conversion? Thank you for your help.

S5_QCM_Expo_Log.mw

I found system remember tables mentioned under Details in ?CacheOption.

What exactly are they? Anything special about them?

The ProgrammingGuide does not given more details. It only mentions that there are "procedures that cannot use option system remember tables". For what reason a procedure cannot use them?

For the following limit determination, I do not get the known result 2, but only a term with LerchPhi. Please give me some advice.
lim(n-->oo)[(n/(2^n))*sum(k=1 to n) (2^k/k)]

I wish to plot two line segments over the intervals [0,1] and [2,3].  Maple 2024 draws a single line segment over [0,3].  Oddly enough, if I specify a color option, then it produces the expected result!

This used to work correctly in Maple 2023.  Perhaps this can be corrected in the forthcoming release?

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

plots:-display(
        plot(1, x=0..1),
         plot(1, x=2..3), thickness=5);

plots:-display(
        plot(1, x=0..1),
         plot(1, x=2..3),thickness=5, color=red);


Download mw.mw

I am taking a course in quantum mechanics and trying to do the calculations in Maple.

In the worksheet below I try to solve a system of equations to find some constants. 

It isn't very relevant that the domain is physics. 

The issues I have are with manipulations of expressions (specifically, simplifications).

restart

Levine - Ch. 2.4 - Particle in a Rectangular Well

NULL

Define

s__1 := sqrt(2*m*(V__0-E))/`&hbar;` = 2^(1/2)*(m*(V__0-E))^(1/2)/`&hbar;`NULL

s__2 := -s__1 = -2^(1/2)*(m*(V__0-E))^(1/2)/`&hbar;`NULL

NULLs := sqrt(2*m*E)/`&hbar;` 

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

(1)

`&psi;__1`, `&psi;__2` and `&psi;__3` are wavefunctions.

`&psi;__1` := proc (x) options operator, arrow; C*exp('s__1'*x) end proc = proc (x) options operator, arrow; C*exp('s__1'*x) end procNULL

`&psi;__2` := proc (x) options operator, arrow; A*cos('s'*x)+B*sin('s'*x) end proc = proc (x) options operator, arrow; A*cos('s'*x)+B*sin('s'*x) end procNULL

`&psi;__3` := proc (x) options operator, arrow; G*exp('s__2'*x) end proc = proc (x) options operator, arrow; G*exp('s__2'*x) end procNULL

NULL

assume(G <> 0, C <> 0)

NULL

I would also like to assume that A and B cannot both be zero simultaneously.


As can be seen above, there are four unknown constants, "A,B,C,"and G.

 

We can obtain values for these unknowns by imposing boundary conditions.

 

Some of the boundary conditions involve the first derivatives of the wavefunctions.

`&psi;__1,d` := D(`&psi;__1`) = proc (z) options operator, arrow; C*s__1*exp(s__1*z) end procNULL

`&psi;__2,d` := D(`&psi;__2`) = proc (z) options operator, arrow; -A*s*sin(s*z)+B*s*cos(s*z) end procNULL

`&psi;__3,d` := D(`&psi;__3`) = proc (z) options operator, arrow; G*s__2*exp(s__2*z) end procNULL

NULL

The boundary conditions are

NULL

`&psi;__1`(0) = `&psi;__2`(0)*`&psi;__2`(l) and `&psi;__2`(0)*`&psi;__2`(l) = `&psi;__3`(l)*(D(`&psi;__1`))(0) and `&psi;__3`(l)*(D(`&psi;__1`))(0) = (D(`&psi;__2`))(0)*(D(`&psi;__2`))(l) and (D(`&psi;__2`))(0)*(D(`&psi;__2`))(l) = (D(`&psi;__3`))(l)

NULL

My question is how to find the constants in Maple.

NULLNULL

In this problem, E < V__0 and m > 0.

 

assume(E < V__0, m > 0)

 

Solving the first boundary condition is easy.

expr1 := solve(`&psi;__1`(0) = `&psi;__2`(0), {C}) = {C = A}

NULL

Next, I solve the third boundary condition and sub in the result from solving the first boundary condition. We get B in terms of A.

expr3 := eval(solve(`&psi;__1,d`(0) = `&psi;__2,d`(0), {B}), expr1) = {B = A*(m*(V__0-E))^(1/2)/(m*E)^(1/2)}NULL

NULL

Already here it is not clear to me why Maple does not cancel the m's.

 

Next, consider the second boundary condition

expr2 := solve(`&psi;__2`(l) = `&psi;__3`(l), {G}) = {G = (A*cos(s*l)+B*sin(s*l))/exp(s__2*l)}

 

We can obtain G in terms of just A by subbing in previously found relationships, as follows

expr2 := simplify(subs(expr3, expr2))

{G = exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A*(sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2)+cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2))/E^(1/2)}

(4)

NULL

Finally, consider the fourth boundary condition.

solve(`&psi;__2,d`(l) = `&psi;__3,d`(l), {G})

{G = (m*E)^(1/2)*(A*sin(2^(1/2)*(m*E)^(1/2)*l/`&hbar;`)-B*cos(2^(1/2)*(m*E)^(1/2)*l/`&hbar;`))/((m*(V__0-E))^(1/2)*exp(-2^(1/2)*(m*(V__0-E))^(1/2)*l/`&hbar;`))}

(5)

expr4 := simplify(subs(expr3, solve(`&psi;__2,d`(l) = `&psi;__3,d`(l), {G})))

{G = (sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2)-cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2))*exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A/(V__0-E)^(1/2)}

(6)

result := simplify(subs(expr2, expr4))

{exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A*(sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2)+cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2))/E^(1/2) = (sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2)-cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2))*exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A/(V__0-E)^(1/2)}

(7)

At this point, we have this complicated expression.

 

The calculations above come from the book "Quantum Chemistry" by Levine. The variable "result" above should, after a few more steps of manipulating the expression, give us

 

(2*E-V__0)*sin(sqrt(2*mE)*l/`&hbar;`) = 2*sqrt(-E^2+E*V__0)*cos(sqrt(2*mE)*l/`&hbar;`)

(2*E-V__0)*sin(2^(1/2)*mE^(1/2)*l/`&hbar;`) = 2*(-E^2+E*V__0)^(1/2)*cos(2^(1/2)*mE^(1/2)*l/`&hbar;`)

(8)

 

I've done the calculation by hand. It is not difficult. The exponentials and the A cancel on each side and we are left with an equation involving sin(sl) and cos(sl) which easily comes out to the desired equation above.

I would like to be able to do it here in Maple.

The first thing I would do at this point is to start eliminating some of the clutter. For example, I would like to replace sqrt(2*mE)/`&hbar;` with s.

 

This is a first task (that I have asked about in a separate question).

 

Then, I would want Maple to do the cancellations for me, but I have already used "simplify".

 

Finally, I think I would like to collect terms involving cos and sin.

 

Here is what happens when I try to get Maple to solve the equations for me in one go

 

solve({`&psi;__1`(0) = `&psi;__2`(0), `&psi;__1,d`(0) = `&psi;__2,d`(0), `&psi;__2`(l) = `&psi;__3`(l), `&psi;__2,d`(l) = `&psi;__3,d`(l)}, {A, B, C, G})

{A = 0, B = 0, C = 0, G = 0}

(9)

Download solve_constants.mw

In a calculation, I obtained the following expression from Maple.

expr1:=A*sqrt(-m*(-V__0 + E))/sqrt(m*E)

A*(-m*(-V__0+E))^(1/2)/(m*E)^(1/2)

(1)

The first question I have is why the "m's don't cancel."

Next, consider the expression

expr2:=exp(sqrt(2)*sqrt(m)*sqrt(-V__0 + E)*l*I/`&hbar;`)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(2)

simplify(expr2,[E-V__0=y])

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(3)

simplify(expr2,[2*m=y])

exp(I*y^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(4)

Why doesn't the simplification below work?

simplify(expr2,[2*m*(E-V__0)=y])

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(5)

I also tried with other commands

eval(expr2,2*m=y)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(6)

eval(expr2,E-V__0=y)

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(7)

eval(expr2,2*m*(E-V__0)=y)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(8)

algsubs(2*m=y,expr2)

exp(I*y^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(9)

algsubs(E-V__0=y,expr2)

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(10)

algsubs(2*m*(E-V__0)=y,expr2)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(11)
 

NULL

In reality, I would like to the entirety of sqrt(2m(E-V__0)/hbar) a variable by the name of s.

Download simplify_roots.mw

Below is a simple demonstration of something that I am very confused about in another worksheet I am working on.

Basically, I have a function of x called psi_I and I want to define another function of x called psi_I,d which is just the derivative of psi_I.

In, the snippet below, this works if I use the variable names psi_1 and psi_1,d, but not if I replace the "1" with a "I" as I want to do.

In addition, I don't know why the output (6) is different from (7) or (8). All three are from the same command in Maple.

restart

`&psi;__1` := proc (x) options operator, arrow; C*exp(a*x) end proc

proc (x) options operator, arrow; C*exp(a*x) end proc

(1)

`&psi;__1,d` := unapply(diff(`&psi;__1`(x), x), x)

proc (x) options operator, arrow; C*a*exp(a*x) end proc

(2)

`&psi;__1,d`(x)

C*a*exp(a*x)

(3)

NULL

restart

`&psi;__I` := proc (x) options operator, arrow; C*exp(a*x) end proc

proc (x) options operator, arrow; C*exp(a*x) end proc

(4)

`&psi;__I,d` := unapply(diff(`#msub(mi("psi",fontstyle = "normal"),mi("1"))`(x), x), x)

D(psi__1)

(5)

`#msub(mi("psi",fontstyle = "normal"),mi("1,d"))`(x)

`psi__1,d`(x)

(6)

`#msub(mi("psi",fontstyle = "normal"),mi("I,d"))`(x)

(D(psi__1))(x)

(7)

`&psi;__I,d`(x)

(D(psi__1))(x)

(8)

NULL

Download psi_subscript.mw

To Maplesoft,

Please consider changing the name from Maple to something else.

It is almost impossible to search for anything related to maple, since google keeps giving results about trees called Maple in Canada and about some maple syrup products which I have no interest in at all.

One has to go through pages and pages of links looking for a real Maple software hit.

I know the name Maple has been around for long time, but a new unique name will make searching easier and people will get used to the new name very quickly (may be in 1-2 years).

Some examples:

 

I know when Maple was created almost 40 years ago, the inernet itself was not even here (I forgot when VP. Gore created the internet but I think that was in early 90's), and search was not thought about then.

But these days, the ability to search for something and to easily find it is very important for companies and having a unique name for Maple will make it also much more popular and easier to find things about it instead of finding  information about Maple syrup and Maple trees all the time.

This is posted  under product suggestions.

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