u_0

f(x) = cos(x)
u_0 = 1.9 (slider from -1 to 5, step 0.1)
n = 6 (slider from 1 to 40, step 1)
A: (u_0, 0.0)
B: (u_0, f(u_0))
L1 = IterationList(f, u_0, n)
list1 = Sequence(Segment[(Element[L1, i], Element[L1, i + 1.0]), (Element[L1, i + 1.0], Element[L1, i + 1.0])], i, 1.0, n - 1.0)
list2 = Sequence(Segment[(Element[L1, i], Element[L1, i]), (Element[L1, i], Element[L1, i + 1.0])], i, 2.0, n - 1.0)
b = Segment(B, A)