§6.2 Numerical Integration

Slides:



Advertisements
Similar presentations
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
Advertisements

MTH16_Lec-19_sec_10-3_Taylor_Series.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-52_Fa08_sec_8-3b_Quadratic_Fcn_Apps.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-09_sec_7-6_Double_Integrals.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-16_sec_3-4_Optimization.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-08_sec_2-3_Higher_Order_Derivatives_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-07_sec_2-1_Differeniatation-Basics_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-63_sec_9-4b_Log_Change_Base.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-13_sec_3-3a_3Var_Lin_Sys.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-49_sec_8-2_Derive_Quadratic_Eqn.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-07_sec_2-3a_Lines_by_Intercepts.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-02_Fa13_sec_1-2_Fcn_Graphs.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH16_Lec-14_sec_10-1_Infinite_Series.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
Licensed Electrical & Mechanical Engineer
MTH15_Lec-14_sec_3-2_Concavity_Inflection_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-15_sec_3-3_Curve_Sketching.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-18_sec_4-1_Exponential_Fcns.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-22_sec_5-1_Integration.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-05_sec_1-5_Limits_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH16_Lec-12_sec_8-3_TrigFcn_Integrals.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-51_sec_8-3a_Quadratic_Fcn_Graphs.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-25_sec_5-4_Definite_Integral_Apps.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-09_sec_2-4_Derivative_Chain_Rule_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-04_sec_1-4_Functional_Models_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-10_sec_2-5_Incrementals_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-10_sec_3-1_2Var_LinSys_ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH15_Lec-12_sec_3-1_Rel_Extrema_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-46_sec_7-6b_2Var_Radical_Eqns.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-09_sec_7-6_Double_Integrals.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-11_sec_2-6_Implicit_Diff_.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-58_sec_9-2a_Composite_Fcns.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_EXCEL_Integration_Tutorial-Example.pptx 1 Bruce Mayer, PE ENGR/MTH/PHYS25: Computational Methods Bruce Mayer, PE Registered.
ENGR-25_Lec-28_Excel-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-26_sec_5-7_PolyNom_Eqns-n-Apps.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH15_Lec-24_sec_5-3_Fundamental_Theorem.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_Prob_10-25_Catenary_Solution.ppt.ppt 1 Bruce Mayer, PE ENGR/MTH/PHYS25: Computational Methods Bruce Mayer, PE Registered.
MTH55_Lec-34_sec_6-6_Rational_Equations.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH15_Lec-21_sec_4-4_EXP-n-LOG_Applications.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
ENGR-25_Lec-21_Integ_Diff.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical.
MTH55_Lec-02_sec_1-6_Exponent_Rules.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH55_Lec-51_sec_8-3a_Quadratic_Fcn_Graphs.ppt 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_MTE1_Review.pptx 1 Bruce Mayer, PE Mathematics 16: Applied Calculus-II Bruce Mayer, PE Licensed Electrical & Mechanical.
MTH16_Lec-14_sec_10-1_Infinite_Series.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical &
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1 Bruce Mayer, PE Chabot College Mathematics Bruce Mayer, PE Licensed Electrical.
§2.1 Basics of Differentiation
§5.6 Factoring Strategies
Air Force Admin College, Coimbatore
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
§2.6 Implicit Differentiation
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
§5.7 PolyNomial Eqns & Apps
§2.4 Derivative Chain Rule
§5.6 Factoring Strategies
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
Licensed Electrical & Mechanical Engineer
SKTN 2393 Numerical Methods for Nuclear Engineers
Licensed Electrical & Mechanical Engineer
Air Force Admin College, Coimbatore
Presentation transcript:

§6.2 Numerical Integration Chabot Mathematics §6.2 Numerical Integration Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

6.1 Review § Any QUESTIONS About Any QUESTIONS About HomeWork §6.1 → Integration by Parts, Use of Integral Tables Any QUESTIONS About HomeWork §6.1 → HW-01

