In computer programming, named parameter are common and often preferred - for pretty obvious readability advantages. Why is the concept no more (or at all) widespread in math?

For example, for $x_{i,t,k}$ instead of writing

$$ x_{2,1,3} $$

somewhere in the text, to write

$$ x_{i=2,t=1,k=3} $$

which - granted - is longer, but makes it clear which indices are what. The same can go for $y(i=1,j=2)$ of course.

Two prominent examples of the usage of $=$ are, in equations and in conditions. For example in the set builder notation

$$ \{x_i\in\mathbb R\mid i=3 \} $$

as a simple example it is used as a condition. Or in \begin{align} & g(z) = \begin{cases} \quad z \cdot x_i & \quad i = 2 \\[6pt] \quad z + x_i & \text{otherwise.} \end{cases} \end{align}

we use it as a condition. I would consider $y(i=1,j=2)$ to be very similar to this as in

$$ y(i=1,j=2) = y(i,j), \text{ where } i=1, j=2 $$

I understand that in most formulas we do not actually assign any value to the variables/indices/parameters and often, when we do, it is clear what we mean - especially if there is only one variable as in $f(x)$. But in some situation, e.g. when function have many variables, it might be really helpful to have named variable assignment, so why is it basically never seen?

  • 3
    $\begingroup$ The lack of readability outweighs the potential loss in ambiguity $\endgroup$ Sep 1, 2020 at 11:56
  • 2
    $\begingroup$ I would consider "i=1" to be a predicate depending on $i$, its value is either true or false. This is why you will find it in conditions, but not as an explanation of what is $i$. $\endgroup$
    – LL 3.14
    Sep 1, 2020 at 12:02
  • 2
    $\begingroup$ By the way, I don't think they are "often preferred" in computer science ... it will depend on your language/domain. Unless you have the result of a survey/statistic about this. Most of the languages I used do not have this kind of syntax ... $\endgroup$
    – LL 3.14
    Sep 1, 2020 at 12:08

1 Answer 1


Math has the advantage that we can actually accomplish things in the "comments" (that is, in the narrative passages between formulas). Math also tends toward notations that are compact rather than self-documenting, perhaps because the "documentation" is already so baked into mathematical writing styles.

There are also some relatively firm mathematical conventions for subscripts and function parameters, one of which is that there is a first subscript/parameter, a second subscript/parameter, etc.

So if (for example), $i=2,t=1,k=3$, then $x_{i,t,k}$ is not generally the same thing as $x_{k,i,t}$, unless it happens in the case in hand that $x_{2,1,3} = x_{3,2,1}.$

Function parameters, for example $f(i,t,k),$ follow similar rules. Position is everything. The parameters don't generally need names.

In contrast, functions in software programs often have too many parameters with no obvious sequence to help you remember which is which. They often have parameters you use only sometimes; the rest of the time those parameters take default values implicitly. These are strong motivations for using named parameters.

On the other hand, there is a mathematical notation that is something like a named parameter. For example, suppose we define

$$ F = 3x^2 + y^3. $$

Then we could write

$$ F \bigr\rvert_{x=2,y=4} = 3(2^2) + 4^3. $$

If you want to read the left-hand side aloud, you can say, "$F$ evaluated at $x=2,y=4$."

There are some other mathematical conventions that rely on similar ideas. For example, every time you see someone write a partial derivative in a form like

$$ \frac{\partial f}{\partial x}, $$

they are using $x$ as a named parameter, that is, the implicit assumption is that $x$ represents one of the parameters of the $n$-parameter function $f$ and that (at least in principle) we know which of those parameters it represents (for example, the first parameter).

But I have noticed that the $\frac{\partial f}{\partial x}$ causes many people to have difficulty understanding how partial derivatives actually work. (See this question for some more discussion.) When you start naming variables in math the results often aren't particularly happy. This may help explain why it doesn't happen more often.

But if you look long enough I am sure you will find some mathematical work somewhere in which named parameters are used explicitly in a way similar to the named parameters of a programming language, in some case where a function has many parameters or where it is hard to remember what the first parameter means as opposed to what the second parameter means. Mathematical notation is extremely flexible (as long as you tell the reader what you're doing when you introduce something new) and can be redefined to suit any needs, unlike almost any programming language.

  • $\begingroup$ "evaluated at" also possible for subscript parameters? (not that it looks great - just asking) $\endgroup$
    – Make42
    Sep 1, 2020 at 14:21
  • $\begingroup$ You could write $x_{i,t,k}|_{i=2,t=1,k=3}$ if you like, but why would you do that instead of $x_{2,1,3}$? $\endgroup$
    – David K
    Sep 2, 2020 at 1:09
  • $\begingroup$ The point about subscripts is they have no names, only positions (first, second, third). To define a symmetric matrix you might say that $x_{i,j}=x_{j,i}.$ Now if the names of the variables were more important than their sequence (as they are for named variables in python), then $x_{i,j}$ would be the same as $x_{j,i}$ for every matrix and would say nothing about symmetry. $\endgroup$
    – David K
    Sep 2, 2020 at 1:14
  • $\begingroup$ You write "The point about subscripts is they have no names" - how is that different from variables given in parenthesis in math notations? They are also identified only by position, afteral $f(x,y) \neq f(y,x)$ by default - otherwise would be always implied (but it is not). Consider the discussion on different types of metrics. $\endgroup$
    – Make42
    Sep 2, 2020 at 9:21
  • $\begingroup$ Currently I see not a fundamental difference between "stuff in subscript" (S) and "stuff in parenthesis" (P), besides the fact that P is somewhat more important. Sometimes it is implied that S is more static (e.g. if it is a parameter, which by definition is just different compared to a variable in terms in what way we think about it), or an integer (e.g. for denoting a cell in a matrix). But both can be of any type and e.g. sequences with $x_i$ as elements are often considered to be functions over the integers $i$. $\endgroup$
    – Make42
    Sep 2, 2020 at 9:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .