function pos_definite(x1::Float64, x2::Float64)
= [1.0 0.0; 0.0 1.0]
A = [x1; x2]
x ' * A * x
xend
pos_definite (generic function with 1 method)
Alicia
March 19, 2024
These functions implement the expression, which can calculate scalar quantities when given x1
and x2
components of a 2-element vector.
\[ f(\mathbf x) = \mathbf x^T \mathbf A \mathbf x \]
In this case, I take the matrix A to positive definite or negative definite. Then, I pass the same vectors into the function to see the behavior of positive or negative definite matrices.
The 2x2 identity matrix is positive definite:
\[ \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} \]
The following 2x2 matrix is negative definite:
\[ \begin{bmatrix} -1 & 0 \\ 0 & -2 \\ \end{bmatrix} \]