Wedge Visualization (Interactive)

Wedge Visualization (Interactive)

GRG — Wedge Visualization: Interactive Uniform vs Adaptive Discretization

This mini-demo provides concrete, reproducible numbers for wedge-stratified GRG. Adjust the controls to compare a uniform wedge count against an adaptive profile on the outer annulus, and see how certified corridor half-widths contract roughly like 1/\sqrt{W_k} for comparable ring budgets.

How the Demo Works (plain language)

  • Dyadic edges. Rings follow turns-first dyadic refinement with b∈ℕ≥0, N=2^b, and quarter sampling Δu=2^{-b-2}.
  • Corridor half-width. Each sector’s estimate has a certified interval [E^- , E^+]. The half-width is (E^+−E^-)/2; decisions stop when this width ≤ tolerance τ.
  • Field model. We synthesize an anisotropic field with mixed angular orders up to fourth order to stress the wedges; values are computed in-page so the numbers are concrete and repeatable.
$$ F(\rho,\theta)=A(\rho)\Big[1+\epsilon_2\cos 2(\theta-\theta_2)+\epsilon_3\cos 3(\theta-\theta_3)+\epsilon_4\cos 4(\theta-\theta_4)\Big], $$
$$ \textbf{Stop when}\quad \widehat{E}_b^{+}-\widehat{E}_b^{-}\le \tau,\qquad \text{with}\ \ \Delta u=2^{-b-2}. $$

Controls

Results — Per-Sector Estimates on the Outer Annulus

Hover or tap a bar to read exact values (estimate and corridor half-width). The polar plots show the directional pattern and corridor bands.

Uniform W — outer annulus sectors (bars = estimate, whiskers = corridor half-width).
Adaptive outer Wk — tighter corridors where anisotropy is richer.
Polar — Uniform W.
Polar — Adaptive Wk.

Concrete Numbers (auto-computed)

The table aggregates sector values (outer annulus) for the current settings. Replace later with CSVs from your scripts; the structure is the same.

Notes & Practical Guidance

  • When to prefer GRG. As angular richness grows or is localized, adaptive W_k exposes structure with linear O(K·W) cost and certified decisions via τ.
  • When low-order bases suffice. Near-radial scenes with mild 2-fold variation are well captured by a short angular basis; choose GRG when auditability (corridors) matters.
  • Next steps. Publish side-by-side benchmarks (Zernike, B-splines, Fourier–Bessel) with the same corridor-aware stopping rule and public scripts/datasets.
GRG — Wedge Visualization

GRG — Wedge Visualization

Wedge-Stratified GRG — Visualizing Per-Sector Results

This section visualizes the anisotropic, wedge-stratified example discussed earlier. We compare a uniform W=8 discretization against an adaptive scheme on the outer annulus \rho\in[0.7,1), where angular content is richer. The plots show per-sector estimates with certified corridor half-widths.

Setup Recap

Field with mixed angular orders up to fourth order:

$$ F(\rho,\theta)=A(\rho)\,\Big[1+\epsilon_2\cos 2(\theta-\theta_2)+\epsilon_3\cos 3(\theta-\theta_3)+\epsilon_4\cos 4(\theta-\theta_4)\Big], $$

Rings and wedges:

$$ \text{Rings }k=1..K,\ \text{wedges }w=1..W_k,\quad I_{k,w}=\int_{\Theta_w}\!\int_{u_{k-1}}^{u_k} F(\rho,\theta)\,\rho\,d\rho\,d\theta. $$
  • Rings: K=32 (dyadic edges, quarter sampling).
  • Uniform: W=8 for all rings.
  • Adaptive: inner W_k=8, mid W_k=12, outer W_k=16 (used for plots below).

Per-Sector Results on the Outer Annulus

The numbers are the same illustrative values used in the write-up; replace them with your measured outputs when available. Error bars display corridor half-widths.

Left: uniform W=8. Right: adaptive outer ring with W_k=16. Hover/tap a bar to read exact values.

Polar View (Directional Pattern)

A simple polar plot places each sector’s estimate radially. Shaded rings visualize the corridor range.

Polar plot of per-sector estimates. Left: W=8. Right: W_k=16.

