Is there a way to impose in mathematica an specific trigonometric expansion with TrigExpand?
I have various double-angle expressions for cosine and sine in my problem and i need to rewrite them in terms of cosines and sines functions. With this code you can get the same expressions than me.
ClearAll["Global`*"] SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Condensed"] $PrePrint = # /. {Csc[z_] :> 1/Defer@Sin[z], Sec[z_] :> 1/Defer@Cos[z], Cot[z_] :> Defer@Cos[z]/Defer@Sin[z]} &; Derivative /: MakeBoxes[Derivative[α__][f1_][vars__], TraditionalForm] := Module[{bb, dd, sp}, MakeBoxes[dd, _] ^= If[Length[{α}] == 1, "\[DifferentialD]", "∂"]; MakeBoxes[sp, _] ^= "\[ThinSpace]"; bb /: MakeBoxes[bb[x__], _] := RowBox[Map[ToBoxes[#] &, {x}]]; TemplateBox[{ToBoxes[bb[dd^Plus[α], f1]], ToBoxes[Apply[bb, Riffle[Map[bb[dd, #] &, Select[({vars}^{α}), (# =!= 1 &)]], sp]]], ToBoxes[Derivative[α][f1][vars]]}, "ShortFraction", DisplayFunction :> (FractionBox[#1, #2] &), InterpretationFunction :> (#3 &), Tooltip -> Automatic]] Subscript[w, 1] = f[Subscript[r, 1], Subscript[r, 2], α, β, γ, Subscript[Θ, 12]]; Set[J, -(D[Subscript[w, 1], {β, 2}] + 1/Sin[β]^2 (D[Subscript[w, 1], {α, 2}] + D[Subscript[w, 1], {γ, 2}]) + Cot[β] D[Subscript[w, 1], β] - 2 Cot[β]/ Sin[β] D[Subscript[w, 1], α, γ])] // TraditionalForm ; Set[Subscript[a, 1], 2 D[Subscript[w, 1], {β, 2}] + D[Subscript[w, 1], {γ, 2}] + J] // TraditionalForm ; Set[Subscript[a, 2], 2 Cot[β]/ Sin[β] D[Subscript[w, 1], {α, 1}] - (1 + 2 Cot[β]^2) D[Subscript[w, 1], {γ, 1}] - 2/Sin[β] D[Subscript[w, 1], β, α] + 2 Cot[β] D[Subscript[w, 1], β, γ]] // TraditionalForm ; Set[Subscript[f, 1], 1/(2 Sin[Subscript[Θ, 12]]^2) (-J + Cos[Subscript[Θ, 12]] (Sin[2 γ] Subscript[a, 2] - Cos[2 γ] Subscript[a, 1]) + Sin[Subscript[Θ, 12]] (Sin[2 γ] Subscript[a, 1] + Cos[2 γ] Subscript[a, 2])) - D[Subscript[w, 1], Subscript[Θ, 12], γ] - 1/2 Cot[Subscript[Θ, 12]] D[Subscript[w, 1], {γ, 1}] + (1/4 - 1/( 2 Sin[Subscript[Θ, 12]]^2)) D[Subscript[w, 1], {γ, 2}] ] // ExpandAll // TraditionalForm ; Set[lapla1, -(1/( 2 Subscript[μ, 1])) (1/Subscript[r, 1] D[Subscript[w, 1] Subscript[r, 1], {Subscript[r, 1], 2}] - 1/Subscript[r, 1]^2 (D[Subscript[w, 1], {Subscript[Θ, 12], 2}] + Cot[Subscript[Θ, 12]] D[Subscript[w, 1], {Subscript[Θ, 12], 1}]) - Subscript[f, 1]/Subscript[r, 1]^2)] // ExpandAll // TraditionalForm In this specific case, when I use TrigExpand for lapla1, mathematica does not use a unique relation for doing the expansion of each of the terms and is quite difficult to follow it by hand. So, I would like to impose these two specific trigonometric expansions in order to check the results.
$$\sin(2x)= 2\cos x \sin x$$ $$\cos(2x)= \cos^2 x-\sin ^2x$$
Yo can check that those expressions above can be written in several ways:


TrigExpandfunction, so what I did to solve the problem waslapla1 /. {Sin[2 \[Gamma]] -> 2 Sin[\[Gamma]] Cos[\[Gamma]] , Cos[2 \[Gamma]] -> Cos[\[Gamma]]^2 - Sin[\[Gamma]]^2} // ExpandAll // TraditionalForm. Sorry for any inconvenience $\endgroup$