The application of the method of phase-amplitude functions for calculating the X-ray or neutron reflectivity from planar nanostructures is considered. Several approximations and substitutions are described, which can be useful for different problems. It is shown that this method can be used to calculate reflection curves with lower computational costs than in other approaches. Comparison of model numerical calculations for various algorithms is presented. The Levenberg-Marquardt algorithm is used to solve the inverse problem and reconstruct the scattering potential of a metal film from the experimental reflection intensity. Experimental results are presented for two systems: Al2O3//Cr(200 Å) film and Al2O3//Cr(100 Å)/[Gd(50 Å)/Cr(11 Å)]6/Cr(100 Å) metal superlattice. The obtained scattering potentials allow us to draw conclusions about the layered structures of the samples and determine their dependence on growth conditions.