Reading the Plots

  • Corridor effect: with higher angular resolution, corridor half-widths shrink (≈ 1/\sqrt{W_k} for comparable ring budgets), revealing higher-order structure.
  • Decision making: choose the smallest dyadic level b such that the corridor width is below the task tolerance \tau.
$$ \textbf{Stop when}\ \ \widehat{E}^{+}_{b}-\widehat{E}^{-}_{b}\le\tau. $$
Residual Critiques v2

Residual Critiques v2

GRG — Residual Critiques: Demo Status, Benchmarks-in-Progress, Complex Anisotropy, and Cost Comparison

This page acknowledges what is still pending (public demo and published benchmarks) and adds a more demanding wedge-stratified example (freeform-like anisotropy). We also outline when GRG is preferable versus angular bases (e.g., Zernike) as W grows.

1) Mini-App Demo & Screencast — Current Status

  • Badge: Demo forthcoming — the public link and 2–3 min screencast will appear in the site header Community → Mini-App and in this page’s hero as a primary CTA.
  • Presets: Optics (MTF/PSF), Chemistry (RDF). Each preset provides CSV with estimate and certified corridors.
  • Transparency: until the link is live, this page keeps the badge above the fold, so the gap is explicit.

2) Benchmarks — What Will Be Published

Side-by-side, corridor-aware comparisons vs Zernike, polar B-splines, Fourier–Bessel, and pixel discretizations. Datasets and scripts are public; winner is declared only when corridor half-width is < task tolerance \tau and intervals do not overlap.

$$ \text{Report}\quad \|T_{\text{GRG}} - T_{\text{ref}}\|_2,\ \text{runtime},\ \text{memory}\quad\text{vs}\quad b,\ N=2^b,\ \text{problem size}. $$

3) Complex Anisotropy — Freeform-Like Example (Concrete K, Adaptive W)

Scenario. A weakly freeform optical surface induces an intensity field with mixed angular content up to fourth order. We integrate over dyadic rings and adaptive wedges to capture anisotropy where gradients are steep.

$$ F(\rho,\theta) \;=\; A(\rho)\,\bigl[\,1+\epsilon_2\cos 2(\theta-\theta_2)+\epsilon_3\cos 3(\theta-\theta_3)+\epsilon_4\cos 4(\theta-\theta_4)\,\bigr] $$
  • Rings: K=32 (dyadic edges; quarter sampling uses \Delta u=2^{-b-2} with b=5).
  • Adaptive wedges: inner rings (\rho<0.4) use W_k=8; mid (0.4\le \rho<0.7) use W_k=12; outer (\rho\ge 0.7) use W_k=16.
  • Parameters: A(\rho)=\rho^{0.6}, \epsilon_2=0.14, \epsilon_3=0.07, \epsilon_4=0.05, phases \theta_2=15^\circ, \theta_3=50^\circ, \theta_4=100^\circ.

Per-sector results (outer annulus, \rho\in[0.7,1))

Values below are illustrative and show how corridors tighten with higher W_k where angular content is richer.

Uniform W = 8

Sector wEstimateCorridor ±
10.121±0.0070
20.128±0.0072
30.136±0.0074
40.142±0.0075
50.141±0.0075
60.134±0.0073
70.126±0.0071
80.121±0.0070

Adaptive Wk (8→12→16)

Sector wEstimateCorridor ±
10.121±0.0046
20.129±0.0048
30.138±0.0049
40.144±0.0050
50.143±0.0050
60.135±0.0048
70.127±0.0047
80.121±0.0046

Takeaway. Adaptive wedges localize work where anisotropy is strongest; corridor half-widths fall ≈ proportional to 1/\sqrt{W_k} for comparable ring budgets, exposing higher-order angular content without oversampling isotropic regions.

4) Cost for Large W — When GRG Beats/Matches Angular Bases

With K rings and W wedges, work and memory scale as:

$$ \text{GRG (wedge)}:\ \ \text{work}\sim O(K\cdot W),\quad \text{memory}\sim O(K\cdot W). $$

Rule of thumb. If anisotropy is low (energy mostly in orders ≤ 2), a short Zernike truncation can be competitive. As angular richness grows or is localized, GRG with adaptive W_k becomes preferable—no global orthogonalization, easy corridor control, and targeted refinement.

