MaplePrimes Posts

Latest Posts Latest Posts Feed

Hello all ,

Having read a recent post about comparing Maple and Mathematica I'd like to throw my 2 cents (FWIW).

It is *silly* (not to say stupid) to compare these two softwares.

Maple can do "things" that Mathematica can't. For examples Differential Geometry, Lie Algrebra, covariant derivative and the like.

And Mathematica Manipulate command is far better than Maple Explore (just another exemple).

I have being using Maple since Release V.2 (1992) and Mathematica since Release 1.1.a (1991).

I use both of them on a daily basis and I *LOVE* them both.

Inputs are welcome :-)

Kind regards to all,




Portfolio Optimization with Google Spreadsheet and Maple

I will in this post show how to manage data and do portfolio optimization in Maple by using google spreadsheet.

You can either use a direct link to the data:

or you can set up your own google spreadsheet. If you choice to set up your own spreedsheet follow the below road map:

1) select which market you want to follow:




2) Create a new google spreadsheet and name two sheets Blad1 and Panel. In the first cell of Blad1 you put the formula:


you need to change the url to match your selection in 1).

3) In the first cell of Panel you put the name "Ticker" and then you copy all the ticker names from Blad1.

4) In the script editor you put in the below java script code:

function PanelCreation_Stock() 

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sourceSheet = ss.getSheetByName("Blad1");
var dstSheet = ss.getSheetByName("Panel");
var curDat = new Date();
var day1 = curDat.getDay();
if(day1 == 0 || day1 == 1)
var lCol = dstSheet.getLastColumn();
var srcdate = dstSheet.getRange(1, 1, 1, lCol).getValues();

for(var k=1;k<=srcdate[0].length-1;k++)
if(Utilities.formatDate(srcdate[0][k],"GMT", "dd-MMM-yy") == Utilities.formatDate(curDat,"GMT", "dd-MMM-yy"))
var snRows = sourceSheet.getLastRow();
var dnRows = dstSheet.getLastRow();

var srcStock = sourceSheet.getRange("A2:A" + snRows).getValues();
var srcLastSale = sourceSheet.getRange("C2:C" + snRows).getValues();

var dstStock = dstSheet.getRange("A2:A" + dnRows).getValues();
var dstLastSale = dstSheet.getRange("Z2:Z" + dnRows).getValues();

for(var j=0;j<dnRows-1;j++)
var flag = "true";
var foundStock;
for(var i=0;i<snRows-1;i++) //snRows
var sStockVal = srcStock[i][0];

//var foundStock = ArrayLib.indexOf(dstStock,0, sStockVal);

for(var j=0;j<dnRows-1;j++)
if(dstStock[j][0].toString().toUpperCase() == srcStock[i][0].toString().toUpperCase())
flag = "true";
foundStock = j;
dstLastSale[foundStock][0] = srcLastSale[i][0];
var dnRows1 = dstSheet.getLastRow()+1;
dstSheet.getRange("A" + dnRows1).setValue(srcStock[i][0]);
for(var k=2;k<=lCol;k++)
if(dstSheet.getRange(dnRows1, k).getValue()=="")
dstSheet.getRange(dnRows1, k).setValue("n/a");
dstSheet.getRange(2, lCol+1, dstLastSale.length, 1).setValues(dstLastSale);

5) Set it to run each day at 12:00. The code will save the new last sale price for monday to friday with one days lag.

Now we can move on to Maple.

In Maple run the following code to load the data:


X := proc (Url) local theDLL, URLDownloadToFile, myDirectory, myFile, Destination, DL;


theDLL := "C:\\WINDOWS\\SYSTEM32\\urlmon.dll";


URLDownloadToFile := define_external('URLDownloadToFileA', pCaller::(integer[4]), szURL::string, szFileName::string, dwReserved::(integer[4]), lpfnCB::(integer[4]), 'RETURN'::(integer[4]), LIB = theDLL);


if FileTools[Exists]("C:\\mydir") = true then FileTools:-RemoveDirectory("C:\\mydir", recurse = true, forceremove = true) else end if;


myDirectory := "C:\\mydir";
myFile := "data1.csv";
Destination := cat(myDirectory, "\\", myFile);


DL := proc () local M;


URLDownloadToFile(0, Url, Destination, 0, 0);
M := ImportMatrix("C:\\mydir\\data1.csv", delimiter = ",", datatype = string);
M := Matrix(M, datatype = anything)


end proc;


return DL()


end proc:


data := X("");
L := LinearAlgebra:-Transpose(data);

If you use your own spreadsheet you need to change the url to match that spreadsheet.
Select File -> Publish to the web in google spreadsheet

We can now run the portfolio optimization in Maple:



Nr, Nc := ArrayTools:-Size(L):
symb := L[1 .. 1, 2 .. Nc]:
LL := L[2 .. Nr, 2 .. Nc]:
Nr, Nc := ArrayTools:-Size(LL):


# Removing stocks with missing observations
for i to Nc do if Occurrences("n/a", convert(Column(LL, i), list)) >= 1 then AA[i] := i else AA[i] := 0 end if
end do;


DD := RemoveInRange([seq(AA[i], i = 1 .. Nc)], 0 .. 1):
symbb := DeleteColumn(symb, DD):
LLL := map(parse, DeleteColumn(LL, DD)):
Nr, Nc := ArrayTools:-Size(LLL):


# Calculate Return
for j to Nc do
for i from 2 to Nr do


r[i, j] := (LLL[i, j]-LLL[i-1, j])/LLL[i-1, j]


end do
end do;


RR := Matrix([seq([seq(r[i, j], j = 1 .. Nc)], i = 2 .. Nr)], datatype = float[8]);
n, nstock := ArrayTools:-Size(RR):


# Portfolio Optimization
W := Vector(nstock, symbol = w):
y := Vector(n, fill = 2, datatype = float[8]):
s1 := Optimization[LSSolve]([y, RR])[2];
Nr, Nc := ArrayTools:-Size(s1):


