ame 150 l
DESCRIPTION
AME 150 L. Numerical Integration. Homework 10. Numerical Integration of sin(x) from 0 to p Trapezoidal Rule I I h =( h /2)( y 0 +2 y 1 +2 y 2 +. . .2 y n -2 +2 y n -1 + y n ) | error T | h 2 ( b-a ) max | y''( x ) |/12 Simpson's Rule I h /3( S ends +4 S odds +2 S evens ) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/1.jpg)
23 - 3/6/2000 AME 150L 1
AME 150 L
Numerical Integration
![Page 2: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/2.jpg)
23 - 3/6/2000 AME 150L 2
Homework 10• Numerical Integration of sin(x) from 0 to • Trapezoidal Rule
IIh=(h/2)(y0+2y1+2y2+. . .2yn-2+2yn-1+yn)
|errorT| h2(b-a) max |y''()|/12
• Simpson's Rule
I h/3(ends+4odds+2evens)
|errorT| h4 f iv(x)(b-a)/180
![Page 3: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/3.jpg)
3AME 150L23 - 3/6/2000
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.20
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
sin x( )
4 x x
2
0 x
![Page 4: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/4.jpg)
23 - 3/6/2000 AME 150L 4
0
sin( )x dx
N Trap-8 Simp-8 Trap-4 Simp-44 1.89612 2.00456 1.89612 2.004568 1.97423 2.00027 1.97423 2.0002716 1.99357 2.00002 1.99357 2.0000232 1.99839 2.00000 1.99839 2.0000064 1.99960 2.00000 1.99960 2.00000128 1.99990 2.00000 1.99990 2.00000256 1.99997 2.00000 1.99997 2.00000512 1.99999 2.00000 1.99999 2.000001024 2.00000 2.00000 2.00000 2.00000
![Page 5: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/5.jpg)
5AME 150L23 - 3/6/2000
1.E-13
1.E-12
1.E-11
1.E-10
1.E-09
1.E-08
1.E-07
1.E-06
1.E-05
1.E-04
1.E-03
1.E-02
1.E-01
1 10 100 1000
Number of Points
Tru
nca
tio
n E
rro
r
Trap-8
Simp-8
Trap-4
Simp-4
Double Precisionrequired
0
sin( )x dx
![Page 6: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/6.jpg)
23 - 3/6/2000 AME 150L 6
Truncation Coefficients
N Trap-8 Simp-8 Trap-4 Simp-4
4 0.0842 0.0060 0.0842 0.0060
8 0.0835 0.0057 0.0835 0.0057
16 0.0834 0.0056 0.0834 0.0055
32 0.0833 0.0056 0.0833 0.0064
64 0.0833 0.0056 0.0834 0.0205
128 0.0833 0.0056 0.0835 0.4928
256 0.0833 0.0056 0.0839 2.6281
512 0.0833 0.0056 0.0823 42.0495
1024 0.0833 0.0056 0.1013 1345.5828
![Page 7: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/7.jpg)
23 - 3/6/2000 AME 150L 7
Truncation Coefficients
0
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
1 10 100 1000
Number of Points
Tru
nct
atio
n C
oef
fici
ent
Trap-8
Simp-8
Trap-4
Simp-4
![Page 8: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/8.jpg)
23 - 3/6/2000 AME 150L 8
Single Precision
• Single precision (32-bit) floating-point numbers use 8 bits in the exponent and 23 bits in the fraction, which gives about 7 digit precision and allows storage of numbers whose magnitudes range from roughly 10-38 to about 1038.
![Page 9: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/9.jpg)
23 - 3/6/2000 AME 150L 9
Double Precision
• Double precision (64-bit) floating-point numbers use 11 bits in the exponent and 52 bits in the fraction, which gives about 15 digit precision and allows storage of numbers whose magnitudes range from roughly 10-308 to about 10308.
![Page 10: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/10.jpg)
23 - 3/6/2000 AME 150L 10
Fortran Double Precision
• REAL (Kind=8):: list of variable– Machine dependent (not if use IEEE floating
point)– (Kind=4) is normal
• Other Kinds– INTEGER has Kind=1, 2, and 4– Logical has Kind=1, 4
![Page 11: AME 150 L](https://reader030.vdocument.in/reader030/viewer/2022020721/56812e61550346895d940787/html5/thumbnails/11.jpg)
23 - 3/6/2000 AME 150L 11
More Double Precision
• Specifying Double Precision Constants– lot of decimal digits or"d" in exponent 1.D0 (is
double precision 1) or _"kind": 1.0_8– Functions:
• Selected_Real_Kind( p, r )• Selected_Integer_Kind( r )
• Kind(x) - returns kind for x• Precision(x) - returns precision for x• Range(x) - returns decimal exponent range for x