BRAGA

02 Writing02-02 Notes02-02-178

Circular Torus

Published 16 Apr 20268 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
  3. 03Real-world use
  4. 04The formula, piece by piece
  5. 05The formula in words
  6. 06Critical Concepts
  7. 07Step-by-step calculation (tiny example)
  8. 08Code examples
V=2π2Rr2V = 2\pi^2 R r^2
(1)

, S=4π2RrS = 4\pi^2 R r

Deep Breakdown

What it tells me (Situation Awareness): A circular torus is the 3D surface of revolution obtained by rotating a circle of radius rr (tube radius) around an axis that lies at distance RR (major radius) from the circle's center. Think of a donut or an inner tube. The volume V=2π2Rr2V = 2\pi^2 R r^2 gives the space enclosed; the surface area S=4π2RrS = 4\pi^2 R r gives the outer skin area. In DA/DS and ML: torus topology appears in periodic data (time-of-day + day-of-week combinations form a torus), in topological data analysis (TDA), in geometry-aware neural networks on manifolds, and in robotics/computer graphics where torus-shaped objects must be modeled analytically. The Pappus theorem underlying these formulas also shows up in centroid calculations.

Flowchart

Circular Torus:major radius R,tube radius rVolume: V = 2 *pi^2 * R * r^2Surface area: S= 4 * pi^2 * R * rPappustheorem: V =(2*pi*R) *(pi*r^2)Pappustheorem: S =(2*pi*R) *(2*pi*r)Circumferenceof path * area ofcross-sectioncircleCircumferenceof path *perimeter ofcross-sectioncircleConstraint: R r(non-self-intersecting torus)

Real-world use

Where it is used

Torus geometry is used in 3D object modeling (CAD, game engines), topological data analysis (identifying toroidal holes in data point clouds using persistent homology), robotics joint space (two rotational joints create a toroidal configuration space), and periodic feature engineering (wrapping hour-of-day and day-of-week into a 2D torus embedding for time-series models).

Problem it solves

When a physical or data object has a donut shape, you need to compute its volume (how much material it contains) and surface area (how much it costs to paint or cover). The Pappus theorem gives a clean formula: instead of a complex integral, you just multiply the path length of the centroid by the area (or perimeter) of the cross-section.

How it solves the problem

By the Pappus centroid theorem: when a plane figure is rotated about an external axis, the volume swept equals (centroid path length)×(area of figure)(\text{centroid path length}) \times (\text{area of figure}). For a disk of radius rr with centroid at distance RR from the axis: path length =2πR= 2\pi R, area =πr2= \pi r^2, giving V=2πR⋅πr2=2π2Rr2V = 2\pi R \cdot \pi r^2 = 2\pi^2 R r^2. Similarly, surface area =2πR⋅2πr=4π2Rr= 2\pi R \cdot 2\pi r = 4\pi^2 R r.

Example in a business

A DS builds a time-series demand forecasting model. To represent "time of day" and "day of week" without creating sharp discontinuities at midnight/end-of-week, they embed each timestamp as a point on a torus: (cos⁡(2πh/24),sin⁡(2πh/24),cos⁡(2πd/7),sin⁡(2πd/7))(\cos(2\pi h/24), \sin(2\pi h/24), \cos(2\pi d/7), \sin(2\pi d/7)). This 4D torus embedding makes temporal distance metrics continuous across day and week boundaries.

