Maple 2021 Questions and Posts

These are Posts and Questions associated with the product, Maple 2021

When I was drawing a plane graph, I found that the labels  of vertices were not displayed  and some edges even overlap when drawing because they were too close due to embedding.

DrawPlanar(g,stylesheet=[vertexborder=false,vertexpadding=5,edgecolor = maroon,vertexcolor=gray,edgethickness=3])

So I thought that  option  Interactive  can adjust the position manually, but  at the same time I found that the style of  edges, such as the color and thickness, etc., is lost.  How to handle it? Is this a bug?

DrawPlanar(g,stylesheet=[vertexborder=false,vertexpadding=5,edgecolor = maroon,vertexcolor=gray,edgethickness=3],layout=interactive)

Hi everyone! It's been a remarkably long time since I posted on MaplePrimes -- I should probably briefly reintroduce myself to the community here. My name is Erik Postma. I manage the mathematical software group at Maplesoft: the team that writes most of the Maple-language code in the Maple product, also known as the math library. You can find a longer introduction at this link.

One of my tasks at Maplesoft is the following. When a request for tech support comes in, our tech support team can usually answer the request by themselves. But no single person can know everything, and when specialized knowledge of Maple's mathematical library is needed, they ask my team for help. I screen such requests, answer what I can by myself, and send the even more specialized requests to the experts responsible for the appropriate part of the library.

Yesterday I received a request from a user asking how to unwrap angles occurring in an expression. This is the general idea of taking the fact that sin(phi) = 'sin'(phi + 2*Pi), and similarly for the other trig functions; and using it to modify an expression of the form sin(phi) to make it look "nicer" by adding or subtracting a multiple of 2*Pi to the angle. For a constant, real value of phi you would simply make the result be as close to 0 as possible; this is discussed in e.g. this MaplePrimes question, but the expressions that this user was interested in had arguments for the trig functions that involved variables, too.

In such cases, the easiest solution is usually to write a small piece of custom code that the user can use. You might think that we should just add all these bits and pieces to the Maple product, so that everyone can use them -- but there are several reasons why that's not usually a good idea:

  • Such code is often too specialized for general use.
  • Sometimes it is reliable enough to use if we can communicate a particular caveat to the user -- "this will not work if condition XYZ occurs" -- but if it's part of the Maple library, an unsuspecting user might try it under condition XYZ and maybe get a wrong answer.
  • This type of code code generally doesn't undergo the careful interface design, the testing process, and the documentation effort that we apply to the code that we ship as part of the product; to bring it up to the standards required for shipping it as part of Maple might increase the time spent from, say, 15 minutes, to several days.

That said, I thought this case was interesting enough to post on MaplePrimes, so that the community can take a look - maybe there is something here that can help you with your own code.

So here is the concrete question from the user. They have expressions coming from an inverse Laplace transform, such as:

F := -0.3000*(-1 + exp(-s))*s/(0.0500*s^2 + 0.1*s + 125);
f := invlaplace(F, s, t)*u(t);
# result: (.1680672269e-1*exp(1.-1.*t)*Heaviside(t-1.)*(7.141428429*sin(49.98999900*t-
#         49.98999900)-357.*cos(49.98999900*t-49.98999900))+.1680672269e-1*(-7.141428429*sin
#         (49.98999900*t)+357.*cos(49.98999900*t))*exp(-1.*t))*u(t)

I interpreted their request for unwrapping these angles as replacing the expressions of the form sin(c1 * t + c0) with versions where the constant term was unwrapped. Thinking a bit about how to be safe if unexpected expressions show up, I came up with the following solution:

unwrap_trig_functions := module()
local ModuleApply := proc(expr :: algebraic, $)
  return evalindets(expr, ':-trig', process_trig);
end proc;

local process_trig := proc(expr :: trig, $)
  local terms := convert(op(expr), ':-list', ':-`+`');
  local const, nonconst;
  const, nonconst := selectremove(type, terms, ':-complexcons');
  const := add(const);
  local result := add(nonconst) + (
    if is(const = 0) then
      const := evalf(const);
      if type(const, ':-float') then
        frem(const, 2.*Pi);
        frem(Re(const), 2.*Pi) + I*Im(const);
      end if;
    end if);
  return op(0, expr)(result);
end proc;
end module;

