# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Compute the gyration tensor and derived metrics quantifying the shape of particle distributions

Contributed by:
Nicholas E. Brunk, Wolfram|Alpha Math Team

ResourceFunction["GyrationTensor"][{ returns the gyration tensor of points { | |

ResourceFunction["GyrationTensor"][{ returns the derived metric specified via |

ResourceFunction["GyrationTensor"] allows points {*p*_{1},*p*_{2},…}of any consistent dimensionality ℝ^{n}.

Metric *type* availability depends upon the dimensionality of the coordinates in ℝ^{n}:

Dimension n | type |

any | "ResourceFunction["GyrationTensor"]", "RadiusOfGyration", "Eigenvalues" |

2 | "Acircularity", "NormalizedAcircularity" |

3 | "Asphericity", "NormalizedAsphericity", "RelativeAnisotropy" |

>3 | "HyperAsphericity", "NormalizedHyperAsphericity" |

By default, GyrationTensor returns the tensor itself:

In[1]:= |

Out[1]= |

Other metrics derived from the gyration tensor may be computed:

In[2]:= |

Out[2]= |

Metrics may be computed in other dimensions, for example 2D and 4D, respectively:

In[3]:= |

Out[3]= |

In[4]:= |

Out[4]= |

The metrics "NormalizedAsphericity" and "RelativeAnisotropy" have the same limiting behavior in describing spherically symmetric vs. linear distributions:

In[5]:= |

Out[5]= |

In[6]:= |

Out[6]= |

These metrics do, however, differ in non-limiting cases:

In[7]:= |

Out[7]= |

In[8]:= |

Out[8]= |

Available metrics are determined by the dimensions of the input vectors, such that "Acircularity"—a 2D metric—is not computed for 3D:

In[9]:= |

Out[9]= |

A given dimension can be omitted to check symmetry in the remaining fewer dimensions:

In[10]:= |

Out[10]= |

Non-normalized metrics scale with the size of the distribution:

In[11]:= |

Out[11]= |

In[12]:= |

Out[12]= |

Normalized equivalents do not and are scaled between 0 and 1:

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

Closely approximate the radius of gyration of a given 2D region, for example, reproducing known quantities such as a hoop (unit circle):

In[15]:= |

Out[15]= |

In[16]:= |

Out[16]= |

The same works for a hollow, 3D unit sphere:

In[17]:= |

Out[17]= |

The hollow sphere has a known radius of gyration *R*_{g}=*R*=1, which can be approximated (quite accurately, given the SpherePoints function):

In[18]:= |

Out[18]= |

The same works for a solid, 3D unit sphere, using ImplicitRegion:

In[19]:= |

Out[19]= |

The solid sphere has a known radius of gyration :

In[20]:= |

Out[20]= |

The intermediate result of a hollow spherical shell of a given thickness may also be estimated, using ImplicitRegion:

In[21]:= |

Out[21]= |

The radius of gyration may be estimated:

In[22]:= |

Out[22]= |

This result can be verified, in that it converges on the previous answer for the perfectly hollow unit sphere as thickness *t*→0:

In[23]:= |

Out[23]= |

The same works for a solid, 3D cylinder, e.g. with unit radius and length, for which a Region may be defined from a pre-existing graphics primitive:

In[24]:= |

Out[24]= |

A solid cylinder has a known radius of gyration :

In[25]:= |

Out[25]= |

Estimate the radius of gyration of a rabbit from ExampleData:

In[26]:= |

Out[26]= |

Note that this is a hollow rabbit, so it is more relevant to the Easter chocolate shell version than a live rabbit:

In[27]:= |

Out[27]= |

Shape metrics derived from the gyration tensor may be used to characterize the shape of a random walk. An unbiased random walk will generally have lower normalized asphericity than a biased random walk:

In[28]:= |

Out[28]= |

The unbiased walk (black) is much more spherically symmetric than the predominantly linear, biased random walk (green):

In[29]:= |

Out[29]= |

The relative anisotropy may be used to show that caffeine is a less linear molecule than THC:

In[30]:= |

Out[30]= |

- 2.0.0 – 23 March 2023
- 1.0.1 – 16 March 2021
- 1.0.0 – 18 September 2020

This work is licensed under a Creative Commons Attribution 4.0 International License