1. Replicate the contents below by creating a new (MarkDown) cell below this one (using keyboard shortcuts).

Euler's formula

The function $e^{i \phi}$ traces the unit circle in the complex plane.

$$ e^{i\phi} = \cos \phi + i \sin \phi $$

This implies that

\begin{align} \cos x &= \Re(e^{i x}) &= \frac{e^{ix} + e^{-ix}}{2} \\ \sin x &= \Im(e^{i x}) &= \frac{e^{ix} - e^{-ix}}{2} \end{align}

In Python, we can express the second function as

def sin(x):
    """The sine function ."""
    import numpy as np
    return 0.5*(np.exp(x*1j) - np.exp(-x*1j))

1.5. Delete this cell using a keyboard shortcut.

2. Write a program to create a list of the first 100 Fizz buzz numbers. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. Otherwise the original number is retained.

For example, the first Fizz buzz numbers are 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ....

3. A Pythagorean triplet is a set of 3 integers $a, b, c$ such that $a^2 + b^2 = c^2$. For example, the tuple (3,4,5) is a Pythagorean triplet. Find all Pythagorean triplets where $c < 100$.

4. Write a program using a dictionary to find the top 3 most frequently occurring words and how often they occur in the passage given below. Remove punctuation and convert words to lower case. We consider a word to be any continuous sequence of characters or numbers separated by whitespace.

Write a program to create a list of the first 100 Fizz buzz numbers. Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. Otherwise the original number is retained. For example, the first Fizz buzz numbers are 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, ....


In [ ]: