MaplePrimes Questions

I am studying a nonlinear wave equation and trying to reproduce the energy balance method shown in a research paper. First, the original partial differential equation is reduced to an ordinary differential equation using a traveling wave transformation. After obtaining the reduced equation, the paper rewrites it in a form suitable for the energy balance method and derives the corresponding variational principle and Hamiltonian invariant. Then a trial periodic solution in cosine form is assumed. Using the Hamiltonian invariant and some initial conditions, the parameters of the trial function are determined and a periodic solution is obtained.

I would like to know how to implement this procedure in Maple. Specifically,  compute the Hamiltonian invariant from the equation, substitute the cosine trial function, and determine the unknown parameter in the trial solution using the energy balance method. I will attach images from the paper that show the derivation steps I am trying to reproduce. Any guidance on how to perform these symbolic steps in Maple would be very helpful.

f-s.mw

Hi,

For a pedagogical purpose, I am trying to illustrate the orthogonal projection H of a point A on to a plane P1

I constructed the line l1​ passing through A and perpendicular to the plane P1
However, in the graphical visualization, the line does not appear to be perpendicular to the plane. Visually, it gives the impression that the line is not orthogonal to the plane.

Do you have any idea what might cause this effect?

Thank you for your help.

Q_Espace.mw

While teaching a linear programming course I put together a worksheet to illustrate finding the largest disk inside a convex polygon as in section 2.6 of Understanding and Using Linear Programming by Jiří Matoušek and Bernd Gärtner.  I used both the Optimization[LPSolve] and the simplex[maximize] routines with the same objective and the same constraints.  Optimization[LPSolve] gives the correct answer but simplex[maximize] does not.  Is this a bug or did I do something wrong?

Below is the worksheet.

This is a worksheet I put together to illustrate finding the largest disk inside a convex polygon

as in section 2.6 of Understanding and Using Linear Programming by Jiří Matoušek and
Bernd Gärtner.

 

Load some packages

restart;
with(plots):
with(LinearAlgebra):
with(simplex);
with(Optimization);
with(plottools):

[basis, convexhull, cterm, define_zero, display, dual, feasible, maximize, minimize, pivot, pivoteqn, pivotvar, ratio, setup, standardize]

 

[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize, NLPSolve, QPSolve]

(1)

This is the definition of the polygon with a plot.

constr := [x>=0,y>=0,y-x<=1,x+y<=5,2*x-y<=6];
Vector(%);
P1 := inequal(constr,x=-1..5,y=-1..5,optionsfeasible=[color=yellow]);

These are the outward normals for the polygon constraints and the "b" values.

C := [<-1,0>,<0,-1>,<-1,1>,<1,1>,<2,-1>];
b:= [0,0,1,5,6];

This is a check that a point is inside the polygon with plots of the circle that show the distance

from the pont to each defining line.

Pt := <1,.5>;
Pta := convert(Pt,list);
map(is,subs({x=2,y=1},constr));

DistV := [seq((b[i]-DotProduct(C[i],Pt))/Norm(C[i],2),i=1..5)]

P2 := NULL:
for i from 1 to 5 do
   P2 := P2,plottools:-circle(Pta,DistV[i],color=cat("Bright ",i),thickness=2);
   end do:
display([P2,P1],scaling=constrained);
display(map(display,[seq([P1,[P2][i]],i=1..5)]),insequence=true,scaling=constrained);

Now the distance from a point in the polygon to the boundary of the polygon is defined

and plotted over the polygon.

f := proc(x,y)
     local i;
      uses LinearAlgebra;
     min([seq(((b[i]-DotProduct(C[i],<x,y>))/Norm(C[i],2)),i=1..5)]);
     end proc;

plot3d(f(x,y),x=-1..5,y=-1..5,view=[0..4,0..4,0..2],grid=[151,151]);

 

This is the definition of the LP to solve the largest disk problem.

 

We maximize z, a variable less than or equal to the distance from the point x, y to each of the

constraining lines where x, yis in the polygon.

 

C := [<-1,0>,<0,-1>,<-1,1>,<1,1>,<2,-1>];
b:= [0,0,1,5,6];

