Skip to content

Commit

Permalink
fix formatting and numerical noise in doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwifb committed May 11, 2016
1 parent 6e4937e commit f7973e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sage/calculus/calculus.py
Expand Up @@ -723,7 +723,7 @@ def nintegral(ex, x, a, b,
Now numerically integrating, we see why the answer is wrong::
sage: f.nintegrate(x,0,1)
(-480.0000000000001, 5.329070518200754e-12, 21, 0)
(-480.0000000000001, 5.32907051820075e-12, 21, 0)
It is just because every floating point evaluation of return -480.0
in floating point.
Expand Down
4 changes: 2 additions & 2 deletions src/sage/interfaces/interface.py
Expand Up @@ -521,9 +521,9 @@ def function_call(self, function, args=None, kwds=None):
EXAMPLES::
sage: maxima.quad_qags(x, x, 0, 1, epsrel=1e-4)
[0.5,5.5511151231257...e-15,21,0]
[0.5,0.55511151231257...e-14,21,0]
sage: maxima.function_call('quad_qags', [x, x, 0, 1], {'epsrel':'1e-4'})
[0.5,5.5511151231257...e-15,21,0]
[0.5,0.55511151231257...e-14,21,0]
"""
args, kwds = self._convert_args_kwds(args, kwds)
self._check_valid_function_name(function)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/maxima_abstract.py
Expand Up @@ -1518,7 +1518,7 @@ def nintegral(self, var='x', a=0, b=1,
EXAMPLES::
sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
(0.5284822353142306, 4.16331413788384...e-11, 231, 0)
(0.5284822353142306, 0.41633141378838...e-10, 231, 0)
Note that GP also does numerical integration, and can do so to very
high precision very quickly::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modules/free_module_element.pyx
Expand Up @@ -3857,11 +3857,11 @@ cdef class FreeModuleElement(Vector): # abstract base class
sage: type(vec)
<type 'sage.modules.vector_real_double_dense.Vector_real_double_dense'>
sage: answers
[(0.5, 5.551115123125784e-15, 21, 0), (0.3333333333333..., 3.70074341541719e-15, 21, 0), (0.45969769413186..., 5.103669643922841e-15, 21, 0)]
[(0.5, 5.55111512312578e-15, 21, 0), (0.3333333333333..., 3.70074341541719e-15, 21, 0), (0.45969769413186..., 5.10366964392284e-15, 21, 0)]

sage: r=vector([t,0,1], sparse=True)
sage: r.nintegral(t,0,1)
((0.5, 0.0, 1.0), {0: (0.5, 5.551115123125784e-15, 21, 0), 2: (1.0, 1.11022302462515...e-14, 21, 0)})
((0.5, 0.0, 1.0), {0: (0.5, 5.55111512312578e-15, 21, 0), 2: (1.0, 1.11022302462515...e-14, 21, 0)})

"""
# If Cython supported lambda functions, we would just do
Expand Down
4 changes: 2 additions & 2 deletions src/sage/tests/french_book/integration_doctest.py
Expand Up @@ -68,13 +68,13 @@
Sage example in ./integration.tex, line 430::
sage: sage.calculus.calculus.nintegral(sin(sin(x)), x, 0, 1)
(0.430606103120690..., 4.780688102287053...e-15, 21, 0)
(0.430606103120690..., 4.78068810228705...e-15, 21, 0)
Sage example in ./integration.tex, line 436::
sage: g(x) = sin(sin(x))
sage: g.nintegral(x, 0, 1)
(0.430606103120690..., 4.780688102287053...e-15, 21, 0)
(0.430606103120690..., 4.78068810228705...e-15, 21, 0)
Sage example in ./integration.tex, line 465::
Expand Down

0 comments on commit f7973e0

Please sign in to comment.