MAT 2310. Computational Mathematics

MAT 2310. Computational Mathematics

MAT 2310. Computational Mathematics Wm C Bauldry Fall, 2012 Introduction to Computational Mathematics \1 + 1 = 3 for large enough values of 1." Introduction to Computational Mathematics Table of Contents I. Computer Arithmetic.......................................1 II. Control Structures.........................................27 S I. Special Topics: Computation Cost and Horner's Form....... 59 III. Numerical Differentiation.................................. 64 IV. Root Finding Algorithms................................... 77 S II. Special Topics: Modified Newton's Method................ 100 V. Numerical Integration.................................... 103 VI. Polynomial Interpolation.................................. 125 S III. Case Study: TI Calculator Numerics.......................146 VII. Projects................................................. 158 ICM i I. Computer Arithmetic Sections 1. Scientific Notation.............................................1 2. Converting to Different Bases...................................2 3. Floating Point Numbers........................................7 4. IEEE-754 Floating Point Standard..............................9 5. Maple's Floating Point Representation......................... 16 6. Error......................................................... 18 Exercises..................................................... 25 ICM ii II. Control Structures Sections 1. Control Structures............................................ 27 2. A Common Example.......................................... 33 3. Control Structures Syntax..................................... 35 1. Excel........................................................... 35 2. Maple [Sage/Xcas]............................................. 38 3. MATLAB [FreeMat/Octave/Scilab]............................. 41 4. C and Java..................................................... 44 5. TI-84...........................................................48 6.R.............................................................. 51 4. From Code to Flow Charts.................................... 54 Exercises..................................................... 55 Reference Sheet Links......................................... 58 ICM iii S I. Special Topics: Computation Cost and Horner's Form Sections 1. Introduction.................................................. 59 2. Horner's Form................................................ 60 Exercises..................................................... 63 ICM iv III. Numerical Differentiation Sections 1. Introduction.................................................. 64 2. Taylor's Theorem............................................. 65 3. Difference Methods........................................... 68 1. Forward Differences............................................. 68 2. Backward Differences............................................69 3. Centered Differences............................................ 70 Appendix I: Taylor's Theorem..................................73 Appendix II: Centered Difference Coefficients Chart............. 74 Exercises..................................................... 75 ICM v IV. Root Finding Algorithms Sections 1. The Bisection Method.........................................77 2. Newton-Raphson Method..................................... 81 3. Secant Method............................................... 85 4. Regula Falsi.................................................. 89 Appendix III: Rate of Convergence............................. 96 Exercises..................................................... 97 Links and Others..............................................99 ICM vi S II. Special Topics: Modified Newton's Method Sections 1. Introduction................................................. 100 2. Modified Newton's Method...................................101 Exercises.................................................... 102 ICM vii V. Numerical Integration Sections 1. Numerical Integration........................................ 103 2. Left Endpoint, Right Endpoint, and Midpoint Sums............104 3. Trapezoid Sums............................................. 105 4. Simpson's Rule.............................................. 107 5. Gaussian Quadrature......................................... 111 6. Gauss-Kronrod Quadrature................................... 116 7. A Menagerie of Test Integrals................................ 120 Appendix IV: Legendre & Stieltjes Polynomials for GK7;15 ...... 122 Exercises.................................................... 123 Links and Others............................................ 124 ICM viii VI. Polynomial Interpolation Sections 1. Polynomial Interpolation..................................... 125 2. Lagrange Interpolation....................................... 127 3. Interlude: Bernstein Polynomials.............................. 133 4. Newton Interpolation........................................ 136 5. Two Comparisons............................................ 140 6. Interlude: Splines............................................ 142 Exercises.................................................... 143 Links and Others............................................ 145 ICM ix S III. Case Study: TI Calculator Numerics Sections 1. Introduction................................................. 146 2. Floating Point Structure..................................... 148 3. Numeric Derivatives..........................................150 4. Numerically Finding Roots.................................... 151 5. Numeric Quadrature......................................... 152 6. Transcendental Functions.................................... 153 Appendix V:TI's Solving Algorithm........................... 154 Exercises.................................................... 155 ICM x VII. Projects The Project List One Function For All........................................ 158 • I. Control Structures • A Bit Adder in Excel......................................... 159 • The Collatz Conjecture....................................... 160 • The CORDIC Algorithm...................................... 162 • The Cost of Computing a Determinant........................ 166 II. Numerical Differentiation • Space Shuttle Acceleration . III. Root Finding • Commissioner Loeb's Demise................................. 167 • Roots of Wilkinson's \Perfidious Polynomial".................. 170 • Bernoulli's Method and Deflation............................. 173 ICM xi Projects, II The Project List IV. Numerical Integration • Fourier Power Spectrum . V. Polynomial Interpolation • Cubic B´ezier Splines in 3D....................................... ICM xii Introduction to Computational Mathematics On two occasions I have been asked, \Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." | Charles Babbage Passages from the Life of a Philosopher, p. 67. ICM xiii I. Computer Arithmetic: Scientific Notation Definitions of Scientific Notation Normalized: Any numeric value can be written as p d0:d1d2d3 :::dn 10 × where 1 d0 9. ≤ ≤ Engineering: Any numeric value can be written as q n:d1d2d3 :::dm 10 × where 1 n 999 and q is a multiple of 3. ≤ ≤ Examples (NIST's`Values of Constants') • Speed of light in a vacuum: 2:99792458 108 m/s × • Newtonian constant of gravitation: 6:67384 10 11 m3=(kg s2) × − · • Avogadro's number: 6:022141 10 23 mol 1 × − − • Mass of a proton: 1:672621777 10 27 kg × − • Astronomical unit: 92:95580727 106 mi × ICM 1 { 175 Conversions Basic Base Transmogrification: Integers Binary Decimal Decimal Binary ! ! (Linear algebra version) (Algebra version) Think of the binary number as a Successively compute the bits vector of 1's and 0's. Use a dot (from right to left) product to convert to decimal. 1. bit = x mod 2 1. x2 = 101110 then set x = x=2 b c 2. Repeat until x = 0 2. x10 = 1 0 1 1 1 0 E.g., x10 = 46 h i 25 24 23 22 21 20 b0 = 0; then set x = 23 · h i b1 = 1; x = 11 5 3 2 1 b = 1; x = 5 3. x10 = 2 + 2 + 2 + 2 2 = 46 b3 = 1; x = 2 b4 = 0; x = 1 b5 = 1; x = 0 Whence x2 = 101110 ICM 2 { 175 Conversions Basic Base Transmogrification: Fractions Binary Decimal Decimal Binary ! ! (Linear algebra version) (Algebra version) Think of the binary number as a Successively compute the bits vector of 1's and 0's. Use a dot (from left to right) product to convert to decimal. 1. bit = 2x b c 1. x2 = 0:10111 then set x = frac(2x) 2. Repeat until x = 0 (or when 2. x10 = 1 0 1 1 1 reaching maximum length) h 1 2 3 4 5 i 2− 2− 2− 2− 2− E.g., x10 = 0:71875 · h i b 1 = 1; then set x = 0:43750 − 3. x = 2 1 + 2 3 + 2 4 + 2 5 b 2 = 0; x = 0:87500 10 − − − − − b 3 = 1; x = 0:75000 = 0:71875 − b 4 = 1; x = 0:50000 − b 5 = 1; x = 0:0 Stop − Whence x2 = 0:10111 ICM 3 { 175 Conversions Terminating Expansions? When does a fraction's expansion terminate? n n Base 10: A decimal fraction terminates when r = = . 10p 2p 5p · m Base 2: A binary fraction terminates when r = . 2p Examples 1 1. 10 = 0:110 = 0:000112 1 2. 3 = 0:310 = 0:012 : : 3. p2 = 1:414213562373095048810 = 1:01101010000010011112 : : 4. p = 3:141592653589793238510 = 11:0010010000111111012 ICM 4 { 175 Conversions Examples (Convert A Repeating Binary Expansion) Convert n = 0:0101101101 = 0:01012 to decimal. ··· 1. Convert the repeating block to decimal 1012 = 510 2. Rewrite n in \powers-of-two" notation 4 7 10 13 n = 5 2− + 5 2− + 5 2− + 5 2− + · · · · ··· 3. Express n as a geometric series ¥ 4 3k n = 5 2− ∑ 2− ·

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    191 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us