Sunday, January 04, 2026

The Three Parabola Formulas

The Three Parabola Formulas

A Rosetta Stone for converting between math, engineering, and physics representations

Every field that uses parabolas has developed its own formula. They all describe the same curve, but emphasize different properties. Converting between them is surprisingly undocumented — here's the complete reference.

The Three Forms

Mathematics Standard Form

y = ax² + bx + c
VariableMeaning
aCurvature (positive = opens up, negative = opens down)
bLinear coefficient (affects horizontal position)
cY-intercept (where curve crosses y-axis)

Used in: Algebra, calculus, general mathematical analysis

Civil Engineering Road/Vertical Curve Form

y = y₀ + g₁x + ((g₂ - g₁) / 2L)x²
VariableMeaning
y₀Starting elevation
g₁Entering grade (slope as decimal, e.g., 0.03 = 3%)
g₂Exiting grade
LLength of the curve (horizontal distance)

Used in: Highway design, railway engineering, surveying. The parabola creates smooth transitions between different road grades.

Physics/Optics Focus-Directrix Form

(x - h)² = 4p(y - k)
VariableMeaning
hVertex x-coordinate
kVertex y-coordinate
pFocal distance (distance from vertex to focus)

Used in: Optics, antenna design, telescopes, satellite dishes. The focus is where parallel rays converge after reflection.

Key Insight: Each form answers a different question:
  • Standard: "What's the y-value for any x?"
  • Road: "How does elevation change along this curve?"
  • Focus: "Where do signals/light concentrate?"

Conversion Formulas

Road → Standard

a = (g₂ - g₁) / (2L)
b = g₁
c = y₀

Standard → Road

y₀ = c
g₁ = b
g₂ = b + 2aL
(requires choosing L)

Standard → Focus

h = -b / (2a)
k = c - b² / (4a)
p = 1 / (4a)

Focus → Standard

a = 1 / (4p)
b = -h / (2p)
c = h² / (4p) + k

Road → Focus

First convert to Standard, then to Focus.
h = -g₁L / (g₂ - g₁)
k = y₀ - g₁²L / (2(g₂ - g₁))
p = L / (2(g₂ - g₁))

Focus → Road

y₀ = h²/(4p) + k
g₁ = -h/(2p)
g₂ = g₁ + L/(2p)
(requires choosing L)

⚠️ The L Problem: Road form has an extra degree of freedom — the curve length L. When converting to Road form, you must choose L (typically set L = 1 for unit curves, or use a meaningful physical distance).

JavaScript Conversion Library

/**
 * Parabola Conversion Library
 * Convert between Standard, Road, and Focus forms
 */

