fixed discretization bug.  optimized a few simple things using the profiler
brought pendulum value iteration parameters over from old example.  (and added wrapping)