Re: quadratic multiplication
- To: mathgroup at smc.vnet.net
- Subject: [mg84271] Re: quadratic multiplication
- From: danl at wolfram.com
- Date: Mon, 17 Dec 2007 01:48:34 -0500 (EST)
- References: <fk2v35$n96$1@smc.vnet.net>
On Dec 16, 4:36 am, KFUPM <hussain.alqaht... at gmail.com> wrote: > Dear all > > I have a very large expression which involves the multiplication of > these variables: > > var ={u1,u2,u3,u4,u5,u6} with some other constants. In the expression, > i want to suppress any quadratic or higher order multiplication of > these varibles , e.g u1*u5 or u1*u4*u6 should be zero. And since, my > expression is huge, i want to do this automatically. Any help in this > regard is highly appreciated. > > Sincererly yours, > > HMQ This has come up in past. I'll show a couple of simple methods rather than try to dig up URLs to past threads. The MoC (Method of Choice), I think, is to use Series after multiplying each variable by some new indeterminate. Expand in powers of that new indeterminate, and let Series clip at the desired degree. Then convert back to a normal expression and make the new indeterminate unity. suppressHOT1[expr_, vars_List, deg_Integer] := Module[ {t, subst}, subst = Thread[vars -> t*vars]; Normal[Series[expr /. subst, {t, 0, deg - 1}]] /. t -> 1 ] Here is an alternate method, using as "reducing relations" all the quadratic powers of your variables. suppressHOT2[expr_, vars_] := Module[ {quads}, quads = Union[Flatten[Outer[Times, vars, vars]]]; PolynomialReduce[expr, quads, vars][[2]] ] This second approach can be extended easily to higher orders, and can be done via replacement rules instead of PolynomialReduce. Since this direction is not, to my mind at least, the MoC, I don't pursue these possibilities. Here is a simple example using your variable set. In[9]:= vars = {u1, u2, u3, u4, u5, u6}; In[19]:= expr = Apply[Times, RandomInteger[{-10, 10}, {4, Length[vars] + 1}].Append[vars, 1]] Out[19]= (-10 + 9*u1 + 5*u3 + 2*u4 + 6*u5 - 4*u6)*(-4 + 10*u1 + 5*u2 - 3*u3 - 3*u4 + 4*u5 - 3*u6)*(9 + 6*u1 - 10*u3 + 10*u4 - 10*u5 + 3*u6)* (-7 + 7*u1 - 7*u2 + 6*u3 + 2*u4 - 2*u5 + 8*u6) In[24]:= suppressHOT1[expr, vars, 2] Out[24]= -2520 + 9408*u1 + 630*u2 + 4330*u3 - 3466*u4 + 6112*u5 - 858*u6 In[25]:= suppressHOT2[expr, vars] Out[25]= -2520 + 9408*u1 + 630*u2 + 4330*u3 - 3466*u4 + 6112*u5 - 858*u6 Daniel Lichtblau Wolfram Research