manim-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +104 -0
  2. package/dist/demo.mp4 +0 -0
  3. package/dist/index.js +65 -0
  4. package/dist/mcp-app.html +142 -0
  5. package/dist/server.js +1492 -0
  6. package/package.json +67 -0
  7. package/references/composer/SKILL.md +154 -0
  8. package/references/composer/references/3b1b-series-patterns.md +217 -0
  9. package/references/composer/references/domain-planning-guides/calculus-planning.md +188 -0
  10. package/references/composer/references/domain-planning-guides/linear-algebra-planning.md +169 -0
  11. package/references/composer/references/domain-planning-guides/ml-planning.md +286 -0
  12. package/references/composer/references/domain-planning-guides/number-theory-planning.md +187 -0
  13. package/references/composer/references/domain-planning-guides/physics-planning.md +249 -0
  14. package/references/composer/references/domain-planning-guides/probability-planning.md +200 -0
  15. package/references/composer/references/mathematical-storytelling.md +359 -0
  16. package/references/composer/references/narrative-patterns.md +221 -0
  17. package/references/composer/references/opening-patterns.md +284 -0
  18. package/references/composer/references/pacing-guide.md +289 -0
  19. package/references/composer/references/scene-archetypes.md +534 -0
  20. package/references/composer/references/scene-examples.md +379 -0
  21. package/references/composer/references/visual-techniques.md +480 -0
  22. package/references/composer/templates/scenes-template.md +147 -0
  23. package/references/manimce/SKILL.md +166 -0
  24. package/references/manimce/examples/3d_visualization.py +373 -0
  25. package/references/manimce/examples/basic_animations.py +212 -0
  26. package/references/manimce/examples/graph_plotting.py +401 -0
  27. package/references/manimce/examples/lorenz_attractor.py +172 -0
  28. package/references/manimce/examples/math_visualization.py +315 -0
  29. package/references/manimce/examples/updater_patterns.py +369 -0
  30. package/references/manimce/rules/3b1b-translation.md +594 -0
  31. package/references/manimce/rules/3d.md +254 -0
  32. package/references/manimce/rules/advanced-animations.md +594 -0
  33. package/references/manimce/rules/animation-groups.md +212 -0
  34. package/references/manimce/rules/animations.md +128 -0
  35. package/references/manimce/rules/api-pitfalls.md +89 -0
  36. package/references/manimce/rules/axes.md +214 -0
  37. package/references/manimce/rules/camera.md +208 -0
  38. package/references/manimce/rules/cli.md +232 -0
  39. package/references/manimce/rules/color-conventions.md +444 -0
  40. package/references/manimce/rules/colors.md +199 -0
  41. package/references/manimce/rules/config.md +264 -0
  42. package/references/manimce/rules/creation-animations.md +158 -0
  43. package/references/manimce/rules/graphing.md +233 -0
  44. package/references/manimce/rules/grouping.md +220 -0
  45. package/references/manimce/rules/latex.md +202 -0
  46. package/references/manimce/rules/lines.md +241 -0
  47. package/references/manimce/rules/long-form-video.md +552 -0
  48. package/references/manimce/rules/mathematical-domains.md +689 -0
  49. package/references/manimce/rules/mobjects.md +116 -0
  50. package/references/manimce/rules/multi-scene-composition.md +112 -0
  51. package/references/manimce/rules/pedagogy.md +532 -0
  52. package/references/manimce/rules/physics-simulations.md +610 -0
  53. package/references/manimce/rules/positioning.md +211 -0
  54. package/references/manimce/rules/scenes.md +121 -0
  55. package/references/manimce/rules/shapes.md +300 -0
  56. package/references/manimce/rules/styling.md +177 -0
  57. package/references/manimce/rules/text-animations.md +222 -0
  58. package/references/manimce/rules/text.md +189 -0
  59. package/references/manimce/rules/timing.md +227 -0
  60. package/references/manimce/rules/transform-animations.md +157 -0
  61. package/references/manimce/rules/updaters.md +226 -0
  62. package/references/manimce/templates/basic_scene.py +64 -0
  63. package/references/manimce/templates/camera_scene.py +100 -0
  64. package/references/manimce/templates/threed_scene.py +138 -0
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "manim-mcp",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "MCP server for generating 3Blue1Brown-style math animation videos with AI narration in Claude",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist/index.js",
9
+ "dist/server.js",
10
+ "dist/mcp-app.html",
11
+ "dist/demo.mp4",
12
+ "references"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc --noEmit && cross-env INPUT=mcp-app.html vite build && tsc -p tsconfig.server.json && npx esbuild server.ts --bundle --platform=node --format=esm --outfile=dist/server.js --external:@modelcontextprotocol/sdk --external:@modelcontextprotocol/ext-apps --external:express --external:cors --external:zod && npx esbuild main.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:./server.js --external:@modelcontextprotocol/sdk --external:@modelcontextprotocol/ext-apps --external:express --external:cors --external:zod --banner:js='#!/usr/bin/env node'",
16
+ "dev": "cross-env NODE_ENV=development concurrently \"cross-env INPUT=mcp-app.html vite build --watch\" \"npx tsx --watch main.ts\"",
17
+ "start": "node dist/index.js --stdio",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/ext-apps": "^1.0.0",
22
+ "@modelcontextprotocol/sdk": "^1.24.0",
23
+ "cors": "^2.8.5",
24
+ "express": "^5.1.0",
25
+ "zod": "^4.1.13"
26
+ },
27
+ "devDependencies": {
28
+ "@types/cors": "^2.8.19",
29
+ "@types/express": "^5.0.0",
30
+ "@types/node": "22.10.0",
31
+ "concurrently": "^9.2.1",
32
+ "cross-env": "^10.1.0",
33
+ "esbuild": "^0.27.3",
34
+ "tsx": "^4.21.0",
35
+ "typescript": "^5.9.3",
36
+ "vite": "^6.0.0",
37
+ "vite-plugin-singlefile": "^2.3.0"
38
+ },
39
+ "bin": {
40
+ "manim-mcp": "dist/index.js"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/zcsabbagh/manim-mcp.git"
45
+ },
46
+ "homepage": "https://github.com/zcsabbagh/manim-mcp#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/zcsabbagh/manim-mcp/issues"
49
+ },
50
+ "keywords": [
51
+ "mcp",
52
+ "model-context-protocol",
53
+ "manim",
54
+ "3blue1brown",
55
+ "animation",
56
+ "math",
57
+ "video",
58
+ "education",
59
+ "claude",
60
+ "ai"
61
+ ],
62
+ "license": "MIT",
63
+ "author": "Zane Sabbagh",
64
+ "engines": {
65
+ "node": ">=18.0.0"
66
+ }
67
+ }
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: manim-composer
3
+ description: |
4
+ Trigger when: (1) User wants to create an educational/explainer video, (2) User has a vague concept they want visualized, (3) User mentions "3b1b style" or "explain like 3Blue1Brown", (4) User wants to plan a Manim video or animation sequence, (5) User asks to "compose" or "plan" a math/science visualization.
5
+
6
+ Transforms vague video ideas into detailed scene-by-scene plans (scenes.md). Conducts research, asks clarifying questions about audience/scope/focus, and outputs comprehensive scene specifications ready for implementation with ManimCE or ManimGL.
7
+
8
+ Use this BEFORE writing any Manim code. This skill plans the video; use manimce-best-practices or manimgl-best-practices for implementation.
9
+ ---
10
+
11
+ ## Workflow
12
+
13
+ ### Phase 1: Understand the Concept
14
+
15
+ 1. **Research the topic** deeply before asking questions
16
+ - Use web search to understand the core concepts
17
+ - Identify the key insights that make this topic interesting
18
+ - Find the "aha moment" - what makes this click for learners
19
+ - Note common misconceptions to address
20
+
21
+ 2. **Identify the narrative hook**
22
+ - What question does this video answer?
23
+ - Why should the viewer care?
24
+ - What's the surprising or counterintuitive element?
25
+
26
+ ### Phase 2: Clarify with User
27
+
28
+ Ask targeted questions (not all at once - adapt based on responses):
29
+
30
+ **Audience & Scope**
31
+ - What math/science background should I assume? (e.g., "knows calculus" or "high school algebra")
32
+ - Target video length? (short: 5-10min, medium: 15-20min, long: 30min+)
33
+ - Should this be self-contained or part of a series?
34
+
35
+ **Focus & Depth**
36
+ - Any specific aspects to emphasize or skip?
37
+ - Proof-heavy or intuition-focused?
38
+ - Real-world applications to include?
39
+
40
+ **Style Preferences**
41
+ - Color scheme preferences?
42
+ - Narration style? (casual, formal, playful)
43
+ - Any specific visual metaphors you have in mind?
44
+
45
+ ### Phase 3: Create scenes.md
46
+
47
+ Output a comprehensive `scenes.md` file with this structure:
48
+
49
+ ```markdown
50
+ # [Video Title]
51
+
52
+ ## Overview
53
+ - **Topic**: [Core concept]
54
+ - **Hook**: [Opening question/mystery]
55
+ - **Target Audience**: [Prerequisites]
56
+ - **Estimated Length**: [X minutes]
57
+ - **Key Insight**: [The "aha moment"]
58
+
59
+ ## Narrative Arc
60
+ [2-3 sentences describing the journey from confusion to understanding]
61
+
62
+ ---
63
+
64
+ ## Scene 1: [Scene Name]
65
+ **Duration**: ~X seconds
66
+ **Purpose**: [What this scene accomplishes]
67
+
68
+ ### Visual Elements
69
+ - [List of mobjects needed]
70
+ - [Animations to use]
71
+ - [Camera movements]
72
+
73
+ ### Content
74
+ [Detailed description of what happens, what's shown, what's explained]
75
+
76
+ ### Narration Notes
77
+ [Key points to convey, tone, pacing notes]
78
+
79
+ ### Technical Notes
80
+ - [Specific Manim classes/methods to use]
81
+ - [Any tricky implementations to note]
82
+
83
+ ---
84
+
85
+ ## Scene 2: [Scene Name]
86
+ ...
87
+
88
+ ---
89
+
90
+ ## Transitions & Flow
91
+ [Notes on how scenes connect, recurring visual motifs]
92
+
93
+ ## Color Palette
94
+ - Primary: [color] - used for [purpose]
95
+ - Secondary: [color] - used for [purpose]
96
+ - Accent: [color] - used for [purpose]
97
+ - Background: [color]
98
+
99
+ ## Mathematical Content
100
+ [List of equations, formulas, or mathematical objects that need to be rendered]
101
+
102
+ ## Implementation Order
103
+ [Suggested order for implementing scenes, noting dependencies]
104
+ ```
105
+
106
+ ## 3b1b Style Principles
107
+
108
+ Apply these principles when composing scenes:
109
+
110
+ ### Visual Storytelling
111
+ - **Show, don't just tell** - Every concept needs a visual representation
112
+ - **Progressive revelation** - Build complexity gradually, don't show everything at once
113
+ - **Visual continuity** - Transform objects rather than replacing them when possible
114
+
115
+ ### Pacing & Rhythm
116
+ - **Pause for insight** - Give viewers time to absorb key moments
117
+ - **Vary the pace** - Mix quick sequences with slower explanations
118
+ - **End scenes with resolution** - Each scene should feel complete
119
+
120
+ ### Mathematical Beauty
121
+ - **Emphasize elegance** - Highlight when math is surprisingly simple or beautiful
122
+ - **Connect representations** - Show the same concept multiple ways (algebraic, geometric, intuitive)
123
+ - **Embrace abstraction gradually** - Start concrete, then generalize
124
+
125
+ ### Engagement Techniques
126
+ - **Pose questions** - Make viewers curious before revealing answers
127
+ - **Acknowledge difficulty** - "This might seem confusing at first..."
128
+ - **Celebrate insight** - Make the "aha moment" feel earned
129
+
130
+ ## References
131
+
132
+ ### Core References
133
+ - [references/narrative-patterns.md](references/narrative-patterns.md) - Common 3b1b narrative structures (Mystery, Build-Up, Two Perspectives, Wrong->Right, Specific->General, History, Tourist's Guide, Puzzle)
134
+ - [references/visual-techniques.md](references/visual-techniques.md) - Effective visualization patterns, animation timing, color palettes, scene composition layouts
135
+ - [references/scene-examples.md](references/scene-examples.md) - Example scenes.md excerpts from dot product, Fourier, transformations, transformers, Bayes, and Galton board
136
+
137
+ ### Video Planning References
138
+ - [references/3b1b-series-patterns.md](references/3b1b-series-patterns.md) - Proven series structures: EoLA (11 ch), EoC (11 ch), Neural Networks (4 parts), DiffEq (5 parts), Transformers (6+ parts), Laplace (5+ parts). How series build progressively.
139
+ - [references/opening-patterns.md](references/opening-patterns.md) - How 3b1b opens videos: Opening Quotes (with full EoLA quote list), Mystery First, Physical Scenario, Question-Driven, Pi Creature Classroom, Historical Narrative, Result Preview
140
+ - [references/scene-archetypes.md](references/scene-archetypes.md) - Reusable scene templates: TeacherStudentsScene, OpeningQuote, Grid Transformation, Equation Derivation, Side-by-Side Comparison, Phase Space, Progressive Build, Proof, Simulation, Data Visualization, 3D Surface, Quiz/Reveal, Taxonomy
141
+ - [references/pacing-guide.md](references/pacing-guide.md) - Detailed timing: overall video structure, scene-level pacing, animation run_time values, wait/pause patterns, lag_ratio guidelines, the "earned wait" principle
142
+ - [references/mathematical-storytelling.md](references/mathematical-storytelling.md) - Narrative craft: start with questions not definitions, show the wrong approach first, physical analogy before formal math, specific cases before general formula, multiple perspectives, aha moment placement, broader connections
143
+
144
+ ### Domain-Specific Planning
145
+ - [references/domain-planning-guides/linear-algebra-planning.md](references/domain-planning-guides/linear-algebra-planning.md) - EoLA structure, grid transformation as core visual, basis vector color coding (GREEN/RED), eigenvalue visualization, change-of-basis pattern
146
+ - [references/domain-planning-guides/calculus-planning.md](references/domain-planning-guides/calculus-planning.md) - EoC structure, geometric vs algebraic approach, Riemann rectangle progression, circle area derivation, "nudge" language, the Car metaphor
147
+ - [references/domain-planning-guides/probability-planning.md](references/domain-planning-guides/probability-planning.md) - Bayesian reasoning structure, population grid visualization, CLT dice progression, Beta distribution updating, simulation speed-up pattern
148
+ - [references/domain-planning-guides/physics-planning.md](references/domain-planning-guides/physics-planning.md) - Phase space dual view, vector fields and stream lines, simulation design (spring-mass, SIR, sliding blocks), wave physics, celestial mechanics
149
+ - [references/domain-planning-guides/ml-planning.md](references/domain-planning-guides/ml-planning.md) - Neural network visualization, transformer architecture breakdown, weight matrix coloring, live model integration, attention arc animation, auto-regression loop
150
+ - [references/domain-planning-guides/number-theory-planning.md](references/domain-planning-guides/number-theory-planning.md) - Prime visualization (YELLOW), zeta function spirals, complex plane phase coloring, Moser's circle problem, Pascal's triangle, modular arithmetic patterns
151
+
152
+ ## Templates
153
+
154
+ - [templates/scenes-template.md](templates/scenes-template.md) - Blank scenes.md template
@@ -0,0 +1,217 @@
1
+ # 3Blue1Brown Series Structures
2
+
3
+ Proven multi-part series structures from actual 3b1b videos (2015-2026). Use these as blueprints when planning multi-video series.
4
+
5
+ ---
6
+
7
+ ## Essence of Linear Algebra (2016) -- 11 Chapters + 2 Footnotes
8
+
9
+ The gold standard for a "core concept" series. Each chapter opens with a quote from a mathematician, establishing intellectual gravitas.
10
+
11
+ ### Chapter Progression
12
+
13
+ | Ch | Title | Core Concept | Builds On |
14
+ |----|-------|--------------|-----------|
15
+ | 0 | Preview | Why linear algebra matters, series roadmap | -- |
16
+ | 1 | Vectors, what even are they? | Three perspectives: physics (arrows), CS (lists), math (abstract) | -- |
17
+ | 2 | Linear combinations, span, bases | Scaling + adding vectors, span as reachable space | Ch 1 |
18
+ | 3 | Matrices as linear transformations | Grid transformation, basis vectors determine everything | Ch 1-2 |
19
+ | 4 | Matrix multiplication as composition | Applying two transformations = multiplying their matrices | Ch 3 |
20
+ | 5 | Three-dimensional linear transformations | 3x3 matrices, 3D grid, same intuition in higher dimension | Ch 3-4 |
21
+ | 6 | The determinant | Area/volume scaling factor, sign = orientation flip | Ch 3-5 |
22
+ | 7 | Inverse matrices, column space, null space | When transformations are reversible, what space gets squished | Ch 3-6 |
23
+ | 8 | Nonsquare matrices as transformations between dimensions | Mapping 3D to 2D and vice versa, rank | Ch 7 |
24
+ | 8.5 | Cross products in the light of linear transformations | Cross product as determinant with one variable column | Ch 6-8 |
25
+ | 9 | Dot products and duality | Why component multiplication relates to projection | Ch 3, 8 |
26
+ | 10 | Change of basis | "Your coordinates vs Jennifer's coordinates" | Ch 3, 9 |
27
+ | 11 | Eigenvectors and eigenvalues | Vectors that stay on their span, diagonal matrices | Ch 3-10 |
28
+ | Fn1 | Abstract vector spaces | Functions as vectors, axioms, the "abstractness" debate | Ch 1-11 |
29
+ | Fn2 | Cramer's rule, geometrically | Solving systems via transformed parallelepipeds | Ch 6-7 |
30
+
31
+ ### Design Principles from EoLA
32
+
33
+ 1. **"Three perspectives" framing**: Introduce concepts through physics student, CS student, mathematician perspectives (chapter 1). This humanizes abstract ideas.
34
+ 2. **Opening quotes from real mathematicians**: Jean Dieudonne (ch0), Hermann Weyl (ch1), Angus K. Rodgers (ch2), Morpheus (ch3 -- yes, The Matrix), Emil Artin (ch4), Richard Hamming (ch5), Georg Cantor (ch6), Jeff Lagarias (ch8), Pierre Deligne (ch8.5), Henri Poincare (ch9), Serge Lang (ch10), Vladimir Arnold (ch11).
35
+ 3. **Progressive complexity with constant callbacks**: Each new concept is explained by transforming familiar objects from earlier chapters.
36
+ 4. **The grid is sacred**: The NumberPlane grid transformation is THE core visual. It appears in nearly every chapter.
37
+ 5. **Footnotes for depth**: Side topics that would break the main flow get their own videos (Cramer's rule, abstract spaces).
38
+
39
+ ### Series Structure Pattern
40
+
41
+ ```
42
+ Ch 0: What is this series? (preview/motivation)
43
+ Ch 1-2: Foundation vocabulary (vectors, combinations)
44
+ Ch 3-5: Core mechanism (transformations, composition, 3D)
45
+ Ch 6-9: Derived properties (determinant, inverses, nonsquare, dot product)
46
+ Ch 10-11: Advanced applications (change of basis, eigenvectors)
47
+ Footnotes: Deep dives on side topics
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Essence of Calculus (2017) -- 11 Chapters + 1 Footnote
53
+
54
+ ### Chapter Progression
55
+
56
+ | Ch | Title | Core Concept | Builds On |
57
+ |----|-------|--------------|-----------|
58
+ | 1 | The essence of calculus | Area of circle via rings = derivative/integral preview | -- |
59
+ | 2 | The paradox of the derivative | Instantaneous rate of change, limits informally | -- |
60
+ | 3 | Derivative formulas through geometry | Power rule, sum rule via geometric areas | Ch 2 |
61
+ | 4 | Visualizing the chain rule and product rule | Nested boxes for chain rule, rectangle for product | Ch 3 |
62
+ | 5 | What's so special about Euler's number? | e^t derivative = itself, natural log | Ch 2-4 |
63
+ | 6 | Implicit differentiation | Multivariable chain rule on curves | Ch 4-5 |
64
+ | 7 | Limits | Epsilon-delta, L'Hopital's | Ch 2-6 |
65
+ | 8 | Integration and the fundamental theorem | Antiderivatives, area accumulation | Ch 1-7 |
66
+ | 9 | What does area have to do with slope? | Why FTC works, lower bound sliding | Ch 8 |
67
+ | 10 | Higher order derivatives | Curvature, Taylor preview | Ch 2-8 |
68
+ | 11 | Taylor series | Polynomial approximations, convergence | Ch 10 |
69
+ | Fn | L'Hopital's rule | Geometric proof via parametric curves | Ch 7 |
70
+
71
+ ### Design Principles from EoC
72
+
73
+ 1. **Start with geometry, not formulas**: Chapter 1 derives the circle area formula using concentric rings -- you SEE why 2*pi*r integrates to pi*r^2 before any formal calculus.
74
+ 2. **"Car on a road" metaphor**: A recurring Car mobject with position s(t), velocity v(t) makes derivatives tangible (chapter 2).
75
+ 3. **Area rectangles as the fundamental visual**: Riemann rectangles appear in multiple chapters with progressively finer dx.
76
+ 4. **Deliberate avoidance of epsilon-delta until chapter 7**: Build intuition first, rigor later. When limits finally appear, the viewer already has strong geometric intuition.
77
+ 5. **The "nudge" language**: Instead of "infinitesimal," Grant uses "tiny nudge dx" -- accessible language for the same concept.
78
+
79
+ ---
80
+
81
+ ## Neural Networks (2017) -- 4 Parts
82
+
83
+ ### Chapter Progression
84
+
85
+ | Part | Title | Core Concept | Builds On |
86
+ |------|-------|--------------|-----------|
87
+ | 1 | But what is a neural network? | Layers, neurons, weights, biases, activation | -- |
88
+ | 2 | Gradient descent, how neural networks learn | Cost function, gradient, learning rate | Part 1 |
89
+ | 3 | What is backpropagation really doing? | Chain rule through the network, sensitivity | Part 1-2 |
90
+ | 4 | Backpropagation calculus | The actual math of backprop derivatives | Part 3 |
91
+
92
+ ### Design Principles from NN Series
93
+
94
+ 1. **Concrete problem first**: Start with MNIST digit recognition, not abstract NN theory.
95
+ 2. **Pixels as input**: Uses `PixelsAsSquares` to show raw pixel data flowing into the network.
96
+ 3. **Visualization of activations**: Dot opacity represents activation level -- you see the network "light up."
97
+ 4. **Cost function before optimization**: Spend a full video establishing what "good" means before showing how to get there.
98
+ 5. **Progressive formalism**: Part 1 is almost formula-free. Part 4 is full calculus. The viewer is gradually brought along.
99
+
100
+ ---
101
+
102
+ ## Differential Equations (2019) -- 5 Parts
103
+
104
+ ### Chapter Progression
105
+
106
+ | Part | Title | Core Concept | Builds On |
107
+ |------|-------|--------------|-----------|
108
+ | 1 | Differential equations, a tourist's guide | Pendulum, phase space, vector fields | -- |
109
+ | 2 | But what is a partial differential equation? | Heat equation, temperature evolution | Part 1 |
110
+ | 3 | Solving the heat equation | Boundary conditions, Fourier's insight | Part 2 |
111
+ | 4 | But what is a Fourier series? | Rotating vectors, complex exponentials, epicycles | Part 3 |
112
+ | 5 | Understanding e to the i pi in 3.14 minutes | Euler's formula as rotational dynamics | Part 4 |
113
+
114
+ ### Design Principles from DiffEq Series
115
+
116
+ 1. **Physical system first**: Part 1 opens with a pendulum, not an equation. The ODE emerges from the physics.
117
+ 2. **Phase space as the key visual**: The pendulum's theta-vs-omega phase portrait IS the video -- this dual representation (physical system + phase space side-by-side) is a signature technique.
118
+ 3. **Vector fields as flows**: `StreamLines` and `AnimatedStreamLines` show solutions as trajectories through a vector field.
119
+ 4. **The "tourist's guide" framing**: Explicitly sets expectations: we're surveying, not proving. This liberates the narrative.
120
+ 5. **Each part stands alone but connects**: Each video has its own hook and resolution, but also sets up the next.
121
+
122
+ ---
123
+
124
+ ## Transformers / Deep Learning (2024) -- 6+ Parts
125
+
126
+ The most architecturally complex series. Files span `attention.py`, `embedding.py`, `mlp.py`, `network_flow.py`, `auto_regression.py`, `generation.py`, plus `helpers.py`, `chm.py`, `supplements.py`, `ml_basics.py`.
127
+
128
+ ### Chapter Progression
129
+
130
+ | Part | Topic | Core Concept | Key File |
131
+ |------|-------|--------------|----------|
132
+ | 1 | What is a transformer? | High-level architecture, token flow | `network_flow.py` |
133
+ | 2 | Attention | Query-key-value, dot product attention, softmax | `attention.py` |
134
+ | 3 | Embeddings | Tokenization, word2vec, semantic directions | `embedding.py` |
135
+ | 4 | MLP layers | Non-linear transformations, parameter counts | `mlp.py` |
136
+ | 5 | Auto-regression | Next-token prediction, probability distributions | `auto_regression.py` |
137
+ | 6 | Generation | Live GPT-2/GPT-3 inference, temperature, sampling | `generation.py` |
138
+
139
+ ### Design Principles from Transformer Series
140
+
141
+ 1. **Custom mobjects for domain concepts**: `WeightMatrix`, `NumericEmbedding`, `EmbeddingArray`, `NeuralNetwork`, `MachineWithDials`, `Dial` -- each concept gets its own visual class.
142
+ 2. **Live model inference**: Actual GPT-2 and GPT-3 produce predictions IN the animation. This grounds abstract architecture in real behavior.
143
+ 3. **The 3D block metaphor**: Transformer blocks rendered as `VPrism` objects with depth, rotation, and shading create a visceral sense of data flowing through architecture.
144
+ 4. **Color-coded matrix values**: `value_to_color()` maps positive values to blue, negative to red, creating instant visual feedback about what matrices "contain."
145
+ 5. **Arc-based attention visualization**: `ContextAnimation` uses curved arcs between token positions, colored and weighted by attention strength. This became an iconic representation.
146
+ 6. **Progressive depth across videos**: Start with black-box overview, then open each box (attention, embedding, MLP) in subsequent videos.
147
+
148
+ ---
149
+
150
+ ## Laplace Transform (2025) -- 5+ Parts
151
+
152
+ ### Chapter Progression
153
+
154
+ | Part | Topic | Core Concept | Key File |
155
+ |------|-------|--------------|----------|
156
+ | Prequel | Exponentials as building blocks | Why e^st matters for DiffEq | `exponentials.py` |
157
+ | 1 | Main equations | The transform formula, converting ODEs | `main_equations.py` |
158
+ | 2 | Derivatives | Why derivatives become multiplication by s | `derivatives.py` |
159
+ | 3 | Integration | Integration in s-domain | `integration.py` |
160
+ | 4 | Spring-mass system (SHM) | Solving a real ODE with Laplace | `shm.py` |
161
+
162
+ ### Design Principles from Laplace Series
163
+
164
+ 1. **Consistent color coding**: `S_COLOR = YELLOW` (frequency domain), `T_COLOR = BLUE` (time domain) used in every equation via `t2c` mapping.
165
+ 2. **Commutative diagrams**: Time-domain operations (top row) connected to s-domain operations (bottom row) by vertical Laplace transform arrows.
166
+ 3. **Complex surface visualization**: `ParametricSurface` colored by phase (`z_to_color`) for showing the Laplace transform as a 3D landscape over the complex s-plane.
167
+ 4. **Interactive pole manipulation**: `ComplexValueTracker` with `TrueDot` + `GlowDot` pairs for dragging poles on the s-plane and watching the impulse response change.
168
+ 5. **Physical simulation payoff**: The spring-mass `SrpingMassSystem` with real physics integration provides the tangible "this is what it's for" moment.
169
+
170
+ ---
171
+
172
+ ## Series Design Meta-Patterns
173
+
174
+ ### The Universal Series Arc
175
+
176
+ ```
177
+ Video 1: What is [concept]? (Motivation, big picture, preview of payoff)
178
+ Video 2-3: Core mechanism (The main ideas, with visual intuition)
179
+ Video 4-N: Applications and depth (Use the tools, go deeper)
180
+ Optional: Footnotes, supplements (Side topics, corrections, extras)
181
+ ```
182
+
183
+ ### How Series Build Progressively
184
+
185
+ 1. **Vocabulary first**: Early videos establish visual vocabulary (vectors, matrices, neurons, tokens). Later videos can use these freely.
186
+ 2. **Each video has its own complete arc**: Even within a series, each video has hook -> investigation -> resolution. A viewer should feel satisfied after one video.
187
+ 3. **Forward references create anticipation**: "We'll see in the next chapter why this matters..." builds series loyalty.
188
+ 4. **Backward references create depth**: "Remember how we saw that transformations preserve grid lines? Well..." rewards returning viewers.
189
+ 5. **Increasing abstraction**: Concrete -> specific pattern -> general principle -> abstract framework.
190
+ 6. **Shared helper files**: Every series has a `helpers.py` with custom mobjects and utility functions reused across videos.
191
+
192
+ ### Series Length Guidelines
193
+
194
+ | Series Type | Typical Length | Example |
195
+ |-------------|---------------|---------|
196
+ | Core curriculum | 10-12 chapters | EoLA, EoC |
197
+ | Focused topic | 4-6 parts | Neural Networks, Transformers, Laplace |
198
+ | Mini-series | 2-3 parts | Bayes, Convolutions |
199
+ | One-off with follow-up | 1 + footnote | Wordle, Newton's Fractal |
200
+
201
+ ### The "Essence of" Formula
202
+
203
+ When creating an "Essence of X" series:
204
+ 1. Ch 0: Preview -- show the beautiful result, explain why X matters, outline the journey
205
+ 2. Ch 1-3: Build the fundamental objects and operations
206
+ 3. Ch 4-6: Derive key properties from those operations
207
+ 4. Ch 7-9: Connect to other areas, show surprising applications
208
+ 5. Ch 10+: Advanced topics, unifying themes
209
+ 6. Each chapter: Opening quote -> Main content -> Pi creature interludes -> Implications
210
+
211
+ ### Supplement and Footnote Patterns
212
+
213
+ Most major series include supplementary content:
214
+ - **`supplements.py`**: Additional scenes, B-roll, Pi creature reactions, thumbnail generation
215
+ - **`wordy_scenes.py`** or **`pi_scenes.py`**: TeacherStudentsScene interactions for emotional beats
216
+ - **Footnotes**: Corrections, deeper dives, alternative proofs
217
+ - **Thumbnails**: Custom thumbnail scene classes
@@ -0,0 +1,188 @@
1
+ # Calculus Video Planning Guide
2
+
3
+ Based on the Essence of Calculus series (2017), alternative calculus approach (`_2018/alt_calc.py`), and related content across the 3b1b codebase.
4
+
5
+ ---
6
+
7
+ ## Core Visual Language
8
+
9
+ ### The Riemann Rectangle Progression
10
+
11
+ The fundamental calculus visual: rectangles under a curve that get thinner.
12
+
13
+ ```python
14
+ # Progressive refinement
15
+ rects = axes.get_riemann_rectangles(graph, x_min=0, x_max=4, dx=0.2)
16
+ rects.set_submobject_colors_by_gradient(BLUE, GREEN)
17
+ rects.set_opacity(1)
18
+ rects.set_stroke(BLACK, 1)
19
+
20
+ # Animate decreasing dx
21
+ for new_dx in [0.1, 0.05, 0.01]:
22
+ new_rects = axes.get_riemann_rectangles(graph, dx=new_dx)
23
+ self.play(Transform(rects, new_rects))
24
+ ```
25
+
26
+ ### The "Nudge" Visual
27
+
28
+ Instead of "infinitesimal," show a tiny but visible dx and the resulting df:
29
+
30
+ ```python
31
+ # Tangent line approach
32
+ x = 2
33
+ dx = 0.5
34
+ # Show the input nudge (horizontal bar)
35
+ dx_line = Line(axes.c2p(x, 0), axes.c2p(x + dx, 0), color=GREEN)
36
+ dx_label = Tex("dx", color=GREEN).next_to(dx_line, DOWN)
37
+ # Show the output nudge (vertical bar)
38
+ df_line = Line(axes.c2p(x + dx, f(x)), axes.c2p(x + dx, f(x + dx)), color=YELLOW)
39
+ df_label = Tex("df", color=YELLOW).next_to(df_line, RIGHT)
40
+ ```
41
+
42
+ ### The Car on a Road
43
+
44
+ From EoC Chapter 2, a recurring metaphor: position s(t) on top, velocity v(t) = ds/dt below.
45
+
46
+ ```python
47
+ # Car mobject (from _2017/eoc/chapter2.py)
48
+ class Car(SVGMobject):
49
+ # Car SVG with configurable color
50
+ class MoveCar(Animation):
51
+ # Animates car along a road
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Chapter Planning by Topic
57
+
58
+ ### Area of a Circle (EoC Ch 1)
59
+
60
+ **The most important scene in all of EoC**: Concentric rings unfurled into thin rectangles, forming a triangle whose area is pi*r^2.
61
+
62
+ **Key scenes:**
63
+ 1. Circle with concentric rings (colors: BLUE inner to GREEN outer)
64
+ 2. "Unroll" a single ring into a thin rectangle (length = 2*pi*r, height = dr)
65
+ 3. Stack all rectangles: they form a triangle
66
+ 4. Triangle base = 2*pi*R, height = R, area = pi*R^2
67
+ 5. "This IS integration, even before we call it that"
68
+
69
+ **From `CircleScene` in `_2017/eoc/chapter1.py`:**
70
+ ```python
71
+ CONFIG = {
72
+ "radius": 1.5,
73
+ "fill_color": BLUE_E,
74
+ "radial_line_color": MAROON_B,
75
+ "outer_ring_color": GREEN_E,
76
+ "ring_colors": [BLUE, GREEN],
77
+ "dR": 0.1,
78
+ "dR_color": YELLOW,
79
+ }
80
+ ```
81
+
82
+ ### Derivatives (EoC Ch 2-3)
83
+
84
+ **Geometric approach to derivative rules:**
85
+
86
+ **Power rule via areas:**
87
+ 1. x^2: draw a square with side x, grow by dx, new area = 2x*dx + dx^2
88
+ 2. x^3: draw a cube with side x, grow by dx, new volume = 3x^2*dx + ...
89
+ 3. Pattern: d/dx(x^n) = n*x^(n-1)
90
+
91
+ **Chain rule via nested boxes (EoC Ch 4):**
92
+ 1. Inner function g(x): one box
93
+ 2. Outer function f(g(x)): box around the box
94
+ 3. Change in x -> change in g -> change in f
95
+ 4. df/dx = df/dg * dg/dx (chain of nudges)
96
+
97
+ **Product rule via rectangle (EoC Ch 4):**
98
+ 1. Rectangle with sides f(x) and g(x)
99
+ 2. Area = f*g
100
+ 3. Grow x by dx: two new strips + tiny corner
101
+ 4. d(fg)/dx = f'g + fg' (the two strips)
102
+
103
+ ### Integration and FTC (EoC Ch 8-9)
104
+
105
+ **Key visual: accumulation function**
106
+ 1. Graph of f(x) on top
107
+ 2. Below: shaded area from 0 to x, updating as x moves
108
+ 3. The area IS the antiderivative
109
+ 4. Fundamental theorem: the rate of area growth equals the function height
110
+
111
+ **The slider technique:**
112
+ ```python
113
+ x_tracker = ValueTracker(0)
114
+ area = always_redraw(lambda: axes.get_area(
115
+ graph, x_range=[0, x_tracker.get_value()], color=BLUE, opacity=0.5
116
+ ))
117
+ self.play(x_tracker.animate.set_value(4), run_time=5)
118
+ ```
119
+
120
+ ### Taylor Series (EoC Ch 11)
121
+
122
+ **Progressive approximation:**
123
+ 1. Show the function
124
+ 2. Match value at point: constant term
125
+ 3. Match slope: linear term
126
+ 4. Match curvature: quadratic term
127
+ 5. Keep going: each term captures more
128
+ 6. The polynomial "hugs" the function more and more closely
129
+
130
+ ---
131
+
132
+ ## Geometric vs Algebraic Approach
133
+
134
+ The defining choice of 3b1b calculus: ALWAYS lead with geometry.
135
+
136
+ ### Geometric First
137
+
138
+ | Concept | Geometric Approach | Algebraic (secondary) |
139
+ |---------|-------------------|----------------------|
140
+ | Derivative | Slope of tangent line, rate of area growth | lim (f(x+h)-f(x))/h |
141
+ | Integral | Area under curve, accumulated quantity | Sum of f(x_i)*dx |
142
+ | Chain rule | Nested nudges through compositions | d/dx f(g(x)) = f'(g(x))g'(x) |
143
+ | Product rule | Two strips of a growing rectangle | d/dx (fg) = f'g + fg' |
144
+ | FTC | Area growth rate = function height | d/dx integral_0^x f(t)dt = f(x) |
145
+
146
+ ### When to Use Algebra
147
+
148
+ Algebra comes AFTER geometric intuition, for:
149
+ 1. Confirming the geometric result
150
+ 2. Computing specific values
151
+ 3. Showing the formula is general
152
+ 4. Connecting to standard notation
153
+
154
+ ---
155
+
156
+ ## Color Conventions for Calculus
157
+
158
+ | Element | Color | Purpose |
159
+ |---------|-------|---------|
160
+ | Input x / independent variable | BLUE | Consistent with function input |
161
+ | Output f(x) | GREEN or YELLOW | Function value |
162
+ | Nudge dx | GREEN | Small change in input |
163
+ | Resulting change df | YELLOW | Small change in output |
164
+ | Area under curve | BLUE with opacity 0.5 | Integral visualization |
165
+ | Riemann rectangles | BLUE-GREEN gradient | Progressive refinement |
166
+ | Tangent line | YELLOW | Derivative visualization |
167
+ | Error/remainder | RED | Taylor series error term |
168
+
169
+ ---
170
+
171
+ ## Alternative Calculus Approach (`_2018/alt_calc.py`)
172
+
173
+ Grant explored an alternative presentation focusing on:
174
+ - Functions as transformations of the number line
175
+ - Derivative as local scaling factor
176
+ - Integration as inverse of this scaling
177
+
178
+ This provides a second perspective for videos that need to show calculus from an unusual angle.
179
+
180
+ ---
181
+
182
+ ## Common Pitfalls in Calculus Videos
183
+
184
+ 1. **Starting with limits**: Limits are the FOUNDATION of rigor but the ENEMY of intuition. Build intuition first (EoC delays limits to chapter 7).
185
+ 2. **Algebraic derivation without geometric meaning**: Every formula should have a picture.
186
+ 3. **Static graphs**: The derivative is about CHANGE. Animate the point moving along the curve, the tangent line rotating, the area growing.
187
+ 4. **"And then you just apply the formula"**: Show WHY the formula works, not just how to use it.
188
+ 5. **Epsilon-delta too early**: Save formal rigor for viewers who already have intuition.