# Closed form solution of equation by finding a suitable function

Starting with a sum such as $$\sum_{i} b_{i}$$, where $$b_{i} > 0$$ are real numbers for all $$i$$ under consideration, I have a corresponding vector of real numbers $$a_{i} > 0$$ for all $$i$$. I want to form the sum $$\sum_{i} f(a_{i})b_{i}$$ and then scale it with a constant $$\gamma > 0$$ such that

$$\gamma\sum_{i} f(a_{i})b_{i} = \sum_{i} b_{i}$$, (*)

under the conditions that

1. $$\gamma f(x) = 0.7$$ for all $$\gamma x \leq 0.7$$
2. $$0.7 \leq \gamma f(x) \leq 2$$ for all $$0.7 \leq \gamma x \leq 2$$
3. $$\gamma f(x) = 2$$ for all $$\gamma x > 2$$.

One solution I thought about is letting $$f$$ be defined by

$$f(x, \gamma) = min(\frac{2}{\gamma}, x) + \frac{0.7}{\gamma} - min(\frac{0.7}{\gamma}, x)$$,

which I believe would satisfy all the above constraints. I have not been able to find a closed form solution to (*) using such an $$f$$ (it seems to me it is not possible). I have solved this for $$\gamma$$ numerically using the bisection method, since

$$g(\gamma) = \gamma\sum_{i} f(a_{i}, \gamma)b_{i} - \sum_{i} b_{i}$$ is a continuous increasing function with one root.

I have two questions:

1. Can anyone think of any ways that might solve the problem using a different $$f$$, that might result in a closed form solution?
2. Are there any approaches that might result in a closed form solution to the problem using the $$f$$ I have tried?

I am not sure what are appropriate tags for this problem. Thank you in advance to anyone that took the time to read this post.

Edit: I should also mention that preferably I would like all factors $$\gamma f(a_{i})$$ that are not set to either 0.7 or 2 to be adjusted by the same constant.