j := 0:
for i to Nr do if s1[i] <> 0 then j := j+1; ss1[j] := symbb[1, i] = s1[i] end if end do;


Vector(j, proc (i) options operator, arrow; ss1[i] end proc);




Here are some tips and tricks - ranging from keyboard shortcuts to the newest features - that will help you get the most out of MapleSim 2015.

  1. Quickly run your simulation by pressing F5. Similarly, toggle between the Main Window and Visualization Window by press F6.

  2. Maintaining an organized and clean model layout is made easier by using the Reroute Connections tool. Select the connection lines or components and press CTRL+D (or using the Edit menu, Reroute Connections) to have MapleSim automatically reroute the connections.

  3. While creating your MapleSim model, components and connections can be enabled or disabled by selecting the desired item(s) and using the disable/enable button (  ) or the keyboard shortcut CTRL+E.

  4. Use the Model Tree palette in MapleSim to help manage, navigate, and search a model quickly. Items within the model tree include: components, probes, parameters, and attachments. Simply select the desired view using the drop-down menu. The Model Tree palette is found under the Project tab.

  5. Automatically remove any unreferenced subsystems or custom components using the Prune Model tool. Especially useful for large models or models with multiple modifications, this tool will automatically identify and removes unused shared subsystems or custom components that appear within the Definitions tab, Components palette. The Prune Model function can be performed by clicking the Edit menu, and selecting Prune Model.

  6. Set the MapleSim’s Visualization Window to always on top by toggling the anchor button (  ) in the upper left corner of the Visualization Window.

  7. Automatically scale the model diagram to fit in the viewable area by pressing CTRL+T to gain a complete look at the model. Then return to a default zoom by pressing CTRL+0 (zero). This is also accessible using the View menu.

  8. To group components into a subsystem, select the desired components, right-click and select Create Subsystem or press CTRL+G.

  9. For quick access to get help on a particular component, right-click on it and select help. Similarly, selecting a component within the workspace and pressing F2 will bring up the help page for that component.

  10. View the Modelica code behind the visible system/subsystem/component, click Code View (  ) in the Navigation Tool bar. Then, to switch back to Diagram Mode click the icon (  ) in the Navigation Tool bar.

  11. Automatically compare two models by using the compare tool, found under the Tools menu Compare Models.

  12. Attach important files to a MapleSim model to keep content in one place. Attachments can be Maple worksheets or others such as pdfs, Excel, Word, STL files, etc. These files are found under the Project Tab, Attachments palette. Attach a file by, right-clicking the category and selecting Attach File or clicking the Edit menu Attach File.

I hope you find these useful! Do you have any tips that you would add to this list?

The PDE & BC project , a very nice and challenging one, also one where Maple is pioneer in all computer algebra systems, has restarted, including now also the collaboration of Katherina von Bülow.

Recapping, the PDE & BC project started 5 years ago implementing some of the basic methods found in textbooks to match arbitrary functions and constants to given PDE boundary conditions of different kinds. At this point we aim to fill gaps, and the first one we tackled is the case of 1st order PDE that can be solved without boundary conditions in terms of an arbitrary function, and where a single boundary condition (BC) is given for the PDE unknown function, and this BC does not depend on the independent variables of the problem. It looks simple ... It can be rather tricky though. The method we implemented is a simple however ingenious use of differential invariants  to match the boundary condition.

The resulting new code, the portion already tested, is available for download in the Maplesoft R&D webpage for Differential Equations and Mathematical Functions (the development itself is bundled within the library that contains the new developments for the Physics package, in turn within the zip linked in the webpage).

The examples that can now be handled, although restricted in generality to "only one 1st order linear or nonlinear PDE and only one boundary condition for the unknown function itself", illustrate well how powerful it can be to use more advanced methods to tackle these tricky situations where we need to match an arbitrary function to a boundary condition.

To illustrate the idea, consider first a linear example, among the simplest one could imagine:

PDEtools:-declare(f(x, y, z))

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


pde := diff(f(x, y, z), x)+diff(f(x, y, z), y)+diff(f(x, y, z), z) = f(x, y, z)

diff(f(x, y, z), x)+diff(f(x, y, z), y)+diff(f(x, y, z), z) = f(x, y, z)


Input now a boundary condition (bc) for the unknownf(x, y, z) such that this bc does not depend on the independent variables {x, y, z}; this bc can however depend on arbitrary symbolic parameters, for instance

bc := f(alpha+beta, alpha-beta, 1) = alpha*beta

f(alpha+beta, alpha-beta, 1) = alpha*beta


With the recent development, this kind of problem can now be solved in one go:

sol := pdsolve([pde, bc])

f(x, y, z) = (1/4)*(x-2*z+2+y)*(x-y)*exp(z-1)


Nice! And how do you verify this result for correctness? With pdetest , which actually also tests the solution against the boundary conditions:

pdetest(sol, [pde, bc])

[0, 0]


And what has been done to obtain the solution (4)? First the PDE was solved regardless of the boundary condition, so in general, obtaining:


f(x, y, z) = _F1(-x+y, -x+z)*exp(x)


In a second step, the arbitrary function _F1(-x+y, -x+z) got determined such that the boundary condition f(alpha+beta, alpha-beta, 1) = alpha*beta is matched. Concretely, the mapping _F1 is what got determined. You can see this mapping reversing the solving process in two steps. Start taking the difference between the general solution (6) and the solution (4) that matches the boundary condition

(f(x, y, z) = _F1(-x+y, -x+z)*exp(x))-(f(x, y, z) = (1/4)*(x-2*z+2+y)*(x-y)*exp(z-1))

0 = _F1(-x+y, -x+z)*exp(x)-(1/4)*(x-2*z+2+y)*(x-y)*exp(z-1)


and isolate here _F1(-x+y, -x+z)

PDEtools:-Solve(0 = _F1(-x+y, -x+z)*exp(x)-(1/4)*(x-2*z+2+y)*(x-y)*exp(z-1), _F1(-x+y, -x+z))

_F1(-x+y, -x+z) = (1/4)*exp(-x+z-1)*(x^2-2*x*z-y^2+2*y*z+2*x-2*y)


So this is the value _F1(-x+y, -x+z) that got determined. To see now the actual solving mapping _F1, that takes for arguments -x+y and -x+z and returns the right-hand side of (8), one can perform a change of variables introducing the two parameters `&tau;__1` and `&tau;__2` of the _F1 mapping:

{tau__1 = -x+y, tau__2 = -x+z, tau__3 = z}

{tau__1 = -x+y, tau__2 = -x+z, tau__3 = z}


solve({tau__1 = -x+y, tau__2 = -x+z, tau__3 = z}, {x, y, z})

{x = -tau__2+tau__3, y = -tau__2+tau__1+tau__3, z = tau__3}


PDEtools:-dchange({x = -tau__2+tau__3, y = -tau__2+tau__1+tau__3, z = tau__3}, _F1(-x+y, -x+z) = (1/4)*exp(-x+z-1)*(x^2-2*x*z-y^2+2*y*z+2*x-2*y), proc (u) options operator, arrow; simplify(u, size) end proc)

_F1(tau__1, tau__2) = -(1/4)*exp(tau__2-1)*tau__1*(tau__1-2*tau__2+2)


So the solving mapping _F1 is

_F1 = unapply(rhs(_F1(tau__1, tau__2) = -(1/4)*exp(tau__2-1)*tau__1*(tau__1-2*tau__2+2)), tau__1, tau__2)

_F1 = (proc (tau__1, tau__2) options operator, arrow; -(1/4)*exp(tau__2-1)*tau__1*(tau__1-2*tau__2+2) end proc)


Wow! Although this pde & bc problem really look very simple, this solution (12) is highly non-obvious, as is the way to get it just from the boundary condition f(alpha+beta, alpha-beta, 1) = alpha*beta and the solution (6) too. Let's first verify that this mapping is correct (even when we know, by construction, that it is correct). For that, apply (12) to the arguments of the arbitrary function and we should obtain (8)

(_F1 = (proc (tau__1, tau__2) options operator, arrow; -(1/4)*exp(tau__2-1)*tau__1*(tau__1-2*tau__2+2) end proc))(-x+y, -x+z)

_F1(-x+y, -x+z) = -(1/4)*exp(-x+z-1)*(-x+y)*(x-2*z+2+y)


Indeed this is equal to (8)

normal((_F1(-x+y, -x+z) = -(1/4)*exp(-x+z-1)*(-x+y)*(x-2*z+2+y))-(_F1(-x+y, -x+z) = (1/4)*exp(-x+z-1)*(x^2-2*x*z-y^2+2*y*z+2*x-2*y)))

0 = 0


Skipping the technical details, the key observation to compute a solving mapping is that, given a 1st order PDE where the unknown depends on k independent variables, if the boundary condition depends on k-1 arbitrary symbolic parameters alpha, beta, one can always seek a "relationship between these k-1parameters and the k-1differential invariants that enter as arguments in the arbitrary function _F1 of the solution", and get the form of the mapping _F1 from this relationship and the bc. The method works in general. Change for instance the bc (3) making its right-hand side be a sum instead of a product

bc := f(alpha+beta, alpha-beta, 1) = alpha+beta

f(alpha+beta, alpha-beta, 1) = alpha+beta


sol := pdsolve([pde, bc])

f(x, y, z) = (x-z+1)*exp(z-1)


pdetest(sol, [pde, bc])

[0, 0]


An interesting case happens when the boundary condition depends on less than k-1 parameters, for instance:

bc__1 := subs(beta = alpha, bc)

f(2*alpha, 0, 1) = 2*alpha


sol__1 := pdsolve([pde, bc__1])

f(x, y, z) = ((x-z+1)*_C1+x-y)*exp(((z-1)*_C1+y)/(1+_C1))/(1+_C1)


As we see in this result, the additional difficulty represented by having few parameters got tackled by introducing an arbitrary constant _C1 (this is likely to evolve into something more general...)

pdetest(sol__1, [pde, bc__1])

[0, 0]


Finally, consider a nonlinear example

PDEtools:-declare(u(x, y))

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


pde := 3*(u(x, y)-y)^2*(diff(u(x, y), x))-(diff(u(x, y), y)) = 0

3*(u(x, y)-y)^2*(diff(u(x, y), x))-(diff(u(x, y), y)) = 0


Here we have 2 independent variables, so for illustration purposes use a boundary condition that depends on only one arbitrary parameter

bc := u(0, alpha) = alpha

u(0, alpha) = alpha


All looks OK, but we still have another problem: check the arbitrary function _F1 entering the general solution of pde when tackled without any boundary condition:


u(x, y) = RootOf(-y^3+3*y^2*_Z-3*y*_Z^2+_Z^3-_F1(_Z)-x)


Remove this RootOf to see the underlying algebraic expression

DEtools[remove_RootOf](u(x, y) = RootOf(-y^3+3*y^2*_Z-3*y*_Z^2+_Z^3-_F1(_Z)-x))

-y^3+3*y^2*u(x, y)-3*y*u(x, y)^2+u(x, y)^3-_F1(u(x, y))-x = 0


So this is a pde where the general solution is implicit, actually depending on an arbitrary function of the unknown u(x, y) The code handles this problem in the same way, just that in cases like this there may be more than one solution. For this very particular bc (23) there are actually three solutions:

pdsolve([pde, bc])

u(x, y) = x^(1/3)+y, u(x, y) = -(1/2)*x^(1/3)-((1/2)*I)*3^(1/2)*x^(1/3)+y, u(x, y) = -(1/2)*x^(1/3)+((1/2)*I)*3^(1/2)*x^(1/3)+y


Verify these three solutions against the pde and the boundary condition

map(pdetest, [u(x, y) = x^(1/3)+y, u(x, y) = -(1/2)*x^(1/3)-((1/2)*I)*3^(1/2)*x^(1/3)+y, u(x, y) = -(1/2)*x^(1/3)+((1/2)*I)*3^(1/2)*x^(1/3)+y], [pde, bc])

[[0, 0], [0, 0], [0, 0]]




Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

The first instalment in the Hollywood Math webinar series will be returning live this September 17th! It will be presented by Daniel Skoog, our Maple Product Manager.

Over its storied and intriguing history, Hollywood has entertained us with many mathematical moments in film. John Nash in “A Beautiful Mind,” the brilliant janitor in “Good Will Hunting,” the number theory genius in “Pi,” and even Abbott and Costello are just a few of the Hollywood “mathematicians” that come to mind.

During this webinar we will present a number of examples of mathematics in film, including those done capably, as well as questionable and downright “creative” treatments. See relevant, exciting examples that you can use to engage your students, or attend this webinar simply for its entertainment value. Have you ever wondered if the bus could really have jumped the gap in “Speed?” We’ve got the answer! Anyone with an interest in mathematics, especially high school and early college math educators, will be both entertained and informed by attending this webinar.

To join us for the live presentation, click here to register.

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

Before I begin, a quick note that the content below was primarily created by one of our summer interns, Pia, with guidance and advice from me.

The Question: why is 2*cos(x)^2-1 simpler than 1-2*sin(x)^2

The author, nm, asked why 2*cos(x)^2-1  was simpler than 1-2*sin(x)^2 according to Maple. nm wrote:

I looked at help trying to understand why Maple thinks 2*cos(x)^2-1 is simpler than 1-2*sin(x)^2 but did not see it. I was expecting to see cos(2*x) as a result.

Preben Alsholm answered nm’s question by recommending the use of the combine command to obtain the result he was expecting to see, as well as a further explanation on how the simplify command works. Alsholm wrote:

Use combine to obtain what you want:

simplify has a general preference for cos over sin. That doesn't mean however, that it turns sin into cos at all costs:

##Try also

simplify doesn't necessarily get you the simplest result in the common sense of the word 'simplify'. Try as another example


As always, Alsholm provided an accurate, thoughtful response. But for those just learning Maple, I thought some additional explanation could be helpful.

Let’s talk more about the simplify command and combine function

The simplify command applies simplification rules to an expression. Its parameters can be any expression.

The combine function applies transformations which combine terms in sums, products, and powers into a single term. For many functions, the transformations applied by combine are the inverse of the transformations that are applied by expand. For example, consider the well-known identity:

sin(a + b) = sin(a) cos(b) + cos(a) sin(b)

The combine function applies the identity from right to left, whereas the expand function does the reverse.


I hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please feel free to contact me.


In connection with recent developments for symbolic sequences, a number of improvements were implemented regarding symbolic differentiation, that is the computation of n^th order derivatives were n is a symbol, the simplest example being the n^th derivative of the exponential, which of course is the exponential itself. This post is about these developments, done in collaboration with Katherina von Bülow, and available for download as usual from the Maplesoft R&D web page for Differential Equations and Mathematical functions (the update itself is bundled with the official updates of the Maple Physics package).


It is important to note that Maple is pioneer in having an actual implementation of symbolic differentiation, something that works for real, since several releases.  The development, however, was somewhat stuck because we were unable to compute the symbolic n^th derivative of a composite function f(g(z)). A formula for this problem is actually known, it is the Faà di Bruno formula, but, in order to implement it, first we were missing the incomplete Bell functions , that got implemented in Maple 15, nice, but then we were still missing differentiating symbolic sequences, and functions whose arguments are symbolic sequences (i.e. the number of arguments of the function is n, a symbol, of unknown value at the time of differentiating). All this got implemented now within the new MathematicalFunctions:-Sequence package, opening the door widely to these improvements in n^th differentiation.


The symbolic differentiation code works as mostly all other computer algebra code, by mapping complicated problems into a composition of simpler problems all of which are tractable; what follows is then an illustration of these basic cases.


Among the simplest new case that can now be handled there is that of a power where the exponent is linear in the differentiation variable. This is actually an easy problem

(%diff = diff)(f^(alpha*z+beta), `$`(z, n))

%diff(f^(alpha*z+beta), `$`(z, n)) = alpha^n*f^(alpha*z+beta)*ln(f)^n


More complicated, consider the k^th power of a generic function; the corresponding symbolic derivative can be mapped into a sum of symbolic derivatives of powers of g(z) with lower degree

(%diff = diff)(g(z)^k, `$`(z, n))

%diff(g(z)^k, `$`(z, n)) = k*binomial(n-k, n)*(Sum((-1)^_k1*binomial(n, _k1)*g(z)^(k-_k1)*(Diff(g(z)^_k1, [`$`(z, n)]))/(k-_k1), _k1 = 0 .. n))


In some cases where g(z) is a known function, the computation can be carried on furthermore. For example, for g = ln the result can be expressed using Stirling numbers of the first kind

(%diff = diff)(ln(alpha*z+beta)^k, `$`(z, n))

%diff(ln(alpha*z+beta)^k, `$`(z, n)) = alpha^n*(Sum(pochhammer(k-_k1+1, _k1)*Stirling1(n, _k1)*ln(alpha*z+beta)^(k-_k1), _k1 = 0 .. n))/(alpha*z+beta)^n


The case of sin and cos are relatively simpler, but then assumptions on the exponent are required in order to proceed further ahead from (2), for example

`assuming`([(%diff = diff)(sin(alpha*z+beta)^k, `$`(z, n))], [k::posint])

%diff(sin(alpha*z+beta)^k, `$`(z, n)) = (-1)^k*piecewise(n = 0, (-sin(alpha*z+beta))^k, alpha^n*I^n*(Sum(binomial(k, _k1)*(2*_k1-k)^n*exp(I*(2*_k1-k)*(alpha*z+beta+(1/2)*Pi)), _k1 = 0 .. k))/2^k)


The case of functions of arbitrary number of variables (typical situation where symbolic sequences are required) is now handled properly. This is the pFq hypergeometric function of symbolic order p and q 

(%diff = diff)(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[j], j = 1 .. q)], z), `$`(z, n))

%diff(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[j], j = 1 .. q)], z), `$`(z, n)) = (product(pochhammer(a[i], n), i = 1 .. p))*hypergeom([`$`(a[i]+n, i = 1 .. p)], [`$`(b[j]+n, j = 1 .. q)], z)/(product(pochhammer(b[j], n), j = 1 .. q))


The case of the MeijerG function is more complicated, but in practice, for the computer, once it knows how to handle symbolic sequences, the more involved problem becomes computable

(%diff = diff)(MeijerG([[`$`(a[i], i = 1 .. n)], [`$`(b[i], i = n+1 .. p)]], [[`$`(b[i], i = 1 .. m)], [`$`(b[i], i = m+1 .. q)]], z), `$`(z, k))

%diff(MeijerG([[`$`(a[i], i = 1 .. n)], [`$`(b[i], i = n+1 .. p)]], [[`$`(b[i], i = 1 .. m)], [`$`(b[i], i = m+1 .. q)]], z), `$`(z, k)) = MeijerG([[-k, `$`(a[i]-k, i = 1 .. n)], [`$`(b[i]-k, i = n+1 .. p)]], [[`$`(b[i]-k, i = 1 .. m)], [0, `$`(b[i]-k, i = m+1 .. q)]], z)


Not only the mathematics of this result is correct: the object returned is actually computable to the end (if you provide the values of n, p, m and q), and the typesetting is actually fully readable, as in textbooks, including copy and paste working properly; all this is new.

The n^th derivative of a number of mathematical functions that were not implemented before, are now also implemented, covering the gaps, for example:

(%diff = diff)(BellB(a, z), `$`(z, n))

%diff(BellB(a, z), `$`(z, n)) = Sum(Stirling2(a, _k1)*pochhammer(_k1-n+1, n)*z^(_k1-n), _k1 = 0 .. a)


(%diff = diff)(bernoulli(z), `$`(z, n))

%diff(bernoulli(z), `$`(z, n)) = pochhammer(nu-n+1, n)*bernoulli(nu-n, z)


(%diff = diff)(binomial(z, m), `$`(z, n))

%diff(binomial(z, m), `$`(z, n)) = (Sum((-1)^(_k1+m)*Stirling1(m, _k1)*pochhammer(_k1-n+1, n)*(z-m+1)^(_k1-n), _k1 = 1 .. m))/factorial(m)


(%diff = diff)(euler(a, z), `$`(z, n))

%diff(euler(a, z), `$`(z, n)) = pochhammer(a-n+1, n)*euler(a-n, z)


In the same way the fundamental formulas for the n^th derivative of all the 12 elliptic Jacobi functions  as well as the four elliptic JacobiTheta functions,  the LambertW , LegendreP  and some others are now all implemented.

Finally there is the "holy grail" of this problem: the n^th derivative of a composite function f(g(z)) - this always-unreachable implementation of Faa di Bruno formula. We now have it :)

(%diff = diff)(f(g(z)), `$`(z, n))

%diff(f(g(z)), `$`(z, n)) = Sum(((D@@k)(f))(g(z))*IncompleteBellB(n, k, `$`(diff(g(z), [`$`(z, j)]), j = 1 .. n-k+1)), k = 0 .. n)


Note the symbolic sequence of symbolic order derivatives of lower degree, both of of f and g, also within the arguments of the IncompleteBellB function. This is a very abstract formula ... And does this really work? Of course it does :). Consider, for instance, a case where the n^th derivatives of f(z) and g(z) can both be computed by the system:




This is the n^th derivative expressed using Faa di Bruno's formula, in turn expressed using symbolic sequences within the IncompleteBellB  function

(%diff = diff)(sin(cos(alpha*z+beta)), `$`(z, n))

%diff(sin(cos(alpha*z+beta)), `$`(z, n)) = Sum(sin(cos(alpha*z+beta)+(1/2)*k*Pi)*IncompleteBellB(n, k, `$`(cos(alpha*z+beta+(1/2)*j*Pi)*alpha^j, j = 1 .. n-k+1)), k = 0 .. n)


These results can all be verified. Take for instance n = 3

eval(%diff(sin(cos(alpha*z+beta)), `$`(z, n)) = Sum(sin(cos(alpha*z+beta)+(1/2)*k*Pi)*IncompleteBellB(n, k, `$`(cos(alpha*z+beta+(1/2)*j*Pi)*alpha^j, j = 1 .. n-k+1)), k = 0 .. n), n = 3)

%diff(sin(cos(alpha*z+beta)), z, z, z) = Sum(sin(cos(alpha*z+beta)+(1/2)*k*Pi)*IncompleteBellB(3, k, `$`(cos(alpha*z+beta+(1/2)*j*Pi)*alpha^j, j = 1 .. 4-k)), k = 0 .. 3)


Compute now the inert functions: on the left-hand side this is just the (now explicit) 3rd order derivative, while on the right-hand side we have a sum of IncompleteBellB  functions, where the number of arguments, expressed in (13) using symbolic sequences that depend on the summation index k and the differentiation order n, now in (14) depend only on k, and get transformed into explicit sequences of arguments when the summation is performed and k assumes integer values

