---
title: Integrals as accumulation: charge as ∫ i dt
heading: Adding up a rate over time
eyebrow: A5 · Lesson 41 · Integrals as accumulation
xp: 40
---

::: hook
Current is the rate at which charge flows. If you know the current at every moment while a capacitor charges, how much charge ended up on it? When the current is steady it's just current times time. When the current changes, which it almost always does, you need to add up the charge moment by moment. That adding up is an integral, and it turns out to be an area.

::: play
- The yellow curve is the charging current $i(t) = I_0e^{-t/\tau}$, in mA. The shaded area under it, from 0 to $t_0$, is the charge delivered so far.
- The blue curve records that area as $t_0$ moves: the accumulated charge $q(t)$, in µC.
- Slide $t_0$ out to the end. Does the charge keep growing forever, or level off? At what value?
:::
:::

```sim plot
view: graph
x: t = 0..6 ms
y: y = 0..12
slider: I0 = 1..10 step 0.5 = 8
slider: tau = 0.5..2 step 0.1 = 1
slider: t0 = 0..6 step 0.05 = 1
plot: I0*exp(-t/tau) | fill: 0..t0 | label: i (mA)
plot: I0*tau*(1 - exp(-t/tau)) | color: ch2 | label: q (µC)
point: t0, I0*tau*(1 - exp(-t0/tau)) | color: ch2
readout: charge so far = I0*tau*(1 - exp(-t0/tau))
readout: final charge = I0*tau
```

::: predict
## The current starts at $I_0$ and decays with time constant $\tau$. What total charge flows, from $t = 0$ to forever?

- [ ] Infinite, since the current never quite stops
- [x] $I_0\tau$: the same as the starting current flowing steadily for one time constant
- [ ] $I_0/\tau$
- [ ] Zero

::: reveal
$I_0\tau$, a finite amount. The current never reaches zero, but it shrinks so fast that the tail adds less and less. Read it off the sim: with 8 mA and 1 ms, the charge levels off at 8 µC. That's exactly what 8 mA flowing steadily for 1 ms would deliver, a neat property of the exponential.
:::
:::

::: nameit
## The integral is the area under the curve

If a current $i$ is steady for a time $\Delta t$, the charge is $q = i\,\Delta t$: on a graph of $i$ against $t$, the area of a rectangle. When $i$ varies, chop the time into thin slices, treat the current as steady in each, and add up the rectangles:

$$q \approx \sum_k i(t_k)\,\Delta t$$

The thinner the slices, the better the approximation, and in the limit the sum becomes the **definite integral**:

$$q = \int_{0}^{T} i(t)\,dt$$

read "the integral of $i$ from 0 to $T$". The $\int$ is a stretched S for "sum", and $dt$ stands for the thin slice. Its value is the area under the curve between the limits.

**Units multiply.** Area on a graph of amps against seconds is in amp-seconds, which is coulombs. Every integral works this way:

| Integrate | over time, to get |
|---|---|
| current, A | charge, C |
| power, W | energy, J |
| velocity, m/s | distance, m |

**Signed area.** Area below the axis counts as negative: current flowing the other way removes charge. Over one full cycle, a sine wave's positive and negative halves cancel, so $\int_0^T \sin(\omega t)\,dt = 0$.

**Estimating from data.** Given readings at equal steps $\Delta t$, add them and multiply by $\Delta t$: the left-hand sum uses each slice's first reading. Averaging each slice's two ends, the **trapezoid rule**, is usually much more accurate.
:::

::: example
## A current rises as $i = 3t$ mA for 2 s. How much charge passes?

::: solution
1. **Find the shape.** The area under $i(t)$ is a triangle with base 2 s and height 6 mA.
2. **Area.**
   $$\begin{aligned} q &= \tfrac{1}{2} \times 2 \times 6 \\ &= 6\ \text{mC} \end{aligned}$$

