f = If(0 ≤ x ≤ 4, -x^(3) + 5 * x^(2) + 8 * x)
g = If(4 < x ≤ 8, -x^(3) + 10 * x^(2) + 2 * x)