aroche

Dr. Austin Roche

460 Reputation

7 Badges

12 years, 63 days
Maplesoft
Waterloo, Ontario, Canada
I am a Software Architect in the Math Group, working mostly on the Maple library. I have been working at Maplesoft since 2007, in various areas including differential equations, integration, mathematical functions, simplification, root finding, and logic. I completed a Master's degree from McGill University with a thesis in Differential Geometry, and a PhD from Simon Fraser University with a thesis on Differential Equations.

MaplePrimes Activity


These are replies submitted by aroche

Hi @Kitonum,

I agree with @Carl Love . This is not a bug as stated in the original post because the or is evaluating to false before is sees it.

If the input is corrected by using the inert operator Or instead of or, then the result is FAIL, and this is indeed a weakness, as the expected answer should be true.

In any case, thank you for the report. We will investigate.

Austin Roche
Maplesoft

Hi @nm,

I asked around internally about this issue and this was the most useful reply I got (via @epostma):

One thing we can say is that, first of all, there are algorithms that are intentionally randomized because those are just better algorithms for a given problem. E.g., something like testeq: there is no deterministic way to get equally good results in the same amount of time. If other CASs don't do anything like this, they're leaving performance on the table; a good CAS would do this.Then there are cases where we don't actively choose a randomized algorithm, we just happen to depend on something that differs from run to run, like ordering due to addresses. We got a lot better at this, oh, some time between 2007 and 2015 or so, but there are some cases that remain. (I guess you could argue that this is an instance of the first where the random source is the memory manager and the best algorithm is to just depend on that, but that seems like splitting hairs.) It is possible that there are CASs out there that have banished this completely, but it is not clear to me that there are. I can't easily verify, but for example Mathematica uses sorted lists for sets, and they sort "symbols by their names, and in the event of a tie, by their contexts." That sounds like they don't have a reproducible way to sort two different locals coming out of different invocations of the same procedure either -- in fact, I don't think there can be (especially in a multithreaded context). But I guess the comment suggests that the user experiences these results more frequently in Maple than in other CASs. I don't know that we can really do much about that.

Hi @nm,

Regarding your update from Jan 18th, I was able to reproduce the recursion error using Physics Update Version 1841. Upon seeing the error, I called tracelast and this was the result:

 PolynomialSystemSolvers:-UnivariateHandler called with arguments: {(2*I)*RootOf(_Z^2+1, label = exptmp)*_S000054*_S000053*x+(2*I)*RootOf(_Z^2+1, label = exptmp)*x-Pi}, {x, _S000053, _S000054}, {-_S000045, -_S000047, -_S000049, -_S000051, -_S000053, -_S000054, -RootOf(_Z^2+1, label = exptmp)+y(x)}, absolute, 100
 #(SolveTools:-PolynomialSystemSolvers:-UnivariateHandler,8): return [seq(op(thisproc({s},vars,nz,domain,maxsols)),s in  select(depends,[op(eq)],vars))]
 PolynomialSystemSolvers:-UnivariateHandler called with arguments: {2*RootOf(_Z^2+1, label = exptmp)*_S000054*_S000053*x+2*RootOf(_Z^2+1, label = exptmp)*x+I*Pi}, {x, _S000053, _S000054}, {-_S000045, -_S000047, -_S000049, -_S000051, -_S000053, -_S000054, -RootOf(_Z^2+1, label = exptmp)+y(x)}, absolute, 100
 #(SolveTools:-PolynomialSystemSolvers:-UnivariateHandler,8): return [seq(op(thisproc({s},vars,nz,domain,maxsols)),s in  select(depends,[op(eq)],vars))]
 PolynomialSystemSolvers:-UnivariateHandler called with arguments: {(2*I)*RootOf(_Z^2+1, label = exptmp)*_S000054*_S000053*x+(2*I)*RootOf(_Z^2+1, label = exptmp)*x-Pi}, {x, _S000053, _S000054}, {-_S000045, -_S000047, -_S000049, -_S000051, -_S000053, -_S000054, -RootOf(_Z^2+1, label = exptmp)+y(x)}, absolute, 100
 #(SolveTools:-PolynomialSystemSolvers:-UnivariateHandler,8): return [seq(op(thisproc({s},vars,nz,domain,maxsols)),s in  select(depends,[op(eq)],vars))]

