Quantum Gate And Quantum State Preparation Through Neighboring Optimal Control