Probability, Statistics, Data Science, Mathematics.
derivative sends us off into x being negative, where the equations are undefined. If this happens, just set x to 1 for the next step. Once iteration is complete, the resulting x should be floored to give an integer, eg 3.98 -> 3. In most programming langauges, just casting to an Integer will do