# 插值

(重新導向自 內插法)

1. ${\displaystyle x_{1}=1}$${\displaystyle y_{1}=2}$
2. ${\displaystyle x_{2}=2}$${\displaystyle y_{2}=3}$
3. ${\displaystyle x_{3}=4}$${\displaystyle y_{3}=6}$

${\displaystyle x=3}$時的y值。

## 定義

${\displaystyle f(x)}$為定義在區間${\displaystyle [a,b]}$上的函數。${\displaystyle x_{1},x_{2},x_{3}...x_{n}}$${\displaystyle [a,b]}$上n個互不相同的點，${\displaystyle G}$為給定的某一函數類。若${\displaystyle G}$上有函數${\displaystyle g(x)}$滿足：

 ${\displaystyle g(x_{i})=f(x_{i}),k=1,2,...n}$


## 示例

 ${\displaystyle x}$ ${\displaystyle f(x)}$ 0 0 1 0 . 8415 2 0 . 9093 3 0 . 1411 4 −0 . 7568 5 −0 . 9589 6 −0 . 2794

## 方法

### 線性插值

${\displaystyle y=y_{a}+\left(y_{b}-y_{a}\right){\frac {x-x_{a}}{x_{b}-x_{a}}}{\text{ 在 點 }}\left(x,y\right)}$

${\displaystyle {\frac {y-y_{a}}{y_{b}-y_{a}}}={\frac {x-x_{a}}{x_{b}-x_{a}}}}$

${\displaystyle {\frac {y-y_{a}}{x-x_{a}}}={\frac {y_{b}-y_{a}}{x_{b}-x_{a}}}}$

${\displaystyle |f(x)-g(x)|\leq C(x_{b}-x_{a})^{2}\quad {\text{where}}\quad C={\frac {1}{8}}\max _{r\in [x_{a},x_{b}]}|g''(r)|.}$

### 多項式插值

Plot of the data with polynomial interpolation applied

${\displaystyle f(x)=-0.0001521x^{6}-0.003130x^{5}+0.07321x^{4}-0.3577x^{3}+0.2255x^{2}+0.9038x.}$

### 樣條曲線插值

Plot of the data with spline interpolation applied

${\displaystyle f(x)={\begin{cases}-0.1522x^{3}+0.9937x,&{\text{if }}x\in [0,1],\\-0.01258x^{3}-0.4189x^{2}+1.4126x-0.1396,&{\text{if }}x\in [1,2],\\0.1403x^{3}-1.3359x^{2}+3.2467x-1.3623,&{\text{if }}x\in [2,3],\\0.1579x^{3}-1.4945x^{2}+3.7225x-1.8381,&{\text{if }}x\in [3,4],\\0.05375x^{3}-0.2450x^{2}-1.2756x+4.8259,&{\text{if }}x\in [4,5],\\-0.1871x^{3}+3.3673x^{2}-19.3370x+34.9282,&{\text{if }}x\in [5,6].\end{cases}}}$

## 參考文獻

1. ^ 《數學手冊》編寫組，《數學手冊》，高等教育出版社，1979年