Maple 2022 Questions and Posts

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

I teach high school math where we use Maple. Some times some students who use Maple 2022 on Mac computers both older and new version of the OS, experience that the document won't react to simple things like plot, solve of loading packages with the "with" command. 

Any idea could be causing this? Because the error goes away if we load a new document within Maple or restart the program.

Found integration problem which causes server.exe to crash each time. I hope this can be used to help find why server.exe keeps crashing much more than before in Maple 2022.

 

This happens each time. The above is a typical example of what I have been saying all the time above server.exe crashing. It should not do that. If it can not solve the problem, it should simply return.

I hope these problems will be fixed in Maple 2023.

Any one can figure why it crashes?

Attached worksheet.


 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

integrand:=(2*x^2022+1)/(x^2023+x);
int(integrand,x);

(2*x^2022+1)/(x^2023+x)


 

Download crash_feb_3_2023.mw

 

This question stems from a previous question that has been perfectly resolved by acer and Carl Love, but as Carl Love mentioned the foldl function, today I attempted to experience its functionality (In order to understand the foldl or foldr function). But I encountered a small issue. 

s:="[ (0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5),
(4, 9), (5, 6), (6, 7), (7, 8),(8, 9), (10, 11), (11, 12),
(11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]";
with(StringTools):
L1:= "()[]": L2:= "{}{}":
X:=foldl(SubstituteAll,s,op([L1[1],L2[1]]),op([L1[2],L2[2]]),op([L1[3],L2[3]]),op([L1[4],L2[4]]));

Error, (in StringTools:-SubstituteAll) expecting 3 arguments, but got 2

I find it strange that foldl doesn't recognize SubstituteAll with three arguments. 

Isn't s and op([L1[i], L2[i]]) providing three arguments? Of course, s is constantly changing.

 

The goal is to replace the above string with:

{ {0, 1}, {1, 2}, {1, 10}, {2, 3}, {3, 4}, {4, 5},

    {4, 9}, {5, 6}, {6, 7}, {7, 8},{8, 9}, {10, 11}, {11, 12},

    {11, 16}, {12, 13}, {13, 14}, {14, 15}, {15, 16}}

 

Hey guys

I have a question using the piecewise function:

fa := unapply(piecewise(0 < x and x < a, k1, a < x and x < b, k2), x);

simplify(fa(x)) assuming 0 < a, 0 < x and x < a;

It should return k1, but it doesn't. Does anyone have a solution?

Sincerely,

Oliveira

I was looking for rewriting some expression in simpler forms and ened up getting wrong values from maple

Is something wrong on how I'm using it or is this a bug ?

This is the code with the output:

> NumericStatus(invalid_operation=false):
> simplify(sum(
>         (A-B)
>         *(-1+combinat:-binomial(N-2,i))
>         *(A)^(i)
>         *(B)^(N-2-i)
>     ,i=0..N-2));
                                                    (N - 1)    (N - 1)
                                                   B        - A



> NumericStatus(invalid_operation);
                                                          false

 

This is the wrong answer, is missing the part with the binomial, somehow its set to zero but the NumericStatus is still telling that everythig is fine.
It has not issues when one replaces the N-2 with N,

> simplify(sum(
>         (A-B)
>         *(-1+combinat:-binomial(N,i))
>         *(A)^(i)
>         *(B)^(N-i)
>     ,i=0..N));
                                          (N + 1)    (N + 1)                  N
                                         B        - A        + (A - B) (A + B)

> NumericStatus(invalid_operation);
                                                          false

 

If I drop the (-1) in front I get the right contribution from the binomial regardless of using N or N-2

> simplify(sum(
>         (A-B)
>         *(combinat:-binomial(N-2,i))
>         *(A)^(i)
>         *(B)^(N-2-i)
>     ,i=0..N-2));
                                                   /A + B\N          N
                                                   |-----|  (A - B) B
                                                   \  B  /
                                                   -------------------
                                                               2
                                                        (A + B)

> NumericStatus(invalid_operation);
                                                          false

which is equal to (A+B)^(N-2)*(A-B)

If I use assume(N>2) it still gives the same result but this time is flagged ad an invalid operation (which is not supposed to).
Interesting enough also if I set assume(N>0) in the second example gives me invalid_operation=true but return the correct result.

Let a, b be arbitrary real parameters. I intend to compute something like: (with exact piecewise output) 

Optimization:-Maximize(8*x + 7*y, {5*y <= 6 - 9*b, -6*x - 4*y <= 8 - 5*a - 7*b, -4*x + 7*y <= -1 - 2*a - 7*b, -x + y <= 6 + 4*a - 5*b, 7*x + 5*y <= a + 4*b}, variables = {x, y}): # Error
Optimization:-Minimize((x - 1)^2 + (2*y - 1)^2, {x - 2*y <= 2*a - b + 1, x + 2*y <= a + b, 2*x - y <= a - b + 1}, variables = {x, y}): # Error

