interpolation
- L. Olson
Department of Computer Science University of Illinois at Urbana-Champaign
1
interpolation L. Olson Department of Computer Science University - - PowerPoint PPT Presentation
interpolation L. Olson Department of Computer Science University of Illinois at Urbana-Champaign 1 semester plan Tu Nov 10 Least-squares and error Th Nov 12 Case Study: Cancer Analysis Tu Nov 17 Building a basis for approximation
Department of Computer Science University of Illinois at Urbana-Champaign
1
2
3
4
a |f(t) − g(t)|2 dt
5
6
i + · · · + anxn i = yi
0 + · · · + anxn 0 = y0
1 + · · · + anxn 1 = y1
2 + · · · + anxn 2 = y2
3 + · · · + anxn 3 = y3
n + · · · + anxn n = yn
7
1
1
2
2
n
n
8
1 year = np.array([1986, 1988, 1990, 1992, 1994, 1996]) 2 price= np.array([133.5, 132.2, 138.7, 141.5, 137.6,
3 4 M = np.vander(year) 5 a = np.linalg.solve(M,price) 6 7 x = np.linspace(1986,1996,200) 8 p = np.polyval(a,x) 9 plt.plot(year,price,’o’,x,p,’-’) 9
10
11
1 3 1 4
4)(x − 1)
3 − 1 4)( 1 3 − 1)
3)(x − 1)
4 − 1 3)( 1 4 − 1)
3)(x − 1 4)
3)(1 − 1 4)
12
n
n
13
(x−x1)(x−x2) (x0−x1)(x0−x2)
(2)(−1)
(x−x0)(x−x2) (x1−x0)(x1−x2)
(−2)(−3)
(x−x0)(x−x1) (x2−x0)(x2−x1)
(1)(3)
14
15
16
i + · · · + anxn i = yi
1
1
n
n
17
n
n
18
19
20
21
n
n
22
23
24
25