This project has moved. For the latest updates, please go here.

Convenience interpolators

Jan 26, 2014 at 7:19 PM
Edited Jan 26, 2014 at 7:25 PM
I defined a convenience interpolator as an interpolation algorithm wrapped in a transform function. These interpolators follow this template:
class WrappedInterpolator
     Func<double,double> _func;
     Func<double,double> _inverse; 
     IIntepolation _underlyingInterp; 
     Func<IEnumerable<double>, IEnumerable<double>, IIntepolation> _interpCreator;

     WrappedInterpolator(IEnumerable<double> sampleX, IEnumerable<double> sampleY)
          var transformY = sampleY.Select(i => _func(i));
          _underlyingInterp = _interpCreator(sampleX, transformY);

     double Interpolate(double t)
            return _inverse(_underlyingInterp(t));
An example would be the LogLinear interpolator.

Do you want to add this to the framework?

If no, is it possible to make the top level Interpolation partial to allow these interpolators added to the framework in a local branch?
Jan 28, 2014 at 8:28 AM
Hi Candy,

So the general idea is to interpolate in a transformed space, i.e. f^-1(interp(x, f(y))?

Yes, we could add that. I guess log might be a common use case though, so we could also consider adding a specialized LogTransformedInterpolation wrapper that is hard-coded to Log/Exp but could also support derivatives out of the box (if the inner interpolation supports it), even though we would loose integration support. What do you think?

Jan 28, 2014 at 1:25 PM
Maybe we can add an abstract class TransformedInterpolation to capture the idea, then a concrete class for each commonly used transform. Yes we will lose integration by default, but not every single implementation supports integration anyway.

How about the top level Interpolate though? Do you think we should make it partial for users to incorporate their own interpolators which the project may not necessarily want to include? Maybe we could make it a lookup, <string, IInterpolation>. The framework can install default implementations. Users can add and overwrite?