2
$\begingroup$

This question already has an answer here:

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.

$\endgroup$

marked as duplicate by MarcoB, m_goldberg, user9660, Kuba, Mr.Wizard Jun 21 '16 at 10:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    $\begingroup$ Related concepts: Currying, Subvalues. But just for calculation purposes, no big difference. $\endgroup$ – happy fish Jun 20 '16 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 '16 at 3:12
  • 1
    $\begingroup$ @Wjx, or f[1, ##] & @@@ something, if wanted. But, f[1] @@ something can be cleaner in some cases. $\endgroup$ – J. M. is away Jun 20 '16 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 '16 at 3:49
  • 4
    $\begingroup$ Proposed duplicate: (7999). Recommended reading: (544), (5686494), (56504) $\endgroup$ – Mr.Wizard Jun 20 '16 at 12:29