An Inverse Kinematics Solution for Flexible Manipulators Using Learning Algorithm