Various theoretical methods for calculating diffraction profiles of perfect crystals are available in literature. Although these methods hold within certain validity ranges due to their inherent approximations, they constitute the current state-of-the-art of numerical computation of diffraction profiles. In this paper we summarize the theory of Zachariasen for flat crystals, the multi-lamellar approximation for bent crystals and the Penning-Polder approximation for bent Laue crystals. Some examples of their results are presented. Another method to calculate the diffraction profile consists in solving the Takagi-Taupin equations. The finite difference method, that provides a numerical solution of these equations, is briefly discussed. A new method for solving numerically these equations using the finite element method is proposed. This method is very flexible, because it can consider a crystal with an arbitrary shape and cover the case of critical regime (i.e., inhomogeneities and deformations) with fine elements. In addition, it can couple naturally the diffraction calculation with thermal or mechanical crystal deformations. These deformations are generally induced by the x-ray beam (heat load), the crystal bender (mechanical stress) or are intrinsic to the crystal (inhomogeneities, impurities, dislocations, etc.). An example of the feasibility of this method is shown.