Problem 2 on Hamiltonian Systems worksheet

Watch how the Hamiltonian function changes as the parameter a changes from negative to positive:

Manipulate[ Plot3D[y^2/2 + a*x - x^3/3,{x,-5,5},{y,-5,5},AxesLabel->Automatic,MeshFunctions->{#3&}], {a, -10,5} ]

Here is the 2D plot of the level curves as the parameter a changes. Equilibrium points are plotted as purple dots.

Manipulate[ Show[
ContourPlot[ y^2/2 + a*x - x^3/3, {x,-5,5},{y,-5,5}],Graphics[{PointSize[Large],Purple, Point[ If[a≥ 0,{{Sqrt[a],0},{-Sqrt[a],0}},{}] ]}]
], {a, -5,5} ]