f(x) = If[0 ≤ x ≤ 4, 1 / 2 - (1 / 8 * x), 0]
a = Integral(f, -10, 10)
g(x) = If[x < 0, 0, If[0 ≤ x ≤ 4, (1 / 2 * x) - (1 / 16 * x^(2)), 1]]