# 4 - ALGEBRA-LINEAR

## 657 days ago by jmarcellopereira

ALGEBRA LINEAR

Some common Sage rings and fields
ZZ integers, ring

QQ rationals, field

AA, QQbar algebraic number fields, exact

RDF real double field, inexact

CDF complex double field, inexact

RR 53-bit reals, inexact, not same as RDF

RealField(400) 400-bit reals, inexact

CC, ComplexField(400) complexes, too

RIF real interval field

GF(2) mod 2, field, specialized implementations

GF(p) == FiniteField(p) p prime, field

Integers(6) integers mod 6, ring only

CyclotomicField(7) rationals with 7th root of unity √QuadraticField(-5, ’x’) rationals with x= −5

SR ring of symbolic expressions

VETORES

v = vector([1, 0]) u = vector([0, 1]) t = vector([-1,-2]) v;u;t
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,0\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,1\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(-1,\,-2\right)

Gráfico de vetores 2D

plot(v,color="red", figsize = (4,4),gridlines="minor") + plot(u) + plot(t,color="green")

# campo de vetores resultante var('x,y') plot_vector_field((x,y),(x,0,1),(y,0,1), figsize=(6,5), gridlines="minor")

OPERAÇÕES COM VETORES

Soma e Subtração de Vetores

v = vector([1, 0]); u = vector([0, 1]); t = vector([-1,-2]); Som = v+u+t; Sub = v-u-t v; u; t; Som; Sub
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,0\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,1\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(-1,\,-2\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,-1\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(2,\,1\right)

Viualização Gráfica 2D

plot(v,color="red", figsize = (4,4),gridlines="minor")+plot(u)+plot(t,color="green")+plot(Som,color="black")
plot(v,color="red", figsize = (4,4),gridlines="minor")+plot(u)+plot(t,color="green")+plot(Sub,color="black")

Vetores 3D

w = vector([1, 0, 0]); r = vector([0,1, 0]); s = vector([0,0, 1]); Som = w+r+s; Sub = w-r-s; w;r;s; Som; Sub
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,0,\,0\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,1,\,0\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,0,\,1\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,1,\,1\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,-1,\,-1\right)

Visualizção Gráfica 3D

