The evolution of nuclear spin magnetization during a radiofrequency pulse in the absence of relaxation or coupling interactions can be described by three Euler angles. The Euler angles in turn can be obtained from the solution of a Riccati differential equation; however, analytic solutions exist only for rectangular and chirp pulses. The Homotopy Analysis Method is used to obtain new approximate solutions to the Riccati equation for shaped radiofrequency pulses in NMR spectroscopy. The results of even relatively low orders of approximation are highly accurate and can be calculated very efficiently. The results are extended in a second application of the Homotopy Analysis Method to represent relaxation as a perturbation of the magnetization trajectory calculated in the absence of relaxation. The Homotopy Analysis Method is powerful and flexible and is likely to have other applications in magnetic resonance.