Cost surface

Cost surface preview
remixableManimCE3Doptimisationturntable

manim/cost_surface.py

"""Cost surface: the cost over two weights, a ball stepping down it.

The surface from the explainer in video/make-it-yours: a tilted bowl with
dents in it, drawn as a checkerboard sheet over a grid floor, a ball on it
with a dashed stick down to the weights it stands for.

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 -r 1600,1600 manim/cost_surface.py CostSurface
    ASSET_MODE=motion $P -m manim -qh   -r 1080,1080 manim/cost_surface.py CostSurfaceLoop
"""

import numpy as np
from manim import (
    DEGREES,
    DashedLine,

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