const Parabola = {
    
    // ============ STANDARD FORM: y = ax² + bx + c ============
    
    /**
     * Create from standard form coefficients
     */
    fromStandard(a, b, c) {
        if (a === 0) throw new Error("'a' cannot be zero (not a parabola)");
        return { form: 'standard', a, b, c };
    },
    
    /**
     * Convert standard form to road form
     * @param L - curve length (required, default = 1)
     */
    standardToRoad(a, b, c, L = 1) {
        const y0 = c;
        const g1 = b;
        const g2 = b + 2 * a * L;
        return { form: 'road', y0, g1, g2, L };
    },
    
    /**
     * Convert standard form to focus form
     */
    standardToFocus(a, b, c) {
        const h = -b / (2 * a);
        const k = c - (b * b) / (4 * a);
        const p = 1 / (4 * a);
        return { form: 'focus', h, k, p };
    },
    
    // ============ ROAD FORM: y = y₀ + g₁x + ((g₂-g₁)/2L)x² ============
    
    /**
     * Create from road/engineering form
     * @param y0 - starting elevation
     * @param g1 - entering grade (slope)
     * @param g2 - exiting grade
     * @param L  - curve length
     */
    fromRoad(y0, g1, g2, L) {
        if (L === 0) throw new Error("Curve length L cannot be zero");
        if (g1 === g2) throw new Error("g1 === g2 means straight line, not parabola");
        return { form: 'road', y0, g1, g2, L };
    },
    
    /**
     * Convert road form to standard form
     */
    roadToStandard(y0, g1, g2, L) {
        const a = (g2 - g1) / (2 * L);
        const b = g1;
        const c = y0;
        return { form: 'standard', a, b, c };
    },
    
    /**
     * Convert road form to focus form
     */
    roadToFocus(y0, g1, g2, L) {
        const a = (g2 - g1) / (2 * L);
        const h = -g1 * L / (g2 - g1);
        const k = y0 - (g1 * g1 * L) / (2 * (g2 - g1));
        const p = L / (2 * (g2 - g1));
        return { form: 'focus', h, k, p };
    },
    
    // ============ FOCUS FORM: (x-h)² = 4p(y-k) ============
    
    /**
     * Create from focus-directrix form
     * @param h - vertex x
     * @param k - vertex y  
     * @param p - focal distance (positive = opens up)
     */
    fromFocus(h, k, p) {
        if (p === 0) throw new Error("Focal distance p cannot be zero");
        return { form: 'focus', h, k, p };
    },
    
    /**
     * Convert focus form to standard form
     */
    focusToStandard(h, k, p) {
        const a = 1 / (4 * p);
        const b = -h / (2 * p);
        const c = (h * h) / (4 * p) + k;
        return { form: 'standard', a, b, c };
    },
    
    /**
     * Convert focus form to road form
     * @param L - curve length (required)
     */
    focusToRoad(h, k, p, L = 1) {
        const a = 1 / (4 * p);
        const b = -h / (2 * p);
        const c = (h * h) / (4 * p) + k;
        
        const y0 = c;
        const g1 = b;
        const g2 = b + 2 * a * L;
        return { form: 'road', y0, g1, g2, L };
    },
    
    // ============ UNIVERSAL CONVERTER ============
    
    /**
     * Convert any form to any other form
     * @param parabola - object with form property and coefficients
     * @param targetForm - 'standard', 'road', or 'focus'
     * @param L - curve length (needed when converting TO road form)
     */
    convert(parabola, targetForm, L = 1) {
        // First convert to standard as intermediate
        let std;
        switch (parabola.form) {
            case 'standard':
                std = { a: parabola.a, b: parabola.b, c: parabola.c };
                break;
            case 'road':
                std = this.roadToStandard(parabola.y0, parabola.g1, parabola.g2, parabola.L);
                break;
            case 'focus':
                std = this.focusToStandard(parabola.h, parabola.k, parabola.p);
                break;
            default:
                throw new Error(`Unknown form: ${parabola.form}`);
        }
        
        // Then convert from standard to target
        switch (targetForm) {
            case 'standard':
                return { form: 'standard', a: std.a, b: std.b, c: std.c };
            case 'road':
                return this.standardToRoad(std.a, std.b, std.c, L);
            case 'focus':
                return this.standardToFocus(std.a, std.b, std.c);
            default:
                throw new Error(`Unknown target form: ${targetForm}`);
        }
    },
    
    // ============ EVALUATION ============
    
    /**
     * Evaluate y at given x for any form
     */
    evaluate(parabola, x) {
        let a, b, c;
        switch (parabola.form) {
            case 'standard':
                ({ a, b, c } = parabola);
                break;
            case 'road':
                a = (parabola.g2 - parabola.g1) / (2 * parabola.L);
                b = parabola.g1;
                c = parabola.y0;
                break;
            case 'focus':
                a = 1 / (4 * parabola.p);
                b = -parabola.h / (2 * parabola.p);
                c = (parabola.h * parabola.h) / (4 * parabola.p) + parabola.k;
                break;
        }
        return a * x * x + b * x + c;
    },
    
    /**
     * Get vertex coordinates for any form
     */
    vertex(parabola) {
        const std = this.convert(parabola, 'standard');
        const x = -std.b / (2 * std.a);
        const y = std.c - (std.b * std.b) / (4 * std.a);
        return { x, y };
    },
    
    /**
     * Get focus coordinates for any form
     */
    focus(parabola) {
        const foc = this.convert(parabola, 'focus');
        return { 
            x: foc.h, 
            y: foc.k + foc.p 
        };
    },
    
    /**
     * Pretty print a parabola in its native form
     */
    toString(parabola, decimals = 4) {
        const r = (n) => Number(n.toFixed(decimals));
        switch (parabola.form) {
            case 'standard':
                return `y = ${r(parabola.a)}x² + ${r(parabola.b)}x + ${r(parabola.c)}`;
            case 'road':
                return `y = ${r(parabola.y0)} + ${r(parabola.g1)}x + ((${r(parabola.g2)} - ${r(parabola.g1)}) / ${r(2*parabola.L)})x²`;
            case 'focus':
                return `(x - ${r(parabola.h)})² = ${r(4*parabola.p)}(y - ${r(parabola.k)})`;
        }
    }
};

