Re: Dropping terms in a complex expression
- To: mathgroup at smc.vnet.net
- Subject: [mg21274] Re: [mg21115] Dropping terms in a complex expression
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Tue, 21 Dec 1999 03:46:54 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
If you only want to drop the terms containing powers of 1/x higher than the
second then, I think, the easiest way is simply to use a local rule:
In[7]:=
thing /. {Power[x, n_ /; n < -2] -> 0}
Out[7]=
q x 2
w Cos[t w - n x] E w Cos[t w - p x] Sin[m x]
---------------- + ------------------------------- -
a x 2
b x
Sin[t w - m x]
> From: adam_smith at my-deja.com
> Date: Fri, 17 Dec 1999 01:21:13 -0500 (EST)
> To: mathgroup at smc.vnet.net
> Subject: [mg21274] [mg21115] Dropping terms in a complex expression
>
> I have a complex expression involving powers of 1/x like that shown
> below and I want to be able to drop terms of higher powers. I have
> simplified it a bit, but the thing to note is that there are functions
> of the variables x (Sin, Cos, Exp), that I want to "ignore" when
> dropping the terms.
>
> In[3]:=
> thing = Sin[m x - w t] +
> w Cos[n x - w t](a x)^-1+ ((w^2/b) Cos[p x - w t] Sin[ m x]Exp[q x])
> x^-2 + ((w^3/c^3) Cos[r x - w t]^2 Cos[w t])x^-3
> Out[3]=
> 3 2
> w Cos[t w - n x] w Cos[t w] Cos[t w - r x]
> ---------------- + --------------------------- +
> a x 3 3
> c x
>
> q x 2
> E w Cos[t w - p x] Sin[m x]
> ------------------------------- - Sin[t w - m x]
> 2
> b x
>
>
> I managed to get the desired result with the following crude method
> using substitutions, Series[] and Normal[]. I know I probably don't
> need all four intermediate steps, but I initally wanted to see each
> step.
>
> In[4]:=
> junk = thing/.{k_ x ->k theta};
> junk = junk/.{x->1/r};
> junk = Normal[Series[junk,{r,0,2}]];
> junk/.{r->1/x,theta->k x,phi->g x}
> Out[4]=
> k q x 2
> w Cos[t w - k n x] E w Cos[t w - k p x] Sin[k m x]
> ------------------ + ------------------------------------- -
> a x 2
> b x
>
> Sin[t w - k m x]
>
>
> I imagine there is a better way. Any suggestions?
>
> Adam Smith
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>