A collection of from-scratch, zero-dependency C implementations of classical electromagnetism from electrostatics through Maxwell's equations, wave theory, radiation, and beyond. Each module translates textbook equations into runnable C code, covering the canonical four-semester physics sequence from undergraduate electricity & magnetism through graduate electrodynamics and gauge theory.
| Sub-Module | Topics | Key Courses |
|---|---|---|
| mini-electrostatics | Coulomb's law, Gauss law, Poisson/Laplace equation, multipole expansion, dielectrics, capacitors, boundary value problems (FDM/BEM) | MIT 8.02, Stanford PHYS 230, Caltech Ph 135 |
| mini-em-in-media | D/H/P/M fields, permittivity/permeability tensors, complex refractive index, Kramers-Kronig, Drude/Sellmeier dispersion, Clausius-Mossotti | MIT 8.07, Princeton PHY 515, Jackson |
| mini-em-waves | Plane waves, polarization (Jones/Stokes/Mueller), interference, Fresnel equations, Cauchy/Sellmeier/Drude dispersion, wave packets | MIT 8.07, Hecht Optics, Born & Wolf |
| mini-magnetostatics | Biot-Savart law, Ampere's law, magnetic dipole, vector potential, magnetization, hysteresis (Stoner-Wohlfarth/Jiles-Atherton), domain walls, superconductivity (London/GL), geomagnetism | MIT 8.07, Stanford PHYS 230, Berkeley PHYS 221 |
| mini-maxwell-equations | Gauss/Faraday/Ampere-Maxwell laws, constitutive relations, Lorentz force, charge conservation, potentials, Coulomb/Biot-Savart, FDTD | MIT 8.07, Princeton PHY 515 |
| mini-potential-gauge | Scalar/vector potentials, gauge invariance (Coulomb/Lorenz), Jefimenko/Lienard-Wiechert, FFT Poisson, Aharonov-Bohm, Yang-Mills, BRST, lattice gauge theory | MIT 8.07, Princeton PHY 515, Cambridge Part III |
| mini-radiation | Dipole/quadrupole radiation, Larmor formula, synchrotron radiation, Thomson/Rayleigh scattering, antenna theory, blackbody radiation (Planck/Wien/Stefan-Boltzmann) | MIT 8.07, Stanford PHYS 330, Berkeley PHYS 232 |
| mini-waveguide-resonator | TE/TM/TEM modes, rectangular/circular/coaxial waveguides, cutoff frequencies, S-parameters, cavity resonators, photonic crystals, metamaterials | MIT 8.07, Pozar Microwave Engineering |
- Zero external dependencies — pure C (C99/C11), only
libcandlibm - Self-contained modules — each directory has its own
Makefile,include/,src/,examples/,demos/,tests/ - 9-layer knowledge coverage — from L1 definitions through L9 research frontiers, mirroring the full academic depth of each topic
- Theory-to-code mapping — every module includes
docs/with course-alignment notes and textbook references (Griffiths, Jackson, Hecht, Pozar)
Each module is standalone. Navigate to a module directory and run:
cd mini-electrostatics
make all # build everything
make test # run testsRequires GCC and GNU Make.
mini-electromagnetism/
├── mini-electrostatics/ # Electric fields, potentials, Gauss law, dielectrics
├── mini-em-in-media/ # EM fields in material media, dispersion, Kramers-Kronig
├── mini-em-waves/ # EM wave theory, polarization, interference, Fresnel
├── mini-magnetostatics/ # Magnetostatics, Biot-Savart, Ampere, hysteresis, superconductors
├── mini-maxwell-equations/ # Full Maxwell equations, Lorentz force, FDTD
├── mini-potential-gauge/ # Potentials, gauge theory, Jefimenko, Aharonov-Bohm, Yang-Mills
├── mini-radiation/ # EM radiation, scattering, antenna theory, blackbody
└── mini-waveguide-resonator/ # Waveguide modes, cavity resonators, S-parameters
MIT