ufl tensor sqrt


171
views
0
5 months ago by
Hello!

I am trying to procedure a very simple ufl tensor (2x2) operation:

$F^TF=C=U^2$FTF=C=U2

I am trying to get  $U$U , but fenics is giving me the following error message.

Any idea?

Best!
Ricardo
Community: FEniCS Project

2 Answers


0
5 months ago by
I think a got the answer:

fc_sqrt = as_tensor(((0.5, 0.5), (0.5, 0.5)))

fc_U = elem_pow(fc_C, fc_sqrt)

but now, I am trying to get the  $ln\left(U\right)$ln(U) , it is a Natural logarithm of tensor (2x2), any way or workaround to get it?

Best!
Ricardo
0
5 months ago by
Careful! Matrix function (such as square root or log) is not an element-wise applied scalar function. *Otherwise the matrix inverse would be just inverting the elements and the whole linear algebra world solving Ax=b would have no job :)

Apparently, elem_power is an element-wise operation, something you do not want.

See https://en.wikipedia.org/wiki/Matrix_function . There are several options how to compute matrix function, power series, diagonalization, Cauchy formula, ...
For the special 2x2 case there is a nice formula on the wiki page, see section "Arbitrary function of a 2x2 matrices". Just need to find eigenvalues of the matrix. Generally, a good way is to use the diagonalization approach (and special 2x2 formula is just a shorthand closed form for that approach I guess).
Please login to add an answer/comment or follow this question.

Similar posts:
Search »