## Specify the width of `lprint`'s output?...

`lprint` is officially interpreted as “linear printing of expressions”, but in the most recent release, its output looks just like "left printing" (under the default zoom 100%),

while in some legacy version, `lprint` printed expressions not only on the left but also on the right.

How to render `lprint` print its arguments not only on the left half?
Although I believe that similar questions must have been asked before, I cannot find such a question.

Code:

```lprint(_bigPi):
showstat(ellipsoid)
```

## Error, (in simplify/RootOf) too many levels of rec...

I've reported this to Maplesoft 6 months ago.

I was wondering if someone with beta version of 2024 could check if these are fixed? (if one is allowed to do so). As these errors keep breaking my program. (not possible to trap).

 > interface(version);

 > Physics:-Version();

 > ode:=diff(y(x),x) = (x*y(x)+x^3+x*y(x)^2+y(x)^3)/x^2; sol:=exp(3*sum(1/(9*_R^2-1)*ln((-_R*x+y(x)-1/3*x)/x),_R = RootOf(27*_Z^3-9*_Z+29)))-c__1*exp(x) = 0; odetest(sol,ode);

Error, (in simplify/RootOf) too many levels of recursion

 > ode:=diff(u(x),x)-1/2*(2*a*u(x)^3+u(x)+2*b)/x = 0; sol:=2*sum(1/(6*_R^2*a+1)*ln(u(x)-_R),_R = RootOf(2*_Z^3*a+_Z+2*b))-1/2*ln(x)-_C1 = 0; odetest(sol,ode);

Error, (in simplify/RootOf) too many levels of recursion

 >

## how to call dsolve with _homogeneous, `class G` m...

Maple dsolve allows one to specify the algorithm to use to solve the ode. But sometimes it is very tricky to figure the syntax,

This ode

```ode:=diff(y(x),x)*y(x)+a*x*y(x)+b*x^3=0;
```

Gives

[[_homogeneous, `class G`], _rational, [_Abel, `2nd type`, `class A`]]

I wanted now to call dsolve telling dsolve to use the first method above. But how? All the following syntax failed for me

```sol:=dsolve(ode,['_homogeneous, `class G`']);
sol:=dsolve(ode,'[_homogeneous, `class G`]');
```

I am sure I am using wrong syntax but do not know what the correct one should be.

```infolevel[dsolve]:=5;
sol:=dsolve(ode);

```

gives

```Methods for first order ODEs:
--- Trying classification methods ---
trying 1st order linear
trying Bernoulli
trying separable
trying inverse linear
trying homogeneous types:
trying homogeneous G
<- homogeneous successful
```

With long solution printed now OK.

When using just '[homogeneous]' it works

```sol:=dsolve(ode,'[homogeneous]');
```

It gives same solution as default case.

What is the correct syntax to tell dsolve to use specific method [_homogeneous, `class G`] ? i.e. I need to add class G

The reason I ask is becuase Maple have different kind of homogeneous method as described here

Maple 2023.2.1 on windows 10

## Match the `seq` modifier?...

It seems that `applyrule` cannot handle variable numbers of arguments, and I cannot use something like

```applyrule(f(u::anything, v::seq(anything)) = g(v, u), [f(x, y, z), f(x, y, z, t)]);
=
[f(x, y, z), f(x, y, z, t)]

```

Strangely, Maple does support the identical patterns in parameter declarations:

```eval([f(x, y, z), f(x, y, z, t)], f = ((u::anything, v::seq(anything)) → g(v, u)));
=
[g(y, z, x), g(y, z, t, x)]

```

So the two designs do not appear coherent. Should this be regarded as a "bug" in a sense?

Of course there is no need to use the  modifier; here it is enough to use

`evalindets([f(x,y,z),f(x,y,z,t)],'specfunc'(anything,f),w->g(op(2..(),w),op(1,w))):`
`use f = MakeFunction('g(args[2 .. ], args[1])') in [f(x, y, z), f(x, y, z, t)] end:`
```use f = unapply('g(_rest, _w)', [_w::anything]) in [f(x, y, z), f(x, y, z, t)] end:
```