Here are the constraints.

obj := z;
constr1 := [x>=0,y>=0,y-x<=1,x+y<=5,2*x-y<=6];
constr2 := [seq(z<=(b[i]-DotProduct(C[i],<x,y>))/Norm(C[i],2),i=1..5)];

This is the solution using LPSolve.

soln1 := LPSolve(z,[op(constr1),op(constr2)],maximize);

This is the same problem solved with simplex[maximize].

soln2 := simplex:-maximize(z,[op(constr1),op(constr2)]);
evalf(%);

The answer from the simplex package is wrong as the following plots demonstrate.

 

What, if anything, did I do wrong?

constr := [x>=0,y>=0,y-x<=1,x+y<=5,2*x-y<=6]:
P1 := inequal(constr,x=-1..5,y=-1..5,optionsfeasible=[color=yellow]):
Pt1 := subs(soln1[2],[x,y]);
C1 := disk(Pt1,soln1[1],color=red):
display(C1,P1);
Pt2 := subs(soln2,[x,y]);
r2 := subs(soln2,z);
C2 := disk(Pt2,r2,color=red):
display(C2,P1);

 

 

Download inscribe_circle.mw

I have generated the regional plot, but the boundaries between the regions are not clearly marked. How can I highlight the boundaries using a black line or a black dashed line, similar to the example image? What syntax should I use? I have attached my generated image file.

Regional_new.mw


how we solve x^(4)-12*x-12=0, 

mapple sent after solving: RootOf(_Z^4 - 12*_Z - 12, index = 1), RootOf(_Z^4 - 12*_Z - 12, index = 2), RootOf(_Z^4 - 12*_Z - 12, index = 3), RootOf(_Z^4 - 12*_Z - 12, index = 4)

sol:=ln( (y-1)^(1/3)* (y^2+y+1)^(1/3) ) - ln(y) = 2/5* ln(t^2+1)+_C1;
solve( sol,y);

in real domain is fine also. But all my attempts failed. I waited 3-4 minutes each time and stopped it.

Any one can find a trick? Below worksheet showing my attempts and also solution by Mathematica which took 0.3 seconds

Make sure to save all your work first. This problem is known to crash Maple !

restart;

sol:=ln( (y-1)^(1/3)* (y^2+y+1)^(1/3) ) - ln(y) = 2/5* ln(t^2+1)+_C1;
solve( sol,y) assuming real;

ln((y-1)^(1/3)*(y^2+y+1)^(1/3))-ln(y) = (2/5)*ln(t^2+1)+_C1

Warning,  computation interrupted

restart;

sol:=ln( (y-1)^(1/3)* (y^2+y+1)^(1/3) ) - ln(y) = 2/5* ln(t^2+1)+_C1;
RealDomain:-solve( sol,y);

ln((y-1)^(1/3)*(y^2+y+1)^(1/3))-ln(y) = (2/5)*ln(t^2+1)+_C1

Warning,  computation interrupted

restart;
sol:=ln( (y-1)^(1/3)* (y^2+y+1)^(1/3) ) - ln(y) = 2/5* ln(t^2+1)+_C1;
solve( sol,y,real);

ln((y-1)^(1/3)*(y^2+y+1)^(1/3))-ln(y) = (2/5)*ln(t^2+1)+_C1

Warning,  computation interrupted

 


 

Download solve_problem_march_7_2026.mw

 

I have attached a MapleFlow file that shows a result I don't quite understand.  For some reason the FinalValue result that I get using the DynamicSystems:-StepProperties is different than the steady state value from a DynamicSystems:-ResponsePlot to a unit step using a DifferentialEquation object.

You will notice that I played around a bit, including transforming the DiffEquation object to a TransferFunction object, to see if I could make sense of it.  All of the results are the same as the StepProperties result, it appears that only the ResponsePlot for the DifferentialEquation object is different.

Am I doing something wrong?  Does anyone have any ideas?

Dynamic_Systems_Final_Value.flow

How to solve the following system of equations?

