3
$\begingroup$

I would expect the following:

FullSimplify[(a*b)^i, a > 0 && b > 0 && i > 0]

to give me a^i * b^i as output. Much like (a*b)^2 is immediately reduced to a^2 * b^2. How can I achieve this?

$\endgroup$
2
  • $\begingroup$ Generally speaking LeafCount[(a b)^i] < LeafCount[a^i b^i], so it would require some special simplification rule for Simplify to give you what you want. As I understand it, the (a b)^2 case is not being simplified, but simply processed that way by the parser before evaluation. $\endgroup$
    – MarcoB
    Apr 4, 2019 at 17:46
  • $\begingroup$ Distribute[(a*b)^i,Times, Power] $\endgroup$
    – chuy
    Apr 4, 2019 at 17:47

3 Answers 3

4
$\begingroup$

As mentioned in the comments, the default ComplexityFunction considers a^i b^i to be more complex than (a b)^i, hence your desired form will not be returned.

Besides using PowerExpand, you could also use a ComplexityFunction that penalizes complex expressions in the base of Power objects:

cf[expr_] := LeafCount[expr] + Total @ Cases[expr, Power[a_, _] :> 10 LeafCount[a], All]
FullSimplify[
    (a b)^i,
    a>0 && b>0 && i>0,
    ComplexityFunction -> cf
]

a^i b^i

$\endgroup$
4
$\begingroup$
(a*b)^i // PowerExpand

a^i b^i

As @MarcoB points out, there are many assumptions here, detailed in the documentation: in this case, it is assumed that i is an integer and a and b are positive real numbers.

$\endgroup$
1
  • $\begingroup$ ... with the usual caveat that PowerExpand makes some assumptions (real values of variables), which happen to be upheld in this particular case. $\endgroup$
    – MarcoB
    Apr 4, 2019 at 17:44
2
$\begingroup$

The simple ComplexityFunction

cf[e_] := LeafCount[e] + 10 Count[e, _Times]

also works:

FullSimplify[(a b)^i, a > 0 && b > 0 && i > 0, ComplexityFunction -> cf]
(* a^i b^i *)

If (a b)^i lies lower in the expression, then its level must be specified. For instance,

cf2[e_] := LeafCount[e] + 10 Count[e, _Times, {2}]
FullSimplify[1 + (a b)^i, a > 0 && b > 0 && i > 0, ComplexityFunction -> cf2]
(* 1 + a^i b^i *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.