tgt
- 519
- 2
What does f[a] mean in mathematica?
What does f[a] mean in mathematica?
What does f[a] mean in mathematica?
The discussion revolves around the interpretation of function notation in Mathematica, specifically the meaning of expressions like f[a][b] and how to index functions. Participants explore various ways to define and apply functions, as well as how to create indexed functions.
Participants express differing views on the equivalence of f[a][b] and f[a, b]. The discussion on indexing functions also reveals varying approaches and preferences, with no consensus reached on the best method.
Some participants' definitions and examples depend on specific interpretations of function application and indexing, which may not be universally applicable. The discussion does not resolve the ambiguity surrounding the notation.
This discussion may be useful for Mathematica users seeking to understand function application and indexing, as well as those interested in naming conventions for functions in programming contexts.
CompuChip said:How do you mean "indexed" by i = 1, 2, 3? You would like three functions F[x], G[x], H[x] but call them Fi[x] (i = 1, 2, 3) instead?
Subscript[g, 1][x_] := x
Subscript[g, 2][x_] := x^2
Subscript[g, 3][x_] := Sin[x]
Plot[{Subscript[g, 1][x], Subscript[g, 2][x],
Subscript[g, 3][x]}, {x, -1, 1}]
Subscript[f, i_?(Function[IntegerQ[#] && 1 <= # <= 3])][x_] :=
Which[i == 1, F[x], i == 2, G[x], i == 3, H[x], True, "This should not occur!"]
CompuChip said:So the simplest form is
Code:Subscript[g, 1][x_] := x Subscript[g, 2][x_] := x^2 Subscript[g, 3][x_] := Sin[x] [/QUOTE] why g?