restart;
el1 := a[0] = 1;
el2 := a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9]+a[10]+a[11]+a[12]+a[13]+a[14]+a[15] = 3/2+sinh(1);
el3 := a[1] = 1;
el4 := a[1]+2*a[2]+3*a[3]+4*a[4]+5*a[5]+6*a[6]+7*a[7]+8*a[8]+9*a[9]+10*a[10]+11*a[11]+12*a[12]+13*a[13]+14*a[14]+15*a[15] = 1+cosh(1);
el5 := 24*a[4]-(2*(1+c))*a[2]+c*a[0] = -1;
el6 := 24*a[4]+120*a[5]+360*a[6]+840*a[7]+1680*a[8]+3024*a[9]+5040*a[10]+7920*a[11]+11880*a[12]+17160*a[13]+24024*a[14]+32760*a[15]-(1+c)*(2*a[2]+6*a[3]+12*a[4]+20*a[5]+30*a[6]+42*a[7]+56*a[8]+72*a[9]+90*a[10]+110*a[11]+132*a[12]+156*a[13]+182*a[14]+210*a[15])+c*(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9]+a[10]+a[11]+a[12]+a[13]+a[14]+a[15])-(1/2)*c = -1;
el7 := 120*a[5]-(6*(1+c))*a[3]+c*a[1] = 0;
el8 := 120*a[5]+720*a[6]+2520*a[7]+6720*a[8]+15120*a[9]+30240*a[10]+55440*a[11]+95040*a[12]+154440*a[13]+240240*a[14]+360360*a[15]-(1+c)*(6*a[3]+24*a[4]+60*a[5]+120*a[6]+210*a[7]+336*a[8]+504*a[9]+720*a[10]+990*a[11]+1320*a[12]+1716*a[13]+2184*a[14]+2730*a[15])+c*(a[1]+2*a[2]+3*a[3]+4*a[4]+5*a[5]+6*a[6]+7*a[7]+8*a[8]+9*a[9]+10*a[10]+11*a[11]+12*a[12]+13*a[13]+14*a[14]+15*a[15])-c = 0;
el9 := 720*a[6]-(24*(1+c))*a[4]+2*c*a[2]-c = 0;
el10 := 720*a[6]+5040*a[7]+20160*a[8]+60480*a[9]+151200*a[10]+332640*a[11]+665280*a[12]+1235520*a[13]+2162160*a[14]+3603600*a[15]-(1+c)*(24*a[4]+120*a[5]+360*a[6]+840*a[7]+1680*a[8]+3024*a[9]+5040*a[10]+7920*a[11]+11880*a[12]+17160*a[13]+24024*a[14]+32760*a[15])+c*(2*a[2]+6*a[3]+12*a[4]+20*a[5]+30*a[6]+42*a[7]+56*a[8]+72*a[9]+90*a[10]+110*a[11]+132*a[12]+156*a[13]+182*a[14]+210*a[15])-c = 0;
el11 := 5040*a[7]-(120*(1+c))*a[5]+6*c*a[3] = 0;
el12 := 5040*a[7]+40320*a[8]+181440*a[9]+604800*a[10]+1663200*a[11]+3991680*a[12]+8648640*a[13]+17297280*a[14]+32432400*a[15]-(1+c)*(120*a[5]+720*a[6]+2520*a[7]+6720*a[8]+15120*a[9]+30240*a[10]+55440*a[11]+95040*a[12]+154440*a[13]+240240*a[14]+360360*a[15])+c*(6*a[3]+24*a[4]+60*a[5]+120*a[6]+210*a[7]+336*a[8]+504*a[9]+720*a[10]+990*a[11]+1320*a[12]+1716*a[13]+2184*a[14]+2730*a[15]) = 0;
el13 := 40320*a[8]-(720*(1+c))*a[6]+24*c*a[4] = 0;
el14 := 40320*a[8]+362880*a[9]+1814400*a[10]+6652800*a[11]+19958400*a[12]+51891840*a[13]+121080960*a[14]+259459200*a[15]-(1+c)*(720*a[6]+5040*a[7]+20160*a[8]+60480*a[9]+151200*a[10]+332640*a[11]+665280*a[12]+1235520*a[13]+2162160*a[14]+3603600*a[15])+c*(24*a[4]+120*a[5]+360*a[6]+840*a[7]+1680*a[8]+3024*a[9]+5040*a[10]+7920*a[11]+11880*a[12]+17160*a[13]+24024*a[14]+32760*a[15]) = 0;
el15 := 362880*a[9]-(5040*(1+c))*a[7]+120*c*a[5] = 0;
el16 := 362880*a[9]+3628800*a[10]+19958400*a[11]+79833600*a[12]+259459200*a[13]+726485760*a[14]+1816214400*a[15]-(1+c)*(5040*a[7]+40320*a[8]+181440*a[9]+604800*a[10]+1663200*a[11]+3991680*a[12]+8648640*a[13]+17297280*a[14]+32432400*a[15])+c*(120*a[5]+720*a[6]+2520*a[7]+6720*a[8]+15120*a[9]+30240*a[10]+55440*a[11]+95040*a[12]+154440*a[13]+240240*a[14]+360360*a[15]) = 0;

