MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: restricting interpolating functions to be positive

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106436] Re: restricting interpolating functions to be positive
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 12 Jan 2010 04:51:00 -0500 (EST)

On 1/11/10 at 6:52 PM, google at dantimatter.com (dantimatter) wrote:

>I would like to construct an interpolation that can only take on
>positive values.  The data that I'm trying to interpolate is all
>positive, but for some reason the Interpolation[] function 'wants'
>to connect the dots by dipping below zero.

By default, Interpolation uses piecewise cubic polynomials to
fit your data. The coefficients of these polynomials are found
by selecting a sufficient number of consecutive (4 for cubics)
and solving for the needed coefficients. The dips below zero are
a consequence of using a 3 order polynomial and the specific
values of the data you are interpolating.

>Is there a way to force positivity?  Or should I simply adjust the
>InterpolationOrder until it works?

You really don't have much option here. If you reduce the
interpolating order to 1, and all of the data is positive you
are guaranteed all values of the resulting interpolation will be
positive. But this also means derivatives will not be continuous
which may or may not be a problem for you. Lack of continuity in
the first and second derivatives means a plot of the
interpolating function will not be smooth. No other
interpolation order is certain to only provide positive values
given positive data. Higher order interpolating polynomials are
more likely to dip below zero.

If you want continuous first and second derivatives (a smooth
interpolation) and only positive values, you either need to use
some other basis for interpolating your data than polynomials
such as a set of exponential terms or give up the requirement
the interpolating function pass through your data.

Using exponentials creates other problems. It transforms the
problem into one that will not have explicit algebraic solutions
for the coefficients. That means you will need iterative methods
which will only converge well if you provide sufficiently close
initial values as a starting point. Also, these methods tend not
to be very stable numerically when more than a few exponential
terms are required.

You can achieve smooth interpolating functions with cubic
polynomials using a smoothed natural cubic spline. If you are
interested in this approach, I've written a package for my use
which has the needed functions that I would be willing to send
you offline. Note, while this will yield a smooth function
(continuous first and second derivatives) it will not pass
through your data points when you require all positive values
for the range of your data.



  • Prev by Date: Re: Re: Re: Radicals simplify
  • Next by Date: Re: Inconsistency in different ways of calculating CDF of bivariate
  • Previous by thread: Re: restricting interpolating functions to be positive
  • Next by thread: Re: restricting interpolating functions to be positive