MaplePrimes Questions

Maple help does not have an example I could find showing the right way to call method, which is meant to be called only from the constructor the object, before the object is fully build.

Help page does not have such example.

This worksheet shows 3 possible ways to do this. All seem to work fine. I am sure one can come up with more variations.

The question is, which one of these calls is the "right" way?

The method called from the constructor in this example is called process_age().

If someone knows an official Maple documentation showing one example of calling  a proc from constructor that will also help.

Version 1

 

restart;

module person()
   option object;

   local _name::string;
   local _age::posint;

   export ModuleCopy::static := proc( _self, proto::person,
        name::string,age::posint,$)
        _name:=name;
        _age:=process_age(age);
   end proc;

   local process_age:=proc(age::posint,$)::posint;
         age+1;
   end proc;

   export get_age::static:=proc(_self,$)::posint;
          _age;
   end proc;
end module;

module person () local _name::string, _age::posint, process_age; option object; end module

o:=Object(person,"me",99);
o:-get_age()

module person () local _name::string, _age::posint, process_age; option object; end module

100

 

 

Version 2

 

restart;

module person()
   option object;

   local _name::string;
   local _age::posint;

   export ModuleCopy::static := proc( _self, proto::person,
        name::string,age::posint,$)
        _name:=name;
        _age:=process_age(age);
   end proc;

   local process_age::static:=proc(age::posint,$)::posint;
         age+1;
   end proc;

   export get_age::static:=proc(_self,$)::posint;
          _age;
   end proc;
end module;

module person () local _name::string, _age::posint; option object; end module

 

o:=Object(person,"me",99);
o:-get_age()

module person () local _name::string, _age::posint; option object; end module

100

 

 

Version 3

 

restart;

module person()
   option object;

   local _name::string;
   local _age::posint;

   export ModuleCopy::static := proc( _self, proto::person,
        name::string,age::posint,$)
        _name:=name;
        _age:=_self:-process_age(age);
   end proc;

   local process_age::static:=proc(_self,age::posint,$)::posint;
         age+1;
   end proc;

   export get_age::static:=proc(_self,$)::posint;
          _age;
   end proc;
end module;

module person () local _name::string, _age::posint; option object; end module

 

 

o:=Object(person,"me",99);
o:-get_age()

module person () local _name::string, _age::posint; option object; end module

100

 

 

Download correct_way_to_call_method_from_constructor_oct_17_2025.mw

I have a Pascal program. I want to use a Maple program inside the Pascal program when calling it each time. I dont know how to interact Maple with Pascal. For this, could you give me over a small program? Yours Sincerely

The pair of symbols that stand for "isomorphic" and "not isomorphic" - basically equality sign with a tilda on top - seem to be conspicuously absent from all the palettes that I've seen. Is it hidden somewhere I failed to find it or actually absent - and if latter, is there any reason for that ? It seems to be a rather basic symbol, especially compared to much more niche stuff in "Relational" palette. 

Another conspicuously absent symbol is "not a subset". We have good old subset, and a "notSquareSubset" but I couldn't locate the "not a subset" in any palette. 

Less critical but still noticeable is absence of various arrows indicating surjectivity, injectivity and bijectivity. 

Is there perhaps a workaround to typesetting all of the above ? Copying from another document works usually but it's not a very convenient way. And if they are actually absent, perhaps we could ask the good folks at Maple to add them for the next update if it's not too much trouble ?

Isomorphism symbol : ≅
"Not a [proper] subset" symbols :  ⊈ ⊄
Arrows : in LaTex, \rightarrowtail \twoheadrightarrow \twoheadrightarrowtail 
Arrows

在 Maple 2025 中,我可以通过“编辑”菜单更改所选文本或数学表达式的字体,但我不知道如何将我喜欢的字体(例如 Microsoft YaHei)设置为所有新文档的默认字体。创建字符样式时“恢复为默认值”按钮显示为灰色.

How Maple 2023 displays new results with old results together

Help page for structured types shows examples where they add delayed quotes around things. For example

So I started writing  'specfunc(anything,y)' instead of just  specfunc(anything,y). Only to find this breaks things when used inside a proc.

Here is an example.

restart;

#here it worksheetdir
IC:=y(x)=0;
indets(IC,'specfunc(anything,y)');      

y(x) = 0

{y(x)}

#inside proc, same code fail
foo:=proc(func::function(name),IC::`=`)
    local y::symbol:=op(0,func);
    indets(IC,'specfunc(anything,y)');
end proc:
 

foo(y(x),y(x)=0)

{}

 

 

Removing the quotes, it now works

restart;

#here it worksheetdir
IC:=y(x)=0;
indets(IC,'specfunc(anything,y)');      

y(x) = 0

{y(x)}

#inside proc, same code fail
foo:=proc(func::function(name),IC::`=`)
    local y::symbol:=op(0,func);
    indets(IC,specfunc(anything,y));
