## [Maxima-commits] CVS: maxima/src simp.lisp,1.115,1.116

 [Maxima-commits] CVS: maxima/src simp.lisp,1.115,1.116 From: Dieter Kaiser - 2010-09-23 20:33:12 ```Update of /cvsroot/maxima/maxima/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19744/src Modified Files: simp.lisp Log Message: Implementing the simplification of (z^a)^b more correctly. Do not simplify (z^a)^b -> z^(a*b) for all z>0, but look at the exponents a and b: 1. Simplify for b an integer 2. Simplify, if -10 and a real. Related bug report: Bug ID: 3038883: In general exp(z)^a --> exp(z*a) not correct Index: simp.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/simp.lisp,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -r1.115 -r1.116 --- simp.lisp 15 Sep 2010 00:10:38 -0000 1.115 +++ simp.lisp 23 Sep 2010 20:33:03 -0000 1.116 @@ -2041,13 +2041,18 @@ ((and \$domxmxops (member pot '(-1 -1.0) :test #'equal)) (return (simplifya (outermap1 'mexpt gr pot) t))) (t (go up))) - e1 - ;; At this point we have an expression: (z^a)^b - + ;; At this point we have an expression: (z^a)^b with gr = z^a and pot = b (cond ((or (eq \$radexpand '\$all) + ;; b is an integer or an odd rational (simplexpon pot) - (member (setq z (\$csign (cadr gr))) '(\$pos \$pz \$zero)) + (and (not (member (\$csign (caddr gr)) '(\$complex \$imaginary))) + ;; z >= 0 and a not a complex + (or (member (setq z (\$csign (cadr gr))) '(\$pos \$pz \$zero)) + ;; -1 < a <= 1 + (and (mnump (caddr gr)) + (eq (\$sign (sub 1 (take '(mabs) (caddr gr)))) + '\$pos)))) ;; (1/z)^a -> 1/z^a when z a constant complex (and (equal (caddr gr) -1) (eq z '\$complex) @@ -2064,20 +2069,20 @@ ;; Again not correct in general. ;; At first exclude the sqrt function. (not (alike1 pot '((rat simp) 1 2))))) - ;; Simplify: (z^a)^b -> z^(a*b) + ;; Simplify (z^a)^b -> z^(a*b) (setq pot (mult pot (caddr gr)) gr (cadr gr))) ((and (eq \$domain '\$real) (free gr '\$%i) \$radexpand (not (decl-complexp (cadr gr))) (evnump (caddr gr))) - ;; Simplify: (x^a)^b -> abs(x)^(a*b) + ;; Simplify (x^a)^b -> abs(x)^(a*b) (setq pot (mult pot (caddr gr)) gr (radmabs (cadr gr)))) ((and (mminusp (caddr gr)) ;; Again not correct in general. ;; At first exclude the sqrt function. (not (alike1 pot '((rat simp) 1 2)))) - ;; Simplify: (1/z^a)^b -> 1/(z^a)^b + ;; Simplify (1/z^a)^b -> 1/(z^a)^b (setq pot (neg pot) gr (list (car gr) (cadr gr) (neg (caddr gr))))) (t (go up))) ```

 [Maxima-commits] CVS: maxima/src simp.lisp,1.115,1.116 From: Dieter Kaiser - 2010-09-23 20:33:12 ```Update of /cvsroot/maxima/maxima/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19744/src Modified Files: simp.lisp Log Message: Implementing the simplification of (z^a)^b more correctly. Do not simplify (z^a)^b -> z^(a*b) for all z>0, but look at the exponents a and b: 1. Simplify for b an integer 2. Simplify, if -10 and a real. Related bug report: Bug ID: 3038883: In general exp(z)^a --> exp(z*a) not correct Index: simp.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/simp.lisp,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -r1.115 -r1.116 --- simp.lisp 15 Sep 2010 00:10:38 -0000 1.115 +++ simp.lisp 23 Sep 2010 20:33:03 -0000 1.116 @@ -2041,13 +2041,18 @@ ((and \$domxmxops (member pot '(-1 -1.0) :test #'equal)) (return (simplifya (outermap1 'mexpt gr pot) t))) (t (go up))) - e1 - ;; At this point we have an expression: (z^a)^b - + ;; At this point we have an expression: (z^a)^b with gr = z^a and pot = b (cond ((or (eq \$radexpand '\$all) + ;; b is an integer or an odd rational (simplexpon pot) - (member (setq z (\$csign (cadr gr))) '(\$pos \$pz \$zero)) + (and (not (member (\$csign (caddr gr)) '(\$complex \$imaginary))) + ;; z >= 0 and a not a complex + (or (member (setq z (\$csign (cadr gr))) '(\$pos \$pz \$zero)) + ;; -1 < a <= 1 + (and (mnump (caddr gr)) + (eq (\$sign (sub 1 (take '(mabs) (caddr gr)))) + '\$pos)))) ;; (1/z)^a -> 1/z^a when z a constant complex (and (equal (caddr gr) -1) (eq z '\$complex) @@ -2064,20 +2069,20 @@ ;; Again not correct in general. ;; At first exclude the sqrt function. (not (alike1 pot '((rat simp) 1 2))))) - ;; Simplify: (z^a)^b -> z^(a*b) + ;; Simplify (z^a)^b -> z^(a*b) (setq pot (mult pot (caddr gr)) gr (cadr gr))) ((and (eq \$domain '\$real) (free gr '\$%i) \$radexpand (not (decl-complexp (cadr gr))) (evnump (caddr gr))) - ;; Simplify: (x^a)^b -> abs(x)^(a*b) + ;; Simplify (x^a)^b -> abs(x)^(a*b) (setq pot (mult pot (caddr gr)) gr (radmabs (cadr gr)))) ((and (mminusp (caddr gr)) ;; Again not correct in general. ;; At first exclude the sqrt function. (not (alike1 pot '((rat simp) 1 2)))) - ;; Simplify: (1/z^a)^b -> 1/(z^a)^b + ;; Simplify (1/z^a)^b -> 1/(z^a)^b (setq pot (neg pot) gr (list (car gr) (cadr gr) (neg (caddr gr))))) (t (go up))) ```