def get_trajectory(fnc, x0, steps):
    """
    First, a function to calculate the trajectory. Takes a function,
    a starting x-value, and a number of steps. Returns a pair of lists:
    (time, trajectory).
    """
    step = 0
    xx = x0
    time = list(range(steps+1))
    trajectory = [x0]
    while step < steps:
        step += 1
        xx = fnc(xx)
        trajectory.append(xx)
    return (time, trajectory)