Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Has anyone developed an Agent Skill for Maple compliant with the Agent Skills Specification?

I frequently use Claude Code to create and edit Maple Documents. It does fine alone, but I found adding a script to do a syntax check eliminated a lot of content errors. I also presume some instructions on how it should read the Maple documentation will improve its reliability. Before I go about writing my own Skill against the specification, I just want to check if there is already one in use within the community.

I am trying to follow a series of substitutions used in a paper. I have given some examples of the substitutions. But I am having difficulty getting them to work. I know if all else fails I can manually recreate an expression with the substitution variables and then check backwards using eval(f,vals).
Would appreciate any insight on substitution techniques here.
 

restart

 

sidrels := [a*c - b^2 = Delta, a + c - 2*b = d, a - b = c__bar, a - c = b__bar, c - b = a__bar];

[a*c-b^2 = Delta, a+c-2*b = d, a-b = c__bar, a-c = b__bar, c-b = a__bar]

(1)

vals:='rhs=lhs'~(sidrels)

[Delta = a*c-b^2, d = a+c-2*b, c__bar = a-b, b__bar = a-c, a__bar = c-b]

(2)

t1:=a + c - 2*b;
simplify(t1,sidrels); #this should be d

a+c-2*b

 

d

(3)

t2:=Vector[column](3, [-a + b, c - b, 0]);
simplify(t2,sidrels) ; # This should be <-c__bar,a__bar,0> or <c__bar,-a__bar,0,>r

Vector(3, {(1) = -a+b, (2) = c-b, (3) = 0})

 

Vector[column](%id = 36893490321805397396)

(4)

t3:=normal(1 - b^2/(a*c));

(a*c-b^2)/(a*c)

(5)

simplify((5),sidrels); # This should be Delta/(a*c)

Delta/(b^2+Delta)

(6)

simplify(numer((5)),sidrels,'mindeg')/(denom((5)) ); # This works

 

Delta/(a*c)

(7)

t4:=[(-b^2 + b*c)/(a*c - b^2), (a*b - b^2)/(a*c - b^2)]

[(-b^2+b*c)/(a*c-b^2), (a*b-b^2)/(a*c-b^2)]

(8)

simplify(t4,sidrels,'mindeg');# this should be [(b*a__bar)/Delta, (b*b__bar)/Delta]

[-b*(-c+b)/Delta, b*(a-b)/Delta]

(9)

t5:=simplify(Vector[column](3, [3*b*c__bar - Delta, -3*a__bar*b + Delta, b*(-c__bar + a__bar)]))

Vector(3, {(1) = 3*b*c__bar-Delta, (2) = -3*a__bar*b+Delta, (3) = b*(-c__bar+a__bar)})

(10)

t5[3]:=simplify(t5[3],sidrels)  ;#This should be b*b__bar

 

-a__bar^2+(2*b+d)*a__bar-Delta

(11)

t5

Vector(3, {(1) = 3*b*c__bar-Delta, (2) = -3*a__bar*b+Delta, (3) = -a__bar^2+(2*b+d)*a__bar-Delta})

(12)

subs(sidrels[-2],b*(-c__bar + a__bar))

b*(-c__bar+a__bar)

(13)

algsubs(sidrels[-2],b*(-c__bar + a__bar))

b*(-c__bar+a__bar)

(14)

 


 

Download 2026-07-29_Q_Simplifications_and_Substitutions.mw

I am a long-time user of Joe Riel's maplev mode in emacs. Upgraded emacs to version 30.2 and now it does not work anymore because of difficulties with something called abbrevlist. This is on MacOS. I am already on the last version of maplev.

Anyone have an idea what is going on and what to do? Somehow for me referencing a username no longer is possible (I get a blocking box with a spinner upon entering the at sign) so I can't create a notification for Joe.

TIA,

Mac Dude.

In the attached file, I'd like to solve an ODE as an exercise. Only the "series" option yielded a solution. How can the length of the result series be controlled? Is there a package that leads to a "closed" solution – even using well-known transcendental functions?

restart

ode := (1+f(x))*(diff(f(x), x, x)) = 1+x

(1+f(x))*(diff(diff(f(x), x), x)) = 1+x

(1)

ics := f(0) = 1, (D(f))(0) = 0

f(0) = 1, (D(f))(0) = 0

(2)

dsolve({ics, ode}, f(x), series)

f(x) = series(1+(1/4)*x^2+(1/12)*x^3-(1/192)*x^4-(1/240)*x^5+O(x^6),x,6)

(3)

``

Download test.mw

The Miracle of Integer Eigenvalues is a paper that shows how any partially-ordered set can be used to generate a matrix with integer eigenvalues.

R. Kenyon et al, Funct. Anal. Its Appl. 58, 182–194 (2024)  doi: 10.1134/S0016266324020072, arXiv:2401.05291v2

Here I outline the process and give two examples.

restart

PartiallyOrdered sets is after GraphTheory so its DrawGraph gets priority.

with(GraphTheory); with(LinearAlgebra); with(PartiallyOrderedSets)

Example (the first example in the paper): Poset in 3 elements with one relation {u < v, {u, v, w}}.

vars := [u, v, w]; n := nops(vars); rels := {u < v}

[u, v, w]

3

{u < v}

Some derived things we will need.

translate := `~`[`=`](vars, [`$`(1 .. n)]); arcs := map(`@`(`[]`, op), rels); A := AdjacencyMatrix(Graph(vars, arcs))

translate := [u = 1, v = 2, w = 3]

arcs := {[u, v]}

Matrix(%id = 36893490746138016812)

p := PartiallyOrderedSet(vars, A)

module PosetObject () local numElems::':-integer', height::':-integer', width::':-integer', comparator::procedure, comparatorExists::boolean, transitiveClosure::Matrix, transitiveClosureExists::boolean, transitiveReduction::Matrix, transitiveReductionExists::boolean, elementMap::table, minimalElements::set, minimalElementsExists::boolean, leastElement::':-integer', maximalElements::set, maximalElementsExists::boolean, greatestElement::':-integer', closureGraph::Graph, closureGraphExists::boolean, connectedComponents::(set(set)), connectedComponentsExists::boolean, reductionGraph::Graph, reductionGraphExists::boolean, adjList::Array, adjListExists::boolean, isLattice::boolean, isFaceLattice::boolean, grade::':-integer', isGraded::boolean, isRanked::boolean, rankFuction::procedure, rankTable::Array, rankFuctionExists::boolean; option object; end module

We can represent this as a directed graph.

DrawGraph(p, size = [200, 200])

There are three linear extensions; roughly these are linear orders/chains with all of {u, v, w} that maintain u < v. In this case there are three: u < v and v < w, u < w and w < v, w < u and u < v. In other words, we want to find all permutations of [1,2,3] in which 1 (=u) precedes 2 (=v). We can use the iterator TopologicalSort, which finds all permutations satisfying some relations.

T := Iterator:-TopologicalSorts(n, subs(translate, rels))

_m2598758943744

The three permutations that have u before v are given below both numerically and symbolically.

extnums := [seq([seq(t)], `in`(t, T))]; exts := [seq(vars[[seq(t)]], `in`(t, T))]

[[1, 2, 3], [1, 3, 2], [3, 1, 2]]

[[u, v, w], [u, w, v], [w, u, v]]

Choose two of these, P and Q, say the first two.

Pnum, Qnum := extnums[1 .. 2][]; P, Q := exts[1 .. 2][]

[1, 2, 3], [1, 3, 2]

[u, v, w], [u, w, v]

Then the kth node in Q is a (P,Q) disagreement node or descent node if the k-1th node in Q is greater than the kth node, considered as a relation in P.  For example, for k = 2 (w in Q), so k-1 = 1 (u in Q) then in P we have u < w and w is a (P,Q) agreement node. For k = 3 (v) and k-1 = 2 (w) we have w > v in P and disagreement. The first node in Q is defined to be an agreement node. So u = agree, w = agree, v = disagree. We make a list of agreements (0) and disagreements (1) from k = 2 to k = n and find [0,1].

As a procedure we have

eps := proc(P::permlist, Q::permlist)
local k, i, j, L;
for k from 2 to nops(Q) do
  member(Q[k-1], P, 'i');
  member(Q[k], P, 'j');
  if i < j then L[k] := 0 else L[k] := 1 end if;
end do;
convert(L, list);
end proc:

eps(Pnum, Qnum)

[0, 1]

So now we do this for all P,Q pairs and fill a 3x3 matrix with a variable indexed with the generated lists

M := Matrix(nops(extnums), proc (i, j) options operator, arrow; index(a, eps(extnums[i], extnums[j])[]) end proc)

:=

And we find this matrix has eigenvalues that are linear combinations of these variables, with integer coefficients

Eigenvalues(M, output = list)

[a[0, 0]-a[1, 0], a[0, 0]-a[0, 1], a[0, 0]+a[1, 0]+a[0, 1]]

And of course if these variables had integer values, the matrix would have all integer eigenvalues.

inds := indets(M); r := rand(-20 .. 20); M2 := eval(M, `~`[`=`](inds, {seq(r(), 1 .. nops(inds))})); Eigenvalues(M2, output = list)

M2 :=

[7, -7, -6]

Example 2: A poset with the Hasse diagram: (generated below)

It is convenient to enter only the arcs shown (not b<e)

vars := [a, b, c, d, e]; n := nops(vars); rels := {a < c, b < c, b < d, d < e}

[a, b, c, d, e]

5

{a < c, b < c, b < d, d < e}

Specify input = transitivereduction so the missing relation doesn't throw an error.

translate := `~`[`=`](vars, [`$`(1 .. n)]); arcs := map(`@`(`[]`, op), rels); A := AdjacencyMatrix(Graph(vars, arcs)); p := PartiallyOrderedSet(vars, A, input = transitivereduction)

translate := [a = 1, b = 2, c = 3, d = 4, e = 5]

arcs := {[a, c], [b, c], [b, d], [d, e]}

Matrix(%id = 36893490746159485164)

module PosetObject () local numElems::':-integer', height::':-integer', width::':-integer', comparator::procedure, comparatorExists::boolean, transitiveClosure::Matrix, transitiveClosureExists::boolean, transitiveReduction::Matrix, transitiveReductionExists::boolean, elementMap::table, minimalElements::set, minimalElementsExists::boolean, leastElement::':-integer', maximalElements::set, maximalElementsExists::boolean, greatestElement::':-integer', closureGraph::Graph, closureGraphExists::boolean, connectedComponents::(set(set)), connectedComponentsExists::boolean, reductionGraph::Graph, reductionGraphExists::boolean, adjList::Array, adjListExists::boolean, isLattice::boolean, isFaceLattice::boolean, grade::':-integer', isGraded::boolean, isRanked::boolean, rankFuction::procedure, rankTable::Array, rankFuctionExists::boolean; option object; end module

The graph is the transitive reduction (Hasse diagram).

DrawGraph(p, size = [200, 200])

Update the relations to include all those in the transitive closure (including b<e)

Edges(ToGraph(p, reduction = false)); rels := map(`@`(`<`, op), %)

{[a, c], [b, c], [b, d], [b, e], [d, e]}

{a < c, b < c, b < d, b < e, d < e}

Find the 9 linear extensions

T := Iterator:-TopologicalSorts(n, subs(translate, rels)); extnums := [seq([seq(t)], `in`(t, T))]; exts := [seq(vars[[seq(t)]], `in`(t, T))]

_m2598743159552

[[1, 2, 3, 4, 5], [1, 2, 4, 3, 5], [1, 2, 4, 5, 3], [2, 1, 3, 4, 5], [2, 1, 4, 3, 5], [2, 1, 4, 5, 3], [2, 4, 1, 3, 5], [2, 4, 1, 5, 3], [2, 4, 5, 1, 3]]

[[a, b, c, d, e], [a, b, d, c, e], [a, b, d, e, c], [b, a, c, d, e], [b, a, d, c, e], [b, a, d, e, c], [b, d, a, c, e], [b, d, a, e, c], [b, d, e, a, c]]

Leading to the matrix

M := Matrix(nops(extnums), proc (i, j) options operator, arrow; index(a, eps(extnums[i], extnums[j])[]) end proc)

Matrix(%id = 36893490746138048980)

The eigenvalues

Eigenvalues(M, output = list)

[a[0, 0, 0, 0]-a[0, 0, 1, 0], a[0, 0, 0, 0]-a[0, 0, 1, 0]-a[1, 0, 0, 0]+a[1, 0, 1, 0], a[0, 0, 0, 0]-a[0, 0, 1, 0]+a[1, 0, 0, 0]-a[1, 0, 1, 0], a[0, 0, 0, 0]-a[0, 0, 0, 1]-a[1, 0, 0, 0]+a[1, 0, 0, 1], a[0, 0, 0, 0]-a[0, 0, 0, 1]-a[0, 1, 0, 0]+a[0, 1, 0, 1], a[0, 0, 0, 0]+a[0, 0, 0, 1]-a[0, 1, 0, 0]-a[0, 1, 0, 1], a[0, 0, 0, 0]-a[0, 0, 0, 1]+a[0, 1, 0, 0]-a[0, 1, 0, 1]+a[1, 0, 0, 0]-a[1, 0, 0, 1], a[0, 0, 0, 0]+a[0, 0, 0, 1]+a[0, 0, 1, 0]-a[1, 0, 0, 0]-a[1, 0, 0, 1]-a[1, 0, 1, 0], a[0, 0, 0, 0]+a[0, 0, 0, 1]+2*a[0, 0, 1, 0]+a[0, 1, 0, 0]+a[0, 1, 0, 1]+a[1, 0, 0, 0]+a[1, 0, 0, 1]+a[1, 0, 1, 0]]

