Make symbolic doctests ready for random seeds
Closed this issue · 14 comments
This ticket makes
sage -t --long --random-seed=n src/sage/symbolic/
pass for different values n than just 0.
Depends on #29962
Component: doctest framework
Author: Jonathan Kliem
Branch/Commit: ac1e491
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/29984
Just a remark. I got
File "src/sage/symbolic/expression.pyx", line 9998, in sage.symbolic.expression.Expression.simplify_hypergeometric
Failed example:
(nest(lambda y: hypergeometric([y], [1], x), 3, 1)
.simplify_hypergeometric(algorithm='sage'))
Exception raised:
Traceback (most recent call last):
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 680, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1104, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.symbolic.expression.Expression.simplify_hypergeometric[3]>", line 2, in <module>
.simplify_hypergeometric(algorithm='sage'))
File "sage/symbolic/expression.pyx", line 10036, in sage.symbolic.expression.Expression.simplify_hypergeometric (build/cythonized/sage/symbolic/expression.cpp:52239)
return closed_form(hypergeometric(a, b, t))
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/functions/hypergeometric.py", line 923, in closed_form
return sum([coeff * _closed_form(pfq) for coeff, pfq in new._deflated()])
File "sage/symbolic/expression.pyx", line 12725, in sage.symbolic.expression._eval_on_operands.new_f (build/cythonized/sage/symbolic/expression.cpp:67166)
return f(ex, *new_args, **kwds)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/functions/hypergeometric.py", line 706, in _deflated
new = self.eliminate_parameters()
File "sage/symbolic/expression.pyx", line 12725, in sage.symbolic.expression._eval_on_operands.new_f (build/cythonized/sage/symbolic/expression.cpp:67166)
return f(ex, *new_args, **kwds)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/functions/hypergeometric.py", line 462, in eliminate_parameters
if bbb in aa:
File "sage/symbolic/expression.pyx", line 3115, in sage.symbolic.expression.Expression.__nonzero__ (build/cythonized/sage/symbolic/expression.cpp:19420)
res = self.test_relation()
File "sage/symbolic/expression.pyx", line 3284, in sage.symbolic.expression.Expression.test_relation (build/cythonized/sage/symbolic/expression.cpp:21463)
val = domain(diff.subs(var_dict))
File "sage/symbolic/expression.pyx", line 5351, in sage.symbolic.expression.Expression.substitute (build/cythonized/sage/symbolic/expression.cpp:30434)
res = self._gobj.subs_map(smap, 0)
File "sage/symbolic/function.pyx", line 1224, in sage.symbolic.function.BuiltinFunction._evalf_or_eval_ (build/cythonized/sage/symbolic/function.cpp:13392)
res = self._evalf_try_(*args)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/functions/hypergeometric.py", line 337, in _evalf_try_
return self._evalf_(a, b, z, parent=p)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/sage/functions/hypergeometric.py", line 354, in _evalf_
return mpmath_utils.call(hyper, aa, bb, z, parent=parent)
File "sage/libs/mpmath/utils.pyx", line 436, in sage.libs.mpmath.utils.call (build/cythonized/sage/libs/mpmath/utils.c:6914)
y = func(*args, **kwargs)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/mpmath/functions/hypergeometric.py", line 222, in hyper
if q == 1: return ctx._hyp1f1(a_s, b_s, z, **kwargs)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/mpmath/functions/hypergeometric.py", line 342, in _hyp1f1
v = ctx.hypsum(1, 1, (atype, btype), [a, b], z, **kwargs)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/mpmath/ctx_mp.py", line 715, in hypsum
epsshift, mag_dict, **kwargs)
File "/home/jonathan/Applications/sage/local/lib/python3.7/site-packages/mpmath/libmp/libhyper.py", line 321, in _hypsum
prec, wp, epsshift, magnitude_check, kwargs)
File "sage/libs/mpmath/ext_main.pyx", line 2647, in sage.libs.mpmath.ext_main.hypsum_internal (build/cythonized/sage/libs/mpmath/ext_main.c:28451)
have_complex, magn = MPF_hypsum(&c.re, &c.im, p, q, param_types, \
File "sage/libs/mpmath/ext_impl.pyx", line 2212, in sage.libs.mpmath.ext_impl.MPF_hypsum (build/cythonized/sage/libs/mpmath/ext_impl.c:23881)
raise NoConvergence('Hypergeometric series converges too slowly. Try increasing maxterms.')
mpmath.libmp.libhyper.NoConvergence: Hypergeometric series converges too slowly. Try increasing maxterms.
**********************************************************************
2 items had failures:
1 of 24 in sage.symbolic.expression.Expression.rectform
1 of 7 in sage.symbolic.expression.Expression.simplify_hypergeometric
[2873 tests, 2 failures, 69.17 s]
sage -t --long --random-seed=1231123241434789 src/sage/symbolic/random_tests.py
[42 tests, 57.33 s]
so I set set_random_seed(0) for this one.
New commits:
da1c6be | start from a "random" random seed for doctesting |
b7b836d | make random seed reproducible |
eedbe5e | document random_seed |
998b1b9 | default random seed 0 for now |
1d7b00e | dash instead of underscore for command line options |
34cbdaa | make symbolix fuzz ready |
8530e45 | fix tests in src/sage/symbolix/expression |
Branch: public/29984
Author: Jonathan Kliem
Merge conflict.
I also need to go through it again and check I respected the design decision in #29935.
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
b86258b | Trac #27365: update docstring |
43b68a9 | Trac #27365: src.sage.interfaces.latte: check for zero polynomial |
ddedd05 | Trac #27365: minor restructure of code (for clearification) in src.sage.interfaces.latte |
46bccaa | Trac #27365: cleanup one import |
8e29094 | Trac #27365: boundary case: integration over polyhedron with only one vertex |
790aec5 | Polyhedron_base.integrate: Update for new affine_hull_projection output |
a25c0ef | src/sage/geometry/polyhedron/base.py: Add some # optional - latte_int |
3324366 | Polyhedron_base._integrate_latte_: Fix error message |
8d8b665 | Merge branch 'u/mkoeppe/polyhedron-integrate-induced' of git://trac.sagemath.org/sage into test_27365 |
b541ec9 | make symbolic ready for random seeds |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
ac1e491 | make symbolic ready for random seeds |
lgtm
Reviewer: Dima Pasechnik
Changed branch from public/29984 to ac1e491