# Numerical Recipes Workshop 1
For the week of 23-27 September, 2019

These activities will start with a small Python/NumPy refresher and then cover some things related to lectures 1/2 and the first part of Checkpoint 1.

**Please hand in your notebook via Noteable at the end of the workshop.**

They will not be graded and you will not receive feedback on them, but we want to test the submission process to make sure it's working for the checkpoints.

Please spend the first hour of the workshop with this notebook before starting on the checkpoint. **TAs will not answer questions about the checkpoints until the second hour of the workshop.**

## Documentation
* Python: https://docs.python.org/3.7/
* NumPy: https://numpy.org/doc/1.17/user/index.html
* SciPy: https://docs.scipy.org/doc/scipy/reference/
* matplotlib: https://matplotlib.org/3.1.0/index.html

Advice: google is really helpful (e.g. "numpy trapezoid rule")

## Python/package Versions

It's good to know what versions of Python and various packages you're using. Answers can be different or known bugs may exist in specific versions.

Use sys package for Python version. Most external packages have a `__version__` attribute associated with the top level import.

```python
# Python version
import sys
print(sys.version)
# Scipy version
import scipy
print(scipy.__version__)
# Try numpy and matplotlib
```

    3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00)
    [GCC 7.3.0]
    1.3.1

## The two most useful functions in Python
* `dir` - list all names (variables, functions, etc) in the given scope, i.e., what's in here? Try the following:
```
# top level name space
dir()
x = 1
dir()
```
```
import sys
# contents of the sys module
dir(sys)
```

* `help` - show documentation for a function or object.
```
import numpy as np
help(np.sum)
```

#### Use `dir` to see what's in the NumPy module. Pick a random function and see what it does.

```python
import numpy as np
dir(np)
help(np.iinfo)
```

    Help on class iinfo in module numpy:

    class iinfo(builtins.object)
     |  iinfo(int_type)
     |
     |  iinfo(type)
     |
     |  Machine limits for integer types.
     |
     |  Attributes
     |  ----------
     |  bits : int
     |      The number of bits occupied by the type.
     |  min : int
     |      The smallest integer expressible by the type.
     |  max : int
     |      The largest integer expressible by the type.
     |
     |  Parameters
     |  ----------
     |  int_type : integer type, dtype, or instance
     |      The kind of integer data type to get information about.
     |
     |  See Also
     |  --------
     |  finfo : The equivalent for floating point data types.
     |
     |  Examples
     |  --------
     |  With types:
     |
     |  >>> ii16 = np.iinfo(np.int16)
     |  >>> ii16.min
     |  -32768
     |  >>> ii16.max
     |  32767
     |  >>> ii32 = np.iinfo(np.int32)
     |  >>> ii32.min
     |  -2147483648
     |  >>> ii32.max
     |  2147483647
     |
     |  With instances:
     |
     |  >>> ii32 = np.iinfo(np.int32(10))
     |  >>> ii32.min
     |  -2147483648
     |  >>> ii32.max
     |  2147483647
     |
     |  Methods defined here:
     |
     |  __init__(self, int_type)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  __str__(self)
     |      String representation.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  max
     |      Maximum value of given dtype.
     |
     |  min
     |      Minimum value of given dtype.

## Best Practices

* Put module imports at the top in the first code cell.
* Rename modules to keep names short.
```
# Too long!
import numpy
x = numpy.arange(10)
```
```
# Much better
import numpy as np
x = np.arange(10)
```
* Don't do `from MODULE import *`. Every available object will be in your namespace.
```
from scipy import *
dir() # aaah!
```
* Be careful with variable names. Just about everything can be overwritten.
```
dir = 5
dir()
# The dir function is now lost. Doom.
```
* Use tab completion to recall function/object names. Start typing something and hit the [tab] key a couple times to bring up a menu of matching options. Use this in the terminal, too. Don't waste time typing long names.
```
np.su[tab][tab]
```
* If things are getting messy, restart the kernel using one of the *Restart* commands in the *Kernel* menu. This will reset your session, removing bad imports and extra variables.
* Cell taking too long to run? From *Kernel* menu, click *Interrupt* to stop execution. Have a look at the traceback to see where the code was. This can give a hint as to why it's taking so long.
* Keep it neat. Someone is most likely going to have to read your code someday. It should look nice, be clear, and conform to the style of code that was already there.

