Maple 2022 Questions and Posts

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

Hi,

Can anybody explain why

with(Units):
A := 1, 2, 3:
B := 4, 5, 6:
AB := B - A;

outputs 11, but the output is 3, 3, 3 without the Units package?

Best regards,

Mikkel

That is to say, a generalized map
E.g., here is a nested list: 

nl := [[[[s, t]], [u, [v, w]]], [[x, [y, z]]]]:

We can use map to apply the mapped function F to "each operand" (i.e., the first‐level parts) of : 

:-map(F, nl);
 = 
         [F([[[s, t]], [u, [v, w]]]), F([[x, [y, z]]])]

But in Mathematica, we can make further explorations: 

In[1]:= nl = {{{{s, t}}, {u, {v, w}}}, {{x, {y, z}}}}; 

In[2]:= Map[F, nl, {1}] (*Maple's result*)

Out[2]= {F[{{{s, t}}, {u, {v, w}}}], F[{{x, {y, z}}}]}

In[3]:= Map[F, nl, {2, -2}]

Out[3]= {{F[{F[{s, t}]}], F[{u, F[{v, w}]}]}, {F[{x, F[{y, z}]}]}}

In[4]:= Map[F, nl, {-3, 3}]

Out[4]= {{F[{F[{s, t}]}], F[{F[u], F[{v, w}]}]}, {F[{F[x], F[{y, z}]}]}}

In[5]:= Map[F, nl, {0, \[Infinity]}, Heads -> \[Not] True]

Out[5]= F[{F[{F[{F[{F[s], F[t]}]}], F[{F[u], F[{F[v], F[w]}]}]}], F[{F[{F[x], F[{F[y], F[z]}]}]}]}]

Note that the last case has been implemented in Maple as MmaTranslator[Mma][MapAll]:  

MmaTranslator:-Mma:-MapAll(F,nl);
 = 
   F([F([F([F([F(s), F(t)])]), F([F(u), F([F(v), F(w)])])]), 

     F([F([F(x), F([F(y), F(z)])])])])

Naturally, how to reproduce the other two results in Maple programmatically? (The output may not be easy to read or understand; I have added an addendum below.)

Addendum. It is also possible to display in "tree" structure (like dismantle) manually: 

`[]`
(
    `[]`
    (
        `[]`
        (
            `[]`
            (
                s
            ,
                t
            )
        )
    ,
        `[]`
        (
            u
        ,
            `[]`
            (
                v
            ,
                w
            )
        )
    )
,
    `[]`
    (
        `[]`
        (
            x
        ,
            `[]`
            (
                y
            ,
                z
            )
        )
    )
)

As you can see, the "depth" of  is five (0, 1, 2, 3, and 4), while the classical map just maps at the first "level". (Moreover, such descriptions may lead to a confusion.)

Supplement. Unfortunately, there remains a bug in the MmaTranslator[Mma][Level]. Compare: 

MmaTranslator:-Mma:-Level(nl, [4]); (*Maple*)
                             [v, w]

MmaTranslator:-Mma:-Level(nl, [-1]); (*Maple*)
          [s, t, u, v, w, x, y, z, -1, x, c, r, y, 2]

In[6]:= Level[nl, {4}] (*Mathematica*)

Out[6]= {s, t, v, w, y, z}

In[7]:= Level[nl, {-1}] (*Mathematica*)

Out[7]= {s, t, u, v, w, x, y, z}

Hello there, 

Is there any chance to ask this one question?

The attached (following) worksheet shows the result of LieDerivative operation, which is not correct. 

The correct answer is given in the image in the middle of the worksheet. Is there any particular reason regarding Maple's way of conducting the operation in that way?

restart;

with(LinearAlgebra):

with(DifferentialGeometry):

with(LieAlgebras):

DGsetup([x1, x2], M, verbose);

`The following coordinates have been protected:`

 

[x1, x2]

 

`The following vector fields have been defined and protected:`

 

[_DG([["vector", M, []], [[[1], 1]]]), _DG([["vector", M, []], [[[2], 1]]])]

 

`The following differential 1-forms have been defined and protected:`

 

[_DG([["form", M, 1], [[[1], 1]]]), _DG([["form", M, 1], [[[2], 1]]])]

 

`frame name: M`

(1)

 

M > 

f := evalDG((x2)*D_x1 + (c1 * (1 - x1^2) * x2 - c2 * x1)*D_x2);

_DG([["vector", M, []], [[[1], x2], [[2], -c1*x1^2*x2+c1*x2-c2*x1]]])

(2)
M > 

h := evalDG((x1)*D_x1 + (0)*D_x2);

_DG([["vector", M, []], [[[1], x1]]])

(3)
M > 

###### answer

M > 

M > 

LieDerivative(f, h);

_DG([["vector", M, []], [[[1], x2], [[2], x1*(2*c1*x1*x2+c2)]]])

(4)
M > 

 

Download Q20230307.mw

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.

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?

in my program, I keep assumptions in a set. Sometimes this is empty if no assumptions are used. This never caused a problem before (at least I do not think so, else I would have seen it) when using empty {} in assuming, except for now.

Here is one example below. Is this a known problem? I noticed when changing {} to [] the error goes away. I am not sure why, and if this is known issue. But will change from a set to a list to avoid this. 

Maple 2022.2 on windows 10

interface(version);

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

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1392 and is the same as the version installed in this computer, created 2023, February 13, 12:58 hours Pacific Time.`

restart;

ode:=diff(diff(y(x),x),x)+diff(y(x),x)^2+diff(y(x),x) = 0;
ic:=y(0) = 0;
sol:=y(x) = -ln(exp(x))+ln(-1+_C1*exp(x))-ln(-1+_C1);

diff(diff(y(x), x), x)+(diff(y(x), x))^2+diff(y(x), x) = 0

y(0) = 0

y(x) = -ln(exp(x))+ln(-1+_C1*exp(x))-ln(-1+_C1)

odetest(sol,[ode,ic]) assuming {};

Error, (in convert/multiset) too many levels of recursion

odetest(sol,[ode,ic]) assuming [];

[0, 0]

odetest(sol,[ode, ic]);

[0, 0]

 

Download feb_14_2023.mw

My question is can the last step be equal to 1/6.

I want to output to 1/6. it outputs to sqrt(9)/18 - (See Below).

NULL"5)Square root: undefined - DNE (Limit does not exist):"

NULL

NULL

NULL

limit((sqrt(x+1)-3)/(x-8), x = 8)"(=)"1/6 

 

 

limit((sqrt(x+1)-3)/(x-8), x = 8)Limit(((x+1)^(1/2)-3)/(x-8), x = 8) = (1/18)*9^(1/2)"(=)"Limit(((x+1)^(1/2)-3)/(x-8), x = 8) = 1/6

NULL

Download limit-sqrt-5.mw

IndependencePolynomial returns the independence polynomial for the graph G in the variable x.

For the following example, its calculation took over 20 minutes and still hasn't produced a result, and what's fatal is that it  has consumed 4G  memory.

with(GraphTheory):
G:=ConvertGraph("W|tNHEpCKoh`@@Po_WHB@CKC?WGO{G?KKCB`?OMG?_y_?Sn");
G1:=LineGraph(G);
IndependencePolynomial(G1, x) # be careful

I use  codes in  the link https://github.com/pernici/hobj.

It produced results quickly (It takes approximately 5 seconds.). So I think the built-in function " IndependencePolynomial " should be able to be improved. (Of course we are usually very concerned about their coefficients) 

Their coefficients of the independent polynomial of G1 are as follows.

[340649, 12329124, 68797662, 140606548, 139481127, 77027880, 25546428, 5303544, 700911, 58580, 2982, 84, 1]

It tells me the total number of independence sets with size 12 is 340649. 

Hi,

I have been bothered lately by the number format for axis labels in Maple. My problem existed before, but it apparently didn't bother me before. I have spent many hours trying to find an answer in the program help, in MaplePrimes, and in general online searches. I am not having any luck at all (good luck, that is).

I want to change the format of the axis numbering. Maple seems to default to 2 decimal places in my graph, and I really need more. Oddly, when I export the graph to PDF, I get another decimal place (even though I didn't explicitly ask for one). 

How do I change the axis-label format? Any idea what I might get when I export the graph?

Thanks for your help,

Jno.

 

Hello guys
I'm having trouble solving a PDE using pdsolve-numerical. Here's a notebook attached.

I'm grateful if anyone can help.

Regards,

Oliveira

                   PDE1.mw

Let us begin with few simulations: 
 

restart;

CodeTools:-Usage(plots['pointplot3d'](Matrix((proc (_) options operator, arrow; [_[() .. (), 1]-_[() .. (), 3], _[() .. (), 2]-_[() .. (), 4], _[() .. (), 5]] end proc)(convert(ssystem("wolframscript -code \"RandomPoint[Simplex[IdentityMatrix[5]], 2*^4]\"")[-1], FromMma)), scan = [rectangular, columns], datatype = float[4]), scaling = constrained))

memory used=0.57TiB, alloc change=91.51MiB, cpu time=18.77m, real time=15.86m, gc time=4.91m

 

CodeTools:-Usage(plots['pointplot3d'](Matrix((proc (_) options operator, arrow; [_[() .. (), 1]-_[() .. (), 3], _[() .. (), 2]-_[() .. (), 4], _[() .. (), 5]] end proc)(convert(ssystem("wolframscript -code \"RandomPoint[Sphere[5], 2*^4, ConstantArray[List[0, 1], 5]]\"")[-1], FromMma)), scan = columns, datatype = float[4]), scaling = constrained))

memory used=0.56TiB, alloc change=-12.08MiB, cpu time=18.70m, real time=15.11m, gc time=5.69m

 

NULL


 

Download iDistributionVector.mws

Well, I'd like to prove (through the use of Maple): 

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 1) = 1))) # not Maple syntax

is equivalent to a filled pyramid

ImplicitRegion((X, Y, Z), 0 <= Z <= 1 - abs(X) - abs(Y)) # not SymPy syntax

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 2) = 1))) # not Maple syntax

is equivalent to a hemi-ball

ImplicitRegion((X, Y, Z), 0 <= Z <= sqrt(1 - X**2 - Y**2)) # not SymPy syntax

, and 

transform((x1, x2, x3, x4, x5) -> [x1 - x3, x2 - x4, x5])(inequal(And((x || (1 .. 5)) >=~ 0, norm([x || (1 .. 5)], 'infinity') = 1))) # not Maple syntax

is equivalent to a solid cuboid

ImplicitRegion((X, Y, Z), -1 <= X <= 1 & -1 <= Y <= 1 & 0 <= Z <= 1) # not SymPy syntax

. (Here, for the convenience of the descriptions, I utilize some non-standard notation from .) 
Note that ”two regions are equal" is a two-way property, which means the following proof 

is(Z >= 0) and is(Z <= 1 - abs(X) - abs(Y)) assuming (X, Y, Z) =~ (x1 - x3, x2 - x4, x5), x || (1 .. 5) >=~ 0, add(x || (1 .. 5)) = 1;
                              true
(*Accordingly, the latter region is a subset of the former one.*) 

is incomplete (because it's hard to determine whether the is routine always performs equivalent transformations in internal evaluation). 

So, can I execute such eliminations in Maple?

As the code:

poly := x^4 + 8*x + 12:
galois(poly, x)

"4T4", {"A(4)"}, "+", 12, {"(1 2 4)", "(2 3 4)"}

 Then I know it's Galois group has to be (isomorphic to) A4. And I can draw its Subgroup Lattice:

DrawSubgroupLattice(GaloisGroup(poly, x), 'indices')

But according to Galois's theory, each subgroup represents an intermediate field. As far as I know, ⑤⑥⑦⑧ are Q(r1),Q(r2),Q(r3) and Q(r4), respectively, where ri is the root of equation x^4+8x+12. But I have no idea what fields ②③④⑨ means. How do you calculate out those intermediate fields with maple?

Hello guys,

I created a palette, but when I click on an entry, the following occurs:

If the entry line, where the mouse cursor is, is empty, insertion takes place on this line.
If the input line has any expression and the mouse cursor is to the left of the expression, insertion takes place on the line above.

If the input line has any expression and the mouse cursor is to the right of the expression, insertion takes place on the line below.

Does anyone know how to fix this?

Sincerely,

Oliveira

Hello guys
Could someone help me create a simple palette to contain, for example, three functions that I use constantly?

           conve1(a), conve2(a) and conve3(a).

I tried through the help documentation, but I couldn't.

Sincerely,
Oliveira

Mathematica's Dimensions returns a list of the allowed levels, which has been implemented in Maple as . But 

MmaTranslator:-Mma:-Dimensions(<<1 | 2>, <1 | 0>>);

returns [6], and 

MmaTranslator:-Mma:-Dimensions([[1, 2], [1, 0]]);

returns [2, 2, 4]. What happened here?

It should be [2, 2].

restart;

MmaTranslator:-Mma:-Dimensions(linalg[matrix]([[1, 2], [1, 0]]));

[0]

(1)

MmaTranslator:-Mma:-Dimensions(< 1 , 2 ; 1 , 0 >);

[6]

(2)

MmaTranslator:-Mma:-Dimensions(convert(`{{1, 2}, {1, 0}}`, FromMma));

[2, 2, 4]

(3)

MmaTranslator:-FromMma(`Dimensions[{{1, 2}, {1, 0}}]`, evaluate);

[2, 2]

(4)

NULL

Download Mma[Dimensions].mws

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