declare(n,integer)$ abs(x)^(2*n) doesn't simplify to x^(2*n). Similarly for abs(x)^(2*floor(q)).
Maxima 5.23.2 on GCL 2.6.8 on Windows 7
With this patch to SIMPEXPT
diff --git a/src/simp.lisp b/src/simp.lisp index 1cac796..a84af43 100644 --- a/src/simp.lisp +++ b/src/simp.lisp @@ -2302,7 +2302,8 @@ (go cont)) ((atom gr) (go atgr)) ((and (eq (caar gr) 'mabs) - (evnump pot) + (or (evnump pot) + (mevenp pot)) (or (and (eq $domain '$real) (not (decl-complexp (cadr gr)))) (and (eq $domain '$complex) (decl-realp (cadr gr))))) (return (power (cadr gr) pot)))
all of the following (and similar) work:
(%i1) declare(n,integer,e,even)$ (%i2) abs(x)^(2*n); (%o2) x^(2*n) (%i3) abs(x)^e; (%o3) x^e (%i4) abs(x)^(n*e); (%o4) x^(e*n) (%i5) abs(x)^(2*floor(z)); (%o5) x^(2*floor(z))
The EVNUMP is still required so we get things like
(%i1) abs(x)^(4/3); (%o1) x^(4/3)
The test suite runs fine with this change. I can commit it if there are no objections.
My previously posted patch was committed as [bdf4de], along with some test suite tests.
Commit: [bdf4de]
Log in to post a comment.
With this patch to SIMPEXPT
all of the following (and similar) work:
The EVNUMP is still required so we get things like
The test suite runs fine with this change. I can commit it if there are no objections.
My previously posted patch was committed as [bdf4de], along with some test suite tests.
Related
Commit: [bdf4de]