Chapter 9

Calculus into Algebra

Can we turn calculus into algebra?

Chapter 9: Calculus into Algebra ↗

Slopes become multiplication

Mika: Remember the sticky note from Chapter 4? For eate^{at}, taking a slope was just × a\times\, a. Now watch what the probe does with a slope.

New words

f′f' and f′′f''
Short for dfdt\frac{df}{dt}, the slope of ff, and the slope of that slope. Chapter 7 wrote them with dots, x˙\dot x and x¨\ddot x.
L{f}\mathcal{L}\{f\}
"The transform of ff": the same thing as F(s)F(s), handy when ff is a whole expression.
Capital letters
A capital letter is the transform of its small letter: FF for ff, HH for the height hh, XX for xx.

Here's the property that makes the whole thing worth it. What happens to the transform when we take the slope of the signal? Try it with f=eatf = e^{at}. Its slope is aeata e^{at} (Chapter 4), so

L{f′}=as−a=ss−a−1=s F(s)−f(0)\begin{aligned} \mathcal{L}\{f'\} &= \frac{a}{s-a} = \frac{s}{s-a} - 1 \\ &= s\,F(s) - f(0) \end{aligned}

The slope turned into multiplying by ss, minus the starting value f(0)f(0). Calculus became algebra!

Chapter 9: Calculus into Algebra ↗

Theo: Hold on. That's a trick that works for eate^{at} because eate^{at} is special. Next you'll tell me it's a lookup rule we're supposed to memorise. I don't buy it for any curve.

June: Then let's test it on the ugliest curve you can draw.

Draw any signal you like in the first plot (or pick a preset). We compute its slope, then work out both sides of the rule with the area machine: the transform of the slope, and s F(s)−f(0)s\,F(s) - f(0). The second plot shows those two sides for every ss.

Chapter 9: Calculus into Algebra ↗

Theo: They match, even for my wobbly scribble. Not a lookup rule after all: it's what the area machine does to any slope.

Here is the missing algebra, as a picture. A product changes for two reasons. ff changes while the probe holds still, and the probe changes while ff holds still. Picture a rectangle with sides ff and e−ste^{-st}: it grows along one side, then along the other. This move has a name: integration by parts.

(f e−st)′=f′ e−st−s f e−st\big(f\,e^{-st}\big)' = f'\,e^{-st} - s\,f\,e^{-st}

Add up those changes from 0 to ∞ (Chapter 3: area undoes slope) and you get the value at the end minus the value at the start. That is what the bracket [ ⋅ ]0∞\big[\,\cdot\,\big]_0^\infty means:

[f e−st]0∞=∫0∞f′ e−st dt−s F(s)\big[f\,e^{-st}\big]_0^\infty = \int_0^\infty f'\,e^{-st}\,dt - s\,F(s)

At the far end the probe has squashed everything to zero (as long as ss beats the signal's growth), so the left side is just 0−f(0)0 - f(0). Move s F(s)s\,F(s) across and there's the rule.

Theo: So f(0)f(0) isn't a fudge. It's the rectangle we started with.

Apply the same rule once more, this time to f′f', whose starting value is f′(0)f'(0), the starting speed:

L{f′′}=s L{f′}−f′(0)=s(s F(s)−f(0))−f′(0)=s2F(s)−s f(0)−f′(0)\begin{aligned} \mathcal{L}\{f''\} &= s\,\mathcal{L}\{f'\} - f'(0) \\ &= s\big(s\,F(s) - f(0)\big) - f'(0) \\ &= s^2 F(s) - s\,f(0) - f'(0) \end{aligned}

Our own table

Textbooks print a "table of Laplace transforms" as if it came from the sky. We're going to earn ours, one row at a time. Each row is just the probe-and-area machine applied to one signal, with a check that the formula agrees with the actual area.

Chapter 9: Calculus into Algebra ↗

Mika: The sine row is my favourite. A sine is just two twin spinners, and each spinner's transform is the exponential row with a=±iωa = \pm i\omega. Chapter 6 added the twins to get a cosine. Subtract them instead and the along parts cancel, leaving 2isin⁡ωt2i\sin\omega t. That's where the 2i2i comes from! And multiplying the twins' bottoms is Chapter 7's mirror product, (s−iω)(s+iω)=s2+ω2(s - i\omega)(s + i\omega) = s^2 + \omega^2.

(For a complex aa, the exponential row still works as long as the left-right part of ss beats the left-right part of aa. For the twins that's simply σ>0\sigma > 0.)

And the last row needed no new work at all: multiplying by e−σte^{-\sigma t} simply shifts ss to s+σs+\sigma. Four rows, all derived, all checked.

One more rule we've been using quietly. The area machine is fair: make a signal 3 times taller and every slice of its area is 3 times taller, so the whole area is too. Add two signals and their areas add. Mathematicians call this linearity.

Chapter 9: Calculus into Algebra ↗

June: That's what lets us transform an equation one term at a time, numbers in front and all. And the drone's equation is exactly that kind of sum. Let's use the table!

Undoing a common denominator

Theo: Every answer we'll get comes out as one big fraction. But our table only knows small ones: 1s\frac1s, 1s−a\frac{1}{s-a}, the sines. How do we break a big fraction into table pieces?

At school you added fractions by finding a common bottom. Here we go backwards: start from one fraction and find the small pieces that add up to it. That is called splitting into partial fractions:

1s+1s+2=2s+2s (s+2)so2s+2s (s+2)=As+Bs+2\frac{1}{s} + \frac{1}{s+2} = \frac{2s + 2}{s\,(s+2)} \qquad\text{so}\qquad \frac{2s+2}{s\,(s+2)} = \frac{A}{s} + \frac{B}{s+2}

What goes on top of each piece? **One unknown for every power of ss in its bottom.** A bottom like ss or s+2s + 2 gets a plain number. A quadratic bottom like s2+2s+5s^2 + 2s + 5 gets B s+CB\,s + C: two unknowns, because a quadratic has room for two.

Chapter 9: Calculus into Algebra ↗

June: Each slider moves one piece, and the pieces just add up in time too. The AA piece is a step; the quadratic piece is a wiggle that dies away. And the big fraction on the right is what they add up to.

Finding the numbers has a shortcut for the first-power pieces, the cover-up trick. Multiply by the piece's bottom, then set ss to the value that makes it zero: every other piece vanishes and only its top is left.

A=[s⋅2s+2s (s+2)]s=0=22=1,B=[(s+2)⋅2s+2s (s+2)]s=−2=−2−2=1A = \Big[s \cdot \frac{2s+2}{s\,(s+2)}\Big]_{s=0} = \frac{2}{2} = 1, \qquad B = \Big[(s+2) \cdot \frac{2s+2}{s\,(s+2)}\Big]_{s=-2} = \frac{-2}{-2} = 1

A quadratic bottom needs one more move before the table can read it: push it into the shape (s+σ)2+ω2(s + \sigma)^2 + \omega^2 by completing the square, halving the middle number and squaring it. So s2+2s+5=(s+1)2+4s^2 + 2s + 5 = (s + 1)^2 + 4: a decaying cosine and sine with σ=1\sigma = 1 and ω=2\omega = 2.

Solving the drone with algebra

Here is the Chapter 2 drone under P control, with no free hover thrust this time, starting on a 1 m ledge. At t=0t=0 we release it and ask for 2 m. In the calculation from that instant onward, the new setpoint and constant gravity force each transform like a step:

m h′′+c h′=Kp (2−h)−mgm\,\out{h}'' + c\,\out{h}' = \eff{K_p}\,(\sp{2} - \out{h}) - \dis{m g}

Step 1: transform every term. Because areas scale and add (the table section), we can transform each term on its own. A step of size rr becomes r/sr/s, and slopes become multiplication by ss. Here's what we wrote:

m s2H+c s H=Kp(2s−H)−mgsm\,s^2\out{H} + c\,s\,\out{H} = \eff{K_p}\Big(\frac{\sp{2}}{s} - \out{H}\Big) - \frac{\dis{m g}}{s}

Step 2: it's algebra now. Collect H\out{H} on one side, then divide:

(ms2+cs+Kp) H=Kp 2−mgsH(s)=N(s)s (ms2+cs+Kp)N(s)=Kp 2−mg\begin{gathered} \begin{aligned} &(m s^2 + c s + \eff{K_p})\,\out{H} \\ &\quad = \frac{\eff{K_p}\,\sp{2} - \dis{m g}}{s} \end{aligned} \\[8pt] \out{H}(s) = \frac{N(s)}{s\,\big(m s^2 + c s + \eff{K_p}\big)} \\[8pt] N(s) = \eff{K_p}\,\sp{2} - \dis{m g} \end{gathered}

Mika: Look at that. No slopes left, just letters being shuffled around. Theo, your notebook has stopped smoking.

Step 3: split it into table pieces, as in the section above: one number on top of the ss piece, and Bs+CB s + C on top of the quadratic one:

H(s)=As+Bs+Cms2+cs+Kp\out{H}(s) = \frac{A}{s} + \frac{B s + C}{m s^2 + c s + \eff{K_p}}

How do we find AA, BB, and CC? Multiply both sides by the shared bottom s (ms2+cs+Kp)s\,(m s^2 + c s + \eff{K_p}):

N(s)=A (ms2+cs+Kp)+s (Bs+C)\begin{aligned} N(s) &= A\,(ms^2+cs+\eff{K_p}) \\ &\quad + s\,(Bs+C) \end{aligned}

Then compare both sides, one power of ss at a time. The plain numbers give AA, the s2s^2 terms give BB, and the ss terms give CC:

A=2−mgKpB=−m A,C=−c A\begin{gathered} A = \sp{2} - \frac{\dis{mg}}{\eff{K_p}} \\ B = -m\,A, \qquad C = -c\,A \end{gathered}

No new physics appears here: we have simply undone a common denominator to reach pieces our table can take back to time. Notice that AA doesn't care where the drone started.

Theo: And we never had to guess este^{st} once. The table did the guessing for us.

Step 4: look each piece up in the table we just derived: A/sA/s is a step, and the second piece is a decaying cosine plus a decaying sine (the side trip below shows how it fits those rows). Read off h(t)h(t).

June: Let's check it against the simulation!

Predict first! We start the drone on a 1 m ledge and run our formula next to the simulation. What will we see?

Chapter 9: Calculus into Algebra ↗

Mika: Uh-oh. The formula starts at zero, but the drone starts on the ledge at 1 m. The algebra is lying?

Theo: The algebra's fine. We lied. Look at Step 1: we wrote L{h′′}=s2H\mathcal{L}\{h''\} = s^2 H and L{h′}=s H\mathcal{L}\{h'\} = s\,H, and dropped every h(0)h(0). That's exactly the piece that remembers the ledge.

Flip the switch to put the starting-height terms back, and watch Steps 1 and 2 and the coefficients above change with it. The dashed formula and the blue simulation now sit exactly on top of each other: the biggest gap is less than a millionth of a metre, just rounding. Change Kp\eff{K_p} or the ledge height and they still agree.

Chapter 9: Calculus into Algebra ↗

Theo: In Chapter 2 we had to fly the drone to find its droop. Here it just fell out of a fraction.

What we know now

What we figured out

  • Slopes become multiplication: L{f′}=sF(s)−f(0)\mathcal{L}\{f'\} = sF(s) - f(0). The f(0)f(0) remembers where the signal started. Forget it and your answer starts in the wrong place.
  • We derived our own table: 1/s1/s, 1/(s−a)1/(s-a), ω/(s2+ω2)\omega/(s^2+\omega^2), and the shifted version for decaying sines. Areas scale and add, so we can transform an equation term by term.
  • Big fractions split into partial fractions: one unknown per power of ss in each bottom, found with the cover-up trick. A quadratic bottom becomes a shrinking cosine and sine.
  • Transform, do algebra, split into table pieces, read off the answer. The A/sA/s piece is where the drone settles, droop and all. It matches the simulation exactly, as long as you keep the starting values.

June: "Every time we solved something, the answer was (something) ÷ (a polynomial in s), and the drone's behaviour came from where the bottom is zero. What if that fraction is the drone?"

Chapter 9: Calculus into Algebra ↗