# Approximating Integrals using Numpy [ Riemann / Trapeze / Simpson’s / Adaptive /Monte Carlo Integration ]

integral from 0 to pi x sin(x^2) dx = sin^2(π^2/2)≈0.9513And as seen above we can already see the results from analytical solutions.Approximating MethodsRiemann integrationTrapeze integrationSimpson’s integrationAdaptive integrationMonte Carlo integrationAs seen above we are going to use five different methods to estimate the integrals..Increasing this value will result in better approximation of integral,Function 1While Adaptive integral got the most accurate integral value, other methods either under/over estimated..(of course as we increase number of samples it gets more accurate.)Function 2For this function adaptive integral method have under estimated the integral value for large amount.Function 3Except for the adaptive integral method overall other methods did quite well, for small number of data points.Function 4Interestingly similar results for sine function as well.Interactive CodeTo access the code for this post please click here.Amazing ResourcesPaper from this websitevideo from this websiteFinal WordsThis was a good review as well as good programming practice..When I was playing around with the values, it became quite clear that Monte Carlo methods integration is a powerful method but it needs more time to converge properly.If any errors are found, please email me at jae.duk.seo@gmail.com, if you wish to see the list of all of my writing please view my website here.Reference(2018)..Retrieved 1 December 2018, from https://giphy.com/gifs/fourier-series-HqZuL4RWgf2msMonte Carlo Integration In Python For Noobs.. More details