# pendulum energy function, contour plot
t = 3.14/6
phidot = 1 
V(q) = q*cos(t) - (q*sin(t))**2 * phidot**2 / 2
T(qd) = 0.5*qd*qd
E(q,qd) = T(qd) + V(q)
L(q,qd) = T(qd) - V(q)

set cntrpa levels incremental -4,0.21,4.0
set hidden3d

set size 1,1
set surface
set nocontour
set ticslevel 0
# first is tilt, second is xy rotn was 130
set view 67,40
#set view
set xlabel "q"
set ylabel "q-dot"
set nokey
set key
set xrange [0:8]
set yrange [-2.5:2.5]
set zrange [-2.3:4]
set isosamples 30,30
set samples 100,100

# set title "T"
# (q,q')"
splot T(y) t 'Teff' w l 1 1 , 0 t '' w l 8 8
pause -1 'T'
# set title "V"
# (q,q')"
splot V(x) t 'Veff' w l 3 3 , 0 t '' w l 8 8
pause -1 'Veff'
#
# set title "T,V"
splot  T(y)  t 'Teff'  w l 1 1, V(x)  t 'Veff'  w l 3 3
pause -1 'Veff'

splot L(x,y) t 'The Lagrangian L' w l 5 5    , 0 t '' w l 8 8
pause -1 'L'
splot E(x,y) t 'The Hamiltonian H' w l 5 5  
pause -1 'H'
set nokey
set contour base
replot
pause -1 'H'
set nosurface
#set nokey
set nohidden3d
set contour surf
#replot
#pause -1 'H'
set contour base
replot
pause -1 'H'

###########
# again
###########
set samples 220,220
set nokey 
set hidden3d

set size 0.8,1.24
set view 180,0
set contour base
set nosurface

set nokey
#set title "H = T + V"
set title
# (q,q')"
splot E(x,y)  w l 3 3
pause -1 'H'




#splot L(x,y)  w l 3 3
#pause -1 'L'




