hamilton eqns - Maple Help

DEtools

 hamilton_eqs
 generate Hamilton equations

 Calling Sequence hamilton_eqs(H)

Parameters

 H - any algebraic expression representing the Hamiltonian

Description

 • hamilton_eqs receives a Hamiltonian and returns a sequence with Hamilton's equations and a list with the p's and q's involved.
 • Some useful conventions were adopted to represent the p's and q's. All p's and q's must appear as pn or qn where n is a positive integer, as in p1, p2, and the time dependence need not be explicit, as in pn or qn instead of pn(t) or qn(t). The Hamilton equations will be automatically returned using pn(t) or qn(t).
 • This function is part of the DEtools package, and so it can be used in the form hamilton_eqs(..) only after executing the command with(DEtools). However, it can always be accessed through the long form of the command by using DEtools[hamilton_eqs](..).

Examples

 > $\mathrm{with}\left(\mathrm{DEtools}\right):$

The Toda Hamiltonian

 > $H≔\frac{1}{2}\left({\mathrm{p1}}^{2}+{\mathrm{p2}}^{2}\right)+\frac{1}{24}\left(\mathrm{exp}\left(2\mathrm{q2}+2\mathrm{sqrt}\left(3\right)\mathrm{q1}\right)+\mathrm{exp}\left(2\mathrm{q2}-2\mathrm{sqrt}\left(3\right)\mathrm{q1}\right)+\mathrm{exp}\left(-4\mathrm{q2}\right)\right)-\frac{1}{8}$
 ${H}{≔}\frac{{{\mathrm{p1}}}^{{2}}}{{2}}{+}\frac{{{\mathrm{p2}}}^{{2}}}{{2}}{+}\frac{{{ⅇ}}^{{2}{}{\mathrm{q2}}{+}{2}{}\sqrt{{3}}{}{\mathrm{q1}}}}{{24}}{+}\frac{{{ⅇ}}^{{2}{}{\mathrm{q2}}{-}{2}{}\sqrt{{3}}{}{\mathrm{q1}}}}{{24}}{+}\frac{{{ⅇ}}^{{-}{4}{}{\mathrm{q2}}}}{{24}}{-}\frac{{1}}{{8}}$ (1)
 > $\mathrm{hamilton_eqs}\left(H\right)$
 $\left[\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{p1}}{}\left({t}\right){=}{-}\frac{\sqrt{{3}}{}{{ⅇ}}^{{2}{}{\mathrm{q2}}{}\left({t}\right){+}{2}{}\sqrt{{3}}{}{\mathrm{q1}}{}\left({t}\right)}}{{12}}{+}\frac{\sqrt{{3}}{}{{ⅇ}}^{{2}{}{\mathrm{q2}}{}\left({t}\right){-}{2}{}\sqrt{{3}}{}{\mathrm{q1}}{}\left({t}\right)}}{{12}}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{p2}}{}\left({t}\right){=}{-}\frac{{{ⅇ}}^{{2}{}{\mathrm{q2}}{}\left({t}\right){+}{2}{}\sqrt{{3}}{}{\mathrm{q1}}{}\left({t}\right)}}{{12}}{-}\frac{{{ⅇ}}^{{2}{}{\mathrm{q2}}{}\left({t}\right){-}{2}{}\sqrt{{3}}{}{\mathrm{q1}}{}\left({t}\right)}}{{12}}{+}\frac{{{ⅇ}}^{{-}{4}{}{\mathrm{q2}}{}\left({t}\right)}}{{6}}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{q1}}{}\left({t}\right){=}{\mathrm{p1}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{q2}}{}\left({t}\right){=}{\mathrm{p2}}{}\left({t}\right)\right]{,}\left[{\mathrm{p1}}{}\left({t}\right){,}{\mathrm{p2}}{}\left({t}\right){,}{\mathrm{q1}}{}\left({t}\right){,}{\mathrm{q2}}{}\left({t}\right)\right]$ (2)

The Henon-Heiles Hamiltonian

 > $H≔\frac{1}{2}\left({\mathrm{p1}}^{2}+{\mathrm{p2}}^{2}+{\mathrm{q1}}^{2}+{\mathrm{q2}}^{2}\right)+{\mathrm{q1}}^{2}\mathrm{q2}-\frac{{\mathrm{q2}}^{3}}{3}$
 ${H}{≔}\frac{{1}}{{2}}{}{{\mathrm{p1}}}^{{2}}{+}\frac{{1}}{{2}}{}{{\mathrm{p2}}}^{{2}}{+}\frac{{1}}{{2}}{}{{\mathrm{q1}}}^{{2}}{+}\frac{{1}}{{2}}{}{{\mathrm{q2}}}^{{2}}{+}{{\mathrm{q1}}}^{{2}}{}{\mathrm{q2}}{-}\frac{{1}}{{3}}{}{{\mathrm{q2}}}^{{3}}$ (3)
 > $\mathrm{hamilton_eqs}\left(H\right)$
 $\left[\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{p1}}{}\left({t}\right){=}{-}{2}{}{\mathrm{q1}}{}\left({t}\right){}{\mathrm{q2}}{}\left({t}\right){-}{\mathrm{q1}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{p2}}{}\left({t}\right){=}{-}{{\mathrm{q1}}{}\left({t}\right)}^{{2}}{+}{{\mathrm{q2}}{}\left({t}\right)}^{{2}}{-}{\mathrm{q2}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{q1}}{}\left({t}\right){=}{\mathrm{p1}}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{q2}}{}\left({t}\right){=}{\mathrm{p2}}{}\left({t}\right)\right]{,}\left[{\mathrm{p1}}{}\left({t}\right){,}{\mathrm{p2}}{}\left({t}\right){,}{\mathrm{q1}}{}\left({t}\right){,}{\mathrm{q2}}{}\left({t}\right)\right]$ (4)