For an application that I’m working on, I needed a way to scale quantities that range (theoretically) over the real numbers (though practically are probably between plus and minus three) into positive numbers. I wanted the function to be everywhere increasing, I wanted , and I wanted control of the derivative at .
The easy choice is: . This is monotonically increasing. and .
I needed to scale three such quantities and mush them together. I thought it’d be spiffy then to have three different functions that satisfy my criteria. The next logical choice was . It is everywhere positive and increasing. And, it has .
Now, I needed third function that was always positive, always increasing, had and . One choice was: . But, that seemed like overkill. It also meant that I really had to keep my tiny if I didn’t want to scale things into the stratosphere.
Playing with hyperbolas
So, I thought… why don’t I make a hyperbola, rotate it, and shift it so that the apex of one side of the hyperbola is at . And, I can adjust the parameters of the hyperbola so that . After a variety of false starts where I tried to keep the hyperbola general until the very end (, rotated by degrees, and shifted by ), I quickly got bogged down in six or seven incredibly ugly equations in eight or nine variables.
So, it was time to start trying to make it easy from the beginning. I noticed that if was going to rotate it by an angle in the clockwise direction, then I needed to be such that if my slope was going to work out right in the end. So, I’m looking at the basic triangle on the right then to determine all of my sines and cosines and such.
Based on that triangle, it was also obvious that the asymptote for my starting hyperbola had to have . I played around a bit then with making and . In the end, I found things simplified sooner if I started with and .
I also needed to be such that the point rotate up so that its -coordinate was . This meant that or .
So, my starting hyperbola then was: .
From there, I had to rotate the and by in the clockwise direction. This gave me:
A little multiplying out leads to:
From there, using , , and , we come to:
The only step remaining was to shift it all over so that when , we end up with . Plugging in , we see that . That equation balances when . We want it to balance when , so we’re going to substitute in place of the in the above equation to get:
We can easily verify that the point is on the curve. And, we can implicitly differentiate the above to get:
Plopping and in there, we find that .
This is pretty good as it goes. The only step is to complete the square to find a nicer expression for in terms of . We start by adding to both sides to get:
This is easy enough to solve for by taking the square root of both sides and shuffling some things about:
Here are all three curves with . The exponential is in black, the hyperbolic tangent is in red, and the hyperbola is in blue:
The first image on the page here was made with Zach’s Vecto library with some post-processing in the GIMP. (Here is the source file: hyperbola.lisp.) The second image was made entirely within the GIMP. And, the last image was made using Foo Plot and the GIMP.