import matplotlib.pyplot as plt targetX = 10.0 step = 0.1 axis1, axis2 = 0.0, 1.0 X, Y = [axis1], [axis2] def fun(axis1:float, axis2:float): return axis2 - 2 * axis1 / axis2 while axis1 <= targetX: t1 = fun(axis1, axis2) t2 = fun(x + step, axis2 + t1 * step) axis2 = axis2 + 0.5 * (t1 + t2) * step axis1 = axis1 + step X.append(axis1) Y.append(axis2)