5. Taylor series – applications and intuition

For now I have one example: the linearized pendulum. Earlier we did see a little bit of physics with the discussion of the Lorenz factor and \(E = mc^2\gamma\).

But before we start on this example we have to have a brief introduction to differential equations!

5.1. A tiny introduction to differential equations

Let us step back to that (now almost nostalgic) time in which we learned how to take derivatives.

5.1.1. A glance at some differential equations and their answers

We will quickly write down some of the derivatives that we used in earlier chapters:

\[\begin{split}\frac{dx^n}{dx} & = n x^{n-1} \\ \frac{d \sin(x)}{dx} & = \cos(x) \\ \frac{d \cos(x)}{dx} & = - \sin(x) \\ \frac{d \sin(\omega x)}{dx} & = \omega \cos(\omega x) \\ \frac{d \cos(\omega x)}{dx} & = - \omega \sin(\omega x) \\ \frac{d e^x}{dx} & = e^x \\ \frac{d e^{rx}}{dx} & = r e^{rx} \\ \frac{d^2 e^{rx}}{dx^2} & = r^2 e^{rx}\end{split}\]

And a couple of higher order derivatives:

\[\begin{split}\frac{d^n x^n}{dx^n} & = n \times (n-1) \times \dots \times 1 = n! \\ \frac{d^2 \sin(\omega x)}{dx^2} & = - \omega^2 \sin(C x) \\ \frac{d^2 \cos(\omega x)}{dx^2} & = - \omega^2 \cos(C x)\end{split}\]

Now we ask three questions:

  1. If we know the derivative of a function, can we find what the original function was?

  2. If we know that the derivative of a function is related linearly to the function itself, can we find out what that function was?

  3. If we have any equation with derivatives of a function in it, can we find out what that function was?

Note that in these questions:

the unknown is not a number; the unknown is a function!!

Let us look at examples of all three questions, and their solutions:

  1. Given a derivative:

    Simple antiderivative:

    \[\begin{split}\textrm{Problem:} & \;\; \frac{df(x)}{dx} = x^4 \\ \\ \textrm{Solution:} & \;\; f(x) = \frac{1}{5} x^5 + C\end{split}\]

    Or for second order:

    \[\begin{split}\textrm{Problem:} & \;\; \frac{d^2f(x)}{dx^2} = x^7 \\ \\ \textrm{Solution:} & \;\; f(x) = \frac{1}{8\times 9} x^9 + C_1 x + C_2\end{split}\]

    Falling body, from Newton’s second law with force of gravity:

    \[\begin{split}\textrm{Problem:} & \;\; m \frac{d^2y(t)}{dt^2} = - m g \\ \\ \textrm{Solution:} & \;\; y(t) = - \frac{1}{2} g t^2 + v_0 t + h\end{split}\]

    Note that the two arbitrary constants here were the initial velocity \(v_0\) and the initial height from which you drop the body \(h\).

  2. Given a linear relation between the derivative and the function itself:

    Population growth:

    \[\begin{split}\textrm{Problem:} & \;\; \frac{df(x)}{dx} = r f(x) \\ \textrm{Solution:} & \;\; f(x) = A e^{rx}\end{split}\]

    Harmonic oscillator:

    (5.1.1)\[\begin{split}\textrm{Problem:} & \;\; \frac{d^2x(t)}{dt^2} = -\omega^2 x(t) \\ \textrm{Solution:} & \;\; x(t) = A \cos(\omega t) + B \sin(\omega t)\end{split}\]
  3. Given any arbitrary relation between the derivative, the function itself, and the variable:

    Falling body with air drag (solution is very difficult):

    \[m \frac{d^2y(t)}{dt^2} = -mg + c \left(\frac{dy(t)}{dt}\right)^2\]

    which you can write in Newton’s notation as:

    \[m \ddot{y} = -mg + c \left(\dot{y}\right)^2\]

    This has a nonlinear relationship between various derivatives and the function itself, which makes it much more difficult to solve.

5.1.2. How did we get those answers? Not by guessing, I hope!

Sadly the answer is that it is guesswork. I showed you the examples of derivatives first, so that when you then saw the differential equations you would match them to the examples you knew about.

In this section what we do is work through those examples and try to “get used to them”.

In the future, when you take a full course in differential equations, you will learn that there are some techniques that help your intuition.

5.1.3. And what’s with those arbitrary constants?

Understanding this harks back to the old days of the quadratic formula. Remember the \(\pm\) that reared its head?

Sometimes you have statements of problems that yield more than one solution. The way you pick between the solutions is by carefully considering the scientific logistics of the situation (the “word problem”, as it used to be called when we were younger).

Let us get used to that. Take the falling body:

\[y(t) = - \frac{1}{2} g t^2 + v_0 t + h\]

Now plug in \(t = 0\) and you get

\[y(0) = h\]

so our arbitrary constant h represents the height at time zero! Now look at the velocity at time zero:

\[\dot{y}(0) = v_0\]

so the other arbitrary constant \(v_0\) represents the velocity at time 0.

So one way of thinking about those arbitrary constants is that you find them by looking at the initial conditions.

A differential equation, paired with a description of the system at a starting point, is called an “initial value problem”.

For further study: there are many introductions to differential equations. You might take a look at these lecture slides:

https://www2.math.upenn.edu/~deturck/m104/notes/week5.pdf

archived by the wayback machine at:

http://web.archive.org/web/20240113235718if_/https://www2.math.upenn.edu/~deturck/m104/notes/week5.pdf

5.2. The pendulum: the equation and how to simplify it

