Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica Collect function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110716] Re: Mathematica Collect function
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sat, 3 Jul 2010 08:17:43 -0400 (EDT)
  • References: <i0k2gi$js4$1@smc.vnet.net>

Am Fri, 2 Jul 2010 06:55:14 +0000 (UTC)
schrieb Minh <dminhle at gmail.com>:

> Given that:
> Expand[((1 + Sqrt[2]) i - 1)/4*(P10 - P11) - (1 + Sqrt[2] + i)/
>    4*(P20 - P21)]
> 
> will output
> -(P10/4) + (i P10)/4 + (i P10)/(2 Sqrt[2]) + P11/4 - (i P11)/4 - (
>  i P11)/(2 Sqrt[2]) - P20/4 - P20/(2 Sqrt[2]) - (
>  i P20)/4 + P21/4 + P21/(2 Sqrt[2]) + (i P21)/4
> 
> How do I get from:
> -(P10/4) + (i P10)/4 + (i P10)/(2 Sqrt[2]) + P11/4 - (i P11)/4 - (
>  i P11)/(2 Sqrt[2]) - P20/4 - P20/(2 Sqrt[2]) - (
>  i P20)/4 + P21/4 + P21/(2 Sqrt[2]) + (i P21)/4
> 
> back to
> ((1 + Sqrt[2]) i - 1)/4*(P10 - P11) - (1 + Sqrt[2] + i)/
>    4*(P20 - P21)
> 
> I've tried using the Collect function as follows:
> Collect[-(P10/4) + (i P10)/4 + (i P10)/(2 Sqrt[2]) + P11/4 - (i P11)/
>   4 - (i P11)/(2 Sqrt[2]) - P20/4 - P20/(2 Sqrt[2]) - (i P20)/4 + P21/
>   4 + P21/(2 Sqrt[2]) + (i P21)/4, {(P10 - P11), (P20 - P21)}]
> but it doesn't seem to collect the terms {(P10 - P11), (P20 - P21)}.
> 
> Got any suggestions?
> 

Introduce temporary expressions Q1,Q1 and do a backsubstituation after
Collect[]ing:

In[7]:= Collect[-(P10/4)+(i P10)/4+(i P10)/(2 Sqrt[2])+P11/4-(i
P11)/4-(i P11)/(2 Sqrt[2])-P20/4-P20/(2 Sqrt[2])-(i P20)/4+P21/4+P21/(2
Sqrt[2])+(i P21)/4 /.
 {P10->Q1+P11,P20->Q2+P21},Q1|Q2,FullSimplify] /.
 {Q1->P10-P11,Q2->P20-P21}
Out[7]= 1/4 (-1+i+Sqrt[2] i) (P10-P11)+1/4 (-1-Sqrt[2]-i) (P20-P21)

There is a difference in your outcome and mine. I think you've got the
wrong sign for the factor of (P10-P11) and misspelled an "i" by "1".

hth,
Peter


  • Prev by Date: Re: Mathematica Collect function
  • Next by Date: Re: Mathematica Collect function
  • Previous by thread: Re: Mathematica Collect function
  • Next by thread: Re: Mathematica Collect function