Unfortunately, these Maple codes are virtually invalid, and the relevant commands minimize, maximize, extrema, and Student[MultivariateCalculus][LagrangeMultipliers] do not support general inequality constraints. Is it possible to tackle these small-scale constrained parametric problems in Maple?

I run the following command.

$ maple2022/bin/maple -q problem.mpl

where problem.mpl is the following:

with(Student[Calculus1]):
ShowSolution(Diff(ln(x),x));

I get the following output.

Differentiation Steps
    Diff(ln(x),x)
▫    1. Apply the natural logarithm rule
        ◦ Recall the definition of the natural logarithm rule
        Diff(ln(x),x) = x^(-1)
    This gives:
    x^(-1)

I want the solver to use 1/x instead of x^(-1) in the output. How can I achieve this?

P.S. I require the output to be parsable, so using output=print to show fractions in a multi-line fashion is not a solution for me.

Hi! 

I've been working on a file in Maple, and saved it yesterday - but now I am not able to open it, as it is corrupted. I have been able to find the back up file, HOWEVER I am not able to load half of the file as Maple comes up with a "there was a problem loading your file....". Is there anything I can do to repair the back up file? 

Any help is greatly appreciated!

Back up file is here: C_Users_jonas_OneDrive_Skrivebord_Mat_B-A_Hjemmeopgavesæt_Opgavesæt_1115_MAS_-_Kopi.mw

I'm having trouble performing a direct operation, involving DotProduct, in the piecewise function. Attached is a document. I appreciate any contribution.

Regards,

Oliveira

Example2.mw

Hi,

I am new to Maple and I couldn't really find anything about this problem. Why doesn't Maple automatically simplify the last expression in the following? (see for example the first and last terms, as well as other terms)

total := (((((D^2/(alpha^2*mu^2) + D^2*exp(2*(-t + t1)*alpha*mu)/(alpha^2*mu^2)) + D^2*exp(2*(-t + t1)*alpha*mu)/(alpha^2*mu^2)) + D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) - (-alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) + exp(2*(-t + t1)*alpha*mu))*D*D1/(mu^2*alpha^2*(alpha^2*mu^2*tau0^2 - 1)) + (alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) - exp(2*(-t + t1)*alpha*mu))*D1*D/(alpha^2*mu^2*(alpha^2*mu^2*tau0^2 - 1))) - (-alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) + exp(2*(-t + t1)*alpha*mu))*D*D1/(mu^2*alpha^2*(alpha^2*mu^2*tau0^2 - 1))) + (alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) - exp(2*(-t + t1)*alpha*mu))*D1*D/(alpha^2*mu^2*(alpha^2*mu^2*tau0^2 - 1)) + D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) + D1^2/((alpha*mu*tau0 + 1)^2*alpha^2*mu^2) - (alpha*mu*tau0*exp(-(-t + t1)*(alpha*mu*tau0 - 1)/tau0) + alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 - 1)/tau0) - alpha^2*mu^2*tau0^2 - 1)*D1^2/(alpha^2*mu^2*(alpha^4*mu^4*tau0^4 - 2*alpha^2*mu^2*tau0^2 + 1))) - (alpha*mu*tau0*exp(-(-t + t1)*(alpha*mu*tau0 - 1)/tau0) + alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 - 1)/tau0) - alpha^2*mu^2*tau0^2 - 1)*D1^2/(alpha^2*mu^2*(alpha^4*mu^4*tau0^4 - 2*alpha^2*mu^2*tau0^2 + 1))

D1^2/((alpha*mu*tau0 + 1)^2*alpha^2*mu^2) + 2*D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) + D^2/(alpha^2*mu^2)

r2r2 := %;
 

total - r2r2;

