Sharedjelecevic_vinkovic.sagewsOpen in CoCalc

Linearna algebra

Zadatak 1

Zadajte simboličke matrice

\mathbf{A}=\left[\begin{array}{cc}a_{11}&a_{12}\\ a_{21} & a_{22}\end{array}\right],\quad \mathbf{B}=\left[\begin{array}{cc}b_{11}&b_{12}\\ b_{21} & b_{22}\end{array}\right],
te izračunajte matricu \mathbf{C} definiranu izrazom
\mathbf{C}=\mathbf{AB}-\mathbf{BA}.
 Kada bi \mathbf A i \mathbf B bili brojevi a ne matrice, kolika bi bila vrijednost \mathbf C ?

Matrica je pravokutna tablica brojeva. Matrica reda m x n ima m redaka i n stupaca. Zadana matrica \mathbf{A} je reda 2x2. Vidi ovaj link, ali ne ovaj !

A = matrix(2, 2, var('a11', 'a12', 'a21', 'a22'))
show(A)
show(A*A)  # Matrice se mogu množiti pod određenim uvjetima na njihove redove (detaljnije ćete vidjeti u Matematici 1) i rezultat množenja je opet matrica. Umnožak dvije matrice A i B realiziramo koristeći operator * , isto kao i kod množenja brojeva, A*B

# Matrice istog reda se mogu i zbrajati i oduzimati korištenjem standarnih operatora + i - i rezultat ovih operacija je opet matrica

B = matrix(2, 2, var('b11', 'b12', 'b21', 'b22'))
show(B)

C = A*B - B*A
show(C)
\displaystyle \left(\begin{array}{rr} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array}\right)
\displaystyle \left(\begin{array}{rr} a_{11}^{2} + a_{12} a_{21} & a_{11} a_{12} + a_{12} a_{22} \\ a_{11} a_{21} + a_{21} a_{22} & a_{12} a_{21} + a_{22}^{2} \end{array}\right)
\displaystyle \left(\begin{array}{rr} b_{11} & b_{12} \\ b_{21} & b_{22} \end{array}\right)
\displaystyle \left(\begin{array}{rr} -a_{21} b_{12} + a_{12} b_{21} & -a_{12} b_{11} + a_{11} b_{12} - a_{22} b_{12} + a_{12} b_{22} \\ a_{21} b_{11} - a_{11} b_{21} + a_{22} b_{21} - a_{21} b_{22} & a_{21} b_{12} - a_{12} b_{21} \end{array}\right)

Zadatak 2

Unesite dvije matrice, \mathbf A i \mathbf B , čiji matrični elementi su brojevi, koje su obje kvadratne, regularne i reda barem 3x3. Izračunajte:

  • \det(\mathbf A)\det(\mathbf{A}^{-1}) i
  • \det(\mathbf{A}\mathbf{B})-\det(\mathbf A)\det(\mathbf B)

Ovdje \mathbf{A}^{-1} označava matricu inverznu matrici \mathbf A , a \det(\mathbf A) označava determinantu matrice \mathbf A . Determinanta matrice je broj. Više o tome u Matematici 1.

Matrica je kvadratna ako ima jednak broj redaka i stupaca. Znači kvadratne matrice su uvijek reda m x m.

U trenutku rješavanja ovog labosa još vjerojatno ne znate za pojam regularna matrica. Bit će dovoljno da unesete neke dvije matrice \mathbf A i \mathbf B , takve da su im determinante različite od nule. Vidjet ćete kasnije u Matematici 1 da je to upravo jedna od karakterizacija regularnih matrica.

ex = matrix(2, 2, [1, 2, 0, 1]) # Definirali smo matricu A sa konkretnim brojevima. A je reda 2x2.
show(ex)
show(ex.det()) # Determinanta matrice A
show(ex.inverse()) # Matrica inverzna matrici A

A = matrix(3, 3, [1, 6, 3, 9, 1, 4, 0, 2, 0])
B = matrix(3, 3, [1, 5, 3, 4, 1, 2, 0, 9, 2])

show(A)
show(B)
show(A.det())
show(B.det())
show(A.det() * A.inverse().det())
show((A * B).det() - A.det() * B.det())
\displaystyle \left(\begin{array}{rr} 1 & 2 \\ 0 & 1 \end{array}\right)
\displaystyle 1
\displaystyle \left(\begin{array}{rr} 1 & -2 \\ 0 & 1 \end{array}\right)
\displaystyle \left(\begin{array}{rrr} 1 & 6 & 3 \\ 9 & 1 & 4 \\ 0 & 2 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rrr} 1 & 5 & 3 \\ 4 & 1 & 2 \\ 0 & 9 & 2 \end{array}\right)
\displaystyle 46
\displaystyle 52
\displaystyle 1
\displaystyle 0

Zadatak 3

Definirajte simboličke matrice

\mathbf A=\left[\matrix{\alpha_{1,1}&\alpha_{1,2}&\alpha_{1,3}\cr\alpha_{2,1}&\alpha_{2,2}&\alpha_{2,3}\cr\alpha_{3,1}&\alpha_{3,2}&\alpha_{3,3}\cr}\right]\quad\hbox{ i }\quad\mathbf B=\left[\matrix{\beta_{1,1}&\beta_{1,2}&\beta_{1,3}&\beta_{1,4}&\beta_{1,5}\cr\beta_{2,1}&\beta_{2,2}&\beta_{2,3}&\beta_{2,4}&\beta_{2,5}\cr\beta_{3,1}&\beta_{3,2}&\beta_{3,3}&\beta_{3,4}&\beta_{3,5}\cr\beta_{4,1}&\beta_{4,2}&\beta_{4,3}&\beta_{4,4}&\beta_{4,5}\cr\beta_{5,1}&\beta_{5,2}&\beta_{5,3}&\beta_{5,4}&\beta_{5,5}\cr}\right].

Izračunajte \det \mathbf B i \mathbf A^{-1} .

def simbolicka_matrica(v, n):
    xevi = list(var(v + '_%d%d' %(i,j)) for i in interval(1, n) for j in interval(1, n))
    return matrix(n, xevi)

A = simbolicka_matrica('alpha', 2)

show(A)

# Da si olakšate, koristite definiranu rutinu simbolicka_matrica().

B = simbolicka_matrica('alpha', 3)
C = simbolicka_matrica('beta', 5)

show(C.det())
show(B.inverse())
\displaystyle \left(\begin{array}{rr} \alpha_{11} & \alpha_{12} \\ \alpha_{21} & \alpha_{22} \end{array}\right)
\displaystyle \beta_{15} \beta_{24} \beta_{33} \beta_{42} \beta_{51} - \beta_{14} \beta_{25} \beta_{33} \beta_{42} \beta_{51} - \beta_{15} \beta_{23} \beta_{34} \beta_{42} \beta_{51} + \beta_{13} \beta_{25} \beta_{34} \beta_{42} \beta_{51} + \beta_{14} \beta_{23} \beta_{35} \beta_{42} \beta_{51} - \beta_{13} \beta_{24} \beta_{35} \beta_{42} \beta_{51} - \beta_{15} \beta_{24} \beta_{32} \beta_{43} \beta_{51} + \beta_{14} \beta_{25} \beta_{32} \beta_{43} \beta_{51} + \beta_{15} \beta_{22} \beta_{34} \beta_{43} \beta_{51} - \beta_{12} \beta_{25} \beta_{34} \beta_{43} \beta_{51} - \beta_{14} \beta_{22} \beta_{35} \beta_{43} \beta_{51} + \beta_{12} \beta_{24} \beta_{35} \beta_{43} \beta_{51} + \beta_{15} \beta_{23} \beta_{32} \beta_{44} \beta_{51} - \beta_{13} \beta_{25} \beta_{32} \beta_{44} \beta_{51} - \beta_{15} \beta_{22} \beta_{33} \beta_{44} \beta_{51} + \beta_{12} \beta_{25} \beta_{33} \beta_{44} \beta_{51} + \beta_{13} \beta_{22} \beta_{35} \beta_{44} \beta_{51} - \beta_{12} \beta_{23} \beta_{35} \beta_{44} \beta_{51} - \beta_{14} \beta_{23} \beta_{32} \beta_{45} \beta_{51} + \beta_{13} \beta_{24} \beta_{32} \beta_{45} \beta_{51} + \beta_{14} \beta_{22} \beta_{33} \beta_{45} \beta_{51} - \beta_{12} \beta_{24} \beta_{33} \beta_{45} \beta_{51} - \beta_{13} \beta_{22} \beta_{34} \beta_{45} \beta_{51} + \beta_{12} \beta_{23} \beta_{34} \beta_{45} \beta_{51} - \beta_{15} \beta_{24} \beta_{33} \beta_{41} \beta_{52} + \beta_{14} \beta_{25} \beta_{33} \beta_{41} \beta_{52} + \beta_{15} \beta_{23} \beta_{34} \beta_{41} \beta_{52} - \beta_{13} \beta_{25} \beta_{34} \beta_{41} \beta_{52} - \beta_{14} \beta_{23} \beta_{35} \beta_{41} \beta_{52} + \beta_{13} \beta_{24} \beta_{35} \beta_{41} \beta_{52} + \beta_{15} \beta_{24} \beta_{31} \beta_{43} \beta_{52} - \beta_{14} \beta_{25} \beta_{31} \beta_{43} \beta_{52} - \beta_{15} \beta_{21} \beta_{34} \beta_{43} \beta_{52} + \beta_{11} \beta_{25} \beta_{34} \beta_{43} \beta_{52} + \beta_{14} \beta_{21} \beta_{35} \beta_{43} \beta_{52} - \beta_{11} \beta_{24} \beta_{35} \beta_{43} \beta_{52} - \beta_{15} \beta_{23} \beta_{31} \beta_{44} \beta_{52} + \beta_{13} \beta_{25} \beta_{31} \beta_{44} \beta_{52} + \beta_{15} \beta_{21} \beta_{33} \beta_{44} \beta_{52} - \beta_{11} \beta_{25} \beta_{33} \beta_{44} \beta_{52} - \beta_{13} \beta_{21} \beta_{35} \beta_{44} \beta_{52} + \beta_{11} \beta_{23} \beta_{35} \beta_{44} \beta_{52} + \beta_{14} \beta_{23} \beta_{31} \beta_{45} \beta_{52} - \beta_{13} \beta_{24} \beta_{31} \beta_{45} \beta_{52} - \beta_{14} \beta_{21} \beta_{33} \beta_{45} \beta_{52} + \beta_{11} \beta_{24} \beta_{33} \beta_{45} \beta_{52} + \beta_{13} \beta_{21} \beta_{34} \beta_{45} \beta_{52} - \beta_{11} \beta_{23} \beta_{34} \beta_{45} \beta_{52} + \beta_{15} \beta_{24} \beta_{32} \beta_{41} \beta_{53} - \beta_{14} \beta_{25} \beta_{32} \beta_{41} \beta_{53} - \beta_{15} \beta_{22} \beta_{34} \beta_{41} \beta_{53} + \beta_{12} \beta_{25} \beta_{34} \beta_{41} \beta_{53} + \beta_{14} \beta_{22} \beta_{35} \beta_{41} \beta_{53} - \beta_{12} \beta_{24} \beta_{35} \beta_{41} \beta_{53} - \beta_{15} \beta_{24} \beta_{31} \beta_{42} \beta_{53} + \beta_{14} \beta_{25} \beta_{31} \beta_{42} \beta_{53} + \beta_{15} \beta_{21} \beta_{34} \beta_{42} \beta_{53} - \beta_{11} \beta_{25} \beta_{34} \beta_{42} \beta_{53} - \beta_{14} \beta_{21} \beta_{35} \beta_{42} \beta_{53} + \beta_{11} \beta_{24} \beta_{35} \beta_{42} \beta_{53} + \beta_{15} \beta_{22} \beta_{31} \beta_{44} \beta_{53} - \beta_{12} \beta_{25} \beta_{31} \beta_{44} \beta_{53} - \beta_{15} \beta_{21} \beta_{32} \beta_{44} \beta_{53} + \beta_{11} \beta_{25} \beta_{32} \beta_{44} \beta_{53} + \beta_{12} \beta_{21} \beta_{35} \beta_{44} \beta_{53} - \beta_{11} \beta_{22} \beta_{35} \beta_{44} \beta_{53} - \beta_{14} \beta_{22} \beta_{31} \beta_{45} \beta_{53} + \beta_{12} \beta_{24} \beta_{31} \beta_{45} \beta_{53} + \beta_{14} \beta_{21} \beta_{32} \beta_{45} \beta_{53} - \beta_{11} \beta_{24} \beta_{32} \beta_{45} \beta_{53} - \beta_{12} \beta_{21} \beta_{34} \beta_{45} \beta_{53} + \beta_{11} \beta_{22} \beta_{34} \beta_{45} \beta_{53} - \beta_{15} \beta_{23} \beta_{32} \beta_{41} \beta_{54} + \beta_{13} \beta_{25} \beta_{32} \beta_{41} \beta_{54} + \beta_{15} \beta_{22} \beta_{33} \beta_{41} \beta_{54} - \beta_{12} \beta_{25} \beta_{33} \beta_{41} \beta_{54} - \beta_{13} \beta_{22} \beta_{35} \beta_{41} \beta_{54} + \beta_{12} \beta_{23} \beta_{35} \beta_{41} \beta_{54} + \beta_{15} \beta_{23} \beta_{31} \beta_{42} \beta_{54} - \beta_{13} \beta_{25} \beta_{31} \beta_{42} \beta_{54} - \beta_{15} \beta_{21} \beta_{33} \beta_{42} \beta_{54} + \beta_{11} \beta_{25} \beta_{33} \beta_{42} \beta_{54} + \beta_{13} \beta_{21} \beta_{35} \beta_{42} \beta_{54} - \beta_{11} \beta_{23} \beta_{35} \beta_{42} \beta_{54} - \beta_{15} \beta_{22} \beta_{31} \beta_{43} \beta_{54} + \beta_{12} \beta_{25} \beta_{31} \beta_{43} \beta_{54} + \beta_{15} \beta_{21} \beta_{32} \beta_{43} \beta_{54} - \beta_{11} \beta_{25} \beta_{32} \beta_{43} \beta_{54} - \beta_{12} \beta_{21} \beta_{35} \beta_{43} \beta_{54} + \beta_{11} \beta_{22} \beta_{35} \beta_{43} \beta_{54} + \beta_{13} \beta_{22} \beta_{31} \beta_{45} \beta_{54} - \beta_{12} \beta_{23} \beta_{31} \beta_{45} \beta_{54} - \beta_{13} \beta_{21} \beta_{32} \beta_{45} \beta_{54} + \beta_{11} \beta_{23} \beta_{32} \beta_{45} \beta_{54} + \beta_{12} \beta_{21} \beta_{33} \beta_{45} \beta_{54} - \beta_{11} \beta_{22} \beta_{33} \beta_{45} \beta_{54} + \beta_{14} \beta_{23} \beta_{32} \beta_{41} \beta_{55} - \beta_{13} \beta_{24} \beta_{32} \beta_{41} \beta_{55} - \beta_{14} \beta_{22} \beta_{33} \beta_{41} \beta_{55} + \beta_{12} \beta_{24} \beta_{33} \beta_{41} \beta_{55} + \beta_{13} \beta_{22} \beta_{34} \beta_{41} \beta_{55} - \beta_{12} \beta_{23} \beta_{34} \beta_{41} \beta_{55} - \beta_{14} \beta_{23} \beta_{31} \beta_{42} \beta_{55} + \beta_{13} \beta_{24} \beta_{31} \beta_{42} \beta_{55} + \beta_{14} \beta_{21} \beta_{33} \beta_{42} \beta_{55} - \beta_{11} \beta_{24} \beta_{33} \beta_{42} \beta_{55} - \beta_{13} \beta_{21} \beta_{34} \beta_{42} \beta_{55} + \beta_{11} \beta_{23} \beta_{34} \beta_{42} \beta_{55} + \beta_{14} \beta_{22} \beta_{31} \beta_{43} \beta_{55} - \beta_{12} \beta_{24} \beta_{31} \beta_{43} \beta_{55} - \beta_{14} \beta_{21} \beta_{32} \beta_{43} \beta_{55} + \beta_{11} \beta_{24} \beta_{32} \beta_{43} \beta_{55} + \beta_{12} \beta_{21} \beta_{34} \beta_{43} \beta_{55} - \beta_{11} \beta_{22} \beta_{34} \beta_{43} \beta_{55} - \beta_{13} \beta_{22} \beta_{31} \beta_{44} \beta_{55} + \beta_{12} \beta_{23} \beta_{31} \beta_{44} \beta_{55} + \beta_{13} \beta_{21} \beta_{32} \beta_{44} \beta_{55} - \beta_{11} \beta_{23} \beta_{32} \beta_{44} \beta_{55} - \beta_{12} \beta_{21} \beta_{33} \beta_{44} \beta_{55} + \beta_{11} \beta_{22} \beta_{33} \beta_{44} \beta_{55}
\displaystyle \left(\begin{array}{rrr} -\frac{{\left(\frac{\alpha_{13}}{\alpha_{11}} - \frac{\alpha_{12} {\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}}\right)} {\left(\frac{\alpha_{21} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} - \frac{\alpha_{31}}{\alpha_{11}}\right)}}{\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}} + \frac{1}{\alpha_{11}} - \frac{\alpha_{12} \alpha_{21}}{\alpha_{11}^{2} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} & \frac{{\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)} {\left(\frac{\alpha_{13}}{\alpha_{11}} - \frac{\alpha_{12} {\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}}\right)}}{{\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)} {\left(\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}\right)}} + \frac{\alpha_{12}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} & -\frac{\frac{\alpha_{13}}{\alpha_{11}} - \frac{\alpha_{12} {\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}}}{\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}} \\ -\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{21} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} - \frac{\alpha_{31}}{\alpha_{11}}\right)}}{{\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)} {\left(\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}\right)}} + \frac{\alpha_{21}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} & -\frac{1}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} + \frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{{\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}^{2} {\left(\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}\right)}} & -\frac{\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}}{{\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)} {\left(\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}\right)}} \\ \frac{\frac{\alpha_{21} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\alpha_{11} {\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)}} - \frac{\alpha_{31}}{\alpha_{11}}}{\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}} & -\frac{\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}}{{\left(\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}\right)} {\left(\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}\right)}} & \frac{1}{\frac{{\left(\frac{\alpha_{13} \alpha_{21}}{\alpha_{11}} - \alpha_{23}\right)} {\left(\frac{\alpha_{12} \alpha_{31}}{\alpha_{11}} - \alpha_{32}\right)}}{\frac{\alpha_{12} \alpha_{21}}{\alpha_{11}} - \alpha_{22}} - \frac{\alpha_{13} \alpha_{31}}{\alpha_{11}} + \alpha_{33}} \end{array}\right)

Zadatak 4

Unesite matricu

\mathbf A=\left[\matrix{{\sqrt2\over 2}&-{\sqrt2\over 2}\cr {\sqrt2\over 2}&{\sqrt2\over 2}}\right].

Izračunajte \mathbf{A}^{2n} za n\in\{1,2,\ldots,10\} .

### Napomena: potenciranje matrica se, kao i kod brojeva, radi pomoću operacije ^
A = matrix(2, 2, [(sqrt(2) / 2), (-sqrt(2) / 2), (sqrt(2) / 2), (sqrt(2) / 2)])

for n in range(1, 11):
    show(A ^ (2*n))
\displaystyle \left(\begin{array}{rr} 0 & -1 \\ 1 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rr} -1 & 0 \\ 0 & -1 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 0 & 1 \\ -1 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 1 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 0 & -1 \\ 1 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rr} -1 & 0 \\ 0 & -1 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 0 & 1 \\ -1 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 1 \end{array}\right)
\displaystyle \left(\begin{array}{rr} 0 & -1 \\ 1 & 0 \end{array}\right)
\displaystyle \left(\begin{array}{rr} -1 & 0 \\ 0 & -1 \end{array}\right)

Zadatak 5

Unesite neku kvadratnu matricu \mathbf B , čiji matrični elementi su brojevi, oblika 2\times 2 . Nacrtajte vektore \vec x=(1,0) i \vec y=(0,1) redom u crvenoj i plavoj tamnoj boji, te vektore \mathbf B\vec x i \mathbf B\vec y u svijetlim tonovima istih boja.

x = vector([1, 0])
y = vector([0, 1])
vx = arrow((0, 0), x, color=(0.7, 0, 0)) # Vektor na crtežu reprezentiramo strelicom sa početkom u ishodištu koordinatnog sustava i vrhom u točki čije su koordinate određene vektorom. Boja je zadana u (red, green, blue) obliku, kao kombinacija osnovne tri boje. Intenzitet svake od osnovne tri boje zadan je brojem između 0 i 1.
vy = arrow((0, 0), y, color=(0, 0, 0.7))

# Primjena matrice na vektor se isto piše kao operacija množenja između matrica.

show(vx+vy, aspect_ratio=1)

B = matrix(2, 2, [1, 2, 3, 4])
vbx = arrow((0, 0), B*x, color=(1, 0, 0))
vby = arrow((0, 0), B*y, color=(0, 0, 1))

show(vbx+vby, aspect_ratio=1)

Primjer

U ovisnosti o (interaktivno zadanim) parametrima l,m\in[-1,1] nacrtajte u prostoru plohu

x^2+y^2+lz^2=m.

x,y,z = var('x, y, z')
@interact
def f(l=(-1,1), m=(-1,1)):
    P = implicit_plot3d( x^2+y^2+l*z^2==m, (x,-2,2), (y,-2,2), (z,-2,2), color='black')
    show(P)

