MaplePrimes Questions

Search Questions:

This the part of a procedure I have for removing common factors from matrices and vectors used in a projective geometry setting.
How can a get it to work so it handles aglebraic denominators? Such as 

x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2

restart

 

ReduceM:= proc(C::{Matrix, :-_ProjM3})
            local i, tgdc, dnm, V1, Ml, SV1, ns, M, r;
            option overload;
            if C::'Matrix' then
                M := LinearAlgebra:-Copy(C);
            elif C::{':-_ProjM3'} then
                M := LinearAlgebra:-Copy(C[1]);
            end if;
            V1 := convert(M, list);
            SV1 := convert(M, set) minus {0};
            ns := nops(SV1);
            dnm := frontend(lcm, [seq(denom(SV1[i]), i = 1 .. ns)]);
            Ml := simplify(dnm *~ M);
            V1 := convert(Ml, list);
            tgdc := SV1[1];
            if tgdc = 0 then
                tgdc := 1;
            end if;
            for i from 2 to ns do
                tgdc := frontend(gcd, [tgdc, SV1[i]]);
            end do;
            r := `if`(C::'Matrix', simplify(factor~(Ml /~ tgdc)),
                <[simplify(factor~(Ml /~ tgdc))]>);
            return r;
        end proc:

 

 

A:=Matrix(3, 3, [[(x__2 - x__1)*(-y__2 + y__3) + (-y__1 + y__2)*(-x__3 + x__2), (x__2 - x__1)*(-y__1 + y__3) + (-y__1 + y__2)*(-x__3 + x__1), (x__2 - x__1)*(-y__1 + y__2) + (-y__1 + y__2)*(-x__2 + x__1)], [(x__3 - x__1)*(-y__2 + y__3) + (-y__1 + y__3)*(-x__3 + x__2), (x__3 - x__1)*(-y__1 + y__3) + (-y__1 + y__3)*(-x__3 + x__1), (x__3 - x__1)*(-y__1 + y__2) + (-y__1 + y__3)*(-x__2 + x__1)], [x__1*(-y__2 + y__3) + y__1*(-x__3 + x__2) - x__2*y__3 + x__3*y__2, (-y__1 + y__3)*x__1 + y__1*(-x__3 + x__1) - x__1*y__3 + x__3*y__1, (-y__1 + y__2)*x__1 + y__1*(-x__2 + x__1) - x__1*y__2 + x__2*y__1]])

Matrix(3, 3, {(1, 1) = (x__2-x__1)*(-y__2+y__3)+(-y__1+y__2)*(-x__3+x__2), (1, 2) = (x__2-x__1)*(-y__1+y__3)+(-y__1+y__2)*(-x__3+x__1), (1, 3) = (x__2-x__1)*(-y__1+y__2)+(-y__1+y__2)*(-x__2+x__1), (2, 1) = (x__3-x__1)*(-y__2+y__3)+(-y__1+y__3)*(-x__3+x__2), (2, 2) = (x__3-x__1)*(-y__1+y__3)+(-y__1+y__3)*(-x__3+x__1), (2, 3) = (x__3-x__1)*(-y__1+y__2)+(-y__1+y__3)*(-x__2+x__1), (3, 1) = x__1*(-y__2+y__3)+y__1*(-x__3+x__2)-x__2*y__3+x__3*y__2, (3, 2) = (-y__1+y__3)*x__1+y__1*(-x__3+x__1)-x__1*y__3+x__3*y__1, (3, 3) = (-y__1+y__2)*x__1+y__1*(-x__2+x__1)-x__1*y__2+x__2*y__1})

(1)

ReduceM(A)

Matrix(3, 3, {(1, 1) = 1, (1, 2) = 1, (1, 3) = 0, (2, 1) = 1, (2, 2) = 0, (2, 3) = -1, (3, 1) = -1, (3, 2) = 0, (3, 3) = 0})

(2)

