# Expanding powers in an expression and Hold

Let an expression like -(1/2) + (3 x^5)/2 be given.

How can this be turned into -(1/2) + (3 x x x x x)/2?

All powers of x shoud be decomposed into product form.

I tried using /.Power[] and Hold[] but this is tricky.

Like this:

Defer[-(1/2) + (3 x^5)/2] /. x_^n_?Positive :> RuleCondition@Table[x, n] /. List -> Times


-(1/2)+3/2 (x x x x x)

?

• Yes, good idea. I had to replace 'n' by '{n}' in the table in Version 8.
– JHT
Sep 20 '18 at 18:28
• Thanks, I was not aware of the Defer´ command.
– JHT
Sep 20 '18 at 18:30
• @fwgb you can use HoldForm too, depends of how long you want to keep it held. Defer is gone now so another evaluation will bring x^5 back.
– Kuba
Sep 20 '18 at 18:34
exp = -(1/2) + (3 x^5)/2;

Block[{Power = (Inactive[Times] @@ Table[#, #2] &) }, exp] (* or *)
exp /. Power -> (Inactive[Times] @@ Table[#, #2] &)
`

both give