I want to implement a classical servo-like loop equation. For example, if
A is gain, then:
Af=A/(1-b*A), where Af is the resulting feedback gain, and B is beta, the sampled portion that must be updated to maintain a set point output of the loop's output. The loop could be a controller of room temperature.

We don't usually give people code if they haven't actually attempted anything yet. We will help you if you get stuck with your code, but we won't write it for you. What I will do, is offer you some guidance as to how to solve this. Write a function where you take gain and beta as arguments and check for invalid values: gain cannot be 0 or 1/beta (division by zero or infinite gain). Calculate the resulting feedback gain using the formula Af = gain / (1 - beta * gain). Return that value as your result. This is a simple function to write because you already know the formula. (Hint - use floating point numbers).

slope