Difference between variables, parameters and constants

57k Views Asked by At

I believe the following 4 questions I have, are all related to eachother.


Question 1: Of course I've been using constants, variables and parameters for a long time, but I sometimes get confused with the definition. It seems to me that these terms are used very loosely.

Let's say we have a second degree polynomial e.g. $ax² + bx + c$. I've heard people say $a, b, c$ are both constants and parameters.

I understand they are parameters, since they allow us to have a 'family' of second degree polynomials. What I mean by that is that if e.g. $c$ is incremented by one, it becomes a different function, since the graph of the function would be shifted up by one.

Why do people call them constants as well though? AFAIK, constants are fixed, e.g. $\pi, e, \varphi$. They would be the same value in any given context, and never change. The parameters $a, b, c$ however, never change with respect to the function, but they represent multiple values, unlike $\pi$.


Question 2: To make things even more confusing, there's also contrast between unknown and known variables. Are known variables the same thing as parameters? If they are known, why don't we just throw in the real value of the variable?


Question 3: If we have $ax + 3$, how does one know if a represents a variable like x, so it's a function that can take two inputs, or if it's a parameter? Should the context provide this information?


Question 4:

In the pythagoream theorem, are $a$, $b$ and $c$ constants, variables or parameters? If they are variables, then why are they represented by the letters a, b, c instead of x, y, z? I've read a, b and c are commonly used as known variables.

4

There are 4 best solutions below

12
On BEST ANSWER

A constant is something like a "number". It doesn't change as variables change. For example $3$ is a constant as is $\pi$.

A parameter is a constant that defines a class of equations. $$\left(\frac xa\right)^2 + \left(\frac yb\right)^2 = 1$$ is the general equation for an ellipse. $a$ and $b$ are constants in this equation, but if we want to talk about the entire class of ellipses then they are also parameters -- because even though they are constant for any particular ellipse, they can take any positive real values.

A variable is an element of the domain or codomain of a relation. Remember that functions are just relations so the input and output of functions are variables. For example, if we talk about the function $x \mapsto ax +3$, then $x$ is a variable and $a$ is a parameter -- and thus a constant. $3$ is also a constant but it is not a parameter.

A "known" variable is typically a value that the conditions of the problem dictate the variable must take. For example if we are discussing an object an free fall, then acceleration is a variable. But physics puts a constraint on the value that that variable may take -- acceleration in free fall is $a=g\approx 9.8$. Thus, though $a$ may be defined as the input of a function, it must take a "known" value. Thus it is a known variable.

The Pythagorean theorem states that $a^2 + b^2 = c^2$ for sides $a,b$ and hypotenuse $c$ of a right triangle. These are parameters -- thus they are also constants.

0
On

A variable is, of course, a quantity that is allowed to vary over its range of definition. For example, $f(x) = 3x + 5$ is a function, where x ranges over the real numbers.

Now, I think the difference between constants and parameters is a bit more subtle. First, constants:

A constant is just something that doesn't vary. 3 is a constant value, $\pi$ is a constant value. But then, in the function $f(x) = ax + b $, $a$ and $b$ are arbitrary constants. So, for whatever reason, say we want to study functions of the form $f(x) = ax + b $, where $a$ and $b$ are some fixed values, but we don't really care if those values are 3, 42, or $\pi$, so we say $a$ and $b$ are constants. I think in that sense there's a distinction between specific constants, like $\pi$, and arbitrary ones, like $a,b$ in the previous formula.

Now, with parameters, in my experience, there's always some notion of partial application going on. I think statistical distributions are a really good example of this. For example, take the normal distribution, if we wanted to, we could think of it as a function of three variables, $x,\mu$ and $\sigma$, but that's not what a normal distribution is! A normal distribution is the particular single-variable function of $x$ you get when you choose a particular $\sigma$ and $\mu$, as opposed to being arbitrary, like $a$ and $b$ we talked about above.

0
On

They are all the same sort of thing on different levels of abstraction/generalization. Setting a value creates a more specialized (less general) version of the mathematical object (function, optimization problem, etc.), and replacing a formerly exactly defined value by a symbol creates a generalized problem (covering a whole family of the specific problems).

  • If you set $a$ to some value in $ax+3$, you get a more specific version, for example $5x+3$. If you further set $x$ to some value, you get a specific number out, like $5\cdot 6 + 3$.
  • In the other direction, if you turn $ax+3$ into $ax+t$, you can represent a whole family of (parameterized) functions including $ax+8$ and $ax+1$.

$t$ is the highest level parameter, $a$ is one lower and $x$ is the lowest. Since we usually only use a few such levels at a time, we like to use names for them instead of just saying "higher level" parameter. Variables are usually those that get adjusted on the lowest level, parameters are a level above and constants are those that we don't change or adjust in our current task, but they could be turned into even higher-level parameters (called hyperparameters) if we wanted to further generalize our problem or object.

Any function with multiple parameters can be turned into a higher-level function that just takes one parameter and gives you a new function which now takes one less parameter than the original. This is called currying. So your $f(a,x)=ax+3$ can be turned into a function which gives a new function for each $a$:

$$ F = (a \mapsto (x \mapsto (ax+3))) $$

So F(7) would be a function itself, $7x+3$.

If you are familiar with programming it is also similar to variable scoping, i.e. that values are defined in nested contexts. Functional programming uses these concepts even more heavily.

Which parameter you put on which level depends on the current problem at hand and the same problem can often be analyzed in multiple ways, i.e. by swapping parameters across levels (like in our example, interpreting $a$ as the lowest and $x$ as the higher-level parameter).

0
On

I'm a bit late but will answer anyway.

$Parameter = para + meter = against + measure$ = "to measure something against some other thing" (against an object treated as a unit). So basicly a "parameter" is something which could be measured with a ruler.

For the sake of modelling some real life system we make up a mathematical object. Now let's imagine that we are modelling our solar system. After many hours of mental labor we came up with a model: $$x =f(t)=at-b$$ where

  • $x$ - a variable, position of the 3rd planet in the solar system under consideration,

  • $t$ - a variable, time,

  • $a$ - a parameter of the system, speed of the planet rotation,

  • $b$ - a parameter of the system, planet's initial position relative to some point,

    thus by plugging $t$ into $f(t)$ we should get the future position of the planet in the solar system.

Now $f(t)=at-b$ is a model of the system but it is a general model, not a model of our particular solar system, but a framework for modelling any solar system there is! To render $f(t)=at-b$ into OUR home system we should measure our system's parameters: $a,b$. By measureing them we transform model of general solar system into particular model of our solar system.

Now let's imagine that after taking measurments by using telescopes we get values for our parameters: $a$=500 km/h and $b$=100 000 km. So $f(t)=at-b$ transforms into $f(t)=500t-100000$. Now we can calculate the variable $x$.

In the example above you should see that:

  1. We do not measure variables! We calculate them or plug them in the model (function). We calculate variables from measured parameters.
  2. We do not calculate parameters, instead we measure them as the etymology of the word suggest.
  3. By measuring parameters we select particular model $f(t)=500t-100000$ from the class of models $f(t)=at-b$.

So in the end: If you measure something - it's a parameter. If you calculate something - it's a variable.