Is it possible to integrate custom function using sympy?
I want something like this:
def func(x, y):
return something_with(x, y)
res = integrate(func, (y, x-2, 3), (x, 1, 2))
Is it possible?
Is it possible to integrate custom function using sympy?
I want something like this:
def func(x, y):
return something_with(x, y)
res = integrate(func, (y, x-2, 3), (x, 1, 2))
Is it possible?
You can integrate some functions with sympy's integrate. Suppose you had the function (one variable to make it simpler)
Then you could integrate it with
Although only limited mathematical functions are likely to work.
If you only care about the numerical answer, you could try scipy's
integrate.quad()
(orscipy.integrate.dblquad()
) which will do numerical integration, and can tackle a broader set of functions within a small error.