B:=Matrix(3, 3, [[-(y__1 - y__3)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) + (y__1 - y__2)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(y__1 - y__3)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(y__1 - y__2)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)], [(-x__3 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) - (-x__2 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), (-x__3 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), (-x__2 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)], [-(x__1*y__3 - x__3*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) + (x__1*y__2 - x__2*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) - 1, -(x__1*y__3 - x__3*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(x__1*y__2 - x__2*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)]])

Matrix(3, 3, {(1, 1) = -(y__1-y__3)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(y__1-y__2)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (1, 2) = -(y__1-y__3)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (1, 3) = -(y__1-y__2)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 1) = (-x__3+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-(-x__2+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 2) = (-x__3+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 3) = (-x__2+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (3, 1) = -(x__1*y__3-x__3*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(x__1*y__2-x__2*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-1, (3, 2) = -(x__1*y__3-x__3*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (3, 3) = -(x__1*y__2-x__2*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)})

(3)

ReduceM(B)

Error, (in gcd/Freeze) arguments should be polynomials

 

B*denom(B[1,1])

Matrix(3, 3, {(1, 1) = (x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)*(-(y__1-y__3)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(y__1-y__2)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)), (1, 2) = -y__1+y__3, (1, 3) = -y__1+y__2, (2, 1) = (x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)*((-x__3+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-(-x__2+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)), (2, 2) = -x__3+x__1, (2, 3) = -x__2+x__1, (3, 1) = (x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)*(-(x__1*y__3-x__3*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(x__1*y__2-x__2*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-1), (3, 2) = -x__1*y__3+x__3*y__1, (3, 3) = -x__1*y__2+x__2*y__1})

(4)

simplify( (4) );

Matrix(3, 3, {(1, 1) = -y__2+y__3, (1, 2) = -y__1+y__3, (1, 3) = -y__1+y__2, (2, 1) = -x__3+x__2, (2, 2) = -x__3+x__1, (2, 3) = -x__2+x__1, (3, 1) = -x__2*y__3+x__3*y__2, (3, 2) = -x__1*y__3+x__3*y__1, (3, 3) = -x__1*y__2+x__2*y__1})

(5)

 


 

Download 2026-08-03_Q_Remove_Common_Factors_from_Matrix.mw

I have two lists. I would like to confirm that one is a permutation of the other. Which Maple procedure does this?

Edit:
So surprising answer is Maple has no builtin one command to establish the fact.

Does GuessRecurrence require at least 7 terms in its input list?

For a numericial integration I want to check if all physical parameters are given in SI base units (before stripping of the units for the integration). Right now I am doing this

restart

Parameters

H = 0.1e-1*Unit('m'), R = 0.6e-2*Unit('m'), r_sub = 0.3e-2*Unit('m'), k = .540*Unit('W'/('m'*'K')), rho = 1060.0*Unit('kg'/'m'^3), Cp = 3745*Unit('J'/('kg'*'K')), Q_flux = 5000*Unit('W'/'m'^2), T_amb = 0*Unit('K'), Nz = 20, Nr = 20, t_final = 30*Unit('s'), t_step = Unit('s'), test_1 = Unit('kW'), test_2 = 2*Unit('N')

H = 0.1e-1*Units:-Unit(m), R = 0.6e-2*Units:-Unit(m), r_sub = 0.3e-2*Units:-Unit(m), k = .540*Units:-Unit(W/(m*K)), rho = 1060.0*Units:-Unit(kg/m^3), Cp = 3745*Units:-Unit(J/(kg*K)), Q_flux = 5000*Units:-Unit(W/m^2), T_amb = 0, Nz = 20, Nr = 20, t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N)

(1)

H: length of rod
R: outer radius
r_sub: outer radius of heat flux
k: conductance
ρ: density
Cp: heat capacity
Q_flux: heat flux
T_amb: initial Tempearture
Nz: number of axial grid points
Nr: number of radial grid points
t_final: integration time
t_step: sampling interval for temperature fields
test_1: unit given in kilos
test_2: unit given in derived base units

alpha = k/(rho*Cp); simplify(subs(H = 0.1e-1*Units:-Unit(m), R = 0.6e-2*Units:-Unit(m), r_sub = 0.3e-2*Units:-Unit(m), k = .540*Units:-Unit(W/(m*K)), rho = 1060.0*Units:-Unit(kg/m^3), Cp = 3745*Units:-Unit(J/(kg*K)), Q_flux = 5000*Units:-Unit(W/m^2), T_amb = 0, Nz = 20, Nr = 20, t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N), %))

alpha = 0.1360304305e-6*Units:-Unit(m^2/s)

(2)

α: thermal diffusivity

 

One way is to check whether the value of a physical parameter has not changed after simplification

`minus`(map(convert, simplify(`~`[rhs]({Cp = 3745*Units:-Unit(J/(kg*K)), H = 0.1e-1*Units:-Unit(m), Nr = 20, Nz = 20, Q_flux = 5000*Units:-Unit(W/m^2), R = 0.6e-2*Units:-Unit(m), T_amb = 0, k = .540*Units:-Unit(W/(m*K)), r_sub = 0.3e-2*Units:-Unit(m), rho = 1060.0*Units:-Unit(kg/m^3), t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N)})), unit_free), map(convert, `~`[rhs]({Cp = 3745*Units:-Unit(J/(kg*K)), H = 0.1e-1*Units:-Unit(m), Nr = 20, Nz = 20, Q_flux = 5000*Units:-Unit(W/m^2), R = 0.6e-2*Units:-Unit(m), T_amb = 0, k = .540*Units:-Unit(W/(m*K)), r_sub = 0.3e-2*Units:-Unit(m), rho = 1060.0*Units:-Unit(kg/m^3), t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N)}), unit_free))

{1000}

(3)

if is(`minus`(map(convert, simplify(`~`[rhs]({Cp = 3745*Units:-Unit(J/(kg*K)), H = 0.1e-1*Units:-Unit(m), Nr = 20, Nz = 20, Q_flux = 5000*Units:-Unit(W/m^2), R = 0.6e-2*Units:-Unit(m), T_amb = 0, k = .540*Units:-Unit(W/(m*K)), r_sub = 0.3e-2*Units:-Unit(m), rho = 1060.0*Units:-Unit(kg/m^3), t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N)})), unit_free), map(convert, `~`[rhs]({Cp = 3745*Units:-Unit(J/(kg*K)), H = 0.1e-1*Units:-Unit(m), Nr = 20, Nz = 20, Q_flux = 5000*Units:-Unit(W/m^2), R = 0.6e-2*Units:-Unit(m), T_amb = 0, k = .540*Units:-Unit(W/(m*K)), r_sub = 0.3e-2*Units:-Unit(m), rho = 1060.0*Units:-Unit(kg/m^3), t_final = 30*Units:-Unit(s), t_step = Units:-Unit(s), test_1 = Units:-Unit(kW), test_2 = 2*Units:-Unit(N)}), unit_free)) <> {}) then print("Not all units are in SI base units") end if

"Not all units are in SI base units"

(4)

Download check_for_SI_base_units.mw

I am interested in simpler ways to perform the test. The statement is quite long and not easy to understand.

Given the size of the unit package, there might be a command that I have overlooked to check whether units are in SI base units.

Have I missed test cases to make the check fool proof?

 

Update: A variant with split was added and attempts with functional programming

check_for_SI_base_units_02.mw

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

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.)

Pretty much what the title says. I am a student and I've worked with B&R Automation Studio, which is a SCADA software, with the physical automation components in the lab in college. Now that I'm on the summer break, it would be great to continue this learning via the B&R connector that Maple offer, to create a "digitial twin". However, there doesn't seem to be any information as to whether MapleSim is actually included in the student edition, and whether the connector is included too.

Thanks

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