quadratic cost function example