# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

## Define Complex Data Using Operators

### Why Use Operators for Complex Numbers?

Use operators to handle complex numbers because a C chart does not support complex number notation `(a + bi)`, where `a` and `b` are real numbers.

### Define a Complex Number

To define a complex number based on two real values, use the `complex` operator described below.

#### complex Operator

Syntax

`complex(realExp, imagExp)`

where `realExp` and `imagExp` are arguments that define the real and imaginary parts of a complex number, respectively. The two arguments must be real values or expressions that evaluate to real values, where the numeric types of both arguments are identical.

Description.  The `complex` operator returns a complex number based on the input arguments.

Example

`complex(3.24*pi, -9.99)`

This expression returns the complex number ```10.1788 – 9.9900i```.

### Access Real and Imaginary Parts of a Complex Number

To access the real and imaginary parts of a complex number, use the operators `real` and `imag` described below.

#### real Operator

Syntax

`real(compExp)`

where `compExp` is an expression that evaluates to a complex number.

Description.  The `real` operator returns the value of the real part of a complex number.

 Note:   If the input argument is a purely imaginary number, the `real` operator returns a value of 0.

Example

`real(frame(200))`

If the expression `frame(200)` evaluates to the complex number `8.23 + 4.56i`, the `real` operator returns a value of 8.2300.

#### imag Operator

Syntax

`imag(compExp)`

where `compExp` is an expression that evaluates to a complex number.

Description.  The `imag` operator returns the value of the imaginary part of a complex number.

 Note:   If the input argument is a real number, the `imag` operator returns a value of 0.

Example

`imag(frame(200))`

If the expression `frame(200)` evaluates to the complex number `8.23 + 4.56i`, the `imag` operator returns a value of 4.5600.

### Work with Vector Arguments

The operators `complex`, `real`, and `imag` also work with vector arguments.

ExampleIf the input `x` is...Then the output `y` is...
`y = real(x)`An n-dimensional vector of complex valuesAn n-dimensional vector of real values
`y = imag(x)`An n-dimensional vector of real valuesAn n-dimensional vector of zeros
`y = complex(real(x), imag(x))`An n-dimensional vector of complex or real valuesAn n-dimensional vector identical to the input argument