complexify

complexify(f, name=None)[source]

Make a function f(scalar) into f(complex).

If f(x) then it returns f_c(z) = f(real(z)) + 1j*f(imag(z))

If the real/imag arguments are not first, then you may specify the name given to them as kwargs.

Parameters:
  • f (Callable) – Function of real variable.

  • name (string, optional) – Name of the real/imag argument names if they are not first.

Returns:

f_c – Function of a complex variable.

Return type:

Callable

Examples

>>> def f(x): return x
>>> f_c = rf.complexify(f)
>>> z = 0.2 -1j*0.3
>>> f_c(z)