Opened 4 years ago

Closed 4 years ago

#24441 closed defect (fixed)

Expression evaluation needs forever

Reported by: rws Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 258e397 (Commits, GitHub, GitLab) Commit: 258e397bc7d9a7ab8ef93f056c03a9394bbe0bb7
Dependencies: Stopgaps:

Status badges

Description

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.

Change History (5)

comment:1 Changed 4 years ago by rws

  • Branch set to u/rws/expression_evaluation_needs_forever

comment:2 Changed 4 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 258e397bc7d9a7ab8ef93f056c03a9394bbe0bb7
  • Status changed from new to needs_review

New commits:

258e39724441: Expression evaluation needs forever

comment:3 Changed 4 years ago by tscrim

  • Reviewers set to Travis Scrimshaw

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

comment:4 Changed 4 years ago by rws

  • Status changed from needs_review to positive_review

Thanks and a happy new year.

comment:5 Changed 4 years ago by vbraun

  • Branch changed from u/rws/expression_evaluation_needs_forever to 258e397bc7d9a7ab8ef93f056c03a9394bbe0bb7
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.