Compare commits
3 commits
5e7027974f
...
40a77ae260
Author | SHA1 | Date | |
---|---|---|---|
40a77ae260 | |||
111ae51feb | |||
09df534f35 |
3 changed files with 7 additions and 6 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Python Cache
|
||||
__pycache__/
|
|
@ -31,8 +31,8 @@ def Miguel_S5_Aufg2(x, y, xx):
|
|||
A[i][i] = 2 * (h[i] + h[i + 1])
|
||||
z[i] = 3 * (((y[i + 2] - y[i + 1]) / h[i + 1]) - ((y[i + 1] - y[i]) / h[i]))
|
||||
|
||||
if i < n - 3:
|
||||
A[i][i + 1] = h[i + 1]
|
||||
if i < n - 3:
|
||||
A[i][i + 1] = h[i + 1]
|
||||
|
||||
c[1:n - 1,:] = linalg.solve(A, z)
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ from matplotlib import pyplot
|
|||
from numpy import array, polyfit, polyval
|
||||
from scipy import interpolate
|
||||
|
||||
x = array([1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 19100, 19110])
|
||||
x = array([1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010])
|
||||
y = array([75.995, 91.972, 105.711, 123.203, 131.669, 150.697, 179.323, 203.212, 226.505, 249.633, 281.422, 308.745])
|
||||
xx = array([17, 25, 41, 56, 72, 98, 100, 108])
|
||||
xx = array([1917, 1925, 1941, 1956, 1972, 1998, 2000, 2008])
|
||||
|
||||
# a)
|
||||
|
||||
|
@ -23,8 +23,7 @@ pyplot.figure()
|
|||
pyplot.scatter(xx, polyval(polyfit(x, y, deg = 11), xx))
|
||||
|
||||
# c) 2
|
||||
x[:] -= 1900
|
||||
pyplot.figure()
|
||||
pyplot.scatter(xx, polyval(polyfit(x, y, deg = 11), xx))
|
||||
pyplot.scatter(xx - 1900, polyval(polyfit(x - 1900, y, deg = 11), xx - 1900))
|
||||
|
||||
# %%
|
||||
|
|
Loading…
Reference in a new issue