and with some integer entries

inds := indets(M); M2 := eval(M, `~`[`=`](inds, {seq(r(), 1 .. nops(inds))})); Eigenvalues(M2, output = list)

M2 :=

[0, -68, -32, 3, -12, 8, -8, -6, -2]

NULL

Download IntegerEigenvalues.mw

This piecewise function with units

q := r -> piecewise(0 <= r and r < 0.1*Unit('mm'), 5*Unit(('kW')/'m'^2));

returns this output

Is it possible to get the output printed without ticks and the units in roman?

In the attached file, I would like to calculate the expressions for the function f(n,x) using a recursion for a given index range, e.g., n=3..15. I would appreciate any advice on this.
 

NULL

restart;

kernelopts(version);

`Maple 2026.1, X86 64 WINDOWS, Jun 04 2026, Build ID 2018217`

(1)

f(1,x):=x;

x

(2)

f(2,x):=2*x + 2*sin(x);

2*x+2*sin(x)

(3)

f(n,x):=2*f(n-1,x)-f(n-2,x)+2*sin((n-1)*x)/(n-1);

2*f(n-1, x)-f(n-2, x)+2*sin((n-1)*x)/(n-1)

(4)

f(3,x):=eval(f(n,x),n=3);

3*x+4*sin(x)+sin(2*x)

(5)

f(4,x):=eval(f(n,x),n=4);

4*x+6*sin(x)+2*sin(2*x)+(2/3)*sin(3*x)

(6)

NULL

NULL


 

Download test24c.mw

 

Responses from the AI assistant in Maple2026 can be copied directly into a Maple Document or Worksheet, Is there a process which allows one to similarly import a external ChatGPT conversation. I have Maple MCP configured in my ChatGPT account.

So the problem I encountered is when I try to assign ranking of variables of ODE in ThomasDecomposition, the indexed variables are not allowed. For instance, for an ODE system containing a[0], a[1], a[2] as dependent variables, if I assign:
R := Ranking([x],[a[0],a[1],a[2]])
It throws an error:
This is going to be inconvenient when I have to dynamically solve ODE system within a function call, especially when the system is nonlinear and algebraically closed(no integration constants in solutions) and calling DifferentialThomas in dsolve will be slow. I want to know how to resolve this.

How to integrate this function (n::posint) :
f := (n, x) -> (1 - cos(n*x))/(1 - cos(x))

Maple is not returning a result. It seems unable to establish the connection with the Dirichlet kernel. Is there a solution that doesn't require forcing a decomposition into a sum of cosinus?

Thank you for your help.

Best regards.

In the context of numerical integration of partial differential equations I am looking for tools to create difference equations for the numerical integration of PDE's. Ideally the desired integration scheme could be given as an input.

The only command that I am aware of is the DiffEquation command from the DynamicSystems package (see ?DynamicSystems,DiffEquation) which is limited to linear time invariant systems and only provides a simple forward integration scheme.

Any insights/examples into the topic of numerical integration of pde's with Maple beyond pdsolve/numeric capabilites is very much appreciated. (I know that Maple comes with advanced numerical solvers for ODE's. MapleSim uses such solvers to integrate systems of ODE's. This seems to be, in terms of computation, close to what I am looking for.)

Today is Pi approximation day (22/7) and I will use that as an excuse to share my new favourite expression for Pi:

 

And this isn't even an approximation! Recently, continuous mathematics has found its own equivalent to the digital hardware NAND gate. In his paper “All elementary functions from a single binary operator”, Andrzej Odrzywołek demonstrated that a single functional primitive can generate the entire standard continuous spectrum of operations. In other words, every single button on a scientific calculator, from addition and subtraction to sines, cosines, and logarithms, can be built using just this one function.

This Maple Worksheet explores how the 'Exp-Minus-Log' ("EML") operator, when paired solely with the constant 1, can be systematically nested to construct basic arithmetic, constants, and complex transcendental functions within Maple.

In essence, he discovered that the binary operator EML, along with the constant 1, forms a basis for the set of standard scientific-calculator operations.

This means that functions like sin(x)cos(x) and operations like a-b or a^b can be creating by composing EML with itself in clever ways. Some constants and functions are trivial to represent, such as EML(1,1) = e or EML(x, 1) = exp(x), others however, are not...

With a quick one-command tweak, you can get Maple to use the property of the extended reals that

And then with a simple argument about standard branches, you can construct the natural logarithm for real numbers, which immediately leads the constant zero:

 

You can then expand the tools in your toolbox by creating subtraction with EML, ln(x), and exp(x)

