Python Same Method Differential Calculus