# CHEM 1000 - Spring 2022
Prof. Geoffrey Hutchison, University of Pittsburgh

## Graded Homework 6

For this homework, we'll focus on:
- integrals in 2D polar and 3D spherical space
- probability (including integrating continuous distributions)
---

As a reminder, you do not need to use Python to solve the problems. If you want, you can use other methods, just put your answers in the appropriate places.

To turn in, either download as Notebook (.ipynb) or Print to PDF and upload to Gradescope.

Make sure you fill in any place that says YOUR CODE HERE or "YOUR ANSWER HERE", as well as your name and collaborators (i.e., anyone you discussed this with) below:


```python
NAME = ""
COLLABORATORS = ""
```

### Cartesian to Spherical Integrals

Consider the Cartesian integral:
$$
\iiint z^{2} d x d y d z
$$

Evaluation is fairly simple over a rectangular region, but if we wish to evaluate across a spherical volume, the limits of integration become messy.

Instead, we can transform $z^2$, resulting in the integral:

$$
\int_{0}^{a} \int_{0}^{\pi} \int_{0}^{2 \pi}(r \cos \theta)^{2} r^{2} \sin \theta d \varphi d \theta d r
$$

Integrate across a sphere of size "a"


```python
from sympy import init_session
init_session()
```


```python
a, r, theta, phi = symbols("N r theta phi")
# technically, we're integrating psi**2 but let's not worry about that now
# z => (r*cos(theta)) in spherical coordinates
f = (r*cos(theta)**2)

integrate(# something)
```

### Normalizing

We often wish to normalize functions. Calculate a normalization constant $N^2$ for the following integral (e.g., evaluate it, set it equal to one, etc.)

$$
\int_{0}^{\infty} \int_{0}^{\pi} \int_{0}^{2 \pi} N^2 \mathrm{e}^{-2 r} \cos ^{2} \theta r^{2} \sin \theta d \varphi d \theta d r
$$

(This is related to a $2p_z$ hydrogen atomic orbital.)


```python
# if you have an error, make sure you run the cell above this
N, r, theta, phi = symbols("N r theta phi")
# technically, we're integrating psi**2 but let's not worry about that now
f = N**2 * exp(-2*r) * cos(theta)**2

integrate(# something)
```

### Gaussian Distribution and Probability

You may have heard much about the Gaussian "normal" distribution ("Bell curve").

If we flip a coin enough, the binomial distribution becomes essentially continuous. Moreover, the "law of large numbers" (i.e., the [central limit theorem](https://en.wikipedia.org/wiki/Central_limit_theorem)) indicates that by taking the enough data points, the sum - and average will tend towards a Gaussian distribution.

In short, even if our underlying data comes from some different distribution, the average will become normal (e.g. consider the average velocities in an ideal gas - a mole is a big number).

We will spend some time on the Gaussian distribution.
- mean $x_0$
- standard deviation $\sigma$, variance $\sigma^2$

A normalized Gaussian distribution is then:

$$
p(x) =\frac{1}{\sqrt{2 \pi \sigma^{2}}} \exp \left[-\frac{\left(x-x_{0}\right)^{2}}{2 \sigma^{2}}\right]
$$

If the mean $x_0 = 0$, what fraction of data will fall:
- within $\pm 0.5\sigma$
- within one standard deviation
- within $\pm 1.5 \sigma$
- within $\pm 2.0 \sigma$

(In other words, change the limits of integration on the probability function.)


```python
sigma = symbols('sigma')

p = (1/sqrt(2*pi*sigma**2))*exp((-x**2)/(2*sigma**2))
simplify(integrate(p, (x, -0.5*sigma, +0.5*sigma)))
```

### If we want to include "error bars" with 95% confidence, what intervals do we use?

YOUR ANSWER HERE

What about 99% confidence intervals?

1ce0df6b99e963f4fc402df420d611e96b0bf2a1
ipynb
Jupyter Notebook
homework/ps6/ps6.ipynb
ghutchis/chem1000
07a7eac20cc04ee9a1bdb98339fbd5653a02a38d
CC-BY-4.0
2020-06-23T18:44:37.000Z
2022-03-14T10:13:05.000Z
homework/ps6/ps6.ipynb
ghutchis/chem1000
07a7eac20cc04ee9a1bdb98339fbd5653a02a38d
CC-BY-4.0
homework/ps6/ps6.ipynb
ghutchis/chem1000
07a7eac20cc04ee9a1bdb98339fbd5653a02a38d
CC-BY-4.0
2021-07-29T10:45:23.000Z
2021-10-16T09:51:00.000Z
Qwen/Qwen-72B
1. YES
2. YES