# 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[edit]

The key approach to calculus is to start with a model where each variable, using as an example, takes on discrete quantities separated by small intervals of width . is a measure of the model's "coarseness" (when is increasing) or "fineness" (when is decreasing). When handling quantities at the scale of , an approximation for which the error **relative** to vanishes as becomes infinitely small, becomes exact when is treated as a continuous variable.

As an example, let be small, and restrict to the quantities . Let for any integer .

The difference approaches 0 as , but it is not accurate to approximate with 0, as the error relative to does not vanish as : in truth, as .

It is however, accurate to approximate with since the error relative to does vanish as : it is the case that as .

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 approach 0 as as opposed to the absolute error, the following example will be used:

Consider the closed interval divided into intervals: where . From each choose a representative point , and let . Let and be two functions whose first parameter is a representative point, and the second parameter is the interval width. Both and will be assumed to approach 0 as the interval width becomes infinitely small. Consider the two sums and . It will be assumed that and converge to and respectively as and .

The question of interest are circumstances under which . If other words, as the interval becomes more and more articulated into smaller and smaller intervals, what is required so that approximating with becomes exact?

If as , this is not sufficient to guarantee that . In contrast, if as , this will force . To prove this, the following derivation will be used:

For each , it is assumed that as . Therefore and hence as and . Therefore .

## Lumped space[edit]

### Directed graphs[edit]

The lumped approximation of space will require the use of a "directed graph".

A "directed graph" consists of a set of nodes/vertices and a set of directed edges. For each edge , has an origin node that is the beginning of edge , and a terminal node that is the end of edge . It will also be allowed that edges can form loops () and that multiple edges can have both the same beginning and end ( and ), though this will be irrelevant for the cases that will be considered.

An arbitrary function over the set of nodes will be referred to as a "**node based function**", and is effectively a scalar field. The notation 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: . If a node based function is denoted by a complex expression , then the evaluation of at a single node will be denoted using the pipe-subscript notation: .

An arbitrary function over the set of edges will be referred to as an "**edge based function**", and is effectively a scalar or vector field. The notation 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: . If an edge based function is denoted by a complex expression , then the evaluation of at a single edge will be denoted using the pipe-subscript notation: . 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 and the edge set is . The origin and terminal nodes of each edge are: ; ; ; ; ; and .

### Interpreting nodes and edges[edit]

Each node will correspond to both a point in space, and a volume that contains . will denote the volume of , also referred to as the volume of node . The volume of each node must be positive: for all . In the example directed graph, an example choice of volumes for each node is .

Each edge will correspond to both a curve originating from and terminating at , and a surface that separates from oriented from to .

will denote the distance from to , which will be referred to as the length of edge . The length of each edge must be positive: for all . will denote the area of projected onto a plane that is perpendicular to the displacement , which will be referred to as the cross-sectional area, thickness, or width of edge . The cross-sectional area of each edge must be positive: for all . In the example directed graph, an example choice of lengths for each edge is , and an example choice of areas for each edge is .

**In summary an arbitrary directed graph will be characterized by:
**

- the set of nodes
- the set of edges
- the start and end of each edge
- the volume of each node
- the length and area of each edge

The point and space associated with each node , and the curve and surface associated with each edge , 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[edit]

A "point" in space is quantified by a single node , which corresponds to the space point .

Point can be denoted by the node based function where for each node it is the case that . The term arises from the fact that the point is "spread out" over the volume of . The notation denotes with the parameter 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 of node/weight pairs denote a multi-point. For each : is the weight associated with node . The node based function that denotes multi-point is: . 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 and the corresponding node based function . 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 , the weights of all of the contained points are added together and the total weight is divided by to spread it out over the volume . On the right, shades of red denote positive values for , while shades of blue denote negative values for . White means that for the current node .

### Volumes and multi-volumes[edit]

The discrete analog to volumes using a directed graph is that a volume is a collection of nodes: . The combined volume region denoted by is and the total volume amount is .

Volume can be denoted by a node based membership function: where for each node , it is the case that . The notation denotes with the parameter 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 can be expressed as the following superpositions:

is the superposition of volumes with the respective weights .

is the superposition of volumes with the respective weights .

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[edit]

The discrete analog to paths using a directed graph is that a path is a series of edges and orientations: where is the edge and is an indicator that is if is traversed in the preferred direction, and is if is traversed in the opposite direction. The path must be unbroken: for each it must be that . The combined path denoted by is (path is path the orientation reversed) and the total length is .

A path can be denoted by the edge based function where for each edge , it is the case that where . The term arises from the fact that the path is "spread out" over the thickness of . The notation denotes with the parameter 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 for all , the edge based function can be expressed as the following superpositions:

is the superposition of paths , and with the respective weights .

is the superposition of paths , and with the respective weights .

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 and the corresponding edge based function . On the left a superposition of multiple paths is shown. For each surface , the total "flow" through is computed and is then divided by to spread it out over the surface . 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 , then is positive. If the green to red orientation is opposite the orientation of , then is negative.

### Surfaces and multi-surfaces[edit]

The discrete analog to oriented surfaces using a directed graph is that an oriented surface is a collection of edges and orientations: where all of the edges are distinct and is an indicator that describes the surface's orientation. Each edge is an edge that passes through the surface, and is if passes through the surface in the preferred direction, and is if passes through the surface in the opposite direction. The combined surface denoted by is (surface is surface with the orientation reversed) and the total area is .

A surface can be denoted by the edge based function where for each edge , it is the case that . The term arises from the fact that the surface is "spread out" over the length of . The notation denotes with the parameter 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 for all , the edge based function can be expressed as the following superpositions:

is the superposition of surfaces and with the respective weights .

is the superposition of surfaces and with the respective weights and .

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 and the corresponding edge based function . On the left a superposition of multiple surfaces is shown. For each curve , the net number of times edge penetrates in the preferred direction, referred to as the "gain" across , is computed and is then divided by to spread the gain out over the curve . 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 , then is positive. If the green to red orientation is opposite the orientation of , then is negative.

### Intersections[edit]

#### Multi-point multi-volume intersections[edit]

Given an arbitrary point and volume , let denote an indicator function that returns 1 if point is contained by volume and returns 0 if otherwise.

Node based function denotes the point , and node based function denotes the volume .

The indicator function can be computed via the following sum: . The term cancels out the in .

counts the number of times point occurs in volume which can only be 0 or 1 for simple points and volumes. This count can be generalized to sets of points. Let denote a collection of points. The collection of points can be denoted by the node based function . The number of points from that are contained by volume can again be computed by the sum: .

In the general case, given a node based function that denotes a multi-point, and a node based function that denotes a multi-volume, then the total weight of all the occurrences of being inside of is . The quantity is called the **net intersection** or the **total intersection weight** of with .

It should also be noted that is commutative:

#### Multi-path multi-surface intersections[edit]

Given an arbitrary path and surface , let denote the number of times path passes through surface in the preferred direction minus the number of times path passes through surface in the opposite direction. For an arbitrary , and an arbitrary , if then the link of path coincides with the segment of surface . If , then and passes through in the preferred direction. If , then and passes through in the opposite direction.

can be computed via the following sum: . The term cancels out the from , and the term cancels out the from .

In the general case, given an edge based function that denotes a multi-path, and an edge based function that denotes a multi-surface, then the total weight of all the intersections of with is . The quantity is called the **net intersection** or the **total intersection weight** of with .

It should also be noted that is commutative:

## Lumped coordinate system models[edit]

### Model of Cartesian coordinates[edit]

The discrete model used for Cartesian coordinates will consist of an infinite 3 dimensional grid of nodes that spans . To establish the model, the following is needed:

- A spacing for the x-coordinates.
- A spacing for the y-coordinates.
- A spacing for the z-coordinates.

For each triplet of integer indices , there exists a node and 3 edges , , and .

The origin and terminal nodes of are and

The origin and terminal nodes of are and

The origin and terminal nodes of are and

The Cartesian coordinate associated with node is , and the space associated with node is .

The volume of node is .

The length of edge is . The length of edge is . The length of edge is .

The area of edge is . The area of edge is . The area of edge is .

Given a scalar field over Cartesian coordinates, will be approximated by the node based function . Function is defined by for each .

Given a vector field over Cartesian coordinates, will be approximated by the edge based function . Function is defined by ; ; and .

### Model of Cylindrical coordinates[edit]

The discrete model used for Cylindrical coordinates will consist of an infinite 3 dimensional cylindrical grid of nodes that spans . To establish the model, the following is needed:

- A spacing for the coordinate .
- A large positive integer that will yield a spacing for the coordinate .
- A spacing for the coordinate .

Each node will correspond to a unique triplet of integers, and will be denoted by . The cylindrical coordinate denoted by will be .

Clearly, due to the nature of cylindrical coordinates (such as the fact that coordinate is cyclical), not every triplet will be allowed. The following three domains will be defined: , , and .

