Given the function (simplified example)
g[En_, k1_] := En^2 *k1
I have to plug it inside another expression, where En
is integrated, but k1
remains as a free variable. The only way I found to do that is
fN[function_, k_] := NIntegrate[function[En, k]*Exp[-theta*function[En, k]], {theta,0,Pi/2}, {En,1,3}]
fN[g, 0.1]
(*0.921158 *)
But in fact I have many functions like g
that need to undergo the same procedure, some with one, two or three k
as argument,
g2[En_, k1_, k2_] := En^2 *k1/k2
g3[En_, k1_, k2_, k3_] := En^2 *k1*k2*k3
Can the function fN
be generalised to admit a function with an arbitrary number of arguments k
?