Re: Re: Re: Cannot Factor an expression
- To: mathgroup at smc.vnet.net
- Subject: [mg87734] Re: [mg87683] Re: [mg87618] Re: [mg87563] Cannot Factor an expression
- From: Syd Geraghty <sydgeraghty at mac.com>
- Date: Wed, 16 Apr 2008 05:05:05 -0400 (EDT)
- References: <200804130731.DAA11432@smc.vnet.net> <200804140946.FAA08308@smc.vnet.net> <200804150955.FAA25252@smc.vnet.net>
Andrzej, There was a syntax problem with your PolynomialReduce function below ... (complete inputs) should have been:- q = Sum[(Subscript[z, i] - 1)*(=CE=BC - Subscript[x, i])^2, {i, 1, 3}] p = Expand[q] Factor[First[ PolynomialReduce[ p, {Subscript[z, 1] - 1, Subscript[z, 2] - 1, Subscript[z, 3] - 1}, {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]}]]].{Subscript[z, 1] - 1, Subscript[z, 2] - 1, Subscript[z, 3] - 1} There is a missing ", {Subscript[x, 1], Subscript[x, 2], Subscript[x, = 3]}]" It seems your postings are sometimes missing lines because I am sure you would have tested your function yet it clearly fails 6.0.2's syntax checking. HTH Syd Syd Geraghty B.Sc, M.Sc. sydgeraghty at mac.com My System Mathematica 6.0.1 for Mac OS X x86 (64 - bit) (June 19, 2007) MacOS X V 10.5 .20 MacBook Pro 2.33 Ghz Intel Core 2 Duo 2GB RAM On Apr 15, 2008, at 2:55 AM, Andrzej Kozlowski wrote: > 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 >>> >> >> > >
- References:
- Cannot Factor an expression
- From: Francogrex <franco@grex.org>
- Re: Cannot Factor an expression
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Cannot Factor an expression
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Cannot Factor an expression