Photons model electromagnetic energy exchange in discrete packets. The energy of each packet depends on frequency, so a dim high-frequency beam and a bright low-frequency beam are different inputs: intensity can change the packet rate, while frequency changes energy per packet.
The photon-energy relation is
\[E=hf=\frac{hc}{\lambda}\]E is energy in joules, f is frequency in hertz, h = 6.62607015 × 10⁻³⁴ J·s, c is vacuum light speed, and λ is vacuum wavelength. At f = 8 × 10¹⁴ Hz, one photon carries about 5.30 × 10⁻¹⁹ J. Doubling frequency doubles this value; that direct proportionality makes a good regression test.
const PLANCK_CONSTANT = 6.626_070_15e-34; // J·s
function photonEnergy(frequency: number) {
if (frequency < 0 || !Number.isFinite(frequency)) throw new RangeError("finite non-negative frequency required");
return PLANCK_CONSTANT * frequency;
}
For N identical photons in this deliberately simple model, total incident energy is N * photonEnergy(frequency). Do not silently turn a fractional expected detector count into a fractional photon. An expectation is a mean over repeated runs; an individual event is recorded or not recorded.
Prediction: A beam can be dimmer by having fewer photons per second without changing energy per photon, as long as frequency stays fixed.
Evaluate the function at4 × 10¹⁴ Hz and 8 × 10¹⁴ Hz. Predict their ratio before calculating it. Then keep the higher frequency and compare 10 versus 100 photons: identify which number changes energy per photon and which changes total energy.Quantization makes the packet contract explicit: frequency maps to energy per photon, while count and detector behavior are separate state and sampling problems. Unit tests for zero and proportionality catch mistakes before a stochastic event display hides them.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Photons and Quantization, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Quantum Beginnings, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Photons and Quantization as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Represent quantized light exchange with explicit packet state, detector rules, and reproducible sampling.