Re: Cannot Factor an expression
- To: mathgroup at smc.vnet.net
- Subject: [mg87618] Re: [mg87563] Cannot Factor an expression
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 14 Apr 2008 05:46:33 -0400 (EDT)
- References: <200804130731.DAA11432@smc.vnet.net>
Factor is not "effectively the reverse of Expand", except in the case
of when you expand an expression that has been factored in *the usual
sense*, in other words, into multiplicative factors (don't forget that
a "factor" is the same thing as a "divisor"). Other kinds of "pseudo-
factorizations", like the one you want, are not unique, and
Mathematica can't read your mind to find out which one you like best.
For example:
q = Sum[(Subscript[z, i] - 1)*(=CE=BC - Subscript[x, i])^2, {i, 1, 3}]
(Subscript[z, 1] - 1)*(=CE=BC - Subscript[x, 1])^2 +
(=CE=BC - Subscript[x, 2])^2*(Subscript[z, 2] - 1) +
(=CE=BC - Subscript[x, 3])^2*(Subscript[z, 3] - 1)
p = Expand[q];
FullSimplify[p]
(Subscript[z, 1] + Subscript[z, 2] + Subscript[z, 3] - 3)*\[Mu]^2 -
2*Subscript[x, 1]*(Subscript[z, 1] - 1)*\[Mu] -
2*Subscript[x, 2]*(Subscript[z, 2] - 1)*\[Mu] -
2*Subscript[x, 3]*(Subscript[z, 3] - 1)*\[Mu] +
Subscript[x, 1]^2*(Subscript[z, 1] - 1) +
Subscript[x, 2]^2*(Subscript[z, 2] - 1) +
Subscript[x, 3]^2*(Subscript[z, 3] - 1)
in by many criteria not worse then the one you want.
However, there is, in fact, a way to get the form q by starting from
p, as long as you know that that is what you want:
Factor[First[PolynomialReduce[q, {Subscript[z, 1] - 1,
Subscript[z, 2] - 1, Subscript[z, 3] - 1}]]] .
{Subscript[z, 1] - 1, Subscript[z, 2] - 1, Subscript[z, 3] - 1}
(Subscript[z, 1] - 1)*(\[Mu] - Subscript[x, 1])^2 +
(\[Mu] - Subscript[x, 2])^2*(Subscript[z, 2] - 1) +
(\[Mu] - Subscript[x, 3])^2*(Subscript[z, 3] - 1)
Andrzej Kozlowski
On 13 Apr 2008, at 16:31, Francogrex wrote:
> If Factor is effectively the reverse of expand, then how come factor
> cannot find back the expression below?
>
> Expand[Sum[(Subscript[z, i] - 1)*(\[Mu] - Subscript[x, i])^2, {i, 1,
> 3}]]
>
> Factor[-3*\[Mu]^2 + 2*\[Mu]*Subscript[x, 1] - Subscript[x, 1]^2 +
> 2*\[Mu]*Subscript[x, 2] - Subscript[x, 2]^2 + 2*\[Mu]*Subscript[x,
> 3] -
> Subscript[x, 3]^2 + \[Mu]^2*Subscript[z, 1] -
> 2*\[Mu]*Subscript[x, 1]*Subscript[z, 1] + Subscript[x, 1]^2*
> Subscript[z, 1] + \[Mu]^2*Subscript[z, 2] -
> 2*\[Mu]*Subscript[x, 2]*Subscript[z, 2] + Subscript[x, 2]^2*
> Subscript[z, 2] + \[Mu]^2*Subscript[z, 3] -
> 2*\[Mu]*Subscript[x, 3]*Subscript[z, 3] + Subscript[x, 3]^2*
> Subscript[z, 3]]
>
> Is there some additional arguments to the function factor so that it
> can find back the original:
> Sum[(Subscript[z, i] - 1)*(\[Mu] - Subscript[x, i])^2, {i, 1, 3}]
>
> Thanks for help with this
>
- Follow-Ups:
- Re: Re: Cannot Factor an expression
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Cannot Factor an expression
- References:
- Cannot Factor an expression
- From: Francogrex <franco@grex.org>
- Cannot Factor an expression