§6.2 Learning Goals Explore the trapezoidal rule and Simpson’s rule for numerical integration Use error bounds for numerical integration Interpret data using numerical integration

Why Numerical Methods? Numerical Integration Very often, the function f(x) to differentiate, or the integrand to integrate, is TOO COMPLEX to yield exact analytical solutions. In most cases in Real World testing, the function f(x) is only available in a TABULATED form with values known only at DISCRETE POINTS

Numerical Integration Game Plan: Divide Unknown Area into Strips (or boxes), and Add Up To Improve Accuracy the TOP of the Strip can Be Slanted Lines Trapezoidal Rule Parabolas Simpson’s Rule Higher Order PolyNomials

Strip-Top Effect Trapezoidal Form Parabolic (Simpson’s) Form Higher-Order-Polynomial Tops Lead to increased, but diminishing, accuracy.

Strip-Count Effect 10 Strips 20 Strips Adaptive Integration → INCREASE the strip-Count in Regions with Large SLOPES More Strips of Constant Width Tends to work just as well http://math.fullerton.edu/mathews/a2001/Animations/Quadrature/Trapezoidal/Trapezoidalaa.html

AUC by Flat Tops

Trapezoidal Area By the Diagram at Right Side Heights: Width: Now “Stack Up” for rectangle of area 2A Then or The area of a straight-sided Trapezoid = [Average Height]x[Width]

AUC by Trapezoids

The Trapezoidal Rule To Find the APPROXIMATE Area Under the Curve given by y = f(x), and have divided the area in question into vertical strips of equal width, Δx Where:

Trapezoidal Rule Error AUC by the Trapezoidal Approximation incurs error in the amount of Where n ≡ the strip count K ≡ the maximum value of |d2y/dx2|

Trapezoidal Rule Error Example This Function does NOT have a Closed Form, Analytical Solution Calculate the Area Under the Curve for this function between x=1 & x=3 using a 10-strip Trapezoidal Calculation

Trapezoidal Rule Error Example Calculate Δx Then make Fcn T-Table using Then The T- Table Then the Approximation

Trapezoidal Rule Error Example ReCall from Error Equation Taking the Derivative Twice Plot d2y/dx2 to EyeBall Max Value Maximum at x = 3

Trapezoidal Rule Error Example Then Thus, to 5 Sig-Figs: Finally the Maximum 10-Strip, Trapezoidal Error

Simpson’s Rule The Simpson Method tops TWO Strips with successive 3-pt Curve-Fit Parabolas A Parabola can be fit EXACTLY to ANY 3 (x,y) points

Simpson’s Rule Since 3-pts defines 2-strips Simpson’s Rule requires an EVEN Strip-Count Then for an Even Counting Number, n if M = max(|d4y/dx4|) then the Error

Simpson’s Rule Example Use Simpson’s rule with n = 10 strips to approximate: SOLUTION From the Trapezoidal example Δx = 0.2 Now the SideWays T-Table

Find Precise Value by MuPAD The Integrand Function fOFx := E^x/x Plot the AREA under the Integrand Curve fArea := plot::Function2d(fOFx, x = 1..3):plot(plot::Hatch(fArea), fArea) The Precise Value AUCn = numeric::int(fOFx, x=1..3)

Simpson’s Error Find Fourth Derivative by MuPAD d4fdx4 := diff(fOFx, x $ 4) Then the 4th Derivative Plot plot(d4fdx4, x=1..3, GridVisible = TRUE) Max at x=1

Simpson’s Error Then the Error Calc The Error comparing to MuPAD Value Thus the TextBook Formula is Conservative as 𝐸 𝑛 𝑏𝑘 > 𝐸 𝑛 𝑀𝑢𝑃𝑎𝑑

NO Equation Functions Often in REAL LIFE “functions” disguise themselves as “Data Tables” When I was Research Tech at Lawrence Berkeley Lab (1978) I made Ventilation-Duct Volume-Flow measurements. A typical Data Set

