An educational Python application built with Pygame to visualize and understand the core principles of wave mechanics. This interactive simulation provides an intuitive link between uniform circular motion and sinusoidal waves.
Animated.Phasor.mp4
This project is an interactive learning tool designed to demystify the fundamental properties of waves: Amplitude, Frequency, and Phase.
By controlling these parameters in real-time, user can instantly see their effect on the wave's shape and behavior. The simulation is split into two connected parts:
- The Phasor View (Left): A rotating vector within a circle.
- The Oscilloscope View (Right): The traditional scrolling waveform.
This is one of the most powerful concepts for understanding oscillations. The rotating element around the circle is called a phasor. A sinusoidal wave, which can look complex, is mathematically just the projection of a simple, uniform circular motion.
Here’s what the phasor makes intuitive:
-
Amplitude is the Radius: The amplitude of the wave is simply the radius of the circle. If we want a bigger wave we have to make the circle bigger. It's a direct, 1-to-1 visual relationship that is immediately understandable.
-
Frequency is the Speed of Rotation: The frequency of the wave is the speed at which the point rotates around the circle. A faster rotation means the wave goes up and down more often, which is precisely what frequency is. This transforms the abstract concept of "cycles per second" into a tangible, visual speed.
-
Phase is the Starting Angle: The phase of the wave is its starting point. In our simulation, this is represented by the initial angle of the dot on the circle. It helps visualize why two waves can have the same frequency and amplitude but be "out of sync."
-
The Connection: The simulation explicitly shows this link. A horizontal blue line projects the vertical position of the rotating dot onto the oscilloscope view, drawing the waveform point by point. We are literally watching the
sin()function being drawn from its geometric origin.
This approach bridges the gap between abstract mathematical formulas (y(t) = A * sin(ωt + φ)) and the concrete visual behavior of a wave.
The controls are as follows:
- UP / DOWN Arrows: Increase / Decrease the Frequency.
- RIGHT / LEFT Arrows: Increase / Decrease the Amplitude.
- 'q' / 'w' Keys: Adjust the Phase of the wave.
- SPACE Bar: Reset all parameters to their default values.
You need to have pygame-ce (or pygame) installed on your system.
- Pygame: You can install it via pip.
pip install pygame-ce