sursumCorda

1169 Reputation

13 Badges

2 years, 42 days

MaplePrimes Activity


These are questions asked by sursumCorda

Execute the following codes in Maple input (1-D math) in the Standard interface. 

(cat("A".."C"),cat("d".."f"))||'$"G".."I",$"j".."l"'; 

Then an error occurred. But if one copy them into 2-D math (instead of Convert To>2-D Math Input) and execute them directly, everything goes without any error messages.

It says that mixed 1-D and 2-D math inside one command is not supported and not recommended stylistically. However, I just want to understand the reason why an error is raised here. 

restart;

kernelopts(version);

`Maple 2022.2, X86 64 WINDOWS, Oct 23 2022, Build ID 1657361`

(1)

interface(version);

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

(2)

(cat("A".."C"),cat("d".."f"))||'$"G".."I",$"j".."l"';

Error, `||` unexpected

 

cat("A" .. "C"), cat("d" .. "f") || '`$`("G" .. "I"), `$`("j" .. "l")'

"AG", "AH", "AI", "Aj", "Ak", "Al", "BG", "BH", "BI", "Bj", "Bk", "Bl", "CG", "CH", "CI", "Cj", "Ck", "Cl", "dG", "dH", "dI", "dj", "dk", "dl", "eG", "eH", "eI", "ej", "ek", "el", "fG", "fH", "fI", "fj", "fk", "fl"

(3)

NULL

Download unexpectedConcatenation.mws

For instance, given an adjacency matrix: 

convert([[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1,
0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0]], Matrix): # adjacency

The desired diagram resembles:

The first one comes from Mathematica; the second one comes from MATLAB.
In MMA, we can use GraphLayout -> "LayeredDigraphEmbedding"; in MatLab, we can use Layout = "layered". Note that overlapping edges should be avoided in a layered plot.

Currently, since the vertices of a 2-D graph can be manually positioned, we can click, drag and place them to embed vertices, route edges, and then get a hierarchical structure as follows:

However, it's just a clumsy and fiddly job. Isn't there a fully automatic and less time-consuming method to do so in Maple?

Let a, b, c, d be real numbers. Define two geometric regions implicitly: abcd>0∧abacadbcbdcda2b2c2d2, and abcd>0∧abcabdacdbcd>0. Suppose that somebody wants to prove that the former region is a subset of the latter one. Can we implement such an implication simply using certain ready-made commands in basic Maple? In other words, it is hoped that 

restart;
RealDomain:-simplify(forall([a, b, c, d], a + b​​​​​​​ + c + d > 0 and a*b + a*c + a*d + b*c + b*d + c*d > a^2 + b^2 + c^2 + d^2 implies a*b*c*d > 0 and a*b*c + a*b*d + a*c*d + b*c*d > 0));

Unfortunately, simplify just returns the statement unevaluated. So, how to address it in internal Maple? 

Note. The desired result (or return value) is true (see below).

  1. restart; # Do not with(Logic): here
    RegularChains:-SemiAlgebraicSetTools:-QuantifierElimination(&A [d, c, b, a], ((d + c + b + a > 0) &and (b*a + c*a + d*a + c*b + d*b + d*c > a^2 + b^2 + c^2 + d^2)) &implies ((d*c*b*a > 0) &and (d*c*b + d*c*a + d*b*a + c*b*a > 0)));
  2. restart;
    not SMTLIB:-Satisfiable(`not`(a + b + c + d > 0 and a*b + a*c + a*d + b*c + b*d + c*d > a^2 + b^2 + c^2 + d^2 implies d*c*b*a > 0 and a*b*c + a*b*d + a*c*d + b*c*d > 0)); # assuming real 

​​​​​​​​​​​​​​​​​​​​​Either ⒈ or ⒉ needs external calls. It seems that the Maple standard library functions in List of Commands still fail in simplifying expressions in the aforementioned form. Am I right?

GraphTheory/IsHamiltonian says that the method can be one of legacy, sat, or tsp. But why method = tsp brings about an error? 

GraphTheory:-IsHamiltonian(GraphTheory:-CompleteGraph(3, 3), method = tsp); # Maple 2022.2

Attachment: HamiltonianGraphQ.mws

Let x, y, z be nonnegative real numbers. Obviously, x3+y3+z3-4xyz is not always nonnegative, since its value is -1 when x=y=z=1. But why Maple's minimize gives wrong result? 

minimize(x^3 + y^3 + z^3 - 4*x*y*z, x = 0 .. infinity, y = 0 .. infinity, z = 0 .. infinity);

Attachment: MinValue.mws.

MMA's Minimize finds correct infimum: 
So, can Maple always find correct exact (i.e., not just numerical) global minima (or maxima) at least for such problems with a small number of variables as well?

First 20 21 22 Page 22 of 22