GFem language documentation -- 3.9.2 Complex numbers

Previous: 3.9.1 Iter
Up: 3.9 Other features
Next: 3.9.3 Scal()

### 3.9.2 Complex numbers

Gfem can handle complex coefficients with 4 dedicated keywords:

- `complex` : to tell Gfem that complex number will be used. When it is used it must be located at the beginning of the program before any function declarations, otherwise the results will be incorrect. It can appear more than once in the program but only the first occurrence counts.
- `I`: for `sqrt(-1)` .
- `Re` : for the real part.
- `Im` : for the imaginary part.

There is purposely no conjug function but `barz=Re(z)-I*Im(z)` will do.

By default all graphics display the real part. To display the imaginary part do `plot(Im(f))`.

The functions implemented for complex numbers are:

- cos
- sin
- zx where z is complex and x is a float

The linear systems for the PDE are solved by a Gauss complex LU factorization.

WARNING: failure to declare `complex` in the program implies all computation will be done in real, even if `I` is used.