Chasing tangent

Part of Calculus in motion

Chasing tangent preview
remixableManimCE2Dderivativeloop

A cubic in the neutral field with one tangent line riding it, plus the small rise-over-run triangle that makes the slope concrete. The loop drives the contact point out to each end of the curve and back in a single period, so the tangent visibly flattens through the turning points and the loop closes where it began.

manim/chasing_tangent.py

"""Chasing tangent: a tangent line sliding the length of a cubic.

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/chasing_tangent.py ChasingTangent
    ASSET_MODE=motion $P -m manim -qh   -r 1600,1600 manim/chasing_tangent.py ChasingTangentLoop
"""

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

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