Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Symbolic integration with parameter

Hello, The following is a bit annoying, even though I can imagine the origin of the bug. Is there a systematic way to avoid this?

t=var('t')
J(kk)=integrate(exp(-2*pi*I*kk*t),t,0,1)

Whereas J(1) returns the correct value (0), J(0) returns a

ValueError: power::eval(): division by zero

and in a longer version:

--------------------------------------------------------------------------- ValueError
Traceback (most recent call last) Cell In[9], line 1 ----> 1 I(Integer(0))

File /private/var/tmp/sage-10.3-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/symbolic/expression.pyx:6187, in sage.symbolic.expression.Expression.__call__ (build/cythonized/sage/symbolic/expression.cpp:78521)() 6185 z^2 + x^y 6186 """ -> 6187 return self._parent._call_element_(self, args, *kwds) 6188 6189 def variables(self):

File /private/var/tmp/sage-10.3-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/symbolic/callable.py:422, in CallableSymbolicExpressionRing_class._call_element_(self, _the_element, *args, kwds) 420 d = dict(zip([repr(_) for _ in self.arguments()], args)) 421 d.update(kwds) --> 422 return SR(_the_element.substitute(d))

File /private/var/tmp/sage-10.3-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:849, in sage.structure.element.Element.substitute (build/cythonized/sage/structure/element.c:15440)() 847 5 848 """ --> 849 return self.subs(args, *kwds) 850 851

File /private/var/tmp/sage-10.3-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/symbolic/expression.pyx:5899, in sage.symbolic.expression.Expression.subs (build/cythonized/sage/symbolic/expression.cpp:76733)() 5897
smap.insert(make_pair((<expression>self.coerce_in(k))._gobj, 5898
(<expression>self.coerce_in(v))._gobj)) -> 5899 res = self._gobj.subs_map(smap, 0) 5900 return new_Expression_from_GEx(self._parent, res) 5901

ValueError: power::eval(): division by zero