TypeError: unable to make sense of Maxima expression
'"__SAGE_SYNCHRO_MARKER_202188656"' in Sage
If I use "pdb" to go up to frame at the top of the traceback, and
rerun the offending line, it works, as you can see below.
Sometimes it dies with other message complaining about the syntax of
seeming correct expressions, e.g.
TypeError: Error executing code in Maxima
CODE:
_tmp_ : -(a0-1)*a1^2*a3$
Maxima ERROR:
_tmp_ : -(a0-1)*a1^2*a3$
stdin:57338284:Incorrect syntax: Illegal use of delimiter )
(%i832002)
stdin:57338357:Incorrect syntax: Premature termination of input at ;.
(%i832003)
Any ideas of what's going on here?
Thanks,
Nathan
----------------------------------------------------------------------
| Sage Version 4.3.2, Release Date: 2010-02-06 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: attach stavros/__init__.py
sage: %pdb
Automatic pdb calling has been turned ON
sage: test()
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/dunfield/work/stavros3/<ipython console> in <module>()
/Users/dunfield/work/stavros3/stavros/__init__.py in test()
226 N = OneCuspedManifold(M)
227 for S in N.NormalSurfaces:
--> 228 info = N.vertex_surface_info(S)
229 if info [:-3] == (True, False, False):
230 print M, N.NormalSurfaces.index(S), info
/Users/dunfield/work/stavros3/stavros/__init__.py in
vertex_surface_info(self, surface)
132 n = len(surface.Coefficients)
133 is_kabaya = min(surface.Coefficients) > 0
--> 134 is_ideal = self.comes_from_an_ideal_point(surface)
135 is_isolated = self.vertex_surface_is_isolated(surface)
136 return surface.BoundarySlope, is_isolated, is_kabaya,
is_ideal
/Users/dunfield/work/stavros3/stavros/__init__.py in
comes_from_an_ideal_point(self, surface)
121 R = PolynomialRing(QQ, ['a%d' % i for i in range(0,n)]
+ ['b%d' % i for i in range(0,n)])
122 eqns = self.first_order_equations(surface)
--> 123 poly_eqns = [ R(e.numerator() - e.denominator()) for e
in eqns]
124 gens = R.gens_dict()
125 blow_up_eqns = [ gens["a%d" % i] * gens["b%d" % i] - 1
for i in range(0, n)]
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/symbolic/
expression.so in sage.symbolic.expression.Expression.denominator (sage/
symbolic/expression.cpp:20432)()
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/structure/
parent.so in sage.structure.parent.Parent.__call__ (sage/structure/
parent.c:6206)()
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/structure/
coerce_maps.so in sage.structure.coerce_maps.NamedConvertMap._call_
(sage/structure/coerce_maps.c:4098)()
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/interfaces/
maxima.pyc in _symbolic_(self, R)
1792 sqrt(2)
1793 """
-> 1794 return R(self._sage_())
1795
1796 def __complex__(self):
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/interfaces/
maxima.pyc in _sage_(self)
1773 from sage.calculus.calculus import
symbolic_expression_from_maxima_string
1774 #return
symbolic_expression_from_maxima_string(self.name(),
maxima=self.parent())
-> 1775 return
symbolic_expression_from_maxima_string(repr(self))
1776
1777 def _symbolic_(self, R):
/pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/calculus/
calculus.pyc in symbolic_expression_from_maxima_string(x, equals_sub,
maxima)
1964 return symbolic_expression_from_string(s, syms,
accept_sequence=True)
1965 except SyntaxError:
-> 1966 raise TypeError, "unable to make sense of Maxima
expression '%s' in Sage"%s
1967 finally:
1968 is_simplified = False
TypeError: unable to make sense of Maxima expression
'"__SAGE_SYNCHRO_MARKER_202188656"' in Sage
> /pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/calculus/calculus.py(1968)symbolic_expression_from_maxima_string()
1967 finally:
-> 1968 is_simplified = False
1969
ipdb> up
> /pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/interfaces/maxima.py(1775)_sage_()
1774 #return
symbolic_expression_from_maxima_string(self.name(),
maxima=self.parent())
-> 1775 return
symbolic_expression_from_maxima_string(repr(self))
1776
ipdb> up
> /pkgs/sage-4.3.2/local/lib/python2.6/site-packages/sage/interfaces/maxima.py(1794)_symbolic_()
1793 """
-> 1794 return R(self._sage_())
1795
ipdb> up
> /Users/dunfield/work/stavros3/stavros/__init__.py(123)comes_from_an_ideal_point()
122 eqns = self.first_order_equations(surface)
--> 123 poly_eqns = [ R(e.numerator() - e.denominator()) for e
in eqns]
124 gens = R.gens_dict()
ipdb> eqns
[-(a2 - 1)*(a1 - 1)*(a0 - 1)^2*a3/(a0^2*a1*a2*a5), a0*a4/(a1 - 1)^2, -
(a2 - 1)*a1^2*a3*a4/((a4 - 1)^2*(a0 - 1)^2*a5), a0*a5^2/((a2 -
1)^2*a3^2), (a4 - 1)^2*(a1 - 1)/(a1*a4^2), a2]
ipdb> [ R(e.numerator() - e.denominator()) for e in eqns]
[-a0^2*a1*a2*a3 - a0^2*a1*a2*a5 + a0^2*a1*a3 + a0^2*a2*a3 +
2*a0*a1*a2*a3 - a0^2*a3 - 2*a0*a1*a3 - 2*a0*a2*a3 - a1*a2*a3 + 2*a0*a3
+ a1*a3 + a2*a3 - a3, -a1^2 + a0*a4 + 2*a1 - 1, -a1^2*a2*a3*a4 -
a0^2*a4^2*a5 + a1^2*a3*a4 + 2*a0^2*a4*a5 + 2*a0*a4^2*a5 - a0^2*a5 -
4*a0*a4*a5 - a4^2*a5 + 2*a0*a5 + 2*a4*a5 - a5, -a2^2*a3^2 + 2*a2*a3^2
+ a0*a5^2 - a3^2, -2*a1*a4 - a4^2 + a1 + 2*a4 - 1, a2 - 1]
ipdb>
You should post exact code so that we can replicate your problem.
William
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
> To unsubscribe, reply using "remove me" as the subject.
>
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
I've boiled down the problem into the example below. Just attach and
then run "prob()".
One thing to note is that's just doing the exact same thing again and
again, but eventually it up and crashes. On my system, which is
detailed below, it dies after about 10-20 minutes at the 4000ish
iteration.
System details: MacPro3,1 with 2 Quad-Core Xeon Processors @ 2.8 Ghz,
running 10.5.8.
Sage 4.3.2 self-compiled with i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1
(Apple Inc. build 5493)
Thanks,
Nathan
------begin code-----
datum = ([0, 1, 0, 2, 0, 2], [([-1, -2, -1, 1, -1, 0], [1, 2, 1, 0, 1,
0], -1), ([2, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0], 1), ([-1, 2, 0, -1,
0, 0], [-1, 0, -1, 1, 0, 0], 1), ([0, 0, 1, 1, 0, -1], [0, -1, 1, -2,
-2, 2], -1), ([0, 0, 0, -1, 2, 1], [0, 0, -1, 1, 0, 0], -1), ([0, 0,
0, 0, -1, 0], [0, 0, 0, 0, 1, -2], -1)])
class Surface():
def __init__(self, datum):
self.Coefficients, self.RawEquations = datum
def eval_eqn( (a,b,c), z):
ans = c
for i, z in enumerate(z):
ans *= z**a[i] * (1 - z) ** b[i]
return ans
class OneCuspedManifold():
def raw_natural_gluing_equations(self, surface):
return surface.RawEquations
def natural_gluing_equations(self, surface):
n = len(surface.Coefficients)
z = var(" ".join(["z%d" % i for i in range(n)]))
return [eval_eqn(eqn, z) for eqn in
self.raw_natural_gluing_equations(surface)]
def first_order_equations(self, surface):
V = [int(e) for e in list(surface.Coefficients)]
n = len(V)
a_vars = var(" ".join(["a%d" % i for i in range(n)]))
t = var('t')
base_eqns = self.raw_natural_gluing_equations(surface)
z = [ a * t ** e for a, e in zip(a_vars, V) ]
eqns = [eval_eqn(eqn, z).subs(t=0) for eqn in base_eqns]
return eqns
def comes_from_an_ideal_point(self, surface):
n = len(surface.Coefficients)
R = PolynomialRing(QQ, ['a%d' % i for i in range(0,n)] + ['b
%d' % i for i in range(0,n)])
eqns = self.first_order_equations(surface)
poly_eqns = [ R(e.numerator() - e.denominator()) for e in
eqns]
def prob():
count = 0
while 1:
M = OneCuspedManifold()
S = Surface(datum)
M.comes_from_an_ideal_point(S)
count += 1
Best,
Nathan
------- problem code begins -----
datum = ([0, 1, 0, 2, 0, 2], [([-1, -2, -1, 1, -1, 0], [1, 2, 1, 0, 1,
0], -1)])
coefficients, raw_natural_gluing_equations = datum
def eval_eqn( (a,b,c), z):
ans = c
for i, z in enumerate(z):
ans *= z**a[i] * (1 - z) ** b[i]
return ans
def first_order_equations():
n = len(coefficients)
a_vars = var(" ".join(["a%d" % i for i in range(n)]))
t = var('t')
base_eqns = raw_natural_gluing_equations
z = [ a * t ** e for a, e in zip(a_vars, coefficients) ]
eqns = [eval_eqn(eqn, z).subs(t=0) for eqn in base_eqns]
R = PolynomialRing(QQ, ['a%d' % i for i in range(n)])
poly_eqns = [ R(e.numerator()) for e in eqns]
def prob():
for i in xrange(1000000):
first_order_equations()
To follow up on myself one last time, here's what appears to be the
minimal example exhibiting this problem
def prob():
for i in xrange(1000000):
a = var('a')
eqn = (a - 1)/(a)
eqn.numerator()
Note: If you run it once and it crashes, and then you run it again (w/
o quiting Sage) it crashes much faster.
Best,
Nathan
I can confirm that the above function eventually desynchronizes Maxima;
I'm using Sage 4.3.5 with Ubuntu 9.10 on a quad-core Core 2 processor.
This reminds me of a previous Maxima problem that Gonzalo Tornaria
solved -- there, the synchronization with Maxima was getting lost on
certain multi-core CPUs because of something related to switching
between cores. See #5662.
Dan
--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------
One more date point: I reproduced the problem on my Mac Book, which
has a dual-core Core 2. Despite the fact that it's a lot slower than
my Mac Pro, it crashes in about half the time...
Nathan