I would like to numerically integrate function over a triangle similarly as
import scipy.integrate as integrate
inside = lambda x: integrate.quad(lambda x,y: 1, 0, x, args=(x))[0]
outside = integrate.quad(inside, 0, 1)[0]
print(outside)
0.5
but using scipy.integrate.fixed_quad function (which has integration order n as parameter). However, when I write
inside = lambda x: integrate.fixed_quad(lambda x,y: 1, 0, x, args=(x), n=5)
print(inside(5))
Traceback (most recent call last): File "", line 1, in File "", line 1, in File "/Users/username/anaconda/lib/python3.5/site-packages/scipy/integrate/ quadrature.py", line 82, in fixed_quad return (b-a)/2.0 * np.sum(w*func(y, *args), axis=0), None
TypeError: () argument after * must be an iterable, not int
I don't know what I'm doing wrong as I'm following the documentation on scipy.integrate.fixed_quad.