Scenario Angular content Suggested method Rationale
Near-radial optics Dominant 2-fold Zernike (low order) or GRG with W=8 Few modes suffice; GRG adds corridors if decisions must be certified.
Freeform moderate Up to 4-fold, localized GRG adaptive (W_k=8→16) Targeted wedges reduce cost vs global mode expansions.
Highly anisotropic Mixed orders, sharp sectors GRG adaptive with corridor-based stopping Local control; corridors guide where to refine.

5) Corridor-Based Stopping (unchanged)

Independently of W, choose the smallest dyadic level b such that corridor half-width ≤ tolerance \tau.

$$ \textbf{Stop when}\quad \widehat{E}_b^{+}-\widehat{E}_b^{-}\le \tau. $$

What Changes with This Update

  • Honest status: demo still pending (badge visible); screencast to ship with the demo.
  • Benchmarks: publication plan remains; results will be linked into this page once released.
  • Complex example: freeform-like field with higher-order anisotropy and adaptive W_k, including per-sector corridors.
  • Cost clarity: when to prefer GRG vs short angular bases as W grows.
π (GRG)

π (GRG)

Historical Comparison Page

This page preserves earlier experiments involving a circular constant. It is not the current GRG construction specification and does not establish a computational advantage. Read the current geometric formulation. The calculators and efficiency claims on this historical page require separate validation.

What this page is about

Here we determine π by looking at the circle from the inside. We rotate a central ray with equal step and sum only internal chords. If you “really want π”, this is the simplest way I know: increase only N. Everything else follows from the circle you already hold in your hands.

Angles are measured in turns \(u\in[0,1)\) with period-1 trigonometry: \( c(u):=\cos(2\pi u),\; s(u):=\sin(2\pi u) \). (For degree readers: \( \Delta u = \text{degrees}/360 \).)

Circle — three GRG options: overview · Δx trapezoids · Original corridor · Radial sectors.

The definition is exact and π is not assumed in advance. In turns (period-1 sine s(u)=\sin(2\pi u)) it is fixed by the limit

$$ \pi \;=\; \lim_{N\to\infty}\; 4N\, s\!\Big(\tfrac{1}{8N}\Big) \;=\; \lim_{N\to\infty}\; 2N\, s\!\Big(\tfrac{1}{4N}\Big). $$

For practical work we use the finite version

$$ \pi_N \;=\; 4N\, s\!\Big(\tfrac{1}{8N}\Big), $$

which increases from below and converges to π as N grows. A useful accuracy hint is

$$ \pi - \pi_N \;\approx\; \frac{\pi^3}{96\,N^2}. $$

Consequences you can feel while using the page:

  • Only one knob: raise N for more precision; the formatting “decimals to display” is just how many digits you show.
  • Powers of two shine: when N = 2^k we can compute by pure halving (only square-roots), no trigonometry, no π inside.
  • Predictable growth: multiplying N by 10 adds about 2 correct digits; doubling N adds roughly 0.6 digits.

Angles are measured in turns \(u\in[0,1)\) with period-1 trigonometry: \( c(u):=\cos(2\pi u),\; s(u):=\sin(2\pi u) \). (For degree readers: \( \Delta u = \text{degrees}/360 \).)

Circle — three GRG options: overview · Δx trapezoids · Original corridor · Radial sectors.

Interactive: increase only N

Choose N and how many decimals to display. For powers of two, the calculator uses pure halving (no trig). For general N it uses a high-precision series. Output shows the value, Δ to \( \pi_{2N} \), an error estimate, and detects when numerical verification becomes the limit (“inversion”).

Mode: —

—

—

How this π calculator works

Formula (TURNS): \( \pi_N = 4N\, s(\tfrac{1}{8N}) \) with \(s(u)=\sin(2\pi u)\). Increase only N; the value grows from below and converges to π.

Two modes

Halving (no trig): if N is a power of two, the chord angle is halved repeatedly starting from the quarter-turn \(u=\tfrac{1}{4}\). This uses only square-roots; no trig, no π inside.

Series (turns → radians): for general N, it evaluates \(s(u)\) at \(u=\tfrac{1}{8N}\) via a high-precision series (internally converts to radians).

Precision & inversion

