## Quantum Mechanics: First-order energy perturbation to harmonic oscillator

In *Quantum Chemistry, 7th Ed* by Levine, an example on page 235 calculates the first-order perturbation correction to an unperturbed harmonic oscillator. It is a simple example, which I will reproduce here with SymPy. Usually, I wouldn't post something so trivial, but there was a trick using SymPy to get the integration to work. This trick was defining assumptions about variables ahead of time, and I demonstrate that here.

An example perturbed Hamiltonian for an osicalltor incorporating anharmonic terms:

$$ \hat{H}^{'} = \hat{H} - \hat{H}^{0} = cx^3 + dx^4 $$

The ground state unperturbed wavefunction of the quantum harmonic oscillator:

$$ \psi_{0}^{(0)} = (\alpha / \pi)^{1/4} e^{-\alpha x^2 / 2} $$

A little shortcut in notation to simplify equation writing:

$$ \alpha = \frac{4 \pi^2 \nu m}{h} $$


```python
from sympy import symbols, oo, integrate, exp, sqrt, pi
```

Here was the trick to making the integration work properly. When creating the symbols, I defined all as real and most as positive.


```python
alpha, x, m, nu, h = symbols('alpha x m nu h', real=True, positive=True)
d = symbols('d', real=True)
```


```python
E_0_1 = 2*d*sqrt(alpha/pi) * integrate(exp(-alpha*x**2)*x**4, (x, 0, oo))
E_0_1
```




$\displaystyle \frac{3 d}{4 \alpha^{2}}$




```python
E_0_1 = E_0_1.subs({alpha: (4*pi**2*nu*m/h)})
E_0_1
```




$\displaystyle \frac{3 d h^{2}}{64 \pi^{4} m^{2} \nu^{2}}$




```python
E_0_0 = 0.5 * h * nu
E_0_0
```




$\displaystyle 0.5 h \nu$




```python

```

f75267c26fb8ffd915dc8d86a3175c2fa54cf748
ipynb
Jupyter Notebook
notebooks/example_pg235.ipynb
akey7/basic-quantum-models
b2f7edd2fdd15b6f85ee3708f8c2dae24686fd07
BSD-2-Clause
notebooks/example_pg235.ipynb
akey7/basic-quantum-models
b2f7edd2fdd15b6f85ee3708f8c2dae24686fd07
BSD-2-Clause
2021-07-12T15:49:00.000Z
2021-07-12T15:54:55.000Z
notebooks/example_pg235.ipynb
akey7/basic-quantum-models
b2f7edd2fdd15b6f85ee3708f8c2dae24686fd07
BSD-2-Clause
Qwen/Qwen-72B
1. YES
2. YES