Hello everyone, I have encountered several problems in the computing of complex numbers.
- The definition of inner product in my question is as follows.
My question is whether my program needs to add conjugate when using the problem/solve/varf like this?
problem Test1(u,v) = int2d(Th)(u*conj(v))
After completing the variation, if the test function of the inner product contains complex numbers, is it possible to do :
problem Test1(u,v) = int2d(Th)(1i*u*conj(1i*v))
2.The second problem is that I noticed that when two complex vectors are multiplied, Freefem will calculate like this :
conj(A)'*A
which means that when I do not need to calculate in this way, it is a better choice to split the vector multiplication. When I write variables [ux, uy] as such a complex function, is the second method more appropriate ?
problem Test2([ux,uy],[vx,vy])
= int2d(Th)([ux,uy]'*[vx,vy])
problem Test2([ux,uy],[vx,vy])
= int2d(Th)(dx(ux)*dx(vx)+dy(uy)+dy(vy))
3.My third problem is that this expression appears in the GL equation:
When calculating in the Freefem, A is real vector and Psi is complex number. But various operations of complex Psi are involved in the calculation of A, which will generate errors:
Compile error : Error: Problem a complex problem with no complex FE function
My solution is to also set the variable type of A as a complex vector, and A will not have any complex value in the calculation. Is this appropriate ?
Any help/suggestion would be greatly appreciated !