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

MathGroup Archive 2008

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

Search the Archive

Re: Re: Cannot Factor an expression


I got my p's and q's mixed up in addition to having some garbled  
input. So here we go again:


q = Sum[(Subscript[z, i] - 1)*
     (\[Mu] - Subscript[x, i])^2, {i, 1, 3}]

(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)
In[2]:=
p = Expand[q];


Factor[First[PolynomialReduce[p,
      {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)


All free and no need to load any Add On packages ;-)

Andrzej Kozlowski


On 14 Apr 2008, at 18:46, Andrzej Kozlowski wrote:
> 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
>>
>
>



  • Prev by Date: Re: Re: Re: Player Pro and Packages
  • Next by Date: smart change of variables?
  • Previous by thread: Re: Cannot Factor an expression
  • Next by thread: Re: Re: Re: Cannot Factor an expression