Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

(ps. there is no Maple 2018 product to select, so I selected Maple 2017 from the menu).

The new UNTIL keyword added to Maple 2018 seems to me to be confusing and a useless addition to the Maple language.

First of all, using it in a DO loop, one does not use an closing END DO as normal. This makes it harder to use, since one is used to seeing an END DO to close each DO. They align physically better, which makes the code easier to read.

In addition, I can't think of anything that can't be done using current language constructs that needs this new keyword. Can someone? 

Adding a whole new keyword to make one type maybe few less characters seems like  a bad language design. A language constructs should be orthogonal to each others for the language to remain simple and clean. Adding more keywords for the fun of it should be avoided if something can be written using exisiting language constructs.

n := 37:
  n := n + 1
until isprime(n);

very confusing to read. It has no end do. At first, I did not see where the loop ends. And the above can be done in many other ways allready, one direct way could be

n := 37:
  n := n + 1;
  if isprime(n) then

And it is more clear as well since the DO is aligned with the END DO and I find the logic clearer with no new keyword added. I am sure there are other ways to do this.

Can someone show an example where UNTIL is really needed and will make the code much more clear that justifies adding it to the language?



I am attempting to solve a series using the solve command, but prior to execution I attempt to convert the "INERT" Sum to "ACTIVE" sum.  This has worked for me in the past when the coefficients of the series did not change.  Now this approach is not working.  The conversion is not working possibly due the varying nature of the coefficients, Ck?

Is there another way to find the solutions?

Today we are pleased to announce the release of Maple 2018.

For many people, today is just another day in March. It’s not like the release of a new version of a software product is a world-shaking event. But for us here at Maplesoft, these first few days after the latest version of Maple is released are always a bit more special. There’s always a nervous energy whenever we release Maple and everyone else gets to see what we’ve been pouring our efforts into for the past year.

I’m not going to start this post by calling the latest version of Maple “game-changing” or “cutting edge” or any other marketing friendly platitude. I’m well aware that the latest version of Maple isn’t going to change the world.

What I would say though is that with every new release of software comes an opportunity. Every new software release is an opportunity to re-evaluate how that software has evolved to better suit your needs and requirements. So… if you've been sitting on the sidelines and watching version after version go by, assuming that it won't affect you, that's wrong! There's a lot that you could be missing out on.

The way that these release announcements usually work is that we try to amaze and astound you with a long list of features. Don’t worry, I’ll get into that in a bit. But first I wanted to walk through a simple exercise of release arithmetic.

I’ll start with one of those basic truths that has always been hiding in plain sight. The build number # for Maple 2018 is 1298750. Here at Maplesoft, every time our developers make a change to Maple this build number goes up by 1. These changes are sometimes small and sometimes very big; they can be as small as fixing a documentation typo or they can constitute implementing a major feature spread across numerous files in our source tree.

I have come to look at these build numbers in a slightly different way. I look at build numbers as representing all of the small to large sized steps our developers take to get you from one version to the next (or put another way, how many steps behind you are if you are using the older versions). With that in mind, let’s do some quick math:

If you are using Maple 2017 (2017.0 was build # 1231047), there have been 1298750 – 1231047 = 67703 steps since that release (these numerous "steps" are what built the "long list" of features below). If you’re using Maple 2016 (#1113130) this number grows to 185620. And so it goes… Maple 2015 (#1022128) = 276622 steps, Maple 18 (#922027) = 376723, Maple 17 (#813473) = 485277, you get the idea. If you’re using a really old version of Maple – there’s a good chance that we have fixed up a bunch of stuff or added something that you might find interesting in the time since your last upgrade!


Every new release of Maple adds functionality that pushes Maple into new domains, rounds out existing packages, fills gaps, and addresses common user requests. Let's explore some additions:


Clickable Math - a.k.a. math that looks like math and can be interacted with using your mouse - has evolved. What was once a collection of operations found in the right-click or main menu items or in interactive smart-popups or in many additional dialogs, has been brought together and enhanced to form the new Context Panel.

We can summarize the Context Panel as follows: Enter an expression and relevant operations that you can apply to that expression appear in a panel on the right side of your screen. Easy, right? It's a great change that unlocks a large part of the Maple library for you.

The addition of the Context Panel is important. It represents a shift in the interaction model for Maple – you’ll see more and more interaction being driven through the context panel in future releases. Already, the changes for the Context Panel permeate through to various other parts of Maple too. You’ll see an example in the Units section below and here’s another for coding applications.

The Context Panel also gives you access to embedded component properties – this makes it much easier to modify parts of your application.

There’s much more we can say about the Context Panel but in the interest of keeping this post (somewhat) concise I’ll stop there. If you are interested and want to see more examples, watch this video.


Coding in Maple - For many of us, using the Maple coding language is fundamental; it's just what we do. Whether you write a lot of procedures, or modify the start-up code for your worksheet, or put a sequence of commands in a code edit region, or include a button or slider in your application, you’ll find yourself using Maple’s code editing tools.

For Code Edit Regions and the Maple Code Editor, there’s automatic command completion for packages, commands, and even file paths.

maplemint has been integrated into the Code Editor, providing code analysis while you write your code.

mint and maplemint have been unified and upgraded. If you’ve never heard of these before, these are tools for analysing your Maple code. They provide information on procedures, giving parameter naming conflicts, unreachable code, unused parameters or variables, and more. Mint is available for use with external text files and maplemint runs directly inside of Maple.

For more, I’ve got another video.


For many engineers and scientists, units are intrinsically linked with calculations. Here's something else in Maple 2018 that will improve your everyday experience – units are now supported in many core routines such as in numeric equation solving, integration, and optimization.

Here’s a quick example of using units in the int command with some thermophysical data:

We define an expression that gives the pressure of methane as a function of the specific volume V.

P := ThermophysicalData:-Property("pressure", "methane", "temperature" = 350*Unit('K'), "density" = 1/V):
-(int(P, V = 1.0*Unit('m'^3/'kg') .. .5*Unit('m'^3/'kg'), numeric));

You'll also find unit formatting in the Context Panel.

Near and dear to my heart, data analysts also have some occasion to rejoice. Maple 2018 finally adds an Interpolate command that supports irregular data! This is one of those items that users have been requesting for a long time and I'm very happy to say that it's finally here.

Furthering the data story, there are new sources for thermochemical data as well as updates to ensure that existing datasets for thermophysical data and scientific constants are up to date.


If you're interested in protecting your content in Maple, listen up:

You can now encrypt procedures; anyone can use your code, but they can't see the source!

You can also lock your Maple documents - effectively protecting them from accidental changes or other unintended modifications.



Of course, I won't leave mathematics out of this. As always, there’s a ton of new and updated stuff here.

There's a new computational geometry package. There are improvements across all fields of mathematics including group theory, graph theory, integration, differential equations and partial differential equations. And there's a ton of new work in Physics (many of you who have been following the Physics project will already know about these).

You can recreate some of the visualizations above as follows:

Here’s an example of the new VoronoiDiagram Command:

m := LinearAlgebra:-RandomMatrix(40, 2):
ComputationalGeometry:-VoronoiDiagram(m, showpoints, symbol = solidcircle, symbolsize = 7,colorregions=ColorTools:-GetPalette("Dalton"));

Here’s another change that I’ve seen mentioned several times on MaplePrimes – the ability to control the  border of arrows:

plots:-display(plottools:-arrow([0, 0], [2, 2], 0.5e-1, .2, .1, border = false, color = "DarkGrey", legend = "A+B"),
                       plottools:-arrow([0, 0], [1, 2], .15, .3, .15, border = false, color = "Crimson", legend = "A"),
                       plottools:-arrow([1, 2], [2, 2], .15, .3, .15, border = false, color = "CornflowerBlue", legend = "B"),
                   size = [600, 400]);

You can rotate Tickmarks in plots using the rotation option. Some plots, such as those in the TimeSeriesAnalysis package, use rotation by default.

ts := TimeSeriesAnalysis:-TimeSeries([7, 23, 21, 19, 13, 46, 42, 30, 31, 26, 19, 9, 16, 26, 17, 33, 31, 46, 42, 35, 45, 30, 11, 17, 23, 20, 15, 36, 31, 55, 49, 39, 36, 28, 12, 11, 21, 23, 27, 33, 36, 49, 42, 37, 33, 45, 12, 7, 23, 32, 25, 42, 27, 52, 50, 34, 41, 40, 16, 14], frequency = monthly, startdate = "2005-09");
TimeSeriesAnalysis:-SeasonalSubseriesPlot(ts, startingperiod = 9, seasonnames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], space = .25, size = [800, 400]);


