def M_from_t(t,n,M0,t0):
    """
    find mean anomaly at time t

    Parameters
    ----------
    t
        time to find M for
    n
        mean motion
    M0
        reference mean anomaly at time t0
    t0
        reference time t0

    Note that M = 0 at pericentre so if t0 = pericentre passage time then M0 = 0
    """

    M = M0 + (n*(t-t0))
    return M