computing integrals minimization of function of variablese bn is mathematically performed by requiring all the partial derivatives to be zero@ @ @ @ :@ @bn acompute the partial derivative @ =@ and generalize to the arbitrary case @ =@bn bshow that bn tsin ntdt cwrite function integrate_coeffs(fnmthat computes bn by numerical integrationusing intervals in the trapezoidal rule da remarkable property of the trapezoidal rule is that it is exact for integrals use this property to sin nt dt (when subintervals are of equal sizecreate function test_integrate_coeff to verify the implementation of integrate_coeffs eimplement the choice td as python function (tand call integrate_coeffs( to see what the optimal choice of is fmake function plot_approx(fnmfilenamewhere you plot (ttogether with the best approximation sn as computed aboveusing intervals for numerical integration save the plot to file with name filename grun plot_approx(fnmfilenamefor td for observe how the approximation improves hrun plot_approx for td and observe fundamental problemregardless of sn not (there are ways to fix this issue filenameautofit_sines py exercise derive the trapezoidal rule for double integral use ideas in sect to derive formula for computing double integral rb rd xy/dydx by the trapezoidal rule implement and test this rule filenametrapezoidal_double py exercise compute the area of triangle by monte carlo integration use the monte carlo method from sect to compute the area of triangle with vertices at / /and filenamemc_triangle py