Cubic Spline Interpolation and Integration RRS feed

  • Question

  • Hope you can help me..............

    I have located a module written by David J Braden (1999) which purports to do the above.
    When I try to compile it under Visual C++ 2008 Express Edition I get 57 errors all from the first 36 lines which look like this

    Option Explicit

    ' This module contains routines for cubic spline interpolation and integration.

    ' Designed for Microsoft Excel 97 and beyond

    ' Written 1999/6/30, David J. Braden
    ' Revisions:
    '   1999/7/2    DJB     Made 2nd derivative at upper endpoint exact
    '                                 Tightened up input validation code
    '   1999/7/6    DJB     Streamlined (optional) error-checking

    ' About 20% of the code is for checking that input is valid, hence the length.
    ' If you "know" that input is always valid, set the compiler directive
    ' fValidateInput = True.

    ' To test:
    ' Into cells A3:A9, enter 1,2,3,4,5,6,7, and into B3:B9, enter 3,3,1,2,1,3,3.
    ' Into cell B1 enter =6/49 (we will go from 1 to 7 in 50 steps). Into Cell C1,
    ' enter 1; into C2, enter =C1+$B$1, and drag it down to C50. You should end up
    ' with 7. While there, go ahead and enter 7 into the last cell (to replace the
    ' proximal value). Select D1:G50 (thats right, 50 rows, 4 columns), in the
    ' formula bar type =SplineData(A3:B9,C1:C50), and do a control-shift-enter.  The
    ' first column is a cubic spline interpolation of your data; each subsequant
    ' column is a higher-order derivative.  Of course you dont need to return so much
    ' data. If you want the cubic-spline interpolation at a single point, no problem:
    ' specify a single point.  If you want more information about the behavior of the
    ' fitted function evaluated at that point, select up to 4 contiguous cells in the
    ' same row, and go for it.  If you want to know some info about one of the
    ' derivatives of such a fit, INDEX is very useful.

    ' For the integral, enter =SplineIntegrate(A3:B9) into a cell. You have the option
    ' of specifying limits, of course.

    ' Both functions have optional specification of end-point first derivatives.

    #Const fReportErrors = False

    The errors are C2061, C2059, [C2001, C2015] repeated many times

    Any suggestions on what I should do to allow this module to compile cleanly?
    Thursday, December 11, 2008 11:29 PM