Conservative Dynamical Systems of 1DoF
Oscillations around equilibria

Example 1:   V[x]=x^2+(1/x) Exp[x^2/4]

Clear["Global`*"]

V[x_]=x^2+(1/x) Exp[x^2/4]
Plot[V[x],{x,0.05,3}, PlotRange->{0,20}]

Equilibrium and stability

f[x_]=-D[V[x],x] //Simplify
Solve[f[x]==0,x]

numsol=FindRoot[f[x]==0,{x,0.5}]
x10=x/.numsol[[1]]

k=D[V[x],{x,2}] /.x->x10

Period of oscillations near equilibrium

Period=2 Pi /Sqrt[k]

Oscillations

deq=x''[t]==f[x[t]]

x0=0.75; y0=0; tmax=10;
sol=NDSolve[{deq,x[0]==x0, x'[0]==y0}, x,{t,0,tmax}]
xt=x[t]/.sol[[1]]
Plot[xt,{t,0,tmax}]

Energy, bounds and Period

Energy0=V[x10] (* energy of Equilibrium point *)
Energy=(1/2)y0^2+V[x0]  (* energy of initial conditions near the equilibrium point *)

delta=0.01;  (*small number*)
xmin=x/.FindRoot[Energy-V[x]==0,{x,x10-delta}]
xmax=x/.FindRoot[Energy-V[x]==0,{x,x10+delta}]

period=2*NIntegrate[(2*(Energy-V[x]))^(-1/2),{x,xmin,xmax}]

Trajectory

yt=D[xt,t]
ParametricPlot[{xt,yt},{t,0,period}, AspectRatio->Automatic]

Trajectory as Energy contour

EnergyFunction=y^2/2+V[x]
ContourPlot[EnergyFunction,{x,0.73,0.77},{y,-0.02,0.02}, Contours->{Energy,Energy0+0.0000001}, ContourShading->False, PlotPoints->100]

Phase Portrait

Plot[{V[x],2.1,4,6,10,15,20},{x,0.05,4}]
ContourPlot[EnergyFunction,{x,0.01,4},{y,-6,6}, Contours->{2.1,4,6,10,15,20}, ContourShading->False, PlotPoints->100]