rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

inconsistent limit results with trig #2491

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 10:02:17 Created by macrakis on 2022-01-31 01:17:58 Original: https://sourceforge.net/p/maxima/bugs/3932


QQ: (-rr*csc(rr)^2)+%pi*csc(rr)^2+cot(rr)-%pi/rr^2;
limit(QQ,rr,0) => 0
limit(trigsimp(QQ),rr,0) => %pi/3
limit(map('trigsimp,QQ),rr,0) => %pi/3

The correct value is %pi/3. tlimit gets it right in both cases.

The trigsimp transformation is correct.

/* Test for bug #### */
limit((-rr*csc(rr)^2)+%pi*csc(rr)^2+cot(rr)-%pi/rr^2,rr,0);
%pi/3;
limit(cos(rr)/sin(rr)-rr/sin(rr)^2+%pi/sin(rr)^2-%pi/rr^2,rr,0);
%pi/3;
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 10:02:18 Created by willisbl on 2022-01-31 01:41:55 Original: https://sourceforge.net/p/maxima/bugs/3932/#c771


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 10:02:21 Created by willisbl on 2022-01-31 01:41:55 Original: https://sourceforge.net/p/maxima/bugs/3932/#bafc


Possibly this bug has been fixed in git:

(%i2)   limit(QQ,rr,0);
(%o2)   %pi/3

(%i3)   tlimit(QQ,rr,0);
(%o3)   %pi/3

(%i4)   limit(trigsimp(QQ),rr,0);
(%o4)   %pi/3

(%i5)   limit(map('trigsimp,QQ),rr,0);
(%o5)   %pi/3
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 10:02:25 Created by robert_dodier on 2022-06-10 06:53:08 Original: https://sourceforge.net/p/maxima/bugs/3932/#e888


Hmm, I am working with a current development build (commit 8a91dae, dated 2022-06-01) and I see the incorrect behavior for limit(QQ, rr, 0):

(%i1) QQ: (-rr*csc(rr)^2)+%pi*csc(rr)^2+cot(rr)-%pi/rr^2;
(%i2) limit(QQ,rr,0);
(%o2)                                  0
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 10:02:28 Created by willisbl on 2023-05-29 14:05:28 Original: https://sourceforge.net/p/maxima/bugs/3932/#a549


My previous claim that the bug had been possibly fixed was wrong.

This bug might be related to the dodgy expressions that simplimplus can return--expressions such as zerob + zeroa. In simplimit, I pasted in the code

 ((mplusp exp) (let (($rootsconmode nil) 
                       (ans ($rootscontract (simplimplus exp))))
        (if (or (eq ans '$zerob) (eq ans '$zeroa)) ans (ridofab ans))))

and the bug went away. But I have some other uncommitted fixes to the limit code.