Loading [MathJax]/jax/output/HTML-CSS/jax.js
Saltar al contenido principal
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
LibreTexts Español

26.3: Proceso de ortogonalización de Gram-Schmidt

( \newcommand{\kernel}{\mathrm{null}\,}\)

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

import math
import copy
from urllib.request import urlretrieve
urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', 
            'answercheck.py');

def transpose(A):
    '''Calculate the transpose of matrix A represented as list of lists'''
    n = len(A)
    m = len(A[0])
    AT = list()
    for j in range(0,m):    
        temp = list()
        for i in range(0,n):
            temp.append(A[i][j])
        AT.append(temp)
    return AT
import math
import copy
from urllib.request import urlretrieve
urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', 
            'answercheck.py');

def transpose(A):
    '''Calculate the transpose of matrix A represented as list of lists'''
    n = len(A)
    m = len(A[0])
    AT = list()
    for j in range(0,m):    
        temp = list()
        for i in range(0,n):
            temp.append(A[i][j])
        AT.append(temp)
    return AT
Hacer esto

Implementar el proceso de ortogonalización de Gram-Schmidt a partir del libro de texto Hefron (página 282). Esta función toma como entrada unam×n MatrixA con columnas linealmente independientes y devuelve unam×n MatrixG con vectores de columna ortogonales. El algoritmo básico funciona de la siguiente manera:

  • AT = transponer (A) (este proceso trabaja con las columnas de la matriz por lo que es más fácil trabajar con la transpuesta. Piense en una lista de lista, es fácil obtener una fila (una lista)).
  • Haga una nueva lista vacía del mismo tamaño que AT y llámela GT (G transpose)
  • Índice de bucle i sobre todas las filas en AT (es decir, columnas de A)
    • GT [i] = AT [i]
    • Índice de bucle j de 0 a i
      • GT [i] -= proj (GT [i], GT [j])
  • G = transponer (GT)

Utilice la siguiente definición de función como plantilla:

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

def GramSchmidt(A):
    return G
def GramSchmidt(A):
    return G

Aquí, vamos a probar tu función usando los vectores:

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

A4 = [[1,4,8],[2,0,1],[0,5,5],[3,8,6]]
print(transpose(A4))
G4 = GramSchmidt(A4)
print(transpose(G4))
A4 = [[1,4,8],[2,0,1],[0,5,5],[3,8,6]]
print(transpose(A4))
G4 = GramSchmidt(A4)
print(transpose(G4))

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

from answercheck import checkanswer

checkanswer.matrix(G4,'a472a81eef411c0df03ae9a072dfa040');
from answercheck import checkanswer

checkanswer.matrix(G4,'a472a81eef411c0df03ae9a072dfa040');

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

A2 = [[-4,-6],[3,5]]
print(transpose(A2))
G2 = GramSchmidt(A2)
print(transpose(G2))
A2 = [[-4,-6],[3,5]]
print(transpose(A2))
G2 = GramSchmidt(A2)
print(transpose(G2))

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

from answercheck import checkanswer

checkanswer.matrix(G2,'23b9860b72dbe5b84d7c598c08af9688');
from answercheck import checkanswer

checkanswer.matrix(G2,'23b9860b72dbe5b84d7c598c08af9688');
Pregunta

¿Cuál es la complejidad Big-O del proceso Gram-Schmidt?


This page titled 26.3: Proceso de ortogonalización de Gram-Schmidt is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?