I think, you first have to give consideration to what this u
function should look like.
Probably, you want to have u
as a linear combination of some basis functions bj
. Then, you need setup the basis functions and test them against the functions f[]
. This will give you a linear equation system for the coefficients uj
in the linear combination:
u = u1*b1 + ... + um*bm
Specifically, the $a_{ij}$ entry of your matrix A
will be
aij = assemble(f[i] * bj * dx).
If your bj
make up a basis of a Fenics FEM space
V, then you can compute a row of A
via
v = TrialFunction(V)
Ai = assemble(f[i] * v * dx)