Coordinate chart restriction raising a floating-point-overflow error

asked 2022-05-26 20:16:48 +0200

Bubbz gravatar image

updated 2022-08-30 11:39:37 +0200

FrédéricC gravatar image

I am using the 9.3 version and what i am trying to do is pass a multivariable function (r,th) as a restriction on my chart. I have been able to do this before in exactly the same way using a different (r,th) function but for some reason beyond my understanding i cannot seem to make it work now. I would deeply appreciate any insights. (I've also tried this in the 9.4 version with the coord_restrictions=[] line but it raises the same error).

My code is:

M = Manifold(4, 'M', latex_name=r'\mathcal{M}', structure='Lorentzian')
X.<t,r,th,ph>=M.chart(r"t r:(1.36,+inf) th:(0,pi):\theta ph:(0,2*pi):periodic\phi")
X.add_restrictions(4*(0.850000000000000*r^5 + 1.22825000000000*r^3*cos(th)^2 + 0.443705312500000*r*cos(th)^4 +   0.850000000000000*r^2)^2*sin(th)^4/(r^6 + 2.16750000000000*r^4*cos(th)^2 + 1.56601875000000*r^2*cos(th)^4 + 0.377149515625000*cos(th)^6)^2 + (r^6 + 0.377149515625000*cos(th)^6 - 2*r^5 + (1.56601875000000*r^2 - 1.04401250000000*r)*cos(th)^4 + r^3 + (2.16750000000000*r^4 - 2.89000000000000*r^3 + 0.722500000000000*r)*cos(th)^2 - 2*r^2)*((1.44500000000000*r^5 + 0.754299031250000*r*cos(th)^4 + 0.722500000000000*r^3 + (2.08802500000000*r^3 + 0.522006250000000*r)*cos(th)^2 + 1.44500000000000*r^2)*sin(th)^4 + (r^8 + (0.377149515625000*r^2 + 0.272490525039062)*cos(th)^6 + 0.722500000000000*r^6 + 3*(0.522006250000000*r^4 + 0.377149515625000*r^2)*cos(th)^4 + 3*(0.722500000000000*r^6 + 0.522006250000000*r^4)*cos(th)^2)*sin(th)^2)/(r^6 + 2.16750000000000*r^4*cos(th)^2 + 1.56601875000000*r^2*cos(th)^4 + 0.377149515625000*cos(th)^6)^2>0.1)

and it raises:

RuntimeError                              Traceback (most recent call last)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value,      is_name, name)
718             try:
--> 719                 self._name = parent._create(value, name=name)
720             except (TypeError, RuntimeError, ValueError) as x:

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _create(self, value, name)
605             else:
--> 606                 self.set(name, value)
607         except RuntimeError as error:

 /opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in set(self, var, value)
513         cmd = '%s : %s$'%(var, value.rstrip(';'))
 --> 514         self.eval(cmd)
515 

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _eval_line(self, line, locals,    reformat, **kwds)
459                 if statement:
 --> 460                     maxima_eval("#$%s$" % statement)
461         if not reformat:

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__  (build/cythonized/sage/libs/ecl.c:8600)()
851         lispargs = EclObject(list(args))
 --> 852         return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
853 

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply   (build/cythonized/sage/libs/ecl.c:5898)()
364     if error != NULL:
 --> 365         raise RuntimeError("ECL says: {}".format(
366             ecl_string_to_python(error)))

RuntimeError: ECL says: #<a FLOATING-POINT-OVERFLOW 0x6ff7f7e7dc80>

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-3-ccc90da119ec> in <module>
 ----> 1 X.add_restrictions(Integer(4)*(RealNumber('0.850000000000000')*r**Integer(5) +      RealNumber('1.22825000000000')*r**Integer(3)*cos(th)**Integer(2) + RealNumber('0.443705312500000')*r*cos(th)**Integer(4) + RealNumber('0.850000000000000')*r**Integer(2))**Integer(2)*sin(th)**Integer(4)/(r**Integer(6) + RealNumber('2.16750000000000')*r**Integer(4)*cos(th)**Integer(2) + RealNumber('1.56601875000000')*r**Integer(2)*cos(th)**Integer(4) + RealNumber('0.377149515625000')*cos(th)**Integer(6))**Integer(2) + (r**Integer(6) + RealNumber('0.377149515625000')*cos(th)**Integer(6) - Integer(2)*r**Integer(5) + (RealNumber('1.56601875000000')*r**Integer(2) - RealNumber('1.04401250000000')*r)*cos(th)**Integer(4) + r**Integer(3) + (RealNumber('2.16750000000000')*r**Integer(4) - RealNumber('2.89000000000000')*r**Integer(3) + RealNumber('0.722500000000000')*r)*cos(th)**Integer(2) - Integer(2)*r**Integer(2))*((RealNumber('1.44500000000000')*r**Integer(5) + RealNumber('0.754299031250000')*r*cos(th)**Integer(4) + RealNumber('0.722500000000000')*r**Integer(3) + (RealNumber('2.08802500000000')*r**Integer(3) + RealNumber('0.522006250000000')*r)*cos(th)**Integer(2) + RealNumber('1.44500000000000')*r**Integer(2))*sin(th)**Integer(4) + (r**Integer(8) + (RealNumber('0.377149515625000')*r**Integer(2) + RealNumber('0.272490525039062'))*cos(th)**Integer(6) + RealNumber('0.722500000000000')*r**Integer(6) + Integer(3)*(RealNumber('0.522006250000000')*r**Integer(4) + RealNumber('0.377149515625000')*r**Integer(2))*cos(th)**Integer(4) + Integer(3)*(RealNumber('0.722500000000000')*r**Integer(6) + RealNumber('0.522006250000000')*r**Integer(4))*cos(th)**Integer(2))*sin(th)**Integer(2))/(r**Integer(6) + RealNumber('2.16750000000000')*r**Integer(4)*cos(th)**Integer(2) + RealNumber('1.56601875000000')*r**Integer(2)*cos(th)**Integer(4) + RealNumber('0.377149515625000')*cos(th)**Integer(6))**Integer(2)>RealNumber('0.1'))

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/manifolds/chart.py in add_restrictions(self, restrictions)
1932                 right = operands[1]
1933                 right_var = right.variables()
-> 1934                 if left in self._xx:
1935                     # the l.h.s. of the restriction is a single
1936                     # coordinate

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in  sage.symbolic.expression.Expression.__nonzero__ (build/cythonized/sage/symbolic/expression.cpp:20864)()
3195             from sage.symbolic.relation import test_relation_maxima
3196             if self.variables():
 -> 3197                 return test_relation_maxima(self)
3198             else:
3199                 return False

 /opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/relation.py in test_relation_maxima(relation)
538                  difference.simplify_rational(),
539                  difference.simplify_rectform(),
--> 540                  difference.simplify_trig()]
541     for f in simp_list:
542         try:

 /opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in   sage.symbolic.expression.Expression.simplify_trig (build/cythonized/sage/symbolic/expression.cpp:55569)()
10389         # right otherwise!
10390         if expand:
 > 10391             return self.parent()(self._maxima_().trigexpand().trigsimp())
10392         else:
10393             return self.parent()(self._maxima_().trigsimp())

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, *args, **kwds)
678 
679     def __call__(self, *args, **kwds):
--> 680         return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
681 
682     def help(self):

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in function_call(self, function, args, kwds)
599                                        [s.name() for s in args],
600                                        ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
 --> 601         return self.new(s)
602 
603     def _function_call_string(self, function, args, kwds):

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in new(self, code)
368 
369     def new(self, code):
 --> 370         return self(code)
371 
372     ###################################################################

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, x, name)
294 
295         if isinstance(x, str):
--> 296             return cls(self, x, name=name)
297         try:
298             # Special methods do not and should not have an option to

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name)
719                 self._name = parent._create(value, name=name)
720             except (TypeError, RuntimeError, ValueError) as x:
 --> 721                 raise TypeError(x)
722 
723     def _latex_(self):

TypeError: ECL says: #<a FLOATING-POINT-OVERFLOW 0x6ff7f7e7dc80>
edit retag flag offensive close merge delete

Comments

As it turns out, even though the error is raised, the restriction does pass on the coordinate_chart which is even weirder(?)

Bubbz gravatar imageBubbz ( 2022-05-27 09:28:31 +0200 )edit