Shunyaya Symbolic Mathematics — Inverse trigonometric functions — atan2 and signed-angle lift (2.33B)

Abstract
We define the symbolic lift of atan2 and a signed-angle operator for 2D vectors. Magnitudes follow the classical formulas; alignment is aggregated via a rapidity-weighted mean using sensitivity weights. We state domains, ranges, quadrant mapping, stable identities, and guard policies. Under collapse phi(m,a) = m, all formulas reduce to the classical ones.


atan2 lift (binary, alignment aggregation)
Inputs: y = (m_y, a_y), x = (m_x, a_x)
Output: atan2*((y), (x)) = ( atan2(m_y, m_x) , a’ )

Alignment aggregator (rapidity mean with sensitivity weights):
u_y = atanh( clamp(a_y, -1+eps, 1-eps) )
u_x = atanh( clamp(a_x, -1+eps, 1-eps) )
w_y = | ∂/∂m_y atan2(m_y, m_x) | = | m_x | / ( m_x^2 + m_y^2 )
w_x = | ∂/∂m_x atan2(m_y, m_x) | = | m_y | / ( m_x^2 + m_y^2 )
a’ = tanh( ( w_y * u_y + w_x * u_x ) / ( w_y + w_x ) )

Equivalent weights (cancel the common denominator):
w_y ∝ | m_x | , w_x ∝ | m_y | (safe because of the normalization by w_y + w_x)

Domain: (m_x, m_y) ≠ (0, 0)
Range (principal): (-pi, +pi]


Quadrant mapping (ASCII, principal branch)
Let r2 = m_x^2 + m_y^2.

Case table (returns theta in (-pi, +pi])

  • m_x > 0: theta = arctan( m_y / m_x )
  • m_x < 0 and m_y >= 0: theta = arctan( m_y / m_x ) + pi
  • m_x < 0 and m_y < 0: theta = arctan( m_y / m_x ) – pi
  • m_x = 0 and m_y > 0: theta = +pi/2
  • m_x = 0 and m_y < 0: theta = -pi/2
  • m_x = 0 and m_y = 0: undefined (guard)

Stable identity (prefer if library has arctan2):
atan2(m_y, m_x) = arctan( m_y / m_x ) with quadrant fixes above
Use hypot-style guards when computing ratios or r = sqrt(r2).


Signed angle between two 2D vectors
Given u = (u_x, u_y) and v = (v_x, v_y), each entry symbolic:
det = u_x * v_y – u_y * v_x (2D cross, scalar)
dot = u_x * v_x + u_y * v_y (dot product)
signed_angle*(u, v) = atan2*( det , dot )

Magnitude channel:
theta = atan2( det_m, dot_m )

Alignment channel (compositional):

  • Products use M2 for alignment: u_prod = atanh(a1) + atanh(a2)
  • Sums use rapidity-weighted means with absolute-magnitude weights
  • Feed resulting det and dot pairs into atan2* aggregation (weights |dot_m| and |det_m| respectively via the sensitivity rule)

Domain guards:

  • If both u and v are zero vectors, undefined
  • If det_m = dot_m = 0 (colinear with zero length), undefined by convention

Range (principal): (-pi, +pi]


Collapse and order
Collapse check:
phi( atan2*((y), (x)) ) = atan2( m_y, m_x )
phi( signed_angle*(u, v) ) = atan2( det_m, dot_m )
Order: not globally monotone; reason about order only on fixed rays/quadrants as in the classical case.


Domain and guard policies (manifest recommendations)
atan2.domain_guard = “error_at_origin” # (m_x, m_y) = (0,0)
atan2.range = “(-pi,pi]” # default; alternative “(0,2pi)” must be declared
atan2.weights = “sensitivity” # w_y ∝ |m_x|, w_x ∝ |m_y|
zero_policy = “canonical_zero” # if theta magnitude is exactly 0, return (0, +1)

For signed angles:
signed_angle.guard = “error_if_both_zero”
signed_angle.compose = { product_alignment: “M2”, sum_alignment: “rapidity_weighted” }

eps = 1e-6 for internal clamps entering atanh


Stable numerics (ASCII)

  • Prefer builtin arctan2 for the magnitude.
  • For ratios, avoid division by small m_x: switch formula with a threshold, e.g.,
    if |m_x| >= |m_y|: use arctan( m_y / m_x ) + quadrant_fix
    else: use sign(m_y) * pi/2 – arctan( m_x / m_y ) + small_fix
  • Use r = hypot(m_x, m_y) when forming auxiliary quantities; avoid forming r2 then sqrt if it risks overflow, apply scaling if needed.

Worked examples
A) First quadrant, balanced influence.
y = ( 1.0, 0.7 ), x = ( 1.0, 0.3 )
theta = atan2(1,1) = pi/4 ≈ 0.7854
u_y = atanh(0.7) ≈ 0.8673, u_x = atanh(0.3) ≈ 0.3095
w_y ∝ |m_x| = 1, w_x ∝ |m_y| = 1
u’ = (10.8673 + 10.3095) / 2 ≈ 0.5884 ⇒ a’ = tanh(0.5884) ≈ 0.529
atan2*((y),(x)) ≈ ( 0.7854 , 0.529 )

B) Second quadrant, asymmetric confidence.
y = ( 1.0, 0.9 ), x = ( -1.0, 0.1 )
theta = atan2(1,-1) = 3*pi/4 ≈ 2.3562
u_y ≈ 1.4722, u_x ≈ 0.1003, weights equal → u’ ≈ 0.7863 → a’ ≈ 0.655
Result ≈ ( 2.3562 , 0.655 )

C) Signed angle between u and v (right angle).
u = ( (1, 0.5), (0, 0.5) ), v = ( (0, 0.2), (1, 0.8) )
det_m = 11 – 00 = 1, dot_m = 10 + 01 = 0
theta = atan2(1,0) = pi/2 ≈ 1.5708
Alignment sketch: det uses the nonzero product (1, 0.5)•(1, 0.8) via M2; dot is exactly 0 → (0, +1).
atan2* weights favor x-channel when m_x=dot_m=0 (sensitivity to m_x dominates), so a’ trends toward +1 under the default sensitivity rule.
signed_angle*(u, v) ≈ ( 1.5708 , +1 )


Takeaway
The atan2 lift returns the classical signed angle on magnitudes and aggregates alignment from y and x using sensitivity weights |m_x| and |m_y|. The signed-angle operator composes determinant and dot via M2 and rapidity-weighted sums, then applies atan2*. Clear guards at the origin and for degenerate vector pairs make the behavior reproducible. Collapse returns standard angles.


Navigation
Previous -> Inverse trigonometric functions — Principal branches & domain guards (2.33A)
Next -> Inverse trigonometric lifts — arctan & atan2 (2.33C)


Disclaimer
Observation only. Results reproduce mathematically; domain claims require independent peer review. Defaults: domain excludes (0,0); range (-pi,pi]; weights use sensitivity; eps = 1e-6; |a| < 1. All formulas are presented in plain text. Collapse uses phi(m,a) = m.