Which then expands the toolbox further by allowing for the construction unary minus from the constant 0 (since -x = 0 - x), and then addition (since a+b=a-(-b))

Since we've constructed addition, subtraction, zero and one, we can technically construct every integer! It would not be very pleasant, and by no means optimal... but you could! Here's 7 for example:

The next step to building all the standard functions is multiplication and inversion. And these use the classic trick by using the fact that x=exp(ln(x)) can help simplify:

These are compositions of exp, addition, ln, and unary minus (all functions constructed previously), which means they can be made with only EML:

 

It's at this point that I will leave the derivation of division (a/b) and exponentiation (a^b) as exercises for the reader, so I can skip to something a little more complex...

To go beyond the basic operators, you'll need to step into the complex domain by constructing the imaginary constant i. To do this, take ln(-1) = -i*Pi (by using the standard branch) and combine it with Euler's formula

And once again the expression on the left-hand side is made up of operations that were all previously defined, so you can compose EML to get a new constant:

And finally, it's possible to break down the expression for Pi from the start, since it's the product i*ln(-1)

 

By successfully extracting the mathematical constants i and Pi, I think this demonstrates the complete constructive capability of the EML operator in the complex domain. While the resulting syntax trees become exponentially deep and unoptimized for human readability, they prove that continuous operations do not require a massive, distinct toolbox. Future applications of this uniform binary structure could dramatically simplify symbolic regression and machine learning optimization models. 
Ultimately, the EML operator reveals the remarkable truth that the vast complexity of scientific mathematics can be distilled down to a single, beautiful building block.


Isn't math awesome?

I am pretty new to pdsolve.

?pdsolve/numeric states

PDEsys - single or set or list of time-dependent partial differential equations in two independent variables

This could be interpreted in a way that problems with 3 independent variables can be handled (time + two others).

The rest of the helppage only describes two independent variables and does not mention time.

In case the above interpretation is wrong, I have two questions:

  • If only two independent variables can be treated, why is time-depencency mentioned at all?
  • Is it possible to integrate the PDE of an axially heated rod of finite length and radius with the help of pdsolve where on one end of the rod a heat flux q=q(r) is applied?

Any links to similar problems solved with Maple (not necessary with pdsolve) are very much appreciated.

Edit: Updated BCs

PDE := diff(T(r, z, t), t) = alpha*(diff(T(r, z, t), r, r)+(diff(T(r, z, t), r))/r+diff(T(r, z, t), z, z))

diff(T(r, z, t), t) = alpha*(diff(diff(T(r, z, t), r), r)+(diff(T(r, z, t), r))/r+diff(diff(T(r, z, t), z), z))

(1)

Updated BC

BC1 := -k*(D[2](T))(r, 0, t) = q; BC2 := (D[2](T))(r, L, t) = 0; BC3 := (D[1](T))(R, z, t) = 0; BC4 := (D[1](T))(0, z, t) = 0; IC := T(r, z, 0) = 0

T(r, z, 0) = 0

(2)

NULL

Corrected original BC (this is a different case of constant external temperature)

BC1 := -k*(D[2](T))(r, 0, t) = q; BC2 := T(r, L, t) = 0; BC3 := T(R, z, t) = 0; BC4 := (D[1](T))(0, z, t) = 0; IC := T(r, z, 0) = 0

T(r, z, 0) = 0

(3)

NULL

Download 2d_BVP.mw

Hello,

I want to define these two equations.I know how I can define a Tensor, but how can I use a Tensor with tue diffrent indices. In one case I need u[i] , but I need also u[j]. I know also, that I need an extra command if I want to use latine letters. Can somebody write this complete for me ?

Thank you 

Hello,

I was wondering whether there is a way to achieve the same result as the code below, but using threads instead of Grid.

The problem is the following. Given a very large list of models (the example below contains only two models), I would like to return a set of sets using a simpler notation for the alpha parameters.

Example

models:=[[y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + z^3*alpha[3, 19]], [y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + y*z^2*alpha[3, 18]]]:

Desired output

{{[1, 17], [2, 19], [3, 15], [3, 18]}, {[1, 17], [2, 19], [3, 15], [3, 19]}}

The order of the elements does not matter, but the final result should be a set of sets.

The code I am currently using is

svars:={x,y,z}:
Grid:-Set('svars'):
convert(Grid:-Map(w->map(v->[op](v),indets(w,name) minus svars),models),set)

Unfortunately, indets is not listed as thread-safe, so I cannot simply replace Grid:-Map with Threads:-Map.

Is there a thread-safe alternative (or a completely new way of doing the same thing) that would achieve the same result?

Many thanks.

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