Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Dear respected colleagues,

The first "ex 1" and second "non linear" codes were sent to me by a colleague. It would be appreciated if they can be modified to look like the one saved with "K2 Nonlinear_Fang 2009". Thank you all for your time and best regards.




In mathematica, CommunityGraphPlot attempts to draw the vertices grouped into communities. 

g = Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 
   3 \[UndirectedEdge] 4, 1 \[UndirectedEdge] 4, 
   1 \[UndirectedEdge] 5, 5 \[UndirectedEdge] 6, 
   5 \[UndirectedEdge] 7, 7 \[UndirectedEdge] 8, 
   8 \[UndirectedEdge] 9, 7 \[UndirectedEdge] 9}, 
  VertexLabels -> "Name"];
ged = {{6, 7, 8, 9}, {5}, {1, 2, 3, 4}};# Gallai-Edmonds decomposition
 HighlightGraph[g, FindIndependentEdgeSet[g], 
  GraphHighlightStyle -> "Thick"], 
 Thread[Labeled[ged, {"D(g)", "A(g)", "C(g)"}]], PlotTheme -> "Web"]

This function is very useful, for example, if I get a partition of vertices, such as the gallai-Edmonds decomposition below, I use  CommunityGraphPlot to easily see the overall layout of the graph. I don't know if Maple has a corresponding function.

PS: The Gallai-Edmonds decomposition of a graph g is the partition {D(g),A(g),C(g)} of its vertices, where D(g) consists of every vertex v for which there exists a maximum matching of g that misses v, A(g) consists of every vertex v that is not in D(g) but neighbors some vertex in D(g) and C(g) consists of all remaining vertices.


I purchased the license of Maple 2019 and I am using the same version up to now. I am wondering if I download the latest version, can I use the former license? When I click on "check for updates" there is nothing for updating but when I want to run a Maple file written in the latest version, I face an error. 

Dear every one.

I want to solve an implit function. But maple give me this. How can i solve z(x,y) by maple?

Hello colleagues

I use Maple 2020 and I try to create Histogram of Poisson with a mean 200 [ Histogram(Sample(Poisson(200),10000))]. but I get an incorrect result in the form of a histogram as uniform distribution. But In my Maple 2015 I get a correct result.what is the problem?

Dear every one.


I am trying to set up an surface integral in maple. I have been trying with the Student[VectorCalculus] package.

I have also tried to use the task template for surface integral over a disk but somehow I mess up huge time.

I have tried to find help online and in maple help center. If anyone would please take time to explain the syntax of the SurfaceInt command id be happy.

Can someone teach me how to solve this exam.

Thank you.


The function subsets is an iterator for generating the power set of a set one set at a time.  I wanted to get iterators for all  k -subsets , so I modified the codes for getitng  iterators for the power set in the help document.

S := subsets({1,2,3,4,a}):
while not S[finished] do
 if nops(s1)=k then 
    end if;
end do:




But I think the iterative process is done in filtering, which means that maple runs out of power sets. It may not save time.

And of course we can use "choose" to get all k-subsets at once.

choose({1,2,3,4,a}, 3)


So my question is is there an iterator that takes less time to get a k-subset .

I prefer the iterator to the choose function because it saves memory and makes it easy to set some breakpoints in the program to terminate the process.

Another interesting thing is that I looked at the source code when use print and it didn't seem to show.







I use Syrup to solve for the transfer function of a circuit, and in particular, the voltage at a given node.   If I use the "trans" option, the solution generates the expected result, in the expected format.  Syrup solves the differential equations and the resulting time domain equation is as expected.

If I then use the 'AC'  option, I get the result in the s-domain.  I then solve for the step response, and take the inverse Laplace transform.  The solution is given in terms of sinh and cosh.   

If I plot the voltage in either solution as a function of time, the plots are identical.  So, the sinh/cosh solution must be somehow simplifiable so that it "looks" like the time domain solution I get from the transient analysis.





interface('displayprecision' = 8)



assum := R1::real, C1::real, R2::real, C2::real, R1 > 0, R2 > 0, C1 > 0, C2 > 0, t::realvin::real, vin > 0

vin::real, 0 < vin


ckt := [vin(5), Rm(1.0*10^7), Cm(1.8*10^(-11), ic = 0), `&//`(R1(9.*10^6), C1(1.5*10^(-11), ic = 0)), `&//`(R2(1.*10^6), C2(1.5*10^(-11), ic = 0))]

