0
$\begingroup$

I have many terms like

A = Cos[Pi/18 + 2 x] + Cos[Pi/18 - 2 x]

and I want to convert A to

2 Cos[Pi/18] Cos[2 x]

automatically.

How can I do this?

What I can get by Simplify[A] is -(-1)^(17/18) (1 + (-1)^(1/9)) Cos[2 x], but I don't like these exponential terms.

$\endgroup$
  • $\begingroup$ Try terms/.A->(2 Cos[Pi/18] Cos[2 x]) $\endgroup$ – Algohi Dec 8 '14 at 12:48
2
$\begingroup$

Try this:

    A = (Cos[Pi/18 + 2 x] + Cos[Pi/18 - 2 x] /. Pi -> pi // Simplify) /. 
  pi -> \[Pi]

(*    2 Cos[\[Pi]/18] Cos[2 x]   *)

Have fun!

$\endgroup$
1
$\begingroup$

You can use TrigExpand and then Simplify:

TrigExpand[Cos[Pi/18 + 2 x] + Cos[Pi/18 - 2 x]] // Simplify

(* 2 Cos[\[Pi]/18] Cos[2 x] *)
$\endgroup$

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.