sursumCorda

922 Reputation

13 Badges

2 years, 207 days

MaplePrimes Activity


These are replies submitted by sursumCorda

@mmcdara Incidentally, an alternative method of the given problem is using certain CAD-based algorithms: 

try
    unwith(Logic):
catch:
    ;
finally
    RegularChains:-SemiAlgebraicSetTools:-QuantifierElimination(&E [x, y, a], ((x^3 + y^2 - x = a) &and (a^2 = 4/27) &and (a < 0)) &and ((x^2 + y^2 = R^2) &and (R >= 0)), 'output' = 'rootof');
end try;
               /    1  (1/2)\     /2  (1/2)     \
               |R = - 3     | &or |- 3      <= R|
               \    3       /     \3            /

Nonetheless, this is really beyond layman's ken (despite its correct result).

Unfortunately, extrema just returns (constrained) relative extrema of n algebraic expression; the "extreme values" must be checked later. In addition, in this problem, x, y, and z are all positive real numbers, so you need at least

extrema(x^2*y^2*z^2, x^2 + y^2 + z^2 = 6, {x, y, z}, 'S');

or 

Student[MultivariateCalculus][LagrangeMultipliers](x*y*z, [x + y + z - 6, -sx^2 + x, -sy^2 + y, -sz^2 + z], [x, y, z, sx, sy, sz], output = detailed);

for exact solutions.

@Carl Love But just take about 0.4s in MMA: So, what happened in Maple?

@mmcdara Thanks for your detailed tests. The last point in your reply may be simply a feature in some later releases. As for those tests, the performance on my computer is worse. 
 

restart;

interface(version);
interface(displayprecision=4):

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

(1)

T:= NULL:
for i from 1 to 1000 do
T := T, CodeTools:-Usage([seq](seq(cat(i,j),j in [$("a".."z"),$("A".."Z"),$("A".."Z"),$("a".."z"),$("A".."Z")]),i in [$("A".."Z"),$("a".."z"),$("a".."z"),$("A".."Z"),$("a".."z")]), iterations=1, output=cputime, quiet):
end do:

Statistics:-Histogram([T], discrete=true, thickness=10)

 

T:= NULL:
for i from 1 to 1000 do
T := T, CodeTools:-Usage([seq](seq(cat(i,j),j in [$("a".."z"),$("A".."Z"),$("A".."Z"),$("a".."z"),$("A".."Z")]),i in [$("A".."Z"),$("a".."z"),$("a".."z"),$("A".."Z"),$("a".."z")]), iterations=10, output=cputime, quiet):
end do:


Statistics:-Histogram([T], discrete=true, thickness=8)

 

T:= NULL:
for i from 1 to 1000 do
T := T, CodeTools:-Usage([seq](seq(i||j,j in [$("a".."z"),$("A".."Z"),$("A".."Z"),$("a".."z"),$("A".."Z")]),i in [$("A".."Z"),$("a".."z"),$("a".."z"),$("A".."Z"),$("a".."z")]), iterations=10, output=cputime, quiet):
end do:

Statistics:-Histogram([T], discrete=true, thickness=8)

 

L1 := [$("a".."z"),$("A".."Z"),$("A".."Z"),$("a".."z"),$("A".."Z")]:
L2 := [$("A".."Z"),$("a".."z"),$("a".."z"),$("A".."Z"),$("a".."z")]:

T:= NULL:
for i from 1 to 1000 do
T := T, CodeTools:-Usage([seq](seq(i||j, j in L1),i in L2), iterations=10, output=cputime, quiet):
end do:

Statistics:-Histogram([T], discrete=true, thickness=8)

 

N1 := numelems(L1):
N2 := numelems(L2):
A1 := Matrix(N1, N2, (i, j) -> L1[i]):
A2 := Matrix(N1, N2, (i, j) -> L2[j]):


T:= NULL:
for i from 1 to 1000 do
T := T, CodeTools:-Usage(cat~(A1, A2), iterations=10, output=cputime, quiet):
end do:

Statistics:-Histogram([T], discrete=true, thickness=8)

 

 


 

Download compareTime_sursumCorda(1).mw

But I believe that these may be irrelevant to the version of Maple.

@dharr Thanks.
Interestingly again, the more readable one is not faster as it is: 

restart;

s1 := CodeTools:-Usage([cat("A" .. "Z"), cat("a" .. "z"), cat("a" .. "z"), cat("A" .. "Z"), cat("a" .. "z") || '`$`("a" .. "z"), `$`("A" .. "Z"), `$`("A" .. "Z"), `$`("a" .. "z"), `$`("A" .. "Z")'])

