Why is the sky blue? Why are sunsets red?
This simulation models Rayleigh scattering — the physical phenomenon where light interacts with molecules in Earth's atmosphere. The key insight is that scattering intensity is proportional to λ⁻⁴, meaning shorter wavelengths (blue/violet) scatter ~10× more than longer wavelengths (red).
When sunlight enters the atmosphere, gas molecules scatter shorter wavelengths much more efficiently than longer ones:
- Overhead sky (short path): Blue light scatters in all directions → sky appears blue
- Sunset (long path): Blue is scattered away entirely, only red survives → sky appears red/orange
- Calculate Rayleigh cross-sections for any wavelength
- Simulate sky color at any zenith angle (0° = overhead, 90° = horizon)
- Chapman-like atmospheric path length model
- Color intensity bar charts for visualization
python rayleigh.pyThe simulator shows:
- Relative scattering intensities across the visible spectrum
- Sky color evolution from zenith to horizon
- Quantitative explanation of why blue drops ~5000× while red drops only ~15×
- Rayleigh, Lord (1871). "On the light from the sky, its polarization and colour"
- Hansen & Travis (1974). "Light scattering in planetary atmospheres"