sursumCorda

1189 Reputation

15 Badges

2 years, 107 days

MaplePrimes Activity


These are questions asked by sursumCorda

The range is wrong. For details, see below, please.
 

restart;

assume(x, RealRange(0, 1))

plot([sqrt(x*(2 - x)/3), 1 - sqrt((1 - x^2)/3)], legend = InertForm:-Display~([sqrt(x*(2 - x) %/ 3), 1 - sqrt((1 %- x^2) %/ 3)], 'inert' = false));

 

smartplot([sqrt(x*(2 - x)/3), 1 - sqrt((1 - x^2)/3)]);

 

smartplot([''piecewise'(And(0 <= x, x <= 1), sqrt(x*(2 - x)/3))', ''piecewise'(And(0 <= x, x <= 1), 1 - sqrt((1 - x^2)/3))']);

 

smartplot(['piecewise(And(0 <= x, x <= 1), sqrt(x*(2 - x)/3))', 'piecewise(And(0 <= x, x <= 1), 1 - sqrt((1 - x^2)/3))']);

 

smartplot([''piecewise''(And(0 <= x, x <= 1), sqrt(x*(2 - x)/3)), ''piecewise''(And(0 <= x, x <= 1), 1 - sqrt((1 - x^2)/3))]);

 

x := 'x'NULL


 

Download SmartPlots.mw

The help page claims that smartplot(..) will call 2-D plot procedures ultimately, but why is the smartplots command incompatible with the use of assume?

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

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, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0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 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?

First 20 21 22 23 Page 22 of 23