<jupyter_start><jupyter_text>First, create your Hamiltonian<jupyter_code>H = p[1]*p[1]/4 + o*o/4/q[1]/q[1] - 1/a/2/q[1] - 2/sympy.sqrt(q[1]*q[1]+q[2]*q[2]) + (a+2)*p[2]*p[2]/a/4; H<jupyter_output><empty_output><jupyter_text>Substitute Hamiltonian to a class `Hamiltonian`<jupyter_code>ham = Hamilton.Hamiltonian(H, [p[1],p[2]], [q[1],q[2]])<jupyter_output><empty_output><jupyter_text>Expand Hamiltonian around an equilibrium point<jupyter_code>equilibrium_points = [0, 0, o*o*a/(4*a+1), 0]
ham.expand_around_equilibrium(equilibrium_points, max_degree=4)<jupyter_output><empty_output><jupyter_text>`rescale()` will rescale the coefficient of $p_i$ and $q_i$<jupyter_code>ham.rescale()
ham.coeff_subs([(a, (8-l*l)/(4*l*l-4))])
ham.rotate45()<jupyter_output><empty_output><jupyter_text>Now we are able to calculate Birkhoff normal form.Substitute the above `Hamiltonian` to a class `LieTransform`<jupyter_code>birkhoff = Birkhoff.LieTransform.fromHamiltonian(ham)
birkhoff.exec()<jupyter_output>Initialized
do exec() and calculate normal form
Lie transform completed!!
do normalform() to print normal form of input Hamiltonian<jupyter_text>Run `normalform()` and you will see Birkhoff normal form!!<jupyter_code>birkhoff.normalform()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15873015873015872, 'fraction_numerical': 0.02619047619047619, 'mean_word_length': 9.686440677966102, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '14772', 'license': 'MIT', 'n_tokens_mistral': 528, 'n_tokens_neox': 499, 'n_words': 83, 'path': 'shibayama2009.ipynb', 'repo_name': 'yonesuke/Birkhoff.py', 'size': '1260'}