MaplePrimes Questions

I seem to recall that a[k] and a(k) are treated interchangeably within a proc.  But I did not expect that to happen at the top level.  See the worksheet below.  Is there a way to keep indexed quantities as indexed?

restart;

kernelopts(version);

`Maple 2025.0, X86 64 LINUX, Mar 24 2025, Build ID 1909157`

A := piecewise(x<0, a[1], a[2]);

A := piecewise(x < 0, a[1], a[2])

int(1/A, x=-1..1);

1/a(1)+1/a(2)

Download mw.mw

I have created an animation of a flexible octahedron (following Bricard) with Maple.   It shows the six vertices and twelve edges.  How do I add the faces (triangles)?  Can the animation show their lines of intersection?

It is not difficult to manually check the validity of the identity  sqrt(x+2*sqrt(x-1)) = sqrt(x-1)+1 , which is true at least for all  x>=1 . I don't know of any Maple command that directly makes this simplification:

expr:=sqrt(x+2*sqrt(x-1));
simplify(expr);
simplify(expr) assuming x>=1;

                          


It was possible to simplify it only by making a variable substitution  x=y+1 (and then a reverse substitution  y=x-1 ) :

expr1:=subs(x=y+1,expr);
simplify(expr1);
subs(y=x-1, %);

                               


By the way,  the CAS Mathematica also cannot cope with simplifying the expression  expr .

I'm working on an optimization problem involving a single decision variable p1, subject to four inequality constraints:

  • Two upper bound constraints:

    p1 < b1,p1 < b2
  • Two lower bound constraints:

    c1 ≤ p1,c2 ≤ p1

Effectively, the feasible region for p1 is:

max⁡(c1,c2)  ≤  p1  ≤  min⁡(b1,b2)

I have already formulated the Karush-Kuhn-Tucker (KKT) conditions for this setup, and now I'm trying to determine:

  1. The optimal value p1∗​

  2. The corresponding feasibility conditions

  3. A case-wise breakdown depending on which constraints are active or inactive


Sheet:  Q_P1_Optimum_condition.mw

in this substitution really is hard to substitute which i don't have idea how find u[1]  u[2] so on becuase  in that term some function like u[i,x] appear and i don't have idea how define them to remove it in my iteration ? and how remove the conjugate of function u[0] i did try evalc(u[0]) and make it worst than this 

which i did some special substitution which i don't know true or not but result is true i didn't have other idea for that
which  instead of any conjugate i use v and istead of any diff(u,x) i use z[i,x] and if conjugate have derivative v[i,x]

k4.mw

Hello,

I need to sort a list of monomials in a custom order based on two criteria:

  1. Increasing total degree (e.g., x<x^2)

  2. Lexicographic order within the same degree, using a specified variable order such as x<y<z.

For example, given the list:

L := [z^2, y*z, x*z, z, y^2, x*y, y, x^2, x, 1] 

and the variable order (which can be changed by the user):

vars := [x, y, z]; 

I would like the output to be:

[1, x, y, z, x^2, x*x, x*y, x*z, y^2, y*z, z^2]

Is there a built-in function or a recommended way to achieve this in Maple?

Thank you!

is easy to determine the linear and non linear part but how we can do it by command specially when contain conjugate part of function even i try to use another function instead of conjugate but stil i didn't got  the result?

restart

with(inttrans)

with(PDEtools)

with(DEtools)

with(DifferentialAlgebra)

"with(Student[ODEs][Solve]): "

with(IntegrationTools)

with(inttrans)

with(PDEtools)

with(Physics)

with(PolynomialTools)

with(RootFinding)

with(SolveTools)

with(LinearAlgebra)

with(sumtools)

declare(u(x, t))*conjugate(u(x, t))*declare(v(x, t))

u(x, t)*`will now be displayed as`*u

 

v(x, t)*`will now be displayed as`*v

 

conjugate(u(x, t))

(1)

pde := u(x, t)+I*(diff(u(x, t), `$`(x, 2)))+2*(diff(u(x, t)*conjugate(u(x, t)), x))*u(x, t)+u(x, t)^2*conjugate(u(x, t))^2*u(x, t) = 0

u(x, t)+I*(diff(diff(u(x, t), x), x))+2*((diff(u(x, t), x))*conjugate(u(x, t))+u(x, t)*(diff(conjugate(u(x, t)), x)))*u(x, t)+u(x, t)^3*conjugate(u(x, t))^2 = 0

(2)

pde_linear, pde_nonlinear := selectremove(proc (term) options operator, arrow; not has((eval(term, u(x, t) = T*u(x, t)))/T, T) end proc, expand(pde))

() = 0, u(x, t)+I*(diff(diff(u(x, t), x), x))+2*u(x, t)*(diff(u(x, t), x))*conjugate(u(x, t))+2*u(x, t)^2*(diff(conjugate(u(x, t)), x))+u(x, t)^3*conjugate(u(x, t))^2 = ()

(3)

u_occurrences := map(proc (i) options operator, arrow; numelems(select(has, [op([op(i)])], u)) end proc, oppde); linear_op_indices := ListTools:-SearchAll(1, u_occurrences); pde_linear := add(oppde[[linear_op_indices]]); pde_nonlinear := expand(simplify(expand(pde)-pde_linear))

Error, invalid input: ListTools:-SearchAll expects its 2nd argument, L, to be of type {list, rtable}, but received 0

 

[linear_op_indices]

 

Error, (in simpl/relopsum) invalid terms in sum: u(x,t)+I*diff(diff(u(x,t),x),x)+2*u(x,t)*diff(u(x,t),x)*conjugate(u(x,t))+2*u(x,t)^2*diff(conjugate(u(x,t)),x)+u(x,t)^3*conjugate(u(x,t))^2 = 0

 
 

NULL

Download solving.mw

Wondering what the experts here think of this. Should not simplify have worked on this automatically? By trial and error, found that combine command is what simplified it the best.

But I think simplify should also have done the same.  

Interested to hear what others think, and why simplify (even using trig option) did not do it.   

The issue is that this is done in code, without lookin at the screen and deciding what to do based on what the expression "looks like".

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

A:=(((sin(sqrt(3)/2)*sqrt(3) - 3*cos(sqrt(3)/2))*cos(sqrt(3)*x/2) - sin(sqrt(3)*x/2)*(sqrt(3)*cos(sqrt(3)/2) + 3*sin(sqrt(3)/2)))*exp(-1/2 + x/2))/3 ;

(1/3)*((sin((1/2)*3^(1/2))*3^(1/2)-3*cos((1/2)*3^(1/2)))*cos((1/2)*3^(1/2)*x)-sin((1/2)*3^(1/2)*x)*(3^(1/2)*cos((1/2)*3^(1/2))+3*sin((1/2)*3^(1/2))))*exp(-1/2+(1/2)*x)

B:=- exp(-1/2 + x/2)*(sqrt(3)*sin(sqrt(3)*(x - 1)/2) + 3*cos(sqrt(3)*(x - 1)/2))/3;

-(1/3)*exp(-1/2+(1/2)*x)*(3^(1/2)*sin((1/2)*3^(1/2)*(x-1))+3*cos((1/2)*3^(1/2)*(x-1)))

simplify(A-B); #show these are same

0

simplify(A,trig)

-(1/3)*((-sin((1/2)*3^(1/2))*3^(1/2)+3*cos((1/2)*3^(1/2)))*cos((1/2)*3^(1/2)*x)+sin((1/2)*3^(1/2)*x)*(3^(1/2)*cos((1/2)*3^(1/2))+3*sin((1/2)*3^(1/2))))*exp(-1/2+(1/2)*x)

simplify(A)

-(1/3)*((-sin((1/2)*3^(1/2))*3^(1/2)+3*cos((1/2)*3^(1/2)))*cos((1/2)*3^(1/2)*x)+sin((1/2)*3^(1/2)*x)*(3^(1/2)*cos((1/2)*3^(1/2))+3*sin((1/2)*3^(1/2))))*exp(-1/2+(1/2)*x)

simplify(A,size)

-(1/3)*((-sin((1/2)*3^(1/2))*3^(1/2)+3*cos((1/2)*3^(1/2)))*cos((1/2)*3^(1/2)*x)+sin((1/2)*3^(1/2)*x)*(3^(1/2)*cos((1/2)*3^(1/2))+3*sin((1/2)*3^(1/2))))*exp(-1/2+(1/2)*x)

simplify(normal(A))

-(1/3)*((-sin((1/2)*3^(1/2))*3^(1/2)+3*cos((1/2)*3^(1/2)))*cos((1/2)*3^(1/2)*x)+sin((1/2)*3^(1/2)*x)*(3^(1/2)*cos((1/2)*3^(1/2))+3*sin((1/2)*3^(1/2))))*exp(-1/2+(1/2)*x)

combine(A); #finally

(-(1/3)*3^(1/2)*sin((1/2)*3^(1/2)*(x-1))-cos((1/2)*3^(1/2)*(x-1)))*exp(-1/2+(1/2)*x)

 

 

Download simplify_vs_combine_june_4_2025.mw

How can I rearrange the inequality to isolate p1​ on one side?
I'm currently using the 'isolate' function, but it's returning expressions with the signum function.

Q_isolate.mw

This could be unrelated to V 26 of support tools and it could be a bug that existed in Maple before.

But no time for me to check now. Thought to ask about it before I forget.

When adding Physics:-Setup('assumingusesAssume'=true):  Maple generated internal error that can not be cought.

This is using latest V 26 of support tools

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 26 and is the same as the version installed in this computer, created June 3, 2025, 23:49 hours Eastern Time.`

restart;

ode:=diff(y(x),x) = (ln(y(x))^2+2*_C1)^(1/2)*y(x);
sol:=y(x) = exp((-2*_C1)^(1/2));
try
   timelimit(30,(odetest(sol,ode) assuming positive));
catch:
   print("cought error ok");
end try;

diff(y(x), x) = (ln(y(x))^2+2*_C1)^(1/2)*y(x)

y(x) = exp((-2*_C1)^(1/2))

-(ln(exp(I*2^(1/2)*_C1^(1/2)))^2+2*_C1)^(1/2)*exp(I*2^(1/2)*_C1^(1/2))

restart;

ode:=diff(y(x),x) = (ln(y(x))^2+2*_C1)^(1/2)*y(x);
sol:=y(x) = exp((-2*_C1)^(1/2));
Physics:-Setup('assumingusesAssume'=true):
try
   timelimit(30,(odetest(sol,ode) assuming positive));
catch:
   print("cought error ok");
end try;

diff(y(x), x) = (ln(y(x))^2+2*_C1)^(1/2)*y(x)

y(x) = exp((-2*_C1)^(1/2))

Error, (in type/complex) too many levels of recursion

 

 

Download type_complex_recursion_june_4_2025_V26_support.mw

Doing multibody analysis on a ridig body results in

Turning quaternions on

Since I do not understand quaternions very well I was wondering why q0 is listed two times (why does the system uses 8 generalized coordinates for 7 degrees of freedom).

Ridig body help says about quaternions:Indicates whether the 3-D rotations will be represented as a four parameter quaternion or as three Euler angles.  Regardless of the setting, the initial conditions are specified with Euler angles.

Is that representation only internal? Can quaternions be probed?

To familarize myself with quaternions in MapleSim I would be greatfull for any examples using them. Are there any?

In which situations shall I use quaternions in MapelSim?

And what by way the stands q0slack in the above screen shot for?

I was debugging another Maple problem and found this.

According to help, it says

Computations performed using assuming do not affect computations performed before or after calling assuming.

But this example below shows this is not the case at all.

I used hasassumptions(y(x)); before calling a command that uses assuming, and it gave false as expected since there are no assumption put on y(x).

After the command is complete, now I find that  hasassumptions(y(x)); returns true  which is wrong. 

This only happens when adding Physics:-Setup('assumingusesAssume'=true); and also when the command that uses assuming timesout.

But from help, this should not cause this. Here is the help on this

assumingusesAssume
  true or false.

The default for this option is true, so that, when Physics is loaded, the Maple assuming command uses Physics:-Assume to place temporary assumptions. This makes the assuming command fully compatible with the Physics, DifferentialGeometry, DifferentialAlgebra and VectorCalculus packages. It is recommended to not change this setting. If assumingusesAssume is set to false, temporary assumptions placed by assuming are placed using the assume command, which redefines the variables receiving assumptions, so that, depending on the computation, the commands of these packages mentioned will fail in recognizing them within expressions (for example: when placing assumptions on the coordinates and computing with the spacetime metric).

Could someone please explain in very simple terms (as I find all this very confusing), why that after calling a command which uses assuming, I find my variables have assumption still attached to them? 

Because of this, commands that uses these variables after this will and could fail depending on what command is used.

This explains many of the problems I am seeing when using assuming command.  

My question is simple: Should any variable which did not have assumptions on it, still not have assumptions on it after using assuming regadless if the command that uses assuming timedout or not?

Notice that I am not even using the Physics package explicitly anywhere in the following. I am just called odetest with timeout.

Here is worksheet to illustrate this.

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 23 and is the same as the version installed in this computer, created June 2, 2025, 12:08 hours Eastern Time.`

