<jupyter_start><jupyter_text>Hydrogen spectra using Rydberg FormulaThe Rydberg formula is used to predict emission spectrum lines from hydrogen. Find out more about the Rydberg formula used for hydrogen at: [https://en.wikipedia.org/wiki/Rydberg_formulaFor_hydrogen](https://en.wikipedia.org/wiki/Rydberg_formulaFor_hydrogen)$$ \tilde\nu = R_H\Biggl(\frac{1}{n_{1}^2} + \frac{1}{n_{2}^2}\Biggr)$$Where \\(\tilde\nu\\) is the wavenumber in \\(cm^{-1}\\) and \\(R_H = 109,677 cm^{-1}\\). See *Physical Chemistry, 8th ed* by Atkins and <NAME>, page 320 for this equation.[On this page](https://www.powertechnology.com/calculators/) I found that you could convert wavenumbers in inverse centimeters to nanometers with \\(\lambda = \frac{10^7}{\tilde\nu}\\), with wavelength in nanometers. Search for the keyword "nanometer".These spectra are not empirical values, but rather calculated using the Rydberg formula.<jupyter_code>def rydberg_nm(n1, n2):
    """
    Calculates the Rydberg wavenumber between n1 and n2.

    Parameters
    ----------
    n1: int
        The n1 level

    n2: int
        The n2 level

    Returns
    -------
    float
        Nanometer wavelength of the transition
    """
    rh = 109677  # cm^-1, Rydberg constant 
    t1 = 1 / n1 ** 2
    t2 = 1 / n2 ** 2
    wavenumber = rh * (t1 - t2)
    return 1 / wavenumber * 1e7<jupyter_output><empty_output><jupyter_text>Lyman series[https://en.wikipedia.org/wiki/Lyman_series](https://en.wikipedia.org/wiki/Lyman_series)<jupyter_code>lyman_n2s = range (2, 12)
lyman = [rydberg_nm(1, n2) for n2 in lyman_n2s]
for nm, n2 in zip(lyman, lyman_n2s):
    print(f'n1=1, n2={n2}, nm={nm}')
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(12, 2))
ax.set_title('Lyman Series', color='b', size=20)
ax.set_yticks([])
ax.set_xlim(90, 130)
ax.set_xlabel("nm", size=20, color='b')
for nm in lyman:
    ax.axvline(nm, color='r')<jupyter_output>n1=1, n2=2, nm=121.56909227398026
n1=1, n2=3, nm=102.57392160617086
n1=1, n2=4, nm=97.25527381918421
n1=1, n2=5, nm=94.97585333904709
n1=1, n2=6, nm=93.78187118278477
n1=1, n2=7, nm=93.07633627226615
n1=1, n2=8, nm=92.62407030398496
n1=1, n2=9, nm=92.31652944555377
n1=1, n2=10, nm=92.09779717725777
n1=1, n2=11, nm=91.93662603219758<jupyter_text>Balmer series[https://en.wikipedia.org/wiki/Balmer_series](https://en.wikipedia.org/wiki/Balmer_series)<jupyter_code>balmer_n2s = range(3, 10)
balmer = [rydberg_nm(2, n2) for n2 in balmer_n2s]
for nm, n2 in zip(balmer, balmer_n2s):
    print(f'n1=2, n2={n2}, nm={nm}')
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(12, 2))
ax.set_title('Balmer Series', color='b', size=20)
ax.set_yticks([])
ax.set_xlim(350, 700)
ax.set_xlabel("nm", size=20, color='b')
for nm in balmer:
    ax.axvline(nm, color='r')
paschen_n2s = range(4, 9)
paschen = [rydberg_nm(3, n2) for n2 in paschen_n2s]
for nm, n2 in zip(paschen, paschen_n2s):
    print(f'n1=2, n2={n2} nm={nm}')
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(12, 2))
ax.set_title('Paschen Series', color='b', size=20)
ax.set_yticks([])
ax.set_xlim(800, 1900)
ax.set_xlabel("nm", size=20, color='b')
for nm in paschen:
    ax.axvline(nm, color='r')<jupyter_output>n1=2, n2=4 nm=1875.6374236556956
n1=2, n2=5 nm=1282.1740200771358
n1=2, n2=6 nm=1094.1218304658223
n1=2, n2=7 nm=1005.2244317404744
n1=2, n2=8 nm=954.8699611338087
{'fraction_non_alphanumeric': 0.16596512327119664, 'fraction_numerical': 0.13319302465423932, 'mean_word_length': 4.677474402730375, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 7, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '55942', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1434, 'n_words': 309, 'path': 'notebooks/rydberg.ipynb', 'repo_name': 'akey7/basic-quantum-models', 'size': '3328'}