forward_difference_code function

Use forward difference coding