restart

 

#this shows no assumptions on y(x);
ode:=y(x)*sqrt(1 + diff(y(x), x)^2) - a*y(x)*diff(y(x), x) - a*x = 0:
sol:=-_C4^2 + (-y(x)*sqrt(_C4^2/y(x)^2) + a*x)^2/a^2 + y(x)^2 = 0;
hasassumptions(y(x));
getassumptions(y(x));

-_C4^2+(-y(x)*(_C4^2/y(x)^2)^(1/2)+a*x)^2/a^2+y(x)^2 = 0

false

{}

#now use a command that uses assuming
Physics:-Setup('assumingusesAssume'=true):
timelimit(10,(odetest(sol,ode,y(x)) assuming integer)):

Error, (in simplify/sqrt/local) time expired

 

#this shows that y(x) has assumptions still stuck on it.

hasassumptions(y(x));
getassumptions(y(x));

true

{a::integer, x::integer, (-(-csgn(1/y(x))*a*x+(y(x)^2*a^4+csgn(1/y(x))^2*a^2*x^2+a^4*x^2-y(x)^2*a^2-a^2*x^2)^(1/2))/(a^2-1)+x)::0, ((csgn(1/y(x))*a*x-(y(x)^2*a^4+csgn(1/y(x))^2*a^2*x^2+a^4*x^2-y(x)^2*a^2-a^2*x^2)^(1/2))/(a^2-1)-x)::0, ((csgn(1/y(x))*a*x+(y(x)^2*a^4+csgn(1/y(x))^2*a^2*x^2+a^4*x^2-y(x)^2*a^2-a^2*x^2)^(1/2))/(a^2-1)-x)::0, ((csgn(1/y(x))*a*x+(y(x)^2*a^4+csgn(1/y(x))^2*a^2*x^2+a^4*x^2-y(x)^2*a^2-a^2*x^2)^(1/2))/(a^2-1)+x)::0}

 

 

Download why_variable_have_assumption_june_3_2025.mw

My quess is this: Because the command that uses assuming timedout, Maple failed to remove/clear any temporary assumptions it added to the variables involved.   But this only happens when using Physics:-Setup('assumingusesAssume'=true):

If the command did not timeout, this does not happen. At least on some examples I tried this on.

Dear All,

I am facing some problems. This kind of error has been shown: "Error, attempting to assign to `D` which is protected.  Try declaring `local D`; see ? protect for details."

RSM_model.mw

restart;
with(geometry);

triangle(ABC, [point(A, a, b), point(B, c, d), point(C, e, f)]);
AreCollinear: hint: could not determine if a*d-a*f-b*c+b*e+c*f-d*e is zero
Error, (in geometry:-triangle) not enough information: the three points might be AreCollinear

assume(a*d - a*f - b*c + b*e + c*f - d*e <> 0);

triangle(ABC, [point(A, a, b), point(B, c, d), point(C, e, f)]);
                              ABC

area(ABC);
                   

What does the ~ after the point variables supposed to mean?

Hello, 

I'm working on a Maple package that manages external processes via TCP connections. I'm using ModuleUnload for cleanup, but I need to better understand how it behaves during Maple termination.

The issue:
- I have a module that manages external processes (via TCP connections)
- I implemented ModuleUnload to kill these processes when the module is unloaded
- ModuleUnload works perfectly when using 'restart' 
- However, when closing the Maple window, the external processes remain active

Investigation:
Using 'lsof', I observed that:
   - When Maple closes, it properly closes its TCP connection (goes to CLOSE_WAIT state)
   - But the external processes remain active

Questions:
1. Is this the expected behavior of ModuleUnload during session termination?
2. Are there alternative approaches to ensure cleanup when Maple is closed?

Any insights or suggestions would be greatly appreciated!
Thanks!

5 6 7 8 9 10 11 Last Page 7 of 2425