Creating Designer Formulas for Color Shifting The Problem
I'm a software development. I work with basic math and formulas a lot--but very rarely do I get to work with more "fun" math problems.
This is one of those times.
I'm working on a program that sets LED colors based on temperature. However, because humans don't perceive color linearly, I've come up with a set of definitions to control how the color is represented. I'm a bit fuzzy on the mathematical representation of a few of these concepts, but I'm going to do my best.
For the purposes of this application:

*

*If the temperature is < 0 degrees fahrenheit, set it to 0 degrees

*If the temperature is > 110 degrees fahrenheit, set it to 110

*Work in the HSV color space and convert back to GRB at the end--this makes it easy to work with hues and saturations separately from brightness/value

GOAL:

*

*For temperatures between 0 and 32 degrees, as temp approaches 32, fade from solid blue (0, 0, 255 on a GRB spectrum) to solid white (255, 255, 255). This needs to occur on a curve, as linearly fading from blue to white "looks" like white at about half way.

*For temperatures from 32-70 degrees, as temp approaches 70, fade from solid white (255, 255, 255) to solid yellow (255, 255, 0). Again, this needs to occur on a curve, as a large set of "white-ish" colors look like solid white.

*For temperatures from 70-110, fade from yellow to red -- this can occur linearly, as it's a simple hue shift

Current Execution (Finally Getting to Math)
We're going to show steps 1 through 3 mathematically. Throughout these examples, the following definitions hold true:

*

*Hue is a number from 0 - 1 inclusive indicating where we fall rotationally on the color wheel. For example, yellow is 60/360, and red is 0/360.

*Saturation is a number from 0 - 1 inclusive indicating how much grey there is in a color. So, any hue with a saturation of 1 will translate to some set of equal values on the GRB spectrum, eg (255, 255, 255) if Value is 1 or ~(127, 127, 127) if Value is 0.5.

*Value is a number from 0 - 1 inclusive and is the overall brightness, or the distance from "black". So, regardless of Saturation or Hue, if Value is 0, we have black. For our purposes, value will always be 1.0.
Temps from 0-32
$Hue=2/3$
$x=temp*10/32$
$Saturation=1-\frac{1.4^{x-7}}{1.4^3}$
Forcing temp onto a 0-10 scale makes it much easier to design a function that graphs how we want.
Temps from 32-70
$Hue=60/360$
$tempRange=70-32$
$tempValue=temp-32$
$x=tempValue*10/tempRange$
$Saturation=1-\frac{1.5^{-x-3}}{1.5^-3}$
Temps from 70-110
$Hue=(\frac{60}{360})-(\frac{temp-70}{110-70}*\frac{60}{360})$
$Saturation=1.0$
Wrapping Up and Asking the Question
With that background finally covered, we can get to the issue I'm having and the question. Formula 3 is working perfectly. It's a very simple rotational transformation of hue. The other two are super close to what I need, but they're not exactly what I want. Ideally, for both of them, I would have a function with a domain of $[0,10]$ and a range of $[0,1]$. Technically the domain could be any set of continuous values -- for the first formula, it would make sense to have a domain of $[0,32]$. But it seems easier to me to design a function with a domain of $[0,10]$, so I'm normalizing my temperature range to that domain.
What I actually have, rather than a function with this domain, is a function that intercepts one of the range-ends and comes very close to the other one:

*

*For the first equation, in the domain $[0, 10]$, $y$ never quite reaches 1 (meaning we never quite reach "blue"), but intersects the x-axis at exactly $x=10$

*For the second equation, in the domain $[0,10]$, y does pass through the origin, but is not quite 1 at $x=10$
The benefits of these equations are that I can change the bases to change the severity of the curve, making adjusting the curves to the human eye relatively easy. However, their range isn't quite what I want. Mathematically speaking, how could I go about solving for an equation that accomplishes both of my needs: Being able to control the severity of the curve, but also holding to a specific domain and range?
 A: Before anything else, we'll establish some terms and conditions.

*

*The variable $t$ is the temperature, and can take values from the set of real numbers.

*The variables $h$, $s$, and $v$ are the hue, saturation, and value of the color, respectively.

*The functions $H$, $S$, and $V$ will take the value of $t$ (without the unit) and $(H,S,V)$ will be the color depending on $t$.

*$H$ will have an output that is in the interval $[0^{\circ},360^{\circ}]$.

*Because it is declared that value of the color is always $1$, we declare $V(t) = 1$ for all $t$.


To work out this problem, we'll solve for a function for each case.

*

