# Basic Syntax Question — Variables for a function

I am looking at the following mathematica code

Subscript[ff, r1_, r2_, CC_][x_, y_] := (r1 x + r2 y) (1 - (x + y)/CC)
Subscript[gg, r1_, r2_, CC_][x_, y_] := x


and am wondering why the $r1,r2,CC$ variables are written as subscripts instead of being included as []'s. What does putting a variable as subscript do? I tried looking for this information here but didn't find my answer.

• See here (18395) – Sektor Mar 19 '16 at 7:34
• By writing it this way the author is separating parameters from variables. Using Subscript is a big no-no in Mathematica programming (as Sektor's link indicates). While it is possible to use it, it leads to problems more often than not. Please resist the temptation to use it. – Sjoerd C. de Vries Mar 19 '16 at 14:52

It's a matter of notation.

I'd have written the functions as

ff[r1_,r2_,CC_,x_,y_]:= (r1*x + r2*y)(1 - (x + y)/CC)
gg[r1_,r2_,CC_,x_,y_]:= x


And would have gotten the same results if I called them to calculate

Input: Print[ff[1,2,3,4,5],",",gg[1,2,3,4,5]]
Output: -28,4


with

Input: Print[Subscript[ff,1,2,3][4,5],",",Subscript[gg,1,2,3][4,5]]
Output: -28,4


My guess is that the author of the code snippet wishes to keep seperate the subscript variables from the (x,y) variables for his own (aesthetic or not) reasons.

You can also see from here that the Subscript[] function is used just for formatting purposes.

• If you read the post I linked to you will see that this behaviour is not always consistent. – Sektor Mar 19 '16 at 10:22
• Unfortunately I've read your very informative link after my post. Thanks ! – milia Mar 20 '16 at 23:05