**Answer:** 6 mC passes.
:::
:::

::: example
## Estimate $\int_0^2 t^2\,dt$ with left and right sums of four slices.

::: solution
1. **Left sum.** With width 0.5, it uses $t = 0, 0.5, 1, 1.5$:
   $$\begin{aligned} L &= 0.5(0 + 0.25 + 1 + 2.25) \\ &= 1.75 \end{aligned}$$
2. **Right sum.** It uses $t = 0.5, 1, 1.5, 2$:
   $$\begin{aligned} R &= 0.5(0.25 + 1 + 2.25 + 4) \\ &= 3.75 \end{aligned}$$
3. **Compare with the exact value.** The exact value, $8/3 = 2.667$, lies between them, as it must for a rising function.

**Answer:** the left sum is 1.75 and the right sum is 3.75.
:::
:::

::: example
## A current ramps as $i = 2t$ A for 3 s and then holds at 6 A for 2 s. How much charge passes?

::: solution
1. **The ramp.** Charge is the area under $i(t)$, and the ramp is a triangle:
   $$\tfrac12 \times 3 \times 6 = 9\ \text{C}$$
2. **The hold.** It's a rectangle:
   $$6 \times 2 = 12\ \text{C}$$
3. **Total.** The total is 21 C, an average of $21/5 = 4.2$ A over the 5 s.

**Answer:** 21 C passes.
:::
:::

::: check
given: I = 2..50 int; t = 2..20 int
answer: I*t/1000
unit: C
tolerance: 0.5%

## A steady current of {I} mA flows for {t} s. How much charge flows?

::: right
Right. $q = i\,\Delta t$ = {I} mA × {t} s = {answer}.
:::

::: misses
- [I*t] That's the number of millicoulombs, written as coulombs. Milliamps times seconds gives millicoulombs.
- [I/t/1000] Charge is current times time.
- [any] Not yet. Multiply the current by the time.
:::
:::

::: check
given: Imax = 2..20 int; T = 2..10 int
answer: Imax*T/2
unit: µC
tolerance: 0.5%

## A current ramps steadily from 0 to {Imax} mA over {T} ms. How much charge flows in that time, in µC?

::: right
Right. The area under a straight ramp is a triangle: ½ × {T} ms × {Imax} mA = {answer}.
:::

::: misses
- [Imax*T] That's the rectangle, as if the current were at its maximum the whole time. The ramp's area is a triangle, half of it.
- [any] Not yet. The area under the ramp is a triangle: ½ × base × height.
:::
:::

::: check
given: a = 2..6 int
answer: (0 + a*1^2 + a*2^2 + a*3^2)*1
tolerance: 0.5%

## Estimate $\int_0^4 \given{a}t^2\,dt$ with a left-hand sum of four slices of width 1.

::: right
Right. The left ends are at 0, 1, 2 and 3, so the sum is $\given{a}(0 + 1 + 4 + 9)$ = {answer}. The exact value is $\given{a} \cdot 64/3$, larger, because a rising curve's left-hand rectangles all sit below it.
:::

::: misses
- [a*(1 + 4 + 9 + 16)] That uses the right-hand ends, 1 to 4. The left-hand sum starts at 0.
- [a*64/3] That's the exact integral. The question asks for the four-rectangle estimate.
- [any] Not yet. Evaluate $\given{a}t^2$ at $t$ = 0, 1, 2 and 3, add, and multiply by the width, 1.
:::
:::

::: check
kind: choice

## What is $\int_0^{T} \sin(2\pi t/T)\,dt$, over exactly one period?

- [x] 0
- [ ] $T$
- [ ] $T/2$
- [ ] $2/\pi$

::: right
Right. The first half-cycle's area above the axis is exactly cancelled by the second half's area below it.
:::

::: misses
- [2] That would be the area of a rectangle of height 1. The sine is negative for half the cycle.
- [3] Count the second half-cycle too: it's below the axis.
- [4] That's the average of $|\sin|$, not the integral of sin over a whole cycle.
:::
:::

