Not a piecewise function with a "ceiling".

18 Views Asked by At

There is a function $$f(n,i,m) =i-1+m$$ Where m and n are actually constants and are set separately each time, and i changes its value from 1 to n inclusive, but when the value of the function becomes greater than n, it must take a value equal to n.

This can be done by making the function piecewise, but I don't like this solution and I'm wondering if it's possible to implement it in any other way?