sursumCorda

1239 Reputation

15 Badges

2 years, 233 days

MaplePrimes Activity


These are replies submitted by sursumCorda

@acer Thanks for your observation.
Can anyone reproduce that bug in Maple 2018?

@mmcdara Thanks. If I understand right, for this purpose, I have to replace the problem variables manually first. So, is it impossible to find the exact supermun directly?
Actually, I have some more complex expressions, but Maple's maximize (or minimize) often gives incorrect results without any exception messages (although the Student[MultivariateCalculus][LagrangeMultipliers] function sometimes works). 

@Carl Love Well, you may consider 

k*x*y - (x - y)^2/2; # which is equal to (1 + k)*x*y - (x^2 + y^2)/2

 for some real parameter k. When k = 0, its supremum is just 0, while when k > 0, its supremum is no longer 0 (but it appears that Maple don't know this fact). (As the arithmetic mean-geometric mean inequality says, we have x2y2≥2xy, where the coefficient "2" cannot be replaced with a larger number in general.)

@QM I agree you. This example is simple enough, so it's not hard to find (and then fix) such a bug; nonetheless, ensuring the correctness would never be users' responsibility!

@C_R Thanks. That's really strange. I don't know what happened in Maple 2023: sqrt(A^2) doesn't work, but sqrt(A)^2, sqrt(A*A), and sqrt(A)*sqrt(A) all works.

@C_R Thanks for your try. Since the error occurs in `simplify/sqrt/fraction`, can you reproduce this in Maple 2022.2? 
 

interface(version) = `Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`NULL

restart;

showstat(`simplify/sqrt/fraction`, 1 .. 2)


`simplify/sqrt/fraction` := proc(f)
local i, nu, de, n, d, nr, dr, g, j, ex, a, gtmp, rmvd, N;
   1   n := traperror(numer(f));
   2   if n = lasterror then
           ...
       end if;
       ...
end proc
 

 

FUNC := proc (x::{list, set, algebraic}) options operator, arrow; end proc

x := -1

proc (x::{list, set, algebraic}) options operator, arrow; end proc

(1)

Typesetting:-mrow(Typesetting:-mi("f0", italic = "true", mathvariant = "italic"), Typesetting:-mo("≔", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mo("proc", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("f", italic = "true", mathvariant = "italic")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mo("local", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mi("n", italic = "true", mathvariant = "italic"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo("≔", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mi("traperror", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("FUNC", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("f", italic = "true", mathvariant = "italic")), mathvariant = "normal")), mathvariant = "normal"), Typesetting:-mo(";", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.2777778em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mi("evalb", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("n", italic = "true", mathvariant = "italic"), Typesetting:-mo("=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mi("lasterror", italic = "true", mathvariant = "italic")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "decreaseindentnewline"), Typesetting:-mo("end", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(":", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"))

Typesetting:-mrow(Typesetting:-mi("f1", italic = "true", mathvariant = "italic"), Typesetting:-mo("≔", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mo("proc", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("f", italic = "true", mathvariant = "italic")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mo("local", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(" ", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mi("n", italic = "true", mathvariant = "italic"), Typesetting:-mo("≔", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mi("traperror", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("numer", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("f", italic = "true", mathvariant = "italic")), mathvariant = "normal")), mathvariant = "normal"), Typesetting:-mo(";", mathvariant = "normal", fence = "false", separator = "true", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.2777778em"), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "firstprocnewline"), Typesetting:-mi("evalb", italic = "true", mathvariant = "italic"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi(""), Typesetting:-mrow(Typesetting:-mi("n", italic = "true", mathvariant = "italic"), Typesetting:-mo("=", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"), Typesetting:-mi("lasterror", italic = "true", mathvariant = "italic")), Typesetting:-mi("")), mathvariant = "normal"), Typesetting:-mi(""), Typesetting:-mspace(height = "0.0ex", width = "0.5em", depth = "0.0ex", linebreak = "decreaseindentnewline"), Typesetting:-mo("end", bold = "true", mathvariant = "bold", fontweight = "bold", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.0em", rspace = "0.0em"), Typesetting:-mo(":", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2777778em", rspace = "0.2777778em"))

f0("")

true

(2)

f1("")

false

(3)

NULL


 

Download lasterror.mw

@Preben Alsholm Many thanks. Could you test f~(x,y) and f~(x,` $`,y) additionally? (I think that the latter would run a bit faster, but I cannot confirm this.)

@Scot Gould This works: 

restart;
with(Units):
Automatically loading the Units[Simple] subpackage


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

Note that the original B - A is equivalent to 

Units:-Simple:-`+`(B, Units:-Simple:-`-`(A));
                               11

B - A;
                               11

:-eval('B' - 'A'); # fix it
                            3, 3, 3

 

@Preben Alsholm & @Carl Love Thanks again. 
Maybe the real time just depends upon the chronological order of codes. When I run the zip version first, `~` is slower instead: (But it seems to me that the first call almost always uses more memories.) 
 

restart;

x := combinat:-randperm(2*10^7):
y := combinat:-randperm(2*10^7):

undefine(f);

t4 := CodeTools[Usage](zip(f, x, y), iterations = 5)

memory used=1.44GiB, alloc change=2.42GiB, cpu time=2.14m, real time=37.94s, gc time=105.51s

 

t2a := CodeTools[Usage](`~`[f](x, y), iterations = 5)

memory used=1.04GiB, alloc change=-4.00MiB, cpu time=2.29m, real time=38.87s, gc time=115.58s

 

t2b := CodeTools[Usage](`~`[f](x, ` $`, y), iterations = 5)

memory used=1.04GiB, alloc change=0 bytes, cpu time=2.20m, real time=38.44s, gc time=109.43s

 

evalb(t2a = t2b and t2b = t4)

true

(1)

NULL


 

Download `_`_and_zip.mw

@Preben Alsholm Thanks for your reply. Surely their respective domains of operation are different, but I am intrigued to know when `~` and map do the same thing, why the latter is less efficient here. (Is this just determined by the computer's performance?)

@Christian Wolinski Many thanks. I think that this doesn't work on the trivial case x = [].

@Carl Love Thanks very much. I shall think it over later.

And what about other two commands? Contrary to my expectations, they do not do the same thing (at least here). 

@Oliveira I find an instance such that _Z1  _Z1

restart;
op([-1, -1], Invfunc[cos](0)):
ToInert(%);

restart;
op([-1, -1], Invfunc[cos](0)):
ToInert(%);

restart;
op([-1, -1], Invfunc[cos](0)):
ToInert(%);

The return value is always _Inert_LOCALNAME("_Z1~", ```different number```), which is surely distinct from the ToInert(_Z1).

@nm Thanks. As regards the series solutions, if an "exact" general solution is available, we can utilize the asympt function later, but if the symbolic solver is stuck… 
An instance that both Maple and Mathematica cannot solve: 

dsolve({t^2*diff(diff(z(t),t),t)+log(t)^2*z(t)=0},z(t),type='series',t=infinity):
AsymptoticDSolveValue[t^2*Derivative[2][z][t]+Log[t]^2*z[t]==0,z[t],t->Infinity];

@nm It's a undocumented internal function, so use of Holonomic`DifferentialAsymptoticSeries is somewhat discouraged. 

In addition, unfortunately, 

dsolve({t^6*diff(diff(z(t),t),t)+2*t^5*diff(z(t),t)-4*z(t)=0},z(t),'series');

returns nothing (in other words, Maple is unable to find symbolic solution), but Mma's AsymptoticDSolveValue is still capable of solving it. (I don't why.)

First 16 17 18 19 20 21 22 Page 18 of 23