::: check
kind: parts
given: I = 2 | 5; T1 = 1 | 3; T2 = 2 | 4

## A current ramps steadily from 0 to {I} A over {T1} s, then holds at {I} A for {T2} s.

::: part
answer: I*T1/2
unit: C
tolerance: 0.5%

### How much charge passes during the ramp?

::: misses
- [I*T1] The ramp is a triangle: half the rectangle.
- [any] The area of the triangle under the ramp.
:::
:::

::: part
answer: I*T1/2 + I*T2
unit: C
tolerance: 0.5%

### How much in total?

::: misses
- [any] Add the rectangle of the hold.
:::
:::

::: part
answer: (I*T1/2 + I*T2)/(T1 + T2)
unit: A
tolerance: 0.5%

### What is the average current over the whole time?

::: misses
- [I/2] That's the ramp's average alone.
- [any] Total charge over total time.
:::
:::
:::

::: check
kind: derivation
vars: I = 1..5, tau = 0.5..3, T = 0..10, t = 0..10

## A current rises as $I(1 - e^{-t/\tau})$. Find the charge it delivers from 0 to $T$.

::: step
answer: I*(t + tau*exp(-t/tau))

### Write an antiderivative of $I(1 - e^{-t/\tau})$ in the variable $t$. (Use $t$ as a variable.)
:::

::: step
answer: I*(T - tau*(1 - exp(-T/tau)))

### Evaluate it from 0 to $T$.
:::

::: right
Right. For $T \gg \tau$ that's $I(T - \tau)$: the slow start costs exactly one time constant's worth of charge.
:::
:::

::: explain
## Why does the area under a graph of current against time equal the charge that flowed?

::: model
Over a very short time the current is nearly constant, so the charge in that moment is current times the short time, which is the area of a thin rectangle under the curve. The total charge is the sum of all those small amounts, which is the sum of all the thin rectangles, and as they get thinner that sum becomes exactly the area under the curve. The units agree: amps times seconds is coulombs.
:::
:::

::: practice

::: check
given: P = 5..2000 sig 2; h = 1..10 int
answer: P*h*3600
unit: J
tolerance: 0.5%

## A {P} W heater runs for {h} hours at steady power. How much energy does it use, in joules?

::: misses
- [P*h] That's in watt-hours. Turn hours into seconds.
- [any] Energy is the integral of power: here power × time, in seconds.
:::
:::

::: check
given: I0 = 1..20 int; tau = 2..9 int
answer: I0*tau
unit: µC
tolerance: 0.5%

## A current $\given{I0}e^{-t/\given{tau}}$ mA ($t$ in ms) flows forever. How much total charge, in µC?

::: misses
- [I0/tau] The total is $I_0\tau$: steady $I_0$ for one time constant.
- [any] The area under $I_0e^{-t/\tau}$ from 0 to ∞ is $I_0\tau$.
:::
:::

::: check
given: a = 2..6 int
answer: a*(1 + 4 + 9 + 16)
tolerance: 0.5%

## Estimate $\int_0^4 \given{a}t^2\,dt$ with a right-hand sum of four slices of width 1.

::: misses
- [a*(0 + 1 + 4 + 9)] That's the left-hand sum.
- [any] Use the right ends: t = 1, 2, 3, 4.
:::
:::

::: check
given: I1 = 1..9 int; I2 = 10..20 int; t1 = 1..5 int; t2 = 1..5 int
answer: I1*t1 + I2*t2
unit: µC
tolerance: 0.5%

## A current is {I1} mA for {t1} ms, then {I2} mA for {t2} ms. Total charge, in µC?

::: misses
- [(I1 + I2)*(t1 + t2)] Add the two rectangles separately: each current times its own time.
- [any] Add the areas of the two rectangles.
:::
:::
:::