plot(w,color='red', figsize = (5,6), mesh=true, thickness=3) + plot(r, thickness=3)+ plot(s,color='green',thickness=3) + plot(Som,color='green',thickness=3)
plot(w,color='red', figsize = (5,6), mesh=true, thickness=3) + plot(r, thickness=3)+ plot(s,color='green',thickness=3) + plot(Sub,color='green',thickness=3)
# multiplicação por escalar v = vector([1, 0]); 2*v
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(2,\,0\right)
# Multiplicação elemento por elemento entre vetores v = vector([1, 0]) u = vector([0, 1]) # Divisão por escalar v = vector([1, 0]) v/2 v.pairwise_product(u)
# Divisão por escalar v = vector([1, 0]) v/2
# Divisão elemento por elemento entre vetores v = vector([1, 0]) u = vector([0, 1])
# Potencia elemento por elemento v = vector([1, 2]) u = vector([3, 4]) v.apply_map(lambda x: x^2)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,4\right)
# Potencia elemento por elemento entre vetores
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,0\right)
# Transposição v = vector([1, 0]) v.column()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{r} 1 \\ 0 \end{array}\right)
# Vetor aletório Va = random_vector(QQ, 3) ; Vab = random_vector(ZZ, 3) Va ; Vab
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(-\frac{1}{3},\,\frac{25}{2},\,\frac{2}{3}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,-2,\,2\right)
# Mediana dos elementos de um vetor
# Média dos valores dos elementos de um vetor
# Desvio padrão dos elementos de um vetor
# Valor máximo do vetor v v = vector([1, 0]) max(v)
 \newcommand{\Bold}[1]{\mathbf{#1}}1
# Valor máximo de um vetor e indice
# valores extremos de um vetor: minimo e máximo
# Testando se o indice 3 corresponde ao elemento de maior valor do vetor v = [1 2 3]. # O valor true no teste de igualdade corresponde a verdadeiro
 Traceback (click to the left of this block for traceback) ... NameError: name 'maximum' is not defined Traceback (most recent call last): File "", line 1, in File "_sage_input_75.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IyBUZXN0YW5kbyBzZSBvIGluZGljZSAzIGNvcnJlc3BvbmRlIGFvIGVsZW1lbnRvIGRlIG1haW9yIHZhbG9yIGRvIHZldG9yIHYgPSBbMSAyIDNdLiAKIyBPIHZhbG9yIHRydWUgbm8gdGVzdGUgZGUgaWd1YWxkYWRlIGNvcnJlc3BvbmRlIGEgdmVyZGFkZWlybwptYXhpbXVtKHYp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmphcIltY/___code___.py", line 4, in exec compile(u'maximum(v) File "", line 1, in NameError: name 'maximum' is not defined
# Valor mínimo de um vetor min(v)
 \newcommand{\Bold}[1]{\mathbf{#1}}0
# Valor minimo de um vetor e indice
 Traceback (click to the left of this block for traceback) ... NameError: name 'extreme' is not defined Traceback (most recent call last): File "", line 1, in File "_sage_input_82.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZXh0cmVtZSh2KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in File "/tmp/tmpuEQuGq/___code___.py", line 2, in exec compile(u'extreme(v) File "", line 1, in NameError: name 'extreme' is not defined
# Testando se o indice 1 corresponde ao elemento de menor valor do vetor v = [1 2 3]. # O valor true no teste de igualdade corresponde a verdadeiro
# Produto interno: somente vetores coluna. aqui o uso do transpose ou v' nao funciona v = vector([1, 0]) u = vector([0, 1]) v.inner_product(u) ; v.dot_product(u)
 \newcommand{\Bold}[1]{\mathbf{#1}}0 \newcommand{\Bold}[1]{\mathbf{#1}}0
# Produto externo ou vetorial vv = vector([1, 0, 0]) uu = vector([0, 1, 0]) vv.cross_product(uu)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,0,\,1\right)

Multiplicação de Vetores

Multiplicação v(linhas_v,colunas_v) * u(linhas_u,colunas_u) , só é possível se colunas_v = linhas_u ou seja se o número de colunas de v for igual ao númer de linhas de colunas de u resultando em um vetor de m_v linhas e n_u colunas

v = vector([1, 1]) u = vector([-1, -1]) u*v
 \newcommand{\Bold}[1]{\mathbf{#1}}-2

OPERAÇÕES COM MATRIZES

A = matrix([[0, -1, -1], [1, 1, 1], [2, 4, 1]]) B = matrix([[1.1, 0.0, 1.8], [-1.7, 9.6, 1.0], [7.9, 4.6, -5.5]]) A ; B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0 & -1 & -1 \\ 1 & 1 & 1 \\ 2 & 4 & 1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1.10000000000000 & 0.000000000000000 & 1.80000000000000 \\ -1.70000000000000 & 9.60000000000000 & 1.00000000000000 \\ 7.90000000000000 & 4.60000000000000 & -5.50000000000000 \end{array}\right)
type(A) ; type(B)
 \newcommand{\Bold}[1]{\mathbf{#1}}\verb|| \newcommand{\Bold}[1]{\mathbf{#1}}\verb||

Soma e Subtração de Matrizes

A+B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & -1 & 0 \\ 0 & 10 & 2 \\ 9 & 8 & -4 \end{array}\right)
A-B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} -1 & -1 & -2 \\ 2 & -8 & 0 \\ -5 & 0 & 6 \end{array}\right)

 \newcommand{\Bold}[1]{\mathbf{#1}}\verb||

Matriz aleatória

C = random_matrix(RR,3,3); D = random_matrix(ZZ,3,2) C ; D
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} -0.464949752575170 & -0.925376804815111 & 0.543435051175178 \\ -0.411737167044980 & -0.597027483122201 & 0.0349596969789387 \\ 0.530014140432005 & -0.521288802455205 & -0.690673367309854 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} -1 & 1 \\ 1 & 2 \\ -1 & 1 \end{array}\right)
type(C) ; type(D)
 \newcommand{\Bold}[1]{\mathbf{#1}}\verb|| \newcommand{\Bold}[1]{\mathbf{#1}}\verb||

Determinante

show(A) A.det() ; det(A)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0 & -1 & -1 \\ 1 & 1 & 1 \\ 2 & 4 & 1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}-3 \newcommand{\Bold}[1]{\mathbf{#1}}-3

Cofatores

 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0 & -1 & -1 \\ 1 & 1 & 1 \\ 2 & 4 & 1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} -3 & -3 & 0 \\ 1 & 2 & -1 \\ 2 & -2 & 1 \end{array}\right)

Multiplicação de Matrizes

Multiplicação Ma(linhas_Ma,colunas_Ma) * Mb(linhas_Mb,colunas_Mb) , só é possível se colunas_Ma = linhas_Mb ou seja se o número de colunas de Ma for igual ao número de linhas de Mb resultando em uma matriz de Ma_linhas e Mb_colunas

A*B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} -6 & -13 & 4 \\ 7 & 13 & -3 \\ 5 & 40 & 1 \end{array}\right)

Matrizes especiais

# matriz de zeros Mzeros_A = matrix(3, 3, 0) ; Mzeros_B = zero_matrix(3,3) Mzeros_A; Mzeros_B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right)
# matriz de uns Muns = ones_matrix(3,3) Muns
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{array}\right)
# matriz identidade Miden_A = matrix(3, 3, 1) ; Miden_B = identity_matrix(3,3) Miden_A; Miden_B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)
#matriz diagonal com termos definidos Mdiag_A = diagonal_matrix([2, 1.3, 5]); Mdiag_B = matrix(QQ, 3, 3, 8) Mdiag ; Mdiag_B
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 2.00000000000000 & 0.000000000000000 & 0.000000000000000 \\ 0.000000000000000 & 1.30000000000000 & 0.000000000000000 \\ 0.000000000000000 & 0.000000000000000 & 5.00000000000000 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 8 & 0 & 0 \\ 0 & 8 & 0 \\ 0 & 0 & 8 \end{array}\right)

Gráfico de uma matriz

Ma = random_matrix(RDF,5) Ma
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrr} 0.45914544525 & 0.559604847613 & 0.903437690898 & 0.389707713313 & -0.384148622554 \\ -0.581268991404 & 0.918519732654 & 0.0907462297484 & 0.0467409372763 & -0.51267646574 \\ 0.824642634628 & -0.233500338055 & -0.579881446876 & 0.59034649742 & 0.254777159865 \\ -0.506528260187 & 0.457662810163 & 0.776323619568 & -0.362255098191 & 0.101236245476 \\ -0.947964975207 & -0.0705800162773 & -0.663184783611 & 0.896910769762 & 0.217774511982 \end{array}\right)
Ma.plot(cmap='Blues',vmin=min(min(Ma)), vmax=ceil(max(max(Ma))), colorbar=true, figsize=(6,5))
Mb = matrix([[1,2],[3,4]]) Mb
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} 1 & 2 \\ 3 & 4 \end{array}\right)
Mb.apply_map(lambda x: x^2)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} 1 & 4 \\ 9 & 16 \end{array}\right)

