Javascript Array Reduce Initial Value Problem Differential Equation