Appendix A. Linear Algebra and Optimization Toolkit
This appendix collects linear algebra and optimization recipes that you can reuse across the book. The goal is not to replace a full linear algebra course, but to make the mathematical objects behind portfolio construction, regression, calibration, and risk aggregation explicit and directly implementable in Python.
This appendix focuses on the mathematical tools that turn financial quantities into
arrays, matrices, and optimization problems. Vectors and matrices provide the language
for returns, weights, exposures, and systems of equations. Inner products, norms, and
quadratic forms express portfolio returns, tracking errors, and variances.
Decompositions reveal factor structure and numerical stability, optimization routines
translate constraints and objectives into implementable portfolio and calibration
workflows, and symbolic differentiation with SymPy helps verify gradients before they
are coded numerically.
Vectors, Matrices, and Shapes
A vector is an ordered collection of numbers, and a matrix is a rectangular collection of numbers. In financial applications, vectors often represent asset returns, portfolio weights, factor exposures, or model parameters, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access