TypeError: cannot determine truth value of Relational using sympy

115 views Asked by At

Here is the code:

import numpy as np
import sympy as sy

#Task 1 

#a
#1
x = sy.symbols('x')
a = np.diff((2*x**5+3*(sy.sin(2*x))),x) 

print(a)

and the traceback of the error

Traceback (most recent call last):

  File "C:\Users\natty\Desktop\LU\FYSB24\labs\comp\task1.py", line 17, in <module>
    a = np.diff((2*x**5+3*(sy.sin(2*x))),x)

  File "<__array_function__ internals>", line 5, in diff

  File "C:\Users\natty\anaconda3\lib\site-packages\numpy\lib\function_base.py", line 1240, in diff
    if n < 0:

  File "C:\Users\natty\anaconda3\lib\site-packages\sympy\core\relational.py", line 398, in __bool__
    raise TypeError("cannot determine truth value of Relational")

TypeError: cannot determine truth value of Relational

it is a simple test code, and I'm not sure what I've done wrong.

0

There are 0 answers