  We consider a gradient approximation scheme that is based on applying needle
shaped inputs. By using ideas known from the classic proof of the Pontryagin
Maximum Principle we derive an approximation that reveals that the considered
system moves along a weighted averaged gradient. Moreover, based on the same
ideas, we give similar results for arbitrary periodic inputs. We also present a
new gradient-based optimization algorithm that is motivated by our calculations
and that can be interpreted as a combination of the heavy ball method and
Nesterov's method.
