Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg106455] Re: restricting interpolating functions to be positive
  • From: Noqsi <jpd at noqsi.com>
  • Date: Wed, 13 Jan 2010 05:58:01 -0500 (EST)
  • References: <higdjs$kfi$1@smc.vnet.net>

On Jan 11, 4:52 pm, dantimatter <goo... at dantimatter.com> wrote:
> Hi All,
>
> 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.  Is there a way to force
> positivity?  Or should I simply adjust the InterpolationOrder until it
> works?

One way is to transform the data. Choose a positive real function f,
apply its inverse to the data. Tranform the interpolation back using
f.

Exp[] often is a good choice for f. Using Valeri's example data:

data = {{0, 2}, {1, 1}, {2, .2}, {3, .01}, {4, 1}, {5, 0.9}, {6,
   0.05}, {7, 0.1}, {8, 1}}
logdata = data /. {x_, y_} -> {x, Log[y]}
interp[x_] = Exp[Interpolation[logdata][x]]

If you plot interp[x], you'll see that it avoids zero.


  • Prev by Date: Re: Program Generation of Mathematica Code
  • Next by Date: Re: restricting interpolating functions to be positive
  • Previous by thread: Re: restricting interpolating functions to be positive
  • Next by thread: Re: Re: restricting interpolating functions to be positive