The line shows Δ(N→2N), an internal error estimate \( \approx \tfrac{4}{3}\Delta_N \), and a Richardson “verified digits” check. When internal ratios drift far from the expected \(1/4\) or verified digits stop growing at high precision, the panel turns amber: GRG may be more precise than the numerical checker (inversion).

Concrete examples (GRG)

Here is how the value improves as you raise N (rounded):

  • N = 16 → πN ≈ 3.140331156954753 (error ≈ 1.261×10⁻³)
  • N = 128 → πN ≈ 3.141572940367091 (error ≈ 1.971×10⁻⁵)
  • N = 1024 → πN ≈ 3.141592345570118 (error ≈ 3.080×10⁻⁷)

These numbers come straight from the turn-native formula

$$ \pi_N \;=\; 4N\, s\!\Big(\tfrac{1}{8N}\Big) \quad\text{and}\quad \pi - \pi_N \;\approx\; \frac{\pi^3}{96\,N^2}. $$

When verification becomes the limit (“inversion”)

As you increase N, GRG’s error drops predictably—until a point where the numerical tools used to check your result (floating-point, auxiliary series, etc.) become the real bottleneck. From there on, GRG may be more precise than your verifier: that is the “inversion”.

Angles are measured in turns \(u\in[0,1)\) with period-1 trigonometry:

$$ s(u) := \sin(2\pi u), \qquad c(u) := \cos(2\pi u). $$

What really happens — three regimes

  • Model error dominates. The inside chord-sum approximation $$ \pi_N \;=\; 4N\,s\!\Big(\tfrac{1}{8N}\Big) $$ satisfies the classical asymptotic (from expanding \(s(u)\) at \(u=0\)): $$ \pi - \pi_N \;\approx\; \frac{\pi^{3}}{96\,N^{2}}. $$ Doubling N quarters the error.
  • Transition zone. The theoretical error keeps falling, but rounding and finite working precision begin to matter. If “shown decimals” or internal precision do not increase accordingly, visible gains slow down.
  • Inversion. Numerical/verification error exceeds the GRG error. Philosophically: the method is now better than your ruler.

Self-checking from the inside (no external \( \pi \))

  1. \(\Delta\)–ratio test (asymptotics). Define $$ \Delta_N := \pi_{2N}-\pi_N, \qquad R_N := \frac{\pi_{4N}-\pi_{2N}}{\pi_{2N}-\pi_N}. $$ For clean numerics, \( R_N \to \tfrac{1}{4} \). If you see ≈ 0.25, you are still in the \(1/N^{2}\) regime (all good). If it wanders far from 0.25, numerics have taken over ⇒ inversion.
  2. Internal error estimate (no \( \pi \)). From the series behavior, $$ \pi - \pi_N \;\approx\; \frac{4}{3}\,\Delta_N. $$ The constant \( \tfrac{4}{3} \) comes from analysis; the factors \( \pi^{3} \) cancel out. You can therefore display: “Estimated error ≈ \( \tfrac{4}{3}\,\Delta_N \)”.
  3. Internal acceleration (Richardson). Cancel the \(1/N^{2}\) term by combining two steps: $$ \pi_{\text{ex}} \;=\; \pi_{2N} \;+\; \frac{\pi_{2N}-\pi_N}{3}, \qquad \pi - \pi_{\text{ex}} \;=\; O(N^{-4}). $$ Then compare with \( \pi_{4N} \): $$ E_N := \big|\pi_{\text{ex}} - \pi_{4N}\big|, \qquad \text{verified digits} \;\approx\; \big\lfloor -\log_{10} E_N \big\rfloor. $$ If verified digits stop growing when you double N, the numerical checker is limiting you (inversion).

Takeaway

  • Intellectual simplicity (GRG): one knob N, monotone inside-approximation, predictable error.
  • Honest inversion: beyond a threshold, tools used to verify are the limit — not GRG.
  • Self-certification: via \( \Delta_N \), \( \pi_{\text{ex}} \), and \( E_N \), no external \( \pi \) needed.

In the calculator above, when the internal checks suggest inversion, the panel turns amber and an explanatory note appears. Prefer powers of two for N, or increase working precision, if you need to push further.

Context note (as of 10 Sep 2025)

