def analysis.C2Functions._spline_extension (   x,
  y,
  y2,
  xmin = None,
  xmax = None 
) [private]

compute the correct coefficients and insert them to allow spline extrapolation

Parameters:
x the array of abscissas for an already existing spline
y the array of ordinates for an already existing spline
x the array of spline coefficients for an already existing spline
xmin the lower bound to which extrapolation should be permitted (None if no lower extension)
xmax the upper bound to which extrapolation should be permitted (None if no upper extension)
Returns:
new arrays x, y, y'' with extesions added
x, y, y2 = spline_extension(x_vals,y_vals, y2vals, xmin=None, xmax=None) 
returns the x, y, y2 table for the spline as needed by splint() with adjustments to allow quadratic extrapolation 
outside the range x[0]-x[-1], from xmin (or x[0] if xmin is None) to xmax (or x[-1] if xmax is None),
working from x, y, y2 from an already-created spline

Definition at line 993 of file C2Functions.py.

00993                                                      :
00994     """x, y, y2 = spline_extension(x_vals,y_vals, y2vals, xmin=None, xmax=None) 
00995     returns the x, y, y2 table for the spline as needed by splint() with adjustments to allow quadratic extrapolation 
00996     outside the range x[0]-x[-1], from xmin (or x[0] if xmin is None) to xmax (or x[-1] if xmax is None),
00997     working from x, y, y2 from an already-created spline"""
00998 
00999     xl=[x]
01000     yl=[y]
01001     y2l=[y2]
01002     
01003     if xmin is not None:
01004         h0=x[1]-x[0]
01005         h1=xmin-x[0]
01006         yextrap=y[0]+((y[1]-y[0])/h0 - h0*(y2[0]+2.0*y2[1])/6.0)*h1+y2[0]*h1*h1/2.0
01007         yl.insert(0, (yextrap,))
01008         xl.insert(0, (xmin,))
01009         y2l.insert(0, (y2[0],))
01010 
01011     if xmax is not None:
01012         h0=x[-1]-x[-2]
01013         h1=xmax-x[-1]
01014         yextrap=y[-1]+((y[-1]-y[-2])/h0 + h0*(2.0*y2[-2]+y2[-1])/6.0)*h1+y2[-1]*h1*h1/2.0
01015         yl.append((yextrap,))
01016         xl.append((xmax,))
01017         y2l.append((y2[-1],))
01018 
01019     return _numeric.concatenate(xl), _numeric.concatenate(yl), _numeric.concatenate(y2l)
01020 
##


Generated on Wed Nov 21 10:18:31 2007 for analysis by  doxygen 1.5.4