MathGroup Archive 2009

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

Search the Archive

Simplifying and Rearranging Expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95889] Simplifying and Rearranging Expressions
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 29 Jan 2009 05:55:14 -0500 (EST)

I want to start a thread on this because I believe many MathGroup people
will have some useful things to say.

 

A common task for Mathematica users is to obtain an expression that is in a
particular form. For students and teachers this may often be a textbook
form, or there may be other reasons that a particular form is desired.

 

It might be thought that this should be an easy task but quite often it can
be a very difficult task, even involving mathematical derivation and many of
the capabilities of Mathematica. Not obtaining a specific form may be a
matter of not knowing how to solve the problem in the first place.

 

Nevertheless, even simple rearrangement can be difficult. I sometimes think
of it as doing surgery on expressions. I believe it is generally desirable
to use Mathematica to rearrange an expression and not retype the expression.
Retyping is too error prone.

 

Simplify and FullSimplify are amazingly useful but it is difficult to
control them and obtain a precise result. One will often have to do
additional piecemeal operations. One downside of Simplify and FullSimplify
is that they can return different forms with different Mathematica versions.
Then any additional operations in an old notebook may no longer work. It
would be nice if there was a method of using these commands that would be
more version independent.

 

Various routines such as Together, Apart, Factor, TrigReduce, TrigFactor,
TrigExpand, TrigToExp, GroebnerBasis etc., can be useful in getting a
specific form. MapAt is very useful for doing surgery on specific parts of
an expression. Mathematica often gets two factors that have extra minus
signs. You can correct that by mapping Minus onto the two factors. For
integrals in the wrong form you could cheat by trying to find the constant
by which they differ by subtracting and simplifying, and then use that in
the derivation.

 

Over the  years I've collected a number of routines that aid in manipulating
expressions and have included them in the Presentations package. Some of
these are: CompleteTheSquare, FactorOut (any  'factor' expression with
ability to hold results such as factoring from a matrix), MultiplyByOne (a
common mathematical technique), LinearBreakout, PushOnto (much better than
Through), HoldOp (hold a specific operation but evaluate the arguments),
CreateSubexpression (creates a tooltip and holds expressions together with a
tag so they won't get split by routines like Simplify),
ReleaseSubexpressions, MaplevelParts (apply an operation to a subset of
level parts, for example Factor three out of five terms in a sum),
MapLevelPatterns, EvaluateAt (evaluate specific parts of held expressions),
EvaluateAtPattern. SymbolsToPatterns, LHSSymbolsToPatterns (convert specific
derived rules to general patterned rules). 

 

It is very useful to get Mathematica generated expressions into the form
that one wants. I believe that this is probably a sticking point with many
users. In general it is not a trivial topic. Others may have some good
general ideas that I don't know about. Someday someone may even write a good
tutorial on it.

 

 

David Park

djmpark at comcast.net

 <http://home.comcast.net/~djmpark> http://home.comcast.net/~djmpark/  

 


  • Prev by Date: Re: Using Map or Thread over selected parts of nested lists
  • Next by Date: Re: Mathematica having trouble with simple calculation...
  • Previous by thread: Mathematica notebooks don't print or PDF well under Linux
  • Next by thread: Re: Simplifying and Rearranging Expressions