Control and Optimization of Physical Systems: Quantum Dynamics and Magnetic Confinement in Stellarators