# Verify Harmonic Addition Theorem with Mathematica

I've calculated the harmonic addition theorem and would just like to check my result with Mathematica.

However,

a Exp[I (ω t + ϕ1)] + b Exp[I (ω t + ϕ2)] ==
Sqrt[a^2 + b^2 + 2 a b Cos[ϕ1 - ϕ2]] Exp[
I (ω t + ArcTan[(a Sin[ϕ1] + b Sin[ϕ2])/(a Cos[ϕ1] +
b Cos[ϕ2])])] && Element[{a, b, ϕ1, ϕ2, ω, t}, Reals]


does not evaluate to True, Reduce does not work either. Numerically, it seems to be true on a 10^-15 level:

init = a Exp[I (ω t + ϕ1)] +  b Exp[I (ω t + ϕ2)]
/. {a -> 3, b -> 5, ϕ1 -> 0, ϕ2 -> π/3, ω -> 1}

sum = Sqrt[a^2 + b^2 + 2 a b Cos[ϕ1 - ϕ2]] Exp[I (ω t +
ArcTan[(a Sin[ϕ1] + b Sin[ϕ2])/(a Cos[ϕ1] + b Cos[ϕ2])])]
/. {a -> 3, b -> 5, ϕ1 -> 0, ϕ2 -> π/3, ω -> 1}

Plot[Re[init - sum], {t, -30, 30}]
Plot[Im[init - sum], {t, -30, 30}]


What should I be doing better / what's the point I am missing?

-
This does not seem to be true for any values. Try ... /. {a -> 1, b -> 1, \[Phi]1 -> Pi/2, \[Phi]2 -> Pi, t -> 1/2, \[Omega] -> 1} . FullSimplify tells me that it's only true if a Cos[\[Phi]1] + b Cos[\[Phi]2] > 0. – Szabolcs Sep 19 '13 at 15:28
Try like this: FullSimplify[ a E^(I (\[Phi]1 + t \[Omega])) + b E^(I (\[Phi]2 + t \[Omega])) == E^(I (t \[Omega] + ArcTan[(a Sin[\[Phi]1] + b Sin[\[Phi]2])/( a Cos[\[Phi]1] + b Cos[\[Phi]2])])) Sqrt[ a^2 + b^2 + 2 a b Cos[\[Phi]1 - \[Phi]2]], Assumptions -> (a | b | \[Phi]1 | \[Phi]2 | \[Omega] | t) \[Element] Reals] – Szabolcs Sep 19 '13 at 15:28

In these situations you would typically use Simplify or FullSimplify, and put the restrictions on variables into the Assumptions option (not append them to the equation with &&).

eq =
a E^(I (ϕ1 + t ω)) + b E^(I (ϕ2 + t ω)) ==
E^(I (t ω + ArcTan[(a Sin[ϕ1] + b Sin[ϕ2])/(a Cos[ϕ1] + b Cos[ϕ2])])) Sqrt[a^2 + b^2 + 2 a b Cos[ϕ1 - ϕ2]]

FullSimplify[eq, Assumptions -> (a | b | ϕ1 | ϕ2 | ω | t) \[Element] Reals]

(* ==> (a E^(I ϕ1) + b E^(I ϕ2) == 0 && a Cos[ϕ1] + b Cos[ϕ2] < 0) ||
a Cos[ϕ1] + b Cos[ϕ2] > 0 *)


FullSimplify tell us that eq is true only if a Cos[ϕ1] + b Cos[ϕ2] > 0. If we try numerically a set of values that violates this, the equation doesn't hold:

eq /. {a -> 1, b -> 1, ϕ1 -> Pi/2, ϕ2 -> Pi, t -> 1/2, ω -> 1}
(* ==> False *)

-