input: other vector assumes: other vector has the same size returns a new vector that represents the differenz.
(self,other)
| 101 | else: |
| 102 | raise Exception("must have the same size") |
| 103 | def __sub__(self,other): |
| 104 | """ |
| 105 | input: other vector |
| 106 | assumes: other vector has the same size |
| 107 | returns a new vector that represents the differenz. |
| 108 | """ |
| 109 | size = len(self) |
| 110 | if size == len(other): |
| 111 | result = [self.__components[i] - other.component(i) for i in range(size)] |
| 112 | return result |
| 113 | else: # error case |
| 114 | raise Exception("must have the same size") |
| 115 | def __mul__(self,other): |
| 116 | """ |
| 117 | mul implements the scalar multiplication |