end proc:
 

foo(y(x),y(x)=0)

{y(x)}

 

 

Download delayed_vs_not_v2.mw

Download delayed_vs_not.mw

It took me 2 hrs debugging to find this, as when I copied code which was working in my worksheet to my function, it stopped working and did not know why.

So for now, I will not use quotes around specfunc or any others like the help page shows in its examples.

Is there a rule of thumb to follow here? The help page is very inconsistent. It shows some examples with quotes around and some without. Makes it hard to know why and when to add the delayed quotes. It seems arbitrary.

When doing variable change for a differential equation, dchange works well for transformations like {s=r sin(theta),z=r cos(theta)}, but it does not seem to work if you include constant values like {s=(k-1)*r sin(theta)}, how can I let maple know that k is to be treated as a constant?

Good day.

Using the iterative map routine, the location of the bifurcation points of the logistic function can be determined using the plot (see attached).

I was wondering .. is it possible to estimate and output the locations of these points and the range of the function? I would like to explore the bifurcation behavior for the modified function so, this would be a great help. 

In this case, the location of the points are: (1.00,0.00), (3.00, 0.66), (3.45, 0.44), (3.45, 0.85) and the range is [0,4]. 

Thanks for reading!

MaplePrimes_Oct_16.mw

I gave up on this. I know how to find all normal derivatives such as diff(y(x),x) and diff(y(x),x$2) so on in expression. 

But now I want to find all those used for initial conditions, which do not have x in them. This makes it harder.

These have the form   D(y)(0) or (D@@2)(y)(1) and so on.

I tried indets and select and many other things, but can't figure how to tell Maple to find these in expression. Here is an example.

Given

expr:=y(3)+y(8)+5*(D@@2)(y)(4)+Pi+3*exp(2)+77*D(y)(0)+1/(D@@4)(y)(7);

I'd like to get list that has in it only the derivatives and nothing else, anywhere they show, which will be

{(D@@2)(y)(4) , D(y)(0) , (D@@4)(y)(7) }

some of the things I tried are

indets(expr,'satisfies'(s->op(0,s)=(D@@n)(y) and n::integer) );
indets(expr,'specfunc(anything, D)');
indets(expr,'specfunc(anything, (D@@anything)(y))');

And many more. I still struggle with structured types in Maple.

In the above, we can assume the dependent variable is always same which is the 'y' symbol.

I can do the above using patmatch. But I am trying to move away from that in Maple and use types.

For reference, this is what I do using another software. I am trying to do the same in Maple, but using structured types and not patmatch.

Iam sure there is a way to do this in Maple using structured types, but so far not able to figure the syntax needed.

Maple 2025.1

I use the tab key to control the formatting of lists. 

On my computer the tab key spacing under Maple 2025 is a little more than one inch which is too much. I have been through the Maple Help and cannot find how to change the tab key spacing.

Any help will be greatly appreciated.

My current account email is dead so I can only view answers here.

I want to solve differential equations using dsolve and plot the solution in the range plot(E(nu), nu=10^14…10^18) of the equation.

restart;

with(PDEtools, dchange):

N:=8*Pi*Tq^2*nu^2*E(nu)/(c^3*(exp(E(nu)/(k*T)) - 1));V:=Pi*rb^3;

8*Pi*Tq^2*nu^2*E(nu)/(c^3*(exp(E(nu)/(k*T))-1))

 

Pi*rb^3

(1)

Et:=dchange({nu=1/t},N*V,expand);#Change of var in t = period of a single oscilation;

8*Pi^2*Tq^2*E(t)*rb^3/(t^2*c^3*(exp(E(t)/(k*T))-1))

(2)

Sol_T:=subs(t=t,(Et)-subs(t=t+Tq,(Et)));#We do the calculus per one period Tq;

8*Pi^2*Tq^2*E(t)*rb^3/(t^2*c^3*(exp(E(t)/(k*T))-1))-8*Pi^2*Tq^2*E(t+Tq)*rb^3/((t+Tq)^2*c^3*(exp(E(t+Tq)/(k*T))-1))

(3)

Sol_nu:= dchange({t=1/nu},Sol_T,params=Tq,expand);# I like to go back to variable nu but is correct???;

8*Pi^2*Tq^2*nu^2*E(nu)*rb^3/(c^3*(exp(E(nu)/(k*T))-1))-8*Pi^2*Tq^2*E(nu)*rb^3/((1/nu+Tq)^2*c^3*(exp(E(nu)/(k*T))-1))

(4)

B:=int(diff(Sol_nu,nu),t=t..t+Tq);

16*Pi^2*Tq^3*nu*E(nu)*rb^3/(c^3*(exp(E(nu)/(k*T))-1))+8*Pi^2*Tq^3*nu^2*(diff(E(nu), nu))*rb^3/(c^3*(exp(E(nu)/(k*T))-1))-8*Pi^2*Tq^3*nu^2*E(nu)*rb^3*(diff(E(nu), nu))*exp(E(nu)/(k*T))/(c^3*(exp(E(nu)/(k*T))-1)^2*k*T)-16*Pi^2*Tq^3*E(nu)*rb^3/((1/nu+Tq)^3*c^3*(exp(E(nu)/(k*T))-1)*nu^2)-8*Pi^2*Tq^3*(diff(E(nu), nu))*rb^3/((1/nu+Tq)^2*c^3*(exp(E(nu)/(k*T))-1))+8*Pi^2*Tq^3*E(nu)*rb^3*(diff(E(nu), nu))*exp(E(nu)/(k*T))/((1/nu+Tq)^2*c^3*(exp(E(nu)/(k*T))-1)^2*k*T)

(5)

dsolve(Sol_nu=A*B,E(nu));#Where A = constant

-nu+3*A*Tq*ln(nu)-2*A*Tq*ln(Tq*nu+1)+A*Tq*ln(Tq*nu+2)-A*Tq*ln(exp(E(nu)/(k*T))-1)+A*Tq*ln(E(nu))+_C1 = 0

(6)

E(nu):=solve(E(nu)=-nu + A*Tq*ln(Tq*nu + 2) + 3*A*Tq*ln(nu) - 2*A*Tq*ln(Tq*nu + 1) - A*Tq*ln(exp(E(nu)/(k*T)) - 1) + A*Tq*ln(E(nu))+C1,E(nu));

ln(exp(RootOf(-A*Tq*ln(nu^3*(Tq*nu+2)*ln(exp(_Z)+1)*T*k/(Tq*nu+1)^2)+_Z*A*Tq+ln(exp(_Z)+1)*T*k-C1+nu))+1)*T*k

(7)

#E(nu)=???

k:= 1.3806490000*10^(-23);rb:=5.293*10^(-11);
ec:= 1.602176634*10^(-19);Tq:=1.765*10^(-19);
c:= 299792458;T:=297;A:=1;

0.1380649000e-22

 

0.5293000000e-10

 

0.1602176634e-18

 

0.1765000000e-18

 

299792458

 

297

 

1

(8)

plot(-nu - 2*A*Tq*ln(Tq*nu + 1) + 3*A*Tq*ln(nu) + A*Tq*ln(Tq*nu + 2),nu=10^14..10^18);#Approx neglecting => -A*Tq*ln(exp(E(nu)/(k*T)) - 1) + A*Tq*ln(E(nu))

 

plot(E(nu),nu=10^14..10^18);

Warning, expecting only range variable nu in expression ln(exp(RootOf(-A*Tq*ln(nu^3/(Tq*nu+1)^2*(Tq*nu+2)*ln(exp(_Z)+1)*T*k)+_Z*A*Tq+ln(exp(_Z)+1)*T*k-C1+nu))+1)*T*k to be plotted but found names [A, C1, T, Tq, k]

 

 
 

 

Download plm.mw

Given a list of n characters, for example [a,1,=,#,@,B,...]. Please help me use Maple command to randomly pick k elements, each element consists of q consecutive random characters, for example, randomly pick 4 elements, each element consists of 3 consecutive random characters a1=, aa&, BC!, 90%. Thank you very much for your help!

i don't know how replace the function which remove the sign of integral even i know the author replaced by sin(t) and t and combined them like the picture but i don't know why my pdes not give me zero 

h-pde-M.mw

Hello everyone,

I am working on reproducing Fig. 12 (Isotherms) and Fig. 13 (Streamlines) from the attached paper, cacity_paper_work.pdf which deals with natural convection of GO–MgO/silicone oil hybrid nanofluid inside square and H-shaped cavities under a periodic magnetic field.

Equations (9–11) in the paper describe the steady-state 2D flow and heat transfer in terms of u(x,y), v(x,y), and θ(x,y). I have already set up the full PDE system, parameters, and boundary conditions (BCs) in Maple.

Now, iusing pdsolve(..., numeric, method=fd), 

Solve these equations for both square and H-shaped cavities using the given ICs and BCs, and

Generate Isotherm and Streamline plots (similar to Figs. 12 and 13 in the paper).

I have attached:

The PDF (showing equations and figures), and

My Maple worksheet containing the PDE definitions and parameters.

I would really appreciate guidance on:

Whether dsolve can be used effectively for this PDE system,

How to define the BCs correctly for the H-shaped cavity (especially the partially heated wall, θ=1 for 0.4 < y < 0.6), and

How to extract and plot the temperature (θ) and streamfunction (ψ) fields similar to the paper’s plots.

error_in_cavity_work.mw

Here is a 3D plot of a hemisphere punctured by a cylinder.  I had to think a bit about how to produce this graphics in Maple.  I am posting it here for your amusement, and a challenge for your spare time.

2 3 4 5 6 7 8 Last Page 4 of 2438