Investigating this result, I saw that it was again due to the same non-idempotency bug in factor that was fixed in Physics Update 1842 (see https://www.mapleprimes.com/questions/239596-Bug-Report-Dsolve-Generates-Internal-Error-Error-in-Factor#answer307453). So I am quite sure that if you get the latest Physics update (currently 1843,  but anyway at least 1842) then you should not be able to reproduce this particular error.

Best regards,
Austin Roche
Maplesoft

Hi @nm,

Thank you for this report. It's been filed and we are currently investigating. And yes, as you noted, recursion errors cannot be trapped.

Austin Roche

Hi,

Thank you for the report!

I just want to say that I am investigating this issue (in coulditbe) and currently testing some potential improvements.

Regards,
    Austin

Hi @Carl Love,

Thank you for this feedback! We've considered all of your suggestions and we liked most of them. In particular, we've decided to incorporate your suggestion regarding adding a new &under verification, and it should appear in the next full release.

Best regards,
    Austin

Hi @vv,

I read your comment and agreed that the solution it was computing was not complete. I've made some changes: it now computes the IVP solution for each of the 3 computed "solutions" for diff(y(x),x):

ode:=diff(y(x), x)^3 = (x - 2)^2:ic:=y(2)=1:
Student:-ODEs:-Solve([ode,ic]);

y(x) = 1+(1/5)*(3*x-6)*(x-2)^(2/3), y(x) = -(3/10)*(x-2)^(5/3)*(1+I*3^(1/2))+1, y(x) = (3/10)*(x-2)^(5/3)*(I*3^(1/2)-1)+1

Student:-ODEs:-ODESteps([ode,ic]);

"[[,,"Let's solve"],[,,[((ⅆ)/(ⅆx) y(x))^3=(x-2)^2,y(2)=1]],["•",,"Highest derivative means the order of the ODE is" 1],[,,(ⅆ)/(ⅆx) y(x)],["•",,"Solve for the highest derivative"],[,,[(ⅆ)/(ⅆx) y(x)=(x-2)^(2/3),(ⅆ)/(ⅆx) y(x)=-((x-2)^(2/3))/2-(ⅈ sqrt(3) (x-2)^(2/3))/2,(ⅆ)/(ⅆx) y(x)=-((x-2)^(2/3))/2+(ⅈ sqrt(3) (x-2)^(2/3))/2]],["▫",,"Solve the equation" (ⅆ)/(ⅆx) y(x)=(x-2)^(2/3)],[,"?","Integrate both sides with respect to" x],[,,∫((ⅆ)/(ⅆx) y(x)) ⅆx=∫(x-2)^(2/3) ⅆx+c__1],[,"?","Evaluate integral"],[,,y(x)=(3 (x-2)^(5/3))/5+c__1],[,"?","Solve for" y(x)],[,,y(x)=(3 (x-2)^(5/3))/5+c__1],[,"?","Use initial condition" y(2)=1],[,,1=c__1],[,"?","Solve for" c__1],[,,c__1=1],[,"?","Substitute" c__1=1 "into general solution and simplify"],[,,y(x)=1+((3 x-6) (x-2)^(2/3))/5],[,"?","Solution to the IVP"],[,,y(x)=1+((3 x-6) (x-2)^(2/3))/5],["▫",,"Solve the equation" (ⅆ)/(ⅆx) y(x)=-((x-2)^(2/3))/2-(ⅈ sqrt(3) (x-2)^(2/3))/2],[,"?","Integrate both sides with respect to" x],[,,∫((ⅆ)/(ⅆx) y(x)) ⅆx=∫(-((x-2)^(2/3))/2-(ⅈ sqrt(3) (x-2)^(2/3))/2) ⅆx+c__1],[,"?","Evaluate integral"],[,,y(x)=-(3 (x-2)^(5/3) (1+ⅈ sqrt(3)))/10+c__1],[,"?","Use initial condition" y(2)=1],[,,1=c__1],[,"?","Solve for" c__1],[,,c__1=1],[,"?","Substitute" c__1=1 "into general solution and simplify"],[,,y(x)=-(3 (x-2)^(5/3) (1+ⅈ sqrt(3)))/10+1],[,"?","Solution to the IVP"],[,,y(x)=-(3 (x-2)^(5/3) (1+ⅈ sqrt(3)))/10+1],["▫",,"Solve the equation" (ⅆ)/(ⅆx) y(x)=-((x-2)^(2/3))/2+(ⅈ sqrt(3) (x-2)^(2/3))/2],[,"?","Integrate both sides with respect to" x],[,,∫((ⅆ)/(ⅆx) y(x)) ⅆx=∫(-((x-2)^(2/3))/2+(ⅈ sqrt(3) (x-2)^(2/3))/2) ⅆx+c__1],[,"?","Evaluate integral"],[,,y(x)=(3 (x-2)^(5/3) (ⅈ sqrt(3)-1))/10+c__1],[,"?","Use initial condition" y(2)=1],[,,1=c__1],[,"?","Solve for" c__1],[,,c__1=1],[,"?","Substitute" c__1=1 "into general solution and simplify"],[,,y(x)=(3 (x-2)^(5/3) (ⅈ sqrt(3)-1))/10+1],[,"?","Solution to the IVP"],[,,y(x)=(3 (x-2)^(5/3) (ⅈ sqrt(3)-1))/10+1],["•",,"Set of solutions"],[,,{y(x)=1+((3 x-6) (x-2)^(2/3))/5,y(x)=-(3 (x-2)^(5/3) (1+ⅈ sqrt(3)))/10+1,y(x)=(3 (x-2)^(5/3) (ⅈ sqrt(3)-1))/10+1}]]6""

Download 238434_Ans1.mw
Unfortunately, the solution with y(x) real is comprised of the first of these solutions when x>2, and the 2nd of them when x <2:

evalc(y(x) = -(3*(x - 2)^(5/3)*(1 + sqrt(3)*I))/10 + 1) assuming x < 2;

y(x) = -(3/5)*(2-x)^(5/3)+1

Download 238434_Ans2.mw
I'm not sure if there's much more that can be done about this, because Student:-ODEs is relying on solve to solve for the derivative and solve is returning the solutions in this format.

This improvement is distributed for everybody using Maple 2024 within the Maplesoft Physics Updates v.1758 or newer. To install the Updates, open Maple and input Physics:-Version(latest)

Austin Roche
Maplesoft

 

Thanks for the report. A fix has been made and is expected in the next patch release (2024.1).

-Austin
 

@Aung Yes, the fix mentioned above only fixes a wrong answer from simplify. It does not fix the weakness in integration. I'm not even sure if this integral can be solved.

In Maple 2024 simplify will directly give the desired answer under the assumption m::integer:

simplify(4*cos(Pi*m+2*alpha*Pi)/(Pi*(2*m + 1))) assuming m::integer;

4*cos(2*alpha*Pi)*(-1)^m/(Pi*(2*m+1))

Download tmp1.mw

 

Hi @Preben Alsholm ,
The simplify bug mentioned above is now fixed:

simplify(int((1 - sigma*sin(2*Pi*N))^k, N = 0 .. N))

now returns unchanged and thanks to @ecterrab the fix is also distributed for everybody using Maple 2024 within the Maplesoft Physics Updates v.1717 or newer. As usual, to install the Updates, open Maple and input Physics:-Version(latest).

Cheers,

       Austin

Hi @nm,
This fix should also be available in a future Maple2024.1 patch release.
Cheers,
     Austin

Follow up note on this. If we take the original integral, let t=x^2, -1/2 a^2 =b, then we get the simpler version:

Int(exp(b/x^2), x = 0 .. infinity)

The antiderivative oscillates wildly at 0+ and so the integral is undefined (does not converge, even to infinity) when Re(b) > 0 and Im(b) <> 0 (example, b=I+1). As such the new answer is unevaluated, but it returns infinity if evaluated under appropriate assumptions.

@Mariusz Iwaniuk Thank you, we've entered these issues into our system.

Thank you all for your comments regarding not handling equality assumptions as assignments. Historically assume was not really intended to be used to give a variable a specific value - other mechanisms, such as eval, or the 'use' command, are more suited to this. In particular, Maple may ignore special cases (for which the associated set of parameter values has measure 0), because returning an answer which accounts for every possible subcase may not be practical (or efficient - note, checking for potential subcases using 'is' can be much slower than checking a type!). Instead, it aims to at least return an answer for the general case, and relies on the user explicitly substituting the parameter values before calling the function in question. Of course, finding the right set of cases to treat specially is definitely a goal we are working towards.

Austin Roche
Mathematical Software, Maplesoft

1 2 Page 1 of 2