Closed GoogleCodeExporter closed 9 years ago
I don't get that error, but several doctests fail expectedly since the docs
haven't
been updated.
Could your problem be a Unix/Windows issue?
Original comment by fredrik....@gmail.com
on 10 Oct 2008 at 12:29
A lot of mpmath doctests are failing in sympy currently. I think they need to be
fixed, can you acknowledge?
Original comment by Vinzent.Steinberg@gmail.com
on 17 Nov 2008 at 8:43
Which ones? Possibly at least some of them have been fixed in mpmath.
Right now there are (passing) docstring doctests in calculus.py, functions.py,
elliptic.py and identification.py that can be run by invoking the .py files.
There
should just be a way to run them all automatically.
Original comment by fredrik....@gmail.com
on 18 Nov 2008 at 5:54
Ondrej implemented a very nice doctest runner. Using it for sympy I figured out
that
many doctests fail (because they were outdated -- some of them were never
tested,
fundamental imports were missing). I fixed them, except for mpmath, because this
should be fixed here and I wanted to know your opinion.
There are quite a lot of tests failing:
File "/home/one/src/sympy/git/sympy/mpmath/calculus.py", line 244, in
sympy.mpmath.calculus.polyroots
Failed example:
nprint(polyroots([4,3,2], error=True))
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.calculus.polyroots[1]>", line 1, in <module>
nprint(polyroots([4,3,2], error=True))
NameError: name 'nprint' is not defined
________________________________________________________________________________
_____________________ sympy.mpmath.identification.identify _____________________
File "/home/one/src/sympy/git/sympy/mpmath/identification.py", line 289, in
sympy.mpmath.identification.identify
Failed example:
identify(3*pi + 4*sqrt(2), ['pi','sqrt(2)'])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.identification.identify[3]>", line 1, in <module>
identify(3*pi + 4*sqrt(2), ['pi','sqrt(2)'])
NameError: name 'pi' is not defined
________________________________________________________________________________
__________________________ sympy.mpmath.mptypes.nstr ___________________________
File "/home/one/src/sympy/git/sympy/mpmath/mptypes.py", line 827, in
sympy.mpmath.mptypes.nstr
Failed example:
nstr([+pi, ldexp(1,-500)])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.mptypes.nstr[0]>", line 1, in <module>
nstr([+pi, ldexp(1,-500)])
NameError: name 'pi' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/mptypes.py", line 829, in
sympy.mpmath.mptypes.nstr
Failed example:
print([+pi, ldexp(1,-500)])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.mptypes.nstr[1]>", line 1, in <module>
print([+pi, ldexp(1,-500)])
NameError: name 'pi' is not defined
________________________________________________________________________________
_________________________ sympy.mpmath.quadrature.quad _________________________
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 342, in
sympy.mpmath.quadrature.quad
Failed example:
from mpmath import *
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[0]>", line 1, in <module>
from mpmath import *
ImportError: No module named mpmath
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 346, in
sympy.mpmath.quadrature.quad
Failed example:
print quad(f, [0, 1], [0, pi])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[3]>", line 1, in <module>
print quad(f, [0, 1], [0, pi])
File "sympy/mpmath/quadrature.py", line 390, in quad
points[0], prec, epsilon, m, verbose)
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 188, in sum_next
S += w*(f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "sympy/mpmath/quadrature.py", line 389, in <lambda>
points[1], prec, epsilon, m)[0],
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 188, in sum_next
S += w*(f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "sympy/mpmath/quadrature.py", line 388, in <lambda>
rule.summation(lambda y: f(x,y), \
File "<doctest sympy.mpmath.quadrature.quad[2]>", line 1, in <lambda>
f = lambda x, y: exp(x*sin(y))
NameError: global name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 358, in
sympy.mpmath.quadrature.quad
Failed example:
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[4]>", line 1, in <module>
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
File "sympy/mpmath/quadrature.py", line 452, in quadgl
return quad(*args, **kwargs)
File "sympy/mpmath/quadrature.py", line 385, in quad
v, err = rule.summation(f, points[0], prec, epsilon, m, verbose)
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 326, in sum_next
s += w * (f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "<doctest sympy.mpmath.quadrature.quad[4]>", line 1, in <lambda>
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
NameError: global name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 360, in
sympy.mpmath.quadrature.quad
Failed example:
print quadgl(sin, arange(0, 1000+1, 10))
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[5]>", line 1, in <module>
print quadgl(sin, arange(0, 1000+1, 10))
NameError: name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 362, in
sympy.mpmath.quadrature.quad
Failed example:
print cos(0) - cos(1000)
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[6]>", line 1, in <module>
print cos(0) - cos(1000)
NameError: name 'cos' is not defined
________________________________________________________________________________
___________ sympy.mpmath.tests.test_power.test_pow_epsilon_rounding ____________
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 40, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
1.0001 ** -5
Expected:
0.99950014996500702
Got:
0.999500149965
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 42, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
0.9999 ** -5
Expected:
1.000500150035007
Got:
1.00050015004
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 44, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-1.0001) ** -5
Expected:
-0.99950014996500702
Got:
-0.999500149965
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 46, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-0.9999) ** -5
Expected:
-1.000500150035007
Got:
-1.00050015004
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 49, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
1.0001 ** -6
Expected:
0.99940020994401269
Got:
0.999400209944
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 51, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
0.9999 ** -6
Expected:
1.0006002100560125
Got:
1.00060021006
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 53, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-1.0001) ** -6
Expected:
0.99940020994401269
Got:
0.999400209944
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 55, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-0.9999) ** -6
Expected:
1.0006002100560125
Got:
1.00060021006
________________________________________________________________________________
Original comment by Vinzent.Steinberg@gmail.com
on 18 Nov 2008 at 8:23
I think most of those tests are outdated. Anyway, I'll make sure all doctests
work
as I'm revising the documentation per issue 92 (I just haven't gotten
everywhere
yet).
The last ones are interesting. 1.0001**-5 does repr to 0.99950014996500702 for
me,
on at least three different systems; why doesn't it for you?
Original comment by fredrik....@gmail.com
on 18 Nov 2008 at 8:38
Python 2.5.2 (r252:60911, Aug 1 2008, 00:43:38)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1.0001**-5
0.99950014996500702
Maybe a bug in Ondrej's doctest runner (it's not yet finished nor committed).
I'll wait until you revised the documentation before trying to fix it in sympy.
Please let me know if I can help you!
Original comment by Vinzent.Steinberg@gmail.com
on 18 Nov 2008 at 8:54
Closing this because it's either a bug in SymPy or no longer relevant.
Original comment by fredrik....@gmail.com
on 15 Jan 2010 at 8:26
Original issue reported on code.google.com by
Vinzent.Steinberg@gmail.com
on 8 Oct 2008 at 5:44