The “simple pendulum” is a classic physics setup shown in Figure 5.2.1.

../_images/Pendulum_gravity.png

Figure 5.2.1 A force diagram of a simple pendulum. Because of the constraint of the string, the force of gravity acting on the mass in the direction of montion is \(mg \sin(\theta)\)

(Figure credit: wikipedia https://commons.wikimedia.org/wiki/File:Pendulum_gravity.svg licenced under the CC BY-SA 3.0 license.)

Here is how to think about these diagrams: the quantity \(\theta\) is a function of time – we could write it fully as \(\theta(t)\), since it will change with time as the pendulum swings.

Our scientific question then becomes: can you “solve” this equation, writing an expression:

\[\theta(t) = {\rm SomeFunctionExpression(t)}\]

The terminology used in physics is that we need to “solve Newton’s second equation” to find \(\theta.\)

Looking at the force diagram in the picture, we see focus on a very short bit of the arc of the circle that the pendulum’s mass is constrained to travel. That arc leads from the current position.

From geometry we know that the length of a bit of arc is:

\[\Delta {\rm ArcLength} = l \Delta(\theta)\]

where l is the length of the string. That expression \(l\theta\) is what will be used as a displacement in the classical physics equations.

Some simple trigonometry will tell us that for this system Newton’s 2nd law (\(F = m \frac{d^2(l \theta)}{dt^2}\)), combined with the force of gravity for a falling body (\(F_{\rm gravity} = -mg\sin(\theta)\)) will give us (after we cancel \(m\) which appears on both sides):

\[\begin{split}l \frac{d^2\theta}{dt^2} = -g\sin(\theta) \\ \frac{d^2\theta}{dt^2} + \frac{g}{l} \sin(\theta) = 0\end{split}\]

We use the name \(\omega\) (angular frequency) to refer to \(\sqrt{g/l}\), and we get:

\[\frac{d^2\theta}{dt^2} + \omega^2 \sin(\theta) = 0\]

At this time we are not yet looking at differential equations in detail, so we will simply mention (for those who have already studied them) that the general solution to this is very very difficult to find: it involves some advanced and subtle mathematical techniques, and the calculation of what are called elliptical integrals.

For a discussion of the general solution you can follow this video:

https://www.youtube.com/watch?v=efvT2iUSjaA

But the important thing to say here is that if \(\theta\) is a small angle, then we can approximate it with: \(\sin(\theta) \approx \theta\) and our equation becomes:

\[\begin{split}\frac{d^2\theta}{dt^2} + \omega^2 \theta = 0 \\\end{split}\]

or:

\[\frac{d^2\theta}{dt^2} = - \omega^2 \theta\]

This has us asking the question “hey, if you have a function where the slope of the slope of that function is equal to minus the function itself, what does that look like?”

We recognize this as the simple harmonic oscillator equation. We had first hinted at how this might be solved in Taylor Coefficients for sin() and cos() (Section 3.3), Equation (3.3.1). More recently we had recapitulated this type of differential equation Equation (5.1.1).

Using \(\omega = \sqrt{\frac{g}{l}}\) we get:

(5.2.1)\[\begin{split}\textrm{Problem:} & \;\; \frac{d^2\theta(t)}{dt^2} = -\frac{g}{l} \theta(t) \\ \textrm{Solution:} & \;\; \theta(t) = A \cos\left(\sqrt{\frac{g}{l}} t\right) + B \sin\left(\sqrt{\frac{g}{l}} t\right)\end{split}\]

5.3. Taylor series, and an intuition on why they work

5.3.1. Nomenclature

Remember: we always want to demistify terminology, so let’s see what names mathematicians use to talk about these series we have experimented with.

The kinds of series we work with most of the time are called power series. They have the form:

\[\sum_{k=0}^{N} c_k x^k\]

where \(c_k\) are constant coefficients. The name “power series” comes from the fact we have increasing powers of \(x\).

There is a particular type of power series called the Taylor series. The Taylor series is a wonderful tool which allows you to approximate a function near a certain point, let’s call it \(a\). It looks like:

(5.3.1)\[S(x) = \sum_{k=1}^{\infty} \frac{f^{(k)}(a)}{k!} (x - a)^k\]

This formula is dense, so let’s unpack the two parts of it.

There are the coefficients, which are constants (they do not depend on \(x\)): \(\frac{f^{(k)}(a)}{k!}\).

And there is the power term \((x-a)^k\), which does depend on \(x\).

So this looks like a polynomial of very high degree (you could almost say inifinite degree).

The series for \(sin(x)\), \(cos(x)\), and \(e^x\), which we saw in previous chapters, are all examples of Taylor series. They are all centered at zero, and the coefficients are the derivatives of the function, evaluated at zero. In class we can work out what all those derivatives are, and check that the formula we have been using is indeed the Taylor series.

You can understand this formula at two levels: you can either say “sure, when I made my plots I noticed that they approximate the sin, cos, and exponential functions nicely.”

Or you can say “hey that’s really cool: I wonder how those high order derivatives come in to it”.

5.3.2. Intuition on the Taylor Series derivatives

This is a good topic to develop with the students. By looking at Figure 2.5.1 we can see how the various higher derivatives in the sin function in Equation (5.3.1) nudge our series to get closer and closer to the actual value of the function.

[This writeup will continue when the students in the working group have come up with a good way of describing that intuition.]

5.4. A historical diversion: Bhaskara I’s formula

https://en.wikipedia.org/wiki/Bhaskara_I%27s_sine_approximation_formula