<commit_before>---
layout: post
title: Interpolation by Spline Functions and Others
categories: [Numerical Method]
tags: []
fullview: true
comments: true
---
>**Firstly**,because of the arrangement of the textbook,I read the parts of Least-Square line priory to interpolation by spline function,so I note the introduction of Least-Square line firstly.
Linear function has the form:$y=f(x)=Ax+B$
So,how to find the best approximation of such form that goes near the points?Errors is a vital concept.The error is defined as $e_k=f(x_k)-y_k$

>**There** are 3 kinds of errors:

>1. Maximum error:$E_{\infty}(f)=max\{|f(x_k)-y_k|\}$

>2. Average error:$E_1(f)=\frac{1}{N}\sum_{k=1}^{N}|f(x_k)-y_k|$

>3. Root-Mean-Square error:$E_2(f)=[\frac{1}{N}\sum_{k=1}^{N}(f(x_k)-y_k)^2]^\frac{1}{2}$

>**Since** the 3rd norm is easier to be minimized computationally,it is the traditon choice.

>**Theorem 5.1 (Least-Square Line)**. Suppose that $$\{(x_{k},y_{k})\}_{k=1}^N$$ are N points,where the abscissas $$\{x_k\}^{N}_{k=1}$$ are distinct.The coefficients of the least-squares line:
$$
y=Ax+B
$$

>are the solution to the following linear system(**normal equation**)

>$$
A\sum^{N}_{k=1}x_k^2+B\sum^{N}_{k=1}x_k=\sum^{N}_{k=1}x_ky_k. 
$$

>
$$
A\sum^{N}_{k=1}x_k+NB=\sum^{N}_{k=1}y_k<commit_msg>20160420zo<commit_after>---
layout: post
title: Interpolation by Spline Functions and Others
categories: [Numerical Method]
tags: []
fullview: true
comments: true
---
>**Firstly**,because of the arrangement of the textbook,I read the parts of Least-Square line priory to interpolation by spline function,so I note the introduction of Least-Square line firstly.
Linear function has the form:$y=f(x)=Ax+B$
So,how to find the best approximation of such form that goes near the points?Errors is a vital concept.The error is defined as $e_k=f(x_k)-y_k$

>**There** are 3 kinds of errors:

>* Maximum error:$E_{\infty}(f)=max\{|f(x_k)-y_k|\}$

>* Average error:$E_1(f)=\frac{1}{N}\sum_{k=1}^{N}|f(x_k)-y_k|$

>* Root-Mean-Square error:$E_2(f)=[\frac{1}{N}\sum_{k=1}^{N}(f(x_k)-y_k)^2]^\frac{1}{2}$

>**Since** the 3rd norm is easier to be minimized computationally,it is the traditon choice.

>**Theorem 5.1 (Least-Square Line)**. Suppose that $$\{(x_{k},y_{k})\}_{k=1}^N$$ are N points,where the abscissas $$\{x_k\}^{N}_{k=1}$$ are distinct.The coefficients of the least-squares line:
$$
y=Ax+B
$$

>are the solution to the following linear system(**normal equation**)

>$$
A\sum^{N}_{k=1}x_k^2+B\sum^{N}_{k=1}x_k=\sum^{N}_{k=1}x_ky_k. 
$$

>
$$
A\sum^{N}_{k=1}x_k+NB=\sum^{N}_{k=1}y_k
{'fraction_non_alphanumeric': 0.19485580670303976, 'fraction_numerical': 0.020654715510522212, 'mean_word_length': 5.650259067357513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2261205', 'n_tokens_mistral': 1044, 'n_tokens_neox': 988, 'n_words': 264}