# Graphics Function Definition Style (Using SubValues vs. DownValues)

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?

-
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
– Nasser Jan 10 '14 at 14:19

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}