Taylor approximation

Part of Calculus in motion

Taylor approximation preview
remixableManimCE2Dseriesloop

cos(x) sitting in the neutral field with its Taylor polynomial about zero laid over it, hugging the curve near the origin and peeling away past the radius where it stops being useful. The loop climbs the degree term by term rather than snapping between them, so the polynomial grows into place, then holds on the degree-6 frame the still shows.

manim/taylor_approximation.py

"""Taylor approximation: a polynomial growing degree by degree onto cos(x).

Render (the driver does this for every palette; these are for eyeballing):
    P=/opt/homebrew/opt/python@3.11/bin/python3.11
    ASSET_MODE=still  $P -m manim -s -t -r 1600,1600 manim/taylor_approximation.py TaylorApproximation
    ASSET_MODE=motion $P -m manim -qh   -r 1600,1600 manim/taylor_approximation.py TaylorApproximationLoop
"""

import math

import numpy as np
from manim import (
    DOWN,
    LEFT,
    UP,
    Dot,

The full Manim source and the rendered video come with a plan.