Skip to content

Commit 808db2c

Browse files
Merge pull request mpmath#433 from skirpichev/fix-more-defun
Fix more broken defun decorators, amend ef75979
2 parents 90a9a47 + 7f6a5c6 commit 808db2c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

mpmath/calculus/calculus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ class CalculusMethods(object):
33

44
def defun(f):
55
setattr(CalculusMethods, f.__name__, f)
6+
return f

mpmath/calculus/polynomials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def polyroots(ctx, coeffs, maxsteps=50, cleanup=True, extraprec=10,
117117
118118
>>> mp.dps = 60
119119
>>> for r in polyroots([1, 0, -10, 0, 1]):
120-
... print r
120+
... print(r)
121121
...
122122
-3.14626436994197234232913506571557044551247712918732870123249
123123
-0.317837245195782244725757617296174288373133378433432554879127

mpmath/matrices/eigen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Eigen(object):
4040

4141
def defun(f):
4242
setattr(Eigen, f.__name__, f)
43+
return f
4344

4445
def hessenberg_reduce_0(ctx, A, T):
4546
"""

mpmath/matrices/eigen_symmetric.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,16 +783,16 @@ def gauss_quadrature(ctx, n, qtype = "legendre", alpha = 0, beta = 0):
783783
>>> A = mp.fdot([(f(x), w) for x, w in zip(X, W)])
784784
>>> B = mp.sqrt(mp.pi) * 57 / 16
785785
>>> C = mp.quad(lambda x: mp.exp(- x * x) * f(x), [-mp.inf, +mp.inf])
786-
>>> print mp.chop(A-B, tol = 1e-10), mp.chop(A-C, tol = 1e-10)
787-
0.0 0.0
786+
>>> mp.nprint((mp.chop(A-B, tol = 1e-10), mp.chop(A-C, tol = 1e-10)))
787+
(0.0, 0.0)
788788
789789
>>> f = lambda x: x**5 - 2 * x**4 + 3 * x**3 - 5 * x**2 + 7 * x - 11
790790
>>> X, W = mp.gauss_quadrature(3, "laguerre")
791791
>>> A = mp.fdot([(f(x), w) for x, w in zip(X, W)])
792792
>>> B = 76
793793
>>> C = mp.quad(lambda x: mp.exp(-x) * f(x), [0, +mp.inf])
794-
>>> print mp.chop(A-B, tol = 1e-10), mp.chop(A-C, tol = 1e-10)
795-
0.0 0.0
794+
>>> mp.nprint(mp.chop(A-B, tol = 1e-10), mp.chop(A-C, tol = 1e-10))
795+
.0
796796
797797
# orthogonality of the chebyshev polynomials:
798798
>>> f = lambda x: mp.chebyt(3, x) * mp.chebyt(2, x)

0 commit comments

Comments
 (0)