Manim stands for “Math Animation”. The Community Manim Python package is a publically maintained, open-source commmunity version of a custom Python package initially created by Grant Sanderson, more commonly known as 3Blue1Brown.
Manim provides tools that can bring mathematical ideas and concepts to life that static words and explanations may not capture. As an example, the TBIL.org 3
. Follow the instructions there to obtain an interface for authoring Manim content using just your web browser (Chrome/Edge/Firefox recommended).
Section8.3Hello World!
Let’s run our very first Manim animation.
Activity8.3.1.
Open main.py and look for the line class HelloWorld(Scene):.
(a)
Open a Terminal and execute the command manim render -ql main.py HelloWorld. (See the README file for other options to render Manim scenes.)
(b)
Open the file media/videos/main/480p15/HelloWorld.mp4 to view your newly rendered video.
(c)
See if you can add these lines to the code so the video ends by saying “My name is YOUR NAME HERE”.
name = MathTex(r"\text{My name is YOUR NAME HERE.}")
self.play(Transform(hello, name))
Don’t forget to re-run manim render -ql main.py HelloWorld to update your rendered video.
(d)
See if you can make the circle GREEN instead of PINK.
Section8.4More Animations
Activity8.4.1.
Open main.py and look for the line class TanLine(Scene):.
Review the comments and the code within this block. This particular scene TanLine creates a curve, displays the algebraic work needed to find a tangent line, and then displays said tangent line.
(a)
Run manim render -ql main.py TanLine to produce a video file at media/videos/main/480p15/TanLine.mp4.
(b)
Edit the code to find and display the line tangent to the curve when \(x=2\text{.}\)
(c)
Change the window so that \(x\) ranges from \(0\) to \(10\text{.}\)
(d)
Choose a function \(f\) and \(x\) value of your choice, and edit the code to find and display the line tangent to \(y=f(x)\) at your chosen \(x\) value.
tool can be very helpful in determining appropriate window sizes and scaling.
Activity8.4.2.
Open main.py and look for the line class SinChange(Scene):.
This particular block of code plots a transformed sine function of the form \(y=a\sin(bx)+c\text{.}\) Where initially \(a=1, b=1, c=0\text{.}\) We then adjust the values for \(a, b\) and \(c\) over time.
(a)
Run the code to produce a video file.
(b)
Edit the array a=[1,2, 2, 2, -1/3], and the rhs entries to adjust the vertical stretch.
(c)
Edit the array b=[1,1, 1/2,1/2,-2], and the rhs entries to adjust the horizontal stretch.
(d)
Edit the array c=[0,0, 0, -3, 2], and the rhs entries to adjust the vertical shift.
Activity8.4.3.
Open main.py and look for the lines class FindProduct(Scene):, class FindQuotient(Scene):, and class FindPower(Scene):.
The scene FindProduct displays a product rule computation, FindQuotient displays a quotient rule computation, and FindPower displays a faux-quotient rule computation using powers.
(a)
Run the function FindProduct to produce a video file.
(b)
Pick your favorite product of functions and edit the code to produce the appropriate derivation.
(c)
Copy and paste the FindProduct function and rename it FindChain.
(d)
Edit this new command to display an animation for your favorite chain rule derivation.
Activity8.4.4.
Open main.py and look for the line class Riemann(Scene):.
This code displays a Riemann sum for a funcion, and displays the ongoing sum for \(R_n\text{.}\)
(a)
Run the code to see the output.
(b)
Change the function to a function of your choice. You may need to resize the window. Recall the identitites