244-4:NUMERICAL INTEGRATION
Numerical integration involves methods such as Simpson's rule, higher-order formulas, and built-in functions in MATLAB/Python for evaluating integrals. Simpson's rule divides a range into subdivisions and approximates the integral using second-degree polynomials. Higher-order formulas use higher-degree polynomials with error estimates based on function derivatives. MATLAB/Python offer convenient functions like quad for integral evaluation between specified limits.
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
Numerical Integration Integration: ( )dx x B = I f A is the total value, or summation, of f(x) dx over the range from A to B:
Simpsons Rule -Method Simpson s rule consists of dividing the range (A,B) into N subdivisions, where N is an even integer Connect 3 points using second degree polynomials (parabolas), or even higher order polynomials Sum all the areas under the parabols to obtain approximation to the total integral: ( )dx x f I A B =
Simpsons Rule -Formulation Simpson s 1/3 rule corresponds to using second- order polynomials. Using the Lagrange form for a quadratic fit of three points: ( ) x0 x1 ( ) x0 x2 ( x1 x0 ( x x2 ( ) )f x0 ( )+ x x0 ( ) ) x x2 ( x1 x2 ( ) )f x1 ( )+ x x0 ( x2 x0 ( ) ) x x1 ( x2 x1 ( ) )f x2 ( ) x x1 fnx ( )= Integration over the three points simplifies to: x2 fnx ( ) I = dx x0 I =h f x0 ( )+4 f x1 ( )+ f x2 ( ) 3
Simpsons 3/8 Rule Simpson s 3/8 rule corresponds to using third-order polynomials to fit four points. Integration over the four points simplifies to: dx I =3h 8 x3 fnx ( ) I = x0 f x0 ( )+3f x1 ( )+3f x2 ( )+ f x3 ( ) Simpson s 3/8 rule is generally used in concert with Simpson s 1/3 rule when the number of segments is odd.
Higher-Order Formulas Higher-order Newton-Cotes formulas may also be used In general, the higher the order of the polynomial used, the higher the derivative of the function in the error estimate and the higher the power of the step size.
MATLAB/Python integration functions MATLAB/Python have built-in functions to evaluate the integral of the function y between the limits (A,B) Matlab Python clear y = @(x) f(x) I = quad(y,A,B) from scipy.integrate import quad import numpy as np def y(x): return f(x) I=quad(y,A,B) print I
Integration over vectors If the curve is given in terms of a vector set (x,y), then quad can also be used to calculate the integral I as follows: F = griddedInterpolant(x,y) f=@(x) F(x) I = quad(f,xl,xu) where xl and xu are lower and upper limits of x respectively Hence, quad can be used over a given function (for regular surfaces) or over a vector (for irregular surfaces)
Multiple Integrals Multiple integrals can be determined numerically by first integrating in one dimension, then a second, and so on for all dimensions of the problem.
MATLAB/Python multiple integral functions MATLAB/Python also have built-in functions to evaluate the multiple integral of the function z(x,y) between the limits(xmin,xmax,ymin,ymax) Matlab Python clear z = @(x,y) f(x,y) I = dblquad(z,xmin,xmax,ymin,ymax) import numpy as np import scipy.integrate def z(y,x): return x**2+y**2+x*y z = f(x,y) where [x y] is a matrix meshgrid I=scipy.integrate.dblquad(z,-2,2,-5,5) print(I)