Defining and differentiating vector-valued functions