Calculus, Partial Differential Equations

Characteristic Lines

For a conservation law in 1D, e.g. the inviscid Burger’s Equation, a characteristic line is a curve x = x(s) such that directional derivative of the field (\frac{\mathrm{d} u}{\mathrm{d} s}) can be thought of as the RHS of the PDE. (Here I am assuming that s is the parameter of the curve, and that u is the field variable.)

Let f be known as the flux function, and let us define the derivative of the flux function with respect to the field variable as a(u) = \frac{\mathrm{d} f}{\mathrm{d} u}. Then the primitive form of a conservation law in 1D is given as follows:

\frac{\partial u}{\partial t} + a(u)\frac{\partial u}{\partial x} = 0

If our parametrization x = x(s) satisfies both conditions \frac{\partial t}{\partial s} = 1 and \frac{\partial x}{\partial s} = a(u), then the following holds:

\frac{\mathrm{d} u}{\mathrm{d} s} = \frac{\partial u}{\partial t} + a(u)\frac{\partial u}{\partial x} = 0

In other words, the RHS of the original PDE is nothing more than the directional derivative \frac{\mathrm{d} u}{\mathrm{d} s}. (This is assuming, of course, that we picked just the right parametrization, see the two conditions above.)

This allows us to think of the solution to the PDE along a line of dependency parameterized by s, passing through a point (with field value known a priori) known as a point of dependence, as the solution to an ODE expressed in terms of s. (See Jeffrey, chapter 2.1 and 2.2 for details and caveats.)

  • The point of dependence lies on a Cauchy data curve, which acts as our boundary condition. (See Jeffrey chapter 2.1, and in particular, Figure 2.1. In many examples, e.g. for wave propagation in 1D, the Cauchy data curve coincides with the x-axis and acts as the “initial condition”.

This is a special case of how characteristic lines can be constructed for quasi-linear PDEs, and a formulation for quasi-linear PDEs is described in Chapter 2.2 of Jeffrey.

References

  • Jeffrey, Alan. (2003). Applied Partial Differential Equations : An Introduction. Academic Press.
  • Wang, Qiqi (2017). Characteristic lines for conservation laws. MIT 2.097/6.339/16.920: Numerical Methods for Partial Differential Equations, Fall 2017. (Video, Lecture Notes PDF.)
Calculus, Partial Differential Equations

Heat distribution around a ring

This is the problem that motivated the original development of the Fourier series. It is also difficult to avoid talking about partial differential equations without talking about the Fourier series and Fourier transform, even when dealing with more complex problems.

This is based on Brad Osgood’s discussion in the course reader and lectures for Stanford’s EE261: The Fourier Transform and its Applications, plus some of my own observations / material from other readings.

Setup

heat_ring_setup

  • Need a region in space (a.k.a. the domain).
    • We choose a circle, which is periodic in space. Allows us to take advantage of symmetry / allows us to use the Fourier series, which assumes that the function is periodic.
    • Here we assume a period of 1, although a period of 2\pi will also do.
  • Need an initial distribution of temperature in that region (this acts as our initial condition(s)).
  • The distribution of heat is dependent on both space (point on the circle) and time.

Solution

1. Choose units such that the heat equation (which I derived in another post) takes the following form:

u_t = \frac{1}{2}u_{xx}

2. Use the Fourier series to expand u(x,t):

u(x,t) = \sum\limits_{n=-\infty}^{\infty}c_n(t)e^{2\pi i n x}

c_n(t) = \displaystyle \int_0^1 e^{-2\pi i n x}u(x,t)dx

3. Differentiate c_n(t) with respect to t by applying the Leibniz Integration Rule (which I explain in a different post). Then, substitute our expression for the heat equation:

c'_n(t) = \int_0^1 u_t(x,t)e^{-2\pi i n x}dx = \int_0^1 \frac{1}{2}u_{xx}(x,t)e^{-2\pi i n x}dx

4. Integrate by parts twice to “get the derivatives off” u. (We want to do this because our goal is to find $\latex u$.) The integration by parts “puts” the two derivatives “on” e^{-2 pi i n x}, but this isn’t a problem. Without showing all of the intermediate steps, we end up with:

c'_n(t) = -2\pi^2n^2\int_0^1 u_t(x,t)e^{-2\pi i n x}dx

ℹ️ In order to derive this result, we must use the fact that e^{2\pi i n x} = 1 for n \in \mathbb{Z}. When we integrate by parts, this leads to terms that look like “1 - 1” and cancel nicely.

5. Substituting the definition of c_n(t) into the result in 4), we obtain:

c'_n(t) = -2\pi^2n^2c_n(t)

This is nothing more than an ODE, which can be solved using separation of variables. There are two solutions:

  • Equilibrium solution c_n(t) = 0. (This is also known as a lost solution in the context of separation of variables, which I wrote about here.)
  • c_n(t) = c_n(0)e^{-2\pi^2n^2t}

ℹ️ Notice that we require the initial value c_n(0).

To be continued…

References

Calculus, Partial Differential Equations

Derivation of the Heat Equation in 1D

This is based on Brad Osgood’s discussion in the course reader for Stanford’s EE261: The Fourier Transform and its Applications, plus some of my own observations / material from other readings.

