BeginPackage["CSM`TrigArgument`"]

TrigArgument::usage = "TrigArgument[e] writes trigonometric functions
	of sums and products as products of simple trigonometric functions."

Begin["`Private`"]

trigArgumentRules = {
	Sin[x_ + y_] :> Sin[x] Cos[y] + Sin[y] Cos[x],
	Cos[x_ + y_] :> Cos[x] Cos[y] - Sin[x] Sin[y],
	Sin[n_Integer?Positive x_.] :>
		Sum[ (-1)^((i-1)/2) Binomial[n, i] Cos[x]^(n-i) Sin[x]^i,
		    {i, 1, n, 2} ],
	Cos[n_Integer?Positive x_.] :>
		Sum[ (-1)^(i/2) Binomial[n, i] Cos[x]^(n-i) Sin[x]^i,
		    {i, 0, n, 2} ]
}

SetAttributes[TrigArgument, Listable]

TrigArgument[expr_] :=
	Together[ FixedPoint[ Function[e, e //. trigArgumentRules], expr ] ]

End[]

Protect[ TrigArgument ]

EndPackage[]
