Re: Re: Expression manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg88791] Re: [mg88738] Re: Expression manipulation
- From: Syd Geraghty <sydgeraghty at mac.com>
- Date: Fri, 16 May 2008 05:35:21 -0400 (EDT)
- References: <g0edhe$9eq$1@smc.vnet.net> <200805151051.GAA21816@smc.vnet.net>
David, As a very satisfied user of your Presentations package may I suggest a possible interface addition to a future release. It would be nice to have your additional manipulations (discussed below by you) in a new palette "PresentationsAlgebraicManipulation". This would supplement the standard release palette AlgebraicManipulation and enable use of one very interactive style of expression manipulation. As I write this it strikes me that this might not be a very easy thing to do and I would appreciate your response. This thought was prompted by John Fulz's contribution to this thread. From: jfultz at wolfram.com Subject: [mg88740] Re: [mg88722] Expression manipulation Best wishes, Syd Syd Geraghty B.Sc, M.Sc. sydgeraghty at mac.com My System Mathematica 6.0.2.1 for Mac OS X x86 (64 - bit) (March 13, 2008) MacOS X V 10.5.2 MacBook Pro 2.33 Ghz Intel Core 2 Duo 2GB RAM On May 15, 2008, at 3:51 AM, David Park wrote: > David, > > You should be able to do all the manipulations using Mathematica. > You should > learn how to use rule based programming, commands such as MapAt, > Apart, > Together, Cancel. HoldForm and of course Simplify. > > Still, Mathematica is often very theoretically oriented and lacks > some of > the practical operations often used. The Presentations package, at > my web > site below, has a 'Manipulations' section that contains some practical > additions. Sometimes these are useful in manipulating expressions and > sometimes useful to get expressions in particular standard forms for > display > in reports or to match a textbook expression. > > If you want to keep a particular subexpression together as a unit > you can > wrap it in a HoldForm. This prevents routines like Simplify from > splitting > it up. Presentations has a CreateSubexpression and a > ReleaseSubexpressions > routines that allow you to wrap a subexpression in a tagged Tooltip. > This > works just as well as a HoldForm and allows you to see what the > subexpressions are. > > FactorOut can be used to remove a factor from an expression - even > if the > factor is not initially in the expression. For example, you can > pull a > factor out of a matrix and wrap the matrix in a HoldForm all in one > operation. > > MultiplyByOne will multiply the numerator and denominator of an > expression > by the same factor and Simplify, or perform any other specified > operations > on the numerator and denominator, so the factor won't cancel back out. > > MapLevelParts and MapLevelPatterns will map an operation onto a > subset of > level parts in an expression. The most common use is to apply some > function > to a selected subset of terms in a sum. > > LinearBreakout[f1,f2,...][v1,v2,..][expr] will break out the linear > terms of > any expressions within expr that have heads matching the patterns fi > over > variables matching the patterns vj. > > PushOnto is a much improved version of the Through command that will > push a > list of arguments onto specific functions. > > HoldOp[operation][expr] will prevent an explicit operation in expr > from > being evaluated but will evaluate the arguments of the operation. It > is > useful when operation has a number of definitions with it, but you > want to > see what the expression looks like before these definitions are > applied. > > EvaluateAtPattern will evaluate specific patterns in held expressions. > > Here is an example of using some of these routines to manipulate an > expression as you might do it 'by hand': > > a + b + c > % // MapLevelParts[CreateSubexpression, {{1, 3}}] > d % // Expand > % // FactorOut[sub] > % // ReleaseSubexpressions[] > > a + b + c > > b + (a + c) where (a+c) has a tag and Tooltip 'held'. > > b d+d (a + c) where d did not Distribute across the > subexpression. > > (d+(b d)/(a+c)) (a+c) factoring out the subexpression (a+c), even > though it > is not a true 'factor'. > > (a+c) (d+(b d)/(a+c)) releasing the subexpression keeps the overall > structure. > > Finally, I might mention the annoying tendency of Mathematica to get > more > minus signs into standard expressions than you might wish. One way to > correct this is just to Map Minus onto two factors in a product. For > example: > > 3 - a (c - b) > MapAt[Minus, %, {{2, 1}, {2, 3}}] > 3 - a (-b + c) > 3 + a (b - c) > > -- > David Park > djmpark at comcast.net > http://home.comcast.net/~djmpark/ > > > "David" <David.B.A.Epstein at googlemail.com> wrote in message > news:g0edhe$9eq$1 at smc.vnet.net... >> When trying to simplify an expression by hand, one carries out >> various >> kinds of steps: >> 1. Replace a subexpression that occurs repeatedly by a single symbol. >> 2. Multiply numerator and denominator of some subexpression by the >> same factor. >> 3. Cancel particular factors in numerator and denominator of some >> subexpression. >> 4. Gather together two subexpressions that were added together, and >> rewrite with a common denominator. >> 5. Remove common factors. >> >> etc. etc. etc. >> >> Using Part, one can of course access any particular subexpression. >> But >> this is time-consuming and clumsy. I find that I need trial and error >> to access the correct subexpression. Once I've accessed it, I often >> have difficulty in persuading Mathematica to perform the desired >> operation. And then I have trouble putting the subexpression back >> into >> place. It's something like 20 times slower than working with pencil >> and paper. HOWEVER pencil and paper calculations are more prone to >> stupid arithmetic errors, particularly if the computation is a long >> one. >> >> I have been unable to find a convenient way of doing this in >> Mathematica. I use version 5.2, but because of my University's site >> license, I have access to more recent versions. Would it help to >> change? >> >> Can anyone point me to a tutorial where experts use Mathematica to do >> a typical pencil and paper computation? >> >> Thanks a lot. Please copy replies to my personal email address as I >> don't look at the newsgroup very often. >> >> David >> > >
- References:
- Re: Expression manipulation
- From: "David Park" <djmpark@comcast.net>
- Re: Expression manipulation