Menu

#2230 abs(x)^(2*int) doesn't simplify

None
closed
nobody
5
2015-06-27
2011-07-18
No

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

Discussion

  • Kris Katterjohn

    Kris Katterjohn - 2015-05-22

    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.

     
  • Kris Katterjohn

    Kris Katterjohn - 2015-06-27
    • status: open --> closed
    • Group: --> None
     
  • Kris Katterjohn

    Kris Katterjohn - 2015-06-27

    My previously posted patch was committed as [bdf4de], along with some test suite tests.

     

    Related

    Commit: [bdf4de]


Log in to post a comment.

MongoDB Logo MongoDB