Changeset 7486:b75f20360b8d
- Timestamp:
- 11/27/07 17:59:55 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/rings/polynomial/polynomial_element.pyx (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/polynomial/polynomial_element.pyx
r7471 r7486 2420 2420 [(I, 3), (-2^(1/4), 1), (2^(1/4), 1), (1, 1)] 2421 2421 2422 A n example where the base ring doesn't have a factorization2423 algorithm (yet). Note that this is currently done via naive2424 enumeration, so could be very slow:2422 A couple of examples where the base ring doesn't have a 2423 factorization algorithm (yet). Note that this is currently 2424 done via naive enumeration, so could be very slow: 2425 2425 sage: R = Integers(6) 2426 2426 sage: S.<x> = R['x'] … … 2432 2432 sage: p.roots(multiplicities=False) 2433 2433 [1, 5] 2434 sage: R = Integers(9) 2435 sage: A = PolynomialRing(R, 'y') 2436 sage: y = A.gen() 2437 sage: f = 10*y^2 - y^3 - 9 2438 sage: f.roots(multiplicities=False) 2439 [0, 1, 3, 6] 2434 2440 2435 2441 An example over the complex double field (where root finding … … 2599 2605 .change_ring(L) and proceed as below. 2600 2606 2601 The next method is to attempt to factor the polynomial. 2602 If this succeeds, then for every degree-one factor a*x+b, we 2603 add -b/a as a root (as long as this quotient is actually in 2604 the desired ring). 2605 2606 If factoring over K is not implemented, and K is finite, then 2607 we find the roots by enumerating all elements of K and checking 2608 whether the polynomial evaluates to zero at that value. 2607 The next method, which is used if K is an integral domain, is 2608 to attempt to factor the polynomial. If this succeeds, then 2609 for every degree-one factor a*x+b, we add -b/a as a root (as 2610 long as this quotient is actually in the desired ring). 2611 2612 If factoring over K is not implemented (or K is not an 2613 integral domain), and K is finite, then we find the roots by 2614 enumerating all elements of K and checking whether the 2615 polynomial evaluates to zero at that value. 2609 2616 2610 2617 … … 2767 2774 2768 2775 try: 2769 rts = self.factor() 2776 if K.is_integral_domain(): 2777 rts = self.factor() 2778 else: 2779 raise NotImplementedError 2770 2780 except NotImplementedError: 2771 2781 if K.is_finite():
Note: See TracChangeset
for help on using the changeset viewer.
