Subject: (new) sqrt(-1/abs(x))-1/sqrt(-abs(x))=>0OVERVIEW of bugs #6357:
URL:
<http://savannah.nongnu.org/bugs/?func=detailitem&item_id=6357>
Summary: sqrt(-1/abs(x))-1/sqrt(-abs(x))=>0
Project: Axiom Computer Algebra System
Submitted by: kratt5
Submitted on: Tue 11/04/2003 at 13:26
Category: algebra
Severity: 5 - Average
Item Group: code bug
Status: transferred
Privacy: Public
Assigned to: billpage1
Originator Name: kratt5
Originator Email:
Open/Closed: Open
Release: CVS 3.11.2003
Reproducibility: None
Fixed Release:
Error message:
Example of code trigerring the bug: fricas (1) -> sqrt(-1/abs(x))-1/sqrt(-abs(x))
Type: Expression(Integer)
should be: fricas 2*%i/sqrt(x)
Type: Expression(Complex(Integer))
------------------------------------------------------- Date: Fri 06/11/2004 at 10:43 By: Martin Rubey patched by patch #3089 ------------------------------------------------------- Date: Tue 11/04/2003 at 14:43 By: Martin Rubey The error occurs, because: sqrt(1/x::Expression Integer)=>1/sqrt(x) patched in axiom-patch-25 --kratt6, Thu, 23 Jun 2005 07:43:01 -0500 reply Category: => Axiom Compiler
Status: => closed
Just for the archive, here is the patch:
--- /home/rubey/axiom/mnt/linux/src/algebra/algfunc.spad 2004-05-21 18:51:30.000000000 +0200
+++ algfunc.spad 2004-05-25 13:39:19.000000000 +0200
@@ -431,9 +431,20 @@
hackroot(x, n) ==
-- one? n or one? x => x
(n = 1) or (x = 1) => x
+
+-- the following is FALSE! if x can be negative. Example: x=-1/2 would pass the
+-- test and give 1/(-2)^(1/n) ~= (-1/2)^(1/n)
-- (x ^= -1) and (one?(num := numer x) or (num = -1)) =>
- (x ^= -1) and (((num := numer x) = 1) or (num = -1)) =>
- inv hackroot((num * denom x)::F, n)
+-- (x ^= -1) and (((num := numer x) = 1) or (num = -1)) =>
+-- inv hackroot((num * denom x)::F, n)
+
+-- permissible when denom x is a positive number
+
+ (((dx := denom x) ^= 1) and
+ ((rx := retractIfCan(dx)@Union(Integer,"failed")) case Integer) and
+ positive?(rx))
+ => hackroot((numer x)::F, n)/hackroot(rx::Integer::F, n)
+
(x = -1) and n = 4 =>
((-1::F) ** (1::Q / 2::Q) + 1) / ((2::F) ** (1::Q / 2::Q))
kernel(oproot, [x, n::F])
Category: Axiom Compiler => Axiom Library
|
