Jason
Jason

Reputation: 4546

Using sympy.intergrate TypeError produced

I'm trying to using the sympy.intergrate() function however I keep getting a TypeError when usign the following code:

import sympy as sp

a, b, z, x, c0 = sp.symbols('a,b,z,x,c0')
a = 0.1 
b = 0.5 
f = 0.147 
c0 = 8.1
z  = 1

l = (a * sp.exp(b*z) * c0*sp.exp(f*z))
sp.integrate(l (z, 1, 0))

TypeError                                 Traceback (most recent call last)
<ipython-input-20-69a518c15276> in <module>()
 10 
 11 l = (a * sp.exp(b*z) * c0*sp.exp(f*z))
---> 12 sp.integrate(l (z, 1, 0))

TypeError: 'Float' object is not callable

Does anybody know why I get this error? Thanks.

Upvotes: 0

Views: 74

Answers (1)

asmeurer
asmeurer

Reputation: 91490

You are missing a comma. It should be sp.integrate(l, (z, 1, 0)).

Anyway, your integral doesn't make sense because you assigned z to a number. z needs to be a Symbol if you want to use it as a variable of integration.

Also, did you really intend to compute the "backwards" integral from 1 to 0?

Upvotes: 1

Related Questions