Skip to content

MANE 3351

Lecture 4

Classroom Management

Agenda

  • Numerical Representations in a computer

Resources

Handouts


Assignments

  • Create GitHub account, see supplemental materials
  • Complete Lab 1 before 9/11/2024 at 2:00 pm

Lecture 4 Content

Embrace Your Inner Skeptic

Definition: Numerical Methods

Numerical Methods, definition1


Embrace your Inner Skeptic

embrace your inner skeptic2


Evaluating Numerical Methods

Numerical methods should consider these two evaluation criterion :

  • Accuracy (or error) analysis
  • Speed

Introduction to Error Analysis

Error Measurements

Let \(v_A\) be the approximate value and \(v_E\) be the exact value

  • Absolute error: \(|v_A-v_E|\)
  • Relative error: \(\frac{|v_A-v_E|}{v_E}\)
  • Percentage error: \(\frac{|v_A-v_E|}{v_E}\times 100\%\)

Sources of Error

Sources of Errors

  • Round-off errors are due to the fact that the computers represent numbers in a finite number of bits and bytes
  • Truncation errors are errors that emerge from the approximation of the mathematical model
  • Model errors are due to the fact that the mathematical model usually is an approximation of the physical reality

Number Types in Python

Python supports int, float, and complex.

  • Integers can be represented exactly
  • Float and complex variables can be represented approximately
  • "Floating-point numbers are usually implemented using double in C"7

Computer Implementation of Floats

IEEE Standard 754 Floating Point Numbers

IEEE Standard 754 floating point numbers3


Floating Point Representation

floating point convertor4


Perils of Floating Point

binary floating point5


Single Precision Range

range of single-precision numbers6


Single Floating-Point Precision

precision of single-precision numbers6


Double Precision Range


Double Floating-Point Precision



  1. "numerical methods." A Dictionary of Computing. Retrieved August 27, 2019 from Encyclopedia.com: https://www.encyclopedia.com/computing/dictionaries-thesauruses-pictures-and-press-releases/numerical-methods 

  2. Cheney and Kincaid (2004), Numerical Mathematics and Computing, 5th edition

  3. Geeks for Geeks. Retrieved August 28, 2019 from: https://www.geeksforgeeks.org/ieee-standard-754-floating-point-numbers/ 

  4. FloatConvertor. Retrieved August 28, 2019 from: https://www.h-schmidt.net/FloatConverter/IEEE754.html 

  5. Perils of Floating Point. Retrieved August 28, 2019 from: http://www.lahey.com/float.htm 

  6. IEEE 754 Floating Point Representation. Retrieved August 28, 2019 from: http://cs.boisestate.edu/~alark/cs354/lectures/ieee754.pdf 

  7. Python 3.12.5 Documentation » The Python Standard Library » Built-in Types. Retrieved September 6, 2024 from: https://docs.python.org/3/library/stdtypes.html