Status: Accepted Owner: ---- CC: mattpap Labels: Type-Defect Priority-Medium
New issue 1587 by ondrej.certik: bugs in polynomials.txt http://code.google.com/p/sympy/issues/detail?id=1587 By applying the following patch: diff --git a/doc/src/modules/polynomials.txt b/doc/src/modules/polynomials.txt index ac1bf7f..4094081 100644 --- a/doc/src/modules/polynomials.txt +++ b/doc/src/modules/polynomials.txt @@ -47,10 +47,10 @@ As you can see, q has a non-integer coefficient. If you want only in the ring of polynomials with integer coefficients you can specify an additional parameter. - >>> q, r = div(f, g, coeff='int') #doctest: +SKIP - >>> q #doctest: +SKIP + >>> q, r = div(f, g, coeff='int') + >>> q 0 - >>> r #doctest: +SKIP + >>> r 13 + 5*x**2 + 15*x But be warned, that this ring is no longer euclidean and that the degree of the @@ -58,12 +58,12 @@ remainder doesn't need to be smaller than that of f. Since 2 2*x doesn't divide 5*x**2, even if the degree is smaller. But: >>> g = 5*x + 1 - >>> q, r = div(f, g, x, coeff='int') #doctest: +SKIP - >>> q #doctest: +SKIP + >>> q, r = div(f, g, x, coeff='int') + >>> q x - >>> r #doctest: +SKIP + >>> r 13 + 14*x - >>> (q*g + r).expand() #doctest: +SKIP + >>> (q*g + r).expand() 13 + 5*x**2 + 15*x This also works for polynomials with multiple variables. it seems to reveal a bunch of bugs: File "doc/src/modules/polynomials.txt", line 50, in polynomials.txt Failed example: q, r = div(f, g, coeff='int') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.6/doctest.py", line 1241, in __run compileflags, 1) in test.globs File "<doctest polynomials.txt[11]>", line 1, in <module> q, r = div(f, g, coeff='int') File "/home/ondrej/repos/sympy/sympy/polys/wrappers.py", line 60, in div q, r = poly_div(*_conv_args(2, args), **kwargs) TypeError: poly_div() got an unexpected keyword argument 'coeff' ********************************************************************** File "doc/src/modules/polynomials.txt", line 51, in polynomials.txt Failed example: q Expected: 0 Got: 5*x 5/2 + --- 2 ********************************************************************** File "doc/src/modules/polynomials.txt", line 53, in polynomials.txt Failed example: r Expected: 13 + 5*x**2 + 15*x Got: -2 ********************************************************************** File "doc/src/modules/polynomials.txt", line 61, in polynomials.txt Failed example: q, r = div(f, g, x, coeff='int') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.6/doctest.py", line 1241, in __run compileflags, 1) in test.globs File "<doctest polynomials.txt[15]>", line 1, in <module> q, r = div(f, g, x, coeff='int') File "/home/ondrej/repos/sympy/sympy/polys/wrappers.py", line 60, in div q, r = poly_div(*_conv_args(2, args), **kwargs) TypeError: poly_div() got an unexpected keyword argument 'coeff' ********************************************************************** File "doc/src/modules/polynomials.txt", line 62, in polynomials.txt Failed example: q Expected: x Got: 5*x 5/2 + --- 2 ********************************************************************** File "doc/src/modules/polynomials.txt", line 64, in polynomials.txt Failed example: r Expected: 13 + 14*x Got: -2 ********************************************************************** File "doc/src/modules/polynomials.txt", line 66, in polynomials.txt Failed example: (q*g + r).expand() Expected: 13 + 5*x**2 + 15*x Got: 2 25*x 1/2 + 15*x + ----- 2 ********************************************************************** 1 items had failures: 7 of 66 in polynomials.txt -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en -~----------~----~----~----~------~----~------~--~---
