Inverse Optimal Control For Robot Arm Motions