Differential Dynamic Programming With Nonlinear Function