Re: trying to "simplify" very large output

*To*: mathgroup at smc.vnet.net*Subject*: [mg83096] Re: [mg83058] trying to "simplify" very large output*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Sat, 10 Nov 2007 03:45:51 -0500 (EST)*References*: <200711091011.FAA09888@smc.vnet.net>

Basjsmit wrote: > Dear Reader, > > When I used Mathematica to solve a certain expression, the output was > extremely large, somewhere around 10 000 characters. When I looked more > closely at the output, I noticed certain frases kept repeating. I havent > found anything in the help, but Im wondering if there is a function that can > replace those frases with a variable and set that variable once. An example: > > t-> -(y z-v x Cos[k]^2-v x Sin[k]^2)/(z^2-x^2 Cos[k]^2-x^2 Sin[k]^2)-1/2 > \[Sqrt]((4 (y z-v x Cos[k]^2-v x Sin[k]^2) ........ > > becomes: > > A = y z-v x Cos[k]^2-v x Sin[k]^2 > B = z^2-x^2 Cos[k]^2-x^2 Sin[k]^2 > t-> -A / B -1/2 \[Sqrt]((4 A ........ > > Thanks in advance, Bas > > PS: just curious, is there a name for the proces I described above? > It is usually referred to as common subexpression elimination (cse). Quite coincidently this same question came my way yesterday. Mathematica has some functionality for this in Experimental` context, thus it is a bit hidden (unfortunately, I should add). Here are some URLs to prior threads that indicate usage. http://forums.wolfram.com/mathgroup/archive/2006/Sep/msg00300.html http://forums.wolfram.com/mathgroup/archive/2005/Jan/msg00387.html http://forums.wolfram.com/mathgroup/archive/2002/Jan/msg00369.htm Whether the functionality in Experimental`OptimizeExpression will help for your particular type of examples might depend on option settings, etc. so you'll probably need to experiment. Daniel Lichtblau Wolfram Research

**References**:**trying to "simplify" very large output***From:*"Basjsmit" <basjsmit@wanadoo.nl>