def vectorfield(w, t, p):
    """Defines the differential equations for the coupled 
    spring-mass system. Arguments:
        w :  vector of the state variables: w = [x1,v1,x2,v2]
        t :  time
        p :  vector of the parameters: p = [m,k] 
    """
    x1, v1, x2, v2 = w
    m, k = p

    # Create f = (x1',y1',x2',y2'):
    f = [v1, (-k * x1 + k * (x2 - x1)) / m, v2, (-k * x2 - k * (x2 - x1)) / m]

    return f