{'fraction_non_alphanumeric': 0.03319442448627676, 'fraction_numerical': 0.008154907314269292, 'mean_word_length': 4.139771048744461, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Spread: a measure of the size of metric spaces

Motivated by Leinster-Cobbold measures of biodiversity, the notion of the spread of a finite metric space is introduced. This is related to Leinster's magnitude of a metric space. Spread is generalized to infinite metric spaces equipped with a measure and is calculated for spheres and straight lines. For Riemannian manifolds the spread is related to the volume and total scalar curvature. A notion of scale-dependent dimension is introduced and seen, numerically, to be close to the Hausdorff dimension for approximations to certain fractals.


Introduction
Given a finite metric space X with metric d we define the spread E 0 (X) by This is one of a family of metric space 'sizes' as we will see in Section 1 where we will also see the motivation for this definition.
This generalizes easily from finite metric spaces to arbitrary metric spaces with a measure, as will be seen in Section 3.  One of the things that we will be interested in is how this measure of size alters as the metric is scaled, so we need to define some notation. For t > 0 let tX denote the metric space X with the metric d scaled up by a factor of t, so that the distance in tX between x and x is td(x, x ). We can consider the spread profile of the space X which is just the graph of E 0 (tX) for t > 0.
An example of a profile is given in Figure 1. We consider the space tR, for t > 0, having three points, two of which are a distance t apart and are both a distance 1000t from the third point. This family of metric spaces can be thought of as having three 'regimes': where t is very small and there looks likes there is one point; where t is smallish and there looks like there are two points; and where t is very large and it looks like there are three points. This way of thinking is reflected in the values plotted. So we wish to think of the spread E 0 as akin to an 'effective number of points'.
The basic properties of spread can now be given.

Theorem 1.
For X a finite metric space with N points, the spread has the following properties: • E 0 (tX) is increasing in t; • E 0 (tX) → 1 as t → 0; • E 0 (tX) → N as t → ∞; These results all follow easily from the definition. In this paper we consider further properties of the spread which are summarized in the following synopsis.

Synopsis
In the first section we recall Leinster and Cobbold's diversity measures [4] and show how that gives rise to the spread E 0 of a metric space as the order-zero diversity of the metric space equipped with the uniform probability distribution. This means that the spread can be thought of as an analogue of the number of species in an ecosystem. We all see that there is a spread E q of order q for all 0 ≤ q ≤ ∞ and relate these to generalized means.
In the second section we compare the spread with Leinster's notion [3] of the magnitude of a metric space. We show that if the space has a positive definite 'similarity matrix' then the magnitude is an upper bound for the spread, and if the space is homogeneous then the magnitude is equal to the spread. We then go on to consider a space with no magnitude, or rather, a space whose magnitude profile is discontinuous and see that the spread profile is very similar, but much better behaved. Finally in this section we see that two spaces with the same magnitude profile can have different spread profiles.
In the third section we show that the definition of spread generalizes immediately to infinite metric spaces which are equipped with a measure. We calculate the spread of L the straight line interval of length with the usual Lebesgue measure and show that for large the spread is approximately /2 + ln 2. Then we consider the spread of compact Riemannian manifolds, giving the spread of the nsphere explicitly, and we show that asymptotically, as the manifold is scaled up, the leading order terms in the spread are determined by the volume and the total scalar curvature of the manifold.
In the final section we consider the growth rate of the spread as the metric space is scaled. This gives a scale dependent notion of 'dimension'. For instance if millions of points are formed into the shape of a square, then at small scales it will look like a point, i.e. zero dimensional, at medium scales it will look two dimensional, and at very large scales it will look like a collection of isolated points, i.e. zero dimensional, again. We look at numerical calculations for some simple approximations to fractals and see that at the medium scales the 'spread dimension' is related to the Hausdorff dimension of the fractal.

Connection to Leinster-Cobbold diversity
In this section we recall the notion of Leinster-Cobbold diversity measures and show how this gives rise to the spread of a metric space. We also see how generalized notions of spread relate to generalized means.

Definition of the diversity measure
In [4] Leinster and Cobbold defined certain 'diversity measures'. These are numbers associated to any finite set equipped with a probability distribution and a 'similarity matrix' -we will see that a metric on a finite set gives rise to a similarity matrix in a canonical way. These numbers are supposed to measure the biodiversity of a community where the points represent the different species, the similarity matrix represents the similarity between the species (a metric represents distance between the species) and the probability distribution represents the relative abundances of the species. Before defining the diversity measures we need to define the notion of a similarity matrix. If X is a finite set with N points {x 1 , . . . , x N } then a similarity matrix Z is an N × N matrix with 0 ≤ Z ij ≤ 1 and Z ii = 1. If Z ij = 0 then this represents x i and x j being completely dissimilar and if Z ij = 1 then this represents x i and x j being completely identical. A metric d on X gives rise to a similarity matrix Z by setting Z ij := exp(−d(x i , x j )), so that nearby points are considered very similar and far away points dissimilar.
Given a finite set X with N points {x 1 , . . . , x N } equipped with a probability distribution p = {p 1 , . . . , p N }, so that ∑ i p i = 1, and a similarity matrix, Z, for q ∈ [0, ∞], define the Leinster-Cobbold diversity of order q by For fixed X, p and Z, the graph of q D Z (p) against q is known as the diversity profile. As a function of q, q D Z (p) is monotonically decreasing. We also have 1 ≤ q D Z (p) ≤ N and the order q diversity can be thought of as an 'effective number of species'.
The Leinster-Cobbold diversity measures generalize a classic family of diversity measures known as the Hill numbers [1]. The Hill number of order q, q Hill(p), for q ∈ [0, ∞] is defined for a finite set X with probability distribution p on it, so it requires no metric or similarity matrix. This Hill number can be obtained as the Leinster-Cobbold diversity of the identity similarity matrix, or, equivalenty, of the 'discrete' metric where all of the points are infinitely far apart from each other; so all species are considered to be completely dissimilar. Symbolically, we have q Hill(p) = q D I (p).
The Hill numbers at the values q = 0, 1, 2, ∞ give, respectively, the following classical diversity measures: the number of species, the exponential Shannon index, the Simpson index and the reciprocal Berger-Parker diversity.
We can think of this specialization to Hill numbers as using the Leinster-Cobbold diversity measure to get measures of a finite probability space by equipping the space with a canonical metric, namely the discrete metric. On the other hand we could use the Leinster-Cobbold diversity measures to get measures of the size of a finite metric space by equipping the space with a canonical probability distribution, namely the uniform distribution. This gives rise to the spread. Symbolically, for a metric space X with N points, define the q-spread E q (X), for 0 ≤ q ≤ ∞, by Explicit formulas are given in Table 1. By the monotonically decreasing nature of the Leinster-Cobbold diversity measures we have that q ≤ q implies that E q (X) ≥ E q (X). In this paper we have generally concentrated on the greatest of the these values, E 0 (X) which we just call the spread; this is the analogue of the 'number of species' in an ecosystem.
, we have these explicit formulas and special cases of the q-spread.

Generalized means and reciprocal mean similarity
Fundamental to the definition of the Leinster-Cobbold diversity measures is the idea of generalized mean [4]. Here we give a description of the q-spread in those terms.
Suppose that X is a finite metric space with N points {x 1 , . . . , x N }, then each point x i has a reciprocal mean similarity denoted by ρ i and defined, as the name suggests, as follows: We have 1 ≤ ρ i ≤ N and think of the reciprocal mean similarity as being a measure of how different the space is from the point x i , with ρ i being nearly 1 if all the points are close to x i and nearly N if all of the points are far from x i . In order to get a measure of the whole space we can take an average of these reciprocal mean similarities. There are many different averages we could take. For a set of numbers a := {a 1 , . . . , a N } and a number and as a limit when s = 0, ±∞. This includes many standard means: µ ∞ is the maximum, µ 2 is the quadratic mean, µ 1 is the arithmetic mean, µ 0 is the geometric mean, µ −1 is the harmonic mean, and µ −∞ is the minimum. These have various nice properties, but the interesting one to note here is that if s 1 > s 2 then µ s 1 (a) ≥ µ s 2 (a) with equality if and only if all of the numbers in a are equal. For 1 q ∈ [0, ∞], the q-spread E q (X) of the metric space X is by definition the (1 − q)-mean of the individual reciprocal mean similarities: We have 1 ≤ E q (X) ≤ N with E q (X) being near to 1 if all of the points are close to each other and E q (X) being near to N if all of the points are far away from each other.

Comparison with magnitude
In this section we recall Leinster's notion of magnitude and show how it relates to the spread. We look at examples of a metric space with no magnitude and two metric spaces with the same magnitude. 1 The q-spread can also be defined for negative q, but the properties are slightly different and we do not consider that case here.

Recap on magnitude
Magnitude was introduced by Leinster in [3]. It is defined for 'most' metric spaces in the following way. For X a metric space a weighting on X consists of a weight w x ∈ R for each x ∈ X such that If a weighting exist then |X| the magnitude of X is defined to be the sum of the weights: If it exists then the magnitude is independent of any choice in the weighting. The definition of magnitude comes from enriched category theory, although it had previously appeared in the biodiversity literature [7].
For an example of a space without a magnitude see Section 2.3 below. There are large classes of spaces for which the magnitude is known to exist: one class of spaces on which it is defined is the class of 'positive definite spaces'. A positive definite finite metric space is a finite metric space for which the similarity matrix Z is positive definite. Examples of positive definite spaces include subspaces of Euclidean space. One nice property of the magnitude of positive definite spaces is the following.

The Positive Definite Subset Bound ([3, Corollary 2.4.4])
. If X is a positive definite space then |X| is well defined, furthermore if B ⊂ X then B is also positive definite and |B| ≤ |X|.
The magnitude is related to the Leinster-Cobbold diversity via the 'maximum diversity' |X| + . Before defining that we say that a space X has a nonnegative weighting if there is a weighting for X in which all of the weights are non-negative. The maximum diversity is defined to be the maximum of the magnitudes of subsets of X with a non-negative weighting: For instance, from the Positive Definite Subset Bound it follows that if X is positive definite with nonnegative weighting then |X| + = |X|. The connection with diversity is given by the following theorem.

Leinster's Maximizing Theorem ([2, Theorem 3.1]).
For X a metric space and for any q ∈ [0, ∞] the maximum value of the Leinster-Cobbold diversity of order q, over all probability distributions on X, is given by the maximum diversity: sup This explains the name. The maximum diversity is certainly in some sense much better behaved than the magnitude, however it is considerably harder to calculate in general.

Comparing spread with magnitude
We can now look at some basic comparisons.

Theorem 2.
Suppose that X is a finite metric space.
1. The spread of X is bounded-above by its maximum diversity: 2. If X is positive definite then its maximum diversity is bounded above by its magnitude, and thus so is its spread: Proof. 1. This follows from immediately Leinster's Maximizing Theorem and the interpretation of E 0 (X) as the order-zero Leinster-Cobbold diversity of X with the uniform probability distribution.
2. By definition, the maximum diversity of X is the magnitude of a subset B of X, so by the Positive Definite Subset Bound, if X is positive definite then |X| + := |B| ≤ |X|.
Note that the positive definite condition in part 2 of the above theorem cannot simply be removed as we will see in Section 2.3 that there is non-positive definite space with magnitude smaller than spread.
We can show that the spread is actually equal to the magnitude in the special case of a homogeneous metric space. Recall that a homogeneous space is a space in which the points are all indistinguishable, or, more precisely, a homogeneous metric space is a space with a transitive action by a group of isometries. Theorem 3. If X is a homogeneous finite metric space then the magnitude and the spread coincide: More generally, the magnitude is equal to the q-spread for all q ∈ [0, ∞]: E q (X) = |X|.
Proof. If X has N points, then the Speyer's Formula [5, Theorem 1] for the magnitude of a homogeneous space, we have for any x ∈ X that On the other hand, every point in X has the same mean reciprocal similarity ρ, with The q-spread E q (X) is just the (1 − q)-mean of the set of mean reciprocal similarities. But the (1 − q)-mean of N copies of ρ is just ρ, thus E q (X) = ρ = |X|, as required.
There is slightly interesting notational coincidence when Z is invertible:

A space with no magnitude
Here we look at an example, given by Leinster in [3], which has a discontinuity in its magnitude profile and look at its continuous spread profile. Consider the five-point space K 3,2 illustrated in Figure 2, equipped with the metric induced by the pictured graph, so that points on the same side are a distance 2 from each other and points on opposite sides are a distance 1 from each other. As we scale this space, considering tK 3,2 for t > 0, we see that when t = ln(2 1/2 ) this has no magnitude. However, E 0 (tK 3,2 ) is defined for all values of t > 0, and this seems to be a well-behaved version of the magnitude. This example also shows that magnitude is not always an upper bound for the spread.  It is straightforward to generate examples of metric spaces with many points on the magnitude profile not defined, for instance you can use maple to take a random graph with say 100 vertices and an expected valency of 10 at each vertex.
We summarize here some of the good properties that the spread has when compared with the magnitude.
• The spread E 0 is defined for all metric spaces.
• As an N-point space is scaled up, the spread E 0 increases from 1 to N.
• It is much easier to calculate E 0 (X) than |X|.

Trees with the same magnitude
A further class of metric spaces to consider is that of trees. Given a tree, that is a graph with no cycles, we get a metric space consisting of the set of vertices and the edge-length. We can generalize an example of Leinster [ and as A is a tree with N − 1 vertices the result follows by induction.
Let's look in particular at two extreme examples; these are pictured in Figure 3. On the one hand we have L N the linear tree with N vertices; on the other hand we have C N the corona with N vertices, that is the tree with one "central" vertex which has an edge to each of the other vertices, and there are no other edges. The corona C N can be thought of as the complete bipartite graph K 1,N−1 . Both of these N-trees give positive-definite metric spaces. By the above theorem these two spaces have the same magnitude function. However, they have various different properties. For instance, their diameters are distinct, diam(L N ) = N − 1 and diam(C N ) = 2; and tL N always has a positive weighting, whereas C N has a negative weight on the central point if N ≥ 5 (and tC 4 has a negative weight on the central point if t < ln (2)).
The spread distinguishes these spaces. An easy calculation gives the following.
It is not too hard to calculate the maximum diversity function either. As the linear tree is positive definite and has a positive weighting the maximum diversity is precisely the magnitude. The corona does not always have a positive weighting, and one finds that the central point needs to be 'switched off' when the corona is scaled down sufficiently; this gives the following maximum diversity function.
The linear tree and the corona with 10 points are compared in Figure 4. Whilst they have the same magnitude they clearly do not have the same maximum diversity nor spread: the linear tree has greater spread than the corona. The magnitude of both spaces grows essentially linearly to start with (see Section 4), which is not really the right thing for the corona. The spread (and maximum diversity) grows linearly for the linear tree and exponentially for the corona, reflecting the geometry of these spaces somewhat more.

Generalization to non-finite metric spaces
The spread of a finite metric space was defined by using the canonical uniform probability measure on the underlying finite set. The definition generalizes immediately to any metric space equipped with a finite mass measure. If (X, d) is a metric space equipped with a measure µ such that µ(X) < ∞, then we can define the spread of X by . This is really the spread with respect to the associated probability measure µ/µ(X), but the two factors of µ(X) cancel in the numerator and denominator. For E q (X) with q > 0 the total mass µ(X) makes an appearance in the definition.
We can now look at the following examples: the line interval with the Lebesgue measure; the n-sphere with its intrinsic metric and standard measure; and, asymptotically, any compact Riemannian manifold.

The closed line interval
We can quite straightforwardly calculate the spread of the length line interval L equipped with the standard Lebesgue measure.

Theorem 5. We have
and asymptotically, as → ∞, Proof. This is just a case of calculating the integral. Thus Now to consider the asymptotic behaviour as → ∞, observe arctanh(z) = 1 2 ln This result should be compared with the magnitude for the interval of length > 0 [5]: So asymptotically they have the same leading order term but different sub-leading terms.
As an aside, we can easily calculate the integral theoretic versions of E 2 and E ∞ for the interval. Again, asymptotically these have the the same leading order terms, but different sub-leading order terms. Theorem 6. For > 0 we have the following results for the length interval.
Proof. 1. This is obtained from the integral version of the order two spread: 2. This follows from the above.
3. This is obtained from the integral version of the order-infinity spread: 4. This follows from the above.

Riemannian manifolds
A Riemannian manifold is a smooth manifold equipped with a Riemannian metric, so in particular has an inner-product on each tangent space. This structure gives rise to both a metric and a measure on the manifold. The metric comes about because the Riemannian metric can be used to define a length for each rectifiable path in the manifold and the distance between two points is defined to be the infimum of the lengths of all the paths between the two points.
The measure comes about because the Riemannian metric can be used to define a volume form which leads to a density and a measure. This means that every Riemannian manifold has a well-defined spread given by the formula In the case of homogeneous Riemannian manifolds this coincides with the formula for the magnitude that was examined in [9]. In particular this tells us that the spread of S n R the n-sphere of radius R with its intrinsic metric, for n ≥ 1 is given by Moreover, the methods employed in [9] to calculate the asymptotics carry over essentially unchanged but work for all closed Riemannian manifolds and not just homogeneous ones.

Theorem 7.
If X is an n-dimensional Riemannian manifold (without boundary), with ω n denoting the volume of the unit n-ball, vol(X) denoting the volume of X and tsc(X) denoting the total scalar curvature of X then as X is scaled up the asymptotics of the spread are as follows: Proof. This is almost identical to the proof of Theorem 11 in [9] except that now the scalar curvature is not a constant and should be written as τ(x).
This simplifies in the case n = 2 as follows.
Corollary. For Σ a Riemannian surface, the spread is asymptotically given in terms of the area and the Euler characteristic by Proof. This follows from the theorem above as ω 2 = π and the Gauss-Bonnet Theorem says that tsc(Σ) = 4πχ(Σ).

Dimension and fractals
In this section we define the notion of spread dimension of a metric space which is the instantaneous growth rate of the spread of the space. This notion of dimension is scale dependent. For instance, we will see that a long, thin rectangular array of points can have spread dimension close to zero, one, or two, depending on the scale. Finally, we look at the spread dimension of some finite approximations to simple fractals and see that the spread dimension is close to the Hausdorff dimension at some scales.

Definition of spread dimension
Now that we have a notion of size of a metric space, we can look at the growth rate of this size as a measure of the 'dimension' of the space. Typically one looks at the asymptotic growth rate as a measure of dimension, but it is interesting here to look at the instantaneous growth rate. The size is very scale dependent in a non-obvious way so looking at how the growth rate varies is very interesting. For a realvalued function f defined on some subset of the reals, we can define the growth rate at t by For example, if f (t) = t n then G f (t) = n. Another way of writing this is as The instantaneous growth rate is the gradient in a log-log plot of the function. We define dim 0 (X) the instantaneous spread dimension, or just spread dimension, of a metric space X to be G f (1) where f (t) := E 0 (tX), in other words, It is then informative to look at examples of this instantaneous spread dimension as the space is scaled.
The following examples were calculated using maple on a processor with 16GB of RAM.

Rectangular grids
As a first set of examples we can look at three types of rectangular grids with equally spaced points. The spread-dimension profiles are shown in Figure 5.
Starting first with the grid of 1 × 30000 points, or, in other words, a line of 30000 points, we see that when the points are very close together the spread dimension is close to zero, reflecting the fact that the 'line' at that scale is point-like. As the line of points is scaled up, it looks more and more like a line, so when the interpoint distance is 0.01 units, meaning the length is 300 units, the spread dimension is close to one. As the line of points is scaled up further and further, so that the interpoint distance is 10 units, say, the point-like nature is apparent and the spread dimension drops to zero.
Considering the square grid of 220 × 220 points, we see that this starts off looking like a point at small scales, with the spread dimension being close to zero, then as the square grid is scaled up to about 20 units by 20 units, with an interpoint distance of about 0.1 units, it looks more like a genuine square and has an spread dimension of just under two. Then as the square grid is scaled up further, the point-like nature is apparent and the spread dimension drops to zero.
The most interesting case shown is where we consider the rectangular grid of 10 × 4900 points. Again, at small scales the spread dimension is close to zero whilst the grid looks like a small point. Then as it is scaled up there is a regime, around where the rectangle is of the order of 0.1 units by 50 units, where the space looks 'line-like' and the dimension is approximately one. As it is scaled up further to around 10 units by 500 units, the width is apparent and the spread dimension heads towards two. Finally, as it is scaled up further, the point-like nature becomes apparent and the spread dimension descends to zero.
From this we deduce that the spread E 0 is clearly measuring something geometric.

Fractals
We now look at the spread dimension of certain finite approximations to fractal sets in Euclidean space, namely to the ternary Cantor set, the Koch curve and the Sierpinski triangle. We can look at the spread dimension profile and see that at certain scales the spread dimension is roughly the Hausdorff dimension of the corresponding fractal, indicating that spread is a reasonable measure of the size of these fractals, and, indeed, of these approximations to these fractals.
In the first case we look at the ternary Cantor set. This is approximated by starting with two points a distance apart on a line. We use the two contractions of the line by a factor of a third which respectively leave the two points fixed. By applying these two contractions successively up to 10 times, starting at the initial points, we obtain 2048 points. The spread dimension at various lengths can then be computed numerically. In Figure 6 we see that at small scales the spread dimension is close to zero corresponding to the fact that the space looks like a point at those scales. Similarly, at very large scales, the space looks like a collection of distant points and the spread dimension is again zero. At intermediate scalings, roughly for 10 < < 10000 the spread dimension is roughly the Hausdorff dimension of the Cantor set, namely ln 2/ ln 3, indicating that the space looks more 'Cantor set-like' at those scales.
The top-right picture in Figure 6 is an enlargement of the Cantor set profile, and shows that things are apparently more intriguing than one might guess. At intermediate scales, the spread dimension seems to oscillate around the Hausdorff dimension, with the oscillations being of multiplicative period 3. Such small oscillations were observed for the magnitude of the Cantor set in [5]. I have no good explanation for these oscillations at the moment.
In the next case we look at the Koch curve. Again, this is approximated by starting with a couple of points and iteratively applying one of four contractions, to obtain a finite metric space contained in the Koch curve. The graph shows that as the ap-proximation is scaled up from very small, the spread dimension increases to roughly the Hausdorff dimension, ln 4/ ln 3, where it remains over a range of scales, before descending to zero as the approximating space is scaled up sufficiently so that it's discrete, point-like nature is apparent.
The final example of the Sierpinski triangle is generated in the same way using an iterated function system, and shows the same behaviour, namely, of having roughly the same spread dimension as its Hausdorff dimension at certain scales.
These examples should serve to show that there is something interesting going on which has yet to be examined fully.