Edit or run this notebook

Two by Two Matrix Jacobians

168 μs

This notebook emphasizes the multiple views of Jacobians with examples of 2x2 matrix functions.

In particular we will see the

  • Symbolic "vec" format producing 4x4 matrices (generally n² by n² or mn by mn)

  • Numerical formats

  • The important Linear Transformation view

  • Kronecker notation

  • An example using ForwardDiff automatic differentiation

We also emphasize that matrix factorizations are also matrix functions, just as much as the square and the cube.

2.4 ms
3.6 s
4.3 ms

Symbolic Matrices

134 μs
101 ms

[rcos(θ)rsin(θ)rsin(θ)rcos(θ)]

10.8 s
X

[prqs]

18.1 ms

vec

The vec command in Julia and in standard mathematics flattens a matrix column by column.

186 μs
8.7 μs

1) The matrix square function

135 μs

[p2+qrpr+rspq+qsqr+s2]

674 ms
2.5 ms

Symbolic Jacobian

The Jacobian of the (flattened) matrix function X² symbolically

166 μs
jac (generic function with 1 method)
292 μs
J

[2prq0qp+s0qr0p+sr0rq2s]

1.2 s

Numerical Jacobian

125 μs

[2230350320520238]

985 ms
92.4 ms
2×2 Matrix{Float64}:
 0.00140007  0.0020001
 0.00300015  0.00440022
67.0 ms

Linear Transformation Jacobian

Notice: there is no flattening; this is just matrix to matrix.

160 μs
Loading...
ii