Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

MAGNUM (AI Math Animator powered by GPT-3 and Wolfram Alpha)

All Contributors

Visualize Beautiful Math solutions

Manim Logo

Initial release date: 15 August 2020

Fork Credits: The gpt3-sandbox project was taken as the starting point for this project. We would like to thank the authors of GPT-3-Sandbox for all their help. :)


The goal of this project is to create an Open Source toolkit that makes Math animations effortless. Either from a plain English query or from formatted LaTeX! NO PYTHON CODING NEEDED.

This project addresses the following issues:

  1. Create an end to end package using Wolfram Alpha and GPT-3 to visualize Step-by-step Math soultions to user questions.
  2. Create a standalone package which enables you to convert LaTeX into beautiful animations without any knowledge of Manim.

For full docs and detailed information, have a look at our website: .

Magnum Lite

Before we get to Setting up, we would like to point out that we have made a special NO-CODE + BROWSER-BASED (Cloud hosted) Playground for Magnum Lite (!). If you are not much into software and code, this might be a nice option for you. Have a look at the detailed comparison here.


First, clone or fork this repository. Then to set up your virtual environment, do the following:

  1. Create a virtual environment in the root directory: python -m venv $ENV_NAME
  2. Activate the virtual environment: source $ENV_NAME/bin/activate (for MacOS, Unix, or Linux users) or .\ENV_NAME\Scripts\activate (for Windows users)
  3. Install requirements: pip install -r requirements.txt
  4. To add your OpenAI Secret Key: Open the file called openai in the api_keys folder and add your Seceret Key there $YOUR_SECRET_KEY, where $YOUR_SECRET_KEY looks something like 'sk-somerandomcharacters' (excluding quotes). If you are unsure what your secret key is, navigate to the API docs and copy the token displayed next to the "secret" key type.
  5. To add your Wolfram Alpha AppID: open the file called appid int the api_keys folder and add your AppID there $YOUR_SECRET_KEY, where $YOUR_SECRET_KEY looks something like 'ZHR$%D-GET$%ASBF$' (excluding quotes).

(For detailed Setup information for the no code playground, check our website)

Interactive Priming

The real power of GPT-3 is in its ability to learn to specialize to tasks given a few examples. However, priming can at times be more of an art than a science. Using the GPT and Example classes, you can easily experiment with different priming examples and immediately see their GPT on GPT-3's performance. Below is an example showing it improve incrementally at translating English to LaTeX as we feed it more examples in the python interpreter:

>>> from api import GPT, Example, set_openai_key
>>> gpt = GPT()
>>> set_openai_key(key)
>>> prompt = "integral from a to b of f of x"
>>> print(gpt.get_top_reply(prompt))
output: integral from at to be of f of x

>>> gpt.add_example(Example("Two plus two equals four", "2 + 2 = 4"))
>>> print(gpt.get_top_reply(prompt))

>>> gpt.add_example(Example('The integral from zero to infinity', '\\int_0^{\\infty}'))
>>> print(gpt.get_top_reply(prompt))
output: \int_a^b f(x) dx

Using Custom Priming Data

We have provided you with the basic priming data for the text to Manim GPT-3 model. The LaTeX conversion is slightly non standard as the text is interperetd in TeX so to introduct spacing we have to insert a " / ". Another way of doing this is by explicitly declaring text as \text{Your Text Here}.

If you wish to provide your own examples for priming you can edit the files in the "Training_Examples" directory.

A note if you are using Non-Standard LaTeX packages

We use Manim to animate the solution from Wolfram. Follow the instructions at manim github page to get Manim up and running.

If your LaTeX code uses non-standard or additional packages you will need the manim source code and NOT the "pip" version .

Again the instructions to install the required version are given on Manim github page or you can follow the Manim docs here

For non standard LaTeX packages, follow this amazing video

Rendering options for manim

Manim provides you with a full array of rendering options from setting aspect ratios to resoultion and framerate.

Follow the video here to get insight on all the options


We actively encourage people to contribute by adding their own examples or even adding functionalities to the modules. Please make a pull request if you would like to add something, or create an issue if you have a question. We will update the contributors list on a regular basis.

Please do not leave your secret key and/or AppID in plaintext in your pull request!

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Shreenabh Agrawal

πŸ› πŸ’» πŸ–‹ πŸ“– 🎨 πŸ“† ⚠️

Mayur Selukar

πŸ’» πŸ› πŸ“– 🎨 ⚠️


πŸ’» πŸ› ⚠️

Kartik Kinge


This project follows the all-contributors specification. Contributions of any kind welcome!