rtoy / maxima

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

asksign(x*cos(y) - x) --> incorrect result, without assume(x > 0) #3615

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-08 10:24:12 Created by robert_dodier on 2020-11-14 21:00:27 Original: https://sourceforge.net/p/maxima/bugs/3676


Without assume(x > 0) (subject of a separate bug report), asksign(x*cos(y) - x) and variations yield incorrect results.

(%i1) asksign (x*cos(y) - x);
Is x positive, negative or zero?
p;
(%o1)                                 pos
(%i2) asksign (x*(cos(y) - 1));
Is x positive, negative or zero?
p;
(%o2)                                 pos
(%i3) asksign (x*(cos(y) - 1));
Is x positive, negative or zero?
n;
(%o3)                                 neg

Those should be nz, nz, and pz, respectively, if I'm not mistaken.

Same behavior for sin(y).

I guess asksign is trying to be clever about the trig functions -- asksign(x*foo(y) - x) behaves differently (asking "Is x (foo(y) - 1) positive, negative or zero?" which isn't incorrect, although not too useful).

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-08 10:24:13 Created by robert_dodier on 2020-11-15 05:48:26 Original: https://sourceforge.net/p/maxima/bugs/3676/#f4d5