Project 15: The Conic Sections Mapper
Build a conic-analysis tool that classifies quadratic equations, converts to standard form, and extracts geometric parameters.
Quick Reference
| Attribute | Value |
|---|---|
| Difficulty | Intermediate-Advanced (Level 2-3) |
| Time Estimate | 10-18 hours |
| Main Programming Language | Python |
| Alternative Programming Languages | Julia, JavaScript, C# |
| Key Topics | Completing the square, conic classification, analytic geometry |
| Input Mode | CLI equation strings |
| Output Mode | Standard form + parameter table + plotted curve |
1) Learning Objectives
- Normalize general second-degree equations in two variables.
- Classify circle, parabola, ellipse, or hyperbola in axis-aligned cases.
- Extract center/vertex/focal features from standard forms.
- Verify symbolic transformation via sampled-point residual checks.
- Explain geometric meaning of sign and scaling differences.
2) All Theory Needed (Per-Concept Breakdown)
Concept A: General Quadratic Forms
A conic in two variables can be represented by coefficients over x^2, xy, y^2, linear terms, and constant term. For this project, begin with axis-aligned forms (no xy) to keep classification deterministic and educational.
Concept B: Completing the Square as Decoding Tool
Completing the square transforms opaque expressions into parameter-visible forms. Once in standard form, center/axes/vertex become explicit and easy to verify.
Concept C: Classification by Structure
Sign patterns and denominator placement in standard forms distinguish conic families. Classification logic should be backed by symbolic checks and numerical validation.
3) Project Specification
3.1 What You Will Build
A CLI tool that:
- Parses axis-aligned quadratic equations.
- Converts to standard conic form.
- Classifies conic type and outputs parameter table.
- Renders an annotated plot for visual verification.
3.2 Functional Requirements
- Accept polynomial equation in
xandy. - Support circle, ellipse, parabola, hyperbola (axis-aligned).
- Output transformed equation and extracted parameters.
- Detect unsupported/degenerate forms explicitly.
- Save plotting artifact and diagnostics report.
3.3 Non-Functional Requirements
- Deterministic normalization order.
- Numerical tolerance for residual checks.
- Consistent parameter naming conventions.
3.4 Real World Outcome
$ python conic_mapper.py --expr "x^2 + y^2 - 4x + 6y - 12 = 0"
[classification] circle
[standard_form] (x-2)^2 + (y+3)^2 = 25
[parameters] center=(2,-3), radius=5
[output] saved plot: outputs/conic_circle_001.png
$ python conic_mapper.py --expr "x^2/9 - y^2/16 = 1"
[classification] hyperbola
[parameters] center=(0,0), a=3, b=4, asymptotes=y=+/-4x/3
4) Solution Architecture
4.1 High-Level Design
Equation Parser -> Coefficient Extractor -> Square Completion Engine -> Classifier -> Plotter
4.2 Key Components
| Component | Responsibility |
|---|---|
| Coefficient Extractor | Build canonical coefficient record |
| Transformer | Complete squares and normalize constants |
| Classifier | Branch into conic families from normalized structure |
| Plotter | Render curve and key geometric features |
5) Implementation Guide
Phase 1: Canonicalization
- Parse and gather coefficients.
- Move all terms to one side.
- Normalize leading signs for consistent branching.
Phase 2: Standard-Form Conversion
- Complete square for x and y groups.
- Normalize constants and denominators.
- Generate human-readable transformation transcript.
Phase 3: Validation and Plotting
- Sample points from transformed form.
- Check residuals in original equation.
- Plot conic with center/axes annotations.
6) Validation Checklist
- Known canonical conic test cases classify correctly.
- Parameter extraction matches hand-calculated values.
- Degenerate cases produce explicit warnings.
- Plot and equation diagnostics agree.
7) Extension Ideas
- Add rotated conic support (
xyterms). - Add symbolic equivalence checker between forms.
- Add interactive parameter sliders.
8) Books and References
- Precalculus conic sections chapters.
- Doing Math with Python for algebraic transformation workflows.
- Matplotlib docs for implicit and contour plotting.