Re: Mathematica Collect function
- To: mathgroup at smc.vnet.net
- Subject: [mg110768] Re: Mathematica Collect function
- From: danl at wolfram.com
- Date: Mon, 5 Jul 2010 06:03:32 -0400 (EDT)
> Many thanks to all who have responded to my question. > The question I posted was actually a smaller section of what I had > originally planned on asking. I was hoping to use what I had learnt > from your answers and apply it to a larger problem but I haven't had > much success. > > What I want is to go from expression1: > -((P10 P20 P30)/Sqrt[2]) + (i P10 P20 P30)/Sqrt[2] - i P11 P20 P30 + > i P10 P21 P30 + (P11 P21 P30)/Sqrt[2] - (i P11 P21 P30)/Sqrt[2] - > P10 P20 P31 - (P11 P20 P31)/Sqrt[2] - (i P11 P20 P31)/Sqrt[2] + ( > P10 P21 P31)/Sqrt[2] + (i P10 P21 P31)/Sqrt[2] + P11 P21 P31 > > to expression2: > ((1 + Sqrt[2]) i - 1)/4*(P10 - P11) - ( > 1 + Sqrt[2] + i)/4*(P20 - P21) + ( > 1 - Sqrt[2] + i)/4*(P10 - P11)*(P30 - P31) + ( > 1 + (Sqrt[2] - 1) i)/4*(P20 - P21)*(P30 - P31) > > Given that P10 + P11=1,P20 + P21=1 and P30 + P31=1, > expression 2 becomes expression3: > ((1 + Sqrt[2]) i - 1)/4*(P10 - P11)*(P20 + P21)*(P30 + P31) - ( > 1 + Sqrt[2] + i)/4*(P10 + P11)*(P20 - P21)*(P30 + P31) + ( > 1 - Sqrt[2] + i)/4*(P10 - P11)*(P20 + P21)*(P30 - P31) + ( > 1 + (Sqrt[2] - 1) i)/4*(P10 + P11)*(P20 - P21)*(P30 - P31) > > I know that they are equal because when I use Expand[expression3], I > obtain expression1. > > I've tried forcing the simplification by introducing temporary > expressions and back substituting to go from expression1 to expression > 3 but I've realized then it doesn't work when introducing the extra > terms (P10 + P11),(P20 + P21) and (P30 + P31). Any ideas? > > Thanks, > Minh This will bring you fairly close to the form you are trying to obtain. expr = -((P10 P20 P30)/Sqrt[2]) + (i P10 P20 P30)/Sqrt[2] - i P11 P20 P30 + i P10 P21 P30 + (P11 P21 P30)/Sqrt[2] - (i P11 P21 P30)/Sqrt[2] - P10 P20 P31 - (P11 P20 P31)/Sqrt[2] - (i P11 P20 P31)/ Sqrt[2] + (P10 P21 P31)/Sqrt[2] + (i P10 P21 P31)/Sqrt[2] + P11 P21 P31; rels = {P10 + P11 - 1, P20 + P21 - 1, P30 + P31 - 1, P10 - P11 - p101, P20 - P21 - p201, P30 - P31 - p301}; vars = {P10, P11, P20, P21, P30, P31}; vars2 = {p101, p201, p301}; subs = {p101 -> P10 - P11, p201 -> P20 - P21, p301 -> P30 - P31}; gb = GroebnerBasis[rels, vars]; In[34]:= Collect[PolynomialReduce[expr, gb, vars][[2]], vars2] /. subs Out[34]= (P10 - P11) (1/4 (-1 + i + Sqrt[2] i) + 1/4 (1 - Sqrt[2] + i) (P30 - P31)) + (P20 - P21) (1/4 (-1 - Sqrt[2] - i) + 1/4 (1 - i + Sqrt[2] i) (P30 - P31)) Daniel Lichtblau Wolfram Research