def derive(y,t,N, beta, gamma):        
    """The SIR model differential equations."""

    S, I, R = y
    dSdt = -beta * S * I / N
    dIdt = beta * S * I / N - gamma * I 
    dRdt = gamma * I
    return dSdt, dIdt, dRdt