Solved Task 1
This commit is contained in:
parent
7cb5f64f56
commit
0fb8b74d99
Binary file not shown.
|
@ -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
|
||||||
|
@ -29,22 +30,34 @@ def Serie8_Aufg2(A):
|
||||||
|
|
||||||
Q = np.eye(n)
|
Q = np.eye(n)
|
||||||
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.
Loading…
Reference in New Issue