Signals that repeat
The generator makes x(t) = 5 cos(2π·1000·t) volts. Slide a copy along by T = 1 ms and it lands exactly on top: x(t + T) = x(t) for every t. That makes it periodic. The smallest such T is the period.
Close the switch at t = 0 and the 1 µF capacitor discharges through 1 kΩ: x(t) = 5e^(−t/τ) volts, with τ = RC = 1 ms. Slide a copy by any amount and it never lands on itself. The pulse is aperiodic.
Mirror in time
Put −t in place of t and the graph flips about t = 0, like a mirror. The pulse started at t = 0; the flipped x(−t) ends there. The flip at −0.5 ms shows what x did at +0.5 ms: 3.03 V.
Flip the cosine and it lands on itself: x(−t) = x(t) at every t. A signal like this is even. It is symmetric about t = 0, like a face and its mirror image.
Put t = 0 a quarter period earlier and the same generator reads 5 sin(2π·1000·t). Flip it and every value changes sign: x(−t) = −x(t). That is odd. An odd signal is always 0 at t = 0.
Any signal splits into an even part, [x(t) + x(−t)]/2, plus an odd part, [x(t) − x(−t)]/2. For the pulse at t = 0.5 ms: 1.516 + 1.516 = 3.033 V. At −0.5 ms: 1.516 − 1.516 = 0 V.
Energy and power
Square the signal and add up the area under it: that is its energy, E = ∫x(t)² dt. For the pulse, x² = 25e^(−2t/τ), and the area comes to 25 × τ/2 = 12.5 V²·ms. Watch it fill, then stop.
Divide by R = 1 kΩ for real energy: the resistor turns 12.5 µJ into heat, exactly ½CV² = ½ × 1 µF × (5 V)², all the capacitor held. Finite energy makes an energy signal. Its average power over all time is 0.
The generator never stops, so the area grows by 12.5 V²·ms every millisecond, forever: its energy is infinite. The average, P = A²/2 = 12.5 V², stays put (12.5 mW in 1 kΩ). Finite average power makes a power signal.
In code
With numpy, take a sample every microsecond for 10 ms, square, add, and multiply by the step 1e-6 s. That sum of thin strips gives 12.51 V²·ms, about 0.1% above the exact 12.5. A finer step gets closer.
The working
# step 1/10 · periodic
x(t) = A·cos(2π·f0·t)
A = 5 V, f0 = 1000 Hz
period T = 1 / f0 = 1 ms
periodic: x(t + T) = x(t) for every t
shift 0.5 ms -> no match (crest on trough)
shift 1 ms -> exact match
shift 2 ms, 3 ms ... match too
fundamental period = the smallest T > 0 that works
The parts are chosen examples: a 5 V, 1 kHz generator and a 1 µF capacitor charged to 5 V, each driving 1 kΩ, so τ = RC = 1 ms. Energies are in V²·ms; into 1 kΩ, 1 V²·ms is 1 µJ. Every number and curve is computed from this model. The motion is slowed a great deal: 4 ms of signal plays over 9 seconds. The tanks show energy delivered since t = 0; a full tank is 50 V²·ms.