aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/40-eigenwerte/beispiele/i.m
blob: 353e3a2f767acc1b0dbafa6007428b2f1dd47a8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# i.m -- invariante
#
# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#

A0 = [
  2, 1, 0, 0;
  0, 2, 1, 0;
  0, 0, 2, 0;
  0, 0, 0, 3
];

# find a 3x3 matrix in SL(3,Z)

function retval = zufallswert()
	x = round(rand() * 10) - 2;
	if (x >= 0)
		x = x + 1;
	endif
	retval = x;
end

function	retval = zufallsmatrix(n)
	retval = zeros(n, n);
	for i = (1:n)
		for j = (1:n)
			retval(i,j) = zufallswert();
		end
	end
end

function	retval = regulaer(n)
	d = 0;
	do
		retval = zufallsmatrix(2);
		d = det(retval);
	until (d == 1);
end

function	retval = eingebettet(n,k)
	retval = eye(n);
	retval(k:k+1,k:k+1) = regulaer(2);
end

format long

B = eye(4);
B = B * eingebettet(4,3)
B = B * eingebettet(4,1)
B = B * inverse(eingebettet(4,2))
#B = B * eingebettet(4,2)

B
inverse(B)

A = round(B * A0 * inverse(B))

D = A - 2 * eye(4)
rank(D)

E = round(D*D*D*D)
rank(E')

rref(E)