[geogebra-dev] Improving MathPiper's Factor()

  • From: Howard Ostrowsky <shermost@xxxxxxxxx>
  • To: geogebra-dev@xxxxxxxxxxxxx
  • Date: Mon, 22 Jun 2009 10:57:50 -0700

Here is a short session from MathPiper, showing how one can post-process a
common type of incomplete or confusing result from the Factor() function.
Hope this is helpful to some.

MathPiper version ".75c"
In> u
Result> 2*a*x^2-4*a*x+2*a
In> Factor(u)
Result> FWatom(2*a*x^2-4*a*x+2*a)
   COMMENT: Not very helpful!
In> Listify(%)
Result> {FWatom,2*a*x^2-4*a*x+2*a}
In> fu:=%[2]
Result> 2*a*x^2-4*a*x+2*a
   COMMENT: Better, but still not factored!
In> fc:=Gcd(Coef(fu,x,0 .. 2))
Result> 2*a
   COMMENT: This discovers the constant factors
In> fc*Factor(Simplify(fu/fc))
Result> 2*a*(x-1)^2
   COMMENT: Now, it's fully factored.

Sherm

Other related posts: