Upload
osgood
View
25
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Chabot Mathematics. §6.2 Numerical Integration. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer [email protected]. 6.1. Review §. Any QUESTIONS About §6.1 → Integration by Parts, Use of Integral Tables Any QUESTIONS About HomeWork §6.1 → HW-01. §6.2 Learning Goals. - PowerPoint PPT Presentation
Citation preview
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 1
Bruce Mayer, PE Chabot College Mathematics
Bruce Mayer, PELicensed Electrical & Mechanical Engineer
Chabot Mathematics§6.2
NumericalIntegration
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2
Bruce Mayer, PE Chabot College Mathematics
Review §
Any QUESTIONS About• §6.1 → Integration by Parts, Use of
Integral Tables Any QUESTIONS
About HomeWork• §6.1 → HW-01
6.1
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 3
Bruce Mayer, PE Chabot College Mathematics
§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
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 4
Bruce Mayer, PE Chabot College Mathematics
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
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 5
Bruce Mayer, PE Chabot College Mathematics
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
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 6
Bruce Mayer, PE Chabot College Mathematics
Strip-Top Effect
Parabolic (Simpson’s) Form
Trapezoidal Form
• Higher-Order-Polynomial Tops Lead to increased, but diminishing, accuracy.
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 7
Bruce Mayer, PE Chabot College Mathematics
Strip-Count Effect
Adaptive Integration → INCREASE the strip-Count in Regions with Large SLOPES• More Strips of Constant
Width Tends to work just as well
10 Strips 20 Strips
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 8
Bruce Mayer, PE Chabot College Mathematics
AUC by Flat Tops
xfy
*5xf
x
xxfA jj *WidthHeight
N
jj
N
jj xxfAA
1
*
1
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 9
Bruce Mayer, PE Chabot College Mathematics
Trapezoidal Area By the Diagram at Right
• Side Heights:
• Width: Now “Stack Up” for 2A Then
orx
1jxf jxf
A
A
jxf jjxf
x
1jxf jxf
xxfxfA jj 12
x
xfxfA jj
21
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 10
Bruce Mayer, PE Chabot College Mathematics
AUC by Trapezoids
xxfxf
AA jjtrap
21
xxfxfAAN
jjj
N
jj
1
01
1
0 21
xfy
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 11
Bruce Mayer, PE Chabot College Mathematics
The Trapezoidal Rule To Find the APPROXIMATE Area Under
the Curve given by y = f(x), and divided into vertical strips of equal width, Δx
• Where:
b
a
N
jjj xxfxfdxxf
1
012
1AUC
bxxa N 0
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 12
Bruce Mayer, PE Chabot College Mathematics
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|
2
3
12nabKEn
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 13
Bruce Mayer, PE Chabot College Mathematics
Trapezoidal Rule Error Example The 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
???dxxe
xexfy
xx
1 1.5 2 2.5 30
1
2
3
4
5
6
7
x
y =
ex /x
MTH16 • Bruce Mayer, PE
MTH15 Quick Plot BlueGreenBkGnd 130911.m
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 14
Bruce Mayer, PE Chabot College Mathematics
Trapezoidal Rule Error Example Calculate
Δx Then make Fcn T-Table using
ThenTheT-Table
2.0102
1013
n
abx
4.202.2.2 7j e.g; 81 xxxx jjj x f(xj) = ex/x ΔA = [½][f(xj)+f(xj+1)]•Δx1 1.0 2.718282 0.5485045932 1.2 2.766764 0.5663335513 1.4 2.896571 0.5992216674 1.6 3.095645 0.6456560525 1.8 3.360915 0.7055443316 2.0 3.694528 0.7796806917 2.2 4.102279 0.8695269028 2.4 4.592990 0.9771350949 2.6 5.178361 1.10514489210 2.8 5.873088 1.25682671111 3.0 6.695179
Σtotal = 8.053574484
Then theApproximation
0536.82
1 dx
xex
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 15
Bruce Mayer, PE Chabot College Mathematics
Trapezoidal Rule Error Example ReCall from
Error Equation Taking the Derivative Twice
Plot d2y/dx2 to EyeBall Max Value
2
2
maxdx
xfdK
322
2
2 22xe
xe
xe
dxyd
xe
xe
dxdy
xey
xxxxxx
Maximumat x = 3
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 16
Bruce Mayer, PE Chabot College Mathematics
Trapezoidal Rule Error Example Then
Thus, to 5 Sig-Figs: Finally the Maximum 10-Strip,
Trapezoidal Error
333
3
2
33
32
2
275
272
92
31
32
32
3eeeee
dxydK
x
7195.3K
%48.20248.01012
137195.312 2
3
2
3
nabKEn
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 17
Bruce Mayer, PE Chabot College Mathematics
Simpson’s Rule The Simpson Method
tops TWO Strips with successive 3-pt Curve-Fit Parabolas
A Parabola can befit EXACTLY to ANY 3 (x,y) points
a, b, cycbxaxycbxaxycbxax
yxyxyx
for Solve,,,
333
222
111
33
22
11
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 18
Bruce Mayer, PE Chabot College Mathematics
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
11321 42243
AUC
nnn
b
a
xfxfxfxfxfxfx
dxxf
4
5
180nabMEn
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 19
Bruce Mayer, PE Chabot College Mathematics
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
3
1 AUC dx
xex
j 1 2 3 4 5 6 7 8 9 10 11
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
f(xj) = ex/x 2.718282 2.766764 2.896571 3.095645 3.360915 3.694528 4.102279 4.592990 5.178361 5.873088 6.695179
f(xj) CoEff 1 4 2 4 2 4 2 4 2 4 1f(xj)·CoEff 2.718282 11.067056 5.793143 12.382581 6.721831 14.778112 8.204558 18.371961 10.356722 23.492353 6.695179
Σ[f(xj)·CoEff] = 120.5817763AUC ≈ (Δx/3)·Σ[f(xj)·CoEff] = 8.038785084
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 20
Bruce Mayer, PE Chabot College Mathematics
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)
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 21
Bruce Mayer, PE Chabot College Mathematics
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
4645.2494
4
edx
fd
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 22
Bruce Mayer, PE Chabot College Mathematics
Simpson’s Error Then the
Error Calc
The Error comparing to MuPAD Value
• Thus the TextBook Formula is Conservative
44
5
1035.410180139
eEn
038714754.8038714754.8038785084.8
ActualActualCalc
nE
6108.7488 nE
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 23
Bruce Mayer, PE Chabot College Mathematics
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
r (in) V1 (ft/S) V2 (ft/S) V3 (ft/S) V4 (ft/S) V5 (ft/S) V6 (ft/S) Vavg (ft/S)2.15 24.1 24.3 27.6 27.3 25.7 28.1 26.24.38 15.1 13.9 13.1 13.9 14.4 14.8 14.25.62 3.9 3.8 3.9 3.4 3.6 3.9 3.7
12 inch OD Round Duct FlowSpeed Traverse
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 24
Bruce Mayer, PE Chabot College Mathematics
NO-Equation Functions I then had to Calculate the Duct Volume
Flow, Q, from the Data Table using the integration
This type of Integration OccursFrequently in the Physical, Life, and Social Sciences, aswell as in the Business world
rrVQ avg
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 25
Bruce Mayer, PE Chabot College Mathematics
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) 0 1 3 5 6 9 11 12 13 15 18
FlowRate(ft3/min) 0 80 130 150 150 160 165 170 160 140 120
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 26
Bruce Mayer, PE Chabot College Mathematics
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 0 2 4 6 8 10 12 14 16 180
20
40
60
80
100
120
140
160
t (min)
Q =
(ft3 /m
in))
MTH16 • Bruce Mayer, PE
MTH15 Quick Plot BlueGreenBkGnd 130911.m
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 27
Bruce Mayer, PE Chabot College Mathematics
NO-Eqn Integration Example Make ΔV Calcs
for the 10 strips Then by GeoMetry
So Finally
t (min) Q (cfm) Qavg (cfm) ΔV= Qavg•Δt0 0 40.0 40.01 80 105.0 210.03 130 140.0 280.05 150 150.0 150.06 150 155.0 465.09 160 162.5 325.0
11 165 167.5 167.512 170 165.0 165.013 160 150.0 300.015 140 130.0 390.018 120
Σtotal = 2492.5tnkwtr
tnkwtr
AVHor
HAV
ft 17.19ft52
997ft 130ft 5.2492 23 H
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 28
Bruce Mayer, PE Chabot College Mathematics
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 0 2 4 6 8 10 12 14 16 18
0
20
40
60
80
100
120
140
160
t (min)
Q =
(ft3 /m
in))
MTH16 • Bruce Mayer, PE
MTH15 Quick Plot BlueGreenBkGnd 130911.m
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 29
Bruce Mayer, PE Chabot College Mathematics
MatLab C
ode% Bruce Mayer, PE% MTH-15 • 01Aug13 • Rev 11Sep13% MTH15_Quick_Plot_BlueGreenBkGnd_130911.m%clear; clc; clf; % clf clears figure window%% The Domain Limitsxmin = -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*FcnRangeymin = min(y); ymax = max(y); % the Range Limitsxmin = min(x); xmax = max(x); % the Range LimitsR = ymax - ymin; ymid = (ymax + ymin)/2;ypmin = ymid - 1.025*R/2; ypmax = ymid + 1.025*R/2% % The ZERO Lineszxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ypmin*1.05 ypmax*1.05];%% the 6x6 Plotaxes; set(gca,'FontSize',12);whitebg([0.8 1 1]); % Chg Plot BackGround to Blue-Greenplot(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 onplot(zxv,zyv, 'k', zxh,zyh, 'k', 'LineWidth', 2)stem(x,y, '-r.', 'LineWidth', 2)hold off
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 30
Bruce Mayer, PE Chabot College Mathematics
WhiteBoard Work Problems From §6.2
• P40 → Consumer’s Surplus
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 31
Bruce Mayer, PE Chabot College Mathematics
All Done for Today
TrackingTrapezoids
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 32
Bruce Mayer, PE Chabot College Mathematics
Bruce Mayer, PELicensed Electrical & Mechanical Engineer
Chabot Mathematics
Appendix
–
srsrsr 22
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 33
Bruce Mayer, PE Chabot College Mathematics
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 34
Bruce Mayer, PE Chabot College Mathematics
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 35
Bruce Mayer, PE Chabot College Mathematics
P6.2-40 MatLAB Codex = [0 4 8 12 16 20 24]y = [49.1200 42.9000 31.3200 19.8300 13.8700 10.5800 7.2500]ps = y-yminM = [1 4 2 4 2 4 1]CS1 = ps.*MCS2 = (4/3)*CS1CS3 = sum(CS2)CS4 = sum(CS1)CStot = (4/3)*CS4
% 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*FcnRangeymin = min(y); ymax = max(y); % the Range Limitsxmin = min(x); xmax = max(x); % the Range LimitsR = ymax - ymin; ymid = (ymax + ymin)/2;ypmin = ymid - 1.025*R/2; ypmax = ymid + 1.025*R/2ypmin =0% % The ZERO Lineszxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ypmin*1.05 ypmax*1.05];%% the 6x6 Plotaxes; set(gca,'FontSize',12);whitebg([1 1 1]); % Chg Plot BackGround to Blue-Greenplot(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 onplot(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
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 36
Bruce Mayer, PE Chabot College Mathematics
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.
0 50 100 150 200 250 300 3500
50
100
150
200
250
time, t (min)
Pow
er C
onsu
mpt
ion,
P (k
W)
Furnace Power Consumption
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 37
Bruce Mayer, PE Chabot College Mathematics
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 theTotal Energy in MJ expended byThe Furnace during this processrun
Time (min)
Power (kW)
0 47 24 107 45 104 74 146 90 126
118 178 134 147 169 211 180 151 218 233 229 184 265 222 287 180 340 247
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 38
Bruce Mayer, PE Chabot College Mathematics
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 )– Example: Pavg,6 = (P7 − P6)/2 =
(147+178)/2 = 162.5 kW = 162.5 kJ/sec
Time (min)
Power (kW)
0 47 24 107 45 104 74 146 90 126
118 178 134 147 169 211 180 151 218 233 229 184 265 222 287 180 340 247
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 39
Bruce Mayer, PE Chabot College Mathematics
Example NONconstant ∆x The
GamePlan Graphically• Note the
VariableWidth, ∆x,of the StripTops
t (minutes)
P (k
W)
MTH15 • Variable-Width Strip-Integration
0 50 100 150 200 250 300 3500
25
50
75
100
125
150
175
200
225Bruce May er, PE • 25Jul13
4x
9x
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 40
Bruce Mayer, PE Chabot College Mathematics
MATLA
B C
ode% Bruce Mayer, PE% MTH-15 • 25Jul13% XY_Area_fcn_Graph_6x6_BlueGreen_BkGnd_Template_1306.m%clear; clc; clf; % clf is clear figure%% The FUNCTIONxmin = 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 Lineszxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ymin ymax];%% the 6x6 Plotaxes; set(gca,'FontSize',12);whitebg([0.8 1 1]); % Chg Plot BackGround to Blue-Green% Now make AREA Plotarea(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')
[email protected] • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 41
Bruce Mayer, PE Chabot College Mathematics
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
n Time, t Power ∆t = 60*(tn+1-tn) Pavg=(Pn+1−Pn)/2 ∆Q= Pavg*∆t
(cnt) (min) (kW) (Sec) (kW) (kJ)1 0 471 1440 77 1108802 24 1072 1260 105.5 1329303 45 1043 1740 125 2175004 74 1464 960 136 1305605 90 1265 1680 152 2553606 118 1786 960 162.5 1560007 134 1477 2100 179 3759008 169 2118 660 181 1194609 180 1519 2280 192 437760
10 218 23310 660 208.5 13761011 229 18411 2160 203 43848012 265 22212 1320 201 26532013 287 18013 3180 213.5 67893014 340 247
3456.69Total Energy in MJ = (∑∆Q)/1000 =