rtoy / maxima

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

ratsubst fails to report division by zero #1515

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 18:03:37 Created by macrakis on 2021-12-08 00:14:31 Original: https://sourceforge.net/p/maxima/bugs/3898


ex: a/(sqrt(a+1)-1)$
ratsubst(0,a,ex) => 0 

but ratsubst on the numerator and denominator separately shows that they're both 0:

ratsubst(0,a,args(ex)) => [0,0]

... so it should be reporting division by zero, as subst does.

You might think it's doing something clever (L'Hôpital?, limit?, simplification?), and that in fact there is a removable singularity at a=0 (which Maxima generally ignores: a/a => 1), making 0 is a reasonable result, but that is not correct. It is never zero, even as a limit at a=0.

taylor(ex,a,0,1) => 2+a/2+...

It does simplify using ratsimp:

ratsimp(ex),algebraic => sqrt(a+1)+1

again showing that its value at a=0 is 2.

Maxima 5.45.1 SBCL 2.0.0 Windows 10

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 18:03:38 Created by macrakis on 2021-12-08 00:17:02 Original: https://sourceforge.net/p/maxima/bugs/3898/#5484


Diff:


--- old
+++ new
@@ -17,3 +17,5 @@
 ratsimp(ex),algebraic => sqrt(a+1)+1

again showing that its value at a=0 is 2. + +Maxima 5.45.1 SBCL 2.0.0 Windows 10