def finite_diff_kauers(sum):
 function = sum.function
 for l in sum.limits:
  function = function.subs(l[0], (l[(-1)] + 1))
 return function

def finite_diff_kauers ( sum ) : function = sum . function for l in sum . limits : function = function . subs ( l [ 0 ] , ( l [ ( - 1 ) ] + 1 ) ) return function
takes as input a sum instance and returns the difference between the sum with the upper index incremented by 1 and the original sum .