I want to define a function that takes, several, let's say two arguments, both of which have several sub- and suberscripts. For example a function might have the signature $$ f(x_i,q_{j,k}) = \mathrm{function\ of\ } x_i, q_{j,k} $$ Now I want the notebook to be so flexible as to allow for $f$ to take arbitrary arguments with abitrary values of indices, e.g: $$ f(a,b) = \mathrm{function\ of\ } a,b $$ $$ f(x_{i+5},q_{j+1,k}) = \mathrm{function\ of\ } x_{i+5}, q_{j+1,k} $$ that is, I want the value of f to change whether I change the values passed or the indices. Of course, in the former case, if the value of f depends explicitly on the value of one of the indices of one of the parameters, say $$f(x_i)=x_i*i$$ then $$f(a)$$ would not necessarily a properly defined expression, unless $a$ can be written as some $x_j$.
Is there a way to define such functions?
f[i, j]
. See here for why this is not such a good idea. All you have asked to do is absolutely standard in Mathematica. $\endgroup$f[a,b]
andf[x[i], q[j,k]]
. You can make a function respond differently if it is supplied with a number or a symbol. The pattern recognition will spot this and take the correct action. I always find it easier to work with a bracket notation. Working with subscripts has got me lost in the past. $\endgroup$