The simplest interpolation routine in scipy.interpolate is interp1d:

In [ ]:

```
from scipy.interpolate import interp1d
```

If we create a fake dataset:

In [ ]:

```
import numpy as np
x = np.array([0., 1., 3., 4.])
y = np.array([0., 4., 3., 2.])
```

we can interpolate linearly by first creating an interpolating function:

In [ ]:

```
f = interp1d(x, y)
```

and we can then interpolate to any value of x within the original bounds:

In [ ]:

```
f(0.5)
```

In [ ]:

```
f(3.3)
```

It is also possible to interpolate to several values at the same time:

In [ ]:

```
f(np.array([0.5, 1.5, 2.5, 3.5]))
```

If the interpolating function is called outside the original range, an error is raised:

In [ ]:

```
f(-1.)
```

`interp1d`

to not give an error in this case, but to use a set value:

In [ ]:

```
f = interp1d(x, y, bounds_error=False, fill_value=-10.)
```

In [ ]:

```
f(-1.0)
```

In [ ]:

```
f(np.array([-1., 1., 3., 6.]))
```

`interp1d`

uses linear interpolation, but it is also possible to use e.g. cubic interpolation:

In [ ]:

```
f = interp1d(x, y, kind='cubic')
f(0.5)
```

In [ ]:

```
def simple_function(x):
return 3. * x**2 + 2. * x + 1.
```

we can integrate it between limits using:

In [ ]:

```
from scipy.integrate import quad
print(quad(simple_function, 1., 2.))
```

We can also define functions as Numpy arrays:

In [ ]:

```
x = np.linspace(1., 2., 1000)
y = 3. * x**2 + 2. * x + 1.
```

And in this case we can use for example the simps function to integrate using Simpson's rule:

In [ ]:

```
from scipy.integrate import simps
print(simps(y, x=x))
```

`trapz`

function which works similarly to `simps`

but does trapezium integration:

In [ ]:

```
from scipy.integrate import trapz
print(trapz(y, x=x))
```

`x`

, and the parameters for a Gaussian (amplitude, displacement, width) and returns the value of the Gaussian at `x`

:

In [ ]:

```
# your solution here
```

Use `quad`

to compute the integral and compare to what you would expect.

In [ ]:

```
# your solution here
```

`x`

and `y`

that contain the Gaussian for fixed values `x`

, and try and compute the integral using `simps`

.

In [ ]:

```
# your solution here
```

Compare this to what you found with `quad`

and analytically.