diff --git a/.mailmap b/.mailmap index 5a0ac713f422..8930f7b91d2d 100644 --- a/.mailmap +++ b/.mailmap @@ -1285,7 +1285,7 @@ Roman Inflianskas Ronan Lamy Rudr Tiwari Rupesh Harode -Rushabh Mehta RushabhMehta2005 <139112780+RushabhMehta2005@users.noreply.github.com> +Rushabh Mehta Rushabh Mehta <139112780+RushabhMehta2005@users.noreply.github.com> Ruslan Pisarev Ryan Krauss Rémy Léone diff --git a/sympy/physics/optics/tests/test_waves.py b/sympy/physics/optics/tests/test_waves.py index 3cb8f804fb5b..6bcb5f821e09 100644 --- a/sympy/physics/optics/tests/test_waves.py +++ b/sympy/physics/optics/tests/test_waves.py @@ -80,3 +80,28 @@ def test_twave(): raises(ValueError, lambda:TWave(A1)) raises(ValueError, lambda:TWave(A1, f, phi1, t)) + + A, f, phi, n, A2, phi2 = symbols('A, f, phi, n, A2, phi2') + p = Symbol('p') # scaling factor + + w8 = TWave(A, f, phi) + w9 = w8*p + assert w9.amplitude == A*p + assert w9.frequency == f + assert w9.phase == phi + assert w9.wavelength == c/(f*n) + assert w9.time_period == 1/f + assert w9.angular_velocity == 2*pi*f + assert w9.wavenumber == 2*pi*f*n/c + assert w9.speed == c/n + + w10 = TWave(A2, f, phi2) + w11 = w9 + w10 + assert w11.amplitude == sqrt(A**2*p**2 + 2*A*A2*p*cos(phi- phi2) + A2**2) + assert w11.frequency == f + assert w11.phase == atan2(A*p*sin(phi) + A2*sin(phi2), A*p*cos(phi) + A2*cos(phi2)) + assert w11.wavelength == c/(f*n) + assert w11.time_period == 1/f + assert w11.angular_velocity == 2*pi*f + assert w11.wavenumber == 2*pi*f*n/c + assert w11.speed == c/n diff --git a/sympy/physics/optics/waves.py b/sympy/physics/optics/waves.py index 61e2ff4db578..541754778b35 100644 --- a/sympy/physics/optics/waves.py +++ b/sympy/physics/optics/waves.py @@ -302,7 +302,7 @@ def __mul__(self, other): Multiplying a wave by a scalar rescales the amplitude of the wave. """ other = sympify(other) - if isinstance(other, Number): + if isinstance(other, (Number, Symbol)): return TWave(self.amplitude*other, *self.args[1:]) else: raise TypeError(type(other).__name__ + " and TWave objects cannot be multiplied.")