Step 3: Expand to the rational numbers
Author: Andreas Bauer

Use the sliders on the right to vary the red function's parameters. Use the step length slider on the left to move from integer interval lengths to rational ones.

Step length

δ = 1 (slider from 0.1 to 1, step 0.01)
c = 0 (slider from -5 to 5, step 0.1)
a = 0.1 (slider from -0.5 to 0.5, step 0.01)
b = 0 (slider from -5 to 5, step 0.1)
funktion = Sequence((z, a * z^(3.0) + b * z + c), z, -5.0, 5.0, δ)
differenzenfolge = Sequence((x(Element[funktion, n]), 1.0 / δ * (y(Element[funktion, n + 1.0]) - y(Element[funktion, n]))), n, 1.0, Length[funktion], 1.0)
dflinien = Sequence(Segment[Element[differenzenfolge, n], Element[differenzenfolge, n + 1.0]], n, 0.0, Length[funktion], 1.0)
flinien = Sequence(Segment[Element[funktion, n], Element[funktion, n + 1.0]], n, 0.0, Length[funktion], 1.0)
g(x) = a * x^(3.0) + b * x + c
f(x) = g'(x)
text1: "Red graph: " + a + "x³" + (If[b > 0.0, "+" + b + "x", If[b < 0.0, b + "x", ""]]) + (If[c > 0.0, "+" + c, If[c < 0.0, "" + c, ""]])