The formula, piece by piece

  • RR: major radius — distance from the center of the torus to the center of the tube cross-section
  • rr: minor radius (tube radius) — radius of the circular cross-section
  • R>rR > r: condition for a non-self-intersecting (ring) torus; R=rR = r gives a horn torus, R<rR < r gives a spindle torus
  • 2π2Rr22\pi^2 R r^2: volume — product of π2\pi^2 (from the two π\pi's from Pappus), RR, and r2r^2
  • 4π2Rr4\pi^2 R r: surface area — product of 4π24\pi^2 and RrR r
  • Via Pappus: V=(circumference of centroid path)×(disk area)=(2πR)(πr2)V = (\text{circumference of centroid path}) \times (\text{disk area}) = (2\pi R)(\pi r^2)
  • Via Pappus: S=(circumference of centroid path)×(circumference of tube)=(2πR)(2πr)S = (\text{circumference of centroid path}) \times (\text{circumference of tube}) = (2\pi R)(2\pi r)

The formula in words

"The torus is a circle of radius rr swept around a larger circle of radius RR. Volume = the area swept by the cross-section disk over the full circular path. Surface area = the perimeter swept by the circle boundary over the full circular path. Both reduce to two factors: the path length 2πR2\pi R and the cross-section's area or circumference." Tiny example: R=5R = 5, r=2r = 2. V=2π2(5)(4)=40π2≈394.78V = 2\pi^2(5)(4) = 40\pi^2 \approx 394.78. S=4π2(5)(2)=40π2≈394.78S = 4\pi^2(5)(2) = 40\pi^2 \approx 394.78. (Coincidence: V=SV = S when r=R/somethingr = R/\text{something} — happens to be equal here numerically.) Note: VV has units of length3\text{length}^3, SS has units of length2\text{length}^2 — they are equal here only numerically, not physically. ✓\checkmark

Critical Concepts

  • Pappus theorem: the deeper principle. Applies to any shape rotated about an external axis: volume = centroid path length × cross-section area.
  • Three types of tori: ring torus (R>rR > r, donut), horn torus (R=rR = r, pinches at inner point), spindle torus (R<rR < r, self-intersects).
  • Torus topology vs. geometry: a flat torus (used in topology) is not the same as the surface of revolution — the flat torus has zero Gaussian curvature everywhere, while the geometric torus has mixed positive and negative curvature.
  • Aspect ratio: R/rR/r is the aspect ratio. High R/rR/r = thin ring; R/r→1R/r \to 1 = fat donut approaching horn torus.
  • Units: VV is in cubic units (length3^3), SS is in square units (length2^2).
  • DA/DS torus embedding: encode periodic features on a torus to make distances continuous across period boundaries: θ↦(cos⁡θ,sin⁡θ)\theta \mapsto (\cos\theta, \sin\theta) in 2D, then combine two angles to get a 4D torus embedding.

Step-by-step calculation (tiny example)

Step 1: Identify the radii A donut has major radius R=6R = 6 cm, tube radius r=2r = 2 cm.

Step 2: Compute volume V=2π2×6×22=2π2×6×4=48π2≈473.74 cm3V = 2\pi^2 \times 6 \times 2^2 = 2\pi^2 \times 6 \times 4 = 48\pi^2 \approx 473.74 \text{ cm}^3.

Step 3: Compute surface area S=4π2×6×2=48π2≈473.74 cm2S = 4\pi^2 \times 6 \times 2 = 48\pi^2 \approx 473.74 \text{ cm}^2. (Numerically equal here. Verify: Pappus: V=2πR⋅πr2=12π⋅4π=48π2V = 2\pi R \cdot \pi r^2 = 12\pi \cdot 4\pi = 48\pi^2. ✓\checkmark)

Code examples

Beginner example (Python)

python
import numpy as np

def torus_volume(R: float, r: float) -> float:
    """Volume of circular torus: V = 2 * pi^2 * R * r^2."""
    if R <= r:
        raise ValueError(f"R={R} must be > r={r} for a ring torus.")
    return 2.0 * np.pi**2 * R * r**2

def torus_surface_area(R: float, r: float) -> float:
    """Surface area of circular torus: S = 4 * pi^2 * R * r."""
    if R <= r:
        raise ValueError(f"R={R} must be > r={r} for a ring torus.")
    return 4.0 * np.pi**2 * R * r
examples = [(5, 2), (6, 2), (10, 1), (3, 1)]
print(f"{'R':>5} {'r':>5} {'Volume':>12} {'Surface Area':>14}")
for R, r in examples:
    V = torus_volume(R, r)
S = torus_surface_area(R, r)
print(f"{R:>5} {r:>5} {V:>12.4f} {S:>14.4f}")   # Verify via Pappus
R_test, r_test = 5.0, 2.0
V_pappus = (2 * np.pi * R_test) * (np.pi * r_test**2)
S_pappus = (2 * np.pi * R_test) * (2 * np.pi * r_test)
print(f"\nPappus V={V_pappus:.4f} == formula V={torus_volume(R_test, r_test):.4f}: " f"{np.isclose(V_pappus, torus_volume(R_test, r_test))}")

Beginner example (R)

r
# -- Circular Torus ---
torus_volume <- function(R, r) 2 * pi^2 * R * r^2
torus_surface_area <- function(R, r) 4 * pi^2 * R * r
cases <- list(c(5, 2), c(6, 2), c(10, 1), c(3, 1))
cat(sprintf("%-5s %-5s %-12s %-14s\n", "R", "r", "Volume", "Surface Area"))
for (case in cases) { R <- case[1]; r <- case[2]
  cat(sprintf("%-5g %-5g %-12.4f %-14.4f\n", R, r, torus_volume(R, r), torus_surface_area(R, r)))
}  # Pappus verification
R <- 5; r <- 2
cat(sprintf("\nPappus V = %.4f, formula V = %.4f\n", (2*pi*R) * (pi*r^2), torus_volume(R, r)))

Professional example (Python)

python
import numpy as np
import pandas as pd
np.random.seed(42)   # -- Business scenario: torus feature embedding for periodic time-series features ---
# Encode hour-of-day and day-of-week as a torus embedding.
# Compute angular distance between timestamps using the embedded coordinates.

def torus_embed(hour: float, day: float) -> np.ndarray:
    """ Embed (hour, day) as a point on a 4D torus. hour in [0, 24), day in [0, 7). Returns 4D unit-torus coordinates. """
    theta_h = 2 * np.pi * hour / 24.0
    theta_d = 2 * np.pi * day / 7.0
    return np.array([np.cos(theta_h), np.sin(theta_h), np.cos(theta_d), np.sin(theta_d)])   # Simulate 10 events with hour and day-of-week
events = pd.DataFrame({ "event_id": range(10), "hour": np.random.uniform(0, 24, 10).round(1), "day_of_week": np.random.randint(0, 7, 10),
})   # Embed each event
embeddings = np.vstack([torus_embed(h, d) for h, d in zip(events["hour"], events["day_of_week"])])   # Compute pairwise Euclidean distances in torus embedding space
n = len(events)
dist_matrix = np.zeros((n, n))
for i in range(n):
    for j in range(n):
        dist_matrix[i, j] = np.linalg.norm(embeddings[i] - embeddings[j])   # Find the most temporally similar pair of events
np.fill_diagonal(dist_matrix, np.inf)
i_min, j_min = np.unravel_index(dist_matrix.argmin(), dist_matrix.shape)
print("Torus embedding of periodic time features:")
print(events.to_string(index=False))
print(f"\nMost similar pair in torus space: event {i_min} and event {j_min}")
print(f" Torus distance: {dist_matrix[i_min, j_min]:.4f}")
print(f" Event {i_min}: hour={events.iloc[i_min]['hour']}, day={events.iloc[i_min]['day_of_week']}")
print(f" Event {j_min}: hour={events.iloc[j_min]['hour']}, day={events.iloc[j_min]['day_of_week']}")
print(f"\nNote: distances are continuous across hour=23->0 and day=6->0 boundaries.")   # Show torus geometry formulas
R, r = 5.0, 2.0
print(f"\nTorus geometry (R={R}, r={r}):")
print(f" V = 2pi^2 * R * r^2 = {2*np.pi**2*R*r**2:.4f}")
print(f" S = 4pi^2 * R * r = {4*np.pi**2*R*r:.4f}")

Source: domain knowledge

#linear-algebra#spatial-distance-norms-and-analytic-geometry#analytic-geometry-shapes-perimeter-area-volume

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close