Hello,
This is a trivial question from an engineer's perspective and novice to fem and applied math.
I understand interpolation in numerical methods, but am not able to visualize it exactly in a function space format. I understand that it constructs a finite element function whose degrees of freedom (or values at the nodes) are calculated from the expression. I am not able to see that properly in the output. It would be very kind if someone could try explaining what's happening here.
So, when I run the following:
mesh = UnitSquareMesh(8,8)
v = Expression("sin(pi*x[0])")
V = FunctionSpace(mesh, "Lagrange", 1)
Iv = interpolate(v, V)
print Iv.vector().array()
I get the following output:
[ 0.00000000e+00 0.00000000e+00 3.82683432e-01 0.00000000e+00
3.82683432e-01 7.07106781e-01 0.00000000e+00 3.82683432e-01
7.07106781e-01 9.23879533e-01 0.00000000e+00 3.82683432e-01
7.07106781e-01 9.23879533e-01 1.00000000e+00 0.00000000e+00
3.82683432e-01 7.07106781e-01 9.23879533e-01 1.00000000e+00
9.23879533e-01 0.00000000e+00 3.82683432e-01 7.07106781e-01
9.23879533e-01 1.00000000e+00 9.23879533e-01 7.07106781e-01
0.00000000e+00 3.82683432e-01 7.07106781e-01 9.23879533e-01
1.00000000e+00 9.23879533e-01 7.07106781e-01 3.82683432e-01
0.00000000e+00 3.82683432e-01 7.07106781e-01 9.23879533e-01
1.00000000e+00 9.23879533e-01 7.07106781e-01 3.82683432e-01
1.22464680e-16 3.82683432e-01 7.07106781e-01 9.23879533e-01
1.00000000e+00 9.23879533e-01 7.07106781e-01 3.82683432e-01
1.22464680e-16 7.07106781e-01 9.23879533e-01 1.00000000e+00
9.23879533e-01 7.07106781e-01 3.82683432e-01 1.22464680e-16
9.23879533e-01 1.00000000e+00 9.23879533e-01 7.07106781e-01
3.82683432e-01 1.22464680e-16 1.00000000e+00 9.23879533e-01
7.07106781e-01 3.82683432e-01 1.22464680e-16 9.23879533e-01
7.07106781e-01 3.82683432e-01 1.22464680e-16 7.07106781e-01
3.82683432e-01 1.22464680e-16 3.82683432e-01 1.22464680e-16
1.22464680e-16]