This is called "A Gentle Introduction to the Hessian Matrix"
Hessians are somewhere between #linearalgebra #calculus and #rstats but still a core aspect of #datascience
All in all, building and deriving things like these are probably only useful when developing a unique solution. For the vast majority of cases, having a general understanding is enough.
... actually, I am pretty sure that there is a #python library for just such an occasion (I have never looked though so ymmv)