# To use this, with f defined as above:
f2 := unwrap_trig_functions(f);
# result: (.1680672269e-1*exp(1.-1.*t)*Heaviside(t-1.)*(7.141428429*sin(49.98999900*t+
#         .27548346)-357.*cos(49.98999900*t+.27548346))+.1680672269e-1*(-7.141428429*sin(
#         49.98999900*t)+357.*cos(49.98999900*t))*exp(-1.*t))*u(t)

Exercise for the reader, in case you expect to encounter very large constant terms: replace the calls to frem above with the code that Alec Mihailovs wrote in the question linked above!

Hello all,

The following minimal worksheet leads to a "Kernel Connection Lost" message. At seemingly random times, I get a `System error, `, "bad id" message in the worksheet output instead.

Temporarily disabling ESET Internet Security did not help. Before I contact technical support, I would like to ask if there is anything obvious that I am overlooking that could cause this problem.

Thank you very much.


`Maple 2021.1, X86 64 WINDOWS, May 19 2021, Build ID 1539851`



P := CartesianProduct([1,2,3,4],[1,2,3,4]):

add(p,p in P);


with(Student:-Basics); simplify((b - 1)/(b + 2 - (b^2 + 2)/(b - (b - 2)/(b + 1)))); b - 1 This is correct, but I want to see the step-by-step solution. P.D. I try the ExpandSteps command already but the result doesn't give me the solution. Please, help me. Thanks in advance


When I tried to explain to a student how to set it up, it stopped working.  I tried changing the order, but got the same result. I tried using "t" instead of theta, but got the same result. Please help.



Maple 2021.1 screen shot: property box too small to select properties

how it should look like

How do I get it back to normal?

Thank you

     I asked a similar question a few weeks ago and received a most helpful response, but unfortunately I had inaccurately transcribed thespecified form of that double integral from a file presented in Microsoft Word.  I shall be most grateful for the numerical evaluation of this difficult double integral here presented in unambiguous and correct Maple definition, for cases n=0 and n=1.


i1 := Int(exp(-(k^2*sinh(s)^2/(gam-I*k*cosh(s)) + I*k*(1-cosh(s)))*v)*Hypergeom([I/k],[1],I*k*v)*v^n, v=0..R/2);

Jn := 1/R*Int(sinh(s)*coth(s/2)^(2*I/k)/(gam-I*k*cosh(s))^5*i1, s=0..smax);

smax := 20;  R := 1680;  k := 1/4;  gam := 1/2;

The preceding response seemed to have several Maple statements that were not actually involved in the solution, making it difficult to follow the applied scheme of that solution.

      Thanks in advance,     John Ogilvie


I wonder if it is possible to define my own relationships so they can be used later with simplify.


Actually, I would like Maple to simplify the following expression

int(JacobiP(n, a, b, x)*JacobiP(m, a, b, x)*(1 - x)^a*(1 + x)^b, x = -1 .. 1)


but I haven't been able to do so. Therefore, I was wondering if it is possible to define

int(JacobiP(n, a, b, x)*JacobiP(m, a, b, x)*(1 - x)^a*(1 + x)^b, x = -1 .. 1) = piecewise(n <> m, 0, n = m, 2^(a + b + 1)*GAMMA(n + a + 1)*GAMMA(n + b + 1)/((2*n + a + b + 1)*GAMMA(n + a + b + 1)*n!))


and use this relation in further simplification operations.


Thank you in advance,

I wanted to define a set of all positive integer powers of 2, and I could determine whether a number is contained in the set.

When a set is a finite set and there are not many elements, it's not hard to do. We can form the set first and then determine whether the elements are included or not.




Because the set of all positive integer powers of 2 is an infinite set, or rather a countable set. I thought of using the positive type to define it.

map(type, [0, 4, -2], 'And'('positive', 'satisfies'(s -> type(log2(s), 'positive'))))

[false, true, false]

Interestingly, we find that the type of judgment condition is a function, whereas positive(or integer) are symbols.

whattype('And'('positive', 'satisfies'(s -> type(log2(s), 'positive'))));




So my question is how does Maple define integer types or positive integers or even real numbers? In other words if I don't use the positive integer type for the above question, can I define the set of all positive integer powers of 2.

Mathematics for Chemistry with Symbolic Computation

J. F. Ogilvie

            This interactive electronic textbook, in the form of Maple worksheets, is released in its sixth edition, 2021 August.  This book has two major divisions, mathematics for chemistry -- the mathematics that any instructor of a course in chemistry would wish a student thereof to understand and to be able to implement, and mathematics of chemistry, in the sense of the classic volumes by Margenau and Murphy -- mathematical treatments of particular topics in chemistry from an introductory post-secondary level to a post-graduate level. The content, which includes not only chapters in previous editions that have been revised but also additional chapters on quantum mechanics, molecular spectrometry and advanced chemical kinetics, has been collected during two decades, with many contributions from other authors, acknowledged in particular locations.  Each chapter includes not only explanatory treatments but also illuminating examples and exercises with chemical applications where practicable.


Mathematics for chemistry      0  introduction to Maple commands

                                                 1  numbers, symbols and elementary functions

                                                 2  plotting, geometry, trigonometry and functions

                                                 3  differential calculus

                                                 4  integral calculus

                                                 5  multivariate calculus

                                                 6  linear algebra

                                                 7  differential and integral equations

                                                 8  probability, statistics, regression and optimisation

Mathematics of chemistry       9  chemical equilibrium

                                                10  group theory

                                                11  graph theory

                                                12  quantum mechanics in three parts -- models, atoms and molecules

                                                13  molecular spectrometry

                                                14  Fourier transforms

                                                15  advanced chemical kinetics

                                                16  dielectric and magnetic properties

The content freely available at includes also a published report on teaching mathematics with symbolic software and an interactive periodic chart that yields information about particular chemical elements and their isotopic variants.

            The nature of this electronic interactive textbook makes it applicable with an instructor in a traditional setting, or computer laboratory, for which the material of mathematics for chemistry could be reasonably covered in three or four semesters, but even for self study.  The chapters on quantum mechanics and Fourier transforms are available as separate textbooks in the same format.

Dear Sirs, 
I was with my students today, and attempting to do a Math Maple exercise. The assignment contained the requirement to plot three graphs in one plot f,g,h. Those with windows pc and maple were able use the proper command. 

plot({f(x),g(x),h(x)}) or plot([f(x),g(x),h(x)])  however some of those with MacOS would inside Maple 2021 get an error which said "GNU compiler not found", when using the same command. For those there was no other way (that I knew off) than to do a 




and then plots:-display([f(x),g(x),h(x)]):  which work.

But why the MacOS error ? Any idea?

On virtually any webpage is a mixture of images and text. I can go to the page, select all contents, copy the contents into an Excel spreadsheet, save the spreadsheet file and then use the ExcelTools:-Import function to read the file into a DataFrame. At that point, I can work with the data.   All the text on the webpage, even if it is embedded in some HTML command, is copied as text into the spreadsheet which eventually can be read as text by Maple.

My quesiton is, what is the method for me to bypass Excel and import the webpage directly into Maple, striped of the HTML code? Can someone point me to an example? (The only examples I have seen use the Sockets package, but I thought this mode has been superceded with Import.)

Can you use the Dirac function in different coordinate systems?

I have some algebraic expression which I want to expand.

I used the ExpandSteps command to show me the steps, but I guess I used it incorrectly.

Attached below the file with the commands.

It should be expanded to -\Delta*\sin^2(\theta), but I want maple to show me the steps.

"with(Student[Basics]):  Delta:=r^(2)-2 M*r+a^(2);  rho^():=sqrt(r^(2)+a^(2)*(cos(theta))^(2));  ExpandSteps((a^(2)*sin^(2)(theta)-Delta^(2))*((r^(2)+a^(2))^(2)-a^(2 )*Delta*sin^(2)(theta))*((sin^(2)(theta))/(rho^(4)))-(4 *a^(2)*M^(2)*r^(2)*sin^(4)(theta))/(rho^(4)))"

Error, (in Student:-Basics:-ExpandSteps) too many levels of recursion





Dear members,

first of all, this is my first question so please excuse me if it is posted in a bad way. Anyway, here is my problem:


I am trying to plot a function V(k,i(k)) over the positive real numbers k>0 where i=i(k) is the implicitly defined solution to


Both maps chi(i) and w(k) are relatively simple and well-defined. However, depending on k, two solutions to chi(i)-w(k)=0 coexist, call them i^1(k) and i^2(k). Hence, I want to have two plots:

V(k,i^1(k)) over k as well as V(k,i^2(k)) over k.

Below is my code:




The output is

which corresponds to only one of the solutions. How can I visualize the other solution?


Thank you and best regards,


First 15 16 17 18 19 20 21 Last Page 17 of 27