We’ll begin in 1D with a system of two first order equations:

1) Fourier’s law: q(x,t) = -ku_{x}(x,t)

  • Special case of \mathbf{q} = -k\nabla T
  • In some sense analogous to Ohm’s law: I = \frac{1}{R}V
  • k can be thought of as “thermal conductivity” in Watt-meters per Kelvin.
    • In 3D, for anisotropic heat diffusion, k can be a rank 2 tensor.
  • q_{x} has units of Kelvin per meter.

2) Differentiating Fourier’s law with respect to x, we obtain q_x(x,t) = -ku_{xx}(x,t), where q_{xx} has units of Kelvin per meter squared. (NOT per square meter!)

3) Relation of rate of temperature change to rate of heat accumulation per unit length

1D_heat_flux_element

a) Rate at which temperature rises at x: u_t(x,t)

b) u_t(x,t) is proportional to the rate at which heat accumulates per unit length.

c) Rate at which heat accumulates per unit length can be expressed as: \frac{q(x,t) - q(x + \Delta x, t)}{\Delta x}

The reason why we subtract q(x + \Delta x, t) is because it represents heat leaving, by the “arrow convention” in the diagram

d) From a), b), and c), we choose k' as our constant of proportionality, and obtain:

u_t(x,t) = k'\frac{q(x + \Delta x,t) - q(x,t)}{\Delta x}

k' is the reciprocal of “thermal capacity” per unit length, given in Watt-seconds per Kelvin-meter.

e) From elementary calculus, we know that:

\lim\limits_{x \to 0} \frac{q(x + \Delta x,t) - q(x,t)}{\Delta x} = \frac{\partial q}{\partial x} = q_x

ℹ️ Note the “sign flip” when compared to the equation in d)

f) Therefore, u_t(x,t) = -k' q_x in the limit (as \Delta x \to 0). (The negative sign comes from the aforementioned “sign flip”.)

4) Substituting 2) into 3), we obtain the heat equation in 1D:

u_t(x,t) = kk'u_{xx}(x,t)

Where kk' can be thought of as a single scalar constant.

ℹ️ Here, we derived a single second-order PDE from a system of two first-order equations by eliminating the dependent variable q_x. This strategy works for the heat and wave equations, but does not work in the general case. Quoting Jeffrey, p.34:

In general, if a system of n first-order equations arises, it is not possible to eliminate all but one of the n-dependent variables, and then to replace the system by a single nth-order equation in the remaining dependent variable.

References

Calculus, Ordinary Differential Equations

“Lost solutions” when solving an ODE using separation of variables

Some of this material was adapted from MIT OCW 18.03SC (Fall 2011), which is distributed under the Creative Commons BY-NC-SA license.

Consider the following ODE:

y' = 2x(1-y)^2

If we solve using separation of variables, we obtain:

y = 1 - \frac{1}{x^2+C}

However, there is another solution that gets “lost” when we do separation of variables:

y = 1

This is known as a lost solution. Quoting the 18.03SC notes on separation of variables:

for the separable DE y' = f(x)g(y), all the roots of g(y) give lost (constant) solutions

References

  • Arthur Mattuck, Haynes Miller, Jeremy Orloff, and John Lewis. 18.03SC Differential Equations. Fall 2011. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu. License: Creative Commons BY-NC-SA.

 

Discrete Mathematics, Discrete Random Variables, Probability and Statistics

Changing the order of summation in a double sum

The following blog post was adapted from a YouTube video on this subject published by MIT OpenCourseWare, which is distributed under the Creative Commons BY-NC-SA license.

Suppose we  wish to evaluate the following summation:

\sum\limits_{i \geq 1, j \geq 1} a_{ij}

As long as \sum |a_{ij}| < \infty, the following holds:

\sum\limits_{i \geq 1, j \geq 1} a_{ij} = \sum\limits_{i=1}^{\infty}\sum\limits_{j=1}^{\infty} a_{ij} = \sum\limits_{j=1}^{\infty}\sum\limits_{i=1}^{\infty} a_{ij}

In other words, we can swap the order of summation. This also works over a “limited range of indices” – i.e. if we wish to evaluate the following summation:

\sum\limits_{(i,j), j \leq i} a_{ij}

As long as \sum_{(i,j), j \leq i} |a_{ij}| < \infty, the following holds:

\sum\limits_{(i,j), j \leq i} a_{ij} = \sum\limits_{i=1}^{\infty}\sum\limits_{j=1}^{i} a_{ij} = \sum\limits_{j=1}^{\infty}\sum\limits_{i=j}^{\infty} a_{ij}

In conclusion, as long as the sum of the absolute values of the elements that we are summing over converges, we can swap the order of summation as described above. This can be thought of as swapping the order of a doubly-nested for loop.

Applications:

  • Proving that if X is a random variable whose range is \mathbb{Z}^{+} (takes nonnegative integer values), then E[X] = \sum_{k=1}^{\infty} P(X \geq k). (From MIT OCW 6.041sc, Problem Set 3, question 3a.)
  • Swapping the order of doubly-nested for loop in order to optimize for cache locality?

References: