RE: Simplifying constants

*To*: mathgroup at smc.vnet.net*Subject*: [mg18544] RE: [mg18489] Simplifying constants*From*: hanssen at zeiss.de*Date*: Sat, 10 Jul 1999 02:18:44 -0400*Sender*: owner-wri-mathgroup at wolfram.com

> Hi, > > I am working with some annoyingly long equations that I want to simplify > by including one set of parameters in a constant (or function) A, and > another in B and so on. > > You can easily do: > > A = b+c+d+e > > but what I want to do is the reverse: > > b+c+d+e = A > > and use this information to reduce the equations. Does anybody know how > to do this? > Hi, Morten Use pattern matching like this (b+c+d+e+f)*(1+a^2) /. b+c+d+f-> A which gives you (1 + a^2)*(A + e) The other way around: %/. A -> b+c+d+e gives you (1 + a^2)*(b + c + d + 2*e) Another question is, how to find common subexpressions in lengthy expressions. Here you might use Optimize.m, which is available from MathSource (in two flavours). Some hand work still has to be done after this, but it gives you good hints. Regards Dipl.-Math Adalbert Hanszen