rtoy / maxima

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

sign(sqrt(2)/2 - 1/sqrt(2)) => zero, pos, neg, or pnz #2346

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 06:11:19 Created by willisb on 2003-09-01 14:10:33 Original: https://sourceforge.net/p/maxima/bugs/395


Depending on the values of fpprec and signbfloat, sign(sqrt(2)/2 - 1/sqrt(2)) evaluates to zero, pos, neg, or pnz.

(C1) display2d : false;

(D1) FALSE (C2) a : sqrt(2)/2 - 1/sqrt(2);

(D2) SQRT(2)/2-1/SQRT(2) (C3) for k : 20 thru 25 do (fpprec : k, print(k,sign(a)));

20 ZERO 21 POS 22 ZERO 23 POS 24 ZERO 25 NEG (D3) DONE (C4) sign(a), signbfloat : true;

(D4) NEG (C5) sign(a), signbfloat : false;

(D5) PNZ

Here is another example -- this time sign(p) should evaluate to pos.

(C7) p : exp(x) - sum(x^k/k!,k,0,15)$

(C8) p : subst(1/10000001,x,p)$

(C9) sign(p),signbfloat : true;

(D9) ZERO (C10) sign(p),signbfloat : false;

(D10) PNZ (C11) for k : 20 thru 25 do (fpprec : k, print(k,sign (p)));

20 POS 21 NEG 22 NEG 23 ZERO 24 POS 25 ZERO (D11) DONE (C12)

Additionally, signbfloat isn't documented

(C17) describe("signbfloat");

(D17) FALSE

Barton

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 06:11:20 Created by macrakis on 2003-10-20 05:57:20 Original: https://sourceforge.net/p/maxima/bugs/395/#636e


Logged In: YES user_id=588346

About the specific case of sqrt(2)/2 - 1/sqrt(2), cf. bug 721575 -- they should really simplify to a standard form and cancel. The general problem of using approximate arithmetic to check sign/is remains.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 06:11:23 Created by robert_dodier on 2006-07-10 03:27:04 Original: https://sourceforge.net/p/maxima/bugs/395/#842f


Logged In: YES user_id=501686

The p : exp(x) - sum(x^k/k!,k,0,15)$ etc stuff is still present in 5.9.3cvs.

Now sqrt(2)/2 - 1/sqrt(2) simplifies to 0, so that one has gone away.

Incrementing the priority since sign problems are pervasive and important.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-06 06:11:27 Created by robert_dodier on 2006-07-10 03:27:05 Original: https://sourceforge.net/p/maxima/bugs/395/#727b