Skip to content

Instantly share code, notes, and snippets.

@adrientetar
Created January 14, 2014 14:28
Show Gist options
  • Select an option

  • Save adrientetar/8419117 to your computer and use it in GitHub Desktop.

Select an option

Save adrientetar/8419117 to your computer and use it in GitHub Desktop.
TP n°5 d'informatique.
A = [ones(3,4);1,0,ones(1,2);ones(1,4)];
B = [ones(1,5);zeros(3,5)];
C = [ones(3,1)*2,[1;2;3],-ones(3,3)];
D = [diag(1,2,3,4,5)];
function y = factorielle(n)
y = 1;
for i = 1:n
y = y * i;
end
endfunction
function syracuse(u)
while u > 1
disp(u);
if modulo(u,2) == 0 then
u = u / 2;
else
u = 3*u + 1;
end
end
disp(u);
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment