In this challenge, we extend the FourVector class we created in the first installment of the FourVector collection.
So, please add the following features to the class FourVector:
__mul__...GetLength which returns the length of the FV. The length is the square root of the absolute value of the product of the FV with itself. Attention: contrasting to 'normal' vectors the product of a FV with itself may be negative! For details refer to the Wiki article.GetCausalStructure. Let p the product of the FV with itself. The method then returns "lightlike" if p=0, "spacelike" if p<0 and "timelike" if p>0. The causal structure has an important meaning in special relativity: a lightlike FV can be connected to the origin (0, 0, 0, 0) by a ray a light, a timelike FV is connected to the origin by 'more time than space' which means there can be a causal connection (cause and effect) between the origin and the event represented by the FV. In contrast, for a spacelike FV there is 'more space than time' and there can't be a causal connection without violating the 'speed limit' of special relativity.v1 = FourVector([1, 2, 3, 4])
v2 = FourVector([1, 0, 0, 1])
2 * v1 ➞ FourVector([2, 4, 6, 8])
v2 * 3 ➞ FourVector([3, 0, 0, 3])
v1 * v3 ➞ -3
v1.GetLength() ➞ 5.291502622129181
v1.GetCausalStructure() ➞ "spacelike"
Please save your FourVector class for later use, we will add new methods in upcoming challenges in this series!