4
$\begingroup$

How can I factorise into powers of integer exponents?

An expression such as,

factored = 
  2^(-j - k) E^(-y/t) 
    (I (E^(-I y w) - E^(I y w)))^k (E^(-I y w) + E^(I y w))^j

can be expressed as,

unfactored = 
  I^k 2^(-j - k) E^(-y/t - I j y w - I k y w) 
    (1 - E^(2 I y w))^k (1 + E^(2 I y w))^j

My aim is to reduce unfactored to $e^{-y/t}\cos^j (y\,w)\sin^k (y\,w)$, but Mathematica doesn't seem to be able to do this unless the expression is factorised in terms of j, k as in factored

Attempts

  • Collect[unfactored, {E^(y w), E^(- y w)}] and variants
  • ExpToTrig[unfactored] // FullSimplify and variants

Working Example and a sanity check!

ExpToTrig[
  (I/2 E^(-I y w) (1 - E^(2 I y w)))^k 
    (1/2 E^(-I y w) (1 + E^(2 I y w)))^j] // FullSimplify

gives, $ \cos^j(y\,w) \sin ^k(y\,w) $

$\endgroup$
9
  • $\begingroup$ Have you looked into ComplexExpand[], by any chance? $\endgroup$ Commented Jul 31, 2016 at 21:08
  • $\begingroup$ Thanks, just tried that and it didn't really help. Should I explicitly specify somehow that $j,k \in \mathbb{N}$ $\endgroup$ Commented Jul 31, 2016 at 21:10
  • 2
    $\begingroup$ Did you try adjusting TargetFunctions? $\endgroup$ Commented Jul 31, 2016 at 21:17
  • 1
    $\begingroup$ Do factored and unfactored really represent the same quantity? $\endgroup$
    – m_goldberg
    Commented Jul 31, 2016 at 23:36
  • 1
    $\begingroup$ Yeah I actually brute forced the comparison by changing it one tiny bit at a time. I will post the forced method later today $\endgroup$ Commented Aug 1, 2016 at 2:16

2 Answers 2

3
$\begingroup$

I have encountered problems of this sort when deriving plasma dispersion relations with Mathematica. The essence of the problem appears to be that FullSimplify does not have

tf[e_] := e //. 
    {Exp[z1_ - I z2_ z3_] (1 + Exp[2 I z3_])^z2_ -> Exp[z1] (Exp[-I z3] + Exp[I z3])^z2, 
     Exp[z1_ - I z2_ z3_] (1 - Exp[2 I z3_])^z2_ -> Exp[z1] (Exp[-I z3] - Exp[I z3])^z2}

among its TransformationFunctions. Adding it solves the problem.

FullSimplify[unfactored, (j | k) ∈ Integers, TransformationFunctions -> {Automatic, tf}]

(* E^(-(y/t)) Cos[w y]^j Sin[w y]^k *)

Note that, if j and k were specific integers, FullSimplify together with Expand would be sufficient. For instance,

FullSimplify[Expand[unfactored /. {j -> 3, k -> 4}]]

(*( E^(-(y/t)) Cos[w y]^3 Sin[w y]^4 *)
$\endgroup$
2
  • $\begingroup$ strange... If you use exactly the same expression but remove -y/t from the exponential then it fails. Is this because the rule explicitly references Exp[z1]? Just tested and confirmed that is the reason. Very informative answer. $\endgroup$ Commented Aug 1, 2016 at 16:49
  • $\begingroup$ @AlexanderMcFarlane That right. If z1 is zero, a different rule is needed, tf[e_] := e //. {Exp[z1_ - I z2_ z3_] (1 + Exp[2 I z3_])^z2_ -> Exp[z1] (Exp[-I z3] + Exp[I z3])^z2, Exp[-I z2_ z3_] (1 - Exp[2 I z3_])^z2_ -> (Exp[-I z3] - Exp[I z3])^ z2}. $\endgroup$
    – bbgodfrey
    Commented Aug 1, 2016 at 17:12
0
$\begingroup$

Try this:

unfactored /. 
  E^(a_ - I *p_* w y)*(1 + E^(2*I * w y))^p_ :> E^a*2*Cos[p w y]^p /. 
 E^(a_ - I *p_* w y)*(1 - E^(2*I * w y))^p_ :> -E^a*2*I*Sin[p w y]^p

(*  -I I^k 2^(2 - j - k) E^(-(y/t)) Cos[j w y]^j Sin[k w y]^k  *)

Have fun!

$\endgroup$
2
  • $\begingroup$ can you briefly explain what the two pieces of notation: /. and :> are doing? Is this an in-line version of @bbgodfrey 's answer? $\endgroup$ Commented Aug 1, 2016 at 16:51
  • $\begingroup$ @Alexander McFarlane Just type ?/.+Enter and ?:>+Enter and you will have an explanation, and then click on the >> sign in its end to have details. It is more or less the same as in bbgodfrey answer, differing in fine details. $\endgroup$ Commented Aug 2, 2016 at 8:47

Your Answer

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

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