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

  1. Convert complex values between rectangular and polar forms.
  2. Perform multiplication/division using polar reasoning.
  3. Compute powers and roots via argument/magnitude rules.
  4. Visualize geometric interpretation of operations.
  5. 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:

  1. Parses a+bi and r cis(theta) forms.
  2. Performs conversion, multiplication, division, powers.
  3. Computes nth roots.
  4. Saves annotated complex-plane visualizations.

3.2 Functional Requirements

  1. Parse and normalize angle units.
  2. Convert forms bidirectionally.
  3. Output operation results in both forms.
  4. Plot operand/result vectors.
  5. 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

  1. Add complex polynomial root visualization.
  2. Add animation for repeated multiplication by a fixed complex factor.
  3. 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.