function y = avanti(L,b)
y = b(1);
for k = 2 : length(b)
y = [y; b(k) - L(k, 1: k-1) * y];
end
end
L = [1 0 0; 2 1 0; -3 5 1]
b = L * [4; -2; 7]
avanti(L,b)
% dopo la lezione
function x = indietro(U,y)
n = length(y);
x = y(n)/U(n,n);
for k = n-1 : -1 : 1
x = [(y(k)-U(k,k+1 : n)*x)/U(k,k); x];
end
end
U = [-3 5 2; 0 4 -1; 0 0 7]
y = U * [4; -2; 7]
indietro(U,y)
quit
# Octave 3.6.2, Wed Nov 07 17:08:49 2012 CET <achilles@achilles-TOSH>

