Page MenuHomec4science

quadratic_function.py
No OneTemporary

File Metadata

Created
Sun, Apr 28, 03:06

quadratic_function.py

import numpy as np
# This function implements S(x) as given in the exercise sheet
def quadratic_function(x):
# create column vector of input array
x.reshape(-1, 1)
# create matrix and vector coefficients of S(x) given in exercise sheet
A = np.array([[4, 0], [1, 3]])
b = np.array([0, 1]).transpose()
# return S(x)
return (x.transpose() @ A) @ x - x.transpose() @ b

Event Timeline