(self, other)
Addition of two waves will result in their superposition.
        The type of interference will depend on their phase angles.
Addition of two waves will result in their superposition.
        The type of interference will depend on their phase angles.
Addition of two waves will result in their superposition . The type of interference will depend on their phase angles .
def __add__(self, other):
        """
        Addition of two waves will result in their superposition.
        The type of interference will depend on their phase angles.
        """
        if isinstance(other, TWave):
            if self._frequency == other._frequency and self.wavelength == other.wavelength:
                return TWave(sqrt(self._amplitude**2 + other._amplitude**2 + 2 *
                                  self.amplitude*other.amplitude*cos(
                                      self._phase - other.phase)),
                             self.frequency,
                             self._phase + other._phase
                             )
        else:
            raise TypeError(type(other).__name__ + " and TWave objects can't be added.")
def __add__ ( self , other ) : if isinstance ( other , TWave ) : if self . _frequency == other . _frequency and self . wavelength == other . wavelength : return TWave ( sqrt ( self . _amplitude ** 2 + other . _amplitude ** 2 + 2 * self . amplitude * other . amplitude * cos ( self . _phase - other . phase ) ) , self . frequency , self . _phase + other . _phase ) else : raise TypeError ( type ( other ) . __name__ + " and TWave objects can't be added." )