-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.py
51 lines (43 loc) · 1.04 KB
/
example.py
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
#!/usr/bin/env python
from sys import stdout
__author__ = 'Laurence Armstrong'
authorship_string = "{} created on {} by {} ({})\n{}\n".format(
"main.py", "24/07/15", __author__, 15062061, "-----" * 15) \
if __name__ == '__main__' else ""
stdout.write(authorship_string)
from vector import Vector
from matrix import Matrix
v = Vector(1, 2, 3, 4, 5)
u = Vector(0, 1, 2, 3, 4)
w = Vector(-1, -2, -3, -4, -5)
z = Vector(1, 2)
print v + u
print
print v.dot(u)
print
print u.angle(w)
print
a = Matrix((1, 2, 3), (2, 3, 4))
b = Matrix((0, 1, 2), (1, 2, 3))
c = -a
d = Matrix((1, 2, 3), (2, 3, 4), (5, 6, 7))
e = Matrix((1, 2), (3, 4), (5, 6))
f = Matrix((1, 2), (3, 4))
g = Matrix((8, 0, 0, 0), (0, 0, 1, 5), (3, 0, 1, 1), (5, 10, 0, 2))
h = Matrix((0, 0, 0), (0, 1, 5), (3, 1, 1))
i = Matrix((0, 0, 0), (0, 0, 0), (0, 0, 0))
j = Matrix((5, 8, 3, 4, 0),
(5, 9, 4, 4, 8),
(4, 11, 15, 4, 7),
(1, 0, 0, 4, 3),
(6, 4, 12, 0, 1))
print g
g.rref()
print
print g
print
print j.invert()
print
print e * a
print
print a + b