Based on this question, how to write a cycle to get a similar result as in the cycle below for a linear function, please? I do not know how to write a cycle.