I am dealing with huge expressions that contain sums and products of trig functions as well as other terms. I wish to work with the expressions and make substitutions for various coefficients turning them into dimensionless groups. To help with this process I would like to replace the trig functions with symbols so I can see the overall form of the expression. As an example I give a very simple expression below and show how I replace the subexpressions made from trig functions by cutting and pasting. I wish to avoid cutting and pasting and do this automatically. Here is the expression.
e1 = (2 c q r w (-1 + Cos[k L2]))/(c S r w (4 Cos[k L1] - Cos[k (L1 - L2)] - 3 Cos[k (L1 + L2)]) + 2 M (w - w0) (w + w0) Sin[k (L1 + L2)]);
(* I cut and paste the trig functions avoiding all symbolic coefficients. How do I automate this? *)
ClearAll[f1, f2, f3];
subs = {f1 -> -1 + Cos[k L2],
f2 -> 4 Cos[k L1] - Cos[k (L1 - L2)] - 3 Cos[k (L1 + L2)],
f3 -> Sin[k (L1 + L2)]};
trigs = subs /. (a_ -> b_) :> (b -> a);
e2 = e1 /. trigs;
FullSimplify[e1 == e2 /. subs] (* check new expression *)
I can now work on this simpler expression, e2. The problem is how to make the subs, above, without resorting to cutting and pasting. I need to be able to identify any subexpression that contains sums or products of trig functions, but no other symbols, and turn this into a single symbol.
Thanks
Hugh Goyder