memory used=1.26MiB, alloc change=0 bytes, cpu time=16.00ms, real time=16.00ms, gc time=0ns

 

s2 := CodeTools:-Usage([seq](seq(cat(i,j),j in [$("a".."z"),$("A".."Z"),$("A".."Z"),$("a".."z"),$("A".."Z")]),i in [$("A".."Z"),$("a".."z"),$("a".."z"),$("A".."Z"),$("a".."z")])):

memory used=1.52MiB, alloc change=0 bytes, cpu time=47.00ms, real time=58.00ms, gc time=0ns

 

EqualEntries(s1, s2)

true

(1)

comparray(s1, s2, dontprint);

true

(2)

NULL


 

Download compareTime.mws

@mmcdara Thanks for your valuable comments.
An essential issue is that R (as well as Julia, Python, SageMath, etc.) is free and even open-source while Maple, Mathematica and Matlab (and their add-on toolboxes and applications) are all not. For the sake of the institution budget, people may only purchase one of these commercial products and services and cannot access any other licenses for the required functionalities. So hoping to meet expectations of such common capabilities in their own softwares can be reasonable in general. 

@mmcdara Thanks. Can R plot such flow charts using the layered layout method as well?

@dharr Thanks. As you can see, edges may overlap, so it is not a visually appealing layout of this graph. It is hoped that a aesthetic drawing in a hierarchical fashion has minimal edge crossing (like the examples from Mathematica and MATLAB).

@Carl Love Thanks!

subs[eval](
    `is/internal/SMTLIB_max_sys_size`= `is/internal/SMTLIB_max_sys_size`/2,
    eval(`is/internal/SMTLIB`)
):

works well, but it seems that none of 

eval(
    eval(`is/internal/SMTLIB`),
    `is/internal/SMTLIB_max_sys_size`= `is/internal/SMTLIB_max_sys_size`/2
):
algsubs(
    `is/internal/SMTLIB_max_sys_size`= `is/internal/SMTLIB_max_sys_size`/2,
    eval(`is/internal/SMTLIB`)
):
applyrule(
    `is/internal/SMTLIB_max_sys_size`= `is/internal/SMTLIB_max_sys_size`/2,
    eval(`is/internal/SMTLIB`)
):

works. 

 Yes, just for fun. Although we don't know how Mathematica implements the RandomPoint, a similar function Random`RandomPointVector can still be viewed in Mathematica. (Note that these are not the same as Maple's geom3d[randpoint] and linalg[randvector].) If one has the license of MMA, one may run the following code in its interface: 

GeneralUtilities`PrintDefinitions[Random`RandomPointVector]; 
GeneralUtilities`PrintDefinitions[Region`RandomPointDump`SymbolicRegionRandom];
(*Mathematica style*)

But until now, Maple still haven't had a built-in subroutine that can generate a list of (pseudorandom) points uniformly in an arbitrary valid parameter-free region in general.

@Markiyan Hirnyk Well, I have just checked the latest how Maple's performance compares to Mathematica. MMA now claims that median performance for random number generation shows Mathematica to be more than 20 times faster than Maple. However, I'm not sure if such tests are fair. Interestingly, MMA also summarizes the new features in each Maple release. I have to admit that its marketing ploy is quite powerful.

@Carl Love Now I see. It's really an intricate maze. Thanks again.

@acer Thanks anew. But what does [5,7,1,2,5,1,1,2,1,2,1,2,1]=10 mean?

Furthermore, whilst the help page says that the is command makes calls to the SMTLIB package to help compute some answers involving real variables, the help page does say that MathematicalFunctions[Is] only manipulates its input before sending it to the corresponding lowercase command is (and so does MathematicalFunctions[Coulditbe]). However,@Carl Love  has shown that the new command MathematicalFunctions[Coulditbe], in effect, might not perform basically the same operation as the standard coulditbe command. That's queer indeed.

@Carl Love Many thanks. I think that it should be 

# resume
MathematicalFunctions:-Assume(V[] ::~ real);
MathematicalFunctions:-Coulditbe(And(d1[]));

This time it becomes rather time-consuming; I have to abort it manually after thousands of seconds.
In this case, solve is useful indeed. But if there are not no solutions (which means ), solve will run for too long, and coulditbe fails again. For instance, considering 

d3:= {p1, p2, S4 <= 1};
_EnvTry := hard: 
(coulditbe(`and`(d2[])) assuming V[] ::~ real); # FAIL

As for MathematicalFunctions:-Coulditbe, it seems that we need to take a longer time—maybe several hours or even more. However, this may not be acceptable for the user.

@Carl Love Sorry for late reply. I am testing it.

First 16 17 18 19 Page 18 of 19