What’s a sphere?

Geometrically, a sphere is the locus of points equidistant from a given point (which we call the ‘center’. Algebraically, it is the solution set to the equation

where d is the number of dimensions the sphere lives in, and r is some positive constant which we call the radius.

In one dimension, a 0-sphere is just two points, one on each side of the ‘center’. In two dimensions we call a 1-sphere a circle. The words sphere itself is typically reserved for a 2-sphere. Higher dimensional (d-1)-spheres are typically just referred to as hyperspheres. Why d-1? Think of a circle in two dimensions… how many dimensions does the circle actually have? You can only slide along the circle either forward or backward, hence it is one dimensional. A moment thinking about a sphere in three dimensions will get you to the same conclusion

So, whats the surface area of one of these hyperspheres? We could do some nasty area element calculation from the algebraic constrain above, but that would make everyone cry (except Russians…. Russians do not need fancy techniques when they can do something with brute force). Instead, let’s integrate an isotropic multivariate Gaussian with vanishing covariance two ways. A what now? Consider the integral:

where the covariance matrix is diagonal with equal entries (σ²). Because of the pleasant structure of the covariance, we can break this integral up into d Gaussians and integrate:

Yay! Well… not yet, stop being so excited.

To connect this to hyperspheres we’re going to change to polar coordinates. The meassure will then be over all radii and solid angles:

where we have used the definition of the Euler Gamma Function. Try doing the integral yourself! We can now equate these two results and solve for the total solid angle of a hypersphere in d dimensions, and then get the surface area of a hypersphere:

We can plot this as a function of dimension (because of our know how with the Gamma function, we can even look at fractal dimensions…):

The function maximizes at d=7.25… dimensions. That’s weird. WHAT DOES IT MEAN?!?!?!?!?

Well, the total solid angle of a space can be thought of mechanically as how much you would have to move your head around to survey everything in every direction. Clearly in 1d you just have to look ahead of you and behind you. In 2d you have to pull an Exorcist move, and spin your head 360 degrees. In 3d you have to add to that and look above and below you. As you keep increasing the number of dimensions, the amount of neck movement keeps getting worse. Until you hit 7 dimensions. Then as you increase the number of dimensions, you realize you have to move your head less and less. In fact, by the time you’re in 18 dimensions, you have to move your head less than in 1 dimension, to see everything. Higher dimensions are weird.

Ok, what about the volume of hyperspheres? That’s pretty easy. We just integrate from a radius of 0 to some final radius to get:

This too is interesting. For a fixed radius, The volume maximizes as d = 5.25… dimensions. Higher dimensional unit-spheres just don’t take up that much space. Finally we can also quickly calculate the surface area to volume ratio. This turns out to be just d/r. As expected, the larger hyperspheres get, the more volume to surface area they have.

This scaling is very important, and the main reason Life uses cells as its fundamental unit. The energy usage of a cell is proportional to its volume, whereas its energy absorption is proportional to its surface area. If this ratio of absorption to usage is greater than one, then the cell is making excess energy and can grow in size. Eventually, however, because this ratio is proportional to the surface area to volume ratio, it will become less than 1 as the radius increases, and the cell will not be able to support further growth. At this point it is more efficient to split into two cells and CELLS ARE EVERYWHERE.

Interestingly, due to the scaling with dimension, we would expect cells that evolve in universes with more spatial dimensions to be larger. Assuming energy usage and absorption don’t change in higher dimensions, we would not expect multi-cellular life to ever evolve in worlds where the number of spatial dimensions is incredibly high. Someone really should make a B-movie entitled: Attack of the Amoeba of a Billion Dimensions!!!!

# A Simple Economy

What is a fair economy?

I’ve been thinking about that a lot lately, and decided to model a simple economy to try to understand how economic transactions affect the distribution of wealth in a society. I’m not going to be addressing the big questions of policy here, I’ll simply be looking at how a mass of people exchange money to see if there are equilibrium distributions and how fair those distributions are.

First off let’s review a basic metric that tries to capture how much economic equality there is in a society, the Gini Index. Take a group of people and their individual wealth, and plot the percentage of the population versus the percentage of wealth. If the group has an equal distribution of wealth then 10% of the population will have 10% of the wealth, 60% of the population will have 60% of the wealth, etc. That means the plot will be a straight line, the Line of Equality:

If we do this for a group of people in a state, or country, or continent, we get a curve that lies below the Line of Equality, the Lorenz Curve:

The area between these two curves is the Gini Index (divided by two), and gives us a measure of inequality. The more area there is, the more wealth is concentrated in a small fraction of the population. The less area there is the more evenly distributed the wealth is. A Gini Index of 0 is equality, whereas an index of 1 is the case where one person has the wealth of the entire population. The World Bank tries to calculate this quantity for every country, and  UConn has a great site displaying the indices for all the counties in the US.

I wanted to see what happens to the Gini Index in a simple economy which I decided to model. I took a population of N individuals ( I did experiments with economies ranging from a thousand to a million individuals), and gave each individual the same amount of wealth. I then simulated the economy by having individuals randomly pair up with one another, and with some probability, have an economic transaction. The economic transaction consists of one of the individuals, a payer, giving one unit of wealth to the other individual, a payee (presumably in exchange for some activity). Debt is not allowed, so if the payer does not have one unit of wealth, then the transaction is cancelled. This model has a conservation of wealth, in that the sum of wealth of all individuals does not change.

Here’s how an economy of 100,000 individuals, where at every timestep there is a 4% chance of an economic interaction between at least one pair of individuals, evolves over time:

I let this economy run for years and years, and watched the distribution of wealth evolve. The Gini Index seems to be stable around .5 and the wealth rests in an exponential distribution.

Results are consistent with a MaxEnt analysis. In MaxEnt we write down an entropy functional which captures the constraints we have for the system (total number of individuals, and total wealth). Maximizing this functional leads to the distribution that is the most ignorant it can be while still satisfying the constraints.

Consider $M$ units of wealth in a population of $N$ people in a continuum limit. Denote the fraction of people that have wealth between $m$ and $m+d m$ by $n(m)dm$. The entropy functional is:

Since we are dealing with a continuous distribution, the first term is the Kullback-Liebler Divergence, with the second distribution being uniform. The second term is the normalization constraint for the population, while the third is the constraint on the average wealth. $\alpha$ and $\beta$ are Lagrange multipliers that enforce the constraints. Moving on, the population fraction and wealth fraction are, respectively:

Maximizing the entropy function with respect to the two Lagrange multipliers gives us the constraints, while maximizing with respect to the distribution gives us the exponential form found in the numerical experiment:

where we have used the constraints to solve for the Lagrange multipliers. Plugging these back into the equations for the population and wealth fractions, and eliminating the wealth variable, $m$, one can flex their algebraic muscles to show that:

This is the functional form of the Lorenz curve, and can be used to extract the Gini Index:

So the equilibrium distribution in the continuum limit (infinite population and infinite wealth) is an exponential, and its Gini Index is .5.

This is an interesting result since it is halfway between an equal distribution of wealth, and the most unequal distribution of wealth. Given the symmetric nature of the economic transactions (no benefit is gained by having more or less money), this economy seems pretty fair, yet the resulting wealth distribution is quite unequal. So what’s going on here?

First of all the it must be stressed that individuals are performing a random walk, so the distribution represents the amount of time that a particular individual will spend(on average) with a particular value of wealth. This is made quite evident if we follow several individuals’ wealth in a simulation:

Each individual wealth jumps around quite a bit. The Gini Index is not capturing this particular aspect of wealth, and the question of whether we can construct a better metric for measuring wealth disparity is one I may get back to in the future. It should also be noted that this model is equivalent to that of a gas consisting of atoms that have kinetic energy and are allowed to exchange energy in completely elastic collisions. The economic agents are the analog to the atoms, and wealth is the analog of kinetic energy. The exponential distribution seen here is analogous to the Boltzmann distribution, with the average wealth playing the role of temperature.

A major drawback of this model is that we haven’t incorporated any interesting dynamics such as debt, inflation, asymmetric transactions, or more complex financial entities. Some of these have been explored in a papers by Yakovenko and Caticha, to name a few. Since economics is not a zero sum game, and wealth can be generated by both parties during a transaction, it would be interesting to see how any of these types of dynamics end up affecting the equilibrium wealth distribution and consequently the Gini Index.

Hopefully in a future post I’ll explore this model a little more, and incorporate some of the aforementioned aspects of more realistic economies. We’ll see how much time I can actually squeeze into this econophysics sideproject… till next time!

# Modeling Predator-Prey Spatial Dynamics

The dynamics of two populations, one predator the other prey, are modeled using the Lotka-Volterra equations. In this post I’ll discuss why these equations have the form they do in a fully mixed model, and look at generalizations to incorporate spatial dynamics.

Let’s start with basic growth. If you have a large population then it will have more children than a small population. The rate of growth of the population is proportional to its size. Denoting the number of individuals in a population i at time t as $N_i (t)$ we can write

Here the growth rates are functions of the other populations. We want this because the size of a predator population should affect the death rate of a prey population, and the size of the prey population should affect the birth rate of a predator population. For a two population model we have then:

For a prey population the alpha is positive (base birth rate higher than death rate) and the beta is negative (death rate increased by presence of predator), and for a predator population we have the reverse (base death rate higher than birth rate, birth rate increased by presence of prey). This basic system has oscillatory dynamics: the predator population stays low until there is a surge in prey population. The surge in the predator population forces down the prey population, which in turn leads to a collapse of the predator population allowing the prey to grow again.

Now how do we add spatial dynamics?

First we allow the population functions to be functions of space, and define population densities so that the number of individuals in a region $\Delta \vec r$ around some point $\vec r$ is $N_i(\vec r, t|\Delta \vec r)=n_i(\vec r,t)\Delta\vec r$. What kind of dynamics do we wish to incorporate? How about the exploration of the environment, as well as the propensity for predators to chase prey and prey to run away from predators?

With no environmental pressure we might think of the individuals in a population as performing random walks. High population densities will diffuse to regions of lower density, and in an idealized limit there would be individuals everywhere in the environment. Overpopulated lumps dissipate and underpopulated dips fill up. By noting that lumps have negative curvature while dips have positive curvature, this dynamic can be implemented with a Laplacian:

If this was the only term on the RHS, then we would have the diffusion equation, where the motility, $\mu$, of the species is playing the role of the diffusivity. It is a positive number, and the larger it is the faster the individuals in the species can move around. Clumping behavior could be modeled by allowing the motility to become negative.

Alright, so what about the coupled spatial dynamics of the two populations: chasing and escaping? What kind of term can model this? Consider the density of both populations at a single point and let’s think about how one of the populations is reacting to the other. If the population is predatory then it will want to move in the direction of increasing prey population. A prey will act in the opposite fashion. In an interval of time the individuals at a point will shift to a new point that is determined by the gradient of the other population, hence:

Chasing and escaping behavior can be modeled with gradient couplings! Here $\nu$ is the coupling motility, and is positive for chasers (predators) and negative for escapees (prey).  Our spatial dynamics are captured in the operator:

In the case of two populations we now have:

These equations are a great starting place to start looking at the spatial dynamics of populations, and it is pretty obvious about how one can go about and generalize them to to include more complicated behavior.

Just to give you a sense of how the spatial predator and prey dynamics evolve over time I coded a slightly more complicated model than the one just written (included a predator-predator fighting component):

Also, make sure to check out the artwork of Alex Solis if you dig adorable versions of predators and prey.

# Smoothening out Disturbances: Why Diffusion Rocks

The diffusion equation plays an integral role modelling reality. Whenever there is a system containing a physical quantity that wants to smooth out and become homogeneously distributed then the diffusion term will model that happening. A temperature fluctuation in the atmosphere, a drop of dye in a pool of water, a magnetic field in a resistive fluid. All of these phenomena evolve according to the diffusion equation. Before going into the specifics of this equation, let’s take a quick look at it. If Q is a physical quantity (scalar, vector, or tensor) then the diffusion equation reads:

# Adventures in Topology: Euler Characteristics and Platonic Solids

Topology is a branch of Mathematics that can be thought of as the simplest form of geometry. It doesn’t concern itself with the specific shape of an object, but the ways in which the different pieces of the object connect to one another. To a topologist, if two shapes can be stretched, squeezed, and smoothly morphed to look like one another, then they are the same shape. The only caveat is that no cutting or tearing can occur during this process. The old saying goes that a topologist can’t tell the difference between a donut and a teacup:

# Factorial Functions of Fractions, Oh My!

Students are typically introduced to the factorial symbol when they encounter combinatorics in their high school math classes. Many mistake it for a punctuation mark, shouting the number out to the amusement of their math teachers the first time they see it written on the blackboard. To the cognoscenti, however, the symbol is just shorthand for saying the product of all the positive integers up to the number whose factorial is being calculated:

This concise symbol is used to define combinations and permutations, which in turn allow us to determine how many ways one can choose an appetizer, entrée, and dessert at their favorite SOHO restaurant. Along similar lines of reasoning the factorial appears in probability theory and in the Calculus to perform Taylor expansions of smooth functions. It seems simple enough, right? Just do a bunch of multiplication, and voila! there’s your answer. If mathematics has taught us anything over its millennia of existence, it is that structure hides within simplicity. We’re only beginning to scratch the surface of the deep…