Skip to article frontmatterSkip to article content

Notation - Differential Operators

CSIC
UCM
IGEO

Differential Operators


Difference

This is the case where we have a function f:RDRP\boldsymbol{f}:\mathbb{R}^D \rightarrow \mathbb{R}^P which maps an input vector x\vec{\mathbf{x}} to a scalar value. We denote this operation as

Difference:=xf=if\begin{aligned} \text{Difference} &:= \partial_x \boldsymbol{f} \\ &= \nabla_i \boldsymbol{f} \end{aligned}

So this operator is

if:RR\partial_i \boldsymbol{f}: \mathbb{R} \rightarrow \mathbb{R}

where i is the index of the input vector, x\vec{\mathbf{x}}, of the function f\boldsymbol{f}. We can also right the functional transformation version

i[f](x):RDR\partial_i [\boldsymbol{f}](\vec{\mathbf{x}}): \mathbb{R}^D \rightarrow \mathbb{R}

Gradient

The directions of the fastest change and the directional derivative. Tells me locally where something is increasing or decreasing the fastest. Tells us the rate of change at every point (a vector direction of change)

Turns a scalar field into a vector field!

Gradient:=grad(f)=f=[xyz]f=[fxfyfz]=Ji(f)\begin{aligned} \text{Gradient} &:=\text{grad}(\boldsymbol{f}) \\ &= \boldsymbol{\nabla} \boldsymbol{f}\\ &= \begin{bmatrix} \frac{\partial}{\partial x} \\ \frac{\partial}{\partial y} \\ \frac{\partial}{\partial z} \end{bmatrix} \cdot \boldsymbol{f} \\ &= \begin{bmatrix} \frac{\partial f}{\partial x} \\ \frac{\partial f}{\partial y} \\ \frac{\partial f}{\partial z} \end{bmatrix}\\ &= \boldsymbol{J}_i(\boldsymbol{f}) \end{aligned}

So the operation is:

grad(f)=f:RRD\text{grad}(\boldsymbol{f}) = \boldsymbol{\nabla}\boldsymbol{f}: \mathbb{R} \rightarrow \mathbb{R}^D

where DD is the size of the input vector, x\vec{\mathbf{x}}. Let’s take a scalar field with vector-valued inputs.

f=f(x,y,z)=f(x)f:R3Rf=\boldsymbol{f}(x,y,z)=\boldsymbol{f}(\vec{\mathbf{x}}) \hspace{10mm} f:\mathbb{R}^3\rightarrow \mathbb{R}

Then the gradient is

grad(f)=[fxfyfz]\text{grad}(\boldsymbol{f}) = \begin{bmatrix} \frac{\partial \boldsymbol{f}}{\partial x} \\ \frac{\partial \boldsymbol{f}}{\partial y} \\ \frac{\partial \boldsymbol{f}}{\partial z} \end{bmatrix}

We can also write the functional transformation version:

grad[f](x)=f:RDRD\text{grad}[\boldsymbol{f}](\vec{\mathbf{x}}) = \boldsymbol{\nabla}\boldsymbol{f}: \mathbb{R}^D \rightarrow \mathbb{R}^D

Vector Fields


Jacobian


Divergence

Turns a vector field into a scalar field. It measures locally how much stuff is flowing away or flowing towards a single point in space. Basically, how much the vector field is expanding outwards or into a point in space!

How we measure sources and sinks!

Let’s take a vector valued function:

f:RDRD\vec{\boldsymbol{f}}:\mathbb{R}^{D}\rightarrow\mathbb{R}^D

The divergence operator does the following transformation:

div (f):RDR\text{div }(\vec{\boldsymbol{f}}): \mathbb{R}^D \rightarrow \mathbb{R}

Then the divergence operator is the following:

Divergence :=div (f)=f=(x,y,z)(f1,f2,f3)=(x,y,z)(fi^+fj^+fk^)=f1x+f2y+f3z\begin{aligned} \text{Divergence } &:= \text{div }(\vec{\boldsymbol{f}}) \\ &= \vec{\nabla}\cdot \vec{\boldsymbol{f}} \\ &= \left(\frac{\partial}{\partial x}, \frac{\partial}{\partial y}, \frac{\partial}{\partial z} \right)\cdot \left(f_1, f_2, f_3\right) \\ &= \left(\frac{\partial}{\partial x}, \frac{\partial}{\partial y}, \frac{\partial}{\partial z} \right)\cdot \left(f\hat{i} + f\hat{j} + f\hat{k}\right) \\ &= \frac{\partial f_1}{\partial x} + \frac{\partial f_2}{\partial y} + \frac{\partial f_3}{\partial z} \end{aligned}

We can also write the functional transformation version that maps a vector input, x\vec{\mathbf{x}}, through the transformation f()\boldsymbol{f}(\cdot) to the output of the divergence operator div()\text{div}(\cdot). We have the following:

div[f](x):RDR\text{div}\left[\vec{\boldsymbol{f}}\right](\vec{\mathbf{x}}): \mathbb{R}^D \rightarrow \mathbb{R}

Curl

How we measure rotation!

Curl:=curl(f)=×f=deti^j^j^xyzf1f2f3=[f2zf3yf1zf3xf1zf2y]=(f2zf3y)i^(f1zf3x)j^(f1zf2y)k^\begin{aligned} \text{Curl} &:= \text{curl}(\vec{\boldsymbol{f}}) \\ &= \nabla\times \vec{\boldsymbol{f}} \\ &= \det \begin{vmatrix} \hat{i} & \hat{j} & \hat{j} \\ \frac{\partial}{\partial x} & \frac{\partial}{\partial y} & \frac{\partial}{\partial z} \\ f_1 & f_2 & f_3 \end{vmatrix} \\ &= \begin{bmatrix} \frac{\partial f_2}{\partial z} - \frac{\partial f_3}{\partial y}\\ \frac{\partial f_1}{\partial z} - \frac{\partial f_3}{\partial x} \\ \frac{\partial f_1}{\partial z} - \frac{\partial f_2}{\partial y} \end{bmatrix} \\ &= \left(\frac{\partial f_2}{\partial z} - \frac{\partial f_3}{\partial y}\right)\hat{i} \left( \frac{\partial f_1}{\partial z} - \frac{\partial f_3}{\partial x}\right)\hat{j} \left( \frac{\partial f_1}{\partial z} - \frac{\partial f_2}{\partial y}\right)\hat{k} \end{aligned}

We can write this as

curl(f):RDRD\text{curl}(\vec{\boldsymbol{f}}): \mathbb{R}^D \rightarrow \mathbb{R}^D

We can also write the functional transformation version

curl[f](x):RDRD\text{curl}[\vec{\boldsymbol{f}}](\vec{\mathbf{x}}): \mathbb{R}^D \rightarrow \mathbb{R}^D

Laplacian

The second derivative

Laplacian :=Δu=2u=div(u)=xxu+yyu+zzu\begin{aligned} \text{Laplacian } &:= \Delta u \\ &= \nabla^2 u \\ &= \text{div}(\nabla u) \\ &= \partial_{xx}u + \partial_{yy}u + \partial_{zz}u \end{aligned}

We can also write this as the functional transformation version

Laplacian[f](x):RDR\text{Laplacian}[\boldsymbol{f}](\vec{\mathbf{x}}): \mathbf{R}^D \rightarrow \mathbf{R}

Material Derivative

Scalar Field

Given a scalar field:

ϕ:=ϕ(x,t)=ϕ(x,y,z,t)ϕ:R3×RR\phi:=\boldsymbol{\phi}(\vec{\mathbf{x}},t)=\boldsymbol{\phi}(x,y,z,t) \hspace{10mm} \phi:\mathbb{R}^3\times\mathbb{R}\rightarrow \mathbb{R}

We can write the Material derivative as

DϕDt:=ϕt+uϕ\frac{D\phi}{Dt} := \frac{\partial \phi}{\partial t} + \vec{\mathbf{u}} \cdot \nabla \phi

where

uϕ=u1ϕx+u2ϕy+u3ϕz\vec{\mathbf{u}} \cdot \nabla \phi = u_1\frac{\partial \phi}{\partial x} + u_2\frac{\partial \phi}{\partial y} + u_3\frac{\partial \phi}{\partial z}

Vector Field

Given a vector valued field:

F:=F(x,t)=F(x,y,z,t)F:R3×RR3\vec{\boldsymbol{F}}:=\vec{\boldsymbol{F}}(\vec{\mathbf{x}},t)= \vec{\boldsymbol{F}}(x,y,z,t) \hspace{10mm} \vec{\boldsymbol{F}}:\mathbb{R}^3\times\mathbb{R}\rightarrow \mathbb{R}^{3}

We can write the Material derivative as

