There is pchip() in the (inofficial) package NumericalMath at https://github.com/hwborchers/NumericalMath.jl This implements a simplified version of piecewise cubic Hermite interpolation as described by Moler in one of his textbook chapters. Should work as expected in most cases.
On Wednesday, November 12, 2014 6:21:59 PM UTC+1, Nils Gudat wrote: > > I'm still playing around with Julia's interpolation options after the > pointers I got from Tim Holy and Kyle Barbary in this thread. > <https://groups.google.com/forum/#!topic/julia-users/57SztZSCjLc> > The one thing I haven't been able to do is a shape preserving > interpolation. In economics, the concavity of (say) a utility function is > often central to the problems at hand, and hence crucial to preserve during > interpolation. My attempts with some of the interpolation routines can be > found in this git, > <https://github.com/nilshg/LearningModels/blob/master/Test_Interpolations.jl> > but none of them really achieve what I want. The code on git should be self > contained and produces graphs displaying the interpolation of the function > -(1/x) in one dimension and -(1/(y+z)) in two dimensions on rather coarse > grids. > > As I see it, there are two issues with my approach: (i) using regular > grids is clearly not a great idea here, as all the curvature of the > function is between 0 and 10, while only few points would suffice to > reasonably approximate the function for large values of x, and (ii) > quadratic splines don't preserve concavity of the function. > > Are there any other packages in Julia that would support irregularly > spaced grids and/or do a shape-preserving interpolation, such as piecewise > cubic Hermite (like Matlab's pchip), biharmonic or thin splate (as in > Matlab's griddata)? > > Also, as you might be able to tell from the git, I haven't succeded in > using the ApproXD package, mainly because of the lack of documentation. > Does anyone have a simple example of how to use it? > > Many thanks, > Nils >