MathGroup Archive 2010

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

Search the Archive

Re: Mathematica Collect function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110731] Re: Mathematica Collect function
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 3 Jul 2010 08:20:30 -0400 (EDT)

expr = Expand[((1 + Sqrt[2]) i - 1)/4*(P10 - P11) -
    (1 + Sqrt[2] + i)/4*(P20 - P21)];

Your initial form is not what Mathematica considers the simplest form

expr // Simplify

(1/4)*((Sqrt[2]*i + i - 1)*P10 - (Sqrt[2]*i + i - 1)*P11 - 
      (i + Sqrt[2] + 1)*(P20 - P21))

You need to force it

(expr /. {P10 -> x1 + P11, P20 -> x2 + P21} //
   Simplify) /.
 {x1 -> (P10 - P11), x2 -> (P20 - P21)}

(1/4)*((Sqrt[2]*i + i - 1)*(P10 - P11) - (i + Sqrt[2] + 1)*
        (P20 - P21))

This is almost your initial form


Bob Hanlon

---- Minh <dminhle at gmail.com> wrote: 

=============
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?




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