I have a problem with calculating the integral in Python.
So, I have defined function:
def function_f(x):
if x>=0 and x<=1:
return ((1/3)**x)
else:
return 0
I know to calculate the simple one (without square), with this code:
from scipy import integrate
integrate.quad((function_f), 0, 1)
But the problem is that I need to calculate the integral from the square of this function, so I need integral from (function_f)^2.
I hope that you have some advices how I can do that.
I'm not used to scipy.integrate, but based on your explanations you should be able to do :
integrate.quad(lambda x:function_f(x)**2, 0, 1)