def num2coords(i, gridwidth=10):
    """
    Coordinates of variable i in a Gibbs grid
    
    Parameters
    ----------
    i : int
        Position of variable in ordering
    gridwidth : int
        Width of the grid

    Returns
    -------
    length_coord, width_coord (coordinates)
    """
    length_coord = i % gridwidth
    width_coord = i // gridwidth
    return int(length_coord), int(width_coord)