Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The animated plots examples in the documentation at - https://doc.sagemath.org/html/en/reference/plotting/sage/plot/animate. html include an example where `x = lambda t: cos(t)` and `y = ...` are used for a parametric plot. Many subsequent examples fail with a type error if run without resetting `x` to its default value, either with `reset('x')` or with `x = SR.var('x')`. {{{ sage: a = animate([plot(x^2 + n) for n in range(4)], ymin=0, ymax=4) ------------------------------------------------------------------------ --- TypeError Traceback (most recent call last) <ipython-input-...-...> in <module> ----> 1 a = animate([plot(x**Integer(2) + n) for n in ...], ymin=..., ymax=...) <ipython-input-...-...> in <listcomp>(.0) ----> 1 a = animate([plot(x**Integer(2) + n) for n in ...], ymin=..., ymax=...) .../site-packages/sage/rings/integer.pyx in sage.rings.integer.Integer.__pow__ (build/cythonized/sage/rings/integer.c:14496)() 2153 return coercion_model.bin_op(left, right, operator.pow) 2154 # left is a non-Element: do the powering with a Python int -> 2155 return left ** int(right) 2156 2157 cpdef _pow_(self, other): TypeError: unsupported operand type(s) for ** or pow(): 'function' and 'int' }}} {{{ sage: a = animate([sin(x + float(k)) for k in srange(0,2*pi,0.7)], ....: xmin=0, xmax=2*pi, ymin=-1, ymax=1, figsize=[2,1]) ------------------------------------------------------------------------ --- TypeError Traceback (most recent call last) <ipython-input-...> in <module> ----> 1 a = animate([sin(x + float(k)) for ...], 2 xmin=..., xmax=..., ymin=..., ymax=..., figsize=...) <ipython-input-...> in <listcomp>(.0) ----> 1 a = animate([sin(x + float(k)) for ...], 2 xmin=..., xmax=..., ymin=..., ymax=..., figsize=...) TypeError: unsupported operand type(s) for +: 'function' and 'float' }}} {{{ sage: a = animate([sin(x + float(k)) for k in srange(0,2*pi,0.7)], ....: xmin=0, xmax=2*pi, figsize=[2,1]) ....: ------------------------------------------------------------------------ --- TypeError Traceback (most recent call last) <ipython-input-...> in <module> ----> 1 a = animate([sin(x + float(k)) for ...], 2 xmin=..., xmax=..., figsize=...) <ipython-input-...> in <listcomp>(.0) ----> 1 a = animate([sin(x + float(k)) for ...], 2 xmin=..., xmax=..., figsize=...) TypeError: unsupported operand type(s) for +: 'function' and 'float' }}} URL: https://trac.sagemath.org/33264 Reported by: gh-umedoblock Ticket author(s): Michael Orlitzky Reviewer(s): Samuel Lelièvre
- Loading branch information