Re: problem with Collect[] for long polynomial
- To: mathgroup at smc.vnet.net
- Subject: [mg37295] Re: problem with Collect[] for long polynomial
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 22 Oct 2002 04:47:19 -0400 (EDT)
- References: <ap07gi$c52$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Troy, The reason for your difficulty shows up in the following: eqn = 2 +5x+ (x - 1)^2 == 3 +7x+ (x - 1)^3; Collect[eqn, x] 2 + (-1 + x)^2 + 5*x == 3 + (-1 + x)^3 + 7*x (Collect[#1, x] & ) /@ eqn 3 + 3*x + x^2 == 2 + 10*x - 3*x^2 + x^3 You need to map the use of Collect onto the sides of the equation. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Troy Goodson" <Troy.D.Goodson at jpl.nasa.gov> wrote in message news:ap07gi$c52$1 at smc.vnet.net... > I apologize for the length of this post, but I don't see how else to be > precise about my question. > > The short story is this: > -- copy and paste the lines below into Mathematica > -- execute > -- the result is a really big expresssion, but I want the terms in this > expression > to be grouped in powers of my variable "b". > > However, Collect[] doesn't appear to be working right. I call Collect[%, > b] and I think I'm getting % back. At the very least, I can clearly see > more than one term in the expression that includes b^9, for example. > > I'd be very grateful if someone a little more knowledgeable than I could > execute these lines and see if they can get Collect[] to work. Of, if > this is how Collect[] is supposed to work, what command should I be > using? > > Thanks, > > Troy. > > > So, here's what I did. First, to get my equation: > > denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)] > cnu = (2*b^2 - B^2 + r^2)/denom > snu = -2*b*Sqrt[B^2 - b^2]/denom > sif = 2*r*b/denom > cif = (r^2 - B^2)/denom > > pdr = -Cos[ds]*Sin[q]*(snu*cif + > cnu*sif) - Sin[ds]*(cnu*cif - snu*sif) > > HH = -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/( > r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w* > r)^2 - (w*r*pdr)^2)*(Cos[qr])^2 > > Now, my equation is really HH == 0, but there's some manipulations I > want to do first. I don't know Mathematica well, so all I could see to > do was to perform operations on HH, then put the equation together. > > H2 = Expand[HH] > H3 = Collect[HH, Sqrt[B^2 - b^2]] > H4 = H3*( (4 * (b*r)^2 + (B^2 - r^2)^2)^2 ) > H7 = H4*(r^2) > H8 = Collect[ Cancel[H7], Sqrt[-b^2 + B^2] ] > H9 = Equal[H8, 0] /. Equal[ > aa_ + Sqrt[B^2 - b^2]*bb_, 0] -> Equal[ Sqrt[B^2 - b^2]*bb, -aa] > H10 = Thread[#^2 &[H9], Equal] // ExpandAll > H11 = H10 /. Equal[ mm_ , nn_] -> Equal[ mm - nn , 0] > H12 = H10 /. Equal[ qq_ , 0] -> qq > > For H3 and H8, Collect[] seems to work. > The command to get H10 I copied from a post by Andrzej Kozlowski. > > H13 = Collect[H11,b] > H14 = Collect[H12,b] > > but the results don't seem to be 'collected' polynomials. >