I have to define a function of two variables that yields a high dimensional matrix, with each entry containing a scalar function, that uses its coordinates in the matrix as input. like this:
f[x_,a_] := {{g[1,1][x]*a, g[1,2][x]*a}, {g[2,1][x]*a, g[2,2][x]*a}}
Is there any way I can assign the elements in a smart way without mapping the whole matrix by hand?
EDIT:
I've been asked for an example of g
. This is taken out of the original code:
g[n_, m_] := Table[Chop[
I*Conjugate[h[[n]][[i]]].(hx[[m]][[i]] - h[[m]][[i]])/
step, 3*10^-3],
{i, 1, Length[qvals]}];
Array
orTable
. $\endgroup$g
is here? $\endgroup$f[x_, a_] = a Array[g[##][x] &, {2, 2}]
$\endgroup$