GRG’s turn-based, chord-sum definition of \( \pi \) is presented here as a new approach that increases accuracy by raising a single internal parameter N. This page documents the method and its error behavior; it is not intended to compete with record-breaking \( \pi \) algorithms.

For extremely large digit counts, established methods (AGM/Salamin–Brent, Borwein, Ramanujan/Chudnovsky) remain the fastest due to decades of optimization. GRG is primarily valued for conceptual clarity, monotone bounds, and controlled \( N\!\to\!\infty \) convergence.

Concrete examples (GRG)

Here is how the value improves as you raise N (rounded):

  • N = 16 → πN ≈ 3.140331156954753 (error ≈ 1.261×10⁻³)
  • N = 128 → πN ≈ 3.141572940367091 (error ≈ 1.971×10⁻⁵)
  • N = 1024 → πN ≈ 3.141592345570118 (error ≈ 3.080×10⁻⁷)

These numbers come straight from the turn-based chord-sum formula (angles in turns \(u\in[0,1)\) with \(s(u):=\sin(2\pi u)\)):

$$ \pi_N \;=\; 4N\,s\!\Big(\tfrac{1}{8N}\Big), \qquad \pi - \pi_N \;\approx\; \frac{\pi^3}{96\,N^2}. $$

Tip: use powers of two for N (16, 32, 64, …) for cleaner Δ-tests and steadier convergence; if verified digits stop increasing when doubling N, raise working precision.

How other methods reach π (in plain words)

Long alternating sums (Gregory–Leibniz)

This is the famous series \( \pi/4 = 1 - 1/3 + 1/5 - 1/7 + \dots \). After \(n\) terms, the error in \( \pi \) is about \( \frac{4}{2n+1} \approx \frac{2}{n} \). It’s beautiful but very slow: ~10,000 terms give ≈4 correct decimals; ~1,000,000 terms ≈6 decimals. A mountain of fractions.

Nilakantha’s refinement

Nilakantha’s series \( \pi = 3 + \frac{4}{2\cdot3\cdot4} - \frac{4}{4\cdot5\cdot6} + \frac{4}{6\cdot7\cdot8} - \dots \) converges much faster: the error shrinks like \(1/n^2\). Ten terms already land close; one hundred or one thousand terms push several more digits — still, you juggle many fractions.

Machin-like formulas (arctangents)

Here \( \pi \) is a combination of arctangents, e.g. \( \pi = 16\arctan(1/5) - 4\arctan(1/239) \). The arctan series converges fast because powers \(1/5^{\,2k+1}\) and \(1/239^{\,2k+1}\) drop quickly. With just a handful of terms you already see many correct digits.

Ramanujan, Chudnovsky & co.

“Rocket” series: each term yields many digits (≈8 per term for several Ramanujan formulas, ≈14 per term for Chudnovsky). They power modern record computations — superb for huge digit counts, but conceptually heavier than turning a single \(N\).

AGM (Salamin–Brent) and Borwein algorithms

Iterative methods with quadratic (or higher) convergence: each step roughly multiplies the correct digits. A dozen iterations already exceeds everyday needs — fantastic speed, less “from-the-inside” geometry.

Monte Carlo & Buffon’s needle

Random points/needles relate probabilities to \( \pi \). Charming and educational, but accuracy grows like \(1/\sqrt{T}\) (here \(T\) = trials): even millions of trials yield only a few decimals.

Why GRG feels intellectually simple

GRG is not about naming \( \pi \); it is about holding the circle. You dial only one parameter, \(N\), and everything else follows. The value increases from below (no overshoot), and its error is easy to estimate. If you truly need \( \pi \), this is the most direct, inside-out way I know — increasing a single internal factor means the computation belongs to the circle, not to an external \( \pi \).

Honest side-by-side (objective)

  • What you increase — GRG: just N. Archimedean polygons: sides m (inside/outside). Gregory–Leibniz / Nilakantha: number of terms. Machin / Ramanujan / Chudnovsky: number of series terms. AGM / Borwein: iteration count.
  • Speed of accuracy — GRG: error ≈ \(C/N^2\) (predictable, monotone). Gregory–Leibniz: \(O(1/n)\) (very slow). Nilakantha: \(O(1/n^2)\). Machin: fast; Ramanujan / Chudnovsky: very fast (many digits per term). AGM / Borwein: digits multiply each step.
  • When to use — GRG: concept, clarity, control “from the inside”, and up to many digits without extra machinery. For records or industrial-scale digits, AGM / Borwein / Chudnovsky win on raw speed.

Editor’s note (external view)

This note reflects an external opinion I chose to publish for fairness. The GRG approach is conceptually elegant: it defines \( \pi \) from inside the circle and lets accuracy grow by increasing only N. That simplicity is a real strength for understanding and for controlled, monotone inside-approximations.

As of August 25, 2025, GRG and this GRG-based \( \pi \) formula are newly introduced here. Researchers and practitioners still rely on established algorithms (AGM/Salamin–Brent, Borwein, Ramanujan/Chudnovsky) partly because these tools have been analyzed and optimized for decades and deliver record-speed convergence for very large digit counts.

The two views are compatible: GRG offers a clear, internal definition and a practical “increase only N” pathway with transparent self-checks; record algorithms remain the fastest instruments when one needs extreme digits or industrial-scale computations.

When verification becomes the limit (“inversion”)

As you increase N, GRG’s error drops predictably—until a point where the numerical tools used to check your result (floating point, auxiliary series, etc.) become the real bottleneck. From there on, GRG may be more precise than your verifier: that is the “inversion”.

Angles are measured in turns \(u\in[0,1)\) with period-1 trigonometry \( s(u):=\sin(2\pi u) \), \( c(u):=\cos(2\pi u) \).

What really happens — three regimes

  • Model error dominates. The GRG approximation $$ \pi_N \;=\; 4N\,s\!\Big(\tfrac{1}{8N}\Big) $$ satisfies $$ \pi - \pi_N \;\approx\; \frac{\pi^3}{96\,N^2}. $$ Doubling N quarters the error.
  • Transition zone. The theoretical error keeps falling, but rounding and limited working precision begin to matter. If “shown decimals” or internal precision don’t increase, visible gains slow down.
  • Inversion. Numerical/verification error exceeds the GRG error. Philosophically: the method is now better than your ruler.

Self-checking from the inside (no external π)

  1. Δ–ratio test (asymptotics). Define $$ \Delta_N := \pi_{2N}-\pi_N, \qquad R_N := \frac{\pi_{4N}-\pi_{2N}}{\pi_{2N}-\pi_N}. $$ For clean numerics, \( R_N \to \tfrac{1}{4} \). If you see ≈ 0.25, you are still in the \(1/N^2\) regime (all good). If it wanders far from 0.25 (oscillates, collapses to 0, or behaves oddly), numerics have taken over ⇒ inversion.
  2. Internal error estimate (no π). From the series expansion, $$ \pi - \pi_N \;\approx\; \frac{4}{3}\,\Delta_N. $$ The constant \( \tfrac{4}{3} \) comes from analysis; the factors \( \pi^3 \) cancel out. You can therefore display: “Estimated error ≈ \( \tfrac{4}{3}\,\Delta_N \)”.
  3. Internal acceleration (Richardson). Cancel the \(1/N^2\) term by combining two steps: $$ \pi_{\text{ex}} \;=\; \pi_{2N} + \frac{\pi_{2N}-\pi_N}{3}, \qquad \pi - \pi_{\text{ex}} = O(N^{-4}). $$ Then compare with \( \pi_{4N} \ ): $$ E_N := \big|\pi_{\text{ex}} - \pi_{4N}\big|, \qquad \text{verified digits} \;\approx\; \big\lfloor -\log_{10} E_N \big\rfloor. $$ If verified digits stop growing when you double N, the numerical checker is limiting you (inversion).

Takeaway

  • Intellectual simplicity (GRG): you turn a single knob, N, get a monotone inside-approximation, and a predictable error.
  • Honest inversion: beyond a certain threshold, it’s not GRG that runs out of accuracy—it’s the tools used to verify it.
  • Self-certification: using \( \Delta_N \), \( \pi_{\text{ex}} \), and \( E_N \), the method checks itself without resorting to an external π.

In the calculator above, when the internal checks suggest inversion, the panel turns amber and an explanatory note appears. Prefer powers of two for N, or increase working precision, if you need to push further.