Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am going through some of the items in "Modern Differential Geometry of Curves and Surfaces with Mathematica, Third Edition".

An example of the style used by these authors is:

piriform[a_, b_][t_] := {a (1 + Sin[t]), b Cos[t] (1 + Sin[t])}

ParametricPlot[Evaluate[piriform[1, 1][t]], {t, 0, 2 Pi}, AspectRatio -> Automatic]

Can someone please explain why they use piriform[a_, b_][t_] as opposed to piriform[a_, b_, t_]?

Is there some advantage to the authors' form over the latter form?

share|improve this question
In the first case (piriform[a_,b_][t_]), you define SubValues for the symbol piriform while in the second case (piriform[a_,b_,t_]) you define DownValues. BTW, you don't need the Evaluate here. – István Zachar Jan 10 '14 at 14:16
up vote 8 down vote accepted

The form f[a_, b_][t_] allows you to conveniently use f[a, b] as if it were a function. For example, you can Map it over a list:

f[a_, b_][t_] := a^t + b

f[2, 3] /@ {4, 6, 8}
{19, 67, 259}

Please see Define parameterized function for details about this format and alternatives. See also What is the distinction between DownValues, UpValues, SubValues, and OwnValues? for notes about the specific evaluation of SubValues definitions.

Be aware that it is difficult to use Hold attributes for the additional parameters of a function written this way but one can emulate it to a degree. See for example:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.