Const N = 14, M = 2, Q = 3 ' number of points and M.R. polynom degree Dim As Double X(0 to N) = {1.47,1.50,1.52,1.55,1.57, _ 1.60,1.63,1.65,1.68,1.70,1.73,1.75,1.78,1.80,1.83} ' data points Dim As Double Y(0 to N) = {52.21,53.12,54.48,55.84,57.20, _ 58.57,59.93,61.29,63.11,64.47,66.28,68.10,69.92,72.19,74.46} ' data points Dim As Double S(N), T(N) ' linear system coefficient Dim As Double A(M, Q) ' sistem to be solved Dim As Integer i, k, j, fila, columna Dim as Double z For k = 0 To 2*M S(k) = 0 : T(k) = 0 For i = 0 To N S(k) += X(i) ^ k If k <= M Then T(k) += Y(i) * X(i) ^ k Next i Next k ' build linear system For fila = 0 To M For columna = 0 To M A(fila, columna) = S(fila+columna) Next columna A(fila, columna) = T(fila) Next fila Print "Linear system coefficents:" For i = 0 To M For j = 0 To M+1 Print Using "######.#"; A(i,j); Next j Print Next i For j = 0 To M For i = j To M If A(i,j) <> 0 Then Exit For Next i If i = M+1 Then Print !"\nSINGULAR MATRIX '" Sleep: End End If For k = 0 To M+1 Swap A(j,k), A(i,k) Next k z = 1 / A(j,j) For k = 0 To M+1 A(j,k) = z * A(j,k) Next k For i = 0 To M If i <> j Then z = -A(i,j) For k = 0 To M+1 A(i,k) += z * A(j,k) Next k End If Next i Next j Print !"\nSolutions:" For i = 0 To M Print Using " #####.#######"; A(i,M+1); Next i Sleep