// ============ USAGE EXAMPLES ============

// Example 1: Highway engineer's curve
const highway = Parabola.fromRoad(100, 0.03, -0.02, 200);
console.log("Highway curve:", Parabola.toString(highway));
console.log("As standard form:", Parabola.toString(Parabola.convert(highway, 'standard')));
console.log("Vertex (high point):", Parabola.vertex(highway));

// Example 2: Satellite dish
const dish = Parabola.fromFocus(0, 0, 2.5);
console.log("\nSatellite dish:", Parabola.toString(dish));
console.log("As standard form:", Parabola.toString(Parabola.convert(dish, 'standard')));
console.log("Focus point:", Parabola.focus(dish));

// Example 3: Math problem y = 2x² - 4x + 5
const math = Parabola.fromStandard(2, -4, 5);
console.log("\nMath parabola:", Parabola.toString(math));
console.log("As focus form:", Parabola.toString(Parabola.convert(math, 'focus')));
console.log("As road form (L=10):", Parabola.toString(Parabola.convert(math, 'road', 10)));

// Make available globally for browser
if (typeof window !== 'undefined') {
    window.Parabola = Parabola;
}

Interactive Converter

Enter values in any form:

Standard Form

Road Form

Focus Form

Click a "Convert" button to see results...

Real-World Applications

Why Road Engineers Use Their Form

When designing a highway vertical curve, engineers know:

  • The starting elevation (y₀)
  • The incoming road grade (g₁) — e.g., +3% uphill
  • The required outgoing grade (g₂) — e.g., -2% downhill
  • Design constraints on curve length (L)

The road form lets them plug these directly into the formula. Converting to standard form would require computing abstract coefficients that don't map to physical reality.

Why Physicists Use Focus Form

For a satellite dish or telescope mirror, what matters is:

  • Where is the receiver/sensor? → The focus point (h, k+p)
  • How "deep" is the dish? → Related to p

The focus form directly encodes what the engineer needs to build.

Connection to Prime Number Research

When graphing prime products modulo n, parabolic curves emerge in the residue patterns. These curves trace paths that converge on prime factors. The ability to convert between parabola representations helps identify the underlying structure — whether it's best described by coefficients, rates of change, or focal points.

The Deeper Pattern: Primes aren't random. They follow quadratic "rails" in modular space. Euler's prime-generating polynomial n² + n + 41, the Ulam spiral diagonals, and the curves visible in primorial residue plots are all manifestations of the same phenomenon: primes have an affinity for certain quadratic forms.

This reference developed from discussions between John Sokol and Jonathan Vos Post on prime number visualization, and the observation that parabolic curves in modular arithmetic plots point directly to prime factors.

No comments: