# 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.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# `Type`::`Complex`

Type and property representing complex numbers

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```testtype(`obj`, `Type::Complex`)
assume(`x`, `Type::Complex`)
is(`ex`, `Type::Complex`)
```

## Description

`Type::Complex` represents complex numbers. This type can also be used as a property to mark identifiers as complex numbers.

The call `testtype(obj, Type::Complex)` checks, whether `obj` is a complex number and returns `TRUE`, if it holds, otherwise `FALSE`.

`testtype` only performs a syntactical test identifying MuPAD® objects of type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` and `DOM_COMPLEX`. This does not include arithmetical expressions such as `exp(1)`, which are not identified as of type `Type::Complex`.

The call `assume(x, Type::Complex)` marks the identifier `x` as a complex number.

The call `is(ex, Type::Complex)` derives, whether the expression `ex` is a complex number (or this property can be derived).

This type represents a property that can be used in `assume` and `is`.

## Examples

### Example 1

The following numbers are of type `Type::Complex`:

```testtype(2, Type::Complex), testtype(3/4, Type::Complex), testtype(0.123, Type::Complex), testtype(1 + I/3, Type::Complex), testtype(1.0 + 2.0*I, Type::Complex)```

The following expressions are exact representations of complex numbers. Syntactically, however, they are not of type `Type::Complex`:

```testtype(exp(3), Type::Complex), testtype(PI^2 + 5, Type::Complex), testtype(sin(2) + PI*I, Type::Complex)```

### Example 2

Identifiers may be assumed to represent a complex number:

`assume(x, Type::Complex): is(x, Type::Complex)`

The real numbers are a subset of the complex numbers:

`assume(x, Type::Real): is(x, Type::Complex)`

Without further information, it cannot be decided whether a complex number is real:

`assume(x, Type::Complex): is(x, Type::Real)`

`unassume(x):`

## Parameters

 `obj` Any MuPAD object `x` An identifier `ex`

## Return Values

Was this topic helpful?

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos