e1 = 2 Sin[t + 0.3];
e2 = 5 Cos[t + π/4];
e3 = Cos[t - 3.1];
expr = e1 + e2 + e3
FullSimplify[expr]
3.12744 Cos[t] - 1.58328 Sin[t]
res = FullSimplify[expr] /.
a_. Cos[t] + b_. Sin[t] :> a Sqrt[1 + b^2/a^2] Cos[t - ArcTan[b/a]]
3.50537 Cos[0.468639 + t]
Plot[{e1, e2, e3, expr, res}, {t, 0, 6 π},
PlotStyle -> {Automatic, Automatic, Automatic
, {Opacity[0.6, Red], Thickness[0.02]}, {Thick, Blue}}
, PlotLegends -> "Expressions"
]
How to arrive at the replacement formula:
{TrigExpand[A Cos[t - ϕ]], a Cos[t] + b Sin[t]}
{A Cos[t] Cos[ϕ] + A Sin[t] Sin[ϕ], a Cos[t] + b Sin[t]}
Comparing the two and solving:
sol = First[
Assuming[{a, b, A, ϕ} ∈ Reals,
Solve[{A Cos[ϕ] == a ,
A Sin[ϕ] == b }, {A, ϕ}]]] /. C[1] -> 1;
A Cos[t - ϕ] /. sol
TrigExpand
does the first. For the second task there is a resource function.In[591]:= ResourceFunction["TrigContract"][ Cos[3.1 - t] + 5 Cos[\[Pi]/4 + t] + 2 Sin[0.3 + t]] Out[591]= 3.50537 Cos[0.468639 + t]
$\endgroup$Rationalize
d expressions. $\endgroup$