# how to check a function with multiple variables in a visual way

I am not very math inclined, so sorry in advanced if the terminology is not correct.

I have a system of variables; imagine an array of sensors, which return temperature, pressure, humidity, for sake of simplicity. I would like to calculate a coefficient between 1 and 100, based on these values; I know the min and max of each of these variables; so I shall get something like this:

randomnumber between 1 and 100
temperature between 10 and 60
pressure between 1 and 15
humidity between 1 and 100

RandomNumber + ((temperature - humidity - pressure)/3) = 100


Now if I want to verify that in fact I get numbers between 1 and 100 from that function, is there an "automated" way to do so?

I could write some code in python, that create random values in my set ranges and run that function; but I believe there are better ways.

How do you actually verify functions with multiple values, without writing code in some language, that will solve multiple times the function? I saw some plotting utility online, but they usually deal with funcitons that have one or at most 2 variables.

• Hi, welcome to Math.SE. Can you please clarify: For the formula you've given $RandomNumber+((temperature-humidity-pressure)/3)$ you want to ensure that the result is between $1$ and $100$ given the possible range of values you've listed? Apr 8, 2016 at 3:06
• Hi Ian, this is correct; I am experimenting with these parameters; and the objective is to get a function that include 3 variables plus one random value, and the result is in range 1-100. The issue is that I can't try all the values just with my calculator, so I am trying to learn how do you actually figure out if a function is actually working or not. Apr 8, 2016 at 3:09
• Well you could use a Lagrange Multiplier to find the minimum and maximum of the function...but it doesn't sound like that's the proper level for you. I can tell you right away that if randomNumber is from 1 to 100 and the second part has any chance of being positive or negative (i.e. non-zero) then you will go outside of your range. Apr 8, 2016 at 3:17
• Indeed, that's way over my head :) I did base math; but never went beyond the basics (algebra, polynomes, trigonometry and such). Tell me if I am wrong: the random should not be more than half of my max value (100), if I assume that the total of the second part is never more than 50 and never less than 1. Is this how you actually balance the values to be inside a range? Apr 8, 2016 at 3:28

To determine the minimum and maximum values of your function: $RandomNumber+((temperature−humidity−pressure)/3)$ you need to consider how each variable affects the total. This is slightly clearer if you rewrite the function to highlight how each term works.

$$RandomNumber+\frac{temperature}{3}-\frac{humidity}{3}-\frac{pressure}{3}$$

Looking at this we can see that:

• Increasing $RandomNumber$ will increase the total.

• Increasing $temperature$ will increase the total.

*Increasing $humidity$ will decrease the total.

*Increasing $pressure$ will decrease the total.

So to minimize the total you want to minimize $RandomNumber$ and $temperature$ and maximize $humidity$ and $pressure$. So the total would be: $1+\frac{10-100-15}{3}=1+\frac{-105}{3}=-34$.

And to maximize the total you want to maximize $RandomNumber$ and $temperature$ and minimize $humdity$ and $pressure$. So the total would be: $100+\frac{60-1-1}=100+\frac{58}{3}=117\frac{1}{3}$.

So your values are in the range $-34$ to $117\frac{1}{3}$.

• Thanks a lot Ian! This clarified how dd you get to the final range. Is this always done via reasoning and solving the function, or there is an automated way to do this? Apr 8, 2016 at 3:21
• It would depend upon the complexity of your function. If they are all linear then you could just check the different combinations of end values. If the functions where more complex then you'd want to use calculus techniques as well. Apr 8, 2016 at 3:24
• I am trying to stay on the linear complexity; all my values are integers, in the sense of computer integer (so between 65K and -65K, if I recall correctly, on 64 bit systems), although the range for these variables is much smaller than that...1 to 100 is the greatest that it gets. Thanks for the suggestion! Apr 8, 2016 at 3:42