I saw a function defined something like the following:

f[n_Integer][r, θ] = Sin[n r π/L] Cos[n r L π θ/4]

My question is, why did my professor define the function like above, instead of using f[n_Integer, r_, θ_]? What is the difference? I could not find any answers on Mathematica, or google, or here.

If this has been asked before,and I did not find it, I apologize.

  • 4
    $\begingroup$ Related concepts: Currying, Subvalues. But just for calculation purposes, no big difference. $\endgroup$
    – vapor
    Jun 20, 2016 at 3:00
  • 3
    $\begingroup$ So now you can use f[1]@@@something, while if you use the latter definition, you can only use f[1,#1,#2]&@@@something $\endgroup$
    – Wjx
    Jun 20, 2016 at 3:12
  • 1
    $\begingroup$ @Wjx, or f[1, ##] & @@@ something, if wanted. But, f[1] @@ something can be cleaner in some cases. $\endgroup$ Jun 20, 2016 at 3:17
  • 3
    $\begingroup$ It's like $f_n(r,\theta)$ instead of $f(n,r,\theta)$ in mathematics. She or he is thinking of $n$ in a qualitatively different way (as parametrizing a sequence of functions, most likely). $\endgroup$
    – Michael E2
    Jun 20, 2016 at 3:49
  • 4
    $\begingroup$ Proposed duplicate: (7999). Recommended reading: (544), (5686494), (56504) $\endgroup$
    – Mr.Wizard
    Jun 20, 2016 at 12:29


Browse other questions tagged or ask your own question.