2
$\begingroup$

This question already has an answer here:

I've tried several functions related to trigonometric transformations, namely TrigFactor, TrigExpand, TrigReduce, as well as FunctionExpand and some others, but none gives me the following result (or similar) which I can verify with FullSimplify:

FullSimplify[ A Cos[x] + B Sin[x] == Sqrt[A^2+B^2] Sin[x+ArcTan[B,A]] ]

Of course, this is not a simplification of the LHS, so it's unreasonable to expect FullSimplify to yield it directly, but maybe I'm missing some more functions, which could directly lead me to expression similar to RHS of the above equality (i.e. containing only one $\sin$ or $\cos$ of shifted $x$ instead of superposition of multiple $\sin$-$\cos$es). Are there any such functions?

$\endgroup$

marked as duplicate by Michael E2, MarcoB, user9660, Community Feb 14 '16 at 6:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Perhaps this function: CosSin[A_ Cos[x_]+B_ Sin[x_]] := Sqrt[A^2+B^2] Sin[x+ArcTan[B, A]]; {CosSin[3 Cos[y]+4 Sin[y]], CosSin[p Sin[z]+q Cos[z]]} $\endgroup$ – Bill Feb 13 '16 at 18:01
3
$\begingroup$

You can define some new TransformationFunctions and ComplexityFunction for Simplify.

tfun[expr_] := 
  expr /. a_ Cos[x_] + b_ Sin[x_] :> Sqrt[a^2 + b^2] Sin[x + ArcTan[b, a]];
cfun[expr_] := 
  Plus @@ (Count[expr, #, {0, Infinity}, Heads -> True] & /@ {Sin, Cos});

Then

Simplify[A Cos[x] + B Sin[x], TransformationFunctions -> {Automatic, tfun}, 
ComplexityFunction -> cfun]
(* -> Sqrt[A^2 + B^2] Sin[x + ArcTan[B, A]] *)
$\endgroup$

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