Click here to load reader

# Simpson rule Composite Simpson rule

Feb 22, 2016

## Documents

niyati

Simpson rule Composite Simpson rule. Simpson rule for numerical integration. y=sin(x) for x within [1.2 2]. a=1.2;b=2; x= linspace (a,b);plot(x,sin(x));hold on. Quadratic polynomial. Approximate sin using a quadratic polynomial . c=0.5*(a+b); x=[a b c]; y=sin(x); p=polyfit(x,y,2); - PowerPoint PPT Presentation

2008, Applied Mathematics NDHU1Simpson ruleComposite Simpson rule

Simpson rule for numerical integration

2008, Applied Mathematics NDHU22008, Applied Mathematics NDHU3a=1.2;b=2;x=linspace(a,b);plot(x,sin(x));hold on

y=sin(x) for x within [1.2 2]2008, Applied Mathematics NDHU4Quadratic polynomialc=0.5*(a+b);x=[a b c]; y=sin(x);p=polyfit(x,y,2);z=linspace(a,b);plot(z,polyval(p,z) ,'r')

Approximate sin using a quadratic polynomial 2008, Applied Mathematics NDHU5a=1;b=3;x=linspace(a,b);plot(x,sin(x))hold on;c=0.5*(a+b);x=[a b c]; y=sin(x);p=polyfit(x,y,2);z=linspace(a,b);plot(z,polyval(p,z) ,'r')

Approximate sin(x) within [1 3] by a quadratic polynomial 2008, Applied Mathematics NDHU6a=1;b=3;x=linspace(a,b);plot(x,sin(x))hold on;c=0.5*(a+b);x=[a b ]; y=sin(x);p=polyfit(x,y,1);z=linspace(a,b);plot(z,polyval(p,z) ,'r')

Approximate sin(x) within [1 3] by a line

2008, Applied Mathematics NDHU7

Strategy I : Apply Trapezoid rule to calculate area under a lineStrategy II : Apply Simpson rule to calculate area under a second order polynomial

Strategy II is more accurate and general than strategy I, since a line is a special case of quadratic polynomialSimpson ruleOriginal task: integration of f(x) within [a,b]c=(a+b)/2Numerical taskApproximate f(x) within [a,b] by a quadratic polynomial, p(x)Integration of p(x) within [a,b]2008, Applied Mathematics NDHU82008, Applied Mathematics NDHU9

Blue: f(x)=sin(x) within [1,3] Red: a quadratic polynomial that pass (1,sin(1)), (2,sin(2)),(3,sin(3))2008, Applied Mathematics NDHU10

The area under a quadratic polynomial is a sum of area I, II and III2008, Applied Mathematics NDHU11 The area under a quadratic polynomial is a sum of area I, II and III

Partition [a,b] to three equal-size intervals, and use the high of the middle point c to produce three Trapezoids

Use the composite Trapezoid rule to determine area I, II and III h/2*(f(a)+f(c) +f(c)+f(c)+ f(c)+f(b)) substitute h=(b-a)/3 and c=(a+b)/2 area I + II + III = (b-a)/6 *(f(a)+4*f((a+b)/2) +f(b))

2008, Applied Mathematics NDHU12

2008, Applied Mathematics NDHU13

2008, Applied Mathematics NDHU14

2008, Applied Mathematics NDHU15

152008, Applied Mathematics NDHU16

Shift Lagrange polynomialRescale Lagrange polynomial2008, Applied Mathematics NDHU17Shortcut to Simpson 1/3 rule

Partition [a,b] to three equal intervalsDraw three trapezoids, Q(I), Q(II) and Q(III)Calculate the sum of areas of the three trapezoidsProof2008, Applied Mathematics NDHU18

Composite Simpson rulePartition [a,b] into n intervalIntegrate each interval by Simpson ruleh=(b-a)/2n

2008, Applied Mathematics NDHU19Apply Simpson sule to each interval2008, Applied Mathematics NDHU20

2008, Applied Mathematics NDHU21Composite Simpson rule

2008, Applied Mathematics NDHU22

Set nSet fxh=(b-a)/(2*n)ans=0;for i=0:n-1 aa=a+2*i*h;cc=aa+h;bb=cc+h;ans=ans+h/3*(fx(aa)+4*fx(cc)+fx(bb))exit2008, Applied Mathematics NDHU23Composite Simpson rule

h=(b-a)/2n2008, Applied Mathematics NDHU24Composite Simpson rule

h=(b-a)/2nSimpson's Rule for Numerical Integration

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Related Documents
##### Chain Rule – Differentiating Composite Functions.
Category: Documents
##### SIMPSON STRONG-TIE Online Ordering .Online Ordering SIMPSON....
Category: Documents
##### 1 §4.2 The Chain Rule (Pages 251~261) Composite Functions:....
Category: Documents
##### First Rule of Composite Materials
Category: Documents
##### Los simpson
Category: Education
##### Bart Simpson
Category: Documents