thirdOrderLossFunction

open override fun thirdOrderLossFunction(x: Double): Double(source)

G3(x) = (1/6) * Emax(X - x, 0) * max(X - x - 1, 0) * max(X - x - 2, 0).

Accumulated from G2 rather than given a closed form. The third binomial moment of a negative binomial is r(r+1)(r+2)*b^3 with b = (1-p)/p, and the rest is the tail sum that relates consecutive orders. Deriving the closed form is more work than the loop is to run at the stock levels this is used for.