I’ll also mention some updates to the Maple language – items that the readers of this forum will likely find useful.

Dates and Times – Maple 2018 adds new data structures that represent dates and times. There are numerous functions that work with dates and times, including fundamental operations such as date arithmetic and more advanced functionality for working with Calendars.

today := Date();

Year( today ), DayOfMonth( today ), Month( today );

Date arithmetic:

One_year_ago := today - 365*Unit(d);


Until - An optional until clause has been added to Maple's loop control structure.

Here's an example, the following code finds the next prime number after 37 and then terminates the loop.

n := 37;

do n := n+1 until



As always with these posts, we can't cover everything. This post is really just the beginning of the story. I would love to spend another couple of pages describing the inner-workings of every single improvement to Maple 2018 for you; however I'd rather you just try these features yourself, so go ahead, get out there and try out Maple 2018 today. You won't be disappointed that you did.


I do not know how I can solve this equation, you can help me 

I am having trouble getting Maple 2017.3 with latest Physics update to give solution to Burger's PDE for viscous fluid flow with the following initial condition. May be I am not doing something right. I tried different HINTS, but no luck.

Maple can solve the PDE without the initial conditions.

May be a Maple expert can find work around or show what I might be doing wrong.

pde := diff(u(x, t), t) + u(x, t)*diff(u(x, t), x) = mu*diff(u(x,t),x$2);
ic  := u(x,0) = PIECEWISE([0,x>=0],[1,x<0]);
sol := pdsolve({pde,ic}, u(x, t)) assuming mu>0;

Maple returns () as solution.

This PDE can be solved analytically. Here is Mathematica' solution

pde = D[u[x,t],{t}]+u[x,t]*D[u[x,t],{x}]==mu*D[u[x,t],{x,2}];
ic  = u[x,0]==Piecewise[{{1,x<0},{0,x>=1}}];
sol = DSolve[{pde,ic},u[x,t],{x,t},Assumptions->mu>0]



Is it possible to use Regex to generate a complete list of patterns?

for search pattern in a list of characters

Hi everybody,

Please take the example given in the help pages of DocumentTools[Tabulate] (the one where a cardinal sine is plotted)
Change plot(sin(x)/x) by plot(sin(x),/x, legend=sinc(x))

The legend doesn't appear if the list (named "A" in the help page) is displayed through DocumentTools:-tabulate.

Is it possible to circumvent this problem ?


i get wrong solution in maximize. i have to get a approximate 0.18 but i get 0.1

app := proc (x) options operator, arrow; 0.14546e-1*sin(3.141592654*x)+(-1)*0.50512e-2*sin(6.283185308*x)+0.19918e-2*sin(9.424777962*x) end proc;
ex := proc (x) options operator, arrow; evalf(-AiryAi(2^(2/3)*x)*(5*3^(5/6)-9*AiryBi(2^(2/3))*GAMMA(2/3))/(8*AiryAi(2^(2/3))*3^(5/6)-8*AiryBi(2^(2/3))*3^(1/3))-AiryBi(2^(2/3)*x)*(9*AiryAi(2^(2/3))*GAMMA(2/3)-5*3^(1/3))/(8*AiryAi(2^(2/3))*3^(5/6)-8*AiryBi(2^(2/3))*3^(1/3))+(1/4)*x^3+3/8) end proc;
plot([100*abs(app(x)-ex(x))], x = 0 .. 1)
Maximize(100*(abs(app(x)-ex(x))), x = 0 .. 1);

This is on Maple 2017.3 under windows

After obtaining solution from pdsolve(), I tried to see if Maple can convert it to hyperbolic trig functions by calling `convert(sol,trigh)`. 


I waited and waited and nothing happened. Then clicked on the `interrupt current operation` button at top of menu. 

But I found that mserver.exe has hanged in a loop. Taking 100% CPU and still running. So Had to terminate it from task manager.

Question is: It is ok if Maple can't do the conversion, but why does it hang? Maybe if I want for one hr it will finish, I do not know. But the important part, why does `interrupt current operation` does not work, in the sense that the mserver.exe is still running?

Is this common thing to happen? Should this be fixed? 

Here is example


f:=x-> piecewise(x>0 and x<1/2, 2*x, x>1/2 and x<1, 2-2*x);
sol:=pdsolve([pde,bc],u(x,y)) assuming x>0,y>0;

The above works OK and generates a solution. Now the next call hangs mserver.exe


In case your Maple version can't solve the above PDE. Here is the solution obtained, so you can try this below without having to solve the PDE


sol := u(x, y) = Sum(8*sin((1/2)*n*Pi)*sin(Pi*x*n)*(exp(Pi*n*(3*y-2))-
            n = 0 .. infinity);

I also tried convert(rhs(sol),trigh); but it made no difference.


This is my code.  It's not appending as I need it to.  Any help would be humbly and gratefully appreciated!



restart; Sort4 := proc (Q, T, U, Rx1, Ry1, Rx2, Ry2, Rx3, Ry3, Rx4, Ry4) local i, k; description "Organizes vectors Q,T into new vectors Rx1...Ry4 correspponding to values of U."; for i from 5 to nops(U) do if U(i) = 1 then Append(Rx1, Q(i)); Append(Ry1, T(i)) elif U(i) = 2 then Append(Rx2, Q(i)); Append(Ry2, T(i)) elif U(i) = 3 then Append(Rx3, Q(i)); Append(Ry3, T(i)) elif U(i) = 4 then Append(Rx4, Q(i)); Append(Ry4, T(i)) end if end do; return Rx1, Rx2, Rx3, Rx4, Ry1, Ry2, Ry3, Ry4 end proc

Q, T, U := `<,>`(0, 2, 4, 6, 7, 17, 27, 57, 67, 97), `<,>`(0, 2, 1, 8, 19, 20, 21, 22, 23, 24), `<,>`(o, o, o, o, 1, 2, 3, 2, 4)

Vector[column](%id = 18446744078670632710), Vector[column](%id = 18446744078670632830), Vector[column](%id = 18446744078670632950)


Rx1 := Vector([Q(1)]); Ry1 := Vector([T(1)]); Rx2 := Vector([Q(2)]); Ry2 := Vector([T(2)]); Rx3 := Vector([Q(3)]); Ry3 := Vector([T(3)]); Rx4 := Vector([Q(4)]); Ry4 := Vector([T(4)])















Vector[column](%id = 18446744078670620662)


Sort4(Q, T, U, Rx1, Ry1, Rx2, Ry2, Rx3, Ry3, Rx4, Ry4)

Vector[column](%id = 18446744078670623558), Vector[column](%id = 18446744078670625238), Vector[column](%id = 18446744078670626678), Vector[column](%id = 18446744078670619942), Vector[column](%id = 18446744078670624518), Vector[column](%id = 18446744078670625958), Vector[column](%id = 18446744078670619222), Vector[column](%id = 18446744078670620662)





How can i print maple file? when ever i press ctrl+ p it never responce any thing can we print maple file directly? if yes then please how?


how can I write a loop of two variables (i,j )for this formula?

where m& n are fixed numbers.

looking forward to hearing from you.


Strange (inconsistent) behavior of eval in piecewise




p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < 2, 1/(-2+x), x = 2, 22, 33)


eval(p, x=a);





p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi, 1/(-Pi+x), x = Pi, 22, 33)


eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero




p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi+ln(2), 1/(-Pi-ln(2)+x), x = Pi+ln(2), 22, 33)


eval(p, x=a);





p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi+1, 1/(-Pi-1+x), x = Pi+1, 22, 33)


eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero




p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < gamma, 1/(-gamma+x), x = gamma, 22, 33)


eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero



f:=x->piecewise(x<Pi, 1/(x-Pi), x=Pi, 22, 33);

f := proc (x) options operator, arrow; piecewise(x < Pi, 1/(x-Pi), x = Pi, 22, 33) end proc







how can save of resultes as matrix in file.dat?


I am trying to make a library, and therfore package that contains a bunch of objects that inherit from each other.

I understand how to create objects that inherit from one another and my code here works fine:

module ParentObject()
   option object;
end module;

module ChildObject()
   option object(ParentObject);
end module;

However when I put it all in a package with code below:

module Package()
   option package;
   export ParentObject, ChildObject;
   module ParentObject()
      option object;
   end module;

   module ChildObject()
      option object(ParentObject);
   end module;

end module;

I get the error "Error, argument of option object(ParentObject) refer to another object in module Package:-ChildObject".

Any sugguestions?

1 2 3 4 5 6 7 Last Page 1 of 1382