       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
> much success.
>
> What I want is to go from expression1:
> -((P10 P20 P30)/Sqrt) + (i P10 P20 P30)/Sqrt - i P11 P20 P30 +
>  i P10 P21 P30 + (P11 P21 P30)/Sqrt - (i P11 P21 P30)/Sqrt -
>  P10 P20 P31 - (P11 P20 P31)/Sqrt - (i P11 P20 P31)/Sqrt + (
>  P10 P21 P31)/Sqrt + (i P10 P21 P31)/Sqrt + P11 P21 P31
>
> to expression2:
> ((1 + Sqrt) i - 1)/4*(P10 - P11) - (
>   1 + Sqrt + i)/4*(P20 - P21) + (
>   1 - Sqrt + i)/4*(P10 - P11)*(P30 - P31) + (
>   1 + (Sqrt - 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) i - 1)/4*(P10 - P11)*(P20 + P21)*(P30 + P31) - (
>   1 + Sqrt + i)/4*(P10 + P11)*(P20 - P21)*(P30 + P31) + (
>   1 - Sqrt + i)/4*(P10 - P11)*(P20 + P21)*(P30 - P31) + (
>   1 + (Sqrt - 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) + (i P10 P20 P30)/Sqrt -
i P11 P20 P30 +
i P10 P21 P30 + (P11 P21 P30)/Sqrt - (i P11 P21 P30)/Sqrt -
P10 P20 P31 - (P11 P20 P31)/Sqrt - (i P11 P20 P31)/
Sqrt + (P10 P21 P31)/Sqrt + (i P10 P21 P31)/Sqrt +
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:= Collect[PolynomialReduce[expr, gb, vars][], vars2] /. subs

Out= (P10 - P11) (1/4 (-1 + i + Sqrt i) +
1/4 (1 - Sqrt + i) (P30 - P31)) + (P20 -
P21) (1/4 (-1 - Sqrt - i) +
1/4 (1 - i + Sqrt i) (P30 - P31))

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Is it possible to query current plot range values (or have
• Next by Date: Re: Mathematica Collect function
• Previous by thread: Re: Mathematica Collect function
• Next by thread: Re: Mathematica Collect function