Re: Mathematica Collect function
- To: mathgroup at smc.vnet.net
- Subject: [mg110766] Re: Mathematica Collect function
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 5 Jul 2010 06:03:10 -0400 (EDT)
expr1 =
-(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;
expr2 = ((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);
To get the form of expr2 from expr1
expr22 = Simplify[expr1, {
P10 + P11 == t,
P20 + P21 == t,
P30 + P31 == t,
P10 - P11 == x1,
P20 - P21 == x2,
P30 - P31 == x3}] /. {
t -> 1,
x1 -> P10 - P11,
x2 -> P20 - P21,
x3 -> P30 - P31}
1/4 ((i-Sqrt[2]+1) (P10-P11) (P30-P31)+
(Sqrt[2] i+i-1) (P10-P11)+
((Sqrt[2]-1) i+1) (P20-P21) (P30-P31)-
(i+Sqrt[2]+1) (P20-P21))
expr2 == expr22 // Simplify
True
Bob Hanlon
---- Minh <dminhle at gmail.com> wrote:
=============
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