Opened 9 years ago
Closed 9 years ago
#1566 closed defect (fixed)
[with patch] Symbolic substitution infinite recursion (was "NumberField infinite recursion")
Reported by: | phatsphere | Owned by: | mhansen |
---|---|---|---|
Priority: | critical | Milestone: | sage-2.9.1 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
I think the input is wrong, but it should not loop forever and throw an error.
K3.<a>=NumberField([x^2+1,sqrt(x^3)+1])
gives
Exception (click to the left for traceback): ... RuntimeError: maximum recursion depth exceeded in cmp
here the infinite traceback:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/server4/sage_notebook/worksheets/phatsphere/0/code/123.py", line 4, in <module> exec compile(ur'K3=NumberField([x**Integer(2)+Integer(1),sqrt(x**Integer(3))+Integer(1)],names=(\u0027a\u0027,)); (a,) = K3._first_ngens(Integer(1))' + '\n', '', 'single') File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sympy/plotting/", line 1, in <module> File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py", line 245, in NumberField return NumberFieldTower(polynomial, name) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py", line 389, in NumberFieldTower w = NumberFieldTower(v[1:], names=names[1:]) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py", line 387, in NumberFieldTower return NumberField(v[0], names=names) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py", line 251, in NumberField polynomial = polynomial.polynomial(QQ) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1344, in polynomial dict([(var(V[i]),G[i]) for i in range(len(G))]), ring=R) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 2825, in substitute_over_ring return X._recursive_sub_over_ring(kwds, ring) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 3763, in _recursive_sub_over_ring new_ops = [op._recursive_sub_over_ring(kwds, ring=ring) for op in ops] File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 4842, in _recursive_sub_over_ring return ring(ops[0](ops[1]._recursive_sub_over_ring(kwds, ring=ring))) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/polynomial/polynomial_ring.py", line 218, in __call__ return x._polynomial_(self) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1409, in _polynomial_ return self.substitute_over_ring(dict(sub), ring=R) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 2825, in substitute_over_ring return X._recursive_sub_over_ring(kwds, ring) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 4842, in _recursive_sub_over_ring return ring(ops[0](ops[1]._recursive_sub_over_ring(kwds, ring=ring))) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/polynomial/polynomial_ring.py", line 218, in __call__ return x._polynomial_(self) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1409, in _polynomial_ return self.substitute_over_ring(dict(sub), ring=R) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 2825, in substitute_over_ring return X._recursive_sub_over_ring(kwds, ring) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 4842, in _recursive_sub_over_ring return ring(ops[0](ops[1]._recursive_sub_over_ring(kwds, ring=ring))) . . . File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1409, in _polynomial_ return self.substitute_over_ring(dict(sub), ring=R) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 2825, in substitute_over_ring return X._recursive_sub_over_ring(kwds, ring) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 4842, in _recursive_sub_over_ring return ring(ops[0](ops[1]._recursive_sub_over_ring(kwds, ring=ring))) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/rings/polynomial/polynomial_ring.py", line 218, in __call__ return x._polynomial_(self) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 1387, in _polynomial_ vars = self.variables() File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 3524, in variables return self.simplify().variables(vars) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 2555, in simplify S = evaled_symbolic_expression_from_maxima_string(self._maxima_init_()) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 6466, in evaled_symbolic_expression_from_maxima_string return symbolic_expression_from_maxima_string(maxima.eval(x)) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py", line 707, in eval return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != '']) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/interfaces/maxima.py", line 540, in _eval_line self._synchronize() File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/interfaces/maxima.py", line 600, in _synchronize self._expect_expr(timeout=0.5) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/interfaces/maxima.py", line 453, in _expect_expr i = self._expect.expect(expr,timeout=timeout) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/pexpect.py", line 911, in expect compiled_pattern_list = self.compile_pattern_list(pattern) File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/pexpect.py", line 843, in compile_pattern_list compiled_pattern_list.append(re.compile(p, re.DOTALL)) File "/usr/local/sage-2.6/local/lib/python2.5/re.py", line 180, in compile return _compile(pattern, flags) File "/usr/local/sage-2.6/local/lib/python2.5/re.py", line 222, in _compile p = _cache.get(cachekey) RuntimeError: maximum recursion depth exceeded in cmp
Attachments (1)
Change History (9)
comment:1 Changed 9 years ago by
- Milestone set to sage-2.9.1
- Priority changed from major to critical
comment:2 Changed 9 years ago by
comment:3 Changed 9 years ago by
aha it has nothing to do with number fields:
sage: f = sqrt(x) sage: g = f.polynomial(QQ) [boom]
comment:4 Changed 9 years ago by
ok it's some nastiness to do with recursive substitution in symbolic expressions. The same thing happens with cos(x).polynomial(QQ)
etc. I will leave this voodoo to someone else who understands the symbolic calculus package.
comment:5 Changed 9 years ago by
- Component changed from algebraic geometry to calculus
- Summary changed from NumberField infinite recursion to Symbolic substitution infinite recursion (was "NumberField infinite recursion")
comment:6 Changed 9 years ago by
- Owner changed from was to mhansen
- Status changed from new to assigned
Changed 9 years ago by
comment:7 Changed 9 years ago by
- Summary changed from Symbolic substitution infinite recursion (was "NumberField infinite recursion") to [with patch] Symbolic substitution infinite recursion (was "NumberField infinite recursion")
comment:8 Changed 9 years ago by
- Resolution set to fixed
- Status changed from assigned to closed
merged in 2.9.1 rc0
Note: See
TracTickets for help on using
tickets.
I'm taking a look a this....
here is a simpler example that causes the same problem: