Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

How can an equation containing a logarithmic function be converted into a polynomial?


I have a data structure/plotting question. How do I plot the 3 lambdas (singleaxis) and the 6 betas (dualaxis) for 12 calibrations (1000 runs each)? All the details are in the script Thank you!

For the beta plots and subplots, please follow the dualaxis example output format at the bottom of my script for each of the 12 calibrations.

For the lambda plots, I'd like to combine a few of them as follows (each plot with lambda_1 subplot, lambda_2 subplot, and lambda_3 subplot - note that the lambda plot example at the bottom of the script is dualaxis but I just need singleaxis):

PLOT 1 (singleaxis): lambda_1, _2, _3 for ncal2 and ncal3 (superimposed, 2 data series for each subplot)

PLOT 2 (singleaxis):  lambda_1, _2, _3 for ncal7 and ncal8 (superimposed, 2 data series for each subplot)

PLOT 3 (singleaxis):  lambda_1, _2, _3 for ncal4, ncal5, ncal6 (superimposed, 3 data series for each subplot)

PLOT 4 (singleaxis):  lambda_1, _2, _3 for ncal9, ncal10, ncal11 (superimposed, 3 data series for each subplot)

 I run the attached code, but after waiting for a few minutes, there is no response, does anyone know the reason?

 It only shows Evaluating!!!!

I know trig functions are hard to simplify in general but was wondering if there was any simplification command that comes in handy for trig functions of the following form.

sin(theta)^(A - 2)*cos(theta)^2 - sin(theta)^(A - 2) + sin(theta)^A

I am trying to make a very rough animation of a rotating pulsar magnetosphere that would very roughly resemble this gif.
I was able to make a sphere and the dipolar field lines. I was wondering if anyone could provide any possible suggestion regarding.

1. How do i animate the rotation such that the rotation axis is not z but slightly misaligned to z.

2. Is there a better way to make the field likes from the poles (jets).


[1.1, cos(theta), theta]

[1.1, cos(theta), theta]


sph := [.5, theta, phi]; c1 := [A*sin(phi)^2, 0, phi]; c2 := [A*sin(phi)^2, (1/6)*Pi, phi]; c3 := [A*sin(phi)^2, (1/3)*Pi, phi]; c4 := [A*sin(phi)^2, (1/2)*Pi, phi]; c5 := [A*sin(phi)^2, 2*Pi*(1/3), phi]; c6 := [A*sin(phi)^2, 5*Pi*(1/6), phi]

[A*sin(phi)^2, (5/6)*Pi, phi]





A := 2; plot3d([c1, c2, c3, c4, c5, c6, sph], phi = 0 .. 2*Pi, theta = 0 .. 2*Pi, coords = spherical, plotlist = true, scaling = constrained)





s1 := [sqrt(theta), 1, 1/10]; s2 := [sqrt(theta), 3, -1/10]; s3 := [sqrt(theta), 2, 1/10]; s4 := [sqrt(theta), 1.7, 1/7]

p := plot3d([sph, s1, s2, s3, s4, s5, s6, c1, c2, c3, c4, c5, c6], phi = 0 .. 2*Pi, theta = 0 .. Pi, coords = spherical, orientation = [-75, 58, 10], scaling = constrained, color = ["SkyBlue", "yellow", "yellow", "yellow", "yellow", "yellow", "yellow", "red", "red", "red", "red", "red", "red"])




plots[animate](plot3d, [[sph, s1, s2, s3, s4, s5, s6, c1, c2, c3, c4, c5, c6], theta = 0 .. Pi, phi = 0 .. 2*Pi, orientation = [B, 45, 52], coords = spherical], B = -180 .. 180)




3. Any other suggestions that could help with the aesthetics.

Last execution block is not producing any output. Why?

The 3x3 nonlinear system I am trying to solve is already a stylized version of my problem, as I already:

  1. Calibrated my equations before attempting to solve for them (search for "Calib_1" in my script)
  2. Split the original 6x6 system into two 3x3 sub-systems (since 3 out of 6 variables only appear in 3 out of 6 equations) and solved for one sub-system

What else can you think of? Should I instead use the parallel solver on the whole 6x6 system rather than just the unsolved 3x3 sub-system?

How to find, if exist, singular solutions? That is, some valuation of some parameters that will yield a solution that cannot be obtained by applying the same valuation to a general solution. Carl Love (who I cannot tag) once mentioned: "The parameter valuations that lead to singular solutions can often be guessed by using valuations that would produce zeros in denominators in the general solution. A singular solution can't be expressed as any instantiation of a generic symbolic solution. By instantiation I mean an assigment of numeric values to some parameters. Here's an example:"

#2x2 matrix and 2x1 vector. 5 parameters (a, b, d, x, y). The 2 decision variables are
#unseen and unnamed in this pure matrix-vector form. Their values are the two entries 
#in the solution vectors S0 and S1.

A:= <a, b; 0, d>;  B:= <x, y>;

#Get a generic solution:
S0:= LinearAlgebra:-LinearSolve(A, B);

