Week 5: September 28 - October 2
Loading Numerical Data from Files
Numerical data often needs to be loaded from a file for further processing and display. We learn how this can be done using NumPy.
Floating-Point Arithmetic - Hazards and Fixes
Our exploration of floating-point arithmetic continues with an examination of common problems that can arise, and the ways in which these problems can be avoided.
Week 5 Notebook
Sample Quiz 4
- List comprehensions
- NumPy array creation
- NumPy array operations
- Multi-dimensional arrays
- Array indexing and slicing
Assignment 4: Plotting Data/Floating Point Numbers
- 4.1. Plotting Data:
- Load the balloon launch data into a NumPy array.
- Plot the temperature against time in minutes.
- Make some brief observations regarding this graph.
- Say which features of NumPy are used, and how
- 4.2. Finding the Parameters of Python Floating-Point. Find:
- The "machine epsilon" (the smallest number that, when added to 1, gives a result greater than 1).
- The largest floating point number that can be represented in Python.
- The smallest floating point number that can be represented in Python.
- The number of bits reserved for the mantissa.
- The number of bits reserved for the exponent.
- The bias used for the exponent.
- Is denormalization used?
- 4.1: Use numpy.loadtxt to load the balloon data from file, then NumPy array slicing to select and combine the data needed.
- 4.2: Run experiments to find the machine epsilon, the smallest and the largest floating-point numbers. Use the results of these experiments to infer the three parameters and if denormalization is used.