*$t < 0^{\circ}\mathrm{F}$ (The temperature is less than $0^{\circ}\mathrm{F}$).


*

*In this case, we set $t = 0^{\circ}\mathrm{F}$. This will make $t \leq 0^{\circ}\mathrm{F}$.

*The color should be a solid blue $(240^{\circ}, 1, 1)$.

*The functions would be:
\begin{align*}
    H(t) &= 240^{\circ} \\ 
    S(t) &= 1
\end{align*}


*$0^{\circ}\mathrm{F} < t < 32^{\circ}\mathrm{F}$ (The temperature is greater than $0^{\circ}\mathrm{F}$, but less than $32^{\circ}\mathrm{F}$).


*

*In this case, the color should fade from solid blue $(240^{\circ}, 1, 1)$ to solid white $(240^{\circ}, 0, 1)$.

*The functions would be:
\begin{align*}
    H(t) &= 240^{\circ} \\
    S(t) &= -\frac{1}{32}t + 1
\end{align*}


*$32^{\circ} \leq t < 70^{\circ}\mathrm{F}$ (The temperature is greater than or equal to $32^{\circ}\mathrm{F}$, but less than $70^{\circ}\mathrm{F}$).


*

*In this case, the color should fade from solid white $(60^{\circ}, 0, 1)$ to solid yellow $(60^{\circ}, 1, 1)$.

*Because it is not declared how the color should fade, we'll assume that it behaves linearly.

*The functions would be

\begin{align*}
    H(t) &= 60^{\circ} \\
    S(t) &= \frac{1}{38}t
\end{align*}


*$70^{\circ}\mathrm{F} \leq t < 110^{\circ}\mathrm{F}$ (The temperature is greater than or equal to $70^{\circ}\mathrm{F}$ but less than $110^{\circ}\mathrm{F}$.)


*

*In this case, the color fades from solid yellow $(60^{\circ}, 1, 1)$ to solid red $(0^{\circ}, 1, 1)$.


*The functions would be:
\begin{align*}
    H(t) &= -\frac{3}{2}t + 60 \\
    S(t) &= 1
\end{align*}


*$t > 110^{\circ}\mathrm{F}$ (The temperature is greater than $110^{\circ}\mathrm{F}$).


*

*In this case, we set $t = 110^{\circ}\mathrm{F}$. This will make $t \geq 110^{\circ}\mathrm{F}$.

*Because the color is not declared for this interval, we set it to solid red $(0^{\circ}, 1, 1)$ for continuity of the color.

*The functions would be
\begin{align*}
    H(t) &= 0^{\circ} \\
    S(t) &= 1
\end{align*}

To sum everything up,
\begin{align*}
    H(t) &=
    \begin{cases}
        240^{\circ} & \text{if} & t < 32^{\circ}\mathrm{F}, \\
        60^{\circ} & \text{if} & 32^{\circ}\mathrm{F} \leq t < 70^{\circ}\mathrm{F}, \\
        -\frac{3}{2}t + 60 & \text{if} & 70^{\circ}\mathrm{F} \leq t < 110^{\circ}\mathrm{F}, \\
        0^{\circ} & \text{if} & t \geq 110^{\circ}\mathrm{F}
    \end{cases} \\
    S(t) &= 
    \begin{cases}
        1 & \text{if} & t \leq 0^{\circ}\mathrm{F}, \\
        -\frac{1}{32}t + 1 & \text{if} & 0^{\circ}\mathrm{F} < t < 32^{\circ}\mathrm{F}, \\
        \frac{1}{38}t & \text{if} & 32^{\circ}\mathrm{F} \leq t < 70^{\circ}\mathrm{F}, \\
        1 & \text{if} & t \geq 70^{\circ}
    \end{cases} \\
    V(t) &= 1
\end{align*}

For the issue on linearly fading colors, you can define any function so long as it satisfies the correct bounds. However, it is quite unclear how you want to define the color based on the "position" on the interval, hence, I used linear relations to have a constant change in values.

Ideally, for both of them, I would have a function with a domain of $[0,10]$ and a range of $[0,1]$.

Some scaling can be made, though it would be easier to fix the function if it matches the domain of $t$. Take $[0,32]$ as an example. Considering that the function will have $[0,10]$ as the domain, we'll need two functions - one for mapping values from $[0,32]$ to $[0,10]$, and one for mapping values from $[0,10]$ to $[0,1]$. By composing both functions, we get the same function which is the function that maps values from $[0,32]$ to $[0,1]$.
I also didn't make the range $[0,1]$ as it would need another function to apply this to the color.
In case that you need to clarify something, feel free to comment in this answer.
