Motional Dynamics in Trapped Ions and Rydberg Atoms, and Hybrid Quantum Algorithm for Classical Optimization