Interact: please open in CoCalc

Zadatak 6

Nacrtajte u prostoru ravnine zadane formulama 3x+2y+z=0 (žute boje) i x-y-z=0 (zelene boje), te vektore (3,2,0) i (1,-1,-1) , crvenom i plavom bojom.

x, y, z = var('x, y, z')

P1 = implicit_plot3d(3*x + 2*y + z == 0, (x, -2, 2), (y, -2, 2), (z, -2, 2), color='yellow')
P2 = implicit_plot3d(x - y - z == 0, (x, -2, 2), (y, -2, 2), (z, -2, 2), color='green')

v1 = arrow((0, 0, 0), vector([3, 2, 0]), color='red')
v2 = arrow((0, 0, 0), vector([1, -1, -1]), color='blue')

show(P1+P2+v1+v2, aspect_ratio=1)

3D rendering not yet implemented

Zadatak 7

Unesite neku kvadratnu matricu \mathbf A , čiji matrični elementi su brojevi, reda 3\times3 . Za interaktivno zadani realan broj \lambda\in[-10,10] ispišite sljedeće vrijednosti:

  • \mathbf A-\lambda \mathbf I ,
  • \det(\mathbf A-\lambda \mathbf I) i
  • \mathop{{\mathrm{r}}}(\mathbf A-\lambda \mathbf I) , gdje je \mathrm{r} rang matrice.

Matrica \mathbf I označava specijalnu matricu koju zovemo matrica identiteta. Rang matrice \mathbf A je cijeli nenegativan broj. Više o rangu matrice u Matematici 1.

A = matrix(2, 2, [1, 2, 0, 0])
show(A)
show(A.det())
show(A.rank()) # Rang matrice A

#Primijetite da se matrica može množiti s realnim brojem. Rezultat je matrica istog reda
show(5*A)

B = matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9])
I = matrix.identity(3)

@interact
def funkcija(l=(-10, 10)):
    R = B - l*I
    show(R)
    show(R.det())
    show(R.rank())
\displaystyle \left(\begin{array}{rr} 1 & 2 \\ 0 & 0 \end{array}\right)
\displaystyle 0
\displaystyle 1
\displaystyle \left(\begin{array}{rr} 5 & 10 \\ 0 & 0 \end{array}\right)
Interact: please open in CoCalc