Demo problem 1 for horsetail matching, takes two input values of
    size 1

def TP3(x, u, jac=False):
    '''Demo problem 1 for horsetail matching, takes two input values of
    size 1'''

    q = 2 + 0.5*x + 1.5*(1-x)*u
    if not jac:
        return q
    else:
        grad = 0.5 -1.5*u
        return q, grad