[vin(5), Rm(10000000.0), Cm(0.1800000000e-10, ic = 0), `&//`(R1(9000000.), C1(0.1500000000e-10, ic = 0)), `&//`(R2(1000000.), C2(0.1500000000e-10, ic = 0))]




ckt1 := [vin(0), Rm(0.10e8), Cm(0.18e-10, ic = 2.5), `&//`(R1(0.9e7), C1(0.15e-10, ic = 2.25)), `&//`(R2(0.1e7), C2(0.15e-10, ic = .25))]

[vin(0), Rm(0.10e8), Cm(0.18e-10, ic = 2.5), `&//`(R1(0.9e7), C1(0.15e-10, ic = 2.25)), `&//`(R2(0.1e7), C2(0.15e-10, ic = .25))]



Solution doing Transient Analysis

deqs, rest := Solve(ckt, 'tran', 'returnall')

sol1 := dsolve(deqs):

Reassign rest to include the solution.

rest := eval(rest,sol1):

Compute the voltage across the capacitor Cm.

tmp1:=simplify(eval(v[Cm](t), sol1));







p10 := plot(tmp1, t = 0 .. 0.00050000, color = 'blue', linestyle = 'dash')

p10 := plot(tmp1, t = 0 .. 0.5e-3, color = 'blue', linestyle = 'dash')


Solution from AC analysis:

sol, rest := Solve(ckt, 'returnall')

vnode2 := eval(v[2], sol)







Impulse Response

temp1 := invlaplace(vnode2, s, t)






Step Response

temp2 := invlaplace(vnode2/s, s, t)



p1 := plot({temp2, (1-exp(-1))*2.5}, t = 0 .. 0.5e-3)

temp3 := solve(temp2 = (1-exp(-1))*2.5, t)



p2 := plot([temp3, temp3], [0, 2.5])

display({p1, p10, p2})



What is going on?  Where are the sinh and cosh terms in the solution coming from and why wont it simplify so that it looks like the other solution if they are identical?  Is there something special I need to do when using the invlaplace function?





My Maple worksheet, which was working fine a few days ago, suddently cannot be modified. Many elements on the top bar (execute group, execute entire worksheet, insert maple prompt) are grayed out. Additionally I cannot edit any commands in the worksheet; clicking a command does not show any cursor and keyboard input does nothing.

Apparently I have entered some kind of read-only mode. I do not know how I did this. Meanwhile, if I start a new worksheet I can edit and execute as normal.

How do I revert my worksheet back to normal?


I dont like cursing, but this had got me going. 

How are there no solutions for the intersection points, i am only getting some, but not all of them, but i did ask Maple to produce an answer, but it however failed to produce all the answers. Its not that i did not try different techniques. 

I really wonder what went wrong. How could this be?! Just Maple... Answers between zero and 2 Pi... plz.... (!!!)

The answers i get with the suggested method from my math book dont give any straight answer. How is that an answer, i dont want imaginary numbers, i dont want to have  Z values (what is with that anyways?)..

Well here is what i found. Also if i were to ask for solutions between x values closer together i got more answers that were not there before. That is not what i want, that is like manual labor, that is not what i want at all, i want to be faster not slower. My graphing calculator was even a faster and that did get all the answers right away.. 

Any way, it missed an answer between 1/2Pi and Pi, answers that were not there before when looking for values between 0 and 2Pi. 

So, so odd..

It says in english: Also with finding solutions for solving goniometric equations with Maple, we should not forget that there are more solutions than just one, most of the times. We give you two methods to find all the solutions for solving goniometric equations. 


#first attempt

evalf(solve({x > 0*Pi, sin(x) = cos(4*x-(1/6)*Pi), x < 2*Pi}, x, allsolutions, explicit)); smartplot(sin(x), cos(4*x-(1/6)*Pi)); plot([sin(x), cos(4*x-(1/6)*Pi)], x = 0 .. 2*Pi, y = 0 .. 1); evalf(solve({x > (1/2)*Pi, sin(x) = cos(4*x-(1/6)*Pi), x < Pi}, x, allsolutions, explicit))

{x = 4.188790204}, {x = 5.445427267}




{x = 1.675516082}, {x = 2.932153141}


#second attempt

"f(x):=sin(x); g(x):= cos(4 x-1/(6)*Pi);fsolve([f,g]);"

proc (x) options operator, arrow, function_assign; sin(x) end proc


proc (x) options operator, arrow, function_assign; cos(4*x-(1/6)*Pi) end proc


[6.8067840827778841, -9.1035796650957585]


