What if you could take a mathematical equation and make it move?
Not just display it on a screen, but animate it—make graphs appear, equations transform, geometric shapes move, and mathematical ideas become visual stories.
That is where Manim comes in.
Manim is a Python library for creating mathematical animations. It was originally created by Grant Sanderson, better known as 3Blue1Brown, to create the mathematical animations used in his videos.
What makes Manim particularly interesting is that you don't need a traditional animation program to create these scenes. You can describe the animation using Python.
And that means mathematics can become something you program.
What is Manim?
Manim stands for Mathematical Animation Engine.
At its simplest, you can think of it like this:
Python code
↓
Mathematical objects
↓
Animations
↓
Rendered video
Instead of manually moving objects frame by frame, you tell Manim what you want to happen.
For example:
from manim import *
class HelloManim(Scene):
def construct(self):
text = Text("Hello, Manim!")
self.play(Write(text))
self.wait(2)
This creates a scene containing the text:
Hello, Manim!
and then animates the text being written onto the screen.
That's already pretty cool—but this is where Manim starts to become much more interesting.
Installing Manim
If you already have Python installed, you can install Manim with:
pip install manim
You can check whether the installation worked with:
manim --version
You will also need the dependencies required by your operating system for rendering videos. The exact setup can vary between Windows, macOS, and Linux, so it is worth checking the official Manim installation documentation if you run into dependency errors.
Your First Animation
Let's create something slightly more interesting.
Suppose we want a circle to appear and then grow.
from manim import *
class CircleAnimation(Scene):
def construct(self):
circle = Circle()
self.play(Create(circle))
self.play(circle.animate.scale(2))
self.wait(2)
There are only a few important ideas here.
Circle() creates the mathematical object.
circle = Circle()
Create() tells Manim to animate the creation of the object.
self.play(Create(circle))
And:
circle.animate.scale(2)
tells Manim to animate the circle becoming twice as large.
This is one of the things I like about Manim: the code describes the idea of the animation rather than every individual frame.
Understanding a Manim Scene
Most Manim programs begin with a class that inherits from Scene.
class MyScene(Scene):
def construct(self):
...
The construct() method contains the actual scene.
For example:
class MyScene(Scene):
def construct(self):
square = Square()
self.play(Create(square))
self.wait()
You can think of Scene as your canvas and construct() as the script that tells the canvas what should happen.
Manim then handles the actual rendering.
Animating Mathematics
This is where Manim becomes much more powerful than a normal animation library.
For example, we can create a coordinate plane and plot a function:
from manim import *
class GraphExample(Scene):
def construct(self):
axes = Axes(
x_range=[-4, 4],
y_range=[-2, 8],
axis_config={"include_numbers": True}
)
graph = axes.plot(lambda x: x**2)
self.play(Create(axes))
self.play(Create(graph))
self.wait(2)
Here we create:
- an x-axis
- a y-axis
- numerical labels
- the graph of (y=x^2)
The important part is:
graph = axes.plot(lambda x: x**2)
We are literally giving Manim a mathematical function.
And Manim turns it into a visual object.
Why Manim Is Different
There are plenty of animation tools available.
So why use Manim?
Because Manim is designed around a very specific idea:
mathematics should be programmable.
If you want to create a normal cartoon, Manim probably isn't the best tool.
But if you want to explain:
- calculus
- geometry
- probability
- linear algebra
- physics
- economics
- algorithms
- statistics
then Manim becomes extremely interesting.
For example, instead of simply writing:
GDP = C + I + G + (X - M)
you could animate each component appearing one at a time and show how the equation represents the economy.
You could visualize a supply-and-demand curve moving toward equilibrium.
You could animate a matrix transformation.
You could show a derivative geometrically.
The possibilities are much larger than simply drawing equations on a screen.
Manim Is More Than Mathematics
Although Manim was created for mathematical animation, it can also be used for general educational visualization.
You can create:
Text()
Circle()
Square()
Rectangle()
Line()
Arrow()
Dot()
and combine them into larger scenes.
You can also transform one object into another:
self.play(Transform(square, circle))
Now the square smoothly transforms into a circle.
This simple idea opens up a huge amount of creative possibility.
What I Want to Explore Next
The real fun with Manim begins when you stop thinking of it as a way to make equations appear and start thinking of it as a visual programming language.
Imagine explaining an economic model through animation.
Imagine visualizing a philosophical argument.
Imagine turning an algorithm into a short film.
Imagine explaining a mathematical proof as a sequence of visual transformations.
That is what makes Manim interesting to me.
It isn't simply about making mathematics look beautiful.
It is about finding ways to think visually.
Conclusion
Manim combines three things that normally exist in separate worlds:
programming + mathematics + animation.
And because everything is defined through Python, you don't have to manually animate every object.
You describe what should happen.
Manim does the rendering.
If you're interested in Python, mathematics, education, animation, or creative coding, Manim is definitely worth experimenting with.
And the best way to learn it is probably not by reading every available function in the documentation.
Start with one idea.
Then animate it.
Then make it more interesting.
Then make something that didn't exist before.
That's where the fun begins.
Top comments (0)