#Instantiate 3 parameters (a, d, y) to 0 and solve again:
S1:= LinearAlgebra:-LinearSolve(eval([A, B], [a, d, y]=~ 0)[]);

#Note that no possible instantiation of S0 can produce S1.

Thank you!

Hello Everyone;

Hope you are fine. I I have make a code but there is error and dsolve comand is working. I also need to plot. Kindly help me. I am waiting kind response. Code is attached.

restart; Cm := 1.0; ENa := 50.0; EK := -77.0; ELeak := -54.387; gNa := 120.0; gK := 36.0; gLeak := .3; II := piecewise(`and`(t >= 10, t <= 40), 10.0, 0.); alpha_m := proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc; beta_m := proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc; alpha_h := proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc; beta_h := proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc; alpha_n := proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc; beta_n := proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc; eq1 := diff(V(t), t) = (II-gNa*m(t)^3*h(t)*(V(t)-ENa)-gK*n(t)^4*(V(t)-EK)-gLeak*(V(t)-ELeak))/Cm; eq2 := diff(m(t), t) = alpha_m(V(t))*(1-m(t))-beta_m(V(t))*m(t); eq3 := diff(h(t), t) = alpha_h(V(t))*(1-h(t))-beta_h(V(t))*h(t); eq4 := diff(n(t), t) = alpha_n(V(t))*(1-n(t))-beta_n(V(t))*n(t); ics := {V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

















proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc


proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc


proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc


proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc


proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc


proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc


diff(V(t), t) = 3.683900000-120.0000000*m(t)^3*h(t)*(V(t)-50.0)-36.00000000*n(t)^4*(V(t)+77.0)-.3000000000*V(t)


diff(m(t), t) = .1*(V(t)+40.0)*(1-m(t))/(1.0-exp(-.1000000000*V(t)-4.000000000))-4.0*exp(-0.5555555556e-1*V(t)-3.611111111)*m(t)


diff(h(t), t) = 0.7e-1*exp(-0.5000000000e-1*V(t)-3.250000000)*(1-h(t))-1.0*h(t)/(1.0+exp(-.1000000000*V(t)-3.500000000))


diff(n(t), t) = 0.1e-1*(V(t)+55.0)*(1-n(t))/(1.0-exp(-.1000000000*V(t)-5.500000000))-.125*exp(-0.1250000000e-1*V(t)-.8125000000)*n(t)


{V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}


sol := dsolve({eq1, eq2, eq3, eq4, ics})

Error, (in dsolve) invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({list, set})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received {{V(0) = -65, h(0) = 3/5, m(0) = 1/20, n(0) = 8/25}}





I think some form of simplify() would do but I am not sure how.

See the following script for more details:


#Define the assumptions ex-ante (variances as real and positive, correlations in between -1 and +1 and so on...) - or Maple wouldn't know

assume(`#msub(mi("mu",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("mu",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`::real, `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`::real, `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1])::real, (`#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3])::real, (`#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1])::real, (`#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])::real)

assume(0 <= `#msub(mi("mu",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("mu",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("1"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("2"))`, 0 <= `#msub(mi("lambda",fontstyle = "normal"),mi("3"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon1"))`, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("epsilon2"))`, 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[1], 0 <= `#msub(mi("nu",fontstyle = "normal"),mi("0"))`[2], -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 2] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[1, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] and `#msub(mi("rho",fontstyle = "normal"),mi("u"))`[2, 3] <= 1, -1 <= `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] and `#msub(mi("rho",fontstyle = "normal"),mi("v"))`[1, 2] <= 1, 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[2], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("u"))`[3], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[1], 0 <= `#msub(mi("sigma",fontstyle = "normal"),mi("v"))`[2])


t__1 := (`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__2 := -`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__3 := (`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2*`&nu;__0`[2]-`&nu;__0`[1]*`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

See for example that they share the same denominator...
# I want Maple to automatically/smartly choose the most compact way...e.g., (i) t2=t1+... or (ii) t2=t3*... (i) is equivalent to (ii) but I want Maple to pick (ii) if more compact than (i)
# I have 9 expressions like t1,t2,t3 and I want Maple to re-write them as function of each other smartly





It must be something similar to this, but my case is slighty different.

Dear all:

    I am using maple2022 to learn Fourier Series package - Maple Application Center ( . the author provide the package here:  I use the lastest version: Package FourierTrigSeries version 0.41 

there is no .mla so I do not know how to use this package.(the package is a little old). 

please enlight me if you know how to install this old package.

but the author provide the code inside fourierseries-structs.mws 

here is what I do:

1. first delete some lines which is not useful(which I shared in the attachment as

and remain everything inside module and save as .mw (maybe the orginal .mws is a old version of maple files)

2. export as .FourierTrigSeries.mpl (also attached)

3. use the examples.mws (the code also from author)

I got error as:

the package can be recognized, but the first line wil give some error which is out of my knowledge field.

everything mentioned above is here, including the original author's files.

Could you please have a look. your idea is valuable to me.

PS: this package is not available The Fourier Series package for Maple - Maple Application Center ( whenI try to learn  Teaching Fourier Series with Maple II 

if anyone keep it before, please share it.

thanks for your help.


Hi every one, I am trying to find a relation from an equation by putting it is equal to zero but could not get the solution.

N := S(t) + In(t) + C(t);
                    N := S(t) + In(t) + C(t)

eqn1 := diff*(S(t), t) = lambda - (lambda + sigma)*S(t) - (beta + Zeta)*S(t)*In(t) - beta[1]*S(t)*C(t), S(0) = ic1;
 eqn1 := diff (S(t), t) = lambda - (lambda + sigma) S(t)

    - (beta + Zeta) S(t) In(t) - beta[1] S(t) C(t), S(0) = ic1

eqn2 := diff*(In(t), t) = beta*S(t)*In(t) - (lambda + gamma)*In(t), In(0) = ic2;
 eqn2 := 

   diff (In(t), t) = beta S(t) In(t) - (lambda + gamma) In(t), 

   In(0) = ic2

eqn3 := diff*(C(t), t) = Zeta*In(t) + Zeta*In(t)^2 - (rho + lambda)*C(t) - Zeta*C(t)*In(t), C(0) = ic3;
     eqn3 := diff (C(t), t) = Zeta In(t) + Zeta In(t) 

        - (rho + lambda) C(t) - Zeta C(t) In(t), C(0) = ic3

lambda := 0.117852;
                       lambda := 0.117852

mu := 0.035378;
                         mu := 0.035378

beta := 0.11;
                          beta := 0.11

beta__1 := 0.05;
                        beta__1 := 0.05

g := 1;
rho := 0.1;
                           rho := 0.1

zeta := 0.02;
                          zeta := 0.02

sigma := 0.066;
                         sigma := 0.066

ic1 := 2390000;
ic2 := 753;
ic4 := 358500;
                         ic1 := 2390000

                           ic2 := 753

                         ic4 := 358500

dsol := dsolve([eqn1, eqn2, eqn3], numeric);
Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

I have this tedious looking function that I want to write in terms of the other expression but the command i usually use does not work here because the expressions are not polynomials. I am wondering if there is an alternative to doing this manually.

Hi everyone
how can i overcome this error to solve this ODE ? tnx in advanced.


U := 1:L := 10:k := 1:Dea := 0.00001:CA0 := 10:Pe := U*L/Dea:Da := k*CA0^2/Dea:

Eq1 := diff(CA(x), x, x) - Pe*diff(CA(x), x)/L = Da*L*CA(x)^2/CA0;

diff(diff(CA(x), x), x)-100000.0000*(diff(CA(x), x)) = 10000000.00*CA(x)^2


BCs := CA(0) = CA0, D(CA)(L) = 0

CA(0) = 10, (D(CA))(10) = 0


ans := dsolve([Eq1, BCs], numeric);

Error, (in dsolve/numeric/bvp) initial Newton iteration is not converging




I am trying to give an input to an R program from an output the edge set of maple code 

Now how to Build a function which takes a list of edge sets as inputs and returns a list on the below format

Show I want for one edge set of the list

Now I have edge set of a Graph G say {{1,2},{2,3},{3,4},{4,5}}

Now want to pick the first values of each index make one set 


Similiarly first values of each index make one more set 


Then I want to form a list [from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft)]

Now it will take second graph in the Edge list say {{1, 2}, {1, 7}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}}

It will append to the previous list like

[from<-c(1,2,3,4),to<-c(2,3,4,5),ft <- cbind(from, to),Graph1<-ftM2graphNEL(ft),from<-c(1,1,2,3,4,5,6),to<-c(2,7,3,4,5,6,7),ft <- cbind(from, to),Graph2<-ftM2graphNEL(ft)]

This time Graph1 is changed to Graph2 to be observed.

Like that it will need  increase graph number based on the number of edge sets in the list of edges.

To be done all edge sets in list

As then I can copy the entire contents in the list and paste in R so that i can run 

As I can have 100 or more graphs done in maple doing for each of them manually typing may be difficult.

Kind help please

Your help will be surely Acknowledged 

Kind help

A toy code i simply tried for graph attached

But I have errors some come with double quotes can something be done if possible please guide

Kind help

As with 100 of lines it will easy to copy paste 

If the contents of the list can be written to txt file it would be helful 

please help

I have tried something to my knoewledge please help


is there a limit to the matrix size on which the Determinant(A) can operate? I am working on a project that generates a 22x22 matrix of coefficients of unknowns, which I built out of the GenerateMatrix() function.  If I use subs(omega=1, AA), the determinant is calculated. Still, I want the determinant in terms of omega so I can solve for Determinant(A)=0 in order to find the natural frequencies and then find my unknown coefficients.

When I use the Determinant function on my symbolic matrix is always returns 0. I know from using smaller matrices that it can do symbolic determinants. If there is a better way to do what I am trying to do, please let me know!


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