Sub Ex_Polint()
Const N As Long = 4
Dim X(N - 1) As Double, Y(N - 1) As Double, C(N - 1) As Double
Dim Xe As Double, Ye As Double, Yep(0) As Double
Dim Info As Long
'-- Data
X(0) = 0.1: Y(0) = -2.3026
X(1) = 0.11: Y(1) = -2.2073
X(2) = 0.12: Y(2) = -2.1203
X(3) = 0.13: Y(3) = -2.0402
'-- Polynomial interpolation
Call
Polint(N, X(), Y(), C(), Info)
If Info <> 0 Then
Debug.Print "Error in
Polint: Info =", Info
Exit Sub
End If
'-- Compute interpolated values
Xe = 0.115
Call
Polyvl(1, Xe, Ye, Yep(), N, X(), C(), Info)
Debug.Print "ln(" + CStr(Xe) + ") =", Ye
Debug.Print "ln'(" + CStr(Xe) + ") =", Yep(0)
Debug.Print "Info =", Info
End Sub
Sub Polyvl(Nder As Long, XX As Double, Yfit As Double, Yp() As Double, N As Long, X() As Double, C() As Double, Info As Long)
Value of polynomial and derivatives
Sub Polint(N As Long, X() As Double, Y() As Double, C() As Double, Info As Long)
Polynomial interpolation