2
$\begingroup$

I having an expression containing terms that are powers of $w$. How can I simplify these terms using the assumption $w^3=1$?

Simplify[expr, w^3==1 && n ∈ PositiveIntegers]

doesn't work for terms that have symbolic variable, e.g. $n$, in the exponent.

EDIT: Example expression:

( -a*w^3 + b*(n+1)*w^6 + 9*w^(3+3*n)*Sum[d[i], {i,1,n}]^2 - w^(3+6*n)*Sum[c[i], {i,1,n}] ) / (s^2*w^(4 + 3*n) )
$\endgroup$
3
  • $\begingroup$ Kindly provide us expr so we have an example to work with $\endgroup$ Jun 13, 2019 at 14:52
  • $\begingroup$ @JackLaVigne I added an example for the expression. $\endgroup$
    – Myath
    Jun 13, 2019 at 15:15
  • $\begingroup$ You only have to give a rule w^n_- >If[n==3 ,1,w^(n-3)]` (sorry actually No MMA acces) $\endgroup$ Jun 13, 2019 at 16:34

2 Answers 2

6
$\begingroup$

Since $w^3=1$, one can use $w^\alpha=w^{\alpha \text{ mod } 3}$ to simplify arbitrary powers of $w$. This can be implemented as a simple rule:

wrule = w^(x_) :> w^Refine[Mod[x, 3], Assumptions->Element[n, Integers]];

Examples:

{w^1, w^2, w^3, w^4, w^(3n), w^(6n), w^(3+3n), w^(4+3 n), w^(-4-3n)} /. wrule

{w, w^2, 1, w, 1, 1, 1, w, w^2}

$\endgroup$
3
  • $\begingroup$ Nice solution but I believe you need to treat negative integers differently. Applying w^-4/.wrule results in w^2. I think it should result in 1/w (i.e., w^-1). $\endgroup$ Jun 14, 2019 at 22:22
  • $\begingroup$ @JackLaVigne If w^3==1 then w^-1 == 1 * w^-1 == w^3 * w^-1 == w^2. Thus both results are actually the same. $\endgroup$
    – Ray Shadow
    Jun 14, 2019 at 22:34
  • $\begingroup$ You are so right, thank you for pointing that out. $\endgroup$ Jun 14, 2019 at 22:38
4
$\begingroup$

A good strategy when attempting to replace portions of an expression is to look at the FullForm.

Below is an example expression:

expr = w^4 + w^(3 n) + w^(6 n) + w^(3 + 3 n) + w^(4 + 3 n)

and the associated FullForm

FullForm[expr]

Mathematica graphics

By examining the FullForm of expr we see three forms where w is raised to a power involving integers: directly, with a times or with a plus and times.

Use patterns with ReplaceAll to accomplish the job.

expr //. {
  Power[w, Plus[integer_Integer /; integer > 2, rest_]] -> 
   Power[w, Plus[integer - 3, rest]],
  Power[w, integer_Integer] -> Power[w, integer - 3],
  Power[w, Times[integer_Integer, n]] -> 
   Power[w, Times[integer - 3, n]]
  }

Mathematica graphics

Update

Upon request, the following expression was given as an example.

expr = (-a*w^3 + b*(n + 1)*w^6 + 
    9*w^(3 + 3*n)*Sum[d[i], {i, 1, n}]^2 - 
    w^(3 + 6*n)*Sum[c[i], {i, 1, n}])/(s^2*w^(4 + 3*n))

Now one additional rule to handle negative integers is required.

expr //. {
  Power[w, Plus[integer_Integer /; integer > 2, rest_]] -> 
   Power[w, Plus[integer - 3, rest]],
  Power[w, Plus[integer_Integer /; integer < -2, rest_]] -> 
   Power[w, Plus[integer + 3, rest]],
  Power[w, integer_Integer] -> Power[w, integer - 3],
  Power[w, Times[integer_Integer, n]] -> 
   Power[w, Times[integer - 3, n]]
  }

Mathematica graphics

One might want to go further and assume that n is an integer. I leave that as an exercise for you.

$\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.