22 lines
574 B
Python
22 lines
574 B
Python
|
import numpy as np
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
|
||
|
A = np.array([[1,0,2],
|
||
|
[0,1,0],
|
||
|
[1e-4,0,1e-4]])
|
||
|
b_exact = np.array([[1],[1],[0]])
|
||
|
b_approx = np.array([[1],[1],[1.67e-7]])
|
||
|
print("Inverse von A:\n", np.linalg.inv(A))
|
||
|
x_exact = np.linalg.solve(A,b_exact)
|
||
|
print(x_exact)
|
||
|
x_approx = np.linalg.solve(A,b_approx)
|
||
|
print(x_approx)
|
||
|
print(x_exact-x_approx)
|
||
|
|
||
|
print("Task 1 d:")
|
||
|
|
||
|
print(60003*(3e-7/3))
|
||
|
print((60003/(1-0.0060003))*((3e-7/3)+(1.67e-7/1)))
|
||
|
print(((0.01*(1-0.0060003))/60003)-(3e-7/3))
|