#third attempt;

_EnvAllSolutions := true; solve(sin(x) = cos(4*x-(1/6)*Pi), x)

-(2/3)*Pi+2*Pi*_Z4, -arctan((1/6)*3^(1/2)*(2*((1/2)*(4+(4*I)*3^(1/2))^(1/3)+2/(4+(4*I)*3^(1/2))^(1/3))^2-(1/2)*(4+(4*I)*3^(1/2))^(1/3)-2/(4+(4*I)*3^(1/2))^(1/3)-4)/((1/4)*(4+(4*I)*3^(1/2))^(1/3)+1/(4+(4*I)*3^(1/2))^(1/3)))+2*Pi*_Z5, -arctan((1/6)*3^(1/2)*(2*(-(1/4)*(4+(4*I)*3^(1/2))^(1/3)-1/(4+(4*I)*3^(1/2))^(1/3)+((1/2)*I)*3^(1/2)*((1/2)*(4+(4*I)*3^(1/2))^(1/3)-2/(4+(4*I)*3^(1/2))^(1/3)))^2+(1/4)*(4+(4*I)*3^(1/2))^(1/3)+1/(4+(4*I)*3^(1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9





how can I find e^(-x) with respect to x in this relation

e^x (1 + sqrt(1 + e^(-2 x))) - sinh^(-1)(e^(-x))=x

This worksheet attempts to implement figures in Section 3 of the book "Indra's pearls" by Mumford, Series and Wright using the  command complexplot.

The worksheet seems to display Figure 3.1 on page 63 accurately but fails to correctly display Figure 3.4 on page 67.

Can complexplot be coded to accurately display this figure?

Hi all,


I need to compute all roots of a polynomial equation for geometric reasons. I do want accuracy but more important is speedy calculations. I know fsolve works pretty well, but I process the polynomials on my own first. Does the roots command work better? What about solvetools. Any and all thoughts welcome.

Note I need to compute all roots.

While solving an exercise in class, I ran into the following interesting solution of a transcendental equation.  It was not intentionally designed to be like this.

eq := 2*exp(-2*t) + 4*t = 127:
fsolve(eq, t=0..infinity);

The solution looks like a rational number while it was expected to be transcendental.  Let's increase the number of digits:

Digits := 20:
fsolve(eq, t=0..infinity);
Digits := 10:

Let's make it even more accurate:

Digits := 29:
fsolve(eq, t=0..infinity);
Digits := 10:

And even more:

Digits := 40:
fsolve(eq, t=0..infinity);
Digits := 10:

Is there a deep reason why the solution is so close to being a rational or is it just a coincidence?


I want to estimate numerically the value of P (that is the probability that f exceeds the value 12 when x, y and z are uniformly distributed within the box [-Pi, Pi]3).

f := sin(x)+7*sin(y)^2+0.1*z^4*sin(x);
Omega := [x, y, z] =~ [(-Pi..Pi)$3]:
                                2        4       
               sin(x) + 7 sin(y)  + 0.1 z  sin(x)

h := Heaviside(f-12):
P := Int(h, Omega);

Here is a simple Monte Carlo estimation of P.

f_MC  := x -> sin(x[1])+7*sin(x[2])^2+0.1*x[3]^4*sin(x[1]); 
h_MC  := x -> Heaviside(f_MC(x) - 12);
omega := -Pi, Pi;
P_MC := proc(N)
  local Z := Statistics:-Sample(Uniform(omega), [N, 3]):
  local F := Vector(N, n -> h_MC(Z[n])):
  local K := add(F):
  local P := evalf(add(F)/N):
  local q := Statistics:-Quantile(Normal(0, 1), 0.005, numeric):
  local e := -q*sqrt(P*(1-P)/N):
  printf("A bilateral 99%% confidence interval that Prob(f > 12) is %1.3e +/- %1.2e\n", P, e);
end proc:

A bilateral 99% confidence interval that Prob(f > 12) is 1.643e-02 +/- 3.27e-04


I was hoping to get a value for P using  evalf/Int with some method.
But I didn't succeed with any of the methods for multiple integration:

  • The following command returns 0 for n=1 and 2 and Int(h, Omega) if n >=3
    evalf( Int(h, Omega, 'epsilon=1e-n', 'method=_MonteCarlo') );


  • And all my attempts with methods from the Cuba library have resulted in an unevaluated Int(h, Omega) integral. 

Could you help me to estimate P using  evalf/Int ?

4 5 6 7 8 9 10 Last Page 6 of 1855