# Defining the function of list of parameters

I'm defining the functions in the following way

 ClearAll[Ka, Po, r, P, L, PL];
params = {r, Po, Ka}
prmss = ToExpression[StringInsert[Map[ToString, %], "_", -1]]
eq = {Ka*P*L == PL, Po == P + PL, r*Po == L + PL};
variables = {P, L, PL};

sol = Solve[eq, variables] // Last;

(*Define functoins of variables*)

Table[variables[[i]][r_, Po_, Ka_] :=
Evaluate[(variables /. sol)[[i]]], {i, Length[sol]}];

Ka = 10000;
Po = 0.001;

ParametricPlot[Table[{r, variables[[i]] @@ params}, {i, Length[variables]}], {r, 0.1, 5}]


I would prefer do not list them explicitly like [r_, Po_, Ka_] but to do something like @@prmss

How I can do it in my case?

Is this what you're after?

ClearAll[f];
params = {r, Po, Ka} // PatternSequence @@ (Pattern[#, Blank[]] & /@ #) &;
f[params] := {r, Po, Ka};
??f


f[PatternSequence[r_,Po_,Ka_]]:={r,Po,Ka}

f[1, 2, 3]


{1, 2, 3}

UPDATE

Per the comments, here's another try.

ClearAll[eq, auto];
SetAttributes[auto, HoldFirst];
auto[eqn_, pvals : ___Rule] :=
Module[{
vars = Union@Cases[
eqn,
s_Symbol /;
StringMatchQ[SymbolName[s],
RegularExpression["[A-Z].*"]], \[Infinity]],
params = Union@Cases[
eqn,
s_Symbol /;
StringMatchQ[SymbolName[s],
RegularExpression["[a-z].*"]], \[Infinity]],
sol},
sol = Last[Solve[eqn, vars]];
With[{
ilen = Length[vars],
rrange = {r, .1, 5}},
ParametricPlot[
Sequence @@ ({r, #} & /@ (vars /. sol) /. {pvals}), rrange]]]


Then

eq = {ka*P*L == PL, po == P + PL, r*po == L + PL};
auto[eq, po -> .001, ka -> 10000]


resolves to

ParametricPlot[{r,(-1-ka po+ka po r+Sqrt[4 ka po r+(1+ka po-ka po r)^2])/(2 ka)},{r,1/2 (-(1/ka)+po-po r+Sqrt[4 ka po r+(1+ka po-ka po r)^2]/ka)},{r,1/2 (1/ka+po+po r-Sqrt[4 ka po r+(1+ka po-ka po r)^2]/ka)},{r,0.1,5}]

(I left it symbolic here) and generates a plot. This code assumes "variables" start with an uppercase letter and "parameters" start with a lowercase letter. It's just searching for all symbols; you may need to refine that (for example by checking FreeQ[Attributes@s,Protected])

• Not exactly, but using your code I get two lists: {P[r_, Po_, Ka_], L[r_, Po_, Ka_], PL[r_, Po_, Ka_]} and {-((Po (-1 - Ka + Ka r))/(1 + Ka)), (Po r)/(1 + Ka), (Ka Po r)/( 1 + Ka)}. Now I need to define 3 functions P[r_, Po_, Ka_]:=-((Po (-1 - Ka + Ka r))/(1 + Ka)); L[r_, Po_, Ka_]:=(Po r)/(1 + Ka) and PL[r_, Po_, Ka_]:=(Ka Po r)/( 1 + Ka)}. May 27, 2014 at 8:59
• @ФилиппЦветков I think what you are trying to achieve can be done elegantly, but I don't follow exactly what you're seeking. Can you elaborate a bit more on what you want to input and what you want as output? If you have those two lists (call them list1 & list2), you can make definitions with MapThread[SetDelayed, {list1, list2}] May 27, 2014 at 14:29
• Yes I did this to make the definitions. My system of equations as well as parameter and variables will be changed. So I would like to avoid they appease in the code explicitly except in the beginning. Thus in input I have the lists of equations, parameters and variables. As soon the system of equation is solved I would like to define the variables as functions of parameters (so parameters becomes variables) to plot system solutions as parameters functions. May 27, 2014 at 14:43