# Boltzmann distribution for a harmonic oscillator


```python
from sympy import *
init_printing()
```


```python
k, beta, T, p, n, omega, hbar = symbols('k, beta, T, p, n, omega, hbar', positive=True)
```


```python
p = exp(-n*hbar*omega/k/T)*(1-exp(-hbar*omega/k/T))
```


```python
p
```


```python
p.subs(n,2)
```


```python
solveset(p.subs([(n,2),(omega,3.0e4*3.14),(k,1.38e-23),(hbar,1.05e-34)])-0.25,T)
```


```python
x = symbols('x', positive=True)
```


```python
solveset(x**2-x**3-0.08,x)
```


```python
(hbar*omega/k*log(1/0.42)).subs([(n,2),(omega,3.0e4*3.14),(k,1.38e-23),(hbar,1.05e-34)])
```


```python

```

3547494503193914ac06194b2ff52614e4bb2421
ipynb
Jupyter Notebook
Boltzmann.ipynb
corcoted/Phys475
8fc0ee6bccda19e5afff14f0e8fda6aef7ee6d66
MIT
2021-03-10T04:30:46.000Z
2021-07-12T09:20:43.000Z
Boltzmann.ipynb
corcoted/Phys475
8fc0ee6bccda19e5afff14f0e8fda6aef7ee6d66
MIT
Boltzmann.ipynb
corcoted/Phys475
8fc0ee6bccda19e5afff14f0e8fda6aef7ee6d66
MIT
Qwen/Qwen-72B
1. YES
2. YES