For unconstrained optimization, the main goal is to find local maxima. In a univariate, twice-differentiable function, the procedure is 1) find critical points by setting the gradient equal to zero and solving, then 2) perform a second derivative test to figure out the concavity of the function and categorize the critical points found.
real-valued diagonal matrix with positive diagonal entries is positive definite since all eigenvalues are diagonal entries, making them real and positive
def is_positive_definite(A): """Apply Sylvester's Criterion to check if a matrix is positive definite. Inputs: - A: A symmetric matrix Output: - True if the matrix is positive definite, False otherwise """ # Ensure matrix is symmetric if A.is_symmetric(): print(f"Matrix is not symmetric") return False n = A.nrows() # Loop through submatrices for k in range(1, n+1): # Extract the top-left k x k submatrix submatrix = A[:k, :k] determinant = submatrix.det() # If any determinant is non-positive, the matrix is not positive definite if determinant <= 0: print(f"Submatrix {k}x{k}: \n{submatrix}\nDeterminant: {determinant}") return False return TrueA = Matrix(QQ, [ [4, 12, -16], [12, 37, -43], [-16, -43, 98]])is_positive_definite()