### Plotting tips
* add `%matplotlib inline` your import cell to get plots to show up in the notebook
```
from matplotlib import pyplot as plt
%matplotlib inline
```
* add the following in a separate cell to make defautl plot and font sizes bigger
```
pyplot.rcParams['figure.figsize'] = (10, 6) # inches
pyplot.rcParams['font.size'] = 14
```

# Activities

## Integer and floating point precision
Not all programming languages have fancy [arbitrary precision integers](https://rushter.com/blog/python-integer-implementation/). NumPy arrays of integers and floats will have limited precision.

#### Integer types
* `np.int8`, `np.int16`, `np.int32`, `np.int64`
* `np.uint8`, `np.uint16`, `np.uint32`, `np.uint64`

#### Floating point types
* `np.float16`, `np.float32`, `np.float64`, `np.float128`

Use the `np.iinfo` (for ints) and `np.finfo` (for floats) commands to see the limitations of some of these variable types, i.e. what do you get from `np.iinfo(np.int32)`?

```python
import numpy as np
```

```python
np.iinfo(np.int8)
np.finfo(np.float32)

```

    finfo(resolution=1e-06, min=-3.4028235e+38, max=3.4028235e+38, dtype=float32)

See what happens when an upper or lower limit is exceeded. Try a few different types.

```python
# code inverts to the minimum value it can represent
# np.int9 min = -128 max = 127
x = np.array([125, 126, 127], dtype=np.int8)
print(x)
x += 1
print(x)
```

    [125 126 127]
    [ 126  127 -128]

Floating point numbers have an attribute called *resolution*. Demonstrate the meaning of this term with the array below.

```python
y = np.array([1000, 100, 10, 1, 0.1], dtype=np.float32)
print(y)
y += 1e-08
print(y)

```

    [1.e+03 1.e+02 1.e+01 1.e+00 1.e-01]
    [1.0000000e+03 1.0000000e+02 1.0000000e+01 1.0000000e+00 1.0000001e-01]

## NumPy arrays: why bother?
NumPy arrays can be manipulated all at once without having to explicitly iterate over each value. NumPy operations are also significantly faster.

```python
import time
```

```python
# with lists
z = list(range(10000000))

t1 = time.time()
for i in range(len(z)):
    z[i] += 1
t2 = time.time()
print("That took %f seconds." % (t2-t1))
```

```python
# with arrays
z = list(range(10000000))
za = np.array(z)

t1 = time.time()
za += 1
t2 = time.time()
print("That took %f seconds." % (t2-t1))
```

### Some useful NumPy array generator functions.
* `np.arange`
* `np.linspace`
* `np.logspace`
* `np.ones`, `np.ones_like`
* `np.zeros`, `np.zeros_like`

Try them out. Feel free to make notes for yourself.

```python
import numpy as np

# makes a 1D array with evenly spaced
x = np.arange(-5,6)
print(x)

# 2nd argument is the end and 3rd argument is spacing
y = np.arange(0,10,2)
print(y)

# will give a 1D array with 50 evenly spaced numbers between 2 and 20
# can add 3rd argument num = * to change number of items in array
z = np.linspace(2,20)
print(z)

# same as above but using logarithms
# can add extra arguments in order to modify base
a = np.logspace(2,20,num=20,base=10.0)
print(a)

```

    [-5 -4 -3 -2 -1  0  1  2  3  4  5]
    [0 2 4 6 8]
    [ 2.          2.36734694  2.73469388  3.10204082  3.46938776  3.83673469
      4.20408163  4.57142857  4.93877551  5.30612245  5.67346939  6.04081633
      6.40816327  6.7755102   7.14285714  7.51020408  7.87755102  8.24489796
      8.6122449   8.97959184  9.34693878  9.71428571 10.08163265 10.44897959
     10.81632653 11.18367347 11.55102041 11.91836735 12.28571429 12.65306122
     13.02040816 13.3877551  13.75510204 14.12244898 14.48979592 14.85714286
     15.2244898  15.59183673 15.95918367 16.32653061 16.69387755 17.06122449
     17.42857143 17.79591837 18.16326531 18.53061224 18.89795918 19.26530612
     19.63265306 20.        ]
    [1.00000000e+02 8.85866790e+02 7.84759970e+03 6.95192796e+04
     6.15848211e+05 5.45559478e+06 4.83293024e+07 4.28133240e+08
     3.79269019e+09 3.35981829e+10 2.97635144e+11 2.63665090e+12
     2.33572147e+13 2.06913808e+14 1.83298071e+15 1.62377674e+16
     1.43844989e+17 1.27427499e+18 1.12883789e+19 1.00000000e+20]

## Plotting
Some useful plotting commands:
* `plt.plot`
* `plt.semilogx`, `plt.semilogy`
* `plt.loglog`
* `plt.scatter`
* `plt.xlim`, `plt.ylim`
* `plt.xlabel`, `plt.ylabel`
* `plt.legend`
* `plt.title`
* `plt.xscale`, `plt.yscale`

See [here](https://matplotlib.org/api/pyplot_summary.html) for a list of all plotting commands.

When making plots for checkpoints, always label the axes. Make them look nice.

A Gaussian distribution with mean, $\mu$, and variance, $\sigma^2$, takes the form:

$
\begin{align}
\Large
f(x) = \frac{1}{2\pi\sigma^{2}} e^{-\frac{(x - \mu)^2}{2\sigma^{2}}}
\end{align}
$

Make a plot of this function over the range [-5, 5] for a couple values of $\mu$ and $\sigma$ with appropriate labels and a legend. Hint, the `label` keyword can be given to the plotting commands to aid in making the legend. Try different combinations of linear and log-space plots.

First, code up a function for the Gaussian distribution. We'll use it here and there.

```python
def my_gaussian(x, mu=0, sigma=1):
    # np.exp can act on entire arrays! woo!
    y = 1/np.sqrt((2*np.pi*(sigma)**2))*np.exp(-(x-mu)**2/(2*(sigma)**2))
    return y
```

Running the cell below will test your function with a few values.

```python
assert (my_gaussian(0) - 0.3989422804014327 < 1e-7)
assert (my_gaussian(1) - 0.24197072451914337 < 1e-7)
```

```python
from matplotlib import pyplot as plt
%matplotlib inline
import numpy as np
```

```python
plt.rcParams['figure.figsize'] = (10, 6) # inches
plt.rcParams['font.size'] = 14
```

```python
x = np.linspace(-5,5, num = 50)
y = my_gaussian(x)

# Plots
plt.title("Gaussian Centred on Zero")
plt.xlabel("x")
plt.ylabel("f(x)")
plt.plot(x,y)
plt.show()
```

## Integration
Simple integration/summation can be done with basic array operations, i.e., not using fancy integration functions. Some useful functions:
* `np.sum`, `np.cumsum`

Note, many operations available directly from an array:
```
x = np.array([0, 1])
print (x.sum())
print (x.cumsum())
print (x.mean(), x.min(), x.max(), x.size)
```

Scipy has many [useful integration functions](https://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html).

To import one of those, you'll need to do:
```
from scipy.integrate import FUNCTION
```

Note, some of the scipy integrators require a function be given as one of the arguments. Other expect arrays of values. Read their documentation.

Integrate the Gaussian distribution from -5$\sigma$ to +5$\sigma$ using a few of the integration functions, like the trapezoidal rule and Simpson's rule. How quickly do the answers converge as a function of the number of points used?

Bonus: approximations like the trapezoidal rule and Simpson's rule can be coded up as vector operations in a few lines. Try this if you feel like.

```python
from scipy.integrate import trapz
from scipy.integrate import simps

# x is already from 5sigma
integral_t = trapz(y,x)
integral_s = simps(y,x)
print(integral_t)
print(integral_s)

```

    0.9999993758704986
    0.9999994627045221

```python
print(y)
```

    [1.48671951e-06 1.56294518e-06 1.64291438e-06 1.72680223e-06
     1.81479157e-06 1.90707332e-06 2.00384677e-06 2.10531999e-06
     2.21171010e-06 2.32324372e-06 2.44015731e-06 2.56269761e-06
     2.69112199e-06 2.82569895e-06 2.96670852e-06 3.11444274e-06
     3.26920615e-06 3.43131624e-06 3.60110404e-06 3.77891458e-06
     3.96510749e-06 4.16005756e-06 4.36415530e-06 4.57780761e-06
     4.80143840e-06 5.03548920e-06 5.28041992e-06 5.53670947e-06
     5.80485658e-06 6.08538047e-06 6.37882168e-06 6.68574289e-06
     7.00672970e-06 7.34239154e-06 7.69336257e-06 8.06030255e-06
     8.44389784e-06 8.84486240e-06 9.26393876e-06 9.70189908e-06
     1.01595463e-05 1.06377152e-05 1.11372736e-05 1.16591234e-05
     1.22042022e-05 1.27734842e-05 1.33679815e-05 1.39887459e-05
     1.46368699e-05 1.53134881e-05 1.60197791e-05 1.67569666e-05
     1.75263212e-05 1.83291622e-05 1.91668589e-05 2.00408326e-05
     2.09525584e-05 2.19035668e-05 2.28954459e-05 2.39298433e-05
     2.50084680e-05 2.61330924e-05 2.73055547e-05 2.85277610e-05
     2.98016873e-05 3.11293824e-05 3.25129696e-05 3.39546498e-05
     3.54567035e-05 3.70214940e-05 3.86514694e-05 4.03491658e-05
     4.21172102e-05 4.39583229e-05 4.58753211e-05 4.78711216e-05
     4.99487441e-05 5.21113142e-05 5.43620671e-05 5.67043508e-05
     5.91416295e-05 6.16774875e-05 6.43156324e-05 6.70598996e-05
     6.99142555e-05 7.28828016e-05 7.59697791e-05 7.91795725e-05
     8.25167139e-05 8.59858880e-05 8.95919357e-05 9.33398595e-05
     9.72348278e-05 1.01282180e-04 1.05487430e-04 1.09856275e-04
     1.14394597e-04 1.19108467e-04 1.24004157e-04 1.29088138e-04
     1.34367089e-04 1.39847906e-04 1.45537701e-04 1.51443813e-04
     1.57573813e-04 1.63935511e-04 1.70536959e-04 1.77386463e-04
     1.84492586e-04 1.91864155e-04 1.99510270e-04 2.07440309e-04
     2.15663936e-04 2.24191111e-04 2.33032092e-04 2.42197448e-04
     2.51698064e-04 2.61545150e-04 2.71750248e-04 2.82325244e-04
     2.93282371e-04 3.04634221e-04 3.16393754e-04 3.28574305e-04
     3.41189596e-04 3.54253739e-04 3.67781255e-04 3.81787075e-04
     3.96286554e-04 4.11295478e-04 4.26830079e-04 4.42907039e-04
     4.59543504e-04 4.76757094e-04 4.94565913e-04 5.12988560e-04
     5.32044139e-04 5.51752272e-04 5.72133108e-04 5.93207338e-04
     6.14996199e-04 6.37521496e-04 6.60805604e-04 6.84871487e-04
     7.09742705e-04 7.35443430e-04 7.61998457e-04 7.89433213e-04
     8.17773777e-04 8.47046885e-04 8.77279948e-04 9.08501063e-04
     9.40739024e-04 9.74023340e-04 1.00838424e-03 1.04385271e-03
     1.08046046e-03 1.11823998e-03 1.15722454e-03 1.19744822e-03
     1.23894586e-03 1.28175318e-03 1.32590668e-03 1.37144374e-03
     1.41840261e-03 1.46682238e-03 1.51674306e-03 1.56820557e-03
     1.62125172e-03 1.67592427e-03 1.73226693e-03 1.79032436e-03
     1.85014222e-03 1.91176712e-03 1.97524671e-03 2.04062963e-03
     2.10796558e-03 2.17730527e-03 2.24870050e-03 2.32220413e-03
     2.39787011e-03 2.47575348e-03 2.55591040e-03 2.63839816e-03
     2.72327519e-03 2.81060107e-03 2.90043655e-03 2.99284354e-03
     3.08788517e-03 3.18562576e-03 3.28613083e-03 3.38946715e-03
     3.49570271e-03 3.60490678e-03 3.71714984e-03 3.83250369e-03
     3.95104138e-03 4.07283728e-03 4.19796703e-03 4.32650760e-03
     4.45853728e-03 4.59413568e-03 4.73338375e-03 4.87636379e-03
     5.02315943e-03 5.17385570e-03 5.32853895e-03 5.48729692e-03
     5.65021873e-03 5.81739487e-03 5.98891723e-03 6.16487906e-03
     6.34537503e-03 6.53050119e-03 6.72035498e-03 6.91503526e-03
     7.11464225e-03 7.31927759e-03 7.52904433e-03 7.74404687e-03
     7.96439105e-03 8.19018406e-03 8.42153448e-03 8.65855230e-03
     8.90134884e-03 9.15003682e-03 9.40473029e-03 9.66554468e-03
     9.93259675e-03 1.02060046e-02 1.04858876e-02 1.07723664e-02
     1.10655632e-02 1.13656012e-02 1.16726049e-02 1.19867001e-02
     1.23080140e-02 1.26366746e-02 1.29728116e-02 1.33165554e-02
     1.36680379e-02 1.40273919e-02 1.43947515e-02 1.47702517e-02
     1.51540287e-02 1.55462195e-02 1.59469624e-02 1.63563965e-02
     1.67746618e-02 1.72018992e-02 1.76382506e-02 1.80838585e-02
     1.85388665e-02 1.90034187e-02 1.94776600e-02 1.99617360e-02
     2.04557929e-02 2.09599775e-02 2.14744372e-02 2.19993198e-02
     2.25347735e-02 2.30809471e-02 2.36379896e-02 2.42060504e-02
     2.47852791e-02 2.53758253e-02 2.59778391e-02 2.65914704e-02
     2.72168692e-02 2.78541855e-02 2.85035691e-02 2.91651697e-02
     2.98391368e-02 3.05256195e-02 3.12247667e-02 3.19367266e-02
     3.26616471e-02 3.33996755e-02 3.41509585e-02 3.49156418e-02
     3.56938707e-02 3.64857893e-02 3.72915409e-02 3.81112678e-02
     3.89451110e-02 3.97932106e-02 4.06557052e-02 4.15327320e-02
     4.24244269e-02 4.33309242e-02 4.42523567e-02 4.51888553e-02
     4.61405491e-02 4.71075656e-02 4.80900299e-02 4.90880655e-02
     5.01017932e-02 5.11313321e-02 5.21767985e-02 5.32383064e-02
     5.43159674e-02 5.54098903e-02 5.65201811e-02 5.76469432e-02
     5.87902768e-02 5.99502792e-02 6.11270446e-02 6.23206639e-02
     6.35312247e-02 6.47588111e-02 6.60035037e-02 6.72653795e-02
     6.85445117e-02 6.98409697e-02 7.11548190e-02 7.24861209e-02
     7.38349328e-02 7.52013075e-02 7.65852939e-02 7.79869361e-02
     7.94062739e-02 8.08433422e-02 8.22981714e-02 8.37707869e-02
     8.52612093e-02 8.67694540e-02 8.82955314e-02 8.98394467e-02
     9.14011996e-02 9.29807846e-02 9.45781905e-02 9.61934008e-02
     9.78263929e-02 9.94771388e-02 1.01145604e-01 1.02831750e-01
     1.04535529e-01 1.06256890e-01 1.07995775e-01 1.09752118e-01
     1.11525850e-01 1.13316892e-01 1.15125161e-01 1.16950567e-01
     1.18793013e-01 1.20652394e-01 1.22528601e-01 1.24421517e-01
     1.26331016e-01 1.28256969e-01 1.30199236e-01 1.32157674e-01
     1.34132129e-01 1.36122443e-01 1.38128449e-01 1.40149973e-01
     1.42186834e-01 1.44238845e-01 1.46305809e-01 1.48387524e-01
     1.50483779e-01 1.52594357e-01 1.54719033e-01 1.56857574e-01
     1.59009741e-01 1.61175286e-01 1.63353954e-01 1.65545484e-01
     1.67749605e-01 1.69966042e-01 1.72194509e-01 1.74434714e-01
     1.76686359e-01 1.78949137e-01 1.81222735e-01 1.83506831e-01
     1.85801097e-01 1.88105197e-01 1.90418790e-01 1.92741524e-01
     1.95073045e-01 1.97412986e-01 1.99760979e-01 2.02116645e-01
     2.04479600e-01 2.06849454e-01 2.09225807e-01 2.11608257e-01
     2.13996392e-01 2.16389795e-01 2.18788043e-01 2.21190706e-01
     2.23597349e-01 2.26007530e-01 2.28420802e-01 2.30836711e-01
     2.33254798e-01 2.35674601e-01 2.38095648e-01 2.40517464e-01
     2.42939571e-01 2.45361483e-01 2.47782710e-01 2.50202758e-01
     2.52621129e-01 2.55037318e-01 2.57450819e-01 2.59861120e-01
     2.62267707e-01 2.64670059e-01 2.67067655e-01 2.69459970e-01
     2.71846473e-01 2.74226634e-01 2.76599918e-01 2.78965787e-01
     2.81323703e-01 2.83673123e-01 2.86013503e-01 2.88344299e-01
     2.90664962e-01 2.92974946e-01 2.95273699e-01 2.97560671e-01
     2.99835312e-01 3.02097069e-01 3.04345390e-01 3.06579724e-01
     3.08799517e-01 3.11004218e-01 3.13193276e-01 3.15366141e-01
     3.17522263e-01 3.19661095e-01 3.21782090e-01 3.23884702e-01
     3.25968391e-01 3.28032613e-01 3.30076832e-01 3.32100512e-01
     3.34103120e-01 3.36084127e-01 3.38043006e-01 3.39979235e-01
     3.41892294e-01 3.43781670e-01 3.45646851e-01 3.47487331e-01
     3.49302609e-01 3.51092190e-01 3.52855580e-01 3.54592296e-01
     3.56301856e-01 3.57983786e-01 3.59637619e-01 3.61262891e-01
     3.62859148e-01 3.64425940e-01 3.65962827e-01 3.67469372e-01
     3.68945149e-01 3.70389738e-01 3.71802727e-01 3.73183711e-01
     3.74532294e-01 3.75848089e-01 3.77130715e-01 3.78379803e-01
     3.79594991e-01 3.80775926e-01 3.81922264e-01 3.83033671e-01
     3.84109822e-01 3.85150403e-01 3.86155108e-01 3.87123642e-01
     3.88055720e-01 3.88951067e-01 3.89809419e-01 3.90630522e-01
     3.91414133e-01 3.92160019e-01 3.92867960e-01 3.93537743e-01
     3.94169171e-01 3.94762054e-01 3.95316217e-01 3.95831493e-01
     3.96307728e-01 3.96744781e-01 3.97142519e-01 3.97500825e-01
     3.97819591e-01 3.98098720e-01 3.98338130e-01 3.98537748e-01
     3.98697514e-01 3.98817381e-01 3.98897312e-01 3.98937284e-01
     3.98937284e-01 3.98897312e-01 3.98817381e-01 3.98697514e-01
     3.98537748e-01 3.98338130e-01 3.98098720e-01 3.97819591e-01
     3.97500825e-01 3.97142519e-01 3.96744781e-01 3.96307728e-01
     3.95831493e-01 3.95316217e-01 3.94762054e-01 3.94169171e-01
     3.93537743e-01 3.92867960e-01 3.92160019e-01 3.91414133e-01
     3.90630522e-01 3.89809419e-01 3.88951067e-01 3.88055720e-01
     3.87123642e-01 3.86155108e-01 3.85150403e-01 3.84109822e-01
     3.83033671e-01 3.81922264e-01 3.80775926e-01 3.79594991e-01
     3.78379803e-01 3.77130715e-01 3.75848089e-01 3.74532294e-01
     3.73183711e-01 3.71802727e-01 3.70389738e-01 3.68945149e-01
     3.67469372e-01 3.65962827e-01 3.64425940e-01 3.62859148e-01
     3.61262891e-01 3.59637619e-01 3.57983786e-01 3.56301856e-01
     3.54592296e-01 3.52855580e-01 3.51092190e-01 3.49302609e-01
     3.47487331e-01 3.45646851e-01 3.43781670e-01 3.41892294e-01
     3.39979235e-01 3.38043006e-01 3.36084127e-01 3.34103120e-01
     3.32100512e-01 3.30076832e-01 3.28032613e-01 3.25968391e-01
     3.23884702e-01 3.21782090e-01 3.19661095e-01 3.17522263e-01
     3.15366141e-01 3.13193276e-01 3.11004218e-01 3.08799517e-01
     3.06579724e-01 3.04345390e-01 3.02097069e-01 2.99835312e-01
     2.97560671e-01 2.95273699e-01 2.92974946e-01 2.90664962e-01
     2.88344299e-01 2.86013503e-01 2.83673123e-01 2.81323703e-01
     2.78965787e-01 2.76599918e-01 2.74226634e-01 2.71846473e-01
     2.69459970e-01 2.67067655e-01 2.64670059e-01 2.62267707e-01
     2.59861120e-01 2.57450819e-01 2.55037318e-01 2.52621129e-01
     2.50202758e-01 2.47782710e-01 2.45361483e-01 2.42939571e-01
     2.40517464e-01 2.38095648e-01 2.35674601e-01 2.33254798e-01
     2.30836711e-01 2.28420802e-01 2.26007530e-01 2.23597349e-01
     2.21190706e-01 2.18788043e-01 2.16389795e-01 2.13996392e-01
     2.11608257e-01 2.09225807e-01 2.06849454e-01 2.04479600e-01
     2.02116645e-01 1.99760979e-01 1.97412986e-01 1.95073045e-01
     1.92741524e-01 1.90418790e-01 1.88105197e-01 1.85801097e-01
     1.83506831e-01 1.81222735e-01 1.78949137e-01 1.76686359e-01
     1.74434714e-01 1.72194509e-01 1.69966042e-01 1.67749605e-01
     1.65545484e-01 1.63353954e-01 1.61175286e-01 1.59009741e-01
     1.56857574e-01 1.54719033e-01 1.52594357e-01 1.50483779e-01
     1.48387524e-01 1.46305809e-01 1.44238845e-01 1.42186834e-01
     1.40149973e-01 1.38128449e-01 1.36122443e-01 1.34132129e-01
     1.32157674e-01 1.30199236e-01 1.28256969e-01 1.26331016e-01
     1.24421517e-01 1.22528601e-01 1.20652394e-01 1.18793013e-01
     1.16950567e-01 1.15125161e-01 1.13316892e-01 1.11525850e-01
     1.09752118e-01 1.07995775e-01 1.06256890e-01 1.04535529e-01
     1.02831750e-01 1.01145604e-01 9.94771388e-02 9.78263929e-02
     9.61934008e-02 9.45781905e-02 9.29807846e-02 9.14011996e-02
     8.98394467e-02 8.82955314e-02 8.67694540e-02 8.52612093e-02
     8.37707869e-02 8.22981714e-02 8.08433422e-02 7.94062739e-02
     7.79869361e-02 7.65852939e-02 7.52013075e-02 7.38349328e-02
     7.24861209e-02 7.11548190e-02 6.98409697e-02 6.85445117e-02
     6.72653795e-02 6.60035037e-02 6.47588111e-02 6.35312247e-02
     6.23206639e-02 6.11270446e-02 5.99502792e-02 5.87902768e-02
     5.76469432e-02 5.65201811e-02 5.54098903e-02 5.43159674e-02
     5.32383064e-02 5.21767985e-02 5.11313321e-02 5.01017932e-02
     4.90880655e-02 4.80900299e-02 4.71075656e-02 4.61405491e-02
     4.51888553e-02 4.42523567e-02 4.33309242e-02 4.24244269e-02
     4.15327320e-02 4.06557052e-02 3.97932106e-02 3.89451110e-02
     3.81112678e-02 3.72915409e-02 3.64857893e-02 3.56938707e-02
     3.49156418e-02 3.41509585e-02 3.33996755e-02 3.26616471e-02
     3.19367266e-02 3.12247667e-02 3.05256195e-02 2.98391368e-02
     2.91651697e-02 2.85035691e-02 2.78541855e-02 2.72168692e-02
     2.65914704e-02 2.59778391e-02 2.53758253e-02 2.47852791e-02
     2.42060504e-02 2.36379896e-02 2.30809471e-02 2.25347735e-02
     2.19993198e-02 2.14744372e-02 2.09599775e-02 2.04557929e-02
     1.99617360e-02 1.94776600e-02 1.90034187e-02 1.85388665e-02
     1.80838585e-02 1.76382506e-02 1.72018992e-02 1.67746618e-02
     1.63563965e-02 1.59469624e-02 1.55462195e-02 1.51540287e-02
     1.47702517e-02 1.43947515e-02 1.40273919e-02 1.36680379e-02
     1.33165554e-02 1.29728116e-02 1.26366746e-02 1.23080140e-02
     1.19867001e-02 1.16726049e-02 1.13656012e-02 1.10655632e-02
     1.07723664e-02 1.04858876e-02 1.02060046e-02 9.93259675e-03
     9.66554468e-03 9.40473029e-03 9.15003682e-03 8.90134884e-03
     8.65855230e-03 8.42153448e-03 8.19018406e-03 7.96439105e-03
     7.74404687e-03 7.52904433e-03 7.31927759e-03 7.11464225e-03
     6.91503526e-03 6.72035498e-03 6.53050119e-03 6.34537503e-03
     6.16487906e-03 5.98891723e-03 5.81739487e-03 5.65021873e-03
     5.48729692e-03 5.32853895e-03 5.17385570e-03 5.02315943e-03
     4.87636379e-03 4.73338375e-03 4.59413568e-03 4.45853728e-03
     4.32650760e-03 4.19796703e-03 4.07283728e-03 3.95104138e-03
     3.83250369e-03 3.71714984e-03 3.60490678e-03 3.49570271e-03
     3.38946715e-03 3.28613083e-03 3.18562576e-03 3.08788517e-03
     2.99284354e-03 2.90043655e-03 2.81060107e-03 2.72327519e-03
     2.63839816e-03 2.55591040e-03 2.47575348e-03 2.39787011e-03
     2.32220413e-03 2.24870050e-03 2.17730527e-03 2.10796558e-03
     2.04062963e-03 1.97524671e-03 1.91176712e-03 1.85014222e-03
     1.79032436e-03 1.73226693e-03 1.67592427e-03 1.62125172e-03
     1.56820557e-03 1.51674306e-03 1.46682238e-03 1.41840261e-03
     1.37144374e-03 1.32590668e-03 1.28175318e-03 1.23894586e-03
     1.19744822e-03 1.15722454e-03 1.11823998e-03 1.08046046e-03
     1.04385271e-03 1.00838424e-03 9.74023340e-04 9.40739024e-04
     9.08501063e-04 8.77279948e-04 8.47046885e-04 8.17773777e-04
     7.89433213e-04 7.61998457e-04 7.35443430e-04 7.09742705e-04
     6.84871487e-04 6.60805604e-04 6.37521496e-04 6.14996199e-04
     5.93207338e-04 5.72133108e-04 5.51752272e-04 5.32044139e-04
     5.12988560e-04 4.94565913e-04 4.76757094e-04 4.59543504e-04
     4.42907039e-04 4.26830079e-04 4.11295478e-04 3.96286554e-04
     3.81787075e-04 3.67781255e-04 3.54253739e-04 3.41189596e-04
     3.28574305e-04 3.16393754e-04 3.04634221e-04 2.93282371e-04
     2.82325244e-04 2.71750248e-04 2.61545150e-04 2.51698064e-04
     2.42197448e-04 2.33032092e-04 2.24191111e-04 2.15663936e-04
     2.07440309e-04 1.99510270e-04 1.91864155e-04 1.84492586e-04
     1.77386463e-04 1.70536959e-04 1.63935511e-04 1.57573813e-04
     1.51443813e-04 1.45537701e-04 1.39847906e-04 1.34367089e-04
     1.29088138e-04 1.24004157e-04 1.19108467e-04 1.14394597e-04
     1.09856275e-04 1.05487430e-04 1.01282180e-04 9.72348278e-05
     9.33398595e-05 8.95919357e-05 8.59858880e-05 8.25167139e-05
     7.91795725e-05 7.59697791e-05 7.28828016e-05 6.99142555e-05
     6.70598996e-05 6.43156324e-05 6.16774875e-05 5.91416295e-05
     5.67043508e-05 5.43620671e-05 5.21113142e-05 4.99487441e-05
     4.78711216e-05 4.58753211e-05 4.39583229e-05 4.21172102e-05
     4.03491658e-05 3.86514694e-05 3.70214940e-05 3.54567035e-05
     3.39546498e-05 3.25129696e-05 3.11293824e-05 2.98016873e-05
     2.85277610e-05 2.73055547e-05 2.61330924e-05 2.50084680e-05
     2.39298433e-05 2.28954459e-05 2.19035668e-05 2.09525584e-05
     2.00408326e-05 1.91668589e-05 1.83291622e-05 1.75263212e-05
     1.67569666e-05 1.60197791e-05 1.53134881e-05 1.46368699e-05
     1.39887459e-05 1.33679815e-05 1.27734842e-05 1.22042022e-05
     1.16591234e-05 1.11372736e-05 1.06377152e-05 1.01595463e-05
     9.70189908e-06 9.26393876e-06 8.84486240e-06 8.44389784e-06
     8.06030255e-06 7.69336257e-06 7.34239154e-06 7.00672970e-06
     6.68574289e-06 6.37882168e-06 6.08538047e-06 5.80485658e-06
     5.53670947e-06 5.28041992e-06 5.03548920e-06 4.80143840e-06
     4.57780761e-06 4.36415530e-06 4.16005756e-06 3.96510749e-06
     3.77891458e-06 3.60110404e-06 3.43131624e-06 3.26920615e-06
     3.11444274e-06 2.96670852e-06 2.82569895e-06 2.69112199e-06
     2.56269761e-06 2.44015731e-06 2.32324372e-06 2.21171010e-06
     2.10531999e-06 2.00384677e-06 1.90707332e-06 1.81479157e-06
     1.72680223e-06 1.64291438e-06 1.56294518e-06 1.48671951e-06]

```python

```