At extremely low temperatures, clouds of bosonic atoms form what is known as a Bose-Einstein condensate. Recently, it has become clear that many different types of condensates -- so called fragmented condensates -- exist. In order to tell whether fragmentation occurs or not, it is necessary to solve the full many-body Schrödinger equation, a task that remained elusive for experimentally relevant conditions for many years. In this thesis the first numerically exact solutions of the time-dependent many-body Schrödinger equation for a bosonic Josephson junction are provided and compared to the approximate Gross-Pitaevskii and Bose-Hubbard theories. It is thereby shown that the dynamics of Bose-Einstein condensates is far more intricate than one would anticipate based on these approximations. A special conceptual innovation in this thesis are optimal lattice models. It is shown how all quantum lattice models of condensed matter physics that are based on Wannier functions, e.g. the Bose/Fermi Hubbard model, can be optimized variationally. This leads to exciting new physics.