# Multiplying a number proportionally

I'm trying to create a formula for a weather-related task. I need the output to reflect the current temperature.

My range of temps is about $-15C$ to $+35C$, with outputs from $0.2$ to $0.7$. For example, the inputs and outputs should roughly be:

\begin{array}{c|lcr} T & \text{Y} \\ \hline 35 & 0.2 \\ 25 & 0.3 \\ 15 & 0.4 \\ 5 & 0.5 \\ -5 & 0.6 \\ -15 & 0.7 \\ \end{array}

Obviously a temp of $10C$ would result in $0.45$, $12.5C$ would be $0.475$, etc.

Can anyone please advise how I would multiply the temperature to produce the output I need?

Thanks

• So what you want is a formula that matches the temperatures to the outputs? – Arnaud D. Jun 21 '17 at 8:58
• Why don't you plot the numbers ? – Claude Leibovici Jun 21 '17 at 9:01

Let $T$ be the temperature and $x$ be the output. $x$ is a linear function of $T$. So

$$x=A+BT$$

for some constants $A$ and $B$.

Substitute $T=35$, $x=0.3$.

$$0.2=A+35B$$

Substitute $T=25$, $x=0.2$.

$$0.3=A+25B$$

Therefore,

\begin{align} 0.2-0.3&=35B-25B\\ -0.1&=10B\\ B&=-0.01 \end{align}

and hence

\begin{align} 0.2&=A+35(-0.01)\\ A&=0.2+0.35\\ &=0.55 \end{align}

$x=0.55-0.01T$.

• Thank you for explaining that. That's exactly what I was looking for! – user2878409 Jun 21 '17 at 9:08

Given the table of values of inputs (T) and outputs (Y):

\begin{array}{c|lcr} \text{T} & \text{Y} & \\ \hline 35 & 0.2 \\ 25 & 0.3 \\ 15 & 0.4 \\ 5 & 0.5 \\ -5 & 0.6 \\ -15 & 0.7 \\ \end{array}

Notice that the ratios of differentials are the same: $$\frac{\Delta Y}{\Delta T}=\frac{0.3-0.2}{25-35}=\cdots=\frac{0.7-0.6}{-15-(-5)}=-0.01.$$

Now obtain the linear function:

$$\Delta Y=-0.01\Delta T \Rightarrow Y-Y_1=-0.01(T-T_1) \Rightarrow$$ $$Y-0.2=-0.01(T-35) \Rightarrow$$ $$Y=-0.01T+0.55.$$