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 : \R^2 \to \R$$ and $$g : \R^2 \to \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$$.



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 \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 \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\}$$.

In summary an arbitrary directed graph $$\mathcal{G}$$ will be characterized by:
 * 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 \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$$.

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 \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 \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.

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 \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-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)$$

Model of Cartesian coordinates


The discrete model used for Cartesian coordinates will consist of an infinite 3 dimensional grid of nodes that spans $$\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 \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 \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 \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 \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 $$\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 \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 \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 $$\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 \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 \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 \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 \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 \R^3$$, then $$(x_1,x_2,x_3)(y_1,y_2,y_3) = (x_1y_1,x_2y_2,x_3y_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 \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 \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 \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 \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 \R$$. Function $$f_\text{approx}$$ is defined by $$f_\text{approx}(n_I) = f(I\Delta\Xi)$$ for each $$I \in \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 \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 \Z^3$$.

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 \R$$ is an approximation of a scalar field $$f_\text{continuous} : \bigg(\bigcup_{n \in \mathcal{N}} \omega_3(n)\bigg) \to \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_if(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 \R$$ is an approximation of a vector field $$\mathbf{F}_\text{continuous} : \bigg(\bigcup_{n \in \mathcal{N}} \omega_3(n)\bigg) \to \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 \R$$ is an approximation of a vector field $$\mathbf{F}_\text{continuous} : \bigg(\bigcup_{n \in \mathcal{N}} \omega_3(n)\bigg) \to \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$$.

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_1f_1+c_2f_2$$ is $$c_1g_1+c_2g_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 $$\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 \Z^3$$.

For each $$c = 1,2,3$$ and $$I \in \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 \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.

Flow generation density


If the edge based function $$f: \mathcal{E} \to \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 \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 \Z^3$$.

For each $$I \in \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 \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.

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).

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_if_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:

Note that the above table is symmetric along its diagonal.

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_0I_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_0I_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_0I_2$$. Therefore: $$\tau_1(e_6)B(e_6) - \tau_1(e_7)B(e_7) = \mu_0I_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_0I_1$$

$$\tau_1(e_6)B(e_6) - \tau_1(e_7)B(e_7) = \mu_0I_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$$)

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 \R$$, then $$\Z + k$$ denotes the set of integers where $$k$$ has been added to each integer.
 * Given any number $$k \in \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 \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 \R^3$$, then $$(x_1,x_2,x_3)(y_1,y_2,y_3) = (x_1y_1,x_2y_2,x_3y_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 \Z^3 \cup (\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 \Z^3 \cup (\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 \Z^3$$ forming one grid and nodes $$n_I$$ where $$I \in (\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 \Z^3 \cup (\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}}$$