But the problem is, why is there such inconsistency described above?

## how to obtain this simplification in Maple. Automa...

Given equation

We see this can be simplified to

In Mathematica, I just need to tell it the denominator of the left side is not zero for it to do the simplification

The same thing in Maple did not work:

```eq:= (y-2*x)^3/( (y-x)^2 * x ) = a/x;
the_denom:= denom(lhs(eq));
simplify(eq) assuming the_denom <>0

```

No change.

I am doing this in code not by looking at the screen and simply wanted to eliminate common terms on both sides of equation. I can in code obtain the denominator of the LHS and RHS and add assumption. But since I do not know what if any common terms are on both sides, it is not easy to use elminate.

I see code at https://www.mapleprimes.com/questions/227043-How-To-Automatically-Cancel-Any-Common which actually worked on this and it did automatically elminate x from both sides.

But my question is: why Maple does not do it using simplify with the assumption given?  Tried simplify with size and no change.

I am looking for the simplist method to elminate common terms on both sides of equation. Is the link above the only way to do this in Maple? May be there is something simpler in recent Maple versions?

```
#code from https://www.mapleprimes.com/questions/227043-How-To-Automatically-Cancel-Any-Common

restart;

eq:= (y-2*x)^3/( (y-x)^2*x) = a/x;
TT := simplify(expand((eq)),size):
if lhs(TT)::`*` and rhs(TT)::`*` then
TTT := map[2](map,freeze,TT);
comm := `*`(op({op(lhs(TTT))} intersect {op(rhs(TTT))}));
new := simplify(thaw(lhs(TTT)/comm=rhs(TTT)/comm));
end if:
new

```

May be this should be part of Maple build in functions and used by simplify?

Update

I just hit on a way to do this automatically with no assumption of anything. The idea is to simply rewrite the equation, like this

```restart;

eq:= (y-2*x)^3/( (y-x)^2 * x ) = a/x;
numer(lhs(eq))*denom(rhs(eq)) /  (denom(lhs(eq)) *numer(rhs(eq)))=1;
```

You see, the common term on both sides is automatically gone!   I need to test this more.

To moderator: if you think this question is duplicate, feel free to delete it.

## Analogues to reduction rules in `evalindets` or `s...

Although I still prefer `applyrule` (as `evalindets`/`subsindets` is not as intuitive as `applyrule`),  I have heard that it is regarded as being more or less antiquated in modern Maple. I notice that a lot of (yet not all) examples given in the help pages of `evalindets`/`subsindets` can be reformulated by `applyrule`, but does any use of `applyrule` also correspond to using `evalindets`/`subsindets`? And if so, how to equivalently rewrite those transformation rules (especially complicated ones like nested function applications) in the syntax of `evalindets`/`subsindets`?

## parsing question. How to check expression contains...

Given an expression expr, and symbol, say I wanted to check that only shows as argument to a specific Maple function. In this case, say ln() just an example but this can be any other function.

But if shows up in the expression but not as argument to ln() then I want to detect this also. So the function is passed the expression and the symbol name, and it returns true or false.

True means the symbol only shows inside ln and false means it found in the expression but not inside ln()

I can find all indets where the symbol shows inside the function. But the problem is how to find if the symbol shows outside of the function?

I think I need to use depends() somehow. But could not figure out how do far. Below is the code I have and few test examples and the result expected.

```is_symbol_inside_func_only:=proc(expr::anything,f,y::symbol)::truefalse;
local the_type:=`Or`(
'specfunc( `&*`(anything,identical(y)), f )',
'specfunc( identical(y), f )'  ,
'specfunc( `&+`(anything,identical(y)), f )'
);
local T;
T:=indets(expr, the_type );
print(T);

#need to check that y does not show any where inside expression unless
#as argument to f

RETURN(true); #or RETURN(false);
end proc:
```

Here some test cases

```expr:=3*ln(1+y)+ln(3*y)*y+ln(y)+cos(7*y);
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=3*ln(1+y)+ln(3*y);
is_symbol_inside_func_only(expr,ln,y); #should return true

expr:=ln(y)+ln(3*y)+cos(y);
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=3+cos(y);
is_symbol_inside_func_only(expr,cos,y); #should return true

expr:=y+ln(y);
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=-1/2*ln(y-1)+1/3*ln(y)+1/6*ln(y-3):
is_symbol_inside_func_only(expr,ln,y); #should return true
```

some context: I wanted to apply exponential to an expression to convert all ln(y)+ln(1+y)+...  to exp(...) to make it easy to process.

But wanted to do this ONLY if all terms that has are functions on ln otherwise, I will not raise it to exp in this case. The expression will always have the symbol in it. So need to worry about this case.

Update

After asking the question, I thought about using selectremove and it seems to do what I want. But need to test it more.

```is_symbol_inside_func_only:=proc(expr::anything,f,y::symbol)::truefalse;
local the_type:=`Or`(
'specfunc( `&*`(anything,identical(y)), f )',
'specfunc( identical(y), f )'  ,
'specfunc( `&+`(anything,identical(y)), f )'
);
local hasF,nothasF;
hasF,nothasF:=selectremove(hastype,expr,the_type);
if has(nothasF,y) then
RETURN(false);
else
RETURN(true);
fi;
end proc:
```

Here is the result

```expr:=3*ln(1+y)+ln(3*y)*y+ln(y)+cos(7*y):
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=3*ln(1+y)+ln(3*y):
is_symbol_inside_func_only(expr,ln,y); #should return true

expr:=ln(y)+ln(3*y)+cos(y):
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=3+cos(y):
is_symbol_inside_func_only(expr,cos,y); #should return true

expr:=y+ln(y):
is_symbol_inside_func_only(expr,ln,y); #should return false

expr:=-1/2*ln(y-1)+1/3*ln(y)+1/6*ln(y-3):
is_symbol_inside_func_only(expr,ln,y); #should return true

```

Update

I just found my function has a bug. I added one more test case. so you can ignore my function and use any of the other ones given in the answers below.

Maple 2023.2.1

## How to fix a random change of characters in the Ma...

Hi,

is there fix for the following quirk in the Maple 2023 editor:

randomly (hours, days) some characters change their appearance like p.e. the = sign becomes d-bold or sigma becomes s-bold. I have never experienced this in previous versions.

## Message : "Error, (in assuming) when calling 'assu...

Hi, maybe someone knows how to fix this:

"Error, (in assuming) when calling 'assume'. Received: 'question.mw'"

I am attaching the corresponding maple file. I've never met such an error message, and unfortunately the Maplesoft help does not contain any information about such an issue :

 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)
 >
 (7)
 >
 (8)
 >
 (9)
 >
 (10)
 >
 >

## Why do I get different outputs?...

> ode_sys:=2*diff(x(t),t\$2) + 6*x(t) - 2*y(t) = 0, diff(y(t),t\$2) + 2*y(t) - 2*x(t) = 0:
> lsol:=inttrans:-laplace({ode_sys},t,s)

The displayed output has an unresolved  "=  inttrans/laplace`(0, t, s)" on the end.

> lsol

Does not. Why?

## How to solve ODE reptitive...

Dear power users, I am still struggling with relative simple tasks and do hope that some of you can help me in the right direction. Solving an ODE is straightforward in Maple. But how do you solve an ODE with multiple inputs, as shown in the attached worksheet. I would appreciate any help with respect to my question. I would also like to wish all of you a good ending of 2023 and a brilliant start in 2024.

MapleprimesODE_Question.mw

## How do I get an absolute value of an exponential? ...

Hi, will happy to find out how can I get the proper answer for the expression following:

