Tareas Deberes Del 12 Al 17 de Junio de 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Nombre: Danilo Hernández

Materia: METODOS NUMERICOS – 8896

Tareas Deberes del 12 al 17 de junio de 2023


Primer algoritmo: (Patrón)

clc

clear all

n = input("Ingrese un número: ");

for i = 1:n

printf("%d\n", i);

for j = 1:n

if i ~= j

printf("%d %d\n", i, j);

endif

endfor

endfor

Algoritmo 2: (Matrices 10x10)

clc

clear all

A = rand(10, 10) % Matriz aleatoria de 10x10

A(1,:) = A(1,:) / A(1,1)

A(2,:) = A(2,:) - A(2,1) * A(1,:)

A(2,:) = A(2,:) / A(2,2)


A(1,:) = A(1,:) - A(1,2) * A(2,:)

A(3,:) = A(3,:) - A(3,1) * A(1,:)

A(3,:) = A(3,:) - A(3,2) * A(2,:)

A(3,:) = A(3,:) / A(3,3)

A(1,:) = A(1,:) - A(1,3) * A(3,:)

A(2,:) = A(2,:) - A(2,3) * A(3,:)

A(4,:) = A(4,:) - A(4,1) * A(1,:)

A(4,:) = A(4,:) - A(4,2) * A(2,:)

A(4,:) = A(4,:) - A(4,3) * A(3,:)

A(4,:) = A(4,:) / A(4,4)

A(1,:) = A(1,:) - A(1,4) * A(4,:)

A(2,:) = A(2,:) - A(2,4) * A(4,:)

A(3,:) = A(3,:) - A(3,4) * A(4,:)

A(5,:) = A(5,:) - A(5,1) * A(1,:)

A(5,:) = A(5,:) - A(5,2) * A(2,:)

A(5,:) = A(5,:) - A(5,3) * A(3,:)

A(5,:) = A(5,:) - A(5,4) * A(4,:)

A(5,:) = A(5,:) / A(5,5)

A(1,:) = A(1,:) - A(1,5) * A(5,:)

A(2,:) = A(2,:) - A(2,5) * A(5,:)

A(3,:) = A(3,:) - A(3,5) * A(5,:)

A(4,:) = A(4,:) - A(4,5) * A(5,:)

A(6,:) = A(6,:) - A(6,1) * A(1,:)

A(6,:) = A(6,:) - A(6,2) * A(2,:)

A(6,:) = A(6,:) - A(6,3) * A(3,:)

A(6,:) = A(6,:) - A(6,4) * A(4,:)

A(6,:) = A(6,:) - A(6,5) * A(5,:)

A(6,:) = A(6,:) / A(6,6)

A(1,:) = A(1,:) - A(1,6) * A(6,:)

A(2,:) = A(2,:) - A(2,6) * A(6,:)

A(3,:) = A(3,:) - A(3,6) * A(6,:)


A(4,:) = A(4,:) - A(4,6) * A(6,:)

A(5,:) = A(5,:) - A(5,6) * A(6,:)

A(7,:) = A(7,:) - A(7,1) * A(1,:)

A(7,:) = A(7,:) - A(7,2) * A(2,:)

A(7,:) = A(7,:) - A(7,3) * A(3,:)

A(7,:) = A(7,:) - A(7,4) * A(4,:)

A(7,:) = A(7,:) - A(7,5) * A(5,:)

A(7,:) = A(7,:) - A(7,6) * A(6,:)

A(7,:) = A(7,:) / A(7,7)

A(1,:) = A(1,:) - A(1,7) * A(7,:)

A(2,:) = A(2,:) - A(2,7) * A(7,:)

A(3,:) = A(3,:) - A(3,7) * A(7,:)

A(4,:) = A(4,:) - A(4,7) * A(7,:)

A(5,:) = A(5,:) - A(5,7) * A(7,:)

A(6,:) = A(6,:) - A(6,7) * A(7,:)

A(8,:) = A(8,:) - A(8,1) * A(1,:)

A(8,:) = A(8,:) - A(8,2) * A(2,:)

A(8,:) = A(8,:) - A(8,3) * A(3,:)

A(8,:) = A(8,:) - A(8,4) * A(4,:)

A(8,:) = A(8,:) - A(8,5) * A(5,:)

A(8,:) = A(8,:) - A(8,6) * A(6,:)

A(8,:) = A(8,:) - A(8,7) * A(7,:)

A(8,:) = A(8,:) / A(8,8)

A(1,:) = A(1,:) - A(1,8) * A(8,:)

A(2,:) = A(2,:) - A(2,8) * A(8,:)

A(3,:) = A(3,:) - A(3,8) * A(8,:)

A(4,:) = A(4,:) - A(4,8) * A(8,:)

A(5,:) = A(5,:) - A(5,8) * A(8,:)

A(6,:) = A(6,:) - A(6,8) * A(8,:)

A(7,:) = A(7,:) - A(7,8) * A(8,:)

A(9,:) = A(9,:) - A(9,1) * A(1,:)


A(9,:) = A(9,:) - A(9,2) * A(2,:)

A(9,:) = A(9,:) - A(9,3) * A(3,:)

A(9,:) = A(9,:) - A(9,4) * A(4,:)

A(9,:) = A(9,:) - A(9,5) * A(5,:)

A(9,:) = A(9,:) - A(9,6) * A(6,:)

A(9,:) = A(9,:) - A(9,7) * A(7,:)

A(9,:) = A(9,:) - A(9,8) * A(8,:)

A(9,:) = A(9,:) / A(9,9)

A(1,:) = A(1,:) - A(1,9) * A(9,:)

A(2,:) = A(2,:) - A(2,9) * A(9,:)

A(3,:) = A(3,:) - A(3,9) * A(9,:)

A(4,:) = A(4,:) - A(4,9) * A(9,:)

A(5,:) = A(5,:) - A(5,9) * A(9,:)

A(6,:) = A(6,:) - A(6,9) * A(9,:)

A(7,:) = A(7,:) - A(7,9) * A(9,:)

A(8,:) = A(8,:) - A(8,9) * A(9,:)

A(10,:) = A(10,:) - A(10,1) * A(1,:)

A(10,:) = A(10,:) - A(10,2) * A(2,:)

A(10,:) = A(10,:) - A(10,3) * A(3,:)

A(10,:) = A(10,:) - A(10,4) * A(4,:)

A(10,:) = A(10,:) - A(10,5) * A(5,:)

A(10,:) = A(10,:) - A(10,6) * A(6,:)

A(10,:) = A(10,:) - A(10,7) * A(7,:)

A(10,:) = A(10,:) - A(10,8) * A(8,:)

A(10,:) = A(10,:) - A(10,9) * A(9,:)

A(10,:) = A(10,:) / A(10,10)

A(1,:) = A(1,:) - A(1,10) * A(10,:)

A(2,:) = A(2,:) - A(2,10) * A(10,:)

A(3,:) = A(3,:) - A(3,10) * A(10,:)

A(4,:) = A(4,:) - A(4,10) * A(10,:)

A(5,:) = A(5,:) - A(5,10) * A(10,:)


A(6,:) = A(6,:) - A(6,10) * A(10,:)

A(7,:) = A(7,:) - A(7,10) * A(10,:)

A(8,:) = A(8,:) - A(8,10) * A(10,:)

A(9,:) = A(9,:) - A(9,10) * A(10,:)

You might also like