input: other vector assumes: other vector has the same size returns a new vector that represents the sum.
(self,other)
| 89 | summe += c**2 |
| 90 | return math.sqrt(summe) |
| 91 | def __add__(self,other): |
| 92 | """ |
| 93 | input: other vector |
| 94 | assumes: other vector has the same size |
| 95 | returns a new vector that represents the sum. |
| 96 | """ |
| 97 | size = len(self) |
| 98 | if size == len(other): |
| 99 | result = [self.__components[i] + other.component(i) for i in range(size)] |
| 100 | return Vector(result) |
| 101 | else: |
| 102 | raise Exception("must have the same size") |
| 103 | def __sub__(self,other): |
| 104 | """ |
| 105 | input: other vector |