MathGroup Archive 2010

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

Search the Archive

Re: Simplifying complicated expressions

  • To: mathgroup at
  • Subject: [mg110423] Re: Simplifying complicated expressions
  • From: Richard Fateman <fateman at>
  • Date: Thu, 17 Jun 2010 02:05:05 -0400 (EDT)
  • Organization: NNTP Server
  • References: <hudci1$d68$>

S. B. Gray wrote:
> Suppose I  have a long complex expression in which terms like
> (x^2+y^3-x^2y^2+Sqrt[z3+y2]) (for a simple example) appear many times 
> along with various powers and the reciprocals of it, etc. To make the 
> expression comprehensible and to make the computation faster, I would 
> like to substitute say "f1xyz" for it everywhere it appears. The normal 
> /. and -> substitutions and patterns are not adequate for this. Of 
> course at evaluation time I want to compute f1xyz only once and not have 
> the final formula revert to the original variables. How do I prevent that?
> Also a welcome addition to Mathematica would be the ability to find these 
> repeated expressions automatically and put them in, because doing it 
> manually is very error-prone and slow.
> Tips will be appreciated!
> Steve Gray

say you want to replace expression E1 by f where it occurs, even if it 
occurs in powers etc, in big expression B.

First, simplify B to a single fraction N/D.

divide N by E1, with remainder, to get Q and R.    that is  N= Q*E1+R. 
   replace N with Q*f+R.  Same with denominator D.

Actually, you might want to divide N by E1^s  for some power s, if you
think that occurs too.

This idea may not be a single command in Mathematica, though it has been 
described and used at least since 1971, called ratsubst.


  • Prev by Date: Re: Normal with GeometricTransformation
  • Next by Date: Re: Using Mathematica for Electrophysiology Data Analysis
  • Previous by thread: Re: Simplifying complicated expressions
  • Next by thread: Re: Simplifying complicated expressions