solve({el1, el2, el3, el4, el5, el6, el7, el8, el9, el10, el11, el12, el13, el14, el15, el16}, {a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]});

i need it in  numerical format

I never used Maplets before.

Been learning Explore, which is OK, but the UI does not look good. Too much white spaces between sliders.  So been looking at Maplets to use instead.

Should one just use Maplets to make interactive demos with sliders, buttons, popup menus and so on or use Explore? Which is better?

I do not waste more time learning Explore more if Maplets is a better choice.

If someone here knows Maplets, here is something I just wrote in Explore.  Could this be coded in Maplets to see how it will look like. It took me 30 minutes to make it using Explore and I am no expert in Explore, so hopefully it should not take someone who knows Maplets much time to produce same thing as Maplet. I wanted to see if the UI will look better or same issues with too wasted spaces between sliders.  I assume with Maplets, there is same concept as Explore, with range of variables, and initial values and so on...

I understand one can run Maplet using Maple viewer without needing to have Maple installed on the PC, so this is an advantage.

restart;

ode_1 := diff(x(t),t) = r*x(t) *(1-(x(t)+beta*y(t))/k1):
ode_2 := diff(y(t),t) = k*y(t) *(1-(y(t)+alpha*x(t))/k2):

Explore(DEtools:-DEplot(
     [ ode_1, ode_2],[x(t),y(t)],t=0..max_time,[[x(0)=x0,y(0)=y0]],
     x=0..max_x, y=0..max_y,'labels'=["Elk","Deer"],'dirfield'=[ngrid,ngrid],
     'arrows'='SLIM', #'smalltwo',
     'axes'='boxed', 'color' = blue,'linecolor'='red',#color of solution
     'obsrange'=false,
     'title'="Lotka -Volterra Model of Competition"
     ),
    parameters=[
     [r=0..5,'controller' = 'slider','minorticks'=.1,'snaptoticks'=true, 'label' = "Elk growth rate r",'showlabels'=false,placement='right'],
     [alpha=0..2,'controller' = 'slider','minorticks'=.1,'snaptoticks'=true, 'label' = "Elk competition alpha",'showlabels'=false,placement='right'],
     [k1=100..1000,'controller' = 'slider','minorticks'=10,'snaptoticks'=true, 'label' = "Elk carrying capacity",'showlabels'=false,placement='right'],
     [k=0..5,'controller' = 'slider','minorticks'=.1,'snaptoticks'=true, 'label' = "Deer growth rate k",'showlabels'=false,placement='right'],
     [beta=0..2,'controller' = 'slider','minorticks'=.1,'snaptoticks'=true, 'label' = "Deer competition beta",'showlabels'=false,placement='right'],
     [k2=100..1000,'controller' = 'slider','minorticks'=10,'snaptoticks'=true, 'label' = "Deer carrying capacity",'showlabels'=false,placement='right'],
     [max_time=1..200,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "max time",'showlabels'=false,placement='left'],
     [max_x=1..1000,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "max x",'showlabels'=false,placement='left'],
     [max_y=1..1000,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "max y",'showlabels'=false,placement='left'],
     [x0=1..200,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "Deer initial population",'showlabels'=false,placement='left'],
     [y0=1..200,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "Elk initial population",'showlabels'=false,placement='left'],
     [ngrid=10..30,'controller' = 'slider','minorticks'=1,'snaptoticks'=true, 'label' = "arrows",'showlabels'=false,placement='left']     
    ],
    initialvalues=[r=0.12,k1=600,alpha=1.5,k2=600,k=0.18,beta=1.2,x0=75,y0=100,ngrid=24,max_x=700,max_y=700,max_time=100],
    'adaptview'=true
);

 

 

