# Calculus/Discrete vector calculus

This chapter will present an analog to vector calculus where space now consists of discrete "lumps". The purpose of this chapter is to provide an intuitive basis for vector calculus. The portrayal of vector calculus in this chapter will enable the generalization of vector calculus to non-Euclidean geometries.

## The essence of Calculus

The key approach to calculus is to start with a model where each variable, using $x$ as an example, takes on discrete quantities separated by small intervals of width $\Delta x$. $\Delta x$ is a measure of the model's "coarseness" (when $\Delta x$ is increasing) or "fineness" (when $\Delta x$ is decreasing). When handling quantities at the scale of $\Delta x$, an approximation for which the error relative to $\Delta x$ vanishes as $\Delta x$ becomes infinitely small, becomes exact when $x$ is treated as a continuous variable.
As an example, let $\Delta x$ be small, and restrict $x$ to the quantities $\{...,-3\Delta x,-2\Delta x,-\Delta x,0,+\Delta x,+2\Delta x,+3\Delta x,...\}$. Let $x_{i}=i\Delta x$ for any integer $i$.
The difference $\Delta y(i)=x_{i+1}^{2}-x_{i}^{2}=2x_{i}\Delta x+\Delta x^{2}$ approaches 0 as $\Delta x\to 0^{+}$, but it is not accurate to approximate $\Delta y(i)$ with 0, as the error relative to $\Delta x$ does not vanish as $\Delta x\to 0^{+}$: in truth, ${\frac {\Delta y(i)-0}{\Delta x}}=2x_{i}+\Delta x\not \to 0$ as $\Delta x\to 0$.
It is however, accurate to approximate $\Delta y(i)$ with $\Delta z(i)=2x_{i}\Delta x$ since the error relative to $\Delta x$ does vanish as $\Delta x\to 0^{+}$: it is the case that ${\frac {\Delta y(i)-\Delta z(i)}{\Delta x}}=\Delta x\to 0$ as $\Delta x\to 0$.
When we articulate continuous space into small but non-zero volumes for the purpose of approximating vector calculus, it is important to note that the only approximations that will be made, will be those that entail relative errors that vanish as the articulation of space becomes more and more fine.
In order to demonstrate the necessity of having the error relative to the differential $\Delta x$ approach 0 as $\Delta x\to 0$ as opposed to the absolute error, the following example will be used:
Consider the closed interval $[a,b]$ divided into $N$ intervals: $[x_{0},x_{1}],[x_{1},x_{2}],...,[x_{N-1},x_{N}]$ where $a=x_{0}<x_{1}<...<x_{N}=b$. From each $i=1,2,\dots ,N$ choose a representative point $x_{i}^{*}\in [x_{i-1},x_{i}]$, and let $\Delta x_{i}=x_{i}-x_{i-1}$. Let $f:\mathbb {R} ^{2}\to \mathbb {R}$ and $g:\mathbb {R} ^{2}\to \mathbb {R}$ be two functions whose first parameter is a representative point, and the second parameter is the interval width. Both $f$ and $g$ will be assumed to approach 0 as the interval width becomes infinitely small. Consider the two sums $F=\sum _{i=1}^{N}f(x_{i}^{*},\Delta x_{i})$ and $G=\sum _{i=1}^{N}g(x_{i}^{*},\Delta x_{i})$. It will be assumed that $F$ and $G$ converge to $F_{\infty }$ and $G_{\infty }$ respectively as $N\to +\infty$ and $\max(\Delta x_{i})\to 0^{+}$.
The question of interest are circumstances under which $F_{\infty }=G_{\infty }$. If other words, as the interval $[a,b]$ becomes more and more articulated into smaller and smaller intervals, what is required so that approximating $F$ with $G$ becomes exact?
If $\max _{x\in [a,b]}|f(x,\Delta x)-g(x,\Delta x)|\to 0$ as $\Delta x\to 0^{+}$, this is not sufficient to guarantee that $F_{\infty }=G_{\infty }$. In contrast, if $\max _{x\in [a,b]}{\frac {|f(x,\Delta x)-g(x,\Delta x)|}{\Delta x}}\to 0$ as $\Delta x\to 0^{+}$, this will force $F_{\infty }=G_{\infty }$. To prove this, the following derivation will be used:
$|F-G|=\left|\sum _{i=1}^{N}f(x_{i}^{*},\Delta x_{i})-\sum _{i=1}^{N}g(x_{i}^{*},\Delta x_{i})\right|=\left|\sum _{i=1}^{N}(f(x_{i}^{*},\Delta x_{i})-g(x_{i}^{*},\Delta x_{i}))\right|$
$\leq \sum _{i=1}^{N}|f(x_{i}^{*},\Delta x_{i})-g(x_{i}^{*},\Delta x_{i})|=\sum _{i=1}^{N}\Delta x_{i}{\frac {|f(x_{i}^{*},\Delta x_{i})-g(x_{i}^{*},\Delta x_{i})|}{\Delta x_{i}}}$
$\leq \sum _{i=1}^{N}\Delta x_{i}\max _{j}\left({\frac {|f(x_{j}^{*},\Delta x_{j})-g(x_{j}^{*},\Delta x_{j})|}{\Delta x_{j}}}\right)$ $=\left(\sum _{i=1}^{N}\Delta x_{i}\right)\max _{j}\left({\frac {|f(x_{j}^{*},\Delta x_{j})-g(x_{j}^{*},\Delta x_{j})|}{\Delta x_{j}}}\right)$ $=(b-a)\max _{j}\left({\frac {|f(x_{j}^{*},\Delta x_{j})-g(x_{j}^{*},\Delta x_{j})|}{\Delta x_{j}}}\right)$
For each $j=1,2,\dots ,N$, it is assumed that ${\frac {|f(x_{j}^{*},\Delta x_{j})-g(x_{j}^{*},\Delta x_{j})|}{\Delta x_{j}}}\to 0$ as $\Delta x_{j}\to 0^{+}$. Therefore $\max _{j}\left({\frac {|f(x_{j}^{*},\Delta x_{j})-g(x_{j}^{*},\Delta x_{j})|}{\Delta x_{j}}}\right)\to 0$ and hence $|F-G|\to 0$ as $N\to +\infty$ and $\max(\Delta x_{i})\to 0^{+}$. Therefore $F_{\infty }=G_{\infty }$.

## Lumped space
### Directed graphs

The lumped approximation of space will require the use of a "directed graph".
A "directed graph" ${\mathcal {G}}=\langle {\mathcal {N}},{\mathcal {E}}\rangle$ consists of a set ${\mathcal {N}}$ of nodes/vertices and a set ${\mathcal {E}}$ of directed edges. For each edge $e\in {\mathcal {E}}$, $e$ has an origin node $t_{\bullet }(e)\in {\mathcal {N}}$ that is the beginning of edge $e$, and a terminal node $t^{\bullet }(e)\in {\mathcal {N}}$ that is the end of edge $e$. It will also be allowed that edges can form loops ($t_{\bullet }(e)=t^{\bullet }(e)$) and that multiple edges can have both the same beginning and end ($t_{\bullet }(e_{1})=t_{\bullet }(e_{2})$ and $t^{\bullet }(e_{1})=t^{\bullet }(e_{2})$), though this will be irrelevant for the cases that will be considered.
An arbitrary function $f:{\mathcal {N}}\to \mathbb {R}$ over the set of nodes will be referred to as a "node based function", and is effectively a scalar field. The notation $\langle n\in {\mathcal {N}}:f(n)\rangle$ will be used if the input parameter is ambiguous. A node based function can also be denoted by exhaustively listing the assignment to each node: $\{n_{1}\mapsto f(n_{1}),n_{2}\mapsto f(n_{2}),\dots \}$. If a node based function is denoted by a complex expression $F$, then the evaluation of $F$ at a single node $n$ will be denoted using the pipe-subscript notation: $F|_{n}$.
An arbitrary function $f:{\mathcal {E}}\to \mathbb {R}$ over the set of edges will be referred to as an "edge based function", and is effectively a scalar or vector field. The notation $\langle e\in {\mathcal {E}}:f(e)\rangle$ will be used if the input parameter is ambiguous. An edge based function can also be denoted by exhaustively listing the assignment to each edge: $\{e_{1}\mapsto f(e_{1}),e_{2}\mapsto f(e_{2}),\dots \}$. If an edge based function is denoted by a complex expression $F$, then the evaluation of $F$ at a single edge $e$ will be denoted using the pipe-subscript notation: $F|_{e}$. When a real number assigned to an edge denotes a "vector", a positive value denotes an orientation along the edge's preferred direction, and a negative value denotes an orientation against the edge's preferred direction.
An example directed graph is shown to the right. The node set is ${\mathcal {N}}=\{n_{1},n_{2},n_{3},n_{4},n_{5}\}$ and the edge set is ${\mathcal {E}}=\{e_{1},e_{2},e_{3},e_{4},e_{5},e_{6}\}$. The origin and terminal nodes of each edge are: $(t_{\bullet }(e_{1}),t^{\bullet }(e_{1}))=(n_{1},n_{2})$; $(t_{\bullet }(e_{2}),t^{\bullet }(e_{2}))=(n_{1},n_{3})$; $(t_{\bullet }(e_{3}),t^{\bullet }(e_{3}))=(n_{2},n_{4})$; $(t_{\bullet }(e_{4}),t^{\bullet }(e_{4}))=(n_{4},n_{3})$; $(t_{\bullet }(e_{5}),t^{\bullet }(e_{5}))=(n_{4},n_{5})$; and $(t_{\bullet }(e_{6}),t^{\bullet }(e_{6}))=(n_{5},n_{1})$.

### Interpreting nodes and edges

Each node $n\in {\mathcal {N}}$ will correspond to both a point $\omega _{0}(n)$ in space, and a volume $\omega _{3}(n)$ that contains $\omega _{0}(n)$. $\tau _{3}(n)$ will denote the volume of $\omega _{3}(n)$, also referred to as the volume of node $n$. The volume of each node must be positive: $\tau _{3}(n)>0$ for all $n\in {\mathcal {N}}$. In the example directed graph, an example choice of volumes for each node is $\tau _{3}=\{n_{1}\mapsto 3,n_{2}\mapsto 2,n_{3}\mapsto 2,n_{4}\mapsto 1,n_{5}\mapsto 4\}$.
Each edge $e\in {\mathcal {E}}$ will correspond to both a curve $\omega _{1}(e)$ originating from $\omega _{0}(t_{\bullet }(e))$ and terminating at $\omega _{0}(t^{\bullet }(e))$, and a surface $\omega _{2}(e)$ that separates $\omega _{3}(t_{\bullet }(e))$ from $\omega _{3}(t^{\bullet }(e))$ oriented from $\omega _{3}(t_{\bullet }(e))$ to $\omega _{3}(t^{\bullet }(e))$.
$\tau _{1}(e)$ will denote the distance $|\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))|$ from $\omega _{0}(t_{\bullet }(e))$ to $\omega _{0}(t^{\bullet }(e))$, which will be referred to as the length of edge $e$. The length of each edge must be positive: $\tau _{1}(e)>0$ for all $e\in {\mathcal {E}}$. $\tau _{2}(e)$ will denote the area of $\omega _{2}(e)$ projected onto a plane that is perpendicular to the displacement $\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))$, which will be referred to as the cross-sectional area, thickness, or width of edge $e$. The cross-sectional area of each edge must be positive: $\tau _{2}(e)>0$ for all $e\in {\mathcal {E}}$. In the example directed graph, an example choice of lengths for each edge is $\tau _{1}=\{e_{1}\mapsto 1,e_{2}\mapsto 1,e_{3}\mapsto 2,e_{4}\mapsto 1,e_{5}\mapsto 3,e_{6}\mapsto 4\}$, and an example choice of areas for each edge is $\tau _{2}=\{e_{1}\mapsto 1,e_{2}\mapsto 2,e_{3}\mapsto 1,e_{4}\mapsto 2,e_{5}\mapsto 3,e_{6}\mapsto 3\}$.
${\mathcal {G}}$
* the set of nodes ${\mathcal {N}}$
* the set of edges ${\mathcal {E}}$
* the start $t_{\bullet }(e)$ and end $t^{\bullet }(e)$ of each edge $e\in {\mathcal {E}}$
* the volume $\tau _{3}(n)$ of each node $n\in {\mathcal {N}}$
* the length $\tau _{1}(e)$ and area $\tau _{2}(e)$ of each edge $e\in {\mathcal {E}}$
The point $\omega _{0}(n)$ and space $\omega _{3}(n)$ associated with each node $n\in {\mathcal {N}}$, and the curve $\omega _{1}(e)$ and surface $\omega _{2}(e)$ associated with each edge $e\in {\mathcal {E}}$, are not given consideration after the approximate directed graph model has been established. The parameters in the above list are all that is needed to utilize the directed graph model.

### Points and multi-points

A "point" in space is quantified by a single node $n_{0}\in {\mathcal {N}}$, which corresponds to the space point $\omega _{0}(n_{0})$.
Point $n_{0}$ can be denoted by the node based function $\delta _{0}(n;n_{0}):{\mathcal {N}}\to \mathbb {R}$ where for each node $n\in {\mathcal {N}}$ it is the case that $\delta _{0}(n;n_{0})=\left\{{\begin{array}{cc}1/\tau _{3}(n)&(n=n_{0})\\0&(n\neq n_{0})\\\end{array}}\right.$. The term ${\frac {1}{\tau _{3}(n)}}$ arises from the fact that the point is "spread out" over the volume of $n$. The notation $\delta _{0}(n_{0})$ denotes $\delta _{0}(n;n_{0})$ with the parameter $n$ not shown.
A superposition of points is a "multi-point". A multi-point is effectively a set of points with varying weights, which can be any real number. Let the set $W=\{(n_{1},w_{1}),(n_{2},w_{2}),...,(n_{k},w_{k})\}$ of node/weight pairs denote a multi-point. For each $i=1,2,...,k$: $w_{i}$ is the weight associated with node $n_{i}$. The node based function that denotes multi-point $W$ is: $\delta _{0}(n;W)=\sum _{i=1}^{k}w_{i}\delta _{0}(n;n_{i})=\sum _{i=1}^{k}\left\{{\begin{array}{cc}w_{i}/\tau _{3}(n)&(n=n_{i})\\0&(n\neq n_{i})\\\end{array}}\right.$. Any node based function that returns real values can denote a multi-point.
Any node based function that denotes "density" is best interpreted as a multi-point.
Below is shown two examples of a multi-point $W$ and the corresponding node based function $\delta _{0}(n;W)$. On the left, there is a collection of points with a weight of +1 denoted by red dots, and points with a weight of -1 denoted by blue dots. For each volume $\omega _{3}(n)$, the weights of all of the contained points are added together and the total weight is divided by $\tau _{3}(n)$ to spread it out over the volume $\omega _{3}(n)$. On the right, shades of red denote positive values for $\delta _{0}(n;W)$, while shades of blue denote negative values for $\delta _{0}(n;W)$. White means that $\delta _{0}(n;W)=0$ for the current node $n$.
* Multi point example on the left, and function on the right.
* Multi point example on the left, and function on the right.

### Volumes and multi-volumes

The discrete analog to volumes using a directed graph is that a volume $U$ is a collection of nodes: $U\subseteq {\mathcal {N}}$. The combined volume region denoted by $U$ is $\omega _{3}(U)=\bigcup _{n\in U}\omega _{3}(n)$ and the total volume amount is $\tau _{3}(U)=\sum _{n\in U}\tau _{3}(n)$.
Volume $U$ can be denoted by a node based membership function: $\delta _{3}(n;U):{\mathcal {N}}\to \mathbb {R}$ where for each node $n\in {\mathcal {N}}$, it is the case that $\delta _{3}(n;U)=\left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\\\end{array}}\right.$. The notation $\delta _{3}(U)$ denotes $\delta _{3}(n;U)$ with the parameter $n$ not shown.
A superposition of volumes forms a "multi-volume". Any node based function that returns real values can be the membership function of a multi-volume. For example, given the node based function $f=\{n_{1}\mapsto -2,n_{2}\mapsto 0,n_{3}\mapsto 4,n_{4}\mapsto 0.5,n_{5}\mapsto 0.5\}$ can be expressed as the following superpositions:
$f(n)=-2\delta _{3}(n;\{n_{1}\})+4\delta _{3}(n;\{n_{3}\})+0.5\delta _{3}(n;\{n_{4},n_{5}\})$ is the superposition of volumes $\{n_{1}\},\{n_{3}\},\{n_{4},n_{5}\}$ with the respective weights $-2,4,0.5$.
$f(n)=-2\delta _{3}(n;\{n_{1}\})+0.5\delta _{3}(n;\{n_{3},n_{4},n_{5}\})+3.5\delta _{3}(n;\{n_{3}\})$ is the superposition of volumes $\{n_{1}\},\{n_{3},n_{4},n_{5}\},\{n_{3}\}$ with the respective weights $-2,0.5,3.5$.
It is important to note that given an arbitrary node based function, decomposing the multi-volume denoted by the function into a superposition of volumes is not unique, as shown above where a node based function is decomposed into multiple superpositions of volumes.
Any node based function that denotes a "potential" is best interpreted as a multi-volume.

### Paths and multi-paths

The discrete analog to paths using a directed graph is that a path $P$ is a series of edges and orientations: $P=\langle (e_{1},s_{1}),(e_{2},s_{2}),\dots ,(e_{k},s_{k})\rangle$ where $e_{i}\in {\mathcal {E}}$ is the $i^{\text{th}}$ edge and $s_{i}\in \{+1,-1\}$ is an indicator that is $+1$ if $e_{i}$ is traversed in the preferred direction, and is $-1$ if $e_{i}$ is traversed in the opposite direction. The path must be unbroken: for each $i\in \{1,2,\dots ,k-1\}$ it must be that $\left\{{\begin{array}{cc}t^{\bullet }(e_{i})&(s_{i}=+1)\\t_{\bullet }(e_{i})&(s_{i}=-1)\\\end{array}}\right.=\left\{{\begin{array}{cc}t_{\bullet }(e_{i+1})&(s_{i+1}=+1)\\t^{\bullet }(e_{i+1})&(s_{i+1}=-1)\\\end{array}}\right.$. The combined path denoted by $P$ is $\omega _{1}(P)=\bigcup _{i=1}^{k}s_{i}\omega _{1}(e_{i})$ (path $-\omega _{1}(e_{i})$ is path $\omega _{1}(e_{i})$ the orientation reversed) and the total length is $\tau _{1}(P)=\sum _{i=1}^{k}\tau _{1}(e_{i})$.
A path $P$ can be denoted by the edge based function $\delta _{1}(e;P):{\mathcal {E}}\to \mathbb {R}$ where for each edge $e\in {\mathcal {E}}$, it is the case that $\delta _{1}(e;P)=\sum _{i=1}^{k}s_{i}\delta _{1}(e;e_{i})$ where $\delta _{1}(e;e_{i})=\left\{{\begin{array}{cc}1/\tau _{2}(e)&(e=e_{i})\\0&(e\neq e_{i})\\\end{array}}\right.$. The term ${\frac {1}{\tau _{2}(e)}}$ arises from the fact that the path is "spread out" over the thickness of $e$. The notation $\delta _{1}(P)$ denotes $\delta _{1}(e;P)$ with the parameter $e$ not shown.
A superposition of paths forms a "multi-path". Any edge based function that returns real values can denote a multi-path. For example, assuming that $\tau _{2}(e)=1$ for all $e\in {\mathcal {E}}$, the edge based function $f=\{e_{1}\mapsto 1,e_{2}\mapsto -1,e_{3}\mapsto 1,e_{4}\mapsto 2,e_{5}\mapsto 0,e_{6}\mapsto 0\}$ can be expressed as the following superpositions:
$f(e)=\delta _{1}(e;\langle (e_{1},+1)\rangle )-\delta _{1}(e;\langle (e_{2},+1)\rangle )+\delta _{1}(e;\langle (e_{3},+1)\rangle )+2\delta _{1}(e;\langle (e_{4},+1)\rangle )$ is the superposition of paths $\langle (e_{1},+1)\rangle ,\langle (e_{2},+1)\rangle ,\langle (e_{3},+1)\rangle$, and $\langle (e_{4},+1)\rangle$ with the respective weights $1,-1,1,2$.
$f(e)=\delta _{1}(e;\langle (e_{2},-1),(e_{1},+1),(e_{3},+1),(e_{4},+1)\rangle )+\delta _{1}(e;\langle (e_{4},+1)\rangle )$ is the superposition of paths $\langle (e_{2},-1),(e_{1},+1),(e_{3},+1),(e_{4},+1)\rangle$, and $\langle (e_{4},+1)\rangle$ with the respective weights $1,1$.
It is important to note that given an arbitrary edge based function, decomposing the multi-path denoted by the function into a superposition of paths is not unique, as shown above where an edge based function is decomposed into multiple superpositions of paths.
Any edge based function that denotes "flow density" (flow per unit cross-sectional area) is best interpreted as a multi-path.
Below is shown two examples of a multi-path $P$ and the corresponding edge based function $\delta _{1}(e;P)$. On the left a superposition of multiple paths is shown. For each surface $\omega _{2}(e)$, the total "flow" through $\omega _{2}(e)$ is computed and is then divided by $\tau _{2}(e)$ to spread it out over the surface $\omega _{2}(e)$. On the right, the flow enters a surface through the green side and leaves through the red side. The density of the flow is depicted by the strength of the shading. If the green to red orientation coincides with the orientation of $e$, then $\delta _{1}(e;P)$ is positive. If the green to red orientation is opposite the orientation of $e$, then $\delta _{1}(e;P)$ is negative.
* Multi path example on the left, and edge based function on the right.
* Multi path example on the left, and edge based function on the right.

### Surfaces and multi-surfaces

The discrete analog to oriented surfaces using a directed graph is that an oriented surface $S$ is a collection of edges and orientations: $S=\{(e_{1},s_{1}),(e_{2},s_{2}),\dots ,(e_{k},s_{k})\}$ where all of the edges $e_{1},e_{2},\dots ,e_{k}\in {\mathcal {E}}$ are distinct and $s_{i}\in \{+1,-1\}$ is an indicator that describes the surface's orientation. Each edge $e_{i}$ is an edge that passes through the surface, and $s_{i}$ is $+1$ if $e_{i}$ passes through the surface in the preferred direction, and $s_{i}$ is $-1$ if $e_{i}$ passes through the surface in the opposite direction. The combined surface denoted by $S$ is $\omega _{2}(S)=\bigcup _{i=1}^{k}s_{i}\omega _{2}(e_{i})$ (surface $-\omega _{2}(e_{i})$ is surface $\omega _{2}(e_{i})$ with the orientation reversed) and the total area is $\tau _{2}(S)=\sum _{i=1}^{k}\tau _{2}(e_{i})$.
A surface $S$ can be denoted by the edge based function $\delta _{2}(e;S):{\mathcal {E}}\to \mathbb {R}$ where for each edge $e\in {\mathcal {E}}$, it is the case that $\delta _{2}(e;S)=\left\{{\begin{array}{cc}+1/\tau _{1}(e)&((e,+1)\in S)\\-1/\tau _{1}(e)&((e,-1)\in S)\\0&({\text{else}})\\\end{array}}\right.$. The term ${\frac {1}{\tau _{1}(e)}}$ arises from the fact that the surface is "spread out" over the length of $e$. The notation $\delta _{2}(S)$ denotes $\delta _{2}(e;S)$ with the parameter $e$ not shown.
A superposition of surfaces forms a "multi-surface". Any edge based function that returns real values can denote a multi-surface. For example, assuming that $\tau _{1}(e)=1$ for all $e\in {\mathcal {E}}$, the edge based function $f=\{e_{1}\mapsto 2,e_{2}\mapsto 2,e_{3}\mapsto 0,e_{4}\mapsto 0,e_{5}\mapsto 0,e_{6}\mapsto -1\}$ can be expressed as the following superpositions:
$f(e)=2\delta _{2}(e;\{(e_{1},+1)\})+2\delta _{2}(e;\{(e_{2},+1)\})-\delta _{2}(e;\{(e_{6},+1)\})$ is the superposition of surfaces $\{(e_{1},+1)\},\{(e_{2},+1)\},$ and $\{(e_{6},+1)\}$ with the respective weights $2,2,-1$.
$f(e)=\delta _{2}(e;\{(e_{1},+1),(e_{2},+1),(e_{6},-1)\})+\delta _{2}(e;\{(e_{1},+1),(e_{2},+1)\})$ is the superposition of surfaces $\{(e_{1},+1),(e_{2},+1),(e_{6},-1)\}$ and $\{(e_{1},+1),(e_{2},+1)\}$ with the respective weights $1$ and $1$.
It is important to note that given an arbitrary edge based function, decomposing the multi-surface denoted by the function into a superposition of surfaces is not unique, as shown above where an edge based function is decomposed into multiple superpositions of surfaces.
Any edge based function that denotes the "rate of gain" (rate of gain per unit length) is best interpreted as a multi-surface.
Below is shown two examples of a multi-surface $S$ and the corresponding edge based function $\delta _{2}(e;S)$. On the left a superposition of multiple surfaces is shown. For each curve $\omega _{1}(e)$, the net number of times edge $e$ penetrates $S$ in the preferred direction, referred to as the "gain" across $\omega _{1}(e)$, is computed and is then divided by $\tau _{1}(e)$ to spread the gain out over the curve $\omega _{1}(e)$. On the right, the net gain is positive if an edge is traversed from the green end to the red end. The amount of gain is depicted by the strength of the shading. If the green to red orientation coincides with the orientation of $e$, then $\delta _{2}(e;S)$ is positive. If the green to red orientation is opposite the orientation of $e$, then $\delta _{2}(e;S)$ is negative.
* Multi surface example on the left, and edge based function on the right.
* Multi surface example on the left, and edge based function on the right.

### Intersections
#### Multi-point multi-volume intersections

Given an arbitrary point $n_{0}\in {\mathcal {N}}$ and volume $U\subseteq {\mathcal {N}}$, let $\Sigma _{\mathcal {N}}(n_{0},U)=\left\{{\begin{array}{cc}1&(n_{0}\in U)\\0&(n_{0}\notin U)\end{array}}\right.$ denote an indicator function that returns 1 if point $n_{0}$ is contained by volume $U$ and returns 0 if otherwise.
Node based function $\delta _{0}(n;n_{0})=\left\{{\begin{array}{cc}1/\tau _{3}(n)&(n=n_{0})\\0&(n\neq n_{0})\end{array}}\right.$ denotes the point $n_{0}$, and node based function $\delta _{3}(n;U)=\left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\end{array}}\right.$ denotes the volume $U$.
The indicator function $\Sigma _{\mathcal {N}}(n_{0},U)$ can be computed via the following sum: $\Sigma _{\mathcal {N}}(n_{0},U)=\sum _{n\in {\mathcal {N}}}\left\{{\begin{array}{cc}1&(n=n_{0})\\0&(n\neq n_{0})\end{array}}\right\}\cdot \left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\end{array}}\right\}=\sum _{n\in {\mathcal {N}}}\delta _{0}(n;n_{0})\delta _{3}(n;U)\tau _{3}(n)$. The term $\tau _{3}(n)$ cancels out the ${\frac {1}{\tau _{3}(n)}}$ in $\delta _{0}(n;n_{0})$.
$\Sigma _{\mathcal {N}}(n_{0},U)$ counts the number of times point $n_{0}$ occurs in volume $U$ which can only be 0 or 1 for simple points and volumes. This count can be generalized to sets of points. Let $W\subseteq {\mathcal {N}}$ denote a collection of points. The collection of points can be denoted by the node based function $\delta _{0}(n;W)=\left\{{\begin{array}{cc}1/\tau _{3}(n)&(n\in W)\\0&(n\notin W)\end{array}}\right.$. The number of points from $W$ that are contained by volume $U$ can again be computed by the sum: $\Sigma _{\mathcal {N}}(W,U)=\sum _{n\in {\mathcal {N}}}\left\{{\begin{array}{cc}1&(n\in W)\\0&(n\notin W)\end{array}}\right\}\cdot \left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\end{array}}\right\}=\sum _{n\in {\mathcal {N}}}\delta _{0}(n;W)\delta _{3}(n;U)\tau _{3}(n)$.
In the general case, given a node based function $f$ that denotes a multi-point, and a node based function $g$ that denotes a multi-volume, then the total weight of all the occurrences of $f$ being inside of $g$ is $\Sigma _{\mathcal {N}}(f,g)=\sum _{n\in {\mathcal {N}}}f(n)g(n)\tau _{3}(n)$. The quantity $\Sigma _{\mathcal {N}}(f,g)$ is called the net intersection or the total intersection weight of $f$ with $g$.
It should also be noted that $\Sigma _{\mathcal {N}}(f,g)$ is commutative: $\Sigma _{\mathcal {N}}(f,g)=\Sigma _{\mathcal {N}}(g,f)$

#### Multi-path multi-surface intersections

Given an arbitrary path $P=\langle (e_{P,1},s_{P,1}),(e_{P,2},s_{P,2}),...,(e_{P,k_{P}},s_{P,k_{P}})\rangle$ and surface $S=\{(e_{S,1},s_{S,1}),(e_{S,2},s_{S,2}),...,(e_{S,k_{S}},s_{S,k_{S}})\}$, let $\Sigma _{\mathcal {E}}(P,S)$ denote the number of times path $P$ passes through surface $S$ in the preferred direction minus the number of times path $P$ passes through surface $S$ in the opposite direction. For an arbitrary $i=1,2,...,k_{P}$, and an arbitrary $j=1,2,...,k_{S}$, if $e_{P,i}=e_{S,j}$ then the $i^{\text{th}}$ link of path $P$ coincides with the $j^{\text{th}}$ segment of surface $S$. If $s_{P,i}s_{S,j}=+1$, then $s_{P,i}=s_{S,j}$ and $P$ passes through $S$ in the preferred direction. If $s_{P,i}s_{S,j}=-1$, then $s_{P,i}\neq s_{S,j}$ and $P$ passes through $S$ in the opposite direction.
$\Sigma _{\mathcal {E}}(P,S)$ can be computed via the following sum: $\Sigma _{\mathcal {E}}(P,S)=\sum _{i=1}^{k_{P}}\sum _{j=1}^{k_{S}}\left\{{\begin{array}{cc}s_{P,i}s_{S,j}&(e_{P,i}=e_{S,j})\\0&(e_{P,i}\neq e_{S,j})\end{array}}\right.=\sum _{e\in {\mathcal {E}}}\delta _{1}(e;P)\delta _{2}(e;S)\tau _{2}(e)\tau _{1}(e)$. The term $\tau _{2}(e)$ cancels out the ${\frac {1}{\tau _{2}(e)}}$ from $\delta _{1}(e;P)$, and the term $\tau _{1}(e)$ cancels out the ${\frac {1}{\tau _{1}(e)}}$ from $\delta _{2}(e;S)$.
In the general case, given an edge based function $f$ that denotes a multi-path, and an edge based function $g$ that denotes a multi-surface, then the total weight of all the intersections of $f$ with $g$ is $\Sigma _{\mathcal {E}}(f,g)=\sum _{e\in {\mathcal {E}}}f(e)g(e)\tau _{2}(e)\tau _{1}(e)$. The quantity $\Sigma _{\mathcal {E}}(f,g)$ is called the net intersection or the total intersection weight of $f$ with $g$.
It should also be noted that $\Sigma _{\mathcal {E}}(f,g)$ is commutative: $\Sigma _{\mathcal {E}}(f,g)=\Sigma _{\mathcal {E}}(g,f)$

## Lumped coordinate system models
### Model of Cartesian coordinates

The discrete model used for Cartesian coordinates will consist of an infinite 3 dimensional grid of nodes that spans $\mathbb {R} ^{3}$. To establish the model, the following is needed:
* A spacing $\Delta x$ for the x-coordinates.
* A spacing $\Delta y$ for the y-coordinates.
* A spacing $\Delta z$ for the z-coordinates.
For each triplet of integer indices $(i,j,k)\in \mathbb {Z} ^{3}$, there exists a node $n_{(i,j,k)}$ and 3 edges $e_{x,(i,j,k)}$, $e_{y,(i,j,k)}$, and $e_{z,(i,j,k)}$.
The origin and terminal nodes of $e_{x,(i,j,k)}$ are $t_{\bullet }(e_{x,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{x,(i,j,k)})=n_{(i+1,j,k)}$
The origin and terminal nodes of $e_{y,(i,j,k)}$ are $t_{\bullet }(e_{y,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{y,(i,j,k)})=n_{(i,j+1,k)}$
The origin and terminal nodes of $e_{z,(i,j,k)}$ are $t_{\bullet }(e_{z,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{z,(i,j,k)})=n_{(i,j,k+1)}$
The Cartesian coordinate associated with node $n_{(i,j,k)}$ is $\omega _{0}(n_{(i,j,k)})=(i\Delta x,j\Delta y,k\Delta z)$, and the space associated with node $n_{(i,j,k)}$ is $\omega _{3}(n_{(i,j,k)})=\left[i\Delta x-{\frac {\Delta x}{2}},i\Delta x+{\frac {\Delta x}{2}}\right]\times \left[j\Delta y-{\frac {\Delta y}{2}},j\Delta y+{\frac {\Delta y}{2}}\right]\times \left[k\Delta z-{\frac {\Delta z}{2}},k\Delta z+{\frac {\Delta z}{2}}\right]$.
The volume of node $n_{(i,j,k)}$ is $\tau _{3}(n_{(i,j,k)})=\Delta x\Delta y\Delta z$.
The length of edge $e_{x,(i,j,k)}$ is $\tau _{1}(e_{x,(i,j,k)})=\Delta x$. The length of edge $e_{y,(i,j,k)}$ is $\tau _{1}(e_{y,(i,j,k)})=\Delta y$. The length of edge $e_{z,(i,j,k)}$ is $\tau _{1}(e_{z,(i,j,k)})=\Delta z$.
The area of edge $e_{x,(i,j,k)}$ is $\tau _{2}(e_{x,(i,j,k)})=\Delta y\Delta z$. The area of edge $e_{y,(i,j,k)}$ is $\tau _{2}(e_{y,(i,j,k)})=\Delta z\Delta x$. The area of edge $e_{z,(i,j,k)}$ is $\tau _{2}(e_{z,(i,j,k)})=\Delta x\Delta y$.
Given a scalar field $f(x,y,z)$ over Cartesian coordinates, $f$ will be approximated by the node based function $f_{\text{approx}}:{\mathcal {N}}\to \mathbb {R}$. Function $f_{\text{approx}}$ is defined by $f_{\text{approx}}(n_{(i,j,k)})=f(i\Delta x,j\Delta y,k\Delta z)$ for each $(i,j,k)\in \mathbb {Z} ^{3}$.
Given a vector field $\mathbf {F} (x,y,z)=F_{x}(x,y,z)\mathbf {i} +F_{y}(x,y,z)\mathbf {j} +F_{z}(x,y,z)\mathbf {k}$ over Cartesian coordinates, $\mathbf {F}$ will be approximated by the edge based function $F_{\text{approx}}:{\mathcal {E}}\to \mathbb {R}$. Function $F_{\text{approx}}$ is defined by $F_{\text{approx}}(e_{x,(i,j,k)})=F_{x}(i\Delta x,j\Delta y,k\Delta z)$; $F_{\text{approx}}(e_{y,(i,j,k)})=F_{y}(i\Delta x,j\Delta y,k\Delta z)$; and $F_{\text{approx}}(e_{z,(i,j,k)})=F_{z}(i\Delta x,j\Delta y,k\Delta z)$.

### Model of Cylindrical coordinates

The discrete model used for Cylindrical coordinates will consist of an infinite 3 dimensional cylindrical grid of nodes that spans $\mathbb {R} ^{3}$. To establish the model, the following is needed:
* A spacing $\Delta \rho$ for the coordinate $\rho$.
* A large positive integer $N_{\phi }$ that will yield a spacing $\Delta \phi ={\frac {2\pi }{N_{\phi }}}$ for the coordinate $\phi$.
* A spacing $\Delta z$ for the coordinate $z$.
Each node $n\in {\mathcal {N}}$ will correspond to a unique triplet $(i,j,k)$ of integers, and will be denoted by $n_{(i,j,k)}$. The cylindrical coordinate denoted by $n_{(i,j,k)}$ will be $\omega _{0}(n_{(i,j,k)})=(i\Delta \rho ,j\Delta \phi ,k\Delta z)$.
Clearly, due to the nature of cylindrical coordinates (such as the fact that coordinate $\phi$ is cyclical), not every triplet $(i,j,k)$ will be allowed. The following three domains will be defined: $I_{0}$, $I_{1}$, and $I_{2}$.
$(i,j,k)\in I_{0}\iff (i\geq 1\;{\text{and}}\;0\leq j<N_{\phi })$
$(i,j,k)\in I_{1}\iff (i\geq 0\;{\text{and}}\;(i=0\implies j=0)\;{\text{and}}\;0\leq j<N_{\phi })$
$(i,j,k)\in I_{2}\iff (i\geq 0\;{\text{and}}\;0\leq j<N_{\phi })$
There exists a node $n_{(i,j,k)}$ for each $(i,j,k)\in I_{1}$.
There exists an edge $e_{\rho ,(i,j,k)}$ for each $(i,j,k)\in I_{2}$ such that $t_{\bullet }(e_{\rho ,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j,k)}&(i>0)\\n_{(i,0,k)}&(i=0)\\\end{array}}\right.$ and $t^{\bullet }(e_{\rho ,(i,j,k)})=n_{(i+1,j,k)}$
There exists an edge $e_{\phi ,(i,j,k)}$ for each $(i,j,k)\in I_{0}$ such that $t_{\bullet }(e_{\phi ,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{\phi ,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j+1,k)}&(j<N_{\phi }-1)\\n_{(i,0,k)}&(j=N_{\phi }-1)\\\end{array}}\right.$
There exists an edge $e_{z,(i,j,k)}$ for each $(i,j,k)\in I_{1}$ such that $t_{\bullet }(e_{z,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{z,(i,j,k)})=n_{(i,j,k+1)}$
Next, the volume of each node and the lengths and area of each edge will be calculated. To simplify notation, let $l_{\phi }(i_{\text{real}})=(i_{\text{real}}\Delta \rho )\Delta \phi$ for any nonnegative real number $i_{\text{real}}$.
For each $(i,j,k)\in I_{1}$ the cylindrical coordinate that corresponds to $n_{(i,j,k)}$ is $\omega _{0}(n_{(i,j,k)})=(i\Delta \rho ,j\Delta \phi ,k\Delta z)$, and the space (described using cylindrical coordinates) associated with $n_{(i,j,k)}$ is $\omega _{3}(n_{(i,j,k)})=\left\{{\begin{array}{cc}[(i-{\frac {1}{2}})\Delta \rho ,(i+{\frac {1}{2}})\Delta \rho ]\times [(j-{\frac {1}{2}})\Delta \phi ,(j+{\frac {1}{2}})\Delta \phi ]\times [(k-{\frac {1}{2}})\Delta z,(k+{\frac {1}{2}})\Delta z]&(i>0)\\{[0,{\frac {\Delta \rho }{2}}]}\times [0,2\pi ]\times [(k-{\frac {1}{2}})\Delta z,(k+{\frac {1}{2}})\Delta z]&(i=0)\\\end{array}}\right.$
For each $(i,j,k)\in I_{1}$ the volume of node $n_{(i,j,k)}$ is $\tau _{3}(n_{(i,j,k)})=\left\{{\begin{array}{cc}\Delta \rho \cdot l_{\phi }(i)\cdot \Delta z&(i>0)\\\pi ({\frac {\Delta \rho }{2}})^{2}\Delta z&(i=0)\\\end{array}}\right.$
For each $(i,j,k)\in I_{2}$ the length and area of edge $e_{\rho ,(i,j,k)}$ is $\tau _{1}(e_{\rho ,(i,j,k)})=\Delta \rho$ and $\tau _{2}(e_{\rho ,(i,j,k)})\approx l_{\phi }(i+{\frac {1}{2}})\cdot \Delta z$ respectively.
For each $(i,j,k)\in I_{0}$ the length and area of edge $e_{\phi ,(i,j,k)}$ is $\tau _{1}(e_{\phi ,(i,j,k)})\approx l_{\phi }(i)$ and $\tau _{2}(e_{\phi ,(i,j,k)})=\Delta \rho \cdot \Delta z$ respectively.
For each $(i,j,k)\in I_{1}$ the length and area of edge $e_{z,(i,j,k)}$ is $\tau _{1}(e_{z,(i,j,k)})=\Delta z$ and $\tau _{2}(e_{z,(i,j,k)})=\left\{{\begin{array}{cc}\Delta \rho \cdot l_{\phi }(i)&(i>0)\\\pi ({\frac {\Delta \rho }{2}})^{2}&(i=0)\\\end{array}}\right.$ respectively.
Given a scalar field $f(\rho ,\phi ,z)$ over cylindrical coordinates, $f$ will be approximated by the node based function $f_{\text{approx}}:{\mathcal {N}}\to \mathbb {R}$. Function $f_{\text{approx}}$ is defined by $f_{\text{approx}}(n_{(i,j,k)})=f(i\Delta \rho ,j\Delta \phi ,k\Delta z)$ for each $(i,j,k)\in I_{1}$.
Given a vector field $\mathbf {F} (\rho ,\phi ,z)=F_{\rho }(\rho ,\phi ,z){\hat {\mathbf {\rho } }}+F_{\phi }(\rho ,\phi ,z){\hat {\mathbf {\phi } }}+F_{z}(\rho ,\phi ,z){\hat {\mathbf {z} }}$ over cylindrical coordinates, $\mathbf {F}$ will be approximated by the edge based function $F_{\text{approx}}:{\mathcal {E}}\to \mathbb {R}$. Function $F_{\text{approx}}$ is defined by:
$\forall (i,j,k)\in I_{2}:F_{\text{approx}}(e_{\rho ,(i,j,k)})=\left\{{\begin{array}{cc}F_{\rho }(i\Delta \rho ,j\Delta \phi ,k\Delta z)&(i>0)\\\lim _{\rho \to 0^{+}}F_{\rho }(\rho ,j\Delta \phi ,k\Delta z)&(i=0)\\\end{array}}\right.$
$\forall (i,j,k)\in I_{0}:F_{\text{approx}}(e_{\phi ,(i,j,k)})=F_{\phi }(i\Delta \rho ,j\Delta \phi ,k\Delta z)$
$\forall (i,j,k)\in I_{1}:F_{\text{approx}}(e_{z,(i,j,k)})=F_{z}(i\Delta \rho ,j\Delta \phi ,k\Delta z)$

### Model of Spherical coordinates

The discrete model used for Spherical coordinates will consist of an infinite 3 dimensional spherical grid of nodes that spans $\mathbb {R} ^{3}$. To establish the model, the following is needed:
* A spacing $\Delta r$ for the coordinate $r$.
* A large positive integer $N_{\theta }$ that will yield a spacing $\Delta \theta ={\frac {\pi }{N_{\theta }}}$ for the coordinate $\theta$.
* A large positive integer $N_{\phi }$ that will yield a spacing $\Delta \phi ={\frac {2\pi }{N_{\phi }}}$ for the coordinate $\phi$.
Each node $n\in {\mathcal {N}}$ will correspond to a unique triplet $(i,j,k)$ of integers, and will be denoted by $n_{(i,j,k)}$. The spherical coordinate denoted by $n_{(i,j,k)}$ will be $\omega _{0}(n_{(i,j,k)})=(i\Delta r,j\Delta \theta ,k\Delta \phi )$.
Clearly, due to the nature of spherical coordinates (such as the fact that coordinate $\phi$ is cyclical), not every triplet $(i,j,k)$ will be allowed. The following three domains will be defined: $I_{n}$, $I_{r}$, $I_{\theta }$, and $I_{\phi }$.
$(i,j,k)\in I_{n}\iff (i\geq 0\;{\text{and}}\;0\leq j\leq N_{\theta }\;{\text{and}}\;0\leq k<N_{\phi }\;{\text{and}}\;(i=0\implies j=0)\;{\text{and}}\;((j=0\;{\text{or}}\;j=N_{\theta })\implies k=0))$
$(i,j,k)\in I_{r}\iff (i\geq 0\;{\text{and}}\;0\leq j\leq N_{\theta }\;{\text{and}}\;0\leq k<N_{\phi }\;{\text{and}}\;((j=0\;{\text{or}}\;j=N_{\theta })\implies k=0))$
$(i,j,k)\in I_{\theta }\iff (i\geq 1\;{\text{and}}\;0\leq j<N_{\theta }\;{\text{and}}\;0\leq k<N_{\phi })$
$(i,j,k)\in I_{\phi }\iff (i\geq 1\;{\text{and}}\;0<j<N_{\theta }\;{\text{and}}\;0\leq k<N_{\phi })$
There exists a node $n_{(i,j,k)}$ for each $(i,j,k)\in I_{n}$.
There exists an edge $e_{r,(i,j,k)}$ for each $(i,j,k)\in I_{r}$ such that $t_{\bullet }(e_{r,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j,k)}&(i>0)\\n_{(i,0,0)}&(i=0)\\\end{array}}\right.$ and $t^{\bullet }(e_{r,(i,j,k)})=n_{(i+1,j,k)}$
There exists an edge $e_{\theta ,(i,j,k)}$ for each $(i,j,k)\in I_{\theta }$ such that $t_{\bullet }(e_{\theta ,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j,k)}&(j>0)\\n_{(i,j,0)}&(j=0)\\\end{array}}\right.$ and $t^{\bullet }(e_{\theta ,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j+1,k)}&(j<N_{\theta }-1)\\n_{(i,j+1,0)}&(j=N_{\theta }-1)\\\end{array}}\right.$
There exists an edge $e_{\phi ,(i,j,k)}$ for each $(i,j,k)\in I_{\phi }$ such that $t_{\bullet }(e_{\phi ,(i,j,k)})=n_{(i,j,k)}$ and $t^{\bullet }(e_{\phi ,(i,j,k)})=\left\{{\begin{array}{cc}n_{(i,j,k+1)}&(k<N_{\phi }-1)\\n_{(i,j,0)}&(k=N_{\phi }-1)\\\end{array}}\right.$
Next, the volume of each node and the lengths and area of each edge will be calculated. To simplify notation, let $l_{\theta }(i_{\text{real}})=(i_{\text{real}}\Delta r)\Delta \theta$ for any nonnegative real number $i_{\text{real}}$, and let $l_{\phi }(i_{\text{real}},j_{\text{real}})=(i_{\text{real}}\Delta r)\sin(j_{\text{real}}\Delta \theta )\Delta \phi$ for any nonnegative real number $i_{\text{real}}$ and any real number $j_{\text{real}}\in [0,N_{\theta }]$.
For each $(i,j,k)\in I_{n}$ the spherical coordinate that corresponds to $n_{(i,j,k)}$ is $\omega _{0}(n_{(i,j,k)})=(i\Delta r,j\Delta \theta ,k\Delta \phi )$, and the space (described using spherical coordinates) associated with $n_{(i,j,k)}$ is $\omega _{3}(n_{(i,j,k)})=\left\{{\begin{array}{cc}[(i-{\frac {1}{2}})\Delta r,(i+{\frac {1}{2}})\Delta r]\times [(j-{\frac {1}{2}})\Delta \theta ,(j+{\frac {1}{2}})\Delta \theta ]\times [(k-{\frac {1}{2}})\Delta \phi ,(k+{\frac {1}{2}})\Delta \phi ]&(i>0\;{\text{and}}\;0<j<N_{\theta })\\{[(i-{\frac {1}{2}})\Delta r,(i+{\frac {1}{2}})\Delta r]}\times [0,{\frac {\Delta \theta }{2}}]\times [0,2\pi ]&(i>0\;{\text{and}}\;j=0)\\{[(i-{\frac {1}{2}})\Delta r,(i+{\frac {1}{2}})\Delta r]}\times [\pi -{\frac {\Delta \theta }{2}},\pi ]\times [0,2\pi ]&(i>0\;{\text{and}}\;j=N_{\theta })\\{[0,{\frac {\Delta r}{2}}]}\times [0,\pi ]\times [0,2\pi ]&(i=0)\\\end{array}}\right.$
For each $(i,j,k)\in I_{n}$ the volume of node $n_{(i,j,k)}$ is $\tau _{3}(n_{(i,j,k)})\approx \left\{{\begin{array}{cc}\Delta r\cdot l_{\theta }(i)\cdot l_{\phi }(i,j)&(i>0\;{\text{and}}\;0<j<N_{\theta })\\\Delta r\cdot \pi ({\frac {1}{2}}l_{\theta }(i))^{2}&(i>0\;{\text{and}}\;(j=0\;{\text{or}}\;j=N_{\theta }))\\{\frac {4}{3}}\pi ({\frac {\Delta r}{2}})^{3}&(i=0)\\\end{array}}\right.$
For each $(i,j,k)\in I_{r}$ the length and area of edge $e_{r,(i,j,k)}$ is $\tau _{1}(e_{r,(i,j,k)})=\Delta r$ and $\tau _{2}(e_{r,(i,j,k)})\approx \left\{{\begin{array}{cc}l_{\theta }(i+{\frac {1}{2}})\cdot l_{\phi }(i+{\frac {1}{2}},j)&(0<j<N_{\theta })\\\pi ({\frac {1}{2}}l_{\theta }(i+{\frac {1}{2}}))^{2}&(j=0\;{\text{or}}\;j=N_{\theta })\\\end{array}}\right.$ respectively.
For each $(i,j,k)\in I_{\theta }$ the length and area of edge $e_{\theta ,(i,j,k)}$ is $\tau _{1}(e_{\theta ,(i,j,k)})\approx l_{\theta }(i)$ and $\tau _{2}(e_{\theta ,(i,j,k)})\approx \Delta r\cdot l_{\phi }(i,j+{\frac {1}{2}})$ respectively.
For each $(i,j,k)\in I_{\phi }$ the length and area of edge $e_{\phi ,(i,j,k)}$ is $\tau _{1}(e_{\phi ,(i,j,k)})\approx l_{\phi }(i,j)$ and $\tau _{2}(e_{\phi ,(i,j,k)})=\Delta r\cdot l_{\theta }(i)$ respectively.
Given a scalar field $f(r,\theta ,\phi )$ over spherical coordinates, $f$ will be approximated by the node based function $f_{\text{approx}}:{\mathcal {N}}\to \mathbb {R}$. Function $f_{\text{approx}}$ is defined by $f_{\text{approx}}(n_{(i,j,k)})=f(i\Delta r,j\Delta \theta ,k\Delta \phi )$ for each $(i,j,k)\in I_{n}$.
Given a vector field $\mathbf {F} (r,\theta ,\phi )=F_{r}(r,\theta ,\phi ){\hat {\mathbf {r} }}+F_{\theta }(r,\theta ,\phi ){\hat {\mathbf {\theta } }}+F_{\phi }(r,\theta ,\phi ){\hat {\mathbf {\phi } }}$ over spherical coordinates, $\mathbf {F}$ will be approximated by the edge based function $F_{\text{approx}}:{\mathcal {E}}\to \mathbb {R}$. Function $F_{\text{approx}}$ is defined by:
$\forall (i,j,k)\in I_{r}:F_{\text{approx}}(e_{r,(i,j,k)})=\left\{{\begin{array}{cc}F_{r}(i\Delta r,j\Delta \theta ,k\Delta \phi )&(i>0)\\\lim _{r\to 0^{+}}F_{r}(r,j\Delta \theta ,k\Delta \phi )&(i=0)\\\end{array}}\right.$
$\forall (i,j,k)\in I_{\theta }:F_{\text{approx}}(e_{\theta ,(i,j,k)})=\left\{{\begin{array}{cc}F_{\theta }(i\Delta r,j\Delta \theta ,k\Delta \phi )&(j>0)\\\lim _{\theta \to 0^{+}}F_{\theta }(i\Delta r,\theta ,k\Delta \phi )&(j=0)\\\end{array}}\right.$
$\forall (i,j,k)\in I_{\phi }:F_{\text{approx}}(e_{\phi ,(i,j,k)})=F_{\phi }(i\Delta r,j\Delta \theta ,k\Delta \phi )$

### Model of Curvilinear coordinates

A curvilinear coordinate system is a coordinate system such as cylindrical or spherical coordinates where the position may not follow a straight line as one of the coordinates is changed. To model an arbitrary curvilinear coordinate system in 3 dimensional space, let the coordinates be denoted by $\xi _{1},\xi _{2},\xi _{3}$.
To avoid unnecessary repetition, the following notation will be used:
* Given any number $k\in \mathbb {R}$, and subset $C\subseteq \{1,2,3\}$, then $[k]_{C}$ denotes the triple $[k]_{C}=\left(\left\{{\begin{array}{cc}k&(1\in C)\\0&(1\notin C)\end{array}}\right.,\left\{{\begin{array}{cc}k&(2\in C)\\0&(2\notin C)\end{array}}\right.,\left\{{\begin{array}{cc}k&(3\in C)\\0&(3\notin C)\end{array}}\right.\right)$
* Given any two triples of numbers $(x_{1},x_{2},x_{3}),(y_{1},y_{2},y_{3})\in \mathbb {R} ^{3}$, then $(x_{1},x_{2},x_{3})+(y_{1},y_{2},y_{3})=(x_{1}+y_{1},x_{2}+y_{2},x_{3}+y_{3})$
* Given any two triples of numbers $(x_{1},x_{2},x_{3}),(y_{1},y_{2},y_{3})\in \mathbb {R} ^{3}$, then $(x_{1},x_{2},x_{3})(y_{1},y_{2},y_{3})=(x_{1}y_{1},x_{2}y_{2},x_{3}y_{3})$
* $\Xi =(\xi _{1},\xi _{2},\xi _{3})$ denotes an arbitrary curvilinear coordinate $(\xi _{1},\xi _{2},\xi _{3})$.
* $\Delta \Xi =(\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3})$ denotes an arbitrary triplet of differences in the coordinates $\xi _{1},\xi _{2},\xi _{3}$.
Let $\omega _{0}(\Xi )$ denote the position given by coordinate $\Xi =(\xi _{1},\xi _{2},\xi _{3})$. For each $c=1,2,3$, the rate of change in the position $\omega _{0}(\Xi )$ at coordinate $\Xi$ with respect to $\xi _{c}$ is given by: $\mathbf {u} _{\xi _{c}}(\Xi )={\frac {\partial \omega _{0}}{\partial \xi _{c}}}{\bigg |}_{\Xi }$. It will be assumed that $\mathbf {u} _{\xi _{1}}$, $\mathbf {u} _{\xi _{2}}$, and $\mathbf {u} _{\xi _{3}}$ are all mutually perpendicular, which is the case for Cartesian, cylindrical, and spherical coordinates. In addition, for each $c=1,2,3$, vector $\mathbf {v} _{\xi _{c}}(\Xi )={\frac {\mathbf {u} _{\xi _{c}}(\Xi )}{|\mathbf {u} _{\xi _{c}}(\Xi )|}}$ will also denote a unit length normalization of $\mathbf {u} _{\xi _{c}}(\Xi )$.
For the purposes of simplicity, it will be assumed that the coordinates $\Xi =(\xi _{1},\xi _{2},\xi _{3})$ can be any triple of real numbers. Singularities such as the z-axis in cylindrical and spherical coordinates will not be considered by this model. Since singularities are not considered, this model will be considerably simpler than the models given for cylindrical and spherical coordinates.
To model the curvilinear coordinate system, a lattice of nodes ${\mathcal {N}}$ connected by directed edges ${\mathcal {E}}$ will be established:
Start by choosing "resolutions" for each coordinate $\xi _{1},\xi _{2},\xi _{3}$ denoted by $\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3}$. The quantities $\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3}$ should all be strictly positive, and ideally should be as small as possible.
* For each triplet of integer indices $I\in \mathbb {Z} ^{3}$, a node $n_{I}\in {\mathcal {N}}$ will be created at position $\omega _{0}(n_{I})=\omega _{0}(I\Delta \Xi )$.
* For each $c=1,2,3$ and for each triplet of integer indices $I\in \mathbb {Z} ^{3}$, there will exist edge $e_{\xi _{c},I}\in {\mathcal {E}}$ such that $t_{\bullet }(e_{\xi _{c},I})=n_{I}$ and $t^{\bullet }(e_{\xi _{c},I})=n_{I+[1]_{c}}$.
* For each $I\in \mathbb {Z} ^{3}$, the volume of node $n_{I}$ is $\tau _{3}(n_{I})=\prod _{c=1}^{3}(\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|)$ $=\left(\prod _{c=1}^{3}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|\right)\left(\prod _{c=1}^{3}\Delta \xi _{c}\right)$
* For each $c=1,2,3$ and $I\in \mathbb {Z} ^{3}$, the length and area of edge $e_{\xi _{c},I}$ are $\tau _{1}(e_{\xi _{c},I})=\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )|$ and $\tau _{2}(e_{\xi _{c},I})=\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}((I+[0.5]_{c})\Delta \Xi )|$ respectively.
Any node $n\in {\mathcal {N}}$ for which $\tau _{3}(n)=0$ should be deleted along with all connecting edges.
For any edge $e\in {\mathcal {E}}$ for which $\tau _{1}(e)=0$ and $\tau _{2}(e)>0$, then nodes $t_{\bullet }(e)$ and $t^{\bullet }(e)$ should be fused into a single node, and edge $e$ should be discarded. For any edge $e\in {\mathcal {E}}$ for which $\tau _{2}(e)=0$ and $\tau _{1}(e)>0$, then edge $e$ should be discarded. Either action may be pursued when $\tau _{1}(e)=\tau _{2}(e)=0$.
Given a scalar field $f(\Xi )$ over the curvilinear coordinate system, $f$ will be approximated by the node based function $f_{\text{approx}}:{\mathcal {N}}\to \mathbb {R}$. Function $f_{\text{approx}}$ is defined by $f_{\text{approx}}(n_{I})=f(I\Delta \Xi )$ for each $I\in \mathbb {Z} ^{3}$.
Given a vector field $\mathbf {F} (\Xi )=\sum _{c=1}^{3}F_{\xi _{c}}(\Xi )\mathbf {v} _{\xi _{c}}(\Xi )$ over the curvilinear coordinates, $\mathbf {F}$ will be approximated by the edge based function $F_{\text{approx}}:{\mathcal {E}}\to \mathbb {R}$. Function $F_{\text{approx}}$ is defined by $F_{\text{approx}}(e_{\xi _{c},I})=F_{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )$ for each $c=1,2,3$ and for each $I\in \mathbb {Z} ^{3}$.

## Discrete analog to Integrals
### Volume Integrals

Let $U\subseteq {\mathcal {N}}$ denote an arbitrary volume. Given a node based function $f$, the "volume integral" of $f$ over $U$ is $\int _{n\in U}f(n)=\sum _{n\in U}f(n)\tau _{3}(n)$ (recall that $\tau _{3}(n)$ is the volume of node $n$, and $\omega _{3}(n)$ is the volume of space represented by $n$).
If node based function $f:{\mathcal {N}}\to \mathbb {R}$ is an approximation of a scalar field $f_{\text{continuous}}:{\bigg\bigcup _{n\in {\mathcal {N}}}\omega _{3}(n){\bigg )}\to \mathbb {R}$, where $\forall n\in {\mathcal {N}}:f(n)=f_{\text{continuous}}(\omega _{0}(n))$, then $\int _{n\in U}f(n)$ is an approximation of the volume integral $\iiint _{\mathbf {q} \in \bigcup _{n\in U}\omega _{3}(n)}f(\mathbf {q} )dV$.
Recall that $U$ can be described via the node based function $\delta _{3}(n;U)=\left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\\\end{array}}\right.$. This allows the expression $\int _{n\in U}f(n)=\sum _{n\in {\mathcal {N}}}f(n)\delta _{3}(n;U)\tau _{3}(n)$. If node based function $g$ denotes a multi-volume, then $\int _{n\in g}f(n)=\sum _{n\in {\mathcal {N}}}f(n)g(n)\tau _{3}(n)=\Sigma _{\mathcal {N}}(f,g)$.
$f$ most often denotes a density function, and $\int _{n\in g}f(n)$ denotes the total "mass" contained by multi-volume $g$. The equality $\int _{n\in g}f(n)=\Sigma _{\mathcal {N}}(f,g)$ means that if $f$ is interpreted as a multi-point, then the total "mass" contained by $g$ is the total intersection weight of $f$ with $g$.

### Path Integrals

Let $P=\langle (e_{1},s_{1}),(e_{2},s_{2}),...,(e_{k},s_{k})\rangle$ denote an arbitrary path. Given an edge based function $f$, the "path integral" of $f$ along $P$ is $\int _{e\in P}f(e)=\sum _{i=1}^{k}s_{i}f(e_{i})\tau _{1}(e_{i})$ (recall that $\tau _{1}(e)$ is the length of edge $e$, and $\omega _{1}(e)$ is the curve represented by $e$).
If edge based function $f:{\mathcal {E}}\to \mathbb {R}$ is an approximation of a vector field $\mathbf {F} _{\text{continuous}}:{\bigg\bigcup _{n\in {\mathcal {N}}}\omega _{3}(n){\bigg )}\to \mathbb {R} ^{3}$, where $\forall e\in {\mathcal {E}}:f(e)=\mathbf {F} _{\text{continuous}}(\omega _{0}(t_{\bullet }(e)))\cdot {\frac {\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))}{|\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))|}}$, then $\int _{e\in P}f(e)$ is an approximation of the path integral $\int _{\mathbf {q} \in \bigcup _{i=1}^{k}s_{i}\omega _{1}(e_{i})}\mathbf {F} (\mathbf {q} )\cdot d\mathbf {q}$.
Recall that $P$ can be described via the edge based function $\delta _{1}(e;P)=\sum _{i=1}^{k}s_{i}\left\{{\begin{array}{cc}1/\tau _{2}(e)&(e=e_{i})\\0&(e\neq e_{i})\\\end{array}}\right.$. This allows the expression $\int _{e\in P}f(e)=\sum _{e\in {\mathcal {E}}}f(e)\delta _{1}(e;P)\tau _{2}(e)\tau _{1}(e)$. If edge based function $g$ denotes a multi-path, then $\int _{e\in g}f(e)=\sum _{e\in {\mathcal {E}}}f(e)g(e)\tau _{2}(e)\tau _{1}(e)=\Sigma _{\mathcal {E}}(g,f)$.
$f$ most often denotes a rate of gain function, and $\int _{e\in g}f(e)$ denotes the total "gain" caused by $f$ along multi-path $g$. The equality $\int _{e\in g}f(e)=\Sigma _{\mathcal {E}}(g,f)$ means that if $f$ is interpreted as a multi-surface, then the total "gain" generated along $g$ is the total intersection weight of $g$ with $f$.

### Surface Integrals

Let $S=\{(e_{1},s_{1}),(e_{2},s_{2}),...,(e_{k},s_{k})\}$ denote an arbitrary surface. Given an edge based function $f$, the "surface integral" of $f$ over $S$ is $\int _{e\in S}f(e)=\sum _{(e,s)\in S}sf(e)\tau _{2}(e)$ (recall that $\tau _{2}(e)$ is the cross-sectional area of edge $e$, and $\omega _{2}(e)$ is the surface which separates $\omega _{3}(t_{\bullet }(e))$ and $\omega _{3}(t^{\bullet }(e))$).
If edge based function $f:{\mathcal {E}}\to \mathbb {R}$ is an approximation of a vector field $\mathbf {F} _{\text{continuous}}:{\bigg\bigcup _{n\in {\mathcal {N}}}\omega _{3}(n){\bigg )}\to \mathbb {R} ^{3}$, where $\forall e\in {\mathcal {E}}:f(e)=\mathbf {F} _{\text{continuous}}(\omega _{0}(t_{\bullet }(e)))\cdot {\frac {\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))}{|\omega _{0}(t^{\bullet }(e))-\omega _{0}(t_{\bullet }(e))|}}$, then $\int _{e\in S}f(e)$ is an approximation of the surface integral $\iint _{\mathbf {q} \in \bigcup _{(e,s)\in S}s\omega _{2}(e)}\mathbf {F} (\mathbf {q} )\cdot \mathbf {dS}$.
Recall that $S$ can be described via the edge based function $\delta _{2}(e;S)=\left\{{\begin{array}{cc}+1/\tau _{1}(e)&((e,+1)\in S)\\-1/\tau _{1}(e)&((e,-1)\in S)\\0&({\text{else}})\\\end{array}}\right.$. This allows the expression $\int _{e\in S}f(e)=\sum _{e\in {\mathcal {E}}}f(e)\delta _{2}(e;S)\tau _{2}(e)\tau _{1}(e)$. If edge based function $g$ denotes a multi-surface, then $\int _{e\in g}f(e)=\sum _{e\in {\mathcal {E}}}f(e)g(e)\tau _{2}(e)\tau _{1}(e)=\Sigma _{\mathcal {E}}(f,g)$.
$f$ most often denotes a flow density function, and $\int _{e\in g}f(e)$ denotes the total "flow" through multi-surface $g$. The equality $\int _{e\in g}f(e)=\Sigma _{\mathcal {E}}(f,g)$ means that if $f$ is interpreted as a multi-path, then the total "flow" through $g$ is the total intersection weight of $f$ with $g$.

## Discrete analog to the Gradient
### Computing the surfaces of volumes

Consider an arbitrary volume $U\subseteq {\mathcal {N}}$. The inwards oriented surface of $U$ is a surface $S$ defined by $(e,+1)\in S\iff (t_{\bullet }(e)\notin U\;{\text{and}}\;t^{\bullet }(e)\in U)$ and $(e,-1)\in S\iff (t_{\bullet }(e)\in U\;{\text{and}}\;t^{\bullet }(e)\notin U)$. Volume $U$ is denoted by the node based function $\delta _{3}(n;U)=\left\{{\begin{array}{cc}1&(n\in U)\\0&(n\notin U)\end{array}}\right.$. The inwards oriented surface $S$ is denoted by the edge based function: $\delta _{2}(e;S)=\left\{{\begin{array}{cc}+1/\tau _{1}(e)&((e,+1)\in S)\\-1/\tau _{1}(e)&((e,-1)\in S)\\0&({\text{else}})\end{array}}\right.$ $=\left\{{\begin{array}{cc}+1/\tau _{1}(e)&(t_{\bullet }(e)\notin U\;{\text{and}}\;t^{\bullet }(e)\in U)\\-1/\tau _{1}(e)&(t_{\bullet }(e)\in U\;{\text{and}}\;t^{\bullet }(e)\notin U)\\0&({\text{else}})\end{array}}\right.$ $={\frac {\delta _{3}(t^{\bullet }(e);U)-\delta _{3}(t_{\bullet }(e);U)}{\tau _{1}(e)}}$
More generally, if node based function $f$ denotes a multi-volume, then the edge based function $g(e)={\frac {f(t^{\bullet }(e))-f(t_{\bullet }(e))}{\tau _{1}(e)}}$ is the inwards oriented multi-surface boundary of $f$. One required property of the inwards oriented multi-surface boundary is that it must obey linearity: meaning that if multi-volumes $f_{1}$ and $f_{2}$ have inwards oriented multi-surface boundaries $g_{1}$ and $g_{2}$ respectively, then the inwards oriented multi-surface boundary of $f_{1}+f_{2}$ is $g_{1}+g_{2}$. In addition, given an arbitrary coefficients $c_{1},c_{2}$, the inwards oriented multi-surface boundary of $c_{1}f_{1}+c_{2}f_{2}$ is $c_{1}g_{1}+c_{2}g_{2}$. The definition $g(e)={\frac {f(t^{\bullet }(e))-f(t_{\bullet }(e))}{\tau _{1}(e)}}$ satisfies this linearity condition.
Given a node based function $f$, the "gradient" of $f$ is the edge based function $\nabla f$. For all $e\in {\mathcal {E}}$, $\nabla f|_{e}={\frac {f(t^{\bullet }(e))-f(t_{\bullet }(e))}{\tau _{1}(e)}}$. The gradient denotes both the inwards oriented surface when $f$ is treated as a multi-volume, and the rate of change in $f$ along each edge $e$ in the preferred direction when $f$ is treated as a potential. Note that the gradient satisfies linearity as described above.

### Computing potential differences from the gradient

Let $n_{0},n_{1}\in {\mathcal {N}}$ be two nodes that are linked by edge $e$. Let $n_{1}$ be reached from $n_{0}$ by traversing edge $e$ in the direction specified by orientation $s\in \{+1,-1\}$.
The difference in $f$ between $n_{0}$ and $n_{1}$ is:
$f(n_{1})-f(n_{0})=\left\{{\begin{array}{cc}f(t^{\bullet }(e))-f(t_{\bullet }(e))&(s=+1)\\f(t_{\bullet }(e))-f(t^{\bullet }(e))&(s=-1)\end{array}}\right.=s(f(t^{\bullet }(e))-f(t_{\bullet }(e)))=s\tau _{1}(e){\frac {f(t^{\bullet }(e))-f(t_{\bullet }(e))}{\tau _{1}(e)}}=s\tau _{1}(e)\nabla f|_{e}$
When given an arbitrary path $P=\langle (e_{1},s_{1}),(e_{2},s_{2}),...,(e_{k},s_{k})\rangle$ that begins at node $n_{0}$ and ends at node $n_{1}$, the difference in $f$ between $n_{0}$ and $n_{1}$ can be computed by adding the differences along each edge:
$f(n_{1})-f(n_{0})=\sum _{i=1}^{k}s_{i}\tau _{1}(e_{i})\nabla f|_{e_{i}}=\int _{e\in P}\nabla f|_{e}$
The equation $\int _{e\in P}\nabla f|_{e}=f(n_{1})-f(n_{0})$ is referred to as the "gradient theorem".
The following sections will demonstrate that the gradient defined for node based functions is consistent with the gradient for scalar fields in $\mathbb {R} ^{3}$. This consistency will be shown for Cartesian, cylindrical, and spherical coordinates.

### The Gradient in Various Coordinate Systems

All of Cartesian, cylindrical, and spherical coordinate systems will be modeled using the discrete model of curvilinear coordinates. The same shorthand notation will be used.
Starting with an arbitrary scalar field $f(\Xi )$, the node based function that approximates $f$ is $f_{\text{approx}}(n_{I})=f(I\Delta \Xi )$ for all $I\in \mathbb {Z} ^{3}$.
For each $c=1,2,3$ and $I\in \mathbb {Z} ^{3}$, the gradient along edge $e_{\xi _{c},I}$ is:
$\nabla f_{\text{approx}}|_{e_{\xi _{c},I}}={\frac {f_{\text{approx}}(t^{\bullet }(e_{\xi _{c},I}))-f_{\text{approx}}(t_{\bullet }(e_{\xi _{c},I}))}{\tau _{1}(e_{\xi _{c},I})}}$ $={\frac {f_{\text{approx}}(n_{I+[1]_{c}})-f_{\text{approx}}(n_{I})}{\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|}}$ $={\frac {f(I\Delta \Xi +[\Delta \xi _{c}]_{c})-f(I\Delta \Xi )}{\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )|}}$
Given an arbitrary coordinate $\Xi$, let $I(\Xi )\in \mathbb {Z} ^{3}$ index the node $n_{I(\Xi )}$ whose position $I(\Xi )\Delta \Xi$ is "closest" to $\Xi$.
The gradient of scalar field $f$ is a vector quantity with components that are multiples of the basis vectors $\mathbf {v} _{\xi _{1}},\mathbf {v} _{\xi _{2}},\mathbf {v} _{\xi _{3}}$. The coefficient of $\mathbf {v} _{\xi _{1}}$ is the gradient of $f_{\text{approx}}$ along edges that are parallel to $\mathbf {v} _{\xi _{1}}$, and similarly for $\mathbf {v} _{\xi _{2}}$ and $\mathbf {v} _{\xi _{3}}$. The fact that $\mathbf {v} _{\xi _{1}}$, $\mathbf {v} _{\xi _{2}}$, and $\mathbf {v} _{\xi _{3}}$ are of unit length and mutually orthogonal (perpendicular) is important.
The gradient of scalar field $f$ at $\Xi$ can now be approximated by the following:
$\nabla f|_{\Xi }\approx \sum _{c=1}^{3}\nabla f_{\text{approx}}|_{e_{\xi _{c},I(\Xi )}}\mathbf {v} _{\xi _{c}}(I(\Xi )\Delta \Xi )$ $=\sum _{c=1}^{3}{\frac {f(I(\Xi )\Delta \Xi +[\Delta \xi _{c}]_{c})-f(I(\Xi )\Delta \Xi )}{\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}((I(\Xi )+[0.5]_{c})\Delta \Xi )|}}\mathbf {v} _{\xi _{c}}(I(\Xi )\Delta \Xi )$ $\approx \sum _{c=1}^{3}{\frac {f(\Xi +[\Delta \xi _{c}]_{c})-f(\Xi )}{\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(\Xi )|}}\mathbf {v} _{\xi _{c}}(\Xi )$
As $\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3}\to 0^{+}$, it becomes apparent that $\nabla f|_{\Xi }=\sum _{c=1}^{3}{\frac {1}{|\mathbf {u} _{\xi _{c}}(\Xi )|}}{\frac {\partial f}{\partial \xi _{c}}}{\bigg |}_{\Xi }\mathbf {v} _{\xi _{c}}(\Xi )$.

#### The Gradient in Cartesian Coordinates

Applying the curvilinear coordinate model to Cartesian coordinates means that $\xi _{1}=x$, $\xi _{2}=y$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{x}(x,y,z)=\mathbf {i}$, $\mathbf {u} _{y}(x,y,z)=\mathbf {j}$, and $\mathbf {u} _{z}(x,y,z)=\mathbf {k}$. Applying the formula for the gradient that was derived from the discrete model of curvilinear coordinates gives:
$\nabla f|_{(x,y,z)}={\frac {1}{1}}{\frac {\partial f}{\partial x}}{\bigg |}_{(x,y,z)}\mathbf {i} +{\frac {1}{1}}{\frac {\partial f}{\partial y}}{\bigg |}_{(x,y,z)}\mathbf {j} +{\frac {1}{1}}{\frac {\partial f}{\partial z}}{\bigg |}_{(x,y,z)}\mathbf {k}$ $={\frac {\partial f}{\partial x}}\mathbf {i} +{\frac {\partial f}{\partial y}}\mathbf {j} +{\frac {\partial f}{\partial z}}\mathbf {k}$
which is consistent with the formula for the gradient derived for continuous functions over Cartesian coordinates.

#### The Gradient in Cylindrical Coordinates

Applying the curvilinear coordinate model to cylindrical coordinates means that $\xi _{1}=\rho$, $\xi _{2}=\phi$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{\rho }(\rho ,\phi ,z)={\hat {\mathbf {\rho } }}$, $\mathbf {u} _{\phi }(\rho ,\phi ,z)=\rho {\hat {\mathbf {\phi } }}$, and $\mathbf {u} _{z}(\rho ,\phi ,z)={\hat {\mathbf {z} }}$. Applying the formula for the gradient that was derived from the discrete model of curvilinear coordinates gives:
$\nabla f|_{(\rho ,\phi ,z)}={\frac {1}{1}}{\frac {\partial f}{\partial \rho }}{\bigg |}_{(\rho ,\phi ,z)}{\hat {\mathbf {\rho } }}+{\frac {1}{\rho }}{\frac {\partial f}{\partial \phi }}{\bigg |}_{(\rho ,\phi ,z)}{\hat {\mathbf {\phi } }}+{\frac {1}{1}}{\frac {\partial f}{\partial z}}{\bigg |}_{(\rho ,\phi ,z)}{\hat {\mathbf {z} }}$ $={\frac {\partial f}{\partial \rho }}{\hat {\mathbf {\rho } }}+{\frac {1}{\rho }}{\frac {\partial f}{\partial \phi }}{\hat {\mathbf {\phi } }}+{\frac {\partial f}{\partial z}}{\hat {\mathbf {z} }}$
which is consistent with the formula for the gradient derived for continuous functions over cylindrical coordinates.

#### The Gradient in Spherical Coordinates

Applying the curvilinear coordinate model to spherical coordinates means that $\xi _{1}=r$, $\xi _{2}=\theta$, and $\xi _{3}=\phi$. It is also the case that $\mathbf {u} _{r}(r,\theta ,\phi )={\hat {\mathbf {r} }}$, $\mathbf {u} _{\theta }(r,\theta ,\phi )=r{\hat {\mathbf {\theta } }}$, and $\mathbf {u} _{\phi }(r,\theta ,\phi )=r\sin \theta {\hat {\mathbf {\phi } }}$. Applying the formula for the gradient that was derived from the discrete model of curvilinear coordinates gives:
$\nabla f|_{(r,\theta ,\phi )}={\frac {1}{1}}{\frac {\partial f}{\partial r}}{\bigg |}_{(r,\theta ,\phi )}{\hat {\mathbf {r} }}+{\frac {1}{r}}{\frac {\partial f}{\partial \theta }}{\bigg |}_{(r,\theta ,\phi )}{\hat {\mathbf {\theta } }}+{\frac {1}{r\sin \theta }}{\frac {\partial f}{\partial \phi }}{\bigg |}_{(r,\theta ,\phi )}{\hat {\mathbf {\phi } }}$ $={\frac {\partial f}{\partial r}}{\hat {\mathbf {r} }}+{\frac {1}{r}}{\frac {\partial f}{\partial \theta }}{\hat {\mathbf {\theta } }}+{\frac {1}{r\sin \theta }}{\frac {\partial f}{\partial \phi }}{\hat {\mathbf {\phi } }}$
which is consistent with the formula for the gradient derived for continuous functions over spherical coordinates.

## Discrete analog to the Divergence
### Flow generation density

If the edge based function $f:{\mathcal {E}}\to \mathbb {R}$ denotes the "flow density" across each edge, then for an arbitrary edge $e\in {\mathcal {E}}$, the total flow across $e$ in the preferred direction is $\tau _{2}(e)f(e)$. For an arbitrary node $n\in {\mathcal {N}}$, the total flow being generated at node $n$ is $\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)=n\;{\text{and}}\;t^{\bullet }(e)\neq n)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)=n\;{\text{and}}\;t_{\bullet }(e)\neq n)\\0&({\text{else}})\end{array}}\right.$. The "flow generation density" or "divergence" at node $n$ is:
$\nabla \cdot f|_{n}={\frac {1}{\tau _{3}(n)}}\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)=n\;{\text{and}}\;t^{\bullet }(e)\neq n)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)=n\;{\text{and}}\;t_{\bullet }(e)\neq n)\\0&({\text{else}})\end{array}}\right.$
Using a similar argument, given a multi-path denoted by edge based function $f:{\mathcal {E}}\to \mathbb {R}$, then for an arbitrary edge $e\in {\mathcal {E}}$, the total "path weight" that traverses $e$ in the preferred direction is $\tau _{2}(e)f(e)$ (recall that $f(e)$ is the path weight per unit thickness of $e$). The total "path weight" that is "left behind" at an arbitrary node $n\in {\mathcal {N}}$ is $\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)=n\;{\text{and}}\;t^{\bullet }(e)\neq n)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)=n\;{\text{and}}\;t_{\bullet }(e)\neq n)\\0&({\text{else}})\end{array}}\right.$. The path weight that is left behind is the starting point weight minus the ending point weight, no matter how multi-path $f$ is decomposed into a superposition of paths. The starting point weight minus the ending point weight is the "net starting point weight". By diffusing the net starting point weight over the volume of node $n$, the node based function that denotes the "net starting point" is derived. This is the divergence $\nabla \cdot f$.
It is a relatively simple matter to show that for an a simple path $P$ that starts at node $n_{0}$ and ends at node $n_{1}$, that $\nabla \cdot \delta _{1}(P)=\delta _{0}(n_{0})-\delta _{0}(n_{1})$ due to the fact that only the end points of $P$ may have a non-zero starting point weight. $\delta _{0}(n_{0})-\delta _{0}(n_{1})$ is a node based function that denotes the superposition of the starting node of $P$ with the final node of $P$ with respective weights of $+1$ and $-1$.

### The divergence theorem

Let $U\subseteq {\mathcal {N}}$ denote an arbitrary volume, and let $S=\{(e,+1)|e\in {\mathcal {E}}\;{\text{and}}\;t_{\bullet }(e)\in U\;{\text{and}}\;t^{\bullet }(e)\notin U\}\cup \{(e,-1)|e\in {\mathcal {E}}\;{\text{and}}\;t_{\bullet }(e)\notin U\;{\text{and}}\;t^{\bullet }(e)\in U\}$ denote the outwards oriented surface of $U$.
The total flow generation inside $U$ is:
$\int _{n\in U}\nabla \cdot f|_{n}=\sum _{n\in U}(\nabla \cdot f|_{n})\tau _{3}(n)$ $=\sum _{n\in U}\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)=n\;{\text{and}}\;t^{\bullet }(e)\neq n)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)=n\;{\text{and}}\;t_{\bullet }(e)\neq n)\\0&({\text{else}})\end{array}}\right.$ $=\sum _{e\in {\mathcal {E}}}\sum _{n\in U}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)=n\;{\text{and}}\;t^{\bullet }(e)\neq n)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)=n\;{\text{and}}\;t_{\bullet }(e)\neq n)\\0&({\text{else}})\end{array}}\right.$ $=\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)f(e)&(t_{\bullet }(e)\in U\;{\text{and}}\;t^{\bullet }(e)\notin U)\\-\tau _{2}(e)f(e)&(t^{\bullet }(e)\in U\;{\text{and}}\;t_{\bullet }(e)\notin U)\\0&({\text{else}})\end{array}}\right.$ $=\sum _{e\in {\mathcal {E}}}\tau _{2}(e)f(e)\left\{{\begin{array}{cc}+1&((e,+1)\in S)\\-1&((e,-1)\in S)\\0&({\text{else}})\end{array}}\right.$ $=\sum _{(e,s)\in S}sf(e)\tau _{2}(e)$ $=\int _{e\in S}f(e)$
The total flow generated inside $U$ is the total outwards flow through $S$: $\int _{n\in U}\nabla \cdot f|_{n}=\int _{e\in S}f(e)$. This is the discrete analog to Gauss's Divergence Theorem.
Interpreting $f$ as a multi-path, and $\nabla \cdot f$ as the net starting point of $f$, then Gauss's Divergence Theorem can be expressed as: $\Sigma _{\mathcal {N}}(\nabla \cdot f,\delta _{3}(U))=\Sigma _{\mathcal {E}}(f,\delta _{2}(S))$. Due to the fact that $S$ is the outwards oriented surface of $U$, it must be the case that $\delta _{2}(S)=-\nabla \delta _{3}(U)$, since $\nabla \delta _{3}(U)$ is the inwards oriented surface of $U$. This gives:
$\Sigma _{\mathcal {N}}(\nabla \cdot f,\delta _{3}(U))=\Sigma _{\mathcal {E}}(f,-\nabla \delta _{3}(U))$
Replacing $U$ with a multi-volume $g$ gives the generalization:
$\Sigma _{\mathcal {N}}(\nabla \cdot f,g)=\Sigma _{\mathcal {E}}(f,-\nabla g)$
This equation can be interpreted as follows: The total intersection of the net starting point of multi-path $f$ with multi-volume $g$ is the net intersection of $f$ with the outwards oriented surface of $g$.
It should also be noted that the equation can be reformatted to read as:
$\int _{e\in f}\nabla g|_{e}=\Sigma _{\mathcal {N}}(-\nabla \cdot f,g)$
When $f$ is a simple path $P$ that starts at node $n_{0}$ and ends at node $n_{1}$, the above equation reduces to the gradient theorem:
$\int _{e\in P}\nabla g|_{e}=g(n_{1})-g(n_{0})$
The gradient theorem and Gauss's Divergence Theorem are therefore equivalent with the general form: $\Sigma _{\mathcal {N}}(\nabla \cdot f,g)=\Sigma _{\mathcal {E}}(f,-\nabla g)$.
The following sections will demonstrate that the divergence defined for edge based functions is consistent with the divergence for vector fields in $\mathbb {R} ^{3}$. This consistency will be shown for Cartesian, cylindrical, and spherical coordinates.

### The Divergence in Various Coordinate Systems

All of Cartesian, cylindrical, and spherical coordinate systems will be modeled using the discrete model of curvilinear coordinates. The same shorthand notation will be used.
Starting with an arbitrary vector field $\mathbf {F} (\Xi )=\sum _{c=1}^{3}F_{\xi _{c}}(\Xi )\mathbf {v} _{\xi _{c}}(\Xi )$, the edge based function that approximates $\mathbf {F}$ is $F_{\text{approx}}(e_{\xi _{c},I})=F_{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )$ for all $c=1,2,3$ and $I\in \mathbb {Z} ^{3}$.
For each $I\in \mathbb {Z} ^{3}$, the divergence at node $n_{I}$ is:
$\nabla \cdot F_{\text{approx}}|_{n_{I}}={\frac {1}{\tau _{3}(n_{I})}}\sum _{e\in {\mathcal {E}}}\left\{{\begin{array}{cc}+\tau _{2}(e)F_{\text{approx}}(e)&(t_{\bullet }(e)=n_{I}\;{\text{and}}\;t^{\bullet }(e)\neq n_{I})\\-\tau _{2}(e)F_{\text{approx}}(e)&(t^{\bullet }(e)=n_{I}\;{\text{and}}\;t_{\bullet }(e)\neq n_{I})\\0&({\text{else}})\end{array}}\right.$ $={\frac {1}{\prod _{c=1}^{3}\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|}}\sum _{c=1}^{3}(\tau _{2}(e_{\xi _{c},I})F_{\text{approx}}(e_{\xi _{c},I})-\tau _{2}(e_{\xi _{c},I-[1]_{c}})F_{\text{approx}}(e_{\xi _{c},I-[1]_{c}}))$ $={\frac {1}{\prod _{c=1}^{3}\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|}}\sum _{c=1}^{3}\left((\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(I\Delta \Xi +[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(I\Delta \Xi +[0.5\Delta \xi _{c}]_{c})-(\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(I\Delta \Xi -[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(I\Delta \Xi -[0.5\Delta \xi _{c}]_{c})\right)$
Given an arbitrary coordinate $\Xi$, let $I(\Xi )\in \mathbb {Z} ^{3}$ index the node $n_{I(\Xi )}$ whose position $I(\Xi )\Delta \Xi$ is "closest" to $\Xi$.
The divergence of vector field $\mathbf {F}$ at $\Xi$ can now be approximated by the following:
$\nabla \cdot \mathbf {F} |_{\Xi }\approx \nabla \cdot F_{\text{approx}}|_{n_{I(\Xi )}}$
$={\frac {1}{\prod _{c=1}^{3}\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I(\Xi )\Delta \Xi )|}}\sum _{c=1}^{3}{\bigg(\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(I(\Xi )\Delta \Xi +[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(I(\Xi )\Delta \Xi +[0.5\Delta \xi _{c}]_{c})$ $-(\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(I(\Xi )\Delta \Xi -[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(I(\Xi )\Delta \Xi -[0.5\Delta \xi _{c}]_{c}){\bigg )}$
$\approx {\frac {1}{\prod _{c=1}^{3}\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(\Xi )|}}\sum _{c=1}^{3}\left((\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(\Xi +[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(\Xi +[0.5\Delta \xi _{c}]_{c})-(\prod _{c'\neq c}\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}(\Xi -[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(\Xi -[0.5\Delta \xi _{c}]_{c})\right)$ $={\frac {1}{\prod _{c=1}^{3}|\mathbf {u} _{\xi _{c}}(\Xi )|}}\sum _{c=1}^{3}{\frac {1}{\Delta \xi _{c}}}\left((\prod _{c'\neq c}|\mathbf {u} _{\xi _{c'}}(\Xi +[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(\Xi +[0.5\Delta \xi _{c}]_{c})-(\prod _{c'\neq c}|\mathbf {u} _{\xi _{c'}}(\Xi -[0.5\Delta \xi _{c}]_{c})|)F_{\xi _{c}}(\Xi -[0.5\Delta \xi _{c}]_{c})\right)$
As $\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3}\to 0^{+}$, it becomes apparent that $\nabla \cdot \mathbf {F} |_{\Xi }={\frac {1}{\prod _{c=1}^{3}|\mathbf {u} _{\xi _{c}}(\Xi )|}}\sum _{c=1}^{3}{\frac {\partial }{\partial \xi _{c}}}((\prod _{c'\neq c}|\mathbf {u} _{\xi _{c'}}(\Xi )|)F_{\xi _{c}}(\Xi )){\bigg |}_{\Xi }$

#### The Divergence in Cartesian Coordinates

Applying the curvilinear coordinate model to Cartesian coordinates means that $\xi _{1}=x$, $\xi _{2}=y$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{x}(x,y,z)=\mathbf {i}$, $\mathbf {u} _{y}(x,y,z)=\mathbf {j}$, and $\mathbf {u} _{z}(x,y,z)=\mathbf {k}$. Applying the formula for the divergence that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{x}\mathbf {i} +F_{y}\mathbf {j} +F_{z}\mathbf {k}$ gives:
$\nabla \cdot \mathbf {F} |_{(x,y,z)}={\frac {1}{1\cdot 1\cdot 1}}({\frac {\partial }{\partial x}}(1\cdot 1\cdot F_{x}){\bigg |}_{(x,y,z)}+{\frac {\partial }{\partial y}}(1\cdot 1\cdot F_{y}){\bigg |}_{(x,y,z)}+{\frac {\partial }{\partial z}}(1\cdot 1\cdot F_{z}){\bigg |}_{(x,y,z)})$ $={\frac {\partial F_{x}}{\partial x}}+{\frac {\partial F_{y}}{\partial y}}+{\frac {\partial F_{z}}{\partial z}}$
which is consistent with the formula for the divergence derived for continuous vector fields over Cartesian coordinates.

#### The Divergence in Cylindrical Coordinates

Applying the curvilinear coordinate model to cylindrical coordinates means that $\xi _{1}=\rho$, $\xi _{2}=\phi$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{\rho }(\rho ,\phi ,z)={\hat {\mathbf {\rho } }}$, $\mathbf {u} _{\phi }(\rho ,\phi ,z)=\rho {\hat {\mathbf {\phi } }}$, and $\mathbf {u} _{z}(\rho ,\phi ,z)={\hat {\mathbf {z} }}$. Applying the formula for the divergence that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{\rho }{\hat {\mathbf {\rho } }}+F_{\phi }{\hat {\mathbf {\phi } }}+F_{z}{\hat {\mathbf {z} }}$ gives:
$\nabla \cdot \mathbf {F} |_{(\rho ,\phi ,z)}={\frac {1}{1\cdot \rho \cdot 1}}({\frac {\partial }{\partial \rho }}(\rho \cdot 1\cdot F_{\rho }){\bigg |}_{(\rho ,\phi ,z)}+{\frac {\partial }{\partial \phi }}(1\cdot 1\cdot F_{\phi }){\bigg |}_{(\rho ,\phi ,z)}+{\frac {\partial }{\partial z}}(1\cdot \rho \cdot F_{z}){\bigg |}_{(\rho ,\phi ,z)})$ $={\frac {1}{\rho }}{\frac {\partial }{\partial \rho }}(\rho F_{\rho })+{\frac {1}{\rho }}{\frac {\partial F_{\phi }}{\partial \phi }}+{\frac {\partial F_{z}}{\partial z}}$
which is consistent with the formula for the divergence derived for continuous vector fields over cylindrical coordinates.

#### The Divergence in Spherical Coordinates

Applying the curvilinear coordinate model to spherical coordinates means that $\xi _{1}=r$, $\xi _{2}=\theta$, and $\xi _{3}=\phi$. It is also the case that $\mathbf {u} _{r}(r,\theta ,\phi )={\hat {\mathbf {r} }}$, $\mathbf {u} _{\theta }(r,\theta ,\phi )=r{\hat {\mathbf {\theta } }}$, and $\mathbf {u} _{\phi }(r,\theta ,\phi )=r\sin \theta {\hat {\mathbf {\phi } }}$. Applying the formula for the divergence that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{r}{\hat {\mathbf {r} }}+F_{\theta }{\hat {\mathbf {\theta } }}+F_{\phi }{\hat {\mathbf {\phi } }}$ gives:
$\nabla \cdot \mathbf {F} |_{(r,\theta ,\phi )}={\frac {1}{1\cdot r\cdot r\sin \theta }}({\frac {\partial }{\partial r}}(r\cdot r\sin \theta \cdot F_{r}){\bigg |}_{(r,\theta ,\phi )}+{\frac {\partial }{\partial \theta }}(1\cdot r\sin \theta \cdot F_{\theta }){\bigg |}_{(r,\theta ,\phi )}+{\frac {\partial }{\partial \phi }}(1\cdot r\cdot F_{\phi }){\bigg |}_{(r,\theta ,\phi )})$ $={\frac {1}{r^{2}}}{\frac {\partial }{\partial r}}(r^{2}F_{r})+{\frac {1}{r\sin \theta }}{\frac {\partial }{\partial \theta }}(\sin \theta \cdot F_{\theta })+{\frac {1}{r\sin \theta }}{\frac {\partial F_{\phi }}{\partial \phi }}$
which is consistent with the formula for the divergence derived for continuous vector fields over spherical coordinates.

## Discrete analog to the Curl
### Loops

Consider an arbitrary path $P=\langle (e_{1},s_{1}),(e_{2},s_{2}),\dots ,(e_{k},s_{k})\rangle$ that begins and finishes on the same node. $P$ is a closed loop, and the edge based function $\delta _{1}(e;P)$ that denotes $P$ satisfies $\nabla \cdot \delta _{1}(e;P)|_{n}=0$ for all nodes $n\in {\mathcal {N}}$. The divergence-free property of $\delta _{1}(e;P)$ arises from the fact that closed loops have no starting or ending points and leave every node that they enter.
A multi-loop is a superposition of loops, and any edge-based function that denotes a multi-loop is divergence-free. Moreover, any edge-based function that is divergence free can be expressed as a superposition of closed loops and hence denotes a multi-loop.
Given an arbitrary graph ${\mathcal {G}}$, a set of "basis" loops can be formed such that every multi-loop can be expressed as a unique linear superposition of the basis loops. A set of basis loops provides a means of expressing an arbitrary multi-loop as a list of coefficients. Each coefficient is a weight that is assigned to each basis loop. When the basis loops are multiplied by their respective weights and added together, the multi-loop that is represented by the list of coefficients is retrieved.
The set of all edge based functions is a vector space with dimension $|{\mathcal {E}}|$, and each edge based function is a vector whose entries are the list of values assigned to each edge. The set of all multi-loops is a subspace of the set of all edge based functions, and each multi-loop can be interpreted as a vector that is a linear combination of the loops from a set of basis loops.
Three approaches for generating a set ${\mathcal {B}}$ of basis loops for an arbitrary graph ${\mathcal {G}}$ will now be given:
To start, the following definitions are required:
* A path component of graph ${\mathcal {G}}$ is an "island" of ${\mathcal {G}}$ where any two nodes on the island can be linked by a continuous path, and any edge that is connected to a node in the path component is part of the same component and vice versa.
* A bridge is an edge that when removed breaks its host path component into two path components.
* An arc, also referred to as a simple path, is a path where with the exception of the start and end nodes does not visit or traverse the same node or edge more than once.
* A simple loop is a closed loop that does visit a node or edge twice on the same cycle.
* A tree is a graph where any two nodes can be linked by exactly one simple path.
* A spanning tree is a sub-graph of a path component ${\mathcal {G}}$ that is both a tree and which includes every node from ${\mathcal {G}}$.
Generating Basis Loops Approach 1:
To start, all edges that are "bridges" should be removed. After all bridges have been removed, any nodes that are not connected to any edges and are themselves path components are themselves removed. Let ${\mathcal {G}}_{1},{\mathcal {G}}_{2},...,{\mathcal {G}}_{k}$ denote the resultant path components of ${\mathcal {G}}$. Let the set of basis loops ${\mathcal {B}}$ start out empty. Let $N({\mathcal {B}})$ denote the set of nodes visited by the loops from ${\mathcal {B}}$. Let $E({\mathcal {B}})$ denote the set of edges that are traversed by loops from ${\mathcal {B}}$.
The following steps are now repeated for each path component ${\mathcal {G}}_{i}$ for each $i=1,2,...,k$:
Start by choosing an arbitrary simple loop $P$ from ${\mathcal {G}}_{i}$. Add loop $P$ to ${\mathcal {B}}$. For as long as there are nodes or edges in ${\mathcal {G}}_{i}$ that are not contained by $N({\mathcal {B}})$ or $E({\mathcal {B}})$, find an arc $P'$ that starts and ends at nodes from $N({\mathcal {B}})$. With the exception of the starting and ending nodes, arc $P'$ must not visit a node or edge from $N({\mathcal {B}})$ or $E({\mathcal {B}})$. The end nodes of $P'$ can be linked by a path through the nodes and edges from $N({\mathcal {B}})$ and $E({\mathcal {B}})$ to form a simple loop $P''$ that is then added to ${\mathcal {B}}$.
The above process forms a set ${\mathcal {B}}$ of basis loops for ${\mathcal {G}}$.
Let $H$ denote the number of path components of ${\mathcal {G}}$. As bridges and single nodes are removed from ${\mathcal {G}}$, the quantity $|{\mathcal {E}}|-|{\mathcal {N}}|+H$ remains constant. After all bridges and single nodes have been removed, path component ${\mathcal {G}}_{i}$ yields $E_{i}-N_{i}+1$ basis loops where $N_{i}$ and $E_{i}$ are the number of nodes and edges from ${\mathcal {G}}_{i}$ respectively. The total number of basis loops is therefore $|{\mathcal {E}}|-|{\mathcal {N}}|+H$. The vector space of multi-loops has $|{\mathcal {E}}|-|{\mathcal {N}}|+H$ dimensions.
Generating Basis Loops Approach 2:
Let ${\mathcal {G}}_{1},{\mathcal {G}}_{2},...,{\mathcal {G}}_{H}$ denote the path components of graph ${\mathcal {G}}$. $H$ is the number of path components of ${\mathcal {G}}$. For each $i=1,2,...,H$, let ${\mathcal {G}}_{T,i}$ denote a "spanning tree" for path component ${\mathcal {G}}_{i}$. Each edge $e$ from ${\mathcal {G}}_{i}$ that is not part of the spanning tree ${\mathcal {G}}_{T,i}$ corresponds to a basis loop. This basis loop is formed from edge $e$ and the unique arc that connects the end points of $e$ through the spanning tree ${\mathcal {G}}_{T,i}$.
For path component ${\mathcal {G}}_{i}$, let $N_{i}$ and $E_{i}$ respectively denote the number of nodes and edges from ${\mathcal {G}}_{i}$. The spanning tree ${\mathcal {G}}_{T,i}$ contains $N_{i}-1$ edges, so $E_{i}-N_{i}+1$ edges from ${\mathcal {G}}_{i}$ are not part of the spanning tree, and hence correspond to basis loops. The total number of basis loops from ${\mathcal {G}}$ is $\sum _{i=1}^{H}(E_{i}-N_{i}+1)=|{\mathcal {E}}|-|{\mathcal {N}}|+H$.
Generating Basis Loops Approach 3:
A third approach to generating a set of basis loops for graph ${\mathcal {G}}$ proceeds by identifying the loops that pass through each node. To start, the set of nodes ${\mathcal {N}}$ is ordered to form ${\mathcal {N}}=\{n_{1},n_{2},\dots ,n_{|{\mathcal {N}}|}\}$.
For each node $n_{i}$, a set of basis loops is assigned to $n_{i}$. These basis loops are confined to the nodes $\{n_{i},n_{i+1},\dots ,n_{|{\mathcal {N}}|}\}$ and are required to pass through $n_{i}$. These loops will be chosen such that no nonzero linear superposition of these loops will result in an edge based function where all edges that connect to $n_{i}$ are assigned 0.
Each edge $e\in {\mathcal {E}}$ has 2 endings: $t_{\bullet }(e)$ and $t^{\bullet }(e)$. With respect to node $n_{i}$, let $T_{i}$ denote the set of all edge endings that connect to $n_{i}$, excluding any edges that connect to nodes from $\{n_{1},n_{2},\dots ,n_{i-1}\}$. The set $T_{i}$ can now be partitioned into subsets according to the following equivalence relation: two edge endings $t_{1},t_{2}\in T_{i}$ belong to the same partition if and only if there exists a simple loop that is confined to the nodes $\{n_{i},n_{i+1},\dots ,n_{|{\mathcal {N}}|}\}$ and that visits node $n_{i}$ exactly once, arriving through $t_{1}$ or $t_{2}$ and leaving through the other ending. Let $T_{i}=U_{i,1}\cup U_{i,2}\cup \dots U_{i,k_{i}}$ denote the partitioning of $T_{i}$.
For each partition $U_{i,j}$, choose an ending $t_{i,j}\in U_{i,j}$ that will serve as the "prime ending". Each other ending $t$ from $U_{i,j}$ will correspond to a basis loop that leaves $n_{i}$ through $t$ and returns to $n_{i}$ through $t_{i,j}$, never visiting any nodes from $\{n_{1},n_{2},\dots ,n_{i-1}\}$.
For each $i=1,2,...,|{\mathcal {N}}|$ and $j=1,2,...,k_{i}$, each ending from $U_{i,j}\setminus \{t_{i,j}\}$ corresponds to exactly 1 basis loop. Each edge $e\in {\mathcal {E}}$ will contribute at most 1 ending to the total set $S=\bigcup _{i=1}^{|{\mathcal {N}}|}\bigcup _{j=1}^{k_{i}}(U_{i,j}\setminus \{t_{i,j}\})$, including edges that start and end on the same node. To count the number of basis loops, it is necessary to count the number $F$ of edges that do not contribute any endings to $S$. These edges are the edges that contain a "prime ending" $t_{i,j}$ and do not begin and end on the same node.
To determine $F$, let ${\mathcal {G}}_{i}$ denote graph ${\mathcal {G}}$ where the nodes $\{n_{1},n_{2},\dots ,n_{i-1}\}$ and any connected edges have been removed. $H_{i}$ will denote the number of path components of ${\mathcal {G}}_{i}$. $H_{1}=H$ where $H$ is the number of path components of ${\mathcal {G}}$, and $H_{|{\mathcal {N}}|}=1$. Start with ${\mathcal {G}}_{i+1}$ and reintroduce node $n_{i}$ and any connected edges to restore ${\mathcal {G}}_{i}$. Introducing $n_{i}$ creates a new path component. Connecting $n_{i}$ to a disconnected path component via an edge will reduce the number of path components by 1, but will also create an edge that contains a prime ending. Connecting $n_{i}$ to an already connected path component via an edge will not change the number of path components, nor create an edge with a prime ending. The number of prime endings that are connected to node $n_{i}$ not counting edges that start and end on $n_{i}$ is $H_{i+1}-H_{i}+1$ (the +1 compensates for the path component that $n_{i}$ introduces by default).
$F=\sum _{i=1}^{|{\mathcal {N}}|-1}(H_{i+1}-H_{i}+1)=(H_{|{\mathcal {N}}|}-H_{1})+(|{\mathcal {N}}|-1)=(1-H)+(|{\mathcal {N}}|-1)=|{\mathcal {N}}|-H$
so the number of basis loops is $|{\mathcal {E}}|-F=|{\mathcal {E}}|-|{\mathcal {N}}|+H$ which is in agreement with the other approaches.

### Surfaces

Consider an arbitrary surface $S=\{(e_{1},s_{1}),(e_{2},s_{2}),...,(e_{k},s_{k})\}$. Surface $S$ is "closed" if it has the following property: any path $P$ that is also closed must cross surface $S$ in the preferred direction and against the preferred direction an equal number of times. In mathematical terms, this means that given any closed path $P$ that $\Sigma _{\mathcal {E}}(P,S)=\int _{e\in P}\delta _{2}(e;S)=\int _{e\in S}\delta _{1}(e;P)=\sum _{e\in {\mathcal {E}}}\delta _{1}(e;P)\delta _{2}(e;S)\tau _{2}(e)\tau _{1}(e)=0$.
An edge based function $f$ is "conservative" if any path integral of $f$ along an arbitrary closed path $P$ is 0: $\int _{e\in P}f(e)=0$. In a similar manner to how any divergence free edge based function denotes a multi-loop, any conservative edge based function denotes a "multi-closed surface", which is the superposition of any number of closed surfaces.
A surface that is not closed is said to have a "boundary". Non-closed surfaces that share a common boundary can be grouped into "equivalence classes" and treated as though they are identical. It is relatively simple to observe that if surfaces $S_{1}$ and $S_{2}$ share a common boundary then the surface denoted by the edge based function $\delta _{2}(e;S_{1})-\delta _{2}(e;S_{2})$ is a closed surface since surfaces $S_{1}$ and $-S_{2}$ form the two halves of a "clam shell" that when added form a closed surface ($-S_{2}$ is $S_{2}$ with the orientation reversed). The edge based function $\delta _{2}(e;S_{1})-\delta _{2}(e;S_{2})$ is therefore conservative. The difference between edge based functions that denote multi-surfaces with a common boundary denotes a multi-closed surface, and is hence conservative. If edge based function $f$ denotes an arbitrary multi-surface, then when given any conservative edge based function $g$, the edge based function $f+g$ denotes a multi-surface with the same boundary as $f$.
Given an arbitrary edge based function $f$ that denotes a multi-surface, $\partial f$ will denote the boundary of $f$, and ${\mathfrak {B}}[f]$ will denote the set of all edge based functions that have the same boundary as $f$. For any edge based function $g$, $\partial g=\partial f$ if and only if $g\in {\mathfrak {B}}[f]$. Moreover, $\partial g=\partial f$ if and only if $g-f$ is conservative.
Multi-surfaces, and their corresponding edge based functions, that all share a common boundary will be grouped into a single "equivalence class" and treated as if they are identical. An edge based function $f$ "represents" its equivalence class ${\mathfrak {B}}[f]$. An equivalence class ${\mathfrak {B}}$ effectively denotes the common boundary shared by all surfaces $f\in {\mathfrak {B}}$, and will be referred to as a "boundary".
The property of an edge based function being conservative is linear, which means that given conservative edge based functions $f$ and $g$ and coefficients $c$ and $d$, it will be the case that the linear superposition $cf+dg$ is also conservative. The linearity of being conservative implies that: given edge based functions $f_{1},f_{2}$ and $g_{1},g_{2}$ where $\partial f_{1}=\partial f_{2}$ and $\partial g_{1}=\partial g_{2}$, then $\partial (cf_{1}+dg_{1})=\partial (cf_{2}+dg_{2})$ for any coefficients $c,d$. The previous property implies that the linear superposition of boundaries ${\mathfrak {B}}_{1}$ and ${\mathfrak {B}}_{2}$ can be performed unambiguously by choosing "representative" surfaces $f\in {\mathfrak {B}}_{1}$ and $g\in {\mathfrak {B}}_{2}$ and generating a surface $cf+dg$ that represents the linear superposition $c{\mathfrak {B}}_{1}+d{\mathfrak {B}}_{2}$.
The set of all conservative edge based functions (the set of all closed surfaces) is a vector space, and the set of all equivalence classes/boundaries is a vector space.
A set of basis closed surfaces can be generated by the following simple process: Let ${\mathcal {G}}_{1},{\mathcal {G}}_{2},...,{\mathcal {G}}_{H}$ denote the path components of ${\mathcal {G}}$. For each $i=1,2,...,H$, a set of basis closed surfaces for path component ${\mathcal {G}}_{i}$ can be produced by wrapping each node except for 1 in a basis surface as shown below. Any "bubble" can be generated by adding the bubbles that individually wrap each node inside the bubble. A surface that only wraps the remaining node can be generated by adding all of the bubbles that wrap the other nodes in the path component, and then reversing the orientation. The number of basis closed surfaces is $N_{i}-1$ where $N_{i}$ is the number of nodes from path component ${\mathcal {G}}_{i}$. The total number of basis closed surfaces for graph ${\mathcal {G}}$ is $\sum _{i=1}^{H}(N_{i}-1)=|{\mathcal {N}}|-H$.
A set of basis equivalence classes/boundaries can be generated by the following simple process: Let ${\mathcal {G}}_{1},{\mathcal {G}}_{2},...,{\mathcal {G}}_{H}$ denote the path components of ${\mathcal {G}}$. For each $i=1,2,...,H$, let ${\mathcal {G}}_{T,i}$ denote a "spanning tree" for path component ${\mathcal {G}}_{i}$. Each edge $e$ from ${\mathcal {G}}_{i}$ that is not part of the spanning tree ${\mathcal {G}}_{T,i}$ corresponds to a basis equivalence class which consists of all edge based functions that can be formed by adding a conservative edge based function to the edge based function that is $1$ only at edge $e$ and $0$ for all other edges. The number of basis equivalence classes for path component ${\mathcal {G}}_{i}$ is $E_{i}-(N_{i}-1)$ where $N_{i}$ and $E_{i}$ are the number of nodes and edges from path component ${\mathcal {G}}_{i}$ respectively. $N_{i}-1$ is the number of edges from spanning tree ${\mathcal {G}}_{T,i}$. The total number of basis equivalence classes is $\sum _{i=1}^{H}(E_{i}-N_{i}+1)=|{\mathcal {E}}|-|{\mathcal {N}}|+H$. This is the same as the number of basis closed loops.
The fact that the previously mentioned set of basis of equivalence classes is in fact a basis, which means that every equivalence class is a unique linear superposition of the basis equivalence classes, can be confirmed by the following observations: Let $f$ be an arbitrary edge based function. A conservative edge based function $g$ can be created by letting $g=f$ for all edges that are in the spanning trees, and choosing values for $g$ at the edges that are not in the spanning trees such that $g$ is conservative. The difference $f-g$ is 0 for all edges in the spanning trees. The coefficients for each basis equivalence class are the values that $f-g$ attains at each non spanning tree edge. Moreover, any non-zero choice of coefficients for the basis equivalence classes will always create a non-conservative edge based function.
In the images below, the left image shows a set of basis closed surfaces, the middle image shows a set of basis non-closed surfaces, and the right image shows how any edge based function/surface (shown in blue) is the linear combination of basis non-closed surfaces plus a closed surface (shown in black).
* A set of basis closed surfaces for the shown graph. Any closed surface is a linear combination of the basis surfaces. A surface that wraps the bottom right node can be formed by adding all of the shown basis surfaces, and then reversing the orientation.
* A set of basis open surfaces for the shown graph. The edges in the spanning tree do not correspond to any basis surface. Any surface is a unique linear combination of the shown open surfaces plus a closed surface.
* A non-closed surface, shown in blue, is the linear superposition of basis non-closed surfaces and a closed surface. Observe how the blue arrows on the edges are the sum of the black arrows (opposites cancel out).

### Loop-Surface Duality

The number of dimensions of the set of multi-loops is $|{\mathcal {E}}|-|{\mathcal {N}}|+H$. The number of dimensions of the set of surface equivalence classes is also $|{\mathcal {E}}|-|{\mathcal {N}}|+H$. This equivalence implies that it is possible to form a bijective (one to one and onto) linear mapping between the set of multi-loops and surface equivalence classes. In simpler terms, any multi-loop corresponds to a unique equivalence class of surfaces, and any equivalence class of surfaces corresponds to a unique multi-loop. The correspondence is linear, which means that given multi-loops $f_{1}$ and $f_{2}$ which respectively correspond to equivalence classes ${\mathfrak {B}}_{1}$ and ${\mathfrak {B}}_{2}$, and coefficients $c$ and $d$, then multi-loop $cf_{1}+df_{2}$ corresponds to equivalence class $c{\mathfrak {B}}_{1}+d{\mathfrak {B}}_{2}$.
Previously, when given a multi-surface denoted by edge based function $g$, the boundary of $g$ was a hypothetical boundary assumed to be shared by all edge based functions whose difference with $g$ was a conservative edge based function. The boundary $\partial g$ is now an edge based function that denotes the "counter-clockwise oriented boundary of $g$". Since the boundary of any surface is a loop, it will be required that $\partial g$ is a multi-loop: $\nabla \cdot (\partial g)=0$. Mapping each surface to its boundary should also be linear: given surfaces $g_{1},g_{2}$ and coefficients $c,d$, then $\partial (cg_{1}+dg_{2})=c\partial g_{1}+d\partial g_{2}$.
The bijective linear mapping between the set of multi-loops and surface equivalence classes maps each multi-loop $f$ to the equivalence class of surfaces which have $f$ as their common boundary.
Given path $P=\langle (e_{P,1},s_{P,1}),(e_{P,2},s_{P,2}),...,(e_{P,k_{P}},s_{P,k_{P}})\rangle$ and surface $S=\{(e_{S,1},s_{S,1}),(e_{S,2},s_{S,2}),...,(e_{S,k_{S}},s_{S,k_{S}})\}$, the net number of times that path $P$ intersects surface $S$ in the preferred direction is $\Sigma _{\mathcal {E}}(P,S)=\sum _{i=1}^{k_{P}}\sum _{j=1}^{k_{S}}\left\{{\begin{array}{cc}s_{P,i}s_{S,j}&(e_{P,i}=e_{S,j})\\0&(e_{P,i}\neq e_{S,j})\\\end{array}}\right.=\sum _{e\in {\mathcal {E}}}\delta _{1}(e;P)\delta _{2}(e;S)\tau _{2}(e)\tau _{1}(e)=\int _{e\in P}\delta _{2}(e;S)=\int _{e\in S}\delta _{1}(e;P)$. This formula generalizes to edge based functions that denote multi-paths and multi-surfaces. Given edge based function $f$ that denotes a multi-path and edge based function $g$ that denotes a multi-surface, then the net number of times $f$ intersects $g$ in the preferred direction is $\Sigma _{\mathcal {E}}(f,g)=\sum _{e\in {\mathcal {E}}}f(e)g(e)\tau _{2}(e)\tau _{1}(e)=\int _{e\in f}g(e)=\int _{e\in g}f(e)$.
It is also important to note that $\Sigma _{\mathcal {E}}(f,g)$ is linear with respect to $f$ and $g$: $\Sigma _{\mathcal {E}}(cf_{1}+df_{2},g)=c\Sigma _{\mathcal {E}}(f_{1},g)+d\Sigma _{\mathcal {E}}(f_{2},g)$ and $\Sigma _{\mathcal {E}}(f,cg_{1}+dg_{2})=c\Sigma _{\mathcal {E}}(f,g_{1})+d\Sigma _{\mathcal {E}}(f,g_{2})$. It is also important to note that if $f$ is a multi-loop, and $g$ is a multi-closed surface (conservative), then $\Sigma _{\mathcal {E}}(f,g)=0$. This latter property implies that given surfaces $g_{1},g_{2}$ with a common boundary ($\partial g_{1}=\partial g_{2}$), then $\Sigma _{\mathcal {E}}(f,g_{1})=\Sigma _{\mathcal {E}}(f,g_{2})$ since $g_{2}-g_{1}$ is conservative.
One requirement of the mapping of a boundary to each surface equivalence class is that given multi-surfaces $g_{1}$ and $g_{2}$, the net number of times the counter clockwise oriented boundary $\partial g_{1}$ passes through $g_{2}$ in the preferred direction is identical to the net number of times $\partial g_{2}$ passes through $g_{1}$ in the preferred direction: $\sum _{e\in {\mathcal {E}}}(\partial g_{1})|_{e}g_{2}(e)\tau _{2}(e)\tau _{1}(e)=\Sigma _{\mathcal {E}}(\partial g_{1},g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},g_{1})=\sum _{e\in {\mathcal {E}}}(\partial g_{2})|_{e}g_{1}(e)\tau _{2}(e)\tau _{1}(e)$. See the 2nd image on the right for an example of this property.
Since $\Sigma _{\mathcal {E}}(f,g)$ is linear with respect to $f$ and $g$, and $\partial g$ is linear with respect to $g$, the condition $\Sigma _{\mathcal {E}}(\partial g_{1},g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},g_{1})$ is linear with respect to $g_{1}$ and $g_{2}$:
    $\Sigma _{\mathcal {E}}(\partial g_{1,1},g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},g_{1,1})\;{\text{and}}\;\Sigma _{\mathcal {E}}(\partial g_{1,2},g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},g_{1,2})\implies \Sigma _{\mathcal {E}}(\partial (cg_{1,1}+dg_{1,2}),g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},cg_{1,1}+dg_{1,2})$
    $\Sigma _{\mathcal {E}}(\partial g_{1},g_{2,1})=\Sigma _{\mathcal {E}}(\partial g_{2,1},g_{1})\;{\text{and}}\;\Sigma _{\mathcal {E}}(\partial g_{1},g_{2,2})=\Sigma _{\mathcal {E}}(\partial g_{2,2},g_{1})\implies \Sigma _{\mathcal {E}}(\partial g_{1},cg_{2,1}+dg_{2,2})=\Sigma _{\mathcal {E}}(\partial (cg_{2,1}+dg_{2,2}),g_{1})$
Since the condition $\Sigma _{\mathcal {E}}(\partial g_{1},g_{2})=\Sigma _{\mathcal {E}}(\partial g_{2},g_{1})$ is linear, mapping each multi-loop to the surface equivalence class that have the multi-loop as their common boundary is done by determining a set of basis multi-loops $\{f_{1},f_{2},...,f_{|{\mathcal {E}}|-|{\mathcal {N}}|+H}\}$ and a set of basis surface equivalence classes $\{{\mathfrak {B}}[g_{1}],{\mathfrak {B}}[g_{2}],...,{\mathfrak {B}}[g_{|{\mathcal {E}}|-|{\mathcal {N}}|+H}]\}$ such that for all $i,j\in \{1,2,...,|{\mathcal {E}}|-|{\mathcal {N}}|+H\}$, it is the case that $\Sigma _{\mathcal {E}}(f_{i},g_{j})=\Sigma _{\mathcal {E}}(f_{j},g_{i})$. For each $i=1,2,...,|{\mathcal {E}}|-|{\mathcal {N}}|+H$, ${\mathfrak {B}}[g_{i}]$ corresponds to $f_{i}$ and the rest of the mapping is determined via linearity. Given an arbitrary multi-surface $g$, expressing the equivalence class ${\mathfrak {B}}[g]$ as a linear combination of basis surface equivalence classes: ${\mathfrak {B}}[g]=\sum _{i=1}^{|{\mathcal {E}}|-|{\mathcal {V}}|+H}c_{i}{\mathfrak {B}}[g_{i}]$ means that $\partial g=\sum _{i=1}^{|{\mathcal {E}}|-|{\mathcal {V}}|+H}c_{i}f_{i}$.
One such choice of basis multi-loops and basis surface equivalence classes can be determined as follows: Let ${\mathcal {G}}_{1},{\mathcal {G}}_{2},...,{\mathcal {G}}_{H}$ denote the path components of ${\mathcal {G}}$. For each $i=1,2,...,H$, let ${\mathcal {G}}_{T,i}$ denote a "spanning tree" for path component ${\mathcal {G}}_{i}$. Each edge $e$ that is not part of any spanning tree corresponds to both a basis loop and a basis surface equivalence class. The basis loop $f_{e}$ is the loop that passes through edge $e$ and the unique path through a spanning tree that links the endpoints of $e$. A surface $g_{e}$ that is part of the basis surface equivalence class is the surface that contains edge $e$ alone. It is easy to check that $\Sigma _{\mathcal {E}}(f_{e},g_{e})=1$, and when given different edges $e$ and $e'$, that $\Sigma _{\mathcal {E}}(f_{e},g_{e'})=\Sigma _{\mathcal {E}}(f_{e'},g_{e})=0$. This is only one example of a pair of a set of basis multi-loops and a set of basis surface equivalence classes (this example also does not make sense, as the prescribed boundary of each basis surface passes through the surface itself).

#### Example

This example will demonstrate the duality of loops and surfaces using an example from electrical engineering: two simple circuits that are magnetically linked to themselves and to each other.
Three images describing the scenario are shown below:
    The left image depicts a circuit diagram that denotes the circuits that are the subject of this example. Each loop consists of a voltage source in series with a resistor, and a self inductance followed by a mutual inductance. At the bottom of the image, the "magnetic circuit" is shown. The magnetic circuit carries magnetic flux instead of electric current, and helps to quantify the self and mutual inductance between the two loops of current.
    The center image depicts the orientation of the magnetic circuit relative to the electric circuit. As can be seen, the magnetic flux through the first loop is measured relative to "down", while the magnetic flux through the second loop is measured relative to "up".
    The right image depicts the directed graph that model the electric circuit. The set of nodes is ${\mathcal {N}}=\{n_{1},n_{2},n_{3},n_{4},n_{5},n_{6}\}$ and the set of edges is ${\mathcal {E}}=\{e_{1},e_{2},e_{3},e_{4},e_{5},e_{6},e_{7}\}$.
       The origin and terminal nodes of each edge are: $(t_{\bullet }(e_{1}),t^{\bullet }(e_{1}))=(n_{1},n_{2})$; $(t_{\bullet }(e_{2}),t^{\bullet }(e_{2}))=(n_{2},n_{1})$; $(t_{\bullet }(e_{3}),t^{\bullet }(e_{3}))=(n_{3},n_{4})$; $(t_{\bullet }(e_{4}),t^{\bullet }(e_{4}))=(n_{4},n_{3})$; $(t_{\bullet }(e_{5}),t^{\bullet }(e_{5}))=(n_{5},n_{6})$; $(t_{\bullet }(e_{6}),t^{\bullet }(e_{6}))=(n_{6},n_{5})$; and $(t_{\bullet }(e_{7}),t^{\bullet }(e_{7}))=(n_{6},n_{5})$.
       There are 4 basis loops: $P_{1}=\langle (e_{1},+1),(e_{2},+1)\rangle$; $P_{2}=\langle (e_{3},+1),(e_{4},+1)\rangle$; $P_{3}=\langle (e_{5},+1),(e_{7},+1)\rangle$; and $P_{4}=\langle (e_{7},-1),(e_{6},+1)\rangle$. These loops are the respective counterclockwise boundaries of the following 4 surfaces: $S_{1}=\{(e_{5},+1)\}$; $S_{2}=\{(e_{6},+1)\}$; $S_{3}=\{(e_{2},+1)\}$; and $S_{4}=\{(e_{4},+1)\}$. It can be determined that the paths intersect the surfaces the following numbers of times:
| $\Sigma _{\mathcal {E}}(P_{1},S_{1})=0$ | $\Sigma _{\mathcal {E}}(P_{1},S_{2})=0$ | $\Sigma _{\mathcal {E}}(P_{1},S_{3})=1$ | $\Sigma _{\mathcal {E}}(P_{1},S_{4})=0$ |
| $\Sigma _{\mathcal {E}}(P_{2},S_{1})=0$ | $\Sigma _{\mathcal {E}}(P_{2},S_{2})=0$ | $\Sigma _{\mathcal {E}}(P_{2},S_{3})=0$ | $\Sigma _{\mathcal {E}}(P_{2},S_{4})=1$ |
| $\Sigma _{\mathcal {E}}(P_{3},S_{1})=1$ | $\Sigma _{\mathcal {E}}(P_{3},S_{2})=0$ | $\Sigma _{\mathcal {E}}(P_{3},S_{3})=0$ | $\Sigma _{\mathcal {E}}(P_{3},S_{4})=0$ |
| $\Sigma _{\mathcal {E}}(P_{4},S_{1})=0$ | $\Sigma _{\mathcal {E}}(P_{4},S_{2})=1$ | $\Sigma _{\mathcal {E}}(P_{4},S_{3})=0$ | $\Sigma _{\mathcal {E}}(P_{4},S_{4})=0$ |
Note that the above table is symmetric along its diagonal.
| An electric and magnetic circuit that will be subject of this example. | The magnetic circuit is upright relative to the electric circuit. "Up" in the magnetic circuit protrudes from the page in the electric circuit. | A directed graph that will be used to model the electric and magnetic circuits, along with chosen basis loops and their corresponding surfaces. |
The goal will be to derive expressions for the self inductances $L_{1},L_{2}$, and the mutual inductance $M_{1,2}$.
An edge based function $B$ will denote the magnetic field density at each edge in the edge's preferred orientation.
A total current of $I_{1}$ flows around loop $P_{1}$. This current flows outwards through surface $S_{3}$, so due to Ampere's law, the total path integral of $B$ around $P_{3}$ is $\int _{e\in P_{3}}B(e)=\mu _{0}I_{1}$ ($\mu _{0}=4\pi \times 10^{-7}{\text{Tm/A}}$ is the magnetic permeability of free space). Therefore: $\tau _{1}(e_{5})B(e_{5})+\tau _{1}(e_{7})B(e_{7})=\mu _{0}I_{1}$
A total current of $I_{2}$ flows around loop $P_{2}$. This current flows outwards through surface $S_{4}$, so due to Ampere's law, the total path integral of $B$ around $P_{4}$ is $\int _{e\in P_{4}}B(e)=\mu _{0}I_{2}$. Therefore: $\tau _{1}(e_{6})B(e_{6})-\tau _{1}(e_{7})B(e_{7})=\mu _{0}I_{2}$
The divergence of the magnetic field at any node is 0: $\nabla \cdot B=0$. Therefore: $\tau _{2}(e_{5})B(e_{5})-\tau _{2}(e_{6})B(e_{6})-\tau _{2}(e_{7})B(e_{7})=0$
The following equations describe the magnetic field which is present in the magnetic circuit:
$\tau _{1}(e_{5})B(e_{5})+\tau _{1}(e_{7})B(e_{7})=\mu _{0}I_{1}$
$\tau _{1}(e_{6})B(e_{6})-\tau _{1}(e_{7})B(e_{7})=\mu _{0}I_{2}$
$\tau _{2}(e_{5})B(e_{5})-\tau _{2}(e_{6})B(e_{6})-\tau _{2}(e_{7})B(e_{7})=0$
Solving the above equations yields:
$B(e_{5})=\mu _{0}{\frac {(\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{6})\tau _{2}(e_{7}))I_{1}+\tau _{2}(e_{6})\tau _{1}(e_{7})I_{2}}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$
$B(e_{6})=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{1}(e_{7})I_{1}+(\tau _{2}(e_{5})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{7}))I_{2}}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$
$B(e_{7})=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{1}(e_{6})I_{1}-\tau _{1}(e_{5})\tau _{2}(e_{6})I_{2}}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$
The magnetic flux through the first loop (surface $S_{1}$) is:
$\Phi _{1}=\tau _{2}(e_{5})B(e_{5})=\mu _{0}{\frac {(\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7}))I_{1}+\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})I_{2}}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$
The magnetic flux through the second loop (surface $S_{2}$) is:
$\Phi _{2}=\tau _{2}(e_{6})B(e_{6})=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})I_{1}+(\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{2}(e_{7}))I_{2}}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$
This means that the self inductances of the first and second loop are respectively:
$L_{1}=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$ (the coefficient of $I_{1}$ in the expression for $\Phi _{1}$)
and
$L_{2}=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{2}(e_{7})}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$ (the coefficient of $I_{2}$ in the expression for $\Phi _{2}$)
The mutual inductance is:
$M_{1,2}=\mu _{0}{\frac {\tau _{2}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})}{\tau _{2}(e_{5})\tau _{1}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{2}(e_{6})\tau _{1}(e_{7})+\tau _{1}(e_{5})\tau _{1}(e_{6})\tau _{2}(e_{7})}}$ (the coefficient of $I_{2}$ in the expression for $\Phi _{1}$, or the coefficient of $I_{1}$ in the expression for $\Phi _{2}$)

### The Curl
#### Circulation Density

Given an arbitrary edge based rate-of-gain function $f$, and an arbitrary multi-loop $P$ ($\nabla \cdot P|_{n}=0$), the "circulation" of $f$ around $P$ is $\int _{e\in P}f(e)=\sum _{e\in {\mathcal {E}}}f(e)P(e)\tau _{2}(e)\tau _{1}(e)$. With $f$ fixed, the circulation is a linear function of $P$: $\int _{e\in cP_{1}+dP_{2}}f(e)=c\int _{e\in P_{1}}f(e)+d\int _{e\in P_{2}}f(e)$.
As seen in the images to the right, a large loop can be decomposed into a sum of smaller loops, and since the circulation is linear with respect to the loop that is being followed, the total circulation around the large loop is simply the sum of the circulations around the little loops.
Each edge $e\in {\mathcal {E}}$ is its own little surface: $\{(e,+1)\}$, and any surface is a linear combination of these basis surfaces. Any surface $S$ can be expressed as the following linear combination: $\forall e\in {\mathcal {E}}:S(e)=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')\delta _{2}(e;\{(e',+1)\})$. The length term $\tau _{1}(e')$ cancels out the factor of ${\frac {1}{\tau _{1}(e')}}$ in $\delta _{2}(e;\{(e',+1)\})$. If the circulation of $f$ around the counter clockwise boundary of each basis surface $\{(e',+1)\}$ is computed, then the total circulation around the counter clockwise boundary of $S$ can be computed via the same linear combination:
$\int _{e\in \partial S}f(e)=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')\int _{e\in \partial (\{(e',+1)\})}f(e)$
The circulation per unit area of surface $\{(e',+1)\}$ is ${\frac {1}{\tau _{2}(e')}}\int _{e\in \partial (\{(e',+1)\})}f(e)$. This "circulation density" at edge $e'$ will be referred to as the "curl" and denoted by the edge based function $\nabla \times f|_{e'}={\frac {1}{\tau _{2}(e')}}\int _{e\in \partial (\{(e',+1)\})}f(e)$.
The total circulation around the counter clockwise boundary of $S$ is $\int _{e\in \partial S}f(e)=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')\int _{e\in \partial (\{(e',+1)\})}f(e)=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')\tau _{2}(e')(\nabla \times f|_{e'})=\int _{e\in S}\nabla \times f|_{e}$. This is the discrete analog to Stokes' Theorem.

#### Computing the counter-clockwise boundary of a surface

Let $S$ be an arbitrary multi-surface. Since $S$ can be expressed as the linear combination $\forall e\in {\mathcal {E}}:S(e)=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')\delta _{2}(e;\{(e',+1)\})$, the counterclockwise boundary $\partial S$ is the linear combination of boundaries: $\forall e\in {\mathcal {E}}:\partial S|_{e}=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')(\partial (\{(e',+1)\})|_{e})$.
Given arbitrary edges $e_{1},e_{2}\in {\mathcal {E}}$, it is the case that $\Sigma _{\mathcal {E}}(\partial (\{(e_{1},+1)\}),\{(e_{2},+1)\})=\Sigma _{\mathcal {E}}(\partial (\{(e_{2},+1)\}),\{(e_{1},+1)\})$ due to the requirement placed on the boundaries of surfaces. This restriction can also be expressed as: $\partial (\{(e_{1},+1)\})|_{e_{2}}\tau _{2}(e_{2})=\partial (\{(e_{2},+1)\})|_{e_{1}}\tau _{2}(e_{1})$.
The linear combination that describes $\partial S$ becomes:
$\forall e\in {\mathcal {E}}:\partial S|_{e}=\sum _{e'\in {\mathcal {E}}}S(e')\tau _{1}(e')(\partial (\{(e',+1)\})|_{e})$ $=\sum _{e'\in {\mathcal {E}}}S(e'){\frac {\tau _{1}(e')}{\tau _{2}(e)}}(\partial (\{(e',+1)\})|_{e}\tau _{2}(e))$ $=\sum _{e'\in {\mathcal {E}}}S(e'){\frac {\tau _{1}(e')}{\tau _{2}(e)}}(\partial (\{(e,+1)\})|_{e'}\tau _{2}(e'))$ $={\frac {1}{\tau _{2}(e)}}\sum _{e'\in {\mathcal {E}}}S(e')\partial (\{(e,+1)\})|_{e'}\tau _{1}(e')\tau _{2}(e')$ $={\frac {1}{\tau _{2}(e)}}\Sigma _{\mathcal {E}}(\partial (\{(e,+1)\}),S)$ $={\frac {1}{\tau _{2}(e)}}\int _{e'\in \partial (\{(e,+1)\})}S(e')$ $=\nabla \times S|_{e}$
The counterclockwise boundary of multi-surface $S$ is therefore the curl: $\nabla \times S$.
Stoke's theorem becomes:
$\int _{e\in \nabla \times S}f(e)=\int _{e\in S}(\nabla \times f)|_{e}$ which is equivalent to: $\Sigma _{\mathcal {E}}(\nabla \times S,f)=\Sigma _{\mathcal {E}}(\nabla \times f,S)$ which is an exact rephrasing of the condition $\Sigma _{\mathcal {E}}(\partial S,f)=\Sigma _{\mathcal {E}}(\partial f,S)$.

### The Curl in Various Coordinate Systems

All of Cartesian, cylindrical, and spherical coordinate systems will be modeled using the discrete model of curvilinear coordinates. The same shorthand notation will be used. However, the graph will be modified as follows:
Similar to the notation from the discrete model of curvilinear coordinates, the following notation will be used:
* Given any $c\in \{1,2,3\}$, $c+1=\left\{{\begin{array}{cc}c+1&(c\in \{1,2\})\\c-2&(c=3)\end{array}}\right.$ and $c+2=\left\{{\begin{array}{cc}c+2&(c=1)\\c-1&(c\in \{2,3\})\end{array}}\right.$
* Given any number $k\in \mathbb {R}$, then $\mathbb {Z} +k$ denotes the set of integers where $k$ has been added to each integer.
* Given any number $k\in \mathbb {R}$, and subset $C\subseteq \{1,2,3\}$, then $[k]_{C}$ denotes the triple $[k]_{C}=\left(\left\{{\begin{array}{cc}k&(1\in C)\\0&(1\notin C)\end{array}}\right.,\left\{{\begin{array}{cc}k&(2\in C)\\0&(2\notin C)\end{array}}\right.,\left\{{\begin{array}{cc}k&(3\in C)\\0&(3\notin C)\end{array}}\right.\right)$
* Given any two triples of numbers $(x_{1},x_{2},x_{3}),(y_{1},y_{2},y_{3})\in \mathbb {R} ^{3}$, then $(x_{1},x_{2},x_{3})+(y_{1},y_{2},y_{3})=(x_{1}+y_{1},x_{2}+y_{2},x_{3}+y_{3})$
* Given any two triples of numbers $(x_{1},x_{2},x_{3}),(y_{1},y_{2},y_{3})\in \mathbb {R} ^{3}$, then $(x_{1},x_{2},x_{3})(y_{1},y_{2},y_{3})=(x_{1}y_{1},x_{2}y_{2},x_{3}y_{3})$
After choosing a resolution for each coordinate: $\Delta \Xi =(\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3})$, the graph ${\mathcal {G}}=\langle {\mathcal {N}},{\mathcal {E}}\rangle$ has the following nodes and edges:
* For each $I\in \mathbb {Z} ^{3}\cup (\mathbb {Z} +0.5)^{3}$, there exists a node $n_{I}\in {\mathcal {N}}$ at position $\omega _{0}(n_{I})=\omega _{0}(I\Delta \Xi )$. The volume of $n_{I}$ is $\tau _{3}(n_{I})=\prod _{c=1}^{3}(\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}(I\Delta \Xi )|)$.
* For each $c=1,2,3$ and $I\in \mathbb {Z} ^{3}\cup (\mathbb {Z} +0.5)^{3}$, there exists an edge $e_{\xi _{c},I}\in {\mathcal {E}}$ such that $t_{\bullet }(e_{\xi _{c},I})=n_{I}$ and $t^{\bullet }(e_{\xi _{c},I})=n_{I+[1]_{c}}$. The length of $e_{\xi _{c},I}$ is $\tau _{1}(e_{\xi _{c},I})=\Delta \xi _{c}|\mathbf {u} _{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )|$. The thickness of $e_{\xi _{c},I}$ is $\tau _{2}(e_{\xi _{c},I})=\prod _{c'\neq c}(\Delta \xi _{c'}|\mathbf {u} _{\xi _{c'}}((I+[0.5]_{c})\Delta \Xi )|)$.
The graph consists of two interleaved 3D-grids, with nodes $n_{I}$ where $I\in \mathbb {Z} ^{3}$ forming one grid and nodes $n_{I}$ where $I\in (\mathbb {Z} +0.5)^{3}$ forming the other grid.
Lastly, for any edge $e_{\xi _{c},I}\in {\mathcal {E}}$, the counter-clockwise boundary of the surface $\{(e_{\xi _{c},I},+1)\}$ is the path: $\langle (e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}},+1),(e_{\xi _{c+2},I+[0.5]_{c}+[0.5]_{c+1}-[0.5]_{c+2}},+1),(e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}+[0.5]_{c+2}},-1),(e_{\xi _{c+2},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}},-1)\rangle$. This path is a square that passes through nodes $n_{I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}};n_{I+[0.5]_{c}+[0.5]_{c+1}-[0.5]_{c+2}};n_{I+[0.5]_{c}+[0.5]_{c+1}+[0.5]_{c+2}};n_{I+[0.5]_{c}-[0.5]_{c+1}+[0.5]_{c+2}}$
Given an arbitrary vector field $\mathbf {F} (\Xi )=\sum _{c=1}^{3}F_{\xi _{c}}(\Xi )\mathbf {v} _{\xi _{c}}(\Xi )$, the edge based function that approximates $\mathbf {F}$ is $F_{\text{approx}}(e_{\xi _{c},I})=F_{\xi _{c}}((I+[0.5]_{c})\Delta \Xi )$ for all $c\in \{1,2,3\}$ and $I\in \mathbb {Z} ^{3}\cup (\mathbb {Z} +0.5)^{3}$.
For each $e_{\xi _{c},I}\in {\mathcal {E}}$, the curl (circulation density/counter-clockwise boundary) of $F_{\text{approx}}$ is:
$\nabla \times F_{\text{approx}}|_{e_{\xi _{c},I}}={\frac {1}{\tau _{2}(e_{\xi _{c},I})}}\int _{e\in \partial (\{(e_{\xi _{c},I},+1)\})}F_{\text{approx}}(e)$
$={\frac {1}{\tau _{2}(e_{\xi _{c},I})}}{\bigg$ $F_{\text{approx}}(e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}})\tau _{1}(e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}})$ $+F_{\text{approx}}(e_{\xi _{c+2},I+[0.5]_{c}+[0.5]_{c+1}-[0.5]_{c+2}})\tau _{1}(e_{\xi _{c+2},I+[0.5]_{c}+[0.5]_{c+1}-[0.5]_{c+2}})$ $-F_{\text{approx}}(e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}+[0.5]_{c+2}})\tau _{1}(e_{\xi _{c+1},I+[0.5]_{c}-[0.5]_{c+1}+[0.5]_{c+2}})$ $-F_{\text{approx}}(e_{\xi _{c+2},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}})\tau _{1}(e_{\xi _{c+2},I+[0.5]_{c}-[0.5]_{c+1}-[0.5]_{c+2}}){\bigg )}$
$={\frac {1}{|\mathbf {u} _{\xi _{c+1}}((I+[0.5]_{c})\Delta \Xi )||\mathbf {u} _{\xi _{c+2}}((I+[0.5]_{c})\Delta \Xi )|\Delta \xi _{c+1}\Delta \xi _{c+2}}}{\bigg$ $F_{\xi _{c+1}}((I+[0.5]_{c})\Delta \Xi -[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}((I+[0.5]_{c})\Delta \Xi -[0.5\Delta \xi _{c+2}]_{c+2})|\Delta \xi _{c+1}$ $+F_{\xi _{c+2}}((I+[0.5]_{c})\Delta \Xi +[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}((I+[0.5]_{c})\Delta \Xi +[0.5\Delta \xi _{c+1}]_{c+1})|\Delta \xi _{c+2}$ $-F_{\xi _{c+1}}((I+[0.5]_{c})\Delta \Xi +[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}((I+[0.5]_{c})\Delta \Xi +[0.5\Delta \xi _{c+2}]_{c+2})|\Delta \xi _{c+1}$ $-F_{\xi _{c+2}}((I+[0.5]_{c})\Delta \Xi -[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}((I+[0.5]_{c})\Delta \Xi -[0.5\Delta \xi _{c+1}]_{c+1})|\Delta \xi _{c+2}$ ${\bigg )}$
Using $I\Delta \Xi$ and $(I+[0.5]_{c})\Delta \Xi$ as approximations for $\Xi$, gives:
$\nabla \times \mathbf {F} |_{\Xi }\approx \sum _{c=1}^{3}{\frac {1}{|\mathbf {u} _{\xi _{c+1}}(\Xi )||\mathbf {u} _{\xi _{c+2}}(\Xi )|\Delta \xi _{c+1}\Delta \xi _{c+2}}}{\bigg$ $F_{\xi _{c+1}}(\Xi -[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}(\Xi -[0.5\Delta \xi _{c+2}]_{c+2})|\Delta \xi _{c+1}$ $+F_{\xi _{c+2}}(\Xi +[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}(\Xi +[0.5\Delta \xi _{c+1}]_{c+1})|\Delta \xi _{c+2}$ $-F_{\xi _{c+1}}(\Xi +[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}(\Xi +[0.5\Delta \xi _{c+2}]_{c+2})|\Delta \xi _{c+1}$ $-F_{\xi _{c+2}}(\Xi -[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}(\Xi -[0.5\Delta \xi _{c+1}]_{c+1})|\Delta \xi _{c+2}$ ${\bigg )}\mathbf {v} _{\xi _{c}}(\Xi )$
$=\sum _{c=1}^{3}{\frac {1}{|\mathbf {u} _{\xi _{c+1}}(\Xi )||\mathbf {u} _{\xi _{c+2}}(\Xi )|}}{\bigg$ ${\frac {1}{\Delta \xi _{c+1}}}(F_{\xi _{c+2}}(\Xi +[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}(\Xi +[0.5\Delta \xi _{c+1}]_{c+1})|-F_{\xi _{c+2}}(\Xi -[0.5\Delta \xi _{c+1}]_{c+1})|\mathbf {u} _{\xi _{c+2}}(\Xi -[0.5\Delta \xi _{c+1}]_{c+1})|)$ $-{\frac {1}{\Delta \xi _{c+2}}}(F_{\xi _{c+1}}(\Xi +[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}(\Xi +[0.5\Delta \xi _{c+2}]_{c+2})|-F_{\xi _{c+1}}(\Xi -[0.5\Delta \xi _{c+2}]_{c+2})|\mathbf {u} _{\xi _{c+1}}(\Xi -[0.5\Delta \xi _{c+2}]_{c+2})|)$ ${\bigg )}\mathbf {v} _{\xi _{c}}(\Xi )$
As $\Delta \xi _{1},\Delta \xi _{2},\Delta \xi _{3}\to 0^{+}$, it is the case that: $\nabla \times \mathbf {F} |_{\Xi }=\sum _{c=1}^{3}{\frac {1}{|\mathbf {u} _{\xi _{c+1}}(\Xi )||\mathbf {u} _{\xi _{c+2}}(\Xi )|}}\left({\frac {\partial }{\partial \xi _{c+1}}}(F_{\xi _{c+2}}(\Xi )|\mathbf {u} _{\xi _{c+2}}(\Xi )|){\bigg |}_{\Xi }-{\frac {\partial }{\partial \xi _{c+2}}}(F_{\xi _{c+1}}(\Xi )|\mathbf {u} _{\xi _{c+1}}(\Xi )|){\bigg |}_{\Xi }\right)\mathbf {v} _{\xi _{c}}(\Xi )$

#### The Curl in Cartesian Coordinates

Applying the curvilinear coordinate model to Cartesian coordinates means that $\xi _{1}=x$, $\xi _{2}=y$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{x}(x,y,z)=\mathbf {i}$, $\mathbf {u} _{y}(x,y,z)=\mathbf {j}$, and $\mathbf {u} _{z}(x,y,z)=\mathbf {k}$. Applying the formula for the curl that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{x}\mathbf {i} +F_{y}\mathbf {j} +F_{z}\mathbf {k}$ gives:
$\nabla \times \mathbf {F} |_{(x,y,z)}={\frac {1}{1\cdot 1}}\left({\frac {\partial }{\partial y}}(1\cdot F_{z}){\bigg |}_{(x,y,z)}-{\frac {\partial }{\partial z}}(1\cdot F_{y}){\bigg |}_{(x,y,z)}\right)\mathbf {i}$ $+{\frac {1}{1\cdot 1}}\left({\frac {\partial }{\partial z}}(1\cdot F_{x}){\bigg |}_{(x,y,z)}-{\frac {\partial }{\partial x}}(1\cdot F_{z}){\bigg |}_{(x,y,z)}\right)\mathbf {j}$ $+{\frac {1}{1\cdot 1}}\left({\frac {\partial }{\partial x}}(1\cdot F_{y}){\bigg |}_{(x,y,z)}-{\frac {\partial }{\partial y}}(1\cdot F_{x}){\bigg |}_{(x,y,z)}\right)\mathbf {k}$
$=\left({\frac {\partial F_{z}}{\partial y}}-{\frac {\partial F_{y}}{\partial z}}\right)\mathbf {i} +\left({\frac {\partial F_{x}}{\partial z}}-{\frac {\partial F_{z}}{\partial x}}\right)\mathbf {j} +\left({\frac {\partial F_{y}}{\partial x}}-{\frac {\partial F_{x}}{\partial y}}\right)\mathbf {k}$

#### The Curl in Cylindrical Coordinates

Applying the curvilinear coordinate model to cylindrical coordinates means that $\xi _{1}=\rho$, $\xi _{2}=\phi$, and $\xi _{3}=z$. It is also the case that $\mathbf {u} _{\rho }(\rho ,\phi ,z)={\hat {\mathbf {\rho } }}$, $\mathbf {u} _{\phi }(\rho ,\phi ,z)=\rho {\hat {\mathbf {\phi } }}$, and $\mathbf {u} _{z}(\rho ,\phi ,z)={\hat {\mathbf {z} }}$. Applying the formula for the curl that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{\rho }{\hat {\mathbf {\rho } }}+F_{\phi }{\hat {\mathbf {\phi } }}+F_{z}{\hat {\mathbf {z} }}$ gives:
$\nabla \times \mathbf {F} |_{(\rho ,\phi ,z)}={\frac {1}{\rho \cdot 1}}\left({\frac {\partial }{\partial \phi }}(1\cdot F_{z})-{\frac {\partial }{\partial z}}(\rho \cdot F_{\phi })\right){\hat {\mathbf {\rho } }}$$+{\frac {1}{1\cdot 1}}\left({\frac {\partial }{\partial z}}(1\cdot F_{\rho })-{\frac {\partial }{\partial \rho }}(1\cdot F_{z})\right){\hat {\mathbf {\phi } }}$$+{\frac {1}{1\cdot \rho }}\left({\frac {\partial }{\partial \rho }}(\rho \cdot F_{\phi })-{\frac {\partial }{\partial \phi }}(1\cdot F_{\rho })\right){\hat {\mathbf {z} }}$
$=\left({\frac {1}{\rho }}{\frac {\partial F_{z}}{\partial \phi }}-{\frac {\partial F_{\phi }}{\partial z}}\right){\hat {\mathbf {\rho } }}+\left({\frac {\partial F_{\rho }}{\partial z}}-{\frac {\partial F_{z}}{\partial \rho }}\right){\hat {\mathbf {\phi } }}+{\frac {1}{\rho }}\left({\frac {\partial }{\partial \rho }}(\rho \cdot F_{\phi })-{\frac {\partial F_{\rho }}{\partial \phi }}\right){\hat {\mathbf {z} }}$

#### The Curl in Spherical Coordinates

Applying the curvilinear coordinate model to spherical coordinates means that $\xi _{1}=r$, $\xi _{2}=\theta$, and $\xi _{3}=\phi$. It is also the case that $\mathbf {u} _{r}(r,\theta ,\phi )={\hat {\mathbf {r} }}$, $\mathbf {u} _{\theta }(r,\theta ,\phi )=r{\hat {\mathbf {\theta } }}$, and $\mathbf {u} _{\phi }(r,\theta ,\phi )=r\sin \theta {\hat {\mathbf {\phi } }}$. Applying the formula for the curl that was derived from the discrete model of curvilinear coordinates to vector field $\mathbf {F} =F_{r}{\hat {\mathbf {r} }}+F_{\theta }{\hat {\mathbf {\theta } }}+F_{\phi }{\hat {\mathbf {\phi } }}$ gives:
$\nabla \times \mathbf {F} |_{(r,\theta ,\phi )}=$${\frac {1}{r\cdot r\sin \theta }}\left({\frac {\partial }{\partial \theta }}(r\sin \theta \cdot F_{\phi })-{\frac {\partial }{\partial \phi }}(r\cdot F_{\theta })\right){\hat {\mathbf {r} }}$$+{\frac {1}{r\sin \theta \cdot 1}}\left({\frac {\partial }{\partial \phi }}(1\cdot F_{r})-{\frac {\partial }{\partial r}}(r\sin \theta \cdot F_{\phi })\right){\hat {\mathbf {\theta } }}$$+{\frac {1}{1\cdot r}}\left({\frac {\partial }{\partial r}}(r\cdot F_{\theta })-{\frac {\partial }{\partial \theta }}(1\cdot F_{r})\right){\hat {\mathbf {\phi } }}$
$={\frac {1}{r\sin \theta }}\left({\frac {\partial }{\partial \theta }}(\sin \theta \cdot F_{\phi })-{\frac {\partial F_{\theta }}{\partial \phi }}\right){\hat {\mathbf {r} }}+{\frac {1}{r}}\left({\frac {1}{\sin \theta }}{\frac {\partial F_{r}}{\partial \phi }}-{\frac {\partial }{\partial r}}(r\cdot F_{\phi })\right){\hat {\mathbf {\theta } }}+{\frac {1}{r}}\left({\frac {\partial }{\partial r}}(r\cdot F_{\theta })-{\frac {\partial F_{r}}{\partial \theta }}\right){\hat {\mathbf {\phi } }}$