Typescript Array Reduce Initial Value Differential Equation