NO-Equation Functions I then had to Calculate the Duct Volume Flow, Q, from the Data Table using the integration This type of Integration Occurs Frequently in the Physical, Life, and Social Sciences, as well as in the Business world

NO-Eqn Integration Example The Cylindrical Tank shown at right has a bottom area of 130 ft2 . The tank is initially EMPTY. To Fill the Tank, Water Flows into the top at varying rates as given in the Tank-Table below. Time (min) 1 3 5 6 9 11 12 13 15 18 FlowRate (ft3/min) 80 130 150 160 165 170 140 120

NO-Eqn Integration Example For this situation determine the water height ,H, at t = 18 minutes SOLUTION Use the TRAPEZOIDAL Rule to Integrate the WaterFlow to arrive at the the Total Water VOLUME Use the Max No. of strips permitted by Data

NO-Eqn Integration Example Make ΔV Calcs for the 10 strips Then by GeoMetry So Finally

NO-Eqn Integration Example Note that in this case Δx is NON-constant 10 Strips of Varying Width Thus SIMPSON’s Rule Can NOT be Used Simpson’s Rule Requires constant Δx

MatLab Code % Bruce Mayer, PE % MTH-15 • 01Aug13 • Rev 11Sep13 % MTH15_Quick_Plot_BlueGreenBkGnd_130911.m % clear; clc; clf; % clf clears figure window % The Domain Limits xmin = -6; xmax = 6; % The FUNCTION ************************************** x = [0 1 3 5 6 9 11 12 13 15 18]; y = [0 80 130 150 150 160 165 170 160 140 120]; % *************************************************** % the Plotting Range = 1.05*FcnRange ymin = min(y); ymax = max(y); % the Range Limits xmin = min(x); xmax = max(x); % the Range Limits R = ymax - ymin; ymid = (ymax + ymin)/2; ypmin = ymid - 1.025*R/2; ypmax = ymid + 1.025*R/2 % The ZERO Lines zxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ypmin*1.05 ypmax*1.05]; % the 6x6 Plot axes; set(gca,'FontSize',12); whitebg([0.8 1 1]); % Chg Plot BackGround to Blue-Green plot(x,y, '-d', 'LineWidth', 4),grid, axis([xmin xmax ypmin ypmax]),... xlabel('\fontsize{14}t (min)'), ylabel('\fontsize{14}Q = (ft^3/min)'),... title(['\fontsize{16}MTH16 • Bruce Mayer, PE',]),... annotation('textbox',[.53 .05 .0 .1], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'MTH15 Quick Plot BlueGreenBkGnd 130911.m','FontSize',7) hold on plot(zxv,zyv, 'k', zxh,zyh, 'k', 'LineWidth', 2) stem(x,y, '-r.', 'LineWidth', 2) hold off MatLab Code

WhiteBoard Work Problems From §6.2 P40 → Consumer’s Surplus

All Done for Today Tracking Trapezoids Google: “third derivative name”

Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Chabot Mathematics Appendix Wht/Blk Borad Do On Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu –

P6.2-40 MATLAB Code % Bruce Mayer, PE % MTH-16 • 11Jan14 % MTH15_Quick_Plot_BlueGreenBkGnd_130911.m % clear; clc; clf; % clf clears figure window % The FUNCTION ************************************** x = [0:4:24]; y = [49.12 42.9 31.32 19.83 13.87 10.58 7.25]; % *************************************************** % the Plotting Range = 1.05*FcnRange ymin = min(y); ymax = max(y); % the Range Limits xmin = min(x); xmax = max(x); % the Range Limits R = ymax - ymin; ymid = (ymax + ymin)/2; ypmin = ymid - 1.025*R/2; ypmax = ymid + 1.025*R/2 ypmin =0 % The ZERO Lines zxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ypmin*1.05 ypmax*1.05]; % the 6x6 Plot axes; set(gca,'FontSize',12); whitebg([1 1 1]); % Chg Plot BackGround to Blue-Green plot(x,y, '-d', 'LineWidth', 4),grid, axis([xmin xmax ypmin ypmax]),... xlabel('\fontsize{14}q (kUnits)'), ylabel('\fontsize{14}p ($/Unit)'),... title(['\fontsize{16}MTH16 • Bruce Mayer, PE',]),... annotation('textbox',[.53 .05 .0 .1], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'MTH15 Quick Plot BlueGreenBkGnd 130911.m','FontSize',7) hold on plot(zxv,zyv, 'k', zxh,zyh, 'k', 'LineWidth', 2) stem(x,y, '-r.', 'LineWidth', 2) plot([xmin, xmax], [7.25 7.25], '-.m', 'LineWidth', 3) hold off x = [0 4 8 12 16 20 24] y = [49.1200 42.9000 31.3200 19.8300 13.8700 10.5800 7.2500] ps = y-ymin M = [1 4 2 4 2 4 1] CS1 = ps.*M CS2 = (4/3)*CS1 CS3 = sum(CS2) CS4 = sum(CS1) CStot = (4/3)*CS4

