Weak Formulation for Solving Inverse Problems in Reproducing Kernel Hilbert Spaces (With Applications to Learning Dynamical Systems)