Re: Rearranging expressions in a user-defined form
- To: mathgroup at smc.vnet.net
- Subject: [mg94136] Re: [mg94083] Rearranging expressions in a user-defined form
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Fri, 5 Dec 2008 05:34:55 -0500 (EST)
- References: <200812041216.HAA27754@smc.vnet.net>
You can almost always do it using PolynomialReduce and Groebner basic,
although in some cases a simple Collect will do. This is actually true
in your second case:
expr = a b + a c + c d + c a - g d - g a;
Collect[expr, {a, d}]
a (b + 2 c - g) + d (c - g)
The first case is a bit more complicated but the procedure is clear
enough although explaining why it works is somewhat harder:
Collect[Last[PolynomialReduce[expr, {x - (b + c), y - (d + a)},
Join[{b, c, d, a, g}, {x, y}]]], {x, y}] /. {x -> b + c, y -
> d + a}
a*(b + c) + (a + d)*(c - g)
In this case PolynomialReduce did not require GroebnerBasic but in
more complicated cases it may be needed.
Andrzej Kozlowski
On 4 Dec 2008, at 21:16, Alexei Boulbitch wrote:
> Dear MathGroup,
>
> in symbolic transformations of mathematical expressions I often need
> to
> group or transform differently different parts
> of these expression, just to make them more visible , or more easy to
> analyze or so. Just to give a simplest example,
> assume that we have an expression:
>
> expr = ab + ac + cd + ca- gd - ga
>
> and I need to have it once in the form like say,
>
> expr=a (b + c) + (c - g) (d + a)
>
> and another time in the form say,
>
> expr=a (b + 2 c - g) + d (c - g)
>
> or I will need to group it in some third, fourth ... form. You indeed
> understand that I gave the example easily treatable without computer,
> while I have in mind much more complex transformations of real
> interest.
>
> This evidently may be done by copy-pasting parts of the expression in
> question and
> transforming then separately and then again copy-pasting and thus,
> collecting the results together. That's exactly what I do in such a
> case.
> However, this may easily become a source of errors: such as copying
> without a sign, or copying a part of the expression, rather than the
> whole one and so on.
> Finally it considerably slows you down.
>
> Could you think of tricks to instruct Mathematica to group only
> certain
> terms and not others, and to take certain
> factors out of parentheses, while leave others, according to your
> choice?
>
> Thank you, Alexei
>
>
>
>
>
>
> --
> Alexei Boulbitch, Dr., Habil.
> Senior Scientist
>
> IEE S.A.
> ZAE Weiergewan
> 11, rue Edmond Reuter
> L-5326 Contern
> Luxembourg
>
> Phone: +352 2454 2566
> Fax: +352 2454 3566
>
> Website: www.iee.lu
>
> This e-mail may contain trade secrets or privileged, undisclosed or
> otherwise confidential information. If you are not the intended
> recipient and have received this e-mail in error, you are hereby
> notified that any review, copying or distribution of it is strictly
> prohibited. Please inform us immediately and destroy the original
> transmittal from your system. Thank you for your co-operation.
>
>
>
- References:
- Rearranging expressions in a user-defined form
- From: Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
- Rearranging expressions in a user-defined form