Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make symbolic doctests ready for random seeds #29984

Closed
kliem opened this issue Jun 24, 2020 · 14 comments
Closed

Make symbolic doctests ready for random seeds #29984

kliem opened this issue Jun 24, 2020 · 14 comments

Comments

@kliem
Copy link
Contributor

kliem commented Jun 24, 2020

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

@kliem kliem added this to the sage-9.2 milestone Jun 24, 2020
@kliem
Copy link
Contributor Author

kliem commented Jun 24, 2020

comment:1

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.

@kliem
Copy link
Contributor Author

kliem commented Jun 24, 2020

New commits:

da1c6bestart from a "random" random seed for doctesting
b7b836dmake random seed reproducible
eedbe5edocument random_seed
998b1b9default random seed 0 for now
1d7b00edash instead of underscore for command line options
34cbdaamake symbolix fuzz ready
8530e45fix tests in src/sage/symbolix/expression

@kliem
Copy link
Contributor Author

kliem commented Jun 24, 2020

Branch: public/29984

@kliem
Copy link
Contributor Author

kliem commented Jun 24, 2020

Commit: 8530e45

@kliem
Copy link
Contributor Author

kliem commented Jun 24, 2020

Author: Jonathan Kliem

@kliem
Copy link
Contributor Author

kliem commented Jul 12, 2020

comment:3

Merge conflict.

I also need to go through it again and check I respected the design decision in #29935.

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Sep 5, 2020
@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 13, 2021

comment:5

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2021

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

b86258bTrac #27365: update docstring
43b68a9Trac #27365: src.sage.interfaces.latte: check for zero polynomial
ddedd05Trac #27365: minor restructure of code (for clearification) in src.sage.interfaces.latte
46bccaaTrac #27365: cleanup one import
8e29094Trac #27365: boundary case: integration over polyhedron with only one vertex
790aec5Polyhedron_base.integrate: Update for new affine_hull_projection output
a25c0efsrc/sage/geometry/polyhedron/base.py: Add some # optional - latte_int
3324366Polyhedron_base._integrate_latte_: Fix error message
8d8b665Merge branch 'u/mkoeppe/polyhedron-integrate-induced' of git://trac.sagemath.org/sage into test_27365
b541ec9make symbolic ready for random seeds

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2021

Changed commit from 8530e45 to b541ec9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2021

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ac1e491make symbolic ready for random seeds

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2021

Changed commit from b541ec9 to ac1e491

@dimpase
Copy link
Member

dimpase commented Jun 3, 2021

comment:9

lgtm

@dimpase
Copy link
Member

dimpase commented Jun 3, 2021

Reviewer: Dima Pasechnik

@vbraun
Copy link
Member

vbraun commented Jun 19, 2021

Changed branch from public/29984 to ac1e491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants