NAG algorithms for the approximation of functions and data