What is u
? If it’s a vector function, then grad(u)
would be a second order tensor and so would dot(as_matrix(a), grad(u))
. On the other hand dot(u, c)
would be a scalar. Also you need not use numpy
arrays, you can directly pass lists to as_matrix
and as_vector
, namely
a = as_matrix([[0.5*A_3**2*x[2]**2,0,0.5*A_3**2*x[0]*x[2]],
[0,0.5*(A_1**2+A_2**2+A_3**2*(x[2]/x[0])**2),0],
[0.5*A_3**2*x[0]*x[2],0,0.5*A_3**2*x[0]**2]])
c = as_vector([-0.5*A_3**2*x[0]+(A_3**2/2-A_4)*x[0],
-A_5,
-0.5*A_3**2*x[2]+(A_3**2/2+A_4)*x[2]])
If u
is a scalar function (from your previous post) then you don’t need a dot product between c and u, it’s simply c*u