4
$\begingroup$

I have some trigonometric quantities, which may be expressed in either sine or cosine, e.g., ia = Cos[wt], ib = -Sin[π/6 + wt], ic = -Sin[π/6 - wt]. In order to compare the phase of the three quantities, I would like to convert all quantities to the form of Cos[wt + phase]. For the three quantities, they need to appear as ia = Cos[wt], ib = Cos[wt - 2π/3], ic = Cos[wt + 2π/3] after the manipulation. What is a simple way to do that?

$\endgroup$
7
$\begingroup$
Inactivate[{Cos[wt], -Sin[π/6 + wt], -Sin[π/6 - wt]} //.
  {Sin[x_] -> Cos[x-π/2], Cos[-wt+x_] -> Cos[wt-x], -Cos[x_] -> Cos[x+π]}, Cos]

{Inactive[Cos][wt], Inactive[Cos][2π/3 + wt], Inactive[Cos][-2π/3 + wt]}

The Inactivate[..., Cos] wrapper makes sure that the Cos[...] functions do not automatically revert to Sin[...] etc. by instantaneous simplification. You can use Activate on the result to return it to its normal state:

Activate[%]

{Cos[wt], -Sin[π/6 + wt], -Sin[π/6 - wt]}

$\endgroup$
  • $\begingroup$ Thank you. Like the ReplaceRepeated //. idea. $\endgroup$ – nanjun Apr 2 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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