Conic Sections in Polar Coordinates
Put a focus at the origin and every conic, ellipse, parabola or hyperbola, has the same one-line polar equation, with the eccentricity deciding which one you get. That equation is exactly the shape of a planetary orbit, which is why this lesson ends with Kepler's laws and an orbit simulation.
One definition for all three conics
Theorem. Let be a point (the focus), a line not through (the directrix) and a constant. The set of points with
is an ellipse if , a parabola if and a hyperbola if .
Proof sketch. Put at the origin and the directrix at (). For with polar coordinates , and (for points on the focus side). The condition rearranges to
Converting back to Cartesian, squares to , i.e.
If the term vanishes and this is a parabola. If , completing the square gives
For both denominators are positive (an ellipse); for the denominator is negative (a hyperbola). One also checks , so the here is the same eccentricity as in Conic Sections. ∎
| Directrix | Polar equation |
|---|---|
| (right of focus) | |
| (left) | |
| (above) | |
| (below) |
Tip: To read , divide top and bottom by 4: . So (ellipse) and , .
Orbits: the ellipse form
For an ellipse it is more natural to use the semi-major axis than . From we get , so
gives the closest point, perihelion ; gives the farthest, aphelion . The quantity is the semi-latus rectum ( at ).
Kepler's laws (derived by Newton from the inverse-square law, see Motion in Space):
- A planet moves on an ellipse with the Sun at one focus: the equation above.
- The radius vector sweeps equal areas in equal times. In polar form , the polar area formula from Areas and Lengths in Polar Coordinates, with constant (angular momentum per unit mass).
- .
import math
a_au, e = 1.0, 0.0167 # Earth: semi-major axis 1 AU, eccentricity about 0.0167
AU = 1.496e8 # km
for name, th in [("perihelion", 0.0), ("quarter", math.pi / 2), ("aphelion", math.pi)]:
r = a_au * (1 - e**2) / (1 + e * math.cos(th))
print(f"{name:10s} r = {r:.5f} AU = {r * AU / 1e6:.2f} million km")
# Kepler's third law: Mars has a ≈ 1.524 AU, so T = a^1.5 years (Sun's GM in AU³/yr² is 4π²)
print(f"Mars period ≈ {1.524**1.5:.3f} years")perihelion r = 0.98330 AU = 147.10 million km
quarter r = 0.99972 AU = 149.56 million km
aphelion r = 1.01670 AU = 152.10 million km
Mars period ≈ 1.881 years
Simulating an orbit
The polar equation is the analytic answer; a simulation integrates Newton's law step by step and should reproduce it. Use units with , start at moving straight up at speed 1.2. Then , , and since the start is the perihelion, gives and .
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
def gravity(t, s):
x, y, vx, vy = s
r3 = (x*x + y*y) ** 1.5
return [vx, vy, -x / r3, -y / r3]
T = 2 * np.pi * 1.7857142857**1.5 # Kepler's third law with GM = 1
sol = solve_ivp(gravity, (0, T), [1, 0, 0, 1.2], rtol=1e-10, atol=1e-12, dense_output=True)
t = np.linspace(0, T, 2000)
x, y = sol.sol(t)[:2]
r = np.hypot(x, y)
print(f"min r = {r.min():.6f} max r = {r.max():.6f}")
print(f"e from the simulation = {(r.max() - r.min()) / (r.max() + r.min()):.6f}")
print(f"back at the start after one period: {abs(x[-1] - 1) < 1e-6 and abs(y[-1]) < 1e-6}")
th = np.arctan2(y, x)
pred = 1.44 / (1 + 0.44 * np.cos(th))
print(f"largest gap to r = p/(1 + e cos θ): {np.abs(r - pred).max():.1e}")
plt.figure(figsize=(6, 4))
plt.plot(x, y, label="simulated orbit"); plt.plot(0, 0, "o", label="focus (Sun)")
plt.axis("equal"); plt.legend()
print("plotted the orbit")min r = 1.000000 max r = 2.571428
e from the simulation = 0.440000
back at the start after one period: True
largest gap to r = p/(1 + e cos θ): 8.3e-10
plotted the orbit
The numerical orbit closes after exactly the Kepler period and matches the polar conic to within the solver's tolerance. Raise the start speed to (escape speed at ) and becomes 1: the orbit opens into a parabola; above that it is a hyperbola.
In software
- Orbital mechanics in games (Kerbal-style map views): engines integrate the physics, but draw the predicted path from the conic computed from the current position and velocity, which is cheap and never drifts.
- Astronomy and satellite software propagates orbits with Kepler's equation , solved by Newton's method, to get position as a function of time.
- Integrator testing: a Kepler orbit is a standard test for game physics integrators: explicit Euler spirals outward, symplectic Euler keeps the ellipse closed for a very long time.
Exercises
Exercise 1: Read the conic
Identify : eccentricity, type and directrix.
Answer
, a hyperbola, directrix .
Solution
Exercise 2: Write the equation
Find a polar equation of the parabola with focus at the origin and directrix .
Answer
.
Solution
, , directrix to the left . Check : , the vertex halfway between the focus and the directrix.
Exercise 3: A comet
A comet has perihelion 0.6 AU and aphelion 35 AU. Find , and its period in years.
Answer
, , .
Solution
a = (35 + 0.6) / 2
e = (35 - 0.6) / (35 + 0.6)
print(f"a = {a}, e = {e:.4f}, T = {a**1.5:.1f} years")a = 17.8, e = 0.9663, T = 75.1 years
Exercise 4: Equal areas
For the orbit , compute the area swept from to and from to . Which arc takes longer to travel?
Answer
About 1.0310 and 3.4670; the second arc (farther from the Sun) takes about 3.36 times as long.
Solution
By Kepler's second law time is proportional to swept area, and .
import numpy as np
from scipy.integrate import quad
r = lambda t: 1.44 / (1 + 0.44 * np.cos(t))
A1, _ = quad(lambda t: r(t)**2 / 2, 0, np.pi / 2)
A2, _ = quad(lambda t: r(t)**2 / 2, np.pi / 2, np.pi)
print(f"{A1:.4f} {A2:.4f} ratio {A2 / A1:.2f}")1.0310 3.4670 ratio 3.36
Test yourself
What conic is ?
- Parabola
- Hyperbola
- Ellipse
- Circle
An orbit has and . What is the perihelion distance?
- 1
- 1.5
- 3
- 0.5
Kepler's second law in polar coordinates says which quantity is constant?