In a certain type of physics simulation (Lennard-Jones potentials), it is common to use functions of the form:
$f(x) = (\frac{1}{x})^{12} - (\frac{1}{x})^{6} - (\frac{q}{x})$
(where x is between 0 and infinity, q is a constant)
However these functions grow very rapidly with decreasing x < 1, and are undefined at x = 0. It would be very useful to have a modified function which is (almost) the same as the original when x >= 1, but grows less for x < 1, and has certain other nice properties:
- continuously differentiable (ideally twice)
- smooth (absolute value of the derivatives is as small as possible everywhere)
- difference from the original function is as small as possible for x >= 1
- $\lim_{x\to 0} f(x) $ is finite (nice if the value can be chosen at will)
- monotonic for 0 <= x < 1
- has a simple functional form which can be calculated efficiently on computer hardware (using add, subtract, multiply, divide, exp, sin and cos, and a relatively small number of floating point operations)
An example of the original function with q=0.1 (blue) and a modified function for x < 1 (orange; just sketched for illustration of what the modified function might look like, not actually based on a useful analytical expression):
I'm having a bit of trouble designing a function like that by hand. It seems like this can be done essentially by splicing together three functions: a constant for small x, some connecting function for somewhat larger x < 1, and the original function for x >= 1 (also making sure the derivatives are continuous at the splice points). I don't know what the connecting function should look like though, other than it should be a smooth transition (something like a spline).
If this is formulated as a multi-objective minimization problem (eg minimizing the max difference from the goal functions plus the max abs value of the derivative), I guess that could be done using some kind of basis set, but I don't know what basis set (and using a large basis set goes against the desire for having a simple functional expression). Maybe a spline where the spline coefficients are picked based on the minimization problem?
Is it possible to design a simple function that satisfies the above conditions? How would one go about finding it?

Local good results can be obtained by adjusting a smooth function like
$$ g(x,r,\mu,s) = \sum_{k=1}^nr_ke^{-\left(\frac{x-\mu_k}{s_s}\right)^2} $$
Follows a MATHEMATICA script showing that