I’ve posted a new lecture that provides an introduction to sparse partial derivatives. This lecture uses a simple beam moment calculation, with vector inputs and outputs with fairly sparse partial derivatives.

The derivatives are a little tricky to get right, and I walk through how the code structure should look and ways to debug as you go.