Exemplo n.º 1
0
import alc

A = alc.Array([
  [5, -4, 1, 0],
  [-4, 6, -4, 1],
  [1, -4, 6, -4],
  [0, 1, -4, 5],
])
print ("A = {}".format(A))
det = alc.utils.det(A)
print ("det(A) = {}".format(det))
Exemplo n.º 2
0
import alc

A = alc.Array([
    [3, 2, 0],
    [2, 3, -1],
    [0, -1, 3],
])

print("A = {}".format(A))

eigenvalues, eigenvectors = alc.jacobi_eigen(A)
print("autovalores = {}".format(eigenvalues))
print("autovetores = {}".format(eigenvectors))
Exemplo n.º 3
0
import alc

A = alc.Array([
  [5, -4, 1, 0],
  [-4, 6, -4, 1],
  [1, -4, 6, -4],
  [0, 1, -4, 5],
])
B = alc.Array([
  [-1],
  [2],
  [1],
  [3]
])
print ("A = {}".format(A))
print ("B = {}".format(B))
try:
  print ("==> Método de Jacobi")
  x = alc.systems.solve(A, B, method='jacobi')
  print ("x = {}".format(x))
except ValueError as e:
  print (e)

try:
  print ("==> Método de Gauss-Seidel")
  x = alc.systems.solve(A, B, method='gauss_seidel')
  print ("x = {}".format(x))
except ValueError as e:
  print (e)
Exemplo n.º 4
0
import alc

A = alc.Array([
    [16, 9, 8, 7, 6, 5, 4, 3, 2, 1],
    [9, 17, 9, 8, 7, 6, 5, 4, 3, 2],
    [8, 9, 18, 9, 8, 7, 6, 5, 4, 3],
    [7, 8, 9, 19, 9, 8, 7, 6, 5, 4],
    [6, 7, 8, 9, 18, 9, 8, 7, 6, 5],
    [5, 6, 7, 8, 9, 17, 9, 8, 7, 6],
    [4, 5, 6, 7, 8, 9, 16, 9, 8, 7],
    [3, 4, 5, 6, 7, 8, 9, 15, 9, 8],
    [2, 3, 4, 5, 6, 7, 8, 9, 14, 9],
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 13],
])
print("A = {}".format(A))
det = alc.utils.det(A)
print("det(A) = {}".format(det))