Example  NONconstant ∆x Pacific Steel Casting Company (PSC) in Berkeley CA, uses huge amounts of electricity during the metal-melting process. The PSC Materials Engineer measures the power, P, of a certain melting furnace over 340 minutes as shown in the table at right. See Data Plot at Right. Ref: ENGR-25_Final_Exam_Fa12_Solution_121227.doc

Example  NONconstant ∆x The T-table at Right displays the Data Collected by the PSC Materials Enginer Recall from Physics that Energy (or Heat), Q, is the time-integral of the Power. Use Strip-Integration to find the Total Energy in MJ expended by The Furnace during this process run

Example  NONconstant ∆x GamePlan for Strip Integration Use a Forward Difference approach ∆tn = tn+1 − tn Example: ∆t6 = t7 − t6 = 134 − 118 = 16min → 16min·(60sec/min) = 960sec Over this ∆t assume the P(t) is constant at Pavg,n =(Pn+1 + Pn )/2 Example: Pavg,6 = (P7 + P6)/2 = (147+178)/2 = 162.5 kW = 162.5 kJ/sec

Example  NONconstant ∆x The GamePlan Graphically Note the Variable Width, ∆x, of the Strip Tops

MATLAB Code % Bruce Mayer, PE % MTH-15 • 25Jul13 % XY_Area_fcn_Graph_6x6_BlueGreen_BkGnd_Template_1306.m % clear; clc; clf; % clf is clear figure % The FUNCTION xmin = 0; xmax = 350; ymin = 0; ymax = 225; x = [0 24 24 45 45 74 74 90 90 118 118 134 134 169 169 180 180 218 218 229 229 265 265 287 287 340] y = [77 77 105.5 105.5 125 125 136 136 152 152 162.5 162.5 179 179 181 181 192 192 208.5 208.5 203 203 201 201 213.5 213.5] % The ZERO Lines zxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ymin ymax]; % the 6x6 Plot axes; set(gca,'FontSize',12); whitebg([0.8 1 1]); % Chg Plot BackGround to Blue-Green % Now make AREA Plot area(x,y,'FaceColor',[1 0.6 1],'LineWidth', 3),axis([xmin xmax ymin ymax]),... grid, xlabel('\fontsize{14}t (minutes)'), ylabel('\fontsize{14}P (kW)'),... title(['\fontsize{16}MTH15 • Variable-Width Strip-Integration',]),... annotation('textbox',[.15 .82 .0 .1], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'Bruce Mayer, PE • 25Jul13','FontSize',7) set(gca,'XTick',[xmin:50:xmax]); set(gca,'YTick',[ymin:25:ymax]) set(gca,'Layer','top') MATLAB Code

Example  NONconstant ∆x The NONconstant Strip-Width Integration is conveniently done in an Excel SpreadSheet The 13 ∆Q strips Add up to 3456.69 MegaJoules of Total Energy Expended MTH15_NONconst_delX_Strip-Integration_BMayer_1307.xlsx