From: SourceForge.net <no...@so...> - 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 |