# Functions definitions with variable arguments

How do you define a variable amount of functions with a variable amount of arguments? I don't get the reference at all :

    Clear["Global*"]
ClearAll[Subscript]
n = 3;

cost = Table[Subscript[c, i], {i, n}];
Do[Subscript[c, i] = RandomInteger[{0, 400}]/1000, {i, n}];
price = Table[Subscript[p, i], {i, n}];
equations = Table[Subscript[eq, i], {i, n}];

Do[Subscript[eq, i] =
Subscript[p, i] - Subscript[c, i] +
1/(Sum[Subscript[p, l]*Boole[l != i], {l, n}]), {i, n}];

Do[Subscript[p, i] = Symbol["p" <> ToString[i]], {i, n}];
g1[p1_, p2_, p3_] := Evaluate[equations[[1]]];
g1 @@ {0.1, 0.1, 0.2}


I need to be able to generate g1..gn functions with arguments gi[p1,..pn], is there a way to make it with some kind of loop {i,n}?

I tried something like this without success:

Do[Symbol["g" <> ToString[i]][p__] := Evaluate[equations[[i]]], {i, n}]
`

I also wonder how do I explicit that the first argument is p1, the second is p2... and the nth is pn.

• Can you describe a little bit about the functions that you are trying to create? As it is, it's hard to parse what you are trying to do. – march Jul 25 '18 at 18:31
• I have a system of equations that NSolve/FindInstance can't handle. So I'm trying to work a fixed point for several variables convergence with this. (btw the equation above is a dummy, not the real problem) – Rodrigo Jul 25 '18 at 18:41