# Ch-8-SVD를 이용한 총 인구수 예측

## 2227 days ago by matrix

A = matrix(18,3,[3705625,1925,1,3724900 ,1930,1,3744225 ,1935,1,3763600,1940,1,3783025,1945,1,3802500,1950,1,3822025,1955,1,3841600,1960,1,3861225,1965,1,3880900,1970,1,3900625,1975,1,3920400,1980,1,3940225,1985,1,3960100,1990,1,3980025,1995,1,4000000,2000,1,4020025,2005,1,4040100,2010,1]) B = A.transpose()*A Adagger = (B.inverse())*(A.transpose()) y = matrix(18,1,[1902,2044,2221,2355,2512,2017,2150,2499,2916,3144,3468,3741,4042,4339,4455,4599,4704,4799]) x = Adagger*y var('a,b') p1 = plot((47941/193800)*(a^2)-(12083533/12920)*a+3432483301/3876,a,1910,2020,color = 'blue'); show(p1)
A1 = A.submatrix(5,0,13,3) y1 = y.submatrix(5,0,13,1) B1 = A1.transpose()*A1 A1dagger = (B1.inverse())*(A1.transpose()) x1 = A1dagger*y1 print x1
 [ -22147/50050] [ 1640027/910] [-1831712580/1001] [ -22147/50050] [ 1640027/910] [-1831712580/1001]
A2 = matrix(14,3,[3802500,1950,1,3822025,1955,1,3841600,1960,1,3861225,1965,1,3880900,1970,1,3900625,1975,1,3920400,1980,1,3940225,1985,1,3960100,1990,1,3980025,1995,1,4000000,2000,1,4020025,2005,1,4040100,2010,1,4060225,2015,1]) y2 = y = matrix(14,1,[2017,2150,2499,2916,3144,3468,3741,4042,4339,4455,4599,4704,4799,5061.7]) B2 = A2.transpose()*A2 A2dagger = (B2.inverse())*(A2.transpose()) x2 = A2dagger*y2 print x2
 [ -0.408403846153846] [ 1667.59162362638] [-1.69697266928571e6] [ -0.408403846153846] [ 1667.59162362638] [-1.69697266928571e6]