Phil Carmody on Wed, 16 Apr 2008 11:15:42 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
poldisc shortcut known but not used |
It appears that this is well known: > There's more than one way to calculate a polynomial > discriminant. It > turns out that when the coefficients are ugly multivariate > (but exact) > expressions, one of the polresultant() algorithms is much > faster. > Says so right in the manual! For a monic polynomial px of > degree m, > poldisc(px) and polresultant(px,deriv(px)) differ formally > by a factor > of (-1)^(m(m-1)/2). Dragging out the old chestnut > polynomial shows > that the manual wasn't kidding about the other > algorithm being faster: > > ? px=x^10 + (2*B*u + (2*A + 4*B))*x^9 + (9*A*u + (9*A + > (9*B - > 45)))*x^8 + ((-24*A - 120)*u + (-24*A + (-24*B - 120)))*x^7 > + ((-42*B > + 210)*u + (-42*A + (-84*B + 210)))*x^6 + 252*x^5 + (42*B*u > + (42*A + > 84*B))*x^4 + (24*A*u + (24*A + (24*B - 120)))*x^3 + ((-9*A > - 45)*u + > (-9*A + (-9*B - 45)))*x^2 + ((-2*B + 10)*u + (-2*A + (-4*B > + 10)))*x + > 1; > time = 0 ms. > ? disc1=poldisc(px); > time = 46,859 ms. > ? disc2=-polresultant(px,deriv(px),x,2);\\Factor of -1 is (-1)^(10*9/2) > time = 10,475 ms. > ? disc1==disc2 > time = 0 ms. > %4 = 1 Is there any reason why this case can't be detected automatically, and the shortcut used internally? Phil ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