MathGroup Archive 1999

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

Search the Archive

RE: Simplifying constants

  • To: mathgroup at
  • Subject: [mg18544] RE: [mg18489] Simplifying constants
  • From: hanssen at
  • Date: Sat, 10 Jul 1999 02:18:44 -0400
  • Sender: owner-wri-mathgroup at

> 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.


Dipl.-Math Adalbert Hanszen

  • Prev by Date: Re: "At long last, Sir, have you no shame?"
  • Next by Date: bug in 4.0
  • Previous by thread: Re: Simplifying constants
  • Next by thread: Re: Simplifying constants