MathGroup Archive 2004

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

Search the Archive

Re: [Splines] Defining piecewise functions over a variable number of intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52724] Re: [Splines] Defining piecewise functions over a variable number of intervals
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 11 Dec 2004 05:21:18 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 12/9/04 at 8:22 PM, phloam at myrealbox.com (m0NoiD) wrote:

>I know you can define a function piecewise with If[] statements,
>and even better with Which[].  I am wondering if there is a way to
>construct a piecewise function when the number of intervals is not
>known in advance.

>I am trying to find a way to compute cubic splines for any number
>of data points.  The data points will be the input.  Then it will
>compute the coefficients of the polynomials.

>The thing I then need is a subroutine which will take any number of
>coefficients as input and construct piecewise cubic polynomials.

>I am looking for the most efficient way to do this.  I am guessing
>it will require some sort of pattern matching, but I am not sure so
>that is why I need help.

There are fairly efficient algorithms for computing a natural cubic spline that do not require pattern matching. Take a look at the code in NumericalMath`SplineFit` for an example. In fact, if all you need is a cubic spline to represent a set of points, the function SplineFit in that package already does this.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: a strange line of code
  • Next by Date: Re: a strange line of code
  • Previous by thread: Re: [Splines] Defining piecewise functions over a variable number of intervals
  • Next by thread: Problem with linken general differential equations