2  Scalar first order differential equations

Author

James Watmough

Published

January 18, 2025

The [OpenStax Calculus][] text covers most of the material we need for first order scalar1 differential equations. You should have covered all (or at least most) of OpenStax Calculus Volume 1 Chapter 4 in Math 1013. More specifically, you should be familiar with viewing a differential equation as a direction field (or vector field) Section 2.1. You should also master the two simplest solution tricks for first order equations: separable first order equations, and linear first order equations. These require nothing more than a basic mastery of integration.

2.1 Direction fields

A solution to a first order differential equation, \(y' = f(x,y)\), is a function, \(y(x)\), whose slope at \(x\) is \(f(x,y)\). One way to visualize this is to view \(f\) as a direction field. That is, \(f\) assigns a slope, or direction, to every point in the \(x\)-\(y\) plane.

Show the code
using Plots
using LaTeXStrings

plot_font = "Computer Modern"
default(fontfamily=plot_font,
        linewidth=2, framestyle=:box, label=nothing, grid=false)
Precompiling Plots...
    603.7 ms  ✓ LaTeXStrings
    547.8 ms  ✓ SimpleBufferStream
    574.9 ms  ✓ Pipe
    584.2 ms  ✓ StatsAPI
    626.4 ms  ✓ Contour
    756.4 ms  ✓ Measures
    965.7 ms  ✓ URIs
    504.4 ms  ✓ PtrArrays
    552.6 ms  ✓ DataAPI
    660.0 ms  ✓ NaNMath
   1317.8 ms  ✓ Grisu
    842.3 ms  ✓ Statistics
    847.6 ms  ✓ OrderedCollections
    576.5 ms  ✓ Reexport
    822.3 ms  ✓ Requires
    593.3 ms  ✓ BitFlags
   1859.2 ms  ✓ Format
    608.4 ms  ✓ TensorCore
   1519.8 ms  ✓ IrrationalConstants
   1010.4 ms  ✓ TranscodingStreams
    646.4 ms  ✓ StableRNGs
    819.2 ms  ✓ Unzip
    727.7 ms  ✓ DelimitedFiles
    786.0 ms  ✓ ExceptionUnwrapping
    908.3 ms  ✓ LoggingExtras
   1273.6 ms  ✓ ConcurrentUtilities
    992.0 ms  ✓ DocStringExtensions
   1006.0 ms  ✓ OpenSSL_jll
   2006.7 ms  ✓ MbedTLS
   1086.1 ms  ✓ Xorg_libICE_jll
   1004.2 ms  ✓ Wayland_protocols_jll
   1156.2 ms  ✓ Libffi_jll
   1348.3 ms  ✓ Libuuid_jll
   1299.3 ms  ✓ LLVMOpenMP_jll
   3030.6 ms  ✓ UnicodeFun
   1309.8 ms  ✓ Ogg_jll
   1457.6 ms  ✓ fzf_jll
   1243.5 ms  ✓ mtdev_jll
   1391.9 ms  ✓ JpegTurbo_jll
   4721.3 ms  ✓ MacroTools
   1519.5 ms  ✓ x264_jll
   1226.0 ms  ✓ Libiconv_jll
   1789.7 ms  ✓ x265_jll
   1241.3 ms  ✓ Graphite2_jll
   1292.8 ms  ✓ EpollShim_jll
   1465.9 ms  ✓ FriBidi_jll
   1410.6 ms  ✓ Xorg_libXau_jll
   1227.5 ms  ✓ libpng_jll
   1174.4 ms  ✓ Xorg_libXdmcp_jll
   1302.0 ms  ✓ LAME_jll
   1307.3 ms  ✓ libaom_jll
   1348.2 ms  ✓ Zstd_jll
   1134.0 ms  ✓ Opus_jll
   1320.6 ms  ✓ Expat_jll
   1366.3 ms  ✓ LZO_jll
   1071.8 ms  ✓ Xorg_xtrans_jll
   1241.2 ms  ✓ Bzip2_jll
   1319.4 ms  ✓ Libmount_jll
   1209.8 ms  ✓ libfdk_aac_jll
   1259.4 ms  ✓ LERC_jll
   1242.3 ms  ✓ gperf_jll
   1362.3 ms  ✓ XZ_jll
   1301.6 ms  ✓ libevdev_jll
   1430.2 ms  ✓ Libgpg_error_jll
   1205.6 ms  ✓ Xorg_libpthread_stubs_jll
    930.2 ms  ✓ AliasTables
    946.8 ms  ✓ Missings
    866.7 ms  ✓ Showoff
   1023.2 ms  ✓ CodecZlib
   1754.6 ms  ✓ Statistics → SparseArraysExt
   1515.9 ms  ✓ LogExpFunctions
   1272.0 ms  ✓ Xorg_libSM_jll
   3520.5 ms  ✓ JSON
   1384.5 ms  ✓ Pixman_jll
   3690.5 ms  ✓ RecipesBase
   1782.3 ms  ✓ libvorbis_jll
   1304.1 ms  ✓ XML2_jll
   1332.3 ms  ✓ Dbus_jll
   4716.0 ms  ✓ DataStructures
   1810.9 ms  ✓ FreeType2_jll
   2903.2 ms  ✓ JLFzf
   1561.2 ms  ✓ eudev_jll
   5806.2 ms  ✓ FixedPointNumbers
   5404.2 ms  ✓ OpenSSL
   1893.0 ms  ✓ Libtiff_jll
   1374.9 ms  ✓ Libgcrypt_jll
   1166.3 ms  ✓ SortingAlgorithms
   1380.1 ms  ✓ Gettext_jll
   1574.3 ms  ✓ Wayland_jll
   1351.6 ms  ✓ libinput_jll
   1709.5 ms  ✓ Fontconfig_jll
   1294.3 ms  ✓ XSLT_jll
   1552.7 ms  ✓ Glib_jll
   6419.9 ms  ✓ Latexify
   3189.4 ms  ✓ ColorTypes
    943.1 ms  ✓ ColorTypes → StyledStringsExt
   2219.7 ms  ✓ Xorg_libxcb_jll
   1549.1 ms  ✓ Latexify → SparseArraysExt
   1049.1 ms  ✓ Xorg_xcb_util_jll
   4657.8 ms  ✓ StatsBase
   1300.6 ms  ✓ Xorg_libX11_jll
   1291.3 ms  ✓ Xorg_xcb_util_keysyms_jll
   1293.6 ms  ✓ Xorg_xcb_util_renderutil_jll
   1373.3 ms  ✓ Xorg_xcb_util_image_jll
   1411.2 ms  ✓ Xorg_xcb_util_wm_jll
   1413.2 ms  ✓ Xorg_libXrender_jll
   4485.8 ms  ✓ ColorVectorSpace
   1387.4 ms  ✓ Xorg_libXext_jll
   1484.5 ms  ✓ Xorg_libXfixes_jll
   1470.9 ms  ✓ Xorg_libxkbfile_jll
   1416.5 ms  ✓ Xorg_xcb_util_cursor_jll
   1379.8 ms  ✓ Xorg_libXinerama_jll
   1464.3 ms  ✓ Xorg_libXrandr_jll
   1280.3 ms  ✓ Xorg_libXi_jll
   1361.2 ms  ✓ Xorg_libXcursor_jll
   1580.4 ms  ✓ Libglvnd_jll
   1705.4 ms  ✓ Cairo_jll
   1140.0 ms  ✓ Xorg_xkbcomp_jll
    902.2 ms  ✓ HarfBuzz_jll
   1109.4 ms  ✓ Xorg_xkeyboard_config_jll
   1483.8 ms  ✓ libass_jll
   1597.3 ms  ✓ Pango_jll
   9637.1 ms  ✓ Colors
   1314.4 ms  ✓ xkbcommon_jll
   1672.9 ms  ✓ FFMPEG_jll
   1168.8 ms  ✓ Vulkan_Loader_jll
   1244.0 ms  ✓ libdecor_jll
   1046.2 ms  ✓ FFMPEG
   1288.1 ms  ✓ GLFW_jll
   1427.4 ms  ✓ Qt6Base_jll
   1325.8 ms  ✓ Qt6ShaderTools_jll
   1542.7 ms  ✓ GR_jll
   4726.1 ms  ✓ ColorSchemes
   2782.6 ms  ✓ Qt6Declarative_jll
   1444.1 ms  ✓ Qt6Wayland_jll
  38562.6 ms  ✓ Unitful
   3047.2 ms  ✓ UnitfulLatexify
  29475.0 ms  ✓ HTTP
  15530.8 ms  ✓ PlotUtils
   4579.7 ms  ✓ GR
   3078.2 ms  ✓ PlotThemes
   4315.2 ms  ✓ RecipesPipeline
  56373.0 ms  ✓ Plots
   2987.5 ms  ✓ Plots → UnitfulExt
  144 dependencies successfully precompiled in 113 seconds. 43 already precompiled.
Show the code
f(t,x) = 2*t-1-3*x

t = collect(1:.3:4)
x = collect(0:.3:2)
dirfield(t,x) = [1; f(t,x)]/10
fig = quiver(
        repeat(t,length(x)),
        repeat(x,inner=length(t)),
        quiver=dirfield
      )
plot!(fig,ylabel = "x")
plot!(fig,xlabel = "t")
Figure 2.1: Direction field for \(f:(t,x)\to 2t -1 - 3x\).

2.2 Terminology and Notation

We will focus on equations of the form \[\dot{x} = f(x,t,\mu), \quad x\in U\subset{\mathbb R}^n, \quad t\in{\mathbb R}, \quad \mu\in V\subset{\mathbb R}^p. \tag{2.1}\] Here, the over-dot refers to differentiation with respect to the independent variable, \(t\), \(x\) is our vector of dependent variables, and \(\mu\) is a vector of model parameters.

By a solution to Equation 2.1 we mean a differentiable function \(\phi\) from some interval of time, \(I \subset {\mathbb R}\), into \({\mathbb R}^n\) such that \(\dot{\phi}(t) = f(\phi(t),t,\mu)\). Geometrically, \(\phi\) is a curve in \({\mathbb R}^n\) parameterized by \(t\) and tangent to the vector \(f\) at each point. We will refer to \(U\), or \({\mathbb R}^n\), as the state space (or sometimes phase space) of the system, and \(f:U\to{\mathbb R}^n\) as a vector field on \(U\) (or sometimes direction field). Note, when convenient, we will use \(x\) to denote the solution instead of introducing \(\phi\) or another new symbol. Most often it is clear from context whether \(x\) is referring to a point in state space, or a curve through state space parameterized by \(t\).

We use \(\phi(t,t_0,x_0)\) to denote the solution passing through the point \(x_0\) at time \(t_0\), If we are also interested in the dependence on the parameters, we will use \(\phi(t,t_0,x_0,\mu)\), or if we are only interested in the dependence of the solution on the parameters, \(\phi(t,\mu)\). If the initial time is clear from the problem, usually when \(t_0=0\), then we will use \(\phi(t,x_0)\) or \(\phi(t,x_0,\mu)\).

The solution curve through state space will sometimes be referred to as a trajectory through \(x_0\) at time \(t_0\), usually with the notation \(\phi(t,t_0,x_0)\). The set of points comprising the trajectory will be referred to as the orbit, \(O(x_0)\), through \(x_0\) at time \(t_0\).

This terminology relies assumes the existence and uniqueness of solutions. Suppose \(f\) is \(r\)-times differentiable in \(x\), \(t\) and \(\mu\) with \(r\ge 1\) and each derivative continuous, then given any \(t_0\in{\mathbb R}\) and \(x_0\in U\) there is a unique solution through \(x_0\) at time \(t_0\), and this solution is \(r\)-times differentiable in \(t\), \(x_0\), \(t_0\) and \(\mu\).

Example 2.1 The simple pendulum \[\ddot{x} - x = 0\] can be cast as a system of first order equations with the introduction of a new dependent variable \(y = \dot{x}\)

\[\begin{aligned} \dot{x} &= y \\ \dot{y} &= -x \end{aligned} \tag{2.2}\]

The state of the pendulum is completely described by its angle and angular velocity, \((x,y) \in {\mathbb R}^2\). The solution passing through the initial state \((x_0,0)\) at time \(t_0=0\) is \((x(t),y(t)) = (x_0\cos t, -x_0\sin t)\). Note that the initial conditions are a pair of real numbers, \((x_0,y_0)\), and for this solution we have \(y_0=0\). The orbit, \(O((x_0,0))\), is the circle \(x^2 + y^2 = x_0^2\).

Example 2.2 The damped pendulum \[\ddot{x} -\alpha x\dot{x} + \sin(x) = \sin(\omega t)\] can be cast as a system of first order equations with the introduction of a new dependent variable \(y = \dot{x}\) \[\begin{aligned} \dot{x} &= y \\ \dot{y} &= \alpha xy - \sin(x) + \sin(\omega t) \end{aligned} \tag{2.3}\]

Example 2.3 The simple SIR model

\[\begin{aligned} S' &= \Lambda -\mu S - \beta SI, \\ I' &= \beta SI -(\alpha + \mu)I, \\ R' &= \alpha I - \mu R, \end{aligned} \tag{2.4}\]

Here the state variables are populations of susceptible, \(S\), infected, \(I\), and recovered, \(R\) individuals. Our state spaces is the nonnegative cone (octant) of \({\mathbb R}^3\), our parameter space is the positive cone of \({\mathbb R}^4\), since all parameters are assumed to be positive.

Since the dynamics of \(S\) and \(I\) decouple from those of \(R\), we can consider the simpler two state system separately.

Example 2.4 The classic logistic growth model should be introduced as \[\frac{dN}{dt} = bN-(d+aN)N\] where the population size, or density, \(N\) is our dependent variable, time, \(t\), is our independent variable, and \(b\), \(d\), and \(a\) are parameters representing birth, death, and increased mortality due to crowding, respectively. Assume the three parameters are positive real numbers.

This is more commonly written as \(\frac{dN}{dt} = rN(1-N/K)\), with \(r = b-d\), \(K = (b-d)/a\), and the added assumption that \(b>d\).

Exercise 2.1 First, suppose \(b\ne d\) and show that we can, without loss of generality, rescale \(t\) by the net growth rate \(r\) giving rise to the equation \[\frac{dN}{dt} = N-\frac{N^2}{K}\]

Second, let \(x(t) = \bar{N}^{-1} N(t)\), and show that \(x\) must satisfy the equation \[\frac{dx}{dt} = x-\dfrac{\bar{N}}{K}x^2\]

Hence, setting \(\bar{N} = K\) results in an ODE for \(x\) with no free parameters. Note, if \(x(t)\), with the rescaled time is a solution to this last equation, then \(N(t^*) = \bar{N}x(rt^*)\) is a solution to the original equation with the original time scale.

Exercise 2.2 Repeat Exercise 2.1 under the assumption \(b < d\). Be sure to keep the scales positive so that rescaled time and population have the same signs as the original variables.

2.3 First order separable equations

A first order linear differential equation of the form \(\frac{dy}{dt} = f(y)g(t)\) is said to be separable. It can be solved by a single integration step. \[\begin{align*} \frac{dy}{dt} &= f(y)g(t) \\ \frac{1}{f(y)}\frac{dy}{dt} &= g(t) \\ \int \frac{1}{f(y)}\frac{dy}{dt}\,dt &= \int g(t)\,dt + C \\ \int \frac{1}{f(y)}\,dy &= \int g(t)\,dt + C \end{align*}\]

Example 2.5 Find the general solution to the differential equation \(\frac{dy}{dt} = ry\cos(t)\).

Separating variables and integrating leads to \[\begin{align} \int \frac{1}{y}\,dy &= \int r\cos(t)\,dt +C \\ \log |y| &= r\sin t + C \\ y(t) &= \pm\exp(C+r\sin t ) \end{align}\] The solution is usually given in the form \(y(t) = y_0e^{r\sin(t)}\). Since \(C\) is an arbitrary constant, \(y_0 = \pm e^C\) is also arbitrary.

Note

Since we divide by \(y\) on our first step in this example, we must assume \(y\ne0\). However, it is easy to see by inspection that \(y=0\) is also a solution to the equation.
Hence, we can express the general solution as \(y(t) = y_0\exp(r\sin t)\) where \(y_0\) can be any real number.

Example 2.6 Find the general solution to the differential equation \(\frac{dy}{dx} = \frac{6x^2}{2y+\cos y}\).

Separating variables and integrating leads to \[\begin{align} \int (2y+\cos y)\,dy&= \int 6x^2 \, dx + C \\ y^2+\sin y &= 2x^3 + C \end{align}\] In this case, we are not able to solve for \(y\) as a function of \(x\). We are left with \(y\) defined implicitly as a function of \(x\).

Despite not being able to find an analytic expression for \(y\) as a function of \(x\) in this example, we can still make nice plots of the solutions. The trick is to notice that we can find the inverse of the solution. Several solutions are shown in Figure 2.2

Show the code
inversesoln(y,c) = cbrt.(y.*y +sin.(y)/2 .-c/2)
y = range(-pi,pi,100)
plot(legends=false)
for c in -1.2:.2:1.2
  plot!(inversesoln(y,c),y)
end
plot!(xlabel='x')
plot!(ylabel='y')
Figure 2.2: Sample solutions for Example 2.6

Example 2.7 Solve the differential equation \(\frac{dy}{dx} = \frac{x^2}{y^2}\).

Separating variables and integrating leads to \(\frac{y^3}{3} = \frac{x^3}{3} + C\). Solving for the dependent variable leads to \(y = \sqrt[3]{x^3+3C}\).

Example 2.8 Solve the differential equation \(\frac{dy}{dx} = -\frac{2x}{y}\).

Separating variables and integrating leads to \(\frac{y^2}{2} = -x^2 + C\), which is a family of ellipses.

Example 2.9 Solve the differential equation \(\frac{du}{dt} = 2 + 2u + t + tu\).

Here \(u\) is our dependent variable. The equation is both linear and separable so we may choose either method. \[\begin{align*} \frac{du}{dt} &= (2+t)(1+u) \\ \int \frac{du}{1+u} &= \int (2+t) \, dt \\ \ln|1+u| &= 2t+\frac{t^2}{2} + C \\ |1+u| &= A \exp(2t+\frac{t^2}{2}) \\ u &= -1 \pm A \exp(2t+\frac{t^2}{2}) \end{align*}\] Note the use of \(\pm\) is not necessary. Since \(A\) could be positive or negative. It just serves to remind us that integration of \(1/(1+u)\) leads to two solutions.

Example 2.10 Solve the differential equation \(xy' + y = y^2\). This is nonlinear, due to the \(y^2\) term. It is separable. \[\begin{align*} \frac{1}{y^2-y} y' &= \frac{1}{x} \\ \int \frac{dy}{y^2-y} &= \int \frac{dx}{x} \\ \int \frac{1}{y-1} - \frac{1}{y} dy &= \int \frac{dx}{x} \\ \ln|y-1| - \ln|y| &= \ln|x| + C \\ \ln\frac{|y-1|}{|x||y|} &= C \\ \frac{|y-1|}{|x||y|} &= A \end{align*}\] there are in fact several solutions buried in this notation. For example, if \(0< y < 1\), then \(\frac{|y-1|}{|x||y|} = \frac{1-y}{xy}\), and we find \(1/y - 1 = A/x \rightarrow y = x/(A+x)\), \(A>0\).

As a further exercise, sketch a few sample solutions with \(y< 0\), \(0 < y < 1\) and \(y>1\).

2.4 Linear first order differential equations

Consider a differential equation of the form \(y'(t) +p(t) y(t) = q(t)\) with initial data \(y(t_0) = y_0\). These can be integrated using an integrating factor. The trick is to find a factor, \(u\), which turns the left hand side of the equation into the derivative of something familiar. We multiply both sides of the equation by \(u\), \[u(t)y'(t) +u(t)p(t) y(t) = u(t)q(t).\] Notice that if we can choose \(u\) so that \(up = u'\), then the left hand side is the derivative of \(uy\): \[\left(uy\right)' = uy' +u' y = uy' +up y = uq.\] We can solve this with a single integration \[\begin{gather} \frac{d}{dt}\left(u(t)y(t)\right) = u(t)q(t) \\ u(t)y(t) = \int u(s)q(s) \, ds \\ y(t) = \frac{1}{u(t)} \int u(s)q(s)\, ds \end{gather}\] There is an arbitrary constant resulting from in the integration of \(uq\). We’ll use use our initial conditions to determine that once we determined \(u\).

Returning to \(u'=pu\), the differential equation for \(u\), we see it is separable and has solutions of the form \(u(t) = \exp(\int p)\). To make the result more readable, define \(P(t) = \int_{t_0}^t p(s) \, ds\) and take \(u\) as \(u(t) = \exp(P(t))\). This is the solution that also satisfies \(u(t_0)=1\), which is convenient. Putting this together with our expression for \(y\), we find, in terms of \(P\), \[y(t) = e^{-P(t)} \int e^{P(s)}q(s)\, ds\] This is our general solution, since it still has the constant of integration hiding in the integral. Applying the initial conditions we find \[y(t) = e^{-P(t)} \left( y_0 + \int_{t_0}^t e^{P(s)}q(s)\, ds \right)\]

Warning

I advise against memorizing this formula. Instead memorize the technique. Applying the technique is often simpler than applying the formula, and we’ll extend the ideas behind the method later in the course.

Example 2.11 Solve the initial value problem \(t^2y' + 2ty = \log t, \ y(1) = 2\).

You can probably guess the integrating factor by noticing the left hand side looks like the product rule applied to \(t^2y\). Specifically, \[\begin{align*} t^2y' + 2ty &= \log t \\ \dfrac{d}{dt}\left(t^2y\right) &= \log t \\ \left. s^2y(s) \right|_{s=1}^{s=t} &= \int_1^t \log s \, ds \\ t^2y(t) - y(1) &= t\log(t) - t + 1 \\ y(t) &= \frac{1}{t} \log(t) - \frac{1}{t} + \frac{3}{t^2} \end{align*}\]

Tip

If you don’t immediately recognize the integrating factor, first rewrite the problem as \(y' + \dfrac{2}{t} y = \frac{1}{t^2}\log t\) The integrating factor can be computed as \(u(t) = \exp\left(\displaystyle\int \frac{2}{t} \, dt\right) = t^2\)

2.5 Poincaré Maps

Example 2.12 Consider the logistic model with \(r>0\) and periodic harvesting. \[\frac{dx}{dt} = rx(1-x) - h(1+\sin(2\pi t))\] Here, to keep consistent with the example of Hirsch, Smale, and Devaney (Hirsch, Smale, and Devaney 2013, sec. 1.4) we’ve rescaled the population by \(K\) and rescaled time so that the period of harvesting is one.

This equation is neither linear, nor separable, so we have no tools at our disposal to find a nice form of the solution.

Show the code
using DifferentialEquations

using Plots
using LaTeXStrings

plot_font = "Computer Modern"
default(fontfamily=plot_font,
        linewidth=2, framestyle=:box, label=nothing, grid=false)

f(x,p,t) = p.r*x*(1-x) - p.h*(1+sin(2*pi*t))

p = (r = 2., h = .2)

t = collect(0:.2:2)
x = collect(0:.2:1)
dirfield(t,x) = [1; f(x,p,t)]/10
fig = quiver(repeat(t,length(x)),repeat(x,inner=length(t)),quiver=dirfield)
plot!(fig,ylabel = L"\textrm{Population, } \textit{\ x}")
plot!(fig,xlabel = L"\textrm{time, } \textit{\ t}")

x0 = 0.5
tspan = (0.,2.)
prob = ODEProblem(f,x0,tspan,p)
for x0 in .25:.25:1 
  prob = remake(prob;u0 = x0)
  sol = solve(prob)
  plot!(fig,sol)
end

fig
Precompiling DifferentialEquations...
    506.1 ms  ✓ DataValueInterfaces
    532.8 ms  ✓ SimpleUnPack
    571.5 ms  ✓ ConcreteStructs
    581.0 ms  ✓ IteratorInterfaceExtensions
    688.8 ms  ✓ ExprTools
    799.2 ms  ✓ InverseFunctions
    988.5 ms  ✓ ADTypes
    495.4 ms  ✓ UnPack
    492.9 ms  ✓ CommonSolve
   1158.0 ms  ✓ FunctionWrappers
    703.9 ms  ✓ PoissonRandom
    650.3 ms  ✓ ManualMemory
    657.9 ms  ✓ EnumX
    576.6 ms  ✓ IfElse
    727.0 ms  ✓ Inflate
   1915.2 ms  ✓ OffsetArrays
    572.2 ms  ✓ CommonWorldInvalidations
    757.7 ms  ✓ ConstructionBase
    586.6 ms  ✓ FastClosures
    614.2 ms  ✓ StaticArraysCore
    634.5 ms  ✓ MuladdMacro
   1747.7 ms  ✓ RandomNumbers
    791.0 ms  ✓ PositiveFactorizations
    731.4 ms  ✓ CEnum
    518.7 ms  ✓ SIMDTypes
   2354.5 ms  ✓ FastLapackInterface
    651.7 ms  ✓ CompositionsBase
    680.9 ms  ✓ FastPower
    805.3 ms  ✓ Adapt
   1675.0 ms  ✓ FillArrays
   1022.5 ms  ✓ EnzymeCore
    907.7 ms  ✓ CommonSubexpressions
   1377.1 ms  ✓ Distances
   1115.7 ms  ✓ CpuId
   2068.2 ms  ✓ GenericSchur
    976.8 ms  ✓ SuiteSparse
    876.4 ms  ✓ TruncatedStacktraces
   1359.4 ms  ✓ SimpleTraits
   1664.7 ms  ✓ KLU
   1178.3 ms  ✓ OpenSpecFun_jll
   1185.5 ms  ✓ Rmath_jll
    760.7 ms  ✓ TableTraits
   1360.2 ms  ✓ oneTBB_jll
   2429.5 ms  ✓ Sundials_jll
   2896.8 ms  ✓ ChainRulesCore
   1038.9 ms  ✓ RuntimeGeneratedFunctions
   2173.1 ms  ✓ QuadGK
    905.9 ms  ✓ InverseFunctions → InverseFunctionsDatesExt
    925.6 ms  ✓ LogExpFunctions → LogExpFunctionsInverseFunctionsExt
   1278.3 ms  ✓ InverseFunctions → InverseFunctionsTestExt
   2756.3 ms  ✓ IntelOpenMP_jll
   1016.1 ms  ✓ Parameters
    793.2 ms  ✓ FunctionWrappersWrappers
   2391.8 ms  ✓ DifferentiationInterface
    805.7 ms  ✓ ConstructionBase → ConstructionBaseLinearAlgebraExt
   2527.1 ms  ✓ SparseMatrixColorings
   2002.0 ms  ✓ ThreadingUtilities
    873.5 ms  ✓ ADTypes → ADTypesConstructionBaseExt
    978.8 ms  ✓ DiffResults
   2241.7 ms  ✓ Static
   1284.2 ms  ✓ CompositionsBase → CompositionsBaseInverseFunctionsExt
   3439.3 ms  ✓ Sparspak
   1548.1 ms  ✓ GPUArraysCore
   1609.7 ms  ✓ ArrayInterface
   2399.6 ms  ✓ Random123
   6253.1 ms  ✓ TimerOutputs
   1039.4 ms  ✓ OffsetArrays → OffsetArraysAdaptExt
   1125.2 ms  ✓ FillArrays → FillArraysStatisticsExt
    842.0 ms  ✓ EnzymeCore → AdaptExt
    961.9 ms  ✓ ADTypes → ADTypesEnzymeCoreExt
   1604.8 ms  ✓ FillArrays → FillArraysSparseArraysExt
   1616.6 ms  ✓ Distances → DistancesSparseArraysExt
   2331.8 ms  ✓ PDMats
   1329.7 ms  ✓ ChainRulesCore → ChainRulesCoreSparseArraysExt
   2028.0 ms  ✓ Rmath
   1882.6 ms  ✓ Tables
    980.1 ms  ✓ ADTypes → ADTypesChainRulesCoreExt
   1066.1 ms  ✓ Distances → DistancesChainRulesCoreExt
  14117.1 ms  ✓ Krylov
    923.2 ms  ✓ DifferentiationInterface → DifferentiationInterfaceChainRulesCoreExt
   2959.1 ms  ✓ LogExpFunctions → LogExpFunctionsChainRulesCoreExt
   1456.0 ms  ✓ DifferentiationInterface → DifferentiationInterfaceSparseArraysExt
   2610.5 ms  ✓ MKL_jll
   1549.4 ms  ✓ Functors
   1057.5 ms  ✓ BitTwiddlingConvenienceFunctions
   6484.4 ms  ✓ SpecialFunctions
   1918.4 ms  ✓ DifferentiationInterface → DifferentiationInterfaceSparseMatrixColoringsExt
   2872.8 ms  ✓ Setfield
   1094.4 ms  ✓ ArrayInterface → ArrayInterfaceChainRulesCoreExt
    936.7 ms  ✓ SciMLStructures
   1441.0 ms  ✓ MaybeInplace
   2960.3 ms  ✓ CPUSummary
    836.3 ms  ✓ ArrayInterface → ArrayInterfaceGPUArraysCoreExt
   1040.4 ms  ✓ ArrayInterface → ArrayInterfaceStaticArraysCoreExt
   1522.4 ms  ✓ ArrayInterface → ArrayInterfaceSparseArraysExt
   4089.1 ms  ✓ StaticArrayInterface
   4605.9 ms  ✓ Accessors
   1736.3 ms  ✓ FillArrays → FillArraysPDMatsExt
   2124.8 ms  ✓ HostCPUFeatures
   1633.4 ms  ✓ LevyArea
   1420.4 ms  ✓ DiffRules
   2546.6 ms  ✓ HypergeometricFunctions
   1475.7 ms  ✓ MaybeInplace → MaybeInplaceSparseArraysExt
   1342.5 ms  ✓ PolyesterWeave
   1079.3 ms  ✓ StaticArrayInterface → StaticArrayInterfaceOffsetArraysExt
   4440.8 ms  ✓ SpecialFunctions → SpecialFunctionsChainRulesCoreExt
   2043.8 ms  ✓ FiniteDiff
   1069.8 ms  ✓ CloseOpenIntervals
   1427.4 ms  ✓ Accessors → TestExt
   1335.2 ms  ✓ Accessors → LinearAlgebraExt
  18767.4 ms  ✓ StaticArrays
   1723.0 ms  ✓ LayoutPointers
   1506.2 ms  ✓ Accessors → DatesExt
   1447.0 ms  ✓ DifferentiationInterface → DifferentiationInterfaceFiniteDiffExt
   1989.0 ms  ✓ FiniteDiff → FiniteDiffSparseArraysExt
   1563.8 ms  ✓ StaticArrays → StaticArraysStatisticsExt
  11248.4 ms  ✓ SparseConnectivityTracer
   4234.4 ms  ✓ SciMLOperators
   5155.4 ms  ✓ StatsFuns
   3836.5 ms  ✓ SymbolicIndexingInterface
   2418.6 ms  ✓ StaticArrays → StaticArraysChainRulesCoreExt
   2007.0 ms  ✓ ResettableStacks
   1927.7 ms  ✓ ConstructionBase → ConstructionBaseStaticArraysExt
   2199.1 ms  ✓ Adapt → AdaptStaticArraysExt
   1727.4 ms  ✓ DifferentiationInterface → DifferentiationInterfaceStaticArraysExt
   3935.3 ms  ✓ ArnoldiMethod
   2396.1 ms  ✓ StaticArrayInterface → StaticArrayInterfaceStaticArraysExt
   1926.0 ms  ✓ FiniteDiff → FiniteDiffStaticArraysExt
   2338.0 ms  ✓ Accessors → StaticArraysExt
   4877.6 ms  ✓ FastGaussQuadrature
  12011.8 ms  ✓ ForwardDiff
   2860.6 ms  ✓ StrideArraysCore
   2848.9 ms  ✓ SparseConnectivityTracer → SparseConnectivityTracerNaNMathExt
   2855.9 ms  ✓ SparseConnectivityTracer → SparseConnectivityTracerLogExpFunctionsExt
   1142.5 ms  ✓ SciMLOperators → SciMLOperatorsStaticArraysCoreExt
  40639.3 ms  ✓ MLStyle
   1294.1 ms  ✓ StatsFuns → StatsFunsInverseFunctionsExt
   1679.4 ms  ✓ SciMLOperators → SciMLOperatorsSparseArraysExt
   3272.4 ms  ✓ SparseConnectivityTracer → SparseConnectivityTracerSpecialFunctionsExt
   1298.8 ms  ✓ FastPower → FastPowerForwardDiffExt
   1995.7 ms  ✓ ForwardDiff → ForwardDiffStaticArraysExt
   3362.4 ms  ✓ StatsFuns → StatsFunsChainRulesCoreExt
   1465.3 ms  ✓ PreallocationTools
   1766.6 ms  ✓ DifferentiationInterface → DifferentiationInterfaceForwardDiffExt
   4950.4 ms  ✓ RecursiveArrayTools
   2234.9 ms  ✓ NLSolversBase
   1375.8 ms  ✓ Polyester
  35896.5 ms  ✓ ArrayLayouts
   1481.7 ms  ✓ RecursiveArrayTools → RecursiveArrayToolsForwardDiffExt
   1870.5 ms  ✓ RecursiveArrayTools → RecursiveArrayToolsSparseArraysExt
   1437.8 ms  ✓ FastBroadcast
   1778.4 ms  ✓ ArrayLayouts → ArrayLayoutsSparseArraysExt
   4286.8 ms  ✓ LineSearches
   1515.7 ms  ✓ RecursiveArrayTools → RecursiveArrayToolsFastBroadcastExt
   2889.9 ms  ✓ MatrixFactorizations
  11631.7 ms  ✓ Graphs
   3066.3 ms  ✓ NLsolve
  14208.3 ms  ✓ Distributions
   2318.0 ms  ✓ VertexSafeGraphs
   5975.9 ms  ✓ LazyArrays
   3165.0 ms  ✓ Distributions → DistributionsTestExt
   3169.5 ms  ✓ Distributions → DistributionsChainRulesCoreExt
  23129.2 ms  ✓ VectorizationBase
  13762.4 ms  ✓ Expronicon
   8218.1 ms  ✓ Optim
   3093.4 ms  ✓ LazyArrays → LazyArraysStaticArraysExt
   1723.9 ms  ✓ SLEEFPirates
   5143.4 ms  ✓ SparseDiffTools
   1758.8 ms  ✓ SparseDiffTools → SparseDiffToolsPolyesterExt
  15772.4 ms  ✓ SciMLBase
   2400.8 ms  ✓ SciMLBase → SciMLBaseChainRulesCoreExt
  31945.1 ms  ✓ BandedMatrices
   6490.4 ms  ✓ SciMLJacobianOperators
   2508.6 ms  ✓ FiniteDiff → FiniteDiffBandedMatricesExt
   2518.4 ms  ✓ ArrayInterface → ArrayInterfaceBandedMatricesExt
   2789.7 ms  ✓ BandedMatrices → BandedMatricesSparseArraysExt
   2931.4 ms  ✓ MatrixFactorizations → MatrixFactorizationsBandedMatricesExt
   3876.8 ms  ✓ LazyArrays → LazyArraysBandedMatricesExt
  11570.8 ms  ✓ DiffEqBase
   3188.0 ms  ✓ DiffEqBase → DiffEqBaseChainRulesCoreExt
   3274.7 ms  ✓ DiffEqBase → DiffEqBaseSparseArraysExt
   8798.8 ms  ✓ LineSearch
   3826.2 ms  ✓ DiffEqBase → DiffEqBaseDistributionsExt
   9604.9 ms  ✓ DiffEqCallbacks
  16234.3 ms  ✓ NonlinearSolveBase
   9610.4 ms  ✓ JumpProcesses
   4843.4 ms  ✓ LineSearch → LineSearchLineSearchesExt
  19291.3 ms  ✓ FastAlmostBandedMatrices
  15518.2 ms  ✓ OrdinaryDiffEqCore
   4442.6 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseSparseMatrixColoringsExt
   4242.1 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseForwardDiffExt
   9025.4 ms  ✓ SteadyStateDiffEq
  11417.3 ms  ✓ DiffEqNoiseProcess
   4098.4 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseBandedMatricesExt
   4442.5 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseSparseArraysExt
   3616.0 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseLineSearchExt
   3090.5 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseDiffEqBaseExt
   2901.5 ms  ✓ OrdinaryDiffEqCore → OrdinaryDiffEqCoreEnzymeCoreExt
  53563.0 ms  ✓ LoopVectorization
   4783.9 ms  ✓ OrdinaryDiffEqFunctionMap
   5820.5 ms  ✓ OrdinaryDiffEqPRK
   6195.8 ms  ✓ OrdinaryDiffEqExplicitRK
   7221.7 ms  ✓ OrdinaryDiffEqStabilizedRK
   8674.0 ms  ✓ OrdinaryDiffEqSSPRK
   5600.1 ms  ✓ OrdinaryDiffEqQPRK
   7177.4 ms  ✓ OrdinaryDiffEqRKN
   6764.5 ms  ✓ OrdinaryDiffEqSymplecticRK
   8228.6 ms  ✓ OrdinaryDiffEqHighOrderRK
   2468.6 ms  ✓ LoopVectorization → SpecialFunctionsExt
  42089.4 ms  ✓ Sundials
   3298.2 ms  ✓ LoopVectorization → ForwardDiffExt
   8842.3 ms  ✓ OrdinaryDiffEqFeagin
  20935.2 ms  ✓ OrdinaryDiffEqTsit5
   3081.7 ms  ✓ TriangularSolve
  14138.5 ms  ✓ OrdinaryDiffEqLowOrderRK
  11718.8 ms  ✓ OrdinaryDiffEqLowStorageRK
   5323.0 ms  ✓ OrdinaryDiffEqNordsieck
   5325.8 ms  ✓ OrdinaryDiffEqAdamsBashforthMoulton
 117794.4 ms  ✓ ExponentialUtilities
   1937.4 ms  ✓ ExponentialUtilities → ExponentialUtilitiesStaticArraysExt
  13720.9 ms  ✓ RecursiveFactorization
  77287.2 ms  ✓ SimpleNonlinearSolve
   3731.8 ms  ✓ SimpleNonlinearSolve → SimpleNonlinearSolveChainRulesCoreExt
  60798.4 ms  ✓ OrdinaryDiffEqVerner
   3423.9 ms  ✓ OrdinaryDiffEqLinear
  40873.7 ms  ✓ LinearSolve
   3593.9 ms  ✓ LinearSolve → LinearSolveRecursiveArrayToolsExt
   3665.4 ms  ✓ LinearSolve → LinearSolveEnzymeExt
   4669.0 ms  ✓ LinearSolve → LinearSolveFastAlmostBandedMatricesExt
   5448.9 ms  ✓ NonlinearSolveBase → NonlinearSolveBaseLinearSolveExt
   6088.9 ms  ✓ LinearSolve → LinearSolveBandedMatricesExt
   5155.5 ms  ✓ OrdinaryDiffEqDifferentiation
   8571.4 ms  ✓ OrdinaryDiffEqExtrapolation
  30926.8 ms  ✓ NonlinearSolveFirstOrder
  29316.3 ms  ✓ OrdinaryDiffEqRosenbrock
   6877.0 ms  ✓ BoundaryValueDiffEqCore
  60267.8 ms  ✓ NonlinearSolve
   6174.7 ms  ✓ NonlinearSolve → NonlinearSolveNLsolveExt
   9328.2 ms  ✓ NonlinearSolve → NonlinearSolveBandedMatricesExt
  10798.9 ms  ✓ OrdinaryDiffEqNonlinearSolve
  12399.7 ms  ✓ OrdinaryDiffEqPDIRK
  12794.0 ms  ✓ OrdinaryDiffEqStabilizedIRK
  13075.7 ms  ✓ OrdinaryDiffEqIMEXMultistep
  15536.0 ms  ✓ OrdinaryDiffEqSDIRK
   7809.9 ms  ✓ OrdinaryDiffEqExponentialRK
  33370.4 ms  ✓ OrdinaryDiffEqFIRK
  26022.8 ms  ✓ OrdinaryDiffEqBDF
  45629.8 ms  ✓ OrdinaryDiffEqDefault
 123401.4 ms  ✓ BoundaryValueDiffEqMIRK
  11077.6 ms  ✓ OrdinaryDiffEq
  16474.6 ms  ✓ DelayDiffEq
  22183.6 ms  ✓ BoundaryValueDiffEqShooting
  22525.3 ms  ✓ StochasticDiffEq
 152888.9 ms  ✓ BoundaryValueDiffEqFIRK
  12771.3 ms  ✓ BoundaryValueDiffEq
  11030.7 ms  ✓ DifferentialEquations
  256 dependencies successfully precompiled in 411 seconds. 60 already precompiled.
Precompiling SpecialFunctionsExt...
    583.5 ms  ✓ ColorVectorSpace → SpecialFunctionsExt
  1 dependency successfully precompiled in 1 seconds. 54 already precompiled.
Precompiling SparseMatrixColoringsColorsExt...
    787.6 ms  ✓ SparseMatrixColorings → SparseMatrixColoringsColorsExt
  1 dependency successfully precompiled in 1 seconds. 29 already precompiled.
Figure 2.3: Direction field for Example 2.12.

Let \(f(t,x) = rx(1-x) - h(1+\sin(2\pi t))\) and denote the solution to \(\dot{x} = f(t,x)\) with \(x(0) = x_0\) by \(\phi(t,x_0)\). Since \(f\) is periodic in \(t\) with period one, it is useful to view the solution as a curve wrapping around the cylinder \((0,1)\times{\mathbb R}\). The uniqueness of solutions implies that there is a unique curve passing through each point on the cylinder (solutions don’t intersect each other). Since there are no constant solutions, it is natural to ask if there are any periodic solutions, and since we are forcing the system with period one, we look for solutions with period one. That is, solutions with \(\phi(1,x_0) = x_0\). In short, we view \(p(x_0) = \phi(1,x_0)\) as a map from \({\mathbb R}\) to \({\mathbb R}\) and look for fixed points of this map. These maps are referred to as Poincaré maps after Hénri Poincaré.

2.6 Exercises

You should be familiar with material on basic differential equations in Chapter 4 of OpenStax Calculus Volume 2, especially problems 119-142 in Section 4.2 and problems 208-250 and 257-261 in Section 4.4.

Exercise 2.3 Solve the initial value problem \(x^2y' = (2+x)y\) with \(y(1)=1\).

  • separate and integrate \[\begin{align*} x^2y' &= (2+x)y \\ \frac{y'}{y} &= \frac{2}{x^2}+\frac{1}{x} \\ \int \frac{y'}{y} \, dx &= \int \frac{2}{x^2} \, dx +\int \frac{1}{x} \, dx \\ \log y &= -\frac{2}{x} + \log x + C \\ \end{align*}\]
  • apply initial conditions by substituting 1 for \(x\) and \(y\) \[\log 1 = -\frac{2}{1} + \log 1 + C \Rightarrow C = 2\]
  • solve relation for \(y\) in terms of \(x\) \[\begin{align*} y(x) &= \exp\left(-\frac{2}{x} + \log x + 2\right) \\ &= x\exp\left(2-\frac{2}{x}\right) \end{align*}\]

Exercise 2.4  


  1. By scalar I just mean a single equation, with a single dependent variable.↩︎