
Numerical Integration Methods for Precise Calculations
Explore the application of numerical integration techniques in mathematics using composite trapezoid rule, composite Simpson's rule, Gauss Quadrature, and Laguerre Quadrature. Discover how to calculate actual errors, derive formulas, and find upper bounds on errors, along with implementing MATLAB scripts for accurate estimations. Dive into the analysis of functions to achieve exact results for polynomials up to degree 2 with Simpson's rule. Finally, practice with composite rules to approximate integrals and evaluate the percent difference from exact values efficiently.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Quiz 2: 3/9/21 Numerical Integration Text Chapters 5 & 6 Lectures L7-L11 Assignments 5-10
Application of function codes for trapezoid rule with arbitrary spacing composite trapezoid rule composite Simpson s rule Gauss Quadrature Laguerre Quadrature Analysis upper bound on absolute error in ctraprule deriving numerical integration formulas
MatLab script to apply trapezoid rule with arbitrarily spaced points 1 5 exp(-x)dx to estimate with logarithmically spaced points integrand=@(x) exp(-x); exact=exp(-1)-exp(-5); y=linspace(0,log(5),10); newx=exp(y); A2 = arbitrary_points(newx,integrand(newx)); PD2 = 100*abs((A2-exact)/exact); disp([A2, exact, PD2)
MATLAB script to calculate the actual absolute error 5 2 sin( dx x ) in the composite trapezoid rule approximation to with 10 equally spaced points. integrand=@(x) sin(x); exact=cos(2)-cos(5); A=ctraprule(integrand,2,5,10); error=abs(A-exact); disp([A,exact,error])
Upper bound on the error in approximating 5 2 sin( dx x ) by the composite trapezoid rule with 10 points < (b-a)3|f ( )|max /12n2 n=npts-1 f(x) = sin(x), f (x) = cos(x), f (x) = -sin(x) Plot |f (x)| = |sin(x)| between 2 and 5 to find its maximum value
|f ()|max = 1 myf=@(x) abs(sin(x)); fplot(myf,[2,5]) |sin(x)| 5 2 sin( dx x ) radians (by default) < (b-a)3|f ( )|max /12n2 n=npts-1
Derive Simpsons rule with 1 pair of subintervals for range of integration [-a,a] Find weights that give exact results for polynomials up to degree 2 by requiring it to be exact for
Download composite Simpsons rule from the class web page. Write a script for the problem Approximate the integral 10 sin( x 3 100 1 )dx x by composite trapezoid and Simpson s rules with 3 and 5 points. Report the absolute percent difference from the exact value of -18.79829683678703 in each case. integrand=@(x) sin(10/x)*100/x; exact= -18.79829683678703; for npairs=1:2 ntps=2*npairs+1; T=ctraprule(integrand,1,3,npts); S=simprule(integrand,1,3,npairs); pdT=100*abs((T-exact)/exact); pdS=100*abs((S-exact)/exact); disp([npts, T, pdT, S, pdS]); end
fh(x); fh(x);
MatLab script to apply Gauss quadrature 1 5 exp(-x)dx to estimate with 2, 3, 4, and 5 points Similarly for 3 points integrand=@(x) exp(-x); exact=exp(-1)-exp(-5); A2=gauss2pts(integrand,1,5); PD2 = 100*abs((A2-exact)/exact); disp([A2, exact, PD2])
MatLab script to apply Laguerre quadrature 1 1 y = dx exp( ) dy to estimate with 2, 3, 4, and 5 points 0 0 x 2 Similarly for 3 points integrand=@(x) exp(-y/2); exact=2; [A2,A3,A4,A5]=lag2345_Garima(integrand); PD2 = 100*abs((A2-exact)/exact); disp([A2, exact, PD2])