MathGroup Archive 2002

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

Search the Archive

problem with Collect[] for long polynomial

  • To: mathgroup at
  • Subject: [mg37270] problem with Collect[] for long polynomial
  • From: Troy Goodson <Troy.D.Goodson at>
  • Date: Mon, 21 Oct 2002 02:29:40 -0400 (EDT)
  • Organization: JPL/Caltech
  • Sender: owner-wri-mathgroup at

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 
 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 



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.

  • Prev by Date: Re: Bad Alignment of Y Axes
  • Next by Date: RE: Again, How to speed up this calculation? and more
  • Previous by thread: RE: Re: Raising Contour Plot Graphics to 3D
  • Next by thread: Re: problem with Collect[] for long polynomial