r/pythonhelp • u/elhombrepan • Nov 03 '20
When I integrate a function using Sympy it returns a Zero
I wrote this code to find the reaction fraction process in a tubular chemical reactor.
from sympy.interactive import printing
from sympy import Limit, limit, Symbol, S
from sympy import Integral, integrate
printing.init_printing(use_latex='mathjax')
f = Symbol('f')
def frac(fx,V,Q):
gfx=[]
for i in range(0,100):
ff=i/100
n=[Integral(fx, (f,0.0,ff)).doit(),ff]
gfx.append(n)
c=0
for i in gfx:
if i[0]<=(V/Q):
c=c+0.01
return(c-.01)
V=90
Q=17
K=0.0554
cde=4.897
fx=(-cde/(-K*(cde*(1-f))**2))
fr=frac(fx,V,Q)
How you can see, the list who saves the integrated values all are zeros, I was trying using SymboLab and Wolfram Alpha and all of them give others values different from zero.
Why Sympy give me a wrong integration with this function and these values?
3
Upvotes