MA = matrix(RDF,[[8.0,9.1,1.9],[0.5,5.5,3.6],[8.9,1.0,6.1]]) MB = vector(RDF,[8.1,-3.0,7.5]) MA; MB
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 8.0 & 9.1 & 1.9 \\ 0.5 & 5.5 & 3.6 \\ 8.9 & 1.0 & 6.1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(8.1,\,-3.0,\,7.5\right)
MA.augment(MB,subdivide=True)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr|r} 8.0 & 9.1 & 1.9 & 8.1 \\ 0.5 & 5.5 & 3.6 & -3.0 \\ 8.9 & 1.0 & 6.1 & 7.5 \end{array}\right)

simplificando o sistema

MA.augment(MB).rref()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 1.0 & 0.0 & 0.0 & 1.38749106609 \\ 0.0 & 1.0 & 0.0 & -0.169503639201 \\ 0.0 & 0.0 & 1.0 & -0.767076532622 \end{array}\right)
MA.pivots()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(0, 1, 2\right)

Sistemas Lineares

Resolvenddo o sistema

MA = matrix(RDF,[[8.0,9.1,1.9],[0.5,5.5,3.6],[8.9,1.0,6.1]]) MB = vector(RDF,[8.1,-3.0,7.5]) MA ; MB
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 8.0 & 9.1 & 1.9 \\ 0.5 & 5.5 & 3.6 \\ 8.9 & 1.0 & 6.1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(8.1,\,-3.0,\,7.5\right)
X = MA\MB X
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1.38749106609,\,-0.169503639201,\,-0.767076532622\right)
X = MA.solve_right(MB) X
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(1.38749106609,\,-0.169503639201,\,-0.767076532622\right)

 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 1.0 & 0.0 & 0.0 & 1.38749106609 \\ 0.0 & 1.0 & 0.0 & -0.169503639201 \\ 0.0 & 0.0 & 1.0 & -0.767076532622 \end{array}\right)

