Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Collect and manipulate subexpressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53881] Collect and manipulate subexpressions
  • From: "Goyder Dr HGD" <h.g.d.goyder at cranfield.ac.uk>
  • Date: Tue, 1 Feb 2005 04:08:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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







  • Prev by Date: Re: Simplify problems for checking easy equalities...
  • Next by Date: Re: Simplify problems for checking easy equalities...
  • Previous by thread: Re: Re: New Web Site for Mathematica Users using WikiMedia
  • Next by thread: Re: Collect and manipulate subexpressions