It applies a to the function f, and then b to the resulting function.
For example, you could do something like
f[a_] := (a + #)&
then
f[3] would give the function (3 + #)& and applying that to 2 would produce 5.
In more extended notation,
f[a_] := Function[y, a + y]
f[3] => Function[y, 3 + y]
f[3][2] = Function[y, 3 + y][2] = 3 + 2 = 5
Or, equivalently
f[a_, b_] := a + b
f[3, 2]
tgt
Nov18-08, 10:38 AM
So F[a][b]=F[a,b]?
What happens if I'd like F[x] to be indexed by i=1,2,3,...
how to do that?
CompuChip
Nov18-08, 11:33 AM
No, F[a][b] is F[a] applied to b, which is (f applied to a) applied to b.
It depends on what F is.
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? Or ...
tgt
Nov18-08, 05:56 PM
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?
That's right. How to do it?
CompuChip
Nov19-08, 03:56 AM
So the simplest form is
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}]
where you can type g2 using Control + hyphen (-).
An alternative would be
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!"]
Then you can call fi[x] (type with Control + - (hyphen)) for i = 1, 2, 3 and it will call F[x], G[x] or H[x], respectively. The complicated-looking pattern matching is to have it return just fi[x] if i is not 1, 2 or 3.
tgt
Nov19-08, 09:33 AM
So the simplest form is
[code]Subscript[g, 1][x_] := x
Subscript[g, 2][x_] := x^2
Subscript[g, 3][x_] := Sin[x]
why g?
CompuChip
Nov20-08, 03:35 AM
Why not?
I had already used f in the other example. You can call it f if you want, or Apples, or GqoFKdsJF or LoremIpsumDolorem. Just don't use any reserved names (E, N, Sin, ...) or - preferably - things you already defined.