{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# When a Longer Space Route Is Faster\n",
        "\n",
        "An explicit satellite chain shows when faster propagation compensates for the climb to orbit, with Earth-clearance checks for every space link.\n",
        "\n",
        "Synthetic overhead-satellite chord-chain propagation arithmetic with Earth-clearance checks; no contemporary constellation model, moving-orbit routing graph, or network measurement.\n",
        "\n",
        "The code uses Python 3 and the standard library. Saved output is from the checked CPU run.\n"
      ],
      "id": "space-routing-is-a-geometry-an-0"
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {},
      "source": [
        "import math\n",
        "\n",
        "earth_km = 6371.0\n",
        "light_km_s = 299792.458\n",
        "fiber_index = 1.468\n",
        "\n",
        "def compare(distance_km, altitude_km):\n",
        "    radius = earth_km + altitude_km\n",
        "    angle = distance_km / earth_km\n",
        "    visibility_angle = 2.0 * math.acos(earth_km / radius)\n",
        "    max_angle = min(math.radians(10.0), 0.99 * visibility_angle)\n",
        "    hops = max(1, math.ceil(angle / max_angle))\n",
        "    step = angle / hops\n",
        "    clearance = radius * math.cos(step / 2.0) - earth_km\n",
        "    assert clearance > 0.0\n",
        "    orbital_distance = hops * 2.0 * radius * math.sin(step / 2.0)\n",
        "    space_distance = 2.0 * altitude_km + orbital_distance\n",
        "    space_ms = 1000.0 * space_distance / light_km_s\n",
        "    fiber_ms = 1000.0 * distance_km * fiber_index / light_km_s\n",
        "    assert orbital_distance <= radius * angle + 1e-9\n",
        "    return hops, space_ms, fiber_ms\n",
        "\n",
        "for altitude in [550.0, 1150.0]:\n",
        "    denominator = fiber_index - (earth_km + altitude) / earth_km\n",
        "    crossover = 2.0 * altitude / denominator\n",
        "    print(f\"altitude={altitude:.0f}km arc_crossover={crossover:.1f}km\")\n",
        "    for distance in [1000.0, 3000.0, 6000.0]:\n",
        "        hops, space, fiber = compare(distance, altitude)\n",
        "        print(f\"  ground={distance:.0f}km hops={hops} \"\n",
        "              f\"space={space:.3f}ms fiber={fiber:.3f}ms\")\n",
        "print(\"Earth-clearance and chord-length checks: passed\")\n"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "altitude=550km arc_crossover=2882.1km\n",
            "  ground=1000km hops=1 space=7.289ms fiber=4.897ms\n",
            "  ground=3000km hops=3 space=14.529ms fiber=14.690ms\n",
            "  ground=6000km hops=6 space=25.389ms fiber=29.380ms\n",
            "altitude=1150km arc_crossover=8000.2km\n",
            "  ground=1000km hops=1 space=11.606ms fiber=4.897ms\n",
            "  ground=3000km hops=3 space=19.473ms fiber=14.690ms\n",
            "  ground=6000km hops=6 space=31.274ms fiber=29.380ms\n",
            "Earth-clearance and chord-length checks: passed\n"
          ]
        }
      ],
      "id": "space-routing-is-a-geometry-an-1"
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Sources\n",
        "\n",
        "- Delay is Not an Option — accepted primary manuscript: https://discovery.ucl.ac.uk/id/eprint/10062262/7/Handley_hotnets.pdf\n- Delay is Not an Option: Low Latency Routing in Space: https://discovery.ucl.ac.uk/id/eprint/10062262/\n"
      ],
      "id": "space-routing-is-a-geometry-an-2"
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.12.14"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