There exists a node for each .

There exists an edge for each such that and

There exists an edge for each such that and

There exists an edge for each such that and

Next, the volume of each node and the lengths and area of each edge will be calculated. To simplify notation, let for any nonnegative real number .

For each the cylindrical coordinate that corresponds to is , and the space (described using cylindrical coordinates) associated with is

For each the volume of node is

For each the length and area of edge is and respectively.

For each the length and area of edge is and respectively.

For each the length and area of edge is and respectively.

Given a scalar field over cylindrical coordinates, will be approximated by the node based function . Function is defined by for each .

Given a vector field over cylindrical coordinates, will be approximated by the edge based function . Function is defined by:

### Model of Spherical coordinates[edit]

The discrete model used for Spherical coordinates will consist of an infinite 3 dimensional spherical grid of nodes that spans . To establish the model, the following is needed:

- A spacing for the coordinate .
- A large positive integer that will yield a spacing for the coordinate .
- A large positive integer that will yield a spacing for the coordinate .

Each node will correspond to a unique triplet of integers, and will be denoted by . The spherical coordinate denoted by will be .

Clearly, due to the nature of spherical coordinates (such as the fact that coordinate is cyclical), not every triplet will be allowed. The following three domains will be defined: , , , and .

There exists a node for each .

There exists an edge for each such that and

There exists an edge for each such that and

There exists an edge for each such that and

Next, the volume of each node and the lengths and area of each edge will be calculated. To simplify notation, let for any nonnegative real number , and let for any nonnegative real number and any real number .

For each the spherical coordinate that corresponds to is , and the space (described using spherical coordinates) associated with is

For each the volume of node is

For each the length and area of edge is and respectively.

For each the length and area of edge is and respectively.

For each the length and area of edge is and respectively.

Given a scalar field over spherical coordinates, will be approximated by the node based function . Function is defined by for each .

Given a vector field over spherical coordinates, will be approximated by the edge based function . Function is defined by:

### Model of Curvilinear coordinates[edit]

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 .

To avoid unnecessary repetition, the following notation will be used:

- Given any number , and subset , then denotes the triple

- Given any two triples of numbers , then

- Given any two triples of numbers , then

- denotes an arbitrary curvilinear coordinate .

- denotes an arbitrary triplet of differences in the coordinates .

Let denote the position given by coordinate . For each , the rate of change in the position at coordinate with respect to is given by: . It will be assumed that , , and are all mutually perpendicular, which is the case for Cartesian, cylindrical, and spherical coordinates. In addition, for each , vector will also denote a unit length normalization of .

For the purposes of simplicity, it will be assumed that the coordinates 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 of nodes connected by directed edges will be established:

Start by choosing "resolutions" for each coordinate denoted by . The quantities should all be strictly positive, and ideally should be as small as possible.

- For each triplet of integer indices , a node will be created at position .

- For each and for each triplet of integer indices , there will exist edge such that and .

- For each , the volume of node is

- For each and , the length and area of edge are and respectively.

Any node for which should be deleted along with all connecting edges.

For any edge for which and , then nodes and should be fused into a single node, and edge should be discarded. For any edge for which and , then edge should be discarded. Either action may be pursued when .

Given a scalar field over the curvilinear coordinate system, will be approximated by the node based function . Function is defined by for each .

Given a vector field over the curvilinear coordinates, will be approximated by the edge based function . Function is defined by for each and for each .

## Discrete analog to Integrals[edit]

### Volume Integrals[edit]

Let denote an arbitrary volume. Given a node based function , the "volume integral" of over is (recall that is the volume of node , and is the volume of space represented by ).

If node based function is an approximation of a scalar field , where , then is an approximation of the volume integral .

Recall that can be described via the node based function . This allows the expression . If node based function denotes a multi-volume, then .

most often denotes a density function, and denotes the total "mass" contained by multi-volume . The equality means that if is interpreted as a multi-point, then the total "mass" contained by is the total intersection weight of with .

### Path Integrals[edit]

Let denote an arbitrary path. Given an edge based function , the "path integral" of along is (recall that is the length of edge , and is the curve represented by ).

If edge based function is an approximation of a vector field , where , then is an approximation of the path integral .

Recall that can be described via the edge based function . This allows the expression . If edge based function denotes a multi-path, then .

most often denotes a rate of gain function, and denotes the total "gain" caused by along multi-path . The equality means that if is interpreted as a multi-surface, then the total "gain" generated along is the total intersection weight of with .

### Surface Integrals[edit]

Let