value(%diff(sin(cos(alpha*z+beta)), z, z, z) = Sum(sin(cos(alpha*z+beta)+(1/2)*k*Pi)*IncompleteBellB(3, k, `$`(cos(alpha*z+beta+(1/2)*j*Pi)*alpha^j, j = 1 .. 4-k)), k = 0 .. 3))

alpha^3*sin(alpha*z+beta)*cos(cos(alpha*z+beta))-3*alpha^3*cos(alpha*z+beta)*sin(alpha*z+beta)*sin(cos(alpha*z+beta))+alpha^3*sin(alpha*z+beta)^3*cos(cos(alpha*z+beta)) = alpha^3*sin(alpha*z+beta)*cos(cos(alpha*z+beta))-3*alpha^3*cos(alpha*z+beta)*sin(alpha*z+beta)*sin(cos(alpha*z+beta))+alpha^3*sin(alpha*z+beta)^3*cos(cos(alpha*z+beta))


Take left-hand side minus right-hand side

simplify((lhs-rhs)(alpha^3*sin(alpha*z+beta)*cos(cos(alpha*z+beta))-3*alpha^3*cos(alpha*z+beta)*sin(alpha*z+beta)*sin(cos(alpha*z+beta))+alpha^3*sin(alpha*z+beta)^3*cos(cos(alpha*z+beta)) = alpha^3*sin(alpha*z+beta)*cos(cos(alpha*z+beta))-3*alpha^3*cos(alpha*z+beta)*sin(alpha*z+beta)*sin(cos(alpha*z+beta))+alpha^3*sin(alpha*z+beta)^3*cos(cos(alpha*z+beta))))






Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

My desk was covered with papers, a glass of water, and a big shipping container. Even though my chair was there, I was sitting on the floor with my laptop, having a bad hair day, and a robot was seated next to me.  This was a typical day at Maplesoft for an engineering co-op student.

For this project, at the request of my manager, I left my duties as Spanish translator and marketing assistant and I started to work with the robot NAO from Aldebaran Robotics. The purpose of this project was to program NAO using Aldebaran’s Choreographe software to make new movements and dances that I would later use to create new MapleSim models for Maplesoft’s Model Gallery. Maplesoft’s marketing team would then use these models in some of their promotional activities.

Given that NAO was going to travel to Taiwan in a short period of time, I wanted to focus on doing one elaborate dance and a couple of simple movements.Thanks to F.U.N. lab from the University of Notre Dame, I was able to focus on the detailed dance because they had an amazing Choreographe database of behaviour/movement code.   

I started this project with zero knowledge about Choreographe, but with a good understanding of NAO´s MapleSim model that the Maplesoft engineers had previously created. After a few weeks with NAO and some YouTube tutorials, I discovered that programming NAO was really easy. I would move NAO’s joints to the positions I wanted to, and then I would tap its head to record and save them. I did this for a couple of weeks making sure that the sequence of movements wouldn’t make NAO fall or break a finger. At this point I was already a NAO expert.

After finishing up all the movements and dances it was time to move on to the next phase of the project: obtaining the data for the MapleSim model. The MapleSim model was created using the Denavit-Hartenberg (DH) convention; therefore, I needed the values of the degrees of rotation of each joint while the robot performed a dance. These numbers were easily obtained using the “record” button in Choreographe and exporting them into a CSV file. This file was later attached to the MapleSim model, so it could be used in a time look up table. The input of NAO´s joints were then specified by using the values within this table.

I started by recording the simplest movements: NAO blowing kisses and doing the sprinkler. These were the best ones to start working on because in these examples, the robot only needs to move its upper body, meaning that the lower body didn’t need any flexibility. This gave me and Abtin Athari, Application Engineer at Maplesoft, the freedom to simplify the original model by removing unnecessary degrees of freedom on the lower body. Abtin and I also realized that at the beginning of some of the new movements the robot would have too much torque, so we extended some of the recorded position of the rotational joints so the robot could stay in the same position for a longer time. These modifications ensured that the model wouldn´t have any problems during any of the simulations.

To finish the project, I worked with the Marketing team to create some videos where we could display the real robot next to the MapleSim model doing the same movements. The purpose of these videos was to showcase the essence of the high-fidelity models that MapleSim allowed us to create. It was amazing to see how the MapleSim model corresponded so closely to the physical robot.

After three weeks of intense work and meetings, my days as a robot whisperer ended. I learned new things about robots, how to build models with MapleSim, and the processes behind developing videos. It was a project that allowed me to wear both an engineer’s and a marketer’s shoes.  I was able to put into practice my technical knowledge and problem solving skills; and at the same time I was able to enhance my creative and analytical skills by evaluating the quality and impact of my work.

Philip Yasskin, a long-time Maple user and professor at Texas A&M University is passionate about getting young people engaged in mathematics. One of his programs is SEE-Math: a two-week summer day camp for gifted middle school children interested in math. Maplesoft has been a long-standing supporter of SEE-Math, providing software and prizes for the campers.

A major project in SEE-Math is developing computer animations using Maple. Students spend their time creating various animations, in hopes of taking the top prize at the end of the workshop. A slew of animations are submitted, some with pop-culture references, elaborate plot lines, and incredible detail. The top animations take home prizes, while all animations from that year are featured on the SEE-Math website.

Maplesoft proudly sponsors this event, and many like it, to promote interest in STEM education. To see all of the animations from this year’s SEE-Math camp, please visit: You can find the animations listed under “Euler,” “Godel,” “Noether,” and “Ramanujan,” found halfway down the page.

On this week I asked Maplesoft Customer Service for help. Here is our correspondence
(Only the purchase code and e-mail addresses are censored. PS. Also the last name of Kari was deleted by Bryon Thur on 28.08.2015.).
I think this is of interest for many Maple users. I have got some experience contacting
with Kaspersky Antivirus (They helped me by the use of indices of my comp.) and ABBYYLingvo
(They helped to install an ABBYYLingvo vocabulary on my phone.) so I can compare and
make conclusions.

