Next: Random Variables Up: Util: Maths Utilities Previous: Util: Maths Utilities   Contents

Complex Variables

```Complex cmplx(double x, double y)
```
Returns the complex number x+yi with real part x and imaginary part y.

```Macro cmplx_re(Complex z);
Macro cmplx_im(Complex z);
```
Return the real and imaginary parts of z respectively. Implemented as macros, so can be used on both sides of assignment statements.

```Complex cmplx_sum(Complex a, Complex b)
```
Returns the complex sum a+b of two complex numbers.

```Complex cmplx_diff(Complex a, Complex b)
```
Returns the complex difference a-b of two complex numbers.

```Complex cmplx_prod(Complex a, Complex b)
```
Returns the complex product ab of two complex numbers.

```Complex cmplx_times(double a, Complex b)
```
Returns the complex product ab of a real and a complex number.

```Complex cmplx_zero()
```
Returns the complex zero (0+0i).

```Complex cmplx_unit()
```
Returns the complex unit (1+0i).

```Complex cmplx_conj(Complex z)
```
Returns the complex conjugate (x-yi) of x+yi.

```Complex cmplx_div(Complex a, Complex b)
```
Returns the complex quotient a/b of a and b.

```double cmplx_mod(Complex z)
```
Returns the real modulus 4#4z4#4 of complex z.

```double cmplx_mod2(Complex z)
```
Returns the real squared modulus of complex z.

```Complex cmplx_sqrt(Complex z)
```
Returns the principal value of the complex square root of complex z.

Next: Random Variables Up: Util: Maths Utilities Previous: Util: Maths Utilities   Contents
root 2018-09-24