Project 18: The Complex Plane Explorer (Polar Form + Euler)
Build a complex-number toolkit that converts rectangular/polar forms and visualizes multiplication as rotation and scaling.
Quick Reference
| Attribute | Value |
|---|---|
| Difficulty | Intermediate-Advanced (Level 2-3) |
| Time Estimate | 8-16 hours |
| Main Programming Language | Python |
| Alternative Programming Languages | Julia, MATLAB/Octave, JavaScript |
| Key Topics | Complex arithmetic, modulus/argument, roots of unity |
| Input Mode | CLI complex expressions |
| Output Mode | Conversion report + complex-plane plots |
1) Learning Objectives
- Convert complex values between rectangular and polar forms.
- Perform multiplication/division using polar reasoning.
- Compute powers and roots via argument/magnitude rules.
- Visualize geometric interpretation of operations.
- Validate round-trip conversions with tolerances.
2) All Theory Needed (Per-Concept Breakdown)
Concept A: Complex Plane Representation
A complex number a+bi maps directly to point (a,b) in 2D. This geometric view makes operations visually understandable.
Concept B: Polar Form and Operation Efficiency
Polar form separates magnitude and angle, simplifying multiplication/division/powers. Rectangular form remains useful for addition/subtraction.
Concept C: Euler and Roots
Euler-style representation links angle periodicity to repeated multiplication and root distribution. Roots of unity appear as evenly spaced points on unit circle.
3) Project Specification
3.1 What You Will Build
A CLI explorer that:
- Parses
a+biandr cis(theta)forms. - Performs conversion, multiplication, division, powers.
- Computes
nth roots. - Saves annotated complex-plane visualizations.
3.2 Functional Requirements
- Parse and normalize angle units.
- Convert forms bidirectionally.
- Output operation results in both forms.
- Plot operand/result vectors.
- Validate conversion round-trip errors.
3.3 Non-Functional Requirements
- Deterministic output formatting.
- Consistent degree/radian internal policy.
- Robust handling of near-zero values.
3.4 Real World Outcome
$ python complex_explorer.py --z "1+1i" --op polar
[result] modulus=1.4142
[result] argument_deg=45.0000
[result] polar=1.4142 cis(45.0000)
$ python complex_explorer.py --z "2cis30" --w "3cis20" --op multiply
[result] product_polar=6.0000 cis(50.0000)
[result] product_rect=3.8567+4.5963i
[output] saved plot: outputs/complex_mul_rotation_001.png
4) Solution Architecture
4.1 High-Level Design
Input Parser -> Form Normalizer -> Complex Ops Engine -> Plotter -> Reporter
4.2 Key Components
| Component | Responsibility |
|---|---|
| Parser | Parse and normalize complex inputs |
| Converter | Rectangular/polar transformation |
| Ops Engine | Arithmetic and root/power computations |
| Plotter | Geometric visualization of operands and results |
5) Implementation Guide
Phase 1: Core Conversion
- Implement rectangular parser.
- Add modulus/argument calculations.
- Add round-trip checks.
Phase 2: Operations
- Add multiplication/division and power operations.
- Print both rectangular and polar outputs.
- Add regression test vectors.
Phase 3: Visualization
- Plot vectors and angle arcs.
- Add roots-of-unity plotting mode.
- Export deterministic image naming.
6) Validation Checklist
- Conversion results match hand-computed examples.
- Multiplication in polar and rectangular forms agree.
- Root plots show correct angular spacing.
- Degree/radian policy is consistent and documented.
7) Extension Ideas
- Add complex polynomial root visualization.
- Add animation for repeated multiplication by a fixed complex factor.
- Add interactive notebook variant.
8) Books and References
- Math for Programmers - complex-number chapters.
- High-school advanced algebra/precalculus complex sections.
- Matplotlib polar/complex plotting guides.