Re: remove higher orders terms from mathemtica's result
- To: mathgroup at smc.vnet.net
- Subject: [mg90926] Re: [mg90916] remove higher orders terms from mathemtica's result
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 30 Jul 2008 03:51:27 -0400 (EDT)
- References: <200807291009.GAA24445@smc.vnet.net>
On 29 Jul 2008, at 12:09, kem wrote:
> Hi,
> Given this:
>
> K = (1+vy) (zx+wx) + vx (zy+wy);
> Expand[K^2]
>
> Is it possible to remove automatically the 3rd and 4th orders from the
> result of 'Expand[K^2]' ?
>
> By 3rd order I mean terms like: 2 wy zy vx^2 etc. (all terms with sum
> of the degrees of derivatives of u,v,w is = 3)
> By 4th order: wy^2 vx^2 etc. (sum of degrees of u,v,w = 4)
>
>
> Thanks
>
>
>
>
Actually, there are many ways, but no single function that would do
this. Here are a couple of short programs, which get rid of terms od
degree >= 2
K = (1 + v y) (z x + w x) + v x (z y + w y);
Block[{vars = Variables[K], t},
Normal[(K /. Thread[vars -> t vars]) + O[t]^3] /. t -> 1]
w x + z x
Block[{vars = Variables[K], m},
m = Take[CoefficientArrays[K, vars] // Normal, 3];
m[[1]] + m[[2]].vars + m[[3]].vars.vars]
w x + z x
Andrzej Kozlowski
- References:
- remove higher orders terms from mathemtica's result
- From: kem <kemelmi@gmail.com>
- remove higher orders terms from mathemtica's result