gcc m.c mm.c mc.c g3.c g2.c d.c rdx.c -Wmost -fnested-functions

Type bp, the ‘brane pack’

Type bp is a ‘brane pack’ represented as a topological complex.
typedef struct {int d; int vc; R * wh; int sc; short * c;} bp;
A bp holds:
d
the dimensionality of the brane, (d = 3 for S2!)
vc
the vertex count
wh
which locates the vc-by-d array of coordinates of the brane in d space
sc
the number of simplex elements of the brane
c
the sc-by-d array defining the simplexes by providing indexes into the wh array.

Suppose we place an image of Sm centered at the origin and an image of Sn at (1, 0, 0, ...) in Rk space. Recall that k=m+n+1. The m+1 coordinates of points on Sm become the first m+1 components of the points in the image and the rest of those k coordinates are 0. Of the n+1 coordinates of Sn, the first is incremented by 1 and becomes the first coordinate in Rk. The other n coordinates become the last n coordinates of the image of Sn in Rk and the other coordinates of points in the image of Sn are 0. This is the simplest linking of Sm and Sn. We shall need to test less simple mutual orientations of the branes.

This formulation fails to capture the orientation and boundaryness for 0-branes.

Type mat

typedef struct{R* a; int m; int n;} mat; // a[m, n]
This describes a matrix including the matrix size. Expressions such as (mat){(R*)cnta, a.sc, k} produce a value of type mat which locates storage to store a a.sc-by-k array of reals. This construct partly ameliorates C’s lack of a first class array type. Type mat is a matrix with dope info.
If w is of type mat and 0≤i<w.m and 0≤j<w.n, then a[i, j] of the matrix may be accessed as w.a[i*w.n + j].

m.c Logic

Identifiers a and b denote brane packs which we embed and link in a common k dimensional Euclidian space.

Routine ob takes a d-by-k matrix and post multiplies it by the vc-by-d array of vertex coordinates to embed the brane in the k space. Argument vo is a vector offset to the embedding. Then the k dimensional coordinates of the centroids of the simplexes are computed and placed in an array of centroids, access to which is passed to ob as parameter cen.

Routine di performs the integral numerically. Its argument, dc, is the amount that the 2nd brane is offset in the host space. For currently defined branes an offset of 1 causes simple linking and 3 leaves branes unlinked.

D is the determinant of the theory. It is filled in by rows from each brane.

vog generates such a vector offset. (Terrible scoping!!!)

mm.c Logic

void mm(mat A, mat B, mat C);
mm(A, B, C) replaces matrix A by the product of B and C.

sma.c Logic

void sma(mat m, int e, dp rout, R* x)
This routine generates a mesh spread thruout an m.m dimensional simplex. Array m.a is an array of m.m vectors, one vector per mesh stride. Each vector has k=m.n elements. e is the number of mesh points in an edge. Routine rout is called with coordinates of each mesh point. Here is
sma((mat){(R*){1, -1, 2, 2}, 2, 2,}, 4, plot);

sma is recursive, naturally. The simplex is divided into one face which is simplex of one less dimensions, and a simplex of the same dimension but one less extent.

mc.c (Monte Carlo) Logic

This file defines
R smp(R* w, int a, int b)
The input is the matrix of the determinant whose first a rows are the Grassmann value of the first brane element, and the next b do the same for the second element. The last row is the offset from the origin of the first to that of the second. The matrix holds exacty the necessary floating values and in the most convenient format. smp chooses a random point within each element and returns the distance2 between them.

Various Specific Branes

Each of these routines return a brane pack. The brane is currently chosen by editing file m.c.

g2.c Logic

This file defines two brane generators: g2 for S1 which is the simple unit circle, and g1 for S0 = {−1, 1}. gx generates half of S0 which is convenient for testing and can be said to have a boundary.

g3.c Logic

g3 generates an icosohedron of radius about 1. wh is the array of vertex locations—vertices are designated by indexes into wh. Routine nr serves as a two vertex predicate that tells whether two vertices are neighbors based on the distance between them. To identify the triangles that compose the icosohedron we consider each triple of vertices and demand that they be pairwise neighbors. The determinant’s sign merely provides the orientation.
File b.c is a modification to the original to more closely mimic the logic of m.c for debugging the latter.
0-brane and 0-brane: calc =   -2.000000000, theory =    2.000000000, rm =    1.0000
0-brane and 1-brane: calc =    6.285253209, theory =    6.283185307, rm =    0.9995
1-brane and 0-brane: calc =   -6.285253209, theory =    6.283185307, rm =    0.9995
0-brane and 2-brane: calc =   15.135460739, theory =   12.566370614, rm =    0.9342
1-brane and 1-brane: calc =  -12.574643581, theory =   12.566370614, rm =    0.9990
2-brane and 0-brane: calc =  -15.135460739, theory =   12.566370614, rm =    0.9342
1-brane and 2-brane: calc =  -23.931096782, theory =   19.739208802, rm =    0.9338
2-brane and 1-brane: calc =  -23.931096782, theory =   19.739208802, rm =    0.9338
2-brane and 2-brane: calc =  -39.157149254, theory =   26.318945070, rm =    0.8819
I think that the following may account for the substantial errors for 2-branes which are icosahedra. The k5 term depends sensitively on where in the simplex (triangular face) the distance is measured from, especially since these faces are often larger than the distances between the faces. The current code chooses the distance between centers as the ‘typical’ distance. I plan some some sort of improvement on this but this requires yet more hair.

Monte Carlo:

0-brane and 0-brane dc= 1.0 mc:
calc =   -2.000000000, theory =    2.000000000, rm = 31622.7766
0-brane and 0-brane dc= 3.0 mc:
calc =   -4.000000000, theory =    0.000000000, rm = 31622.7766
0-brane and 2-brane dc= 1.0 mc:
calc =   12.564681769, theory =   12.566370614, rm = 31622.7766
0-brane and 2-brane dc= 3.0 mc:
calc =   -0.003973996, theory =    0.000000000, rm = 31622.7766
0-brane and 1-brane dc= 1.0 mc:
calc =    6.283197885, theory =    6.283185307, rm = 31622.7766
0-brane and 1-brane dc= 3.0 mc:
calc =   -0.000008465, theory =    0.000000000, rm = 31622.7766
1-brane and 2-brane dc= 1.0 mc:
calc =  -19.738625427, theory =   19.739208802, rm = 31622.7766
1-brane and 2-brane dc= 3.0 mc:
calc =   -0.000757264, theory =    0.000000000, rm = 31622.7766
2-brane and 1-brane dc= 1.0 mc:
calc =  -19.736952994, theory =   19.739208802, rm = 31622.7766
2-brane and 1-brane dc= 3.0 mc:
calc =    0.000054929, theory =    0.000000000, rm = 31622.7766
2-brane and 2-brane dc= 1.0 mc:
calc =  -26.295376937, theory =   26.318945070, rm = 31622.7766
2-brane and 2-brane dc= 3.0 mc:
calc =    0.000808019, theory =    0.000000000, rm = 31622.7766