DFDt:=Ft+uF\frac{D \vec{\boldsymbol{F}}}{Dt} := \frac{\partial \vec{\boldsymbol{F}}}{\partial t} + \vec{\mathbf{u}} \cdot \nabla \vec{\boldsymbol{F}}

where

uF=u1Fx+u2Fy+u3Fz\vec{\mathbf{u}} \cdot \nabla \vec{\boldsymbol{F}} = u_1\frac{\partial \vec{\boldsymbol{F}}}{\partial x} + u_2\frac{\partial \vec{\boldsymbol{F}}}{\partial y} + u_3\frac{\partial \vec{\boldsymbol{F}}}{\partial z}

Determinant Jacobian

From a differential operator perspective, we have

detJ(A,B)=detJ(B,A)=k(A×B)=k×(AB)=k×(BA)=k curl(BA)\begin{aligned} \det\boldsymbol{J}(A,B) &= -\det\boldsymbol{J}(B,A)\\ &= \mathbf{k}\cdot\left(\nabla A\times \nabla B\right) \\ &= - \mathbf{k}\cdot \nabla\times\left(A\nabla B\right) \\ &= - \mathbf{k}\cdot \nabla\times\left(B\nabla A\right) \\ &= -\mathbf{k}\text{ curl}\left(B\nabla A\right) \end{aligned}

If we think of Cartesian coordinates, we have

detJ(A,B)=AxByAyBx=x(ABy)y(ABx)=y(BAx)x(BAy)\begin{aligned} \det \boldsymbol{J}(A,B) &= \frac{\partial A}{\partial x}\frac{\partial B}{\partial y} -\frac{\partial A}{\partial y}\frac{\partial B}{\partial x} \\ &= \frac{\partial }{\partial x}\left(A\frac{\partial B}{\partial y}\right) -\frac{\partial }{\partial y}\left(A\frac{\partial B}{\partial x}\right) \\ &= \frac{\partial }{\partial y}\left(B\frac{\partial A}{\partial x}\right) -\frac{\partial }{\partial x}\left(B\frac{\partial A}{\partial y}\right) \\ \end{aligned}

We can write this transformation as

detJ(f,g):RD×RDRD\det\boldsymbol{J}(\boldsymbol{f}, \boldsymbol{g}): \mathbf{R}^D\times\mathbb{R}^{D} \rightarrow \mathbf{R}^{D}

We can also write this as the functional transformation version

detJ[f,g](x):RDR\det\boldsymbol{J}[\boldsymbol{f}, \boldsymbol{g}](\vec{\mathbf{x}}): \mathbf{R}^D \rightarrow \mathbf{R}

Helmholtz Equation

f(x)k2f(x)=0(k2)f(x)=0\begin{aligned} \nabla \boldsymbol{f}(\vec{\mathbf{x}}) - k^2 \boldsymbol{f}(\vec{\mathbf{x}}) &= 0 \\ \left( \nabla - k^2 \right)\boldsymbol{f}(\vec{\mathbf{x}}) &= 0 \end{aligned}

Helmholtz Decomposition

f=ϕDiv-Free+×ACurl-Free\vec{\boldsymbol{f}} = \underbrace{- \nabla\phi}_{\text{Div-Free}}+ \underbrace{\nabla\times \mathbf{A}}_{\text{Curl-Free}}

Vector Jacobian Products

  • Tangent Space + Primal Space -> Jacobian-Vector Product
  • Primal Space + Cotangent Space -> Vector-Jacobian Product

Resources:

  • jax documentation
  • Linearization is All You Need for an AutoDiff Library - Blog
  • The Adjoint Method in a Dozen Lines of JAX - Blog
  • Adjoint Sensitivities over nonlinear equations with JAX - YouTube
  • Using JAX Jacobians for Adjoint Sensitivities over Nonlinear Systems of Equations - YouTube
  • A Tutorial on Automatic Differentiation for Scientific Design - Slides

Linearization

First, we linearize about the prior estimate, μz\boldsymbol{\mu_z}.

f(z)f(μz)+zf(zμz)+O2(f)\boldsymbol{f}(\boldsymbol{z}) \approx \boldsymbol{f}(\boldsymbol{\mu_z}) + \boldsymbol{\nabla_z}\boldsymbol{f}(\boldsymbol{z}-\boldsymbol{\mu_z}) + \mathcal{O}^2(\boldsymbol{f})

Then, we approximate the gradient of the function with the gradient evaluated at the prior estimate