((((((D^2/(alpha^2*mu^2) + D^2*exp(2*(-t + t1)*alpha*mu)/(alpha^2*mu^2)) + D^2*exp(2*(-t + t1)*alpha*mu)/(alpha^2*mu^2)) + D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) - (-alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) + exp(2*(-t + t1)*alpha*mu))*D*D1/(mu^2*alpha^2*(alpha^2*mu^2*tau0^2 - 1)) + (alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) - exp(2*(-t + t1)*alpha*mu))*D1*D/(alpha^2*mu^2*(alpha^2*mu^2*tau0^2 - 1))) - (-alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) + exp(2*(-t + t1)*alpha*mu))*D*D1/(mu^2*alpha^2*(alpha^2*mu^2*tau0^2 - 1))) + (alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 + 1)/tau0) - exp(2*(-t + t1)*alpha*mu))*D1*D/(alpha^2*mu^2*(alpha^2*mu^2*tau0^2 - 1)) + D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) + D1^2/((alpha*mu*tau0 + 1)^2*alpha^2*mu^2) - (alpha*mu*tau0*exp(-(-t + t1)*(alpha*mu*tau0 - 1)/tau0) + alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 - 1)/tau0) - alpha^2*mu^2*tau0^2 - 1)*D1^2/(alpha^2*mu^2*(alpha^4*mu^4*tau0^4 - 2*alpha^2*mu^2*tau0^2 + 1))) - (alpha*mu*tau0*exp(-(-t + t1)*(alpha*mu*tau0 - 1)/tau0) + alpha*mu*tau0*exp((-t + t1)*(alpha*mu*tau0 - 1)/tau0) - alpha^2*mu^2*tau0^2 - 1)*D1^2/(alpha^2*mu^2*(alpha^4*mu^4*tau0^4 - 2*alpha^2*mu^2*tau0^2 + 1))) - D1^2/((alpha*mu*tau0 + 1)^2*alpha^2*mu^2) - 2*D1*D/((alpha*mu*tau0 + 1)*alpha^2*mu^2) - D^2/(alpha^2*mu^2)
couldnt insert "r2r2" properly...

I am converting some code from Mathematica. In it there is this solution

eqs={2c2+c0==1,6c3+2c1==2,3c2+12c4==1};
FindInstance[eqs,{c0,c1,c2,c3,c4}]

Which gives

{{c0 -> 0, c1 -> 0, c2 -> 1/2, c3 -> 1/3, c4 -> -(1/24)}}

Maple's solve gives

eqs := [2*c2 + c0 = 1, 6*c3 + 2*c1 = 2, 3*c2 + 12*c4 = 1];
sol:=solve(eqs, {c0, c1, c2, c3, c4})

Gives

sol := {c0 = 1/3 + 8*c4, c1 = -3*c3 + 1, c2 = 1/3 - 4*c4, c3 = c3, c4 = c4}

I know that both are correct solutions. But I'am asking if there is a command or an option I overlooked that will generate the same result as the above from FindInstance, which will make it easier for me.

May be there is another solver package or command I could try?

I am not sure what algorithm FindInstance uses. The documentation page does not say.

I am trying to understand the SymmetryGroup returned in the Logic Package. The help page says "The group is a permutation group; its elements are those permutations which preserve the Boolean structure of expr." [my bold], but later the definition is given as "A symmetry of a Boolean expression expr is a mapping f of each variable to some other variable or negated variable, such that the image of expr after applying f to each of its variables is a Boolean formula which is equivalent to expr." Is logically equivalent meant here, or something else? The help page examples don't answer this question.

The following example shows that a group permutation does not lead to a logically equivalent statement as I was expecting - is this a bug, or am I expecting too much here?

restart

with(Logic)

q := `&and`(`&or`(x[1], x[2]), x[3])

Logic:-`&and`(Logic:-`&or`(x[1], x[2]), x[3])

G, L := SymmetryGroup(q, output = [group, expressions]); g1, g2 := Generators(G)[]

_m1897409254784, [x[1], x[2], x[3], Logic:-`&not`(x[1]), Logic:-`&not`(x[2]), Logic:-`&not`(x[3])]

_m1897409280096, _m1897409281184

Exchanging x[1] with x[2], and (not x[1]) with (not x[2]) leads to a logically equivalent expression, so this is indeed a symmetry.

zip(`=`, L, L[convert(g1, permlist, nops(L))]); q1 := eval(q, %); Equivalent(q, q1)

[x[1] = x[2], x[2] = x[1], x[3] = x[3], Logic:-`&not`(x[1]) = Logic:-`&not`(x[2]), Logic:-`&not`(x[2]) = Logic:-`&not`(x[1]), Logic:-`&not`(x[3]) = Logic:-`&not`(x[3])]

Logic:-`&and`(Logic:-`&or`(x[2], x[1]), x[3])

true

Exchanging x[3] with (not x[3]) leads to an expression that perhaps has the same form but is not equivalent

zip(`=`, L, L[convert(g2, permlist, nops(L))]); q2 := eval(q, %); Equivalent(q, q2)

[x[1] = x[1], x[2] = x[2], x[3] = Logic:-`&not`(x[3]), Logic:-`&not`(x[1]) = Logic:-`&not`(x[1]), Logic:-`&not`(x[2]) = Logic:-`&not`(x[2]), Logic:-`&not`(x[3]) = x[3]]

Logic:-`&and`(Logic:-`&or`(x[1], x[2]), Logic:-`&not`(x[3]))

false

NULL

Download LogicTest.mw

dear all:

    here I try to repeat the results as follows:

 (23) is my target

my 2 solving processes are included in the attachment.

using LinearSolve(A, b) and regular solve command can not generate results as (23)

Please take a look.

question_DHT.mw

thanks for your help.

best regards

First 9 10 11 12 13 14 15 Last Page 11 of 35