## maxima-bugs

 [Maxima-bugs] [ maxima-Bugs-2631766 ] abs((1+%i)^%i) is wrong From: SourceForge.net - 2009-02-23 22:32:05 ```Bugs item #2631766, was opened at 2009-02-23 23:24 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: abs((1+%i)^%i) is wrong Initial Comment: That is the complex number when we evaluate the expression numerically: (%i91) rectform((%i+1)^%i),numer; (%o91) .1548717524642468*%i+.4288290062943678 That is the correct absolute value of the complex number: (%i92) abs(%); (%o92) .4559381277659962 Now the wrong result: (%i93) abs((%i+1)^%i); (%o93) 1 That is the result when we use cabs: (%i94) cabs((%i+1)^%i); (%o94) sqrt(%e^-(%pi/2)*sin(log(2)/2)^2+%e^-(%pi/2)*cos(log(2)/2)^2) cabs evaluates to the correct numerical result: (%i95) cabs((%i+1)^%i),numer; (%o95) .4559381277659962 Remark: It does not help that cabs gets a correct result. The abs function should give a correct result or no result. I have not studied the bug systematically. I think we have wrong results whenever we have a complex exponent. Dieter Kaiser ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2631766 ] abs((1+%i)^%i) is wrong From: SourceForge.net - 2009-02-24 03:47:12 ```Bugs item #2631766, was opened at 2009-02-23 16:24 Message generated for change (Comment added) made by willisbl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: abs((1+%i)^%i) is wrong Initial Comment: That is the complex number when we evaluate the expression numerically: (%i91) rectform((%i+1)^%i),numer; (%o91) .1548717524642468*%i+.4288290062943678 That is the correct absolute value of the complex number: (%i92) abs(%); (%o92) .4559381277659962 Now the wrong result: (%i93) abs((%i+1)^%i); (%o93) 1 That is the result when we use cabs: (%i94) cabs((%i+1)^%i); (%o94) sqrt(%e^-(%pi/2)*sin(log(2)/2)^2+%e^-(%pi/2)*cos(log(2)/2)^2) cabs evaluates to the correct numerical result: (%i95) cabs((%i+1)^%i),numer; (%o95) .4559381277659962 Remark: It does not help that cabs gets a correct result. The abs function should give a correct result or no result. I have not studied the bug systematically. I think we have wrong results whenever we have a complex exponent. Dieter Kaiser ---------------------------------------------------------------------- >Comment By: Barton Willis (willisbl) Date: 2009-02-23 21:47 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2631766 ] abs((1+%i)^%i) is wrong From: SourceForge.net - 2009-02-24 03:48:55 ```Bugs item #2631766, was opened at 2009-02-23 16:24 Message generated for change (Comment added) made by willisbl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: abs((1+%i)^%i) is wrong Initial Comment: That is the complex number when we evaluate the expression numerically: (%i91) rectform((%i+1)^%i),numer; (%o91) .1548717524642468*%i+.4288290062943678 That is the correct absolute value of the complex number: (%i92) abs(%); (%o92) .4559381277659962 Now the wrong result: (%i93) abs((%i+1)^%i); (%o93) 1 That is the result when we use cabs: (%i94) cabs((%i+1)^%i); (%o94) sqrt(%e^-(%pi/2)*sin(log(2)/2)^2+%e^-(%pi/2)*cos(log(2)/2)^2) cabs evaluates to the correct numerical result: (%i95) cabs((%i+1)^%i),numer; (%o95) .4559381277659962 Remark: It does not help that cabs gets a correct result. The abs function should give a correct result or no result. I have not studied the bug systematically. I think we have wrong results whenever we have a complex exponent. Dieter Kaiser ---------------------------------------------------------------------- >Comment By: Barton Willis (willisbl) Date: 2009-02-23 21:48 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2009-02-23 21:47 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2631766 ] abs((1+%i)^%i) is wrong From: SourceForge.net - 2009-02-25 16:44:11 ```Bugs item #2631766, was opened at 2009-02-23 23:24 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: abs((1+%i)^%i) is wrong Initial Comment: That is the complex number when we evaluate the expression numerically: (%i91) rectform((%i+1)^%i),numer; (%o91) .1548717524642468*%i+.4288290062943678 That is the correct absolute value of the complex number: (%i92) abs(%); (%o92) .4559381277659962 Now the wrong result: (%i93) abs((%i+1)^%i); (%o93) 1 That is the result when we use cabs: (%i94) cabs((%i+1)^%i); (%o94) sqrt(%e^-(%pi/2)*sin(log(2)/2)^2+%e^-(%pi/2)*cos(log(2)/2)^2) cabs evaluates to the correct numerical result: (%i95) cabs((%i+1)^%i),numer; (%o95) .4559381277659962 Remark: It does not help that cabs gets a correct result. The abs function should give a correct result or no result. I have not studied the bug systematically. I think we have wrong results whenever we have a complex exponent. Dieter Kaiser ---------------------------------------------------------------------- >Comment By: Dieter Kaiser (crategus) Date: 2009-02-25 17:44 Message: I have checked the suggested change with the testsuite and share_testsuite. There would be only one problem in rtest16.mac with example 59. We have to add an extra assumption and to remove a rectform and the test will work again. This is a diff: Index: rtest16.mac =================================================================== RCS file: /cvsroot/maxima/maxima/tests/rtest16.mac,v retrieving revision 1.65 diff -u -r1.65 rtest16.mac --- rtest16.mac 20 Feb 2009 03:33:20 -0000 1.65 +++ rtest16.mac 25 Feb 2009 16:40:20 -0000 @@ -215,9 +215,10 @@ /* * Bug [ 1661490 ] An integral gives a wrong result. */ -(assume(a>0, b>0, sqrt(sqrt(b^2+a^2)-a)*(sqrt(b^2+a^2)+a)^(3/2)-b^2>0),0); +(assume(a>0, b>0, sqrt(sqrt(b^2+a^2)-a)*(sqrt(b^2+a^2)+a)^(3/2)-b^2>0, + equal(sin(b)^2+cos(b)^2,1)),0); 0; -radcan(integrate(exp(-(a+%i*b)*x^2),x,minf,inf)/rectform(sqrt(%pi)/sqrt(a+%i*b))); +radcan(integrate(exp(-(a+%i*b)*x^2),x,minf,inf)/(sqrt(%pi)/sqrt(a+%i*b))); 1; I think we should do the suggested fix. Dieter Kaiser ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2009-02-24 04:48 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2009-02-24 04:47 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2631766 ] abs((1+%i)^%i) is wrong From: SourceForge.net - 2009-02-27 16:03:11 ```Bugs item #2631766, was opened at 2009-02-23 23:24 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: abs((1+%i)^%i) is wrong Initial Comment: That is the complex number when we evaluate the expression numerically: (%i91) rectform((%i+1)^%i),numer; (%o91) .1548717524642468*%i+.4288290062943678 That is the correct absolute value of the complex number: (%i92) abs(%); (%o92) .4559381277659962 Now the wrong result: (%i93) abs((%i+1)^%i); (%o93) 1 That is the result when we use cabs: (%i94) cabs((%i+1)^%i); (%o94) sqrt(%e^-(%pi/2)*sin(log(2)/2)^2+%e^-(%pi/2)*cos(log(2)/2)^2) cabs evaluates to the correct numerical result: (%i95) cabs((%i+1)^%i),numer; (%o95) .4559381277659962 Remark: It does not help that cabs gets a correct result. The abs function should give a correct result or no result. I have not studied the bug systematically. I think we have wrong results whenever we have a complex exponent. Dieter Kaiser ---------------------------------------------------------------------- >Comment By: Dieter Kaiser (crategus) Date: 2009-02-27 17:03 Message: The proposed fix has been committed. The Example 59 in rtest16.mac has been modified and a test was added to rtest_abs.lisp. Closing this bug report as fixed. Dieter Kaiser ---------------------------------------------------------------------- Comment By: Dieter Kaiser (crategus) Date: 2009-02-25 17:44 Message: I have checked the suggested change with the testsuite and share_testsuite. There would be only one problem in rtest16.mac with example 59. We have to add an extra assumption and to remove a rectform and the test will work again. This is a diff: Index: rtest16.mac =================================================================== RCS file: /cvsroot/maxima/maxima/tests/rtest16.mac,v retrieving revision 1.65 diff -u -r1.65 rtest16.mac --- rtest16.mac 20 Feb 2009 03:33:20 -0000 1.65 +++ rtest16.mac 25 Feb 2009 16:40:20 -0000 @@ -215,9 +215,10 @@ /* * Bug [ 1661490 ] An integral gives a wrong result. */ -(assume(a>0, b>0, sqrt(sqrt(b^2+a^2)-a)*(sqrt(b^2+a^2)+a)^(3/2)-b^2>0),0); +(assume(a>0, b>0, sqrt(sqrt(b^2+a^2)-a)*(sqrt(b^2+a^2)+a)^(3/2)-b^2>0, + equal(sin(b)^2+cos(b)^2,1)),0); 0; -radcan(integrate(exp(-(a+%i*b)*x^2),x,minf,inf)/rectform(sqrt(%pi)/sqrt(a+%i*b))); +radcan(integrate(exp(-(a+%i*b)*x^2),x,minf,inf)/(sqrt(%pi)/sqrt(a+%i*b))); 1; I think we should do the suggested fix. Dieter Kaiser ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2009-02-24 04:48 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2009-02-24 04:47 Message: A fix might be to change cabs to \$cabs in simpabs: (defmfun simpabs (x y z) (oneargcheck x) (setq y (simpcheck (cadr x) z)) (cond ((numberp y) (abs y)) ((or (arrayp y) (\$member y \$arrays)) `((mabs simp) ,y)) ((or (ratnump y) (\$bfloatp y)) (list (car y) (abs (cadr y)) (caddr y))) ((taylorize 'mabs (second x))) ((member y '(\$inf \$infinity \$minf) :test #'eq) '\$inf) ((member y '(\$ind \$und) :test #'eq) y) ((eq (setq z (csign y)) t) (\$cabs y)) <---- was (cabs y) ((member z '(\$pos \$pz) :test #'eq) y) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2631766&group_id=4933 ```