Opened 2 years ago
Closed 19 months ago
#24440 closed defect (fixed)
Infinite loop from converting to QQbar
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | sage-8.2 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | ||
Authors: | Ralf Stephan | Reviewers: | Sébastien Labbé |
Report Upstream: | N/A | Work issues: | |
Branch: | 39bfd96 (Commits) | Commit: | 39bfd964fee8234cf3c47ad0cc47ddc2a727232a |
Dependencies: | Stopgaps: |
Description (last modified by )
sage: QQbar(tanh(pi + 0.1)) /home/ralf/sage/src/sage/structure/parent.pyx in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9406)() 915 if mor is not None: 916 if no_extra_args: --> 917 return mor._call_(x) 918 else: 919 return mor._call_with_args(x, args, kwds) /home/ralf/sage/src/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4972)() 153 print(type(C), C) 154 print(type(C._element_constructor), C._element_constructor) --> 155 raise 156 157 cpdef Element _call_with_args(self, x, args=(), kwds={}): /home/ralf/sage/src/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4840)() 148 cdef Parent C = self._codomain 149 try: --> 150 return C._element_constructor(x) 151 except Exception: 152 if print_warnings: /home/ralf/sage/local/lib/python2.7/site-packages/sage/rings/qqbar.pyc in _element_constructor_(self, x) 1138 return AlgebraicNumber(x._descr) 1139 elif hasattr(x, '_algebraic_'): -> 1140 return x._algebraic_(QQbar) 1141 return AlgebraicNumber(x) 1142 /home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._algebraic_ (build/cythonized/sage/symbolic/expression.cpp:12139)() 1477 """ 1478 from sage.symbolic.expression_conversions import algebraic -> 1479 return algebraic(self, field) 1480 1481 def __hash__(self): /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in algebraic(ex, field) 1046 0 1047 """ -> 1048 return AlgebraicConverter(field)(ex) 1049 1050 ############## /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex) 224 return self.tuple(ex) 225 else: --> 226 return self.composition(ex, operator) 227 228 def get_fake_div(self, ex): /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in composition(self, ex, operator) 987 res = -QQbar.zeta(4)*(exp_ia - ~exp_ia)/(exp_ia + ~exp_ia) 988 elif func_name in ['sinh', 'cosh', 'tanh']: --> 989 exp_a = exp(operand)._algebraic_(QQbar) 990 if func_name == 'sinh': 991 res = (exp_a - ~exp_a)/2 /home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._algebraic_ (build/cythonized/sage/symbolic/expression.cpp:12139)() 1477 """ 1478 from sage.symbolic.expression_conversions import algebraic -> 1479 return algebraic(self, field) 1480 1481 def __hash__(self): /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in algebraic(ex, field) 1046 0 1047 """ -> 1048 return AlgebraicConverter(field)(ex) 1049 1050 ############## ... last 6 frames repeated, from the frame below ... /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex) 216 div = self.get_fake_div(ex) 217 return self.arithmetic(div, div.operator()) --> 218 return self.arithmetic(ex, operator) 219 elif operator in relation_operators: 220 return self.relation(ex, operator) RuntimeError: maximum recursion depth exceeded in __instancecheck__
It seems that only pi
as constant will trigger it.
Change History (9)
comment:1 Changed 22 months ago by
- Component changed from symbolics to basic arithmetic
- Description modified (diff)
comment:2 Changed 22 months ago by
- Summary changed from Infinite loop from proving an expression to Infinite loop from converting to QQbar
comment:3 Changed 22 months ago by
- Description modified (diff)
comment:4 Changed 22 months ago by
comment:5 Changed 22 months ago by
- Branch set to u/rws/infinite_loop_from_converting_to_qqbar
comment:6 Changed 22 months ago by
- Commit set to 39bfd964fee8234cf3c47ad0cc47ddc2a727232a
- Status changed from new to needs_review
New commits:
39bfd96 | 24440: Infinite loop from converting to QQbar
|
comment:7 Changed 20 months ago by
- Reviewers set to Sébastien Labbé
- Status changed from needs_review to positive_review
comment:8 Changed 20 months ago by
Thanks.
comment:9 Changed 19 months ago by
- Branch changed from u/rws/infinite_loop_from_converting_to_qqbar to 39bfd964fee8234cf3c47ad0cc47ddc2a727232a
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Also
QQbar(sin(I*pi/7))
crashes (with or withouthold=True
) but differently. Finally,