f0(x) = 1.0 / 2.0
f1(x) = 2.0 / 3.141592653589793 * cos(x)
f2(x) = -(2.0) / (3.0 * 3.141592653589793) * cos(3.0 * x)
f3(x) = 2.0 / (5.0 * 3.141592653589793) * cos(5.0 * x)
f4(x) = -(2.0) / (7.0 * 3.141592653589793) * cos(7.0 * x)
f5(x) = 2.0 / (9.0 * 3.141592653589793) * cos(9.0 * x)
oq(x) = 1.0 / 2.0 * sgn(cos(x)) + 1.0 / 2.0
f6(x) = -(2.0) / (11.0 * 3.141592653589793) * cos(11.0 * x)
n = 0 (slider from 0 to 10, step 1)
f7(x) = 2.0 / (13.0 * 3.141592653589793) * cos(13.0 * x)
f8(x) = -(2.0) / (15.0 * 3.141592653589793) * cos(15.0 * x)
f9(x) = 2.0 / (17.0 * 3.141592653589793) * cos(17.0 * x)
f(x) = sgn(Max[0.0, n]) * f0(x) + sgn(Max[0.0, n - 1.0]) * f1(x) + sgn(Max[0.0, n - 2.0]) * f2(x) + sgn(Max[0.0, n - 3.0]) * f3(x) + sgn(Max[0.0, n - 4.0]) * f4(x) + sgn(Max[0.0, n - 5.0]) * f5(x) + sgn(Max[0.0, n - 6.0]) * f6(x) + sgn(Max[0.0, n - 7.0]) * f7(x) + sgn(Max[0.0, n - 8.0]) * f8(x) + sgn(Max[0.0, n - 9.0]) * f9(x)
d(x) = oq(x) - f(x)