Decomposição LU

Ax = b

A = LU

P*A = L*U

• P is a square permutation matrix, of siz, so is all zeroes, but with exactly a single one in each row and each column.
• L is lower-triangular, square of siz, with every diagonal entry equal to one.
• U is upper-triangular with size, i.e. entries below the “diagonal” are all zero.
P,L,U = MA.LU() P; L; U
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 0.0 & 0.0 & 1.0 \\ 1.0 & 0.0 & 0.0 \\ 0.0 & 1.0 & 0.0 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1.0 & 0.0 & 0.0 \\ 0.898876404494 & 1.0 & 0.0 \\ 0.0561797752809 & 0.663789560214 & 1.0 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 8.9 & 1.0 & 6.1 \\ 0.0 & 8.20112359551 & -3.58314606742 \\ 0.0 & 0.0 & 5.63575832306 \end{array}\right)
# Testando L*U
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 8.9 & 1.0 & 6.1 \\ 8.0 & 9.1 & 1.9 \\ 0.5 & 5.5 & 3.6 \end{array}\right)

Método de Cholesky

Este método se aplica quando a matriz dos coeficientes A é simétrica (A = A^t) e definida positiva. Nesta situação, a matriz A pode ser fatorada em A=LU=LL^t.

MC = matrix([[4,2,14],[2,17,-5],[14,-5,83]]) MC
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 4 & 2 & 14 \\ 2 & 17 & -5 \\ 14 & -5 & 83 \end{array}\right)
MC.transpose() == MC
 \newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}
MC.cholesky()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 2 & 0 & 0 \\ 1 & 4 & 0 \\ 7 & -3 & 5 \end{array}\right)
%time A = random_matrix(RDF,5000,5000) B = random_vector(RDF,5000)
 CPU time: 4.88 s, Wall time: 4.88 s CPU time: 4.88 s, Wall time: 4.88 s
%time xx =A\B
 CPU time: 9.13 s, Wall time: 9.13 s CPU time: 9.13 s, Wall time: 9.13 s
%time x = A.solve_right(B)
 CPU time: 9.21 s, Wall time: 9.21 s CPU time: 9.21 s, Wall time: 9.21 s
