## Week 5: September 28 - October 2

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

## Quiz 4

• List comprehensions
• len
• NumPy array creation
• NumPy array operations
• Multi-dimensional arrays
• Array indexing and slicing
Sample Quiz 4

## Assignment 4: Plotting Data/Floating Point Numbers

Activity:

• 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?

Tools:

• 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.