Re: Non trivial substitution in a very long output

*To*: mathgroup at smc.vnet.net*Subject*: [mg123165] Re: Non trivial substitution in a very long output*From*: Marco Maso <demind at gmail.com>*Date*: Fri, 25 Nov 2011 04:55:03 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <201111241156.GAA28999@smc.vnet.net>

Ok, this is not exactly what I was looking for but gave me an idea on how I can find a workaround to this problem...I will report here in a while with the outcome! Thanks Marco Il giorno Thu, 24 Nov 2011 11:30:25 -0600 DrMajorBob <btreat1 at austin.rr.com> ha scritto: > It seems to work fine in this example: > > piece = Abs[b41]^2 + Abs[b51]^2 + Abs[b61]^2 + > Abs[(b61 x1 + b51 x2 + b41 x3)/x4]^2 + > Abs[(b61 x2 + b51 x3 + b41 x4)/x1]^2 + > Abs[(b61 x1 x3 + b51 (x2 x3 - x1 x4) + b41 (x3^2 - x2 x4))/ > x4^2]^2 + > Abs[(b61 (x1 x3^2 - x1 x2 x4) + > b51 (x2 x3^2 - x2^2 x4 - x1 x3 x4) + > b41 (x3^3 - 2 x2 x3 x4 + x1 x4^2))/x4^3]^2; > expr = piece + piece^2 - Sin@piece; > expr //. piece -> p > > p + p^2 - Sin[p] > > Bobby > > On Thu, 24 Nov 2011 05:56:33 -0600, Demind <demind at gmail.com> wrote: > > > Hello, my name is Marco. I am experiencing an annoying problem > > using Mathematica. I am dealing with a huge expression, some > > hundreds of lines. I can find 3/4 patterns repeating inside it, and > > I would really like to substitute thme with dummy variables, namely > > D1, D2, D3, D4. I'm expecting the readibility of the equation to be > > improved after this process. As it is right now, it's totally > > unreadable. I went through past topics to find solutions to my > > problem, but unfortunately none of the tricks I tried worked > > (mainly /. and //.). > > > > I give you a sample of what I would like to do, hoping that someone > > will give me some help: > > > > In my equation, Out[1] = ... > > the following pattern is repeated: > > > > Abs[b41]^2 + Abs[b51]^2 + Abs[b61]^2 + Abs[(b61 x1 + b51 x2 + b41 > > x3)/x4]^2 + Abs[(b61 x2 + b51 x3 + b41 x4)/x1]^2 + Abs[(b61 x1 x3 + > > b51 (x2 x3 - x1 x4) + b41 (x3^2 - x2 x4))/x4^2]^2 + Abs[(b61 (x1 > > x3^2 - x1 x2 x4) + b51 (x2 x3^2 - x2^2 x4 - x1 x3 x4) + b41 (x3^3 - > > 2 x2 x3 x4 + x1 x4^2))/x4^3]^2 > > > > I'm doing: > > > > Out[1] //. Abs[b41]^2 + Abs[b51]^2 + Abs[b61]^2 + Abs[(b61 x1 + b51 > > x2 + b41 x3)/x4]^2 + Abs[(b61 x2 + b51 x3 + b41 x4)/x1]^2 + > > Abs[(b61 x1 x3 + b51 (x2 x3 - x1 x4) + b41 (x3^2 - x2 x4))/x4^2]^2 > > + Abs[(b61 (x1 x3^2 - x1 x2 x4) + b51 (x2 x3^2 - x2^2 x4 - x1 x3 > > x4) + b41 (x3^3 - 2 x2 x3 x4 > > + x1 x4^2))/x4^3]^2 -> D1 > > > > Here the text is attached in "InputForm", where in my notebook I > > have it in "StandardForm" (I use the latter in my notebook, but > > here I can't reproduce it for obvious reasons). I tried to use the > > command above both in StandardForm and in InputForm with no result. > > > > Thank you very much > > > > Marco > > > >

**References**:**Non trivial substitution in a very long output***From:*Demind <demind@gmail.com>