Re: trouble with pattern matching & manipulating
- To: mathgroup at smc.vnet.net
- Subject: [mg37033] Re: [mg37013] trouble with pattern matching & manipulating
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Mon, 7 Oct 2002 05:24:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Only on second reading I noticed the part about a,b,c,d being polynomials in x. Both methods will still work if first perform the same operation as below and finally use the replacement rule %/.{a->p[x],b->q[x],c->r[x],d->u[x],e->v[x]}, where p[x] etc are the given polynomials. Of course collecting of terms can be done with Collect[%,x]. Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Sunday, October 6, 2002, at 09:28 PM, Andrzej Kozlowski wrote: > I confess I am not 100% sure what you mean. Would you like to do this > in steps, like you would do it by hand? > > In[1]:= > a + b/c + d*(Sqrt[e]/c) == 0; > > In[2]:= > Thread[(#1 - a - b/c & )[%], Equal] > > Out[2]= > (d*Sqrt[e])/c == -a - b/c > > In[3]:= > Thread[(#1*c & )[%], Equal] > > Out[3]= > d*Sqrt[e] == (-a - b/c)*c > > In[4]:= > Thread[(#1^2 & )[%], Equal] > > Out[4]= > d^2*e == (-a - b/c)^2*c^2 > > In[5]:= > Simplify[%] > > Out[5]= > d^2*e == (b + a*c)^2 > > Of course you can combine all the steps into a single function, but I > think it will be fairly complicated. > > My own favourite way to do this sort of thing is: > > In[1]:= > Simplify[d^2*e == (d^2*e /. AlgebraicRules[ > a + b/c + d*(Sqrt[e]/c) == 0, e])] > > Out[1]= > d^2*e == (b + a*c)^2 > > However, AlgebraicRules has not been documented since version 4. It > should be possible to do this using PolynomialReduce but it seems to > require the sort of skill only Daniel Lichtblau possesses;) > > Andrzej Kozlowski > Toyama International University > JAPAN > http://sigma.tuins.ac.jp/~andrzej/ > > > > > On Sunday, October 6, 2002, at 06:33 PM, Troy Goodson wrote: > >> I'm a newbie and, of course, the first thing I want to do is >> apparently >> one of the most complicated... >> >> I have an expression that looks like this: >> >> A + B/C + D*Sqrt[E]/C = 0 >> >> A,B,C,D, & E are all polynomials in x >> I want it to look like this >> >> (D^2)*E = (A*C + B)^2 >> >> At that point, I'll have polynomials in x on both sides. Finally, I >> want the equation to be written out with terms grouped by powers of x, >> but I think I can do that part :) >> >> I'll be very grateful to anyone who can give me some pointers. Or, at >> least point me to some tutorial in the Mathematica documentation. >> I've >> been looking over the documentation and I found Appendix A.5 in The >> Mathematica Book, but that doesn't help me. I _need_ some examples. I >> did find a couple of well-written posts in this newsgroup, but not >> quite >> close enough to what I want. >> >> Thanks! >> >> Troy. >> >> =-=-=-=-=-=-=-=-=-= >> >> FYI, here's the expression I'm working with. >> >> >> 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) >> >> 0 == -(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 >> >> Although I said it's a polynomial in x, it's really a polynomial in >> "b" >> that I'm after. >> >> >> >> > >