Mat/Wrzodak_Koszarek_Zadania.ipynb
2023-06-14 19:44:46 +02:00

4.6 KiB
Raw Blame History

Zadanie 4.6

import numpy as np
from sympy import symbols, Matrix
from numpy.linalg import eig

A=np.matrix(QQ,5,3,[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 31])
print(A.transpose()*A)
print((A.transpose()*A)^(-1))
mm=(A.transpose()*A)^(-1)
mm=(A.transpose()*A)^(-1)*A.transpose()
print(mm)

b1=np.vector([-1,0,1,0,1])
mm1=mm*b1
print(mm1)
print((b1-A*mm1))
b2=np.vector([1,1,1,1,1])
mm2=mm*b2
print(mm2)
print((b2-A*mm2))

b2 in (m.transpose()).image()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[1], line 5
      2 from sympy import symbols, Matrix
      3 from numpy.linalg import eig
----> 5 A=np.matrix(QQ,5,3,[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 31])
      6 print(A.transpose()*A)
      7 print((A.transpose()*A)^(-1))

NameError: name 'QQ' is not defined

Zadanie 4.7

zb1=[(1,1),(2,3),(4,5)]
zb2=[(1,1),(2,3),(3,4),(4,5),(5,7),(6,9)]

m1=matrix(3,2,[1,exp(1.0),1,exp(2.0),1,exp(4.0)])
m2=matrix(6,2,[1,exp(1.0),1,exp(2.0),1,exp(3.0),1,exp(4.0),1,exp(5.0),1,exp(6.0)])

a,b,t=var('a,b,t')

m1*vector([a,b])-vector([1,3,5])
m2*vector([a,b])-vector([1,3,4,5,7,9])



M1=m1.transpose()*m1
M1.det()



M2=m2.transpose()*m2
M2.det()



M1^(-1)*m1.transpose()*vector([1,3,5])

M2^(-1)*m2.transpose()*vector([1,3,4,5,7,9])


plot(1.64148598265947+ 0.0629860338045423*exp(t),(t,0,4))+sum([point(x) for x in zb1])

plot(3.10041190358990+ 0.0163320609303546*exp(t),(t,0,6))+sum([point(x) for x in zb2])

Zadanie 4.9

m=matrix(3,3,[1,1,0,1,2,2,0,2,3])

eigenvalues = np.m.eigvals(matrix)

eigen=m.right_eigenvectors()
e1=eigen[0][1][0]
e2=eigen[1][1][0]
print(e1.dot_product(e2))
e3=eigen[2][1][0]
print(e3.dot_product(e1))
print(e2.dot_product(e3))