Download lotka_volterra.mw

Screen shot of the UI

 

How would the above look using Maplets instead of Explore?

I am not sure whether this should be in "create a post" or "ask a question." Let me know if this is more appropriate in "ask a question"

The standing wave equation is given by:

PDE:=diff(u(x,t),t,t)=c^2*diff(u(x,t),x,x)

IBC := {u(x, 0) = A0*cos(Pi*x/L), D[1](u)(0, t) = 0, D[1](u)(L, t) = 0, D[2](u)(x, 0) = 0}

pdsolve(PDE,IBC,numeric)

In my problem, the material is a magneto-elastic material where c, the speed of the acoustic wave, is a function of a magnetic field H.  The material is nonlinear and saturable.  I define it by a 3 segment piecewise nonlinear function of H.  The material response is a result of a sinusoidal H field.  I am interested in solving u(x,t).  

With that, c in the PDE has to be rewritten as c(H(t)), pdsolve gives an error as PDE has to be expressed as a function of u,t, or x.  So I redefine c(H(t)) as c(t).  I ran into another error in pdsolve as the piecewise has to be based on t or x and not H.  

The problem is that depending on H I can go through all 3 segments and back in one cycle and I have to find the corresponding t's for the piecewise.  Now I am driving the material with 100 cycles, I have to find and list all those piecewise transition points which is hardly practical.

Is there any other ways to approach and solve this problem?

Hello Friends.

I have used Maple to create a Polynomial Regression model.  The model is called "PRModel."  It works fine.  The independent variable is "X" and the dependent variable is "Y."  Both X and Y are of the vector variety.  The model is as follows:

PRModel:=PolynomialFit(10, X, Y, summarize = true);

I would like an estimate of Y for each value of X.  I would like the estimates of Y to be in a variable called "estY."   I have not been successful with this.  I have tried many different variations of the following, but have not been successful.  

estY := eval(PRModel, X);

Any suggestions as to how I can capture the estimates of Y? 

Thank you.

i recently noticed that i can no longer access maple transactions, usual link https://mapletransactions.org/index.php/maple/index automatically opens https://scholarsportal.info/, and in that web site, some pages do not open, stating

"The page you are trying to access is restricted to IP addresses from our member universities. Please try accessing this page from on-campus or through a VPN."

this seems like a geo ip restriction, i search for an announcement for this change but i couldn't any, could you please clarify situation?

thanks in advance..

On my journey of discovery through the Maple world, I now want to try out Maple's convenient features in the complex plane, something that used to be laboriously worked out and demonstrated on the blackboard with chalk. I couldn't find a suitable introduction in the help text. I'm interested in whether a package needs to be loaded and how to handle polynomials, series, and line integrals (I have a reasonable understanding only of the theory).

once i founded but  i lost the technique and i can't remember how i can reach the point how to find thus parameter and find the solution of pde

t1.mw

I just found a rather incredible error in versions 2025.1 and 2025.2.

The function works fine in version 2022.

The drag function in solve does not work, even for solving a very simple problem.

For example, in the equation 1 + 5x = 3x - 1, if I try to do 3x from right to left, a box opens with a good suggestion (subtract   1+2x = -1)

# subtract 3*x from both sides
((1)) + ~(3 * x)
we can see that the correct expression should be ((1)) - ~(3 * x)

I finally get:

1 + 8x = 6x -1 (it added and did not subtract 3x from both sides)

Please correct this...

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