Solved Task 1

This commit is contained in:
schrom01 2022-11-18 19:34:54 +01:00
parent 7cb5f64f56
commit 0fb8b74d99
3 changed files with 26 additions and 13 deletions

Binary file not shown.

View File

@ -14,10 +14,11 @@ Example: A = np.array([[1,2,-1],[4,-2,6],[3,1,0]])
@author: knaa @author: knaa
""" """
import numpy as np
def Serie8_Aufg2(A): def Serie8_Aufg2(A):
unknown = 0
import numpy as np
A = np.copy(A) #necessary to prevent changes in the original matrix A_in A = np.copy(A) #necessary to prevent changes in the original matrix A_in
A = A.astype('float64') #change to float A = A.astype('float64') #change to float
@ -31,20 +32,32 @@ def Serie8_Aufg2(A):
R = A R = A
for j in np.arange(0,n-1): for j in np.arange(0,n-1):
a = np.copy(???).reshape(n-j,1) a = np.copy(unknown).reshape(n-j,1)
e = np.eye(???)[:,0].reshape(n-j,1) e = np.eye(unknown)[:,0].reshape(n-j,1)
length_a = np.linalg.norm(a) length_a = np.linalg.norm(a)
if a[0] >= 0: sig = ??? if a[0] >= 0: sig = unknown
else: sig = ??? else: sig = unknown
v = ??? v = unknown
u = ??? u = unknown
H = ??? H = unknown
Qi = np.eye(n) Qi = np.eye(n)
Qi[j:,j:] = ??? Qi[j:,j:] = unknown
R = ??? R = unknown
Q = ??? Q = unknown
return(Q,R) return(Q,R)
if __name__ == '__main__':
A = np.array([
[1, -2, 3],
[-5, 4, 1],
[2, -1, 3]
])
b = np.array([
[1],
[9],
[5]
])
Serie8_Aufg2(A)

Binary file not shown.