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

Expression evaluation needs forever #24441

Closed
rwst opened this issue Dec 28, 2017 · 8 comments
Closed

Expression evaluation needs forever #24441

rwst opened this issue Dec 28, 2017 · 8 comments

Comments

@rwst
Copy link

rwst commented Dec 28, 2017

Indirectly found by a random_expr() run:

sage: exp_polar(arcsec(jacobi_sn(1.1*I*x, x)))

...doesn't return. When stopped we find ourselves in Maxima:

/home/ralf/sage/src/sage/symbolic/function.pyx in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11630)()
    992             res = self._evalf_try_(*args)
    993             if res is None:
--> 994                 res = super(BuiltinFunction, self).__call__(
    995                         *args, coerce=coerce, hold=hold)
    996 

/home/ralf/sage/src/sage/symbolic/function.pyx in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6670)()
    486             res = g_function_evalv(self._serial, vec, hold)
    487         elif self._nargs == 1:
--> 488             res = g_function_eval1(self._serial,
    489                     (<Expression>args[0])._gobj, hold)
    490         elif self._nargs == 2:

/home/ralf/sage/src/sage/symbolic/function.pyx in sage.symbolic.function.BuiltinFunction._evalf_or_eval_ (build/cythonized/sage/symbolic/function.cpp:12909)()
   1080         res = self._evalf_try_(*args)
   1081         if res is None:
-> 1082             return self._eval0_(*args)
   1083         else:
   1084             return res

/home/ralf/sage/local/lib/python2.7/site-packages/sage/functions/log.pyc in _eval_(self, z)
   1066         """
   1067         if (isinstance(z, Expression)
-> 1068             and bool(-const_pi < z.imag_part() <= const_pi)):
   1069             return exp(z)
   1070         else:

/home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.__nonzero__ (build/cythonized/sage/symbolic/expression.cpp:19904)()
   2835             # lot of basic Sage objects can't be put into maxima.
   2836             from sage.symbolic.relation import test_relation_maxima
-> 2837             return test_relation_maxima(self)
   2838 
   2839         self_is_zero = self._gobj.is_zero()

/home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in test_relation_maxima(relation)
    514     else: # operator is < or > or <= or >=, which Maxima handles fine
    515         try:
--> 516             s = m.parent()._eval_line('is (%s)'%repr(m))
    517         except TypeError:
    518             raise ValueError("unable to evaluate the predicate '%s'" % repr(relation))

/home/ralf/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in _eval_line(self, line, locals, reformat, **kwds)
    450                     line = line[ind_semi+1:]
    451                 if statement:
--> 452                     result = ((result + '\n') if result else '') + max_to_string(maxima_eval("#$%s$"%statement))
    453             else:
    454                 statement = line[:ind_dollar]

/home/ralf/sage/src/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8466)()
    800         """
    801         lispargs = EclObject(list(args))
--> 802         return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
    803 
    804     def __richcmp__(left, right, int op):

/home/ralf/sage/src/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6082)()
    373     if ecl_nvalues > 1:
    374         s = si_coerce_to_base_string(ecl_values(1))
--> 375         raise RuntimeError("ECL says: "+ecl_base_string_pointer_safe(s))
    376     else:
    377         return ecl_values(0)

RuntimeError: ECL says: Console interrupt.

The Maxima problem should be reported elsewhere. The bug in Sage is that the exp_polar code uses bool(-const_pi < z.imag_part() <= const_pi) to check the argument is in an interval but the argument can have symbols and in that case a proof is attempted unnecessarily.

The ticket should change the exp_polar code such that the proof is only attempted with nonsymbolic argument.

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 258e397

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/24441

@rwst rwst added this to the sage-8.2 milestone Dec 28, 2017
@rwst
Copy link
Author

rwst commented Dec 28, 2017

@rwst
Copy link
Author

rwst commented Dec 28, 2017

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Dec 28, 2017

Commit: 258e397

@rwst
Copy link
Author

rwst commented Dec 28, 2017

New commits:

258e39724441: Expression evaluation needs forever

@tscrim
Copy link
Collaborator

tscrim commented Dec 28, 2017

comment:3

If the patchbot is (morally) green, then positive review.

@tscrim
Copy link
Collaborator

tscrim commented Dec 28, 2017

Reviewer: Travis Scrimshaw

@rwst
Copy link
Author

rwst commented Dec 29, 2017

comment:4

Thanks and a happy new year.

@vbraun
Copy link
Member

vbraun commented Dec 31, 2017

Changed branch from u/rws/expression_evaluation_needs_forever to 258e397

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

3 participants