Ask Your Question

Revision history [back]

TypeError: unsupported operand parent(s) for *: 'Integer Ring' and '<class 'nonetype'="">'

Hi, I keep getting the error above when wanting to plot a slope field x' = -x + 80 - 40*sign(t-6)

My Code Looks Like:

var('t,x')

def sign(t): if t > 0: return 1 if t == 0: return 0 if t < 0: return -1

plot_slope_field(-x+80-40*sign(t-6), (t, 0, 5), (y,0,5))

And the ERROR is:

TypeError Traceback (most recent call last)

<ipython-input-1-5af90de417a8> in <module> 9 def f(t): 10 sgn(t-Integer(6)) ---> 11 plot_slope_field(-x+Integer(80)-Integer(40)*f(t),(t,Integer(0),Integer(5)),(x,Integer(0),Integer(5)))

/home/sc_serv/sage/local/lib/python3.8/site-packages/sage/rings/integer.pyx in sage.rings.integer.Integer.__mul__ (build/cythonized/sage/rings/integer.c:14016)() 1980 return y 1981 -> 1982 return coercion_model.bin_op(left, right, operator.mul) 1983 1984 cpdef _mul_(self, right):

/home/sc_serv/sage/local/lib/python3.8/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11304)() 1246 # We should really include the underlying error. 1247 # This causes so much headache. -> 1248 raise bin_op_exception(op, x, y) 1249 1250 cpdef canonical_coercion(self, x, y):

TypeError: unsupported operand parent(s) for *: 'Integer Ring' and '<class 'nonetype'="">'

TypeError: unsupported operand parent(s) for *: 'Integer Ring' and '<class 'nonetype'="">'

Hi, I keep getting the an error above when wanting to plot a slope field x' = -x + 80 - 40*sign(t-6)

My Code Looks Like:code looks like:

var('t,x')

var('t,x')

def sign(t):
    if t > 0:
        return 1
    if t == 0:
        return 0
    if t < 0:
        return -1

-1 plot_slope_field(-x+80-40*sign(t-6), (t, 0, 5), (y,0,5))

(y,0,5))

And the ERROR is:

TypeError                                 Traceback (most recent call last)

last) <ipython-input-1-5af90de417a8> in <module> 9 def f(t): 10 sgn(t-Integer(6)) ---> 11 plot_slope_field(-x+Integer(80)-Integer(40)*f(t),(t,Integer(0),Integer(5)),(x,Integer(0),Integer(5)))

plot_slope_field(-x+Integer(80)-Integer(40)*f(t),(t,Integer(0),Integer(5)),(x,Integer(0),Integer(5))) /home/sc_serv/sage/local/lib/python3.8/site-packages/sage/rings/integer.pyx in sage.rings.integer.Integer.__mul__ (build/cythonized/sage/rings/integer.c:14016)() 1980 return y 1981 -> 1982 return coercion_model.bin_op(left, right, operator.mul) 1983 1984 cpdef _mul_(self, right):

right): /home/sc_serv/sage/local/lib/python3.8/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11304)() 1246 # We should really include the underlying error. 1247 # This causes so much headache. -> 1248 raise bin_op_exception(op, x, y) 1249 1250 cpdef canonical_coercion(self, x, y):

y): TypeError: unsupported operand parent(s) for *: 'Integer Ring' and '<class 'nonetype'="">'

'NoneType'>'