xx[99]; x[99]
 \newcommand{\Bold}[1]{\mathbf{#1}}-2.3917762987 \newcommand{\Bold}[1]{\mathbf{#1}}-2.3917762987

Utilizando o NumPy

%time from numpy import linalg x = linalg.solve(A,B)
 CPU time: 21.12 s, Wall time: 21.29 s CPU time: 21.12 s, Wall time: 21.29 s
reset()
import numpy as np AA = np.random.rand(5000,5000) BB = np.random.rand(5000,1) Aa = np.matrix(AA) Bb = np.matrix(BB)

%time xy = np.linalg.solve(Aa,Bb)
 CPU time: 8.91 s, Wall time: 8.91 s CPU time: 8.91 s, Wall time: 8.91 s
%time xy = np.linalg.solve(AA,BB)
 CPU time: 8.32 s, Wall time: 8.31 s CPU time: 8.32 s, Wall time: 8.31 s
reset()
A = random_matrix(GF(2), 5000, 5000) b = random_vector(GF(2), 5000)
A[299]
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,1,\,1,\,1,\,0,\,0,\,1,\,0,\,1,\,0,\,1,\,1,\,1,\,1,\,1,\,1,\,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1,\,1,\,1,\,1,\,1,\,0,\,1,\,1,\,0,\,1,\,1,\,0,\,1,\,1,\,0,\,1,\,1,\,0,\,1,\,1,\,1,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,0,\,1,\,0,\,1,\,0,\,0,\,0,\,1,\,1,\,1,\,0,\,1,\,1,\,1,\,1,\,1,\,1,\,0,\,1,\,1,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,1,\,1,\,0,\,0,\,0,\,0,\,0,\,1,\,0,\,0,\,1,\,1,\,1,\,0,\,0,\,0,\,1,\,1,\,1,\,0,\,0,\,1,\,0,\,1,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,0,\,1,\,1,\,0,\,1,\,0,\,1,\,1,\,0,\,0,\,0,\,1,\,1,\,1,\,0,\,1,\,0,\,1,\,1,\,0,\,1,\,1,\,1\right)
%time x = A\b
 CPU time: 0.20 s, Wall time: 0.24 s CPU time: 0.20 s, Wall time: 0.24 s
x[299]
 \newcommand{\Bold}[1]{\mathbf{#1}}1
%time x = A.solve_left(b)
 CPU time: 0.20 s, Wall time: 0.20 s CPU time: 0.20 s, Wall time: 0.20 s
x[466]
 \newcommand{\Bold}[1]{\mathbf{#1}}1

Comparação com outros Softwares

 Julia Octave MatLab Julia Python Sage RDF 2.326s* 3.38s A/B : 8.480s* Linalg: 8.523s*

* tempo médio em segundos numa máquina I5 Haswell, 8GB Ram, Linux NETRunner 17, SageMath 7.0

Aritmética em RR(reais) é mais lento do que aritmética com tipos C nativos.

AUTOVETORES E AUTOVALORES

A = matrix([[0, 4], [-1, 0]]) A
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} 0 & 4 \\ -1 & 0 \end{array}\right)
A.eigenvalues ()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left[-2 \sqrt{-1}, 2 \sqrt{-1}\right]
A.eigenvectors_left() ; A.eigenvectors_right()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left[\left(-2 \sqrt{-1}, \left[\left(1,\,2 \sqrt{-1}\right)\right], 1\right), \left(2 \sqrt{-1}, \left[\left(1,\,-2 \sqrt{-1}\right)\right], 1\right)\right] \newcommand{\Bold}[1]{\mathbf{#1}}\left[\left(-2 \sqrt{-1}, \left[\left(1,\,-0.50000000000000000? \sqrt{-1}\right)\right], 1\right), \left(2 \sqrt{-1}, \left[\left(1,\,0.50000000000000000? \sqrt{-1}\right)\right], 1\right)\right]
A.eigenmatrix_left() ; A.eigenmatrix_right()
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\left(\begin{array}{rr} -2 \sqrt{-1} & 0 \\ 0 & 2 \sqrt{-1} \end{array}\right), \left(\begin{array}{rr} 1 & 2 \sqrt{-1} \\ 1 & -2 \sqrt{-1} \end{array}\right)\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\left(\begin{array}{rr} -2 \sqrt{-1} & 0 \\ 0 & 2 \sqrt{-1} \end{array}\right), \left(\begin{array}{rr} 1 & 1 \\ -0.50000000000000000? \sqrt{-1} & 0.50000000000000000? \sqrt{-1} \end{array}\right)\right)

%%% Fim Algebra linear %%%