% Loesungsvorschlaege zu Blatt 1
% Kurt Keilhofer

%%%%%%%%%%%%%%%%%%%%%%%%% Aufgabe 1 %%%%%%%%%%%%%%%%%%%%%%%%%

format long
(2^23*3^10) / (5^7*7^8)
abs(pi^exp(1) - exp(pi))
n = 1000
sqrt(n+sqrt(n)) - sqrt(n-sqrt(n))
format short

%%%%%%%%%%%%%%%%%%%%%%%%% Aufgabe 2 %%%%%%%%%%%%%%%%%%%%%%%%%

v = [3; -4; 1]
w = [2; 1; 2]
A = [1, 2, 0; 3, 4, -2; 2, -1, 5]
S = [2, 1, 1; 1, 4, 1; 1, 1, 2]
I = eye(3)

A*v
S*A - A*S
A^5
det(A - 5*I)
v'*A
w'*S*w
S\A*S   % effizienter als inv(S)*A*S oder S^(-1)*A*S

B = (S + I)*(S - I)
A(2,:)*B(:,3)

%%%%%%%%%%%%%%%%%%%%%%%%% Aufgabe 3 %%%%%%%%%%%%%%%%%%%%%%%%%

n = 1:12
sqrt(n)
sin(pi*n)
1./(1+n.^2)
z = (sqrt(3)+i)/2
z.^n

n = 1:50;
(-1).^(n-1).*(2*n-1)

% oder
(-1).^(0:49).*(1:2:99)

% oder
s = 1:2:99;
s(2:2:50) = -s(2:2:50)