Sent: August-15-15 4:44 AM
To: Maplesoft Customer Service
Subject: Customer Service Request: (Web) Installation questions

After upgrading my Windows 7 HB 32-bit to Windows 10 I cannot uninstall my Maple 16 PE.
 It cannot be uninstalled by neither Start/Parameters/System/Applications nor
Uninstall in C/ProgramFiles/Maple 16.
The Uninstall option is not seen in Maple 16 as application.
Also the overinstallation of Maple 16 does not work.
Waiting for your feedback.
Markiyan Hirnyk

Dear Markiyan Hirnyk,

Thank you for contacting Maplesoft.

Maple 16 is not officially supported on Windows 10 but I have added an activation to your
existing Maple 16 Personal Edition purchase code: XXXXXXXXXXXXXXXX to see if reactivating
your license fixes the issue.  If reactivating doesn't give you access to Maple 16, please
send me the exact wording of any error messages that you receive so that I can send
 the information to our Technical Support Team so that they can investigate further.

Kind regards,

Customer Service
Hello Kari,
Unfortunately, neither the  reactivation of my Maple 16 PE by XXXXXXXXXX nor its uninstallation
do not succeed for me. See the error communications in the attached screens (both in one file) screens_1_2.docx.
It should be noticed that Maple V Release 4 works on Windows 10 of my comp without any problems.
Markiyan Hirnyk

Hi Markiyan Hirnyk,

Thanks for your response.
I am forwarding your information to our Technical Support Team.
A representative will contact you soon.
Kind regards, Kari
Maplesoft Customer Service
Hello Markiyan,

This error is usually caused by a Windows permissions setting. To fix this, please do the following:

1. Ensure that all Maple programs are completely closed.
2. Click on your Start Menu and go to the 'Programs' > 'Maple 16' > 'Tools' folder.
3. Right click the 'Activate Maple' icon and choose 'Run as administrator'.
4. Activate Maple using your purchase code and this should fix your issue.

Please let me know if you continue to experience any troubles.


Technical Support Analyst
Hello Chris,
Following your directions, I have just reactivated Maple 16, but my problem is not solved.
To shed light on the situation, my Maple 16.02 works properly,
but I cannot uninstall it after upgrading to Windows 10 Home 32bit.
See the screens in the attached file screen.docx .
Markiyan Hirnyk
Hello Markiyan,
If you are seeing error messages about Maple still being open,
 I would suggest you try to restart your PC and then attempt the uninstall again to ensure
that you do not have any lingering Maple programs running. Please let me know
if you still see this message after restarting.


Technical Support Analyst
Hello Chris,
This does not help too. My guess is execution failure when Maple 16 was installing.
Because of that reason the Maple 16 installer did not create Maple uninstaller in my Maple 16.
 See the attached screen of the uninstall folder in C:/ Program Files/ screen_3.docx.
Markiyan Hirnyk
If you think that you have a corrupted installation, I recommend that you reinstall Maple
using the new Maple 16.02 installer link provided below.
 This version of the installer was created to get around the Windows 8 installation issues and
 may be of help to you in Windows 10 as well, though again please be aware that
 we do not officially support Windows 10 yet.
Here are the steps to reinstall Maple:
1. Click on the Start Menu > Control Panel > Programs and Features ( or Add/Remove Programs).
 Find ‘Maple 16’ in the list and uninstall it. If this is not possible, move on to the next step and continue.
2. Restart your computer.
3. Click on the Start Menu > Computer > Local Disk C: > Program Files.
If there is a folder here called ‘Maple 16’, please delete it.
4. Download the installer for Maple 16 from the following link:
5. Make sure to download the correct version for your operating system, i.e. Windows version and 32 or 64-bit.
6. Install Maple by right clicking the installation file and choosing ‘Run as administrator’.
I hope that this helps to resolve the issues that you’re having and if it does not,
contact us and we can further investigate for you.

Technical Support Analyst
 Hi Chris,
My problem with Maple 16 is solved. I completely uninstalled it by Uninstall Tool 3.4, not using brute force. After that I installed Maple 16 by the distributive suggested by you. That's all right.
Markiyan Hirnyk
Alright, that is good to hear. Please let us know if you run into any further issues with your installation.
Technical Support Analyst

In addition to providing access to powerful tools for mathematical computation, Maple has been designed to help you work quickly and efficiently. Here are 10 useful short-cuts when working with Maple:

1. Use F5 to switch between Text and 2D Math input modes in Maple.

2. Use F2 (Control+? for Macintosh) to quickly bring up Maple Help information for anything that you have typed in your document.

3.  Automatic Command Completion can be used when you don't want to type in the full name of a Maple command. To use, begin typing the first few letters of the command name, and press CTRL+Space (Esc or Command+Shift+Space for Macintosh, CTRL+Shift+Space for Linux).  A list of possible completions will display; click the one you want.


4. The Shift+Enter key combination lets you continue entering math or commands on a new line without executing that line. 

5. If you want more than a single command to be executed at once, you must separate them with a semi-colon or colon.

6. When you click inside a set of commands in Math mode, the dash line indicates the boundaries of the input region; all commands in this region will execute together in sequence.

7. To increase the size of a piecewise function, add a new row.  Place the cursor on the last row, and press CTRL+Shift+R (Command+Shift+R for Macintosh). These shortcut keys also work to add rows to matrices.

8. An easy way to insert a Greek letter is to first press CTRL+Shift+G (Command+Shift+G for the Macintosh). The next letter typed will appear in Greek.

9. Sometimes you may want to insert symbols above or below another character, for example, to enter a vector arrow. To insert a symbol above (called "overscript"), press CTRL+Shift+["] (Command+Shift+["] for Macintosh) and then type in your symbol (or insert it from a palette).

For example, typing "x" then holding down CTRL+Shift and pressing ["] allows you to insert a symbol above the x, such as 

10. Compute or recompute the entire Maple worksheet when you have changed expressions that affect subsequent Maple commands.  Press Ctrl + Shift + Enter (Command + Shift + Enter in Macintosh) or click the execute worksheet icon. 

Are there any short-cuts that you would add to this list?

In this work the theme of vector analysis shown from a computational point of view; this being a very important role in the engineering component; in civil and mechanical special it is why, using the scientific software Maple develops interactive solutions for long processes through MapleCloud calculations. At present the majority of professors / researchers perform static classes open source leaves; so that our students learn and memorize commands, thus generating more time learning in the area. Loading Bookseller VectorCalculus develop topics: vector algebra, differential operators, conservative fields, etc. Maplesoft making processes provide immediate calculations long operation Embedded Components displayed in line with MapleNet integrations. Today our future engineers to design solutions and will be launched in the cloud thus being a process with global qualification in the specialty. Significantly Maple is a scientific software which allows the researcher to design their own innovations and not use themes for their manufacturers.







knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. This problem mentioned in  page of tasks still without  Maple implementation. 

The post presents the implementation of this task in Maple. Required parameter of the procedure (named  KnightTour)  is  address  - the address of the initial square in the algebraic notation. The second parameter  opt  is optional parameter:

1) if  opt is sequence  (by default) then  the procedure returns the sequence of moves of the knight in the usual algebraic notation,

2)  if  opt is diagram   then  the procedure returns the plot of moves of the knight and  sequentially numbers all the visited squares,

3) if  opt is animation  then  the procedure returns an animation of moves of the knight.

In the procedure is used a solution with maximum symmetry by George Jelliss,


Code of the procedure:

KnightTour := proc(address::symbol, opt::symbol := sequence)

local L, n, L1, k, i, j, squares, border, chessboard, letters, digits, L2, L3, Tour, T, F;

uses ListTools, plottools, plots;

L := [a1, b3, d2, c4, a5, b7, d8, e6, d4, b5, c7, a8, b6, c8, a7, c6, b8, a6, b4, d5, e3, d1, b2, a4, c5, d7, f8, h7, f6, g8, h6, f7, h8, g6, e7, f5, h4, g2, e1, d3, e5, g4, f2, h1, g3, f1, h2, f3, g1, h3, g5, e4, d6, e8, g7, h5, f4, e2, c1, a2, c3, b1, a3, c2];

n := Search(address, L);

L1 := [L[n .. 64][], L[1 .. n-1][]];

if opt = sequence then return L1[] fi;

k := 0;

for i to 8 do

for j from `if`(type(i, odd), 1, 2) by 2 to 8 do

k := k+1;

squares[k] := polygon([[i-1/2, j-1/2], [i-1/2, j+1/2], [i+1/2, j+1/2], [i+1/2, j-1/2]], color = grey);

od;  od;

squares := convert(squares, list);

border := curve([[1/2, 1/2], [1/2, 17/2], [17/2, 17/2], [17/2, 1/2], [1/2, 1/2]], color = black, thickness = 4);

chessboard := display(squares, border);

letters := [a, b, c, d, e, f, g, h];

digits := [$ 1 .. 8];

L2 := convert~(L1, string);

L3 := subs(letters=~digits, map(t->[parse(t[1]), parse(t[2])], L2));

Tour := curve(L3, color = red, thickness = 3);

T := textplot([seq([op(L3[i]), i], i = 1 .. 64)], align = above, font = [times, bold, 16]);

if opt = diagram then return display(chessboard, Tour, T, axes = none) fi;

F := seq(display(chessboard, curve(L3[1 .. s], color = red, thickness = 3), textplot([seq([op(L3[i]), i], i = 1 .. s)], align = above, font = [times, bold, 16])), s = 1 .. 64);

display(seq(F[i]$5, i = 1 .. 64), insequence = true, axes = none);

end proc:


 Examples of use:


KnightTour(f3, diagram);



KnightTour(f3, animation);


As an educator, you surely know that giving students more involved problems in an online assessment tool provides challenges, both for students and instructors. Only marking the final answer doesn’t necessarily provide an understanding of the student’s capabilities, and it penalizes students that make a small mistake in part of their solution.

This webinar will demonstrate how to create separate questions with multiple steps that can be linked or chained together. Question chaining allows instructors to mark subsequent questions based on the correct answer or the answer provided by students in previous parts.

To join us for the live presentation, please click here to register.

Dear friends,

some time ago I shared a story here on the use of Maple to compute the cycle index of the induced action on the edges of an ordinary graph of the symmetric group permuting the vertices and the use of the Polya Enumeration Theorem to count non-isomorphic graphs by the number of edges. It can be found at the following Mapleprimes link.

I am writing today to alert you to another simple Maple program that is closely related and demonstrates Maple's capability to implement concepts from group theory and Polya enumeration. This link at shows how to use the cycle index of the induced action by the symmetric group permuting vertices on the edges of a multigraph that includes loops to count set partitions of multisets containing two instances of n distinct types of items. The sequence that corresponds to these set partitions is OEIS A020555 where it is pointed out that we can equivalently count multigraphs with n labeled i.e. distinct edges where the vertices of the graph represent the multisets of the multiset partition and are connected by an edge k if the two instances of the value k are included in the sets represented by the two vertices that constitute the edge. The problem then reduces to a simple substitution into the aforementioned cycle index of a polynomial representing the set of labels on an edge including no labels on an edge that is not included.

This computation presents a remarkable simplicity while also implementing a non-trivial application of Polya counting. It is hoped that MaplePrimes users will enjoy reading this program, possibly profit from some of the techniques employed and be motivated to use Maple in their work on combinatorics problems.

Best regards,

Marko Riedel

First 8 9 10 11 12 13 14 Last Page 10 of 240