%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Klausur Numerische Mathematik I, Wintersemester 2017/18 %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Gruppe: 1 %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Bitte fuegen Sie Ihre Loesungen in die fuer die Aufgabe vorgesehenen %
% Abschnitte ein. Vermeiden Sie die Nutzung von 'function' und achten Sie %
% darauf, dass das Skript ausfuehrbar ist. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Aufgabe 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% vorwaerts besser als rueckwarts:
n = 20; c = 1/2;
%format long
I = ones(40,1);
I(1) = 1-10*log((c+1)/c);
% Vorwaertsiteration:
for i = 2:n
I(i) = 1/i-c*I(i-1);
end
I_v = I(n)
% Rueckwaertsiteration:
I(40) = 0.0165;
for i = 40:-1:n+1
I(i-1) = (1/c)*(1/i-I(i));
end
I_r = I(n)
% "Exakter" Wert:
%I_e = quad(@(x)(x.^n)./(x+c),0,1)
I_e = integral(@(x)(x.^n)./(x+c),0,1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Aufgabe 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f = @(x)x.^(1/4);
n = 5;
x0 = 0.5;
x = zeros(1,n+1);
x(1) = x0;
for i = 1:n
x(i+1) = f(x(i));
end
x_5 = x(n+1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Aufgabe 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% symmetrisch, aber nicht positiv definit
M = gallery('fiedler',100);
% Pruefen auf Symmetrie und pos. Def
if issymmetric(M) && min(eig(M)) > 0
L = chol(M,'lower');
else
[L,U,P] = lu(M);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% End of file %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%