abs(exp(I*k*x))?

I expected to get 1

Bu actually I've got

e^R(Ikx)

Futhermore, Maple also doesn't calculate any absolute values of complex expressions, only adds the brackets.

## How do I control the stacking order of plot struct...

For example, I would like to draw the following figure in Maple.

(The above figure is taken from MatLab's documentation.)
Here are these four graphics objects:

```use plottools, ColorTools in
l0, l1 := line~([<1 | 0>, <1 | 1>], [<6 | 5>, <6 | 6>], 'color' =~ Color~(["#0072BD", "#D95319"]))[];
r0, r1 := rectangle~([[2, 0], [4, 0]], [[3, 6], [5, 6]], 'color' =~ Color~([[.6, .7, .9], [.95, .7, .6]]))[]
end:```

However, either

``plots/display`([r1, l1, l0, r0], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")`

or

``plots/display`([r0, l0, l1, r1], 'axes' = "boxed", 'size' = ["default", "golden"], 'style' = "patchnogrid")`

outputs the same graphical image where the lines are always rendered on top of each rectangles instead of the other way around.

So how to superimpose the right rectangle over the two lines? To put it differently, how to handle the graphics hierarchy? I have read some similar questions like Order in plots:-display - MaplePrimes, yet I cannot find any workarounds.

Note that in my opinion, the result should comprise two unbroken line segments rather than four subordinate line segments!

## why can't Maple solve these two linear equations?...

is it possible to find why Maple fails to solve these two equations in two unknowns? Has this always been the case? I do not have older versions of Maple to check. The trace shows that it found solution but then itg says no solution was found. This is very strange.

 > interface(version)

 > Physics:-Version()

 > restart;

 > sol:=1/4*exp(-t) * (c2*(-1+exp(4*t)) + c1*(3+exp(4*t))): expand(simplify(sol));

 > eq1:=-3=eval(sol,t=4): expand(simplify(eq1));

 > eq1:=-17=eval(diff(sol,t),t=4); expand(simplify(eq1));

 > infolevel[solve]:=5; solve([eq1,eq2],[c1,c2])

Main: Entering solver with 2 equations in 2 variables

Main: attempting to solve as a linear system

Linear: solving 2 linear equations

Algebraic: # equations is: 2

Main: Linear solver successful. Exiting solver returning 1 solution

solve: Warning: no solutions found

For reference this is the solution given by Mathematica

## tricky ode with IC. Why this verification fail?...

Maple does not give solution to this first order ode with IC, if asked to do it implicit. It only solves it explicit.

```ode := diff(y(x), x) - 2*(2*y(x) - x)/(x + y(x)) = 0;
ic:=y(0)=2;
dsolve([ode,ic],'implicit'); #maple gives no solution when implicit!```

Then I asked Maple for an implicit solution but with no IC. Then solved for the constant of integration myself, and plugged this back in the solution. But odetest now says the initial conditions do not verify.

Here are the steps I did to solve for the constant of integration. I do not see any error I made. Does any one see where my error is and why odetest does not verify the solution for IC?

This first order ode has unique solution. Here is my worksheet.

 > restart;

 > ode := diff(y(x), x) - 2*(2*y(x) - x)/(x + y(x)) = 0; ic:=y(0)=2; dsolve([ode,ic],'implicit'); #maple gives no solution when implicit!

 > #lets now try finding the constant of integration ourself sol:=dsolve(ode,'implicit')

 > #setup equation and plugin the IC. Raise both sides to exp. RHS becomes 1 eq:=exp(lhs(sol))=1;

 > simplify(eq,exp);

 > #plugin in y=2 at x=0 eval(%,[y(x)=2,x=0]);

 > #solve for constant of integration solve(%,c__1)

 > #subtitute back in the solution sol:=eval(sol,c__1=%);

 > #verify. Why it failed check on IC?? Notice it is not [0,0]. odetest(sol,[ode,ic])

 >