|
The
Topology module defines four functions:
WritheByCount()
to calculate the writhing number for a curve using
a direct counting method,
LinkByCount()
to calculate the linking number of two curves using
a direct counting method,
WritheByGauss()
to calculate the writhing number by evaluating the
Gauss Integral and LinkByGauss()
to calculate the linking number by evaluating the
Gauss Integral.
At
this time, LinkByGauss()
is believed to be inaccurate while
WritheByCount()
is too slow for very low writhes. Our
recommendation is to use
WritheByGauss()
and LinkByCount().
The
Topology module is located in Yup.Tools. Thus, the
required import statement is some variant of:
from
Yup.Tools.Toplogy import
*.
Input
The
functions take the same kinds of input.
The
two Writhe functions require a curve as input. The
two Link functions require two curves (of equal
length) as input. A curve is a list of tuples, each
tuple contains three floating point numbers. Thus,
each entry in the list corresponds to a point on
the curve. For example, the curve in this list:
[ (
0., 0., 0. ), ( 1., 0., 0. ), ( 2., 0., 0. ), ...
] shows
the first three points of a straight line along the
X-axis and the points are 1Å
apart.
The
two functions that evaluate the Gauss Integral do
so by a double summation of the descretized
integrand. Although the singularities cancel out in
the integral, they appear as very large numbers in
the descretization that do not cancel out because
the descretization is almost always asymmetrical.
Thus, these functions have a user specified
parameter, the minimum distance (closest)
between the two curves or two points in the same
curve. The summation will not be carried at such
close points.
The
two functions that evaluate the topological
quantities by direct counting of apparent curve
crossings (self-crossing in the case of Writhe) of
a random projection of the curve or curves on to a
plane. Equivalently, we are observing the curves
from all around them. The observation points
correspond to the intersections of a randomized
mesh. The size of the mesh opening determine the
number of observation points. The user can specify
the number of divisions in one hemisphere
(N). This corresponds to the number of lines
of latitudes. The number of lines of longitude
depend on the latitude. At the equator, the number
of longitude and latitude divisions are the same.
At the poles, there is only one longitude division.
The number of longitude divisions vary between the
two points such that the mesh opening is about the
same size everywhere. The intersection points of
the mesh are then shifted randomly in their local
neighborhood. The approximate number of
observations (bottom row) that corresponds to the
mesh division (top row) are:
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
20
|
|
1
|
5
|
11
|
19
|
29
|
43
|
59
|
79
|
99
|
125
|
149
|
177
|
211
|
245
|
279
|
503
|
Each
observation is equivalent to one round of the
double summation of the Gauss Integral but while
the Gauss Integral is evaluated only once, the
direct count methods have to average the counting
procedure over many observation points. However,
the direct count method accelerates the summation
by assuming some amount of stiffness in the curves
and skipping stretches of the curve when it is
clear that no apparent crossing is likely to occur.
As a result, even though the default setting for
WritheByCount()
uses approximately 99 observations, it is
significantly faster than
WritheByGauss().
Functions
The
WritheByCount()
function returns the writhing number for the given
curve using a direct count method averaging over
the specified number of observations.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
WritheByCount
|
2
|
tuple
of three numbers (the average writhe,
the standard deviation, the size of the
sample)
|
|
Argument
|
Type
|
Preset
Value
|
|
curve
|
list
of tuples
|
-
|
|
N
|
integer
|
9
|
The
preset value of N results in about 99
observations. This is sufficiently accurate for all
but the lowest writhing numbers. For the moment,
the standard deviation reported as the second item
of the tuple is not correctly
calculated.
The
curve is assumed to be open if the distance between
the ends of the curve is about 20% larger than the
largest distance between successive point along the
curve. The Writhing number is evaluated for the
open curve in this case.
The
LinkByCount()
function returns the linking number for the given
pair of curves using a direct count method
averaging over the specified number of
observations.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
LinkByCount
|
3
|
tuple
of three numbers (the average link, the
standard deviation, the size of the
sample)
|
|
Argument
|
Type
|
Preset
Value
|
|
curve1
|
list
of tuples
|
-
|
|
curve2
|
list
of tuples
|
-
|
|
N
|
integer
|
2
|
The
preset value of N results in about 5
observations which is sufficient in most
cases.
The
WritheByGauss()
function returns the writhing number for the given
curve by evaluating the Gauss Integral.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
WritheByGauss
|
2
|
float
|
|
Argument
|
Type
|
Preset
Value
|
|
C
|
list
of tuples
|
-
|
|
closest
|
float
|
1.0
|
The
function returns the writhing number as a floating
point number. The curve is always assumed to be
closed.
The
LinkByGauss()
function returns the linking number for the given
pair of curves by evaluating the Gauss
Integral.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
LinkByGauss
|
3
|
integer
|
|
Argument
|
Type
|
Preset
Value
|
|
C1
|
list
of tuples
|
-
|
|
C2
|
list
of tuples
|
-
|
|
closest
|
float
|
1.0
|
The
function returns the linking number as an
integer.
|