Interpolation and Extrapolation part 4

c=vector(1,n); d=vector(1,n); hh=fabs(x-xa[1]); for (i=1;i | Cubic Spline Interpolation 113 c vector 1 n d vector 1 n hh fabs x-xa 1 for i 1 i n i h fabs x-xa i if h y ya i dy FREERETURN else if h hh ns i hh h c i ya i d i ya i TINY The TINY part is needed to prevent a rare zero-over-zero condition. y ya ns for m 1 m n m for i 1 i n-m i w c i 1 -d i h xa i m -x h will never be zero since this was tested in the initial- t xa i -x d i h izing loop. dd t-c i 1 if dd nrerror Error in routine ratint This error condition indicates that the interpolating function has a pole at the requested value of x. dd w dd d i c i 1 dd c i t dd y dy 2 ns n-m c ns 1 d ns FREERETURN CITED REFERENCES AND FURTHER READING Stoer J. and Bulirsch R. 1980 Introduction to Numerical Analysis NewYork Springer-Verlag . 1 Gear . 1971 Numerical Initial Value Problems in Ordinary Differential Equations Englewood Cliffs NJ Prentice-Hall . Cuyt A. and Wuytack L. 1987 Nonlinear Methods inNumerical Analysis Amsterdam North-Holland Chapter 3. Cubic Spline Interpolation Given a tabulated function yi y xi i focus attention on one particular interval between xj and xj 1. Linear interpolation in that interval gives the interpolation formula Sample page from NUMERICAL RECIPES IN C THE ART OF SCIENTIFIC COMPUTING ISBN 0-521-43108-5 y Ayj Byj i 114 Chapter 3. Interpolation and Extrapolation where A xj i - x xj i - xj PC PC X- j xj 1- xj B 1-A Equations and are a special case of the general Lagrange interpolation formula . Since it is piecewise linear equation has zero second derivative in the interior of each interval and an undefined or infinite second derivative at the abscissas xj. The goal of cubic spline interpolation is to get an interpolation formula that is smooth in the first derivative and continuous in the second derivative both within an interval and at its boundaries. Suppose contrary to fact that in addition to the tabulated values of yi we also have tabulated values for the function s .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.