Forums

Why Trig and exp() functions are not working in my Python?

In [1]: a,b=symbols("a,b")

In [2]: sin(a+b)

TypeErrorTraceback (most recent call last)
<ipython-input-134-61fcf5bf485f> in <module>()
----> 1 sin(a+b)

/Users/Library/Enthought/Canopy/edm/envs/User/lib/python2.7/site- 
packages/sympy/core/expr.py in __float__(self)
224         if result.is_number and result.as_real_imag()[1]:
225             raise TypeError("can't convert complex to float")
--> 226         raise TypeError("can't convert expression to float")
227 
228     def __complex__(self):
TypeError: can't convert expression to float

Do you know what's causing this error?

  1. That doesn't sound like you are running this code on PythonAnywhere
  2. what is symbols?