The documentation for approxfun states that it is “often more useful than approx“. I’m struggling to get my head around approxfun. When would approxfun be more useful than approx (and when would approx be more useful)?
The documentation for approxfun states that it is often more useful than approx .
Share
approxreturns the value of the approximated function at (either) specified points or at a given number of points.approxfunreturns a function which can then be evaluated at some specific points. If you need the approximation at points that you know at the time of making the approximation,approxwill do that for you. If you need a function (in the mathematical sense) which will return the value of the approximation for some argument given later,approxfunis what you need.Here are some examples.
The output from
approxandapproxfunusing this dataMore examples of usage:
or another example where a function is needed: