ProLIP: Probabilistic Vision-Language Model
Automatic visualization of contrastive learning, uncertainty quantification, and probabilistic embeddings — generated from a single natural language prompt.
GRPO: Group Relative Policy Optimization
Complete visualization of Group Relative Policy Optimization for reinforcement learning — showing policy updates, reward shaping, and gradient flow through neural networks. Generated from a single prompt with zero manual editing.
Recursive Rhombicosidodecahedron
A fractal Archimedean solid where every vertex spawns another complete rhombicosidodecahedron, showcasing precise 3D transformations and recursive geometry driven from a single prompt.
You give me: "explain quantum field theory"
I give you back: A complete Manim animation showing Minkowski spacetime, QED Lagrangians, Feynman diagrams, renormalization flow - with 2000+ tokens of LaTeX-rich instructions that actually render correctly.
The secret? I don't use training data. I use a Reverse Knowledge Tree that asks "What must I understand BEFORE X?" recursively until hitting foundation concepts, then builds animations from the ground up.
Most systems try to learn patterns from examples. I do the opposite.
Traditional approach:
Simple prompt -> Pattern matching -> Hope for the best
Problems:
- Requires massive training datasets
- Brittle when concepts are new
- Can't handle edge cases
- Limited to what it's seen before
"Explain cosmology"
v
What must I understand BEFORE cosmology?
-> General Relativity
-> Hubble's Law
-> Redshift
-> CMB radiation
v
What must I understand BEFORE General Relativity?
-> Special Relativity
-> Differential Geometry
-> Gravitational Fields
v
What must I understand BEFORE Special Relativity?
-> Galilean Relativity
-> Speed of light
-> Lorentz Transformations
v
[Continue until hitting high school physics...]
v
Build animation from foundation -> target
Result: Every animation builds conceptual understanding layer by layer, naturally creating the verbose prompts that actually work.
Coming Soon: Integration with Nomic Atlas to create a semantic knowledge graph:
- 10x faster prerequisite discovery (cached graph instead of recursive Claude calls)
- Interactive visualization of entire learning paths (algebra -> quantum field theory)
- Community knowledge - everyone contributes to shared concept database
- Automatic discovery of prerequisite relationships via embeddings
See docs/NOMIC_ATLAS_INTEGRATION.md for the complete vision.
Read the full technical explanation: REVERSE_KNOWLEDGE_TREE.md
I've built a 6-agent system powered by Claude Sonnet 4.5 (with a 7th VideoReview agent underway):
- Parses your casual prompt
- Identifies core concept, domain, difficulty level
- Determines visualization approach
- Recursively asks "What before X?"
- Builds complete knowledge tree
- Identifies foundation concepts
- Creates conceptual dependency graph
- Adds LaTeX equations to each tree node
- Ensures mathematical rigor
- Links formulas to visualizations
- Specifies camera movements, colors, animations
- Maps concepts to visual metaphors
- Designs scene transitions
- Walks the tree from foundation -> target
- Generates 2000+ token verbose prompt
- Weaves narrative arc through concepts
- Translates verbose prompt -> Manim code
- Handles LaTeX rendering correctly
- Produces working Python scenes
- Automates post-render QA for the generated MP4
- Uses the video review toolkit to extract frames and build a web player
- Prepares review artifacts (metadata, frame set, HTML player) for fast iteration
Technology: Claude Agent SDK with automatic context management, built-in tools, and MCP integration.
See full architecture: docs/ARCHITECTURE.md
# Clone repository
git clone https://github.com/HarleyCoops/Math-To-Manim
cd Math-To-Manim
# Install dependencies
pip install -r requirements.txt
# Set up API key
echo "ANTHROPIC_API_KEY=your_key_here" > .env
# Install FFmpeg
# Windows: choco install ffmpeg
# Linux: sudo apt-get install ffmpeg
# macOS: brew install ffmpeg# Launch Gradio interface
python src/app_claude.pyThen enter a simple prompt like:
- "explain quantum mechanics"
- "visualize optimal transport theory"
- "show me the Pythagorean theorem"
Watch the agents build the knowledge tree and generate the verbose prompt automatically.
I've organized 55+ working examples by topic:
# Physics - Quantum mechanics
manim -pql examples/physics/quantum/QED.py QEDJourney
# Mathematics - Geometry
manim -pql examples/mathematics/geometry/pythagorean.py PythagoreanScene
# Computer Science - Neural networks
manim -pql examples/computer_science/machine_learning/AlexNet.py AlexNetScene
# Cosmology
manim -pql examples/cosmology/Claude37Cosmic.py CosmicSceneFlags:
-p= Preview when done-q= Quality (llow,mmedium,hhigh,k4K)
Browse all examples: docs/EXAMPLES.md
Math-To-Manim/
├── src/ # Core agent system
│ ├── agents/
│ │ ├── prerequisite_explorer_claude.py # Reverse knowledge tree agent
│ │ └── prerequisite_explorer.py # Legacy implementation
│ ├── app_claude.py # Gradio UI (Claude SDK)
│ └── app.py # Legacy UI
│
├── examples/ # 55+ working animations
│ ├── physics/
│ │ ├── quantum/ # 13 QED/QFT animations
│ │ ├── gravity/ # Gravitational waves
│ │ ├── nuclear/ # Atomic structure
│ │ └── particle_physics/ # Electroweak symmetry
│ ├── mathematics/
│ │ ├── geometry/ # Proofs, 3D shapes
│ │ ├── analysis/ # Optimal transport, diffusion
│ │ ├── fractals/ # Fractal patterns
│ │ ├── statistics/ # Information geometry
│ │ └── trigonometry/ # Trig identities
│ ├── computer_science/
│ │ ├── machine_learning/ # Neural nets, attention
│ │ ├── algorithms/ # Gale-Shapley, sorting
│ │ └── spatial_reasoning/ # 3D tests
│ ├── cosmology/ # Cosmic evolution
│ ├── finance/ # Option pricing
│ └── misc/ # Experimental
│
├── docs/ # Documentation
│ ├── EXAMPLES.md # Complete catalog
│ ├── ARCHITECTURE.md # System design
│ ├── MIGRATION_TO_CLAUDE.md # Claude SDK migration
│ └── TESTING_ARCHITECTURE.md
│
└── tests/ # Testing infrastructure
├── unit/
├── integration/
└── e2e/
Most people prompt in English. That's why it fails.
"Create an animation showing quantum field theory"
Result: Generic, incorrect, or broken code.
"Begin by slowly fading in a panoramic star field backdrop. As the camera
orients itself, introduce a title reading 'Quantum Field Theory: A Journey
into the Electromagnetic Interaction' in bold glowing text. The title shrinks
and moves to the upper-left corner, making room for a rotating wireframe
representation of 4D Minkowski spacetime. Display the relativistic metric:
$$ds^2 = -c^2 dt^2 + dx^2 + dy^2 + dz^2$$
with each component highlighted in a different hue to emphasize the negative
time component. Zoom into the origin to introduce undulating plane waves in
red (electric field $\vec{E}$) and blue (magnetic field $\vec{B}$),
oscillating perpendicularly. Display Maxwell's equations morphing from
classical vector calculus notation to relativistic four-vector form:
$$\partial_\mu F^{\mu \nu} = \mu_0 J^\nu$$
Animate each transformation by dissolving and reassembling symbols. Then shift
focus to the QED Lagrangian density:
$$\mathcal{L}_{\text{QED}} = \bar{\psi}(i \gamma^\mu D_\mu - m)\psi - \tfrac{1}{4}F_{\mu\nu}F^{\mu\nu}$$
Project this onto a semi-transparent plane with each symbol color-coded:
Dirac spinor $\psi$ in orange, covariant derivative $D_\mu$ in green,
gamma matrices $\gamma^\mu$ in bright teal, field strength tensor
$F_{\mu\nu}$ in gold. Let terms pulse to indicate dynamic fields..."
[...continues for 2000+ tokens]
Result: Perfect animations with correct LaTeX, camera movements, colors, and timing.
My agents generate these verbose prompts automatically by walking the knowledge tree.
By starting with high school concepts and building up, the animations naturally explain prerequisites before advanced topics. This creates coherent narrative flow.
When you write formulas in LaTeX, you're forced to be mathematically precise. This eliminates the ambiguity that breaks code generation.
Specifying exact camera movements, colors, timings, and transitions gives the LLM unambiguous instructions. "Show quantum fields" is vague. "Display red undulating waves labeled
Claude Sonnet 4.5's reasoning capabilities handle the recursive prerequisite discovery. I don't need training datasets - just well-structured prompts.
If the LLM generates broken code, I can pass it back with the error and ask for "verbose explanations." This often fixes LaTeX rendering issues automatically.
- Refactored to Claude Sonnet 4.5 + Claude Agent SDK
- 55+ working example animations
- Reverse knowledge tree core algorithm implemented
- Repository reorganized for first-time users
- Testing architecture designed
Short Term (1-2 months):
- Complete Agent Pipeline: Finalize the core 6 agents and bring the VideoReview step online
- Testing Suite: Comprehensive unit/integration/e2e tests
- Knowledge Tree Visualization: Web UI showing the prerequisite graph
Medium Term (3-6 months): 4. Nomic Atlas Integration: Semantic knowledge graph for instant prerequisite discovery [*] NEW
- Cache all prerequisite relationships in a shared knowledge graph
- 10x faster prerequisite discovery with semantic search
- Interactive visualization of learning paths
- Community-contributed concept database
- See docs/NOMIC_ATLAS_INTEGRATION.md for full vision
Long Term (6-12 months): 5. Community Platform: Public knowledge graph, animation gallery, learning path sharing 6. Fine-Tuning Experiments: RL on successful verbose prompts
- Pythagorean Theorem - Visual proof
- Bouncing Balls - Physics simulation
- Trig Identities - Basic trig
- Fractal Patterns - Self-similarity
- Gale-Shapley Algorithm - Stable matching
- AlexNet Architecture - CNN visualization
- Quantum Electrodynamics - Complete QED journey
- Optimal Transport Theory - Wasserstein distance
- Information Geometry - Statistical manifolds
- Electroweak Symmetry - Higgs mechanism
See all examples: docs/EXAMPLES.md
I've used multiple AI models to generate examples:
- Claude Sonnet 4.5: Primary agent system
- DeepSeek R1: Many quantum physics examples
- Gemini 2.5 Pro: Alternative QED visualizations
- Grok 3: Quantum mechanics approaches
- Qwen Max: Mathematical analysis
- Mistral Large: Gravitational waves
Each model brings unique perspectives, catching edge cases others miss.
I can generate both:
- Manim Python code - The animation itself
- LaTeX study notes - Complete mathematical explanation
Just pass any working scene back to the LLM and ask for "verbose explanations fully rendered as LaTeX study notes" - you'll get a complete PDF-ready document.
My system handles:
- Basic geometric proofs (high school level)
- Advanced physics (graduate level)
- Cutting-edge ML concepts (research level)
- Financial mathematics (professional level)
The knowledge tree approach automatically adjusts depth based on the target concept.
- Reverse Knowledge Tree - Core innovation explained
- Architecture - Agent system design
- Examples Catalog - All 55+ animations by topic
- Migration Guide - DeepSeek -> Claude transition
- Testing Strategy - Comprehensive testing approach
- Quick Start Guide - User-friendly tutorial
- Reorganization Plan - New structure details
- Contributing - How to add examples
Most one-shot animation attempts fail because of LaTeX syntax errors.
My solution: The verbose prompts explicitly show every LaTeX formula that will be rendered on screen, formatted correctly. The agents verify mathematical notation during enrichment.
"Show a quantum field" is too vague - what colors? What motion? From which angle?
My solution: The VisualDesigner agent specifies exact camera movements, color schemes, timing, and transitions. No ambiguity.
Jumping straight to QED without explaining special relativity first.
My solution: The PrerequisiteExplorer agent automatically discovers what concepts must be explained first, ensuring logical narrative flow.
Using
My solution: The MathematicalEnricher agent maintains consistent notation across the entire knowledge tree.
- Python: 3.10+
- Claude API Key: From Anthropic (for agent system)
- FFmpeg: For video rendering
- Manim Community: v0.19.0
- RAM: 8GB minimum, 16GB recommended
- GPU: Optional but speeds up rendering
See full requirements: requirements.txt
- Prerequisite tree generation: ~30-60 seconds for complex topics
- Verbose prompt composition: ~20-40 seconds
- Code generation: ~15-30 seconds
- Total: ~1-2 minutes for complete pipeline
- Low quality (
-ql): 10-30 seconds per scene - High quality (
-qh): 1-5 minutes per scene - 4K quality (
-qk): 5-20 minutes per scene
Times vary based on animation complexity.
I switched from DeepSeek to Claude Sonnet 4.5 + Claude Agent SDK in October 2025 because:
- Superior Reasoning: Claude Sonnet 4.5 handles recursive logic better
- Automatic Context Management: Never runs out of context
- Built-in Tools: File ops, code execution, web search out-of-the-box
- MCP Integration: Easy to connect external services
- Production Ready: Powers Claude Code, battle-tested at scale
- Native Agent Framework: Built by Anthropic specifically for autonomous agents
See migration details: docs/MIGRATION_TO_CLAUDE.md
I welcome contributions! Here's how you can help:
- Add Examples: Create animations for new topics
- Improve Agents: Enhance the prerequisite discovery algorithm
- Fix Bugs: Report and fix issues
- Documentation: Improve guides and explanations
- Testing: Add test coverage
See guidelines: CONTRIBUTING.md
# 1. Create your animation in the appropriate category
examples/physics/quantum/my_new_animation.py
# 2. Follow the naming convention
# Use descriptive names: schrodinger_equation.py, not scene1.py
# 3. Add a docstring explaining the concept
"""
Visualization of the Schrödinger equation in quantum mechanics.
Shows wave function evolution, probability density, and energy eigenstates.
"""
# 4. Test it renders correctly
manim -pql examples/physics/quantum/my_new_animation.py MyScene
# 5. Submit a pull requestQ: Do I need GPU for rendering? A: No, Manim runs on CPU. GPU just speeds things up.
Q: Can I use DeepSeek instead of Claude?
A: Yes, the old implementation is in src/agents/prerequisite_explorer.py
Q: How do I fix LaTeX rendering errors? A: Pass the error back to the LLM with the broken code and ask for corrections.
Q: What if my animation doesn't work? A: Check the examples/ directory for working references in your topic area.
Q: Can I use this for commercial projects? A: Yes, MIT license. Attribution appreciated.
Q: How accurate are the animations? A: Very accurate - I use LaTeX for all mathematical notation and validate formulas during enrichment.
MIT License - See LICENSE
- Manim Community - Incredible animation framework
- Anthropic - Claude Sonnet 4.5 and Agent SDK
- DeepSeek - Original inspiration and many examples
- Community Contributors - The 1000+ stars and growing
- You - For checking out this project
- GitHub Issues: Bug reports and feature requests
- Pull Requests: Contributions welcome
- Discussions: Share your animations and ideas
Star this repo if you find it useful! It helps others discover the project.
Built with recursive reasoning, not training data. Powered by Claude Sonnet 4.5.


