In Class Exercise: Python


In [14]:
import numpy as np
x = np.linspace(1,10,num=5)
print(x)


[  1.     3.25   5.5    7.75  10.  ]

Output should be something like:

Hello World: exp( [1. 3.25 5.5 ]) = [ result ]


In [ ]:

Map a function to x

Map the function $\exp(a)*\exp(-a)$ to x


In [ ]:

Filter the result from the previous Map

Only display the results where $\left|1.0 - r \right| < 10^{-20}$

Print the number of elements in the result


In [ ]: