What “smooth” plot interpolation algorithm does pgfplots use?

In the pgfplots manual it says:

Smooth plots interpolate smoothly between successive points.

In order to choose the right sampling of points from a function evaluation for plotting, I need to know with some detail what is the "interpolation" that "smooth plot" actually pgfplots (or tikz) implements.

For example, is it cubic splines (probably not), Akima splines, home brew? If it is not a standard one, what properties does it have? continuity, continuity of first derivative, second derivative, monotonicity, maximum tolerated curvature?

• I wonder if this is the same "smooth" as the option in TikZ, e.g. \draw plot[id=sin,smooth] function{sin(x)};. – N.N. Jul 8 '11 at 10:34
• @N.N.: It is. PGFplots uses the TikZ \draw plot function to do the actual plotting. – Jake Jul 8 '11 at 10:44
• Thanks, in that case: What is the “smooth” plot interpolation algorithm in tikz? – alfC Jul 8 '11 at 10:48
• @alfC: It uses cubic bézier curves to connect the points of your plot, with the two supports for each point calculated using a relatively simple algorithm that takes the previous and next point into account. Do you want more detail on the algorithm used for determining the supports, or do you already know that this makes TikZ' plotting capabilities unsuitable for you purpose? – Jake Jul 8 '11 at 11:08
• @Jake: I think that is enough information for the complexity of the sampling algorithm I wanted to implement. I think that given the cubic-bezier then there is no simple best adaptive sampling that I can implement quickly. For linear interpolation (i.e. no-smooth) the optimal sampling is given by recursive trapezoidal but for cubic bezier I guess recursive simpson will do at least part of the job. The idea was to plot functions with minimal evaluation points and pdf size the goal being a good resulting "visual plot". – alfC Jul 8 '11 at 22:13