code: def TP1(x, u, jac=False):
      '''Demo problem 1 for horsetail matching, takes two input vectors of size 2
      and returns just the qoi if jac is False or the qoi and its gradient if jac
      is True'''
      factor = 0.1*(u[0]**2 + 2*u[0]*u[1] + u[1]**2)
      q = 0 + factor*(x[0]**2 + 2*x[1]*x[0] + x[1]**2)
      if not jac:
          return q
      else:
          grad = [factor*(2*x[0] + 2*x[1]), factor*(2*x[0] + 2*x[1])]
          return q, graf TP1(x, u, jac=False):
      '''Demo problem 1 for horsetail matching, takes two input vectors of size 2
      and returns just the qoi if jac is False or the qoi and its gradient if jac
      is True'''
      factor = 0.1*(u[0]**2 + 2*u[0]*u[1] + u[1]**2)
      q = 0 + factor*(x[0]**2 + 2*x[1]*x[0] + x[1]**2)
      if not jac:
          return q
      else:
          grad = [factor*(2*x[0] + 2*x[1]), factor*(2*x[0] + 2*x[1])]
          return q, grad
docs: Demo problem 1 for horsetail matching, takes two input vectors of size 2
      and returns just the qoi if jac is False or the qoi and its gradient if jac
      is True