f(z)Jf(z):=zf(z)z=μz\boldsymbol{f}(\boldsymbol{z}) \approx \boldsymbol{J_f}^\top (\boldsymbol{z}) := \boldsymbol{\nabla_z}\boldsymbol{f}(\boldsymbol{z})|_{\boldsymbol{z}=\boldsymbol{\mu_z}}

Here, the operator, Jf(z)\boldsymbol{J_f}(\boldsymbol{z}), is the tangent-linear operator of the function f()\boldsymbol{f}(\cdot) evaluated at μz\boldsymbol{\mu_z}, and the Jf(z)\boldsymbol{J_f}^\top(\boldsymbol{z}) is the adjoint.

Dynamical Tangent-Linear Operator:Jf(z)=Fz=zf(z)z=μz,RDRDx×DxDynamical Adjoint Operator:Jz(z)=Fz=zf(z)z=μz,RDRDx×DxObservation Tangent-Linear Operator:Jh(z)=Hz=zh(z)z=μz,RDRDy×DxObservation Adjoint Operator:Jh(z)=Hz=zh(z)z=μz,RDyRDx×Dy\begin{aligned} \text{Dynamical Tangent-Linear Operator}: && && \boldsymbol{J_f}(\boldsymbol{z}) &= \boldsymbol{F_z} = \boldsymbol{\nabla_z}\boldsymbol{f}(\boldsymbol{z})|_{\boldsymbol{z}=\boldsymbol{\mu_z}}, && && \mathbb{R}^{D}\rightarrow\mathbb{R}^{D_x\times D_x}\\ \text{Dynamical Adjoint Operator}: && && \boldsymbol{J_z}^\top(\boldsymbol{z}) &= \boldsymbol{F_z}^\top = \boldsymbol{\nabla_z}\boldsymbol{f}(\boldsymbol{z})|_{\boldsymbol{z}=\boldsymbol{\mu_z}}, && && \mathbb{R}^{D}\rightarrow\mathbb{R}^{D_x\times D_x}\\ \text{Observation Tangent-Linear Operator}: && && \boldsymbol{J_h}(\boldsymbol{z}) &= \boldsymbol{H_z} = \boldsymbol{\nabla_z}\boldsymbol{h}(\boldsymbol{z})|_{\boldsymbol{z}=\boldsymbol{\mu_z}}, && && \mathbb{R}^{D}\rightarrow\mathbb{R}^{D_y\times D_x}\\ \text{Observation Adjoint Operator}: && && \boldsymbol{J_h}^\top(\boldsymbol{z}) &= \boldsymbol{H_z}^\top = \boldsymbol{\nabla_z}\boldsymbol{h}(\boldsymbol{z})|_{\boldsymbol{z}=\boldsymbol{\mu_z}}, && && \mathbb{R}^{D_y}\rightarrow\mathbb{R}^{D_x\times D_y}\\ \end{aligned}

Tangent-Linear Model

Tangent-Linear Model:(u,v)zf(z)vInput Vector:u:RDTangent Vector:v:RDJacobian-Vector Product:jvp:RD×RMRD\begin{aligned} \text{Tangent-Linear Model}: && && (\boldsymbol{u,v}) &\rightarrow \partial_{\boldsymbol{z}}\boldsymbol{f}(\boldsymbol{z})\boldsymbol{v} \\ \text{Input Vector}: && && \boldsymbol{u}: &\in \mathbb{R}^{D} \\ \text{Tangent Vector}: && && \boldsymbol{v}: &\in \mathbb{R}^{D} \\ \text{Jacobian-Vector Product}: && && \text{jvp} &: \mathbb{R}^{D}\times\mathbb{R}^{M}\rightarrow\mathbb{R}^{D} \end{aligned}

Adjoint Model

Adjoint Model:(u,v)vzf(z)Input Vector:u:RDTangent Vector:v:RMJacobian-Vector Product:jvp:RD×RMRM\begin{aligned} \text{Adjoint Model}: && && (\boldsymbol{u,v}) &\rightarrow \boldsymbol{v}\partial_{\boldsymbol{z}}\boldsymbol{f}(\boldsymbol{z})^\top \\ \text{Input Vector}: && && \boldsymbol{u}: &\in \mathbb{R}^{D} \\ \text{Tangent Vector}: && && \boldsymbol{v}: &\in \mathbb{R}^{M} \\ \text{Jacobian-Vector Product}: && && \text{jvp} &: \mathbb{R}^{D}\times\mathbb{R}^{M}\rightarrow\mathbb{R}^{M} \end{aligned}