Lets say i define my function G,
def G(k, P, W):
return k**2*P*W**2
Where P and W are two functions that have independent variables of k and k is a defined number.
I am trying to integrate this from 0 to infinity
I = scipy.integrate.quad(G, 0, np.Inf)
inputting this into my console gives me the error,
G() takes exactly 3 arguments (2 given)
I tried using the arg()
command, but it does not seem to change it and code remains stubborn. What am i doing wrong and what am i missing?
If I understand correctly, k is a constant. Then you can write:
k = 10
I = integrate.dblquad(lambda p,w: G(k,p,w), 0, np.Inf, lambda x: 0, lambda x: np.Inf)
Found it in the scipy documentation.
Besides, your integral looks divergent.
For symbolic integrals see sympy.integrate. It is a different library.
import * from sympy
k,P,W = symbols('k P W')
integrate(G(k,P,W),P,W)