<jupyter_start><jupyter_text>Numerical analysis<jupyter_code>import numpy as np
from scipy.special import factorial
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
def eps_fock(nmax, r):
    return 1 - (1/np.cosh(r))*sum([((np.tanh(r)**2)/4)**k*factorial(2*k)/(factorial(k)**2) for k in range(nmax//2 + 1)])
eps_focks = [eps_fock(nmax, np.log(2)) for nmax in np.arange(12)]
np.save('eps_focks.npy', eps_focks)
def eps_sq(nmax, r):
    return ((np.cosh(r) - 1)/(np.cosh(r) + 1))**(nmax + 1)
eps_sqs = [eps_sq(nmax, np.log(2)) for nmax in np.arange(12)]
np.save('eps_sqs.npy', eps_sqs)
with plt.style.context('paper.mplstyle'):
    fig, ax = plt.subplots(figsize=(3.5,2.5))
    ax.semilogy(eps_focks, linestyle='--', marker='o', label='Fock')
    ax.semilogy(eps_sqs, linestyle='--', marker='d', label='Squeezed')
    ax.set_xlabel(r'$n_\mathrm{max}$')
    ax.set_ylabel(r'$\eta$')
    ax.xaxis.set_major_locator(MaxNLocator(integer=True))
    ax.legend()
    plt.tight_layout()
    plt.savefig('discarded-population.pdf', bbox_inches='tight', pad_inches=0.02)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1947935368043088, 'fraction_numerical': 0.02154398563734291, 'mean_word_length': 5.408045977011494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '185258', 'license': 'MIT', 'n_tokens_mistral': 502, 'n_tokens_neox': 476, 'n_words': 75, 'path': 'notebooks/numerical-analysis.ipynb', 'repo_name': 'CQuIC-GitHub/pysme', 'size': '1114'}