In this article, we describe the mathematical framework of the computational model at the core of the tool The Virtual Brain (TVB), designed to simulate collective whole brain dynamics by virtualizing brain structure and function, allowing simultaneous outputs of a number of experimental modalities such as electro- and magnetoencephalography (EEG, MEG) and functional Magnetic Resonance Imaging (fMRI). The implementation allows for a systematic exploration and manipulation of every underlying component of a large-scale brain network model (BNM), such as the neural mass model governing the local dynamics or the structural connectivity constraining the space time structure of the network couplings. Here, a consistent notation for the generalized BNM is given, so that in this form the equations represent a direct link between the mathematical description of BNMs and the components of the numerical implementation in TVB. Finally, we made a summary of the forward models implemented for mapping simulated neural activity (EEG, MEG, sterotactic electroencephalogram (sEEG), fMRI), identifying their advantages and limitations.