vector.py ersetzen
This commit is contained in:
18
vector.py
18
vector.py
@@ -38,7 +38,7 @@ class Vector(object):
|
||||
new_coordinates = [x-y for x,y in zip(self.coordinates, v.coordinates)]
|
||||
return Vector(new_coordinates)
|
||||
|
||||
def times_scalar(self, c):
|
||||
def skalar_multiplikation(self, c):
|
||||
new_coordinates = [c*x for x in self.coordinates]
|
||||
return Vector(new_coordinates)
|
||||
|
||||
@@ -63,16 +63,14 @@ class Vector(object):
|
||||
# Tests
|
||||
|
||||
|
||||
veka1 = Vector([0,5,3])
|
||||
veka2 = Vector([2,2,1])
|
||||
a = Vector([3,4])
|
||||
b = Vector([10,5])
|
||||
c = a.minus(b.skalar_multiplikation((1/2)))
|
||||
|
||||
print (veka1.plus(veka2))
|
||||
|
||||
veka3 = Vector([3,4])
|
||||
print(veka3.laenge())
|
||||
|
||||
veka4 = Vector([10,5])
|
||||
print(veka4.laenge()) #magnitude
|
||||
print(c)
|
||||
|
||||
print(a.laenge())
|
||||
print(b.laenge())
|
||||
print(c.laenge())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user