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

NIntegrate Overflow - when scipy is not installed ? #1501

Open
rocky opened this issue Jul 26, 2021 · 0 comments
Open

NIntegrate Overflow - when scipy is not installed ? #1501

rocky opened this issue Jul 26, 2021 · 0 comments

Comments

@rocky
Copy link
Member

rocky commented Jul 26, 2021

$ py.test -sxv test/test_nintegrate.py
==================================== test session starts ====================================
platform linux -- Python 3.7.10[pypy-7.3.5-final], pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /home/rocky/.pyenv/versions/pypy3.7-7.3.5/bin/python
cachedir: .pytest_cache
rootdir: /src/external-vcs/github/mathics/Mathics
collected 2 items                                                                           

test/test_nintegrate.py::test_nintegrate[NIntegrate[x^2, {x,0,1}]-1/3.-] PASSED
test/test_nintegrate.py::test_nintegrate[NIntegrate[x^2 y^(-.5), {x,0,1},{y,0,1}]-1.-] FAILED

========================================= FAILURES ==========================================
_______________ test_nintegrate[NIntegrate[x^2 y^(-.5), {x,0,1},{y,0,1}]-1.-] _______________

str_expr = 'NIntegrate[x^2 y^(-.5), {x,0,1},{y,0,1}]', str_expected = '1.', msg = ''
message = ''

    @pytest.mark.parametrize("str_expr, str_expected, msg", tests_for_nintegrate)
    def test_nintegrate(str_expr: str, str_expected: str, msg: str, message=""):
>       result = evaluate(str_expr)

test/test_nintegrate.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/helper.py:13: in evaluate
    return session.evaluate(str_expr)
mathics/session.py:65: in evaluate
    self.last_result = expr.evaluate(self.evaluation)
mathics/core/expression.py:1315: in evaluate
    expr, reevaluate = expr.evaluate_next(evaluation)
mathics/core/expression.py:1449: in evaluate_next
    result = rule.apply(new, evaluation, fully=False)
mathics/core/rules.py:67: in apply
    self.pattern.match(yield_match, expression, {}, evaluation, fully=fully)
mathics/core/pattern.py:291: in match
    self.head.match(yield_head, expression.get_head(), vars, evaluation)
mathics/core/pattern.py:159: in match
    yield_func(vars, None)
mathics/core/pattern.py:282: in yield_head
    yield_choice, expression, attributes, head_vars
mathics/core/pattern.py:429: in get_pre_choices
    yield_func(vars)
mathics/core/pattern.py:270: in yield_choice
    wrap_oneid=expression.get_head_name() != "System`MakeBoxes",
mathics/core/pattern.py:661: in match_leaf
    include_flattened=include_flattened,
mathics/core/pattern.py:456: in get_wrappings
    yield_func(items[0])
mathics/core/pattern.py:652: in yield_wrapping
    wrap_oneid=wrap_oneid,
mathics/builtin/patterns.py:852: in match
    self.pattern.match(yield_func, expression, new_vars, evaluation)
mathics/builtin/patterns.py:1050: in match
    yield_func(vars, None)
mathics/core/pattern.py:636: in match_yield
    wrap_oneid=wrap_oneid,
mathics/core/pattern.py:661: in match_leaf
    include_flattened=include_flattened,
mathics/core/pattern.py:467: in get_wrappings
    yield_func(sequence)
mathics/core/pattern.py:652: in yield_wrapping
    wrap_oneid=wrap_oneid,
mathics/builtin/patterns.py:852: in match
    self.pattern.match(yield_func, expression, new_vars, evaluation)
mathics/builtin/patterns.py:1110: in match
    yield_func(vars, None)
mathics/core/pattern.py:636: in match_yield
    wrap_oneid=wrap_oneid,
mathics/core/pattern.py:661: in match_leaf
    include_flattened=include_flattened,
mathics/core/pattern.py:467: in get_wrappings
    yield_func(sequence)
mathics/core/pattern.py:652: in yield_wrapping
    wrap_oneid=wrap_oneid,
mathics/builtin/patterns.py:1439: in match
    yield_func(new_vars, None)
mathics/core/pattern.py:640: in match_yield
    yield_func(new_vars, items_rest)
mathics/core/pattern.py:618: in leaf_yield
    (list(chain(rest_expression[0], items_rest[0])), next_rest[1]),
mathics/core/pattern.py:618: in leaf_yield
    (list(chain(rest_expression[0], items_rest[0])), next_rest[1]),
mathics/core/rules.py:42: in yield_match
    new_expression = self.do_replace(expression, vars, options, evaluation)
mathics/core/rules.py:129: in do_replace
    return self.function(evaluation=evaluation, options=options, **vars_noctx)
mathics/builtin/numeric.py:685: in apply_with_func_domain
    return from_python(result)
mathics/core/expression.py:118: in from_python
    return Real(arg)
mathics/core/expression.py:2398: in __new__
    return MachineReal.__new__(MachineReal, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'mathics.core.expression.MachineReal'>, value = nan

    def __new__(cls, value) -> "MachineReal":
        self = Number.__new__(cls)
        self.value = float(value)
        if math.isinf(self.value) or math.isnan(self.value):
>           raise OverflowError
E           OverflowError

mathics/core/expression.py:2467: OverflowError
================================== short test summary info ==================================
FAILED test/test_nintegrate.py::test_nintegrate[NIntegrate[x^2 y^(-.5), {x,0,1},{y,0,1}]-1.-]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================ 1 failed, 1 passed in 8.60s ================================
$
rocky added a commit that referenced this issue Jul 29, 2021
when scipy isn't installed.

#1501 will be used to track
what's up here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant