A previously published temporal finite element method for optimal control p
roblems is updated to include higher-order hierarchical shape functions. Th
e accuracy and power of the analysis and corresponding code are illustrated
on optimal control problems with nonlinear system dynamics, using interfac
es based on symbolic mathematics to automatically generate the necessary de
rivative expressions and nonlinear algebraic equations to be solved. The cl
ass of problems includes those that can have free or fixed final time, mult
iple phases, nonlinear/periodic boundary conditions, and control constraint
s. This code has been tested on a variety of problems, culminating in a thr
ee-phase, seven-state, two-control missile problem with nonlinear system dy
namics, where accuracy was found to be significantly improved over h-versio
n results, with potential order-of-magnitude reductions in CPU time and num
bers of parameters for a given level of error.