MathGroup Archive 2010

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

Search the Archive

Re: Easy simplification with Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111163] Re: Easy simplification with Mathematica?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 22 Jul 2010 05:43:46 -0400 (EDT)

expr1 = a + b - 2*c;

subs1 = {t1 == a - c, t2 == b - c};

expr2 = HoldForm[Evaluate[
    Simplify[expr1, subs1]]] /.
  (Rule @@@ subs1)

(a-c)+(b-c)

expr1 == expr2 // ReleaseHold

True

expr3 = a*b + a*c - 2*a*d + b*c - 2*b*d - 2*c*d + 3*d^2;

subs2 = Thread[{t1, t2, t3} == {a, b, c} - d]

{t1 == a - d, t2 == b - d, t3 == c - d}

expr4 = HoldForm[Evaluate[
    Simplify[expr3, subs2]]] /.
  (Rule @@@ subs2)

(b-d) (c-d)+(a-d) ((b-d)+(c-d))

expr3 == expr4 // ReleaseHold // Simplify

True


Bob Hanlon

---- fajar <fajar96te at yahoo.com> wrote: 

=============

Hi all,

I'm new to symbolic computation.

I have this coming from previous computation:

a + b -2*c

How can I convert that expression, with Mathematica, into:

(a - c) + (b - c) ?


Another example: Given

a*b + a*c - 2*a*d + b*c - 2*b*d - 2*c*d + 3*d^2

How can I convert that expression, with Mathematica, into:

(a-d)*(b-d) + (a-d)*(c-d) + (b-d)*(c-d) ?



Thanks

Fajar



  • Prev by Date: Re: Very very basic question about Mathematica
  • Next by Date: Re: Brillouin function for a Ferromagnet
  • Previous by thread: Easy simplification with Mathematica?
  • Next by thread: Re: Easy simplification with Mathematica?