# How to turn a matrix into a 'function'? [duplicate]

I have some codes to turn a set of equations into a matrix. Suppose the matrix Lis expressed in terms of variables $$\epsilon$$, $$K$$, $$M$$, and I want to make a function which takes the numerical values of $$\epsilon$$, $$K$$, $$M$$ and return the matrix L in numerical form. How should I do it? I know I can use replacement like L/.{M->1,epsilon->0.1,K->10}, but I think having L[0.1,10,1] will make the subsequent codes look nicer.

Edit:

I generate L as follow:

I use DSolve to find the general solutions of a few vriables in terms of the constants C[1], C[2], C[3], etc. Then I define the equations I'm solving:

eq1=Simplify[...], and extract the coefficient of each underdetermined constants row1=Map[Simplify,Table[Coefficient[Substract@@eq1,C[n]],{n,1,5}]]. Finally, I construct the matrix for the linear system of equations as L={row1,row2,row3...}.

• You may also try L1[e1_, k1_, m1_] := With[{e1=e1,k1=k1,m1=m1},L]. Might be a bit faster than approaches based on ReplaceAll. – Henrik Schumacher Dec 5 '19 at 19:44