Documentation

This is machine translation

Translated by Microsoft
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::Imaginary

Type and property representing imaginary 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::Imaginary)
assume(x, Type::Imaginary)
is(ex, Type::Imaginary)

Description

Type::Imaginary represents complex numbers with vanishing real part. This type can also be used as a property to mark identifiers as imaginary numbers.

The call testtype(obj, Type::Imaginary) checks, whether obj is an imaginary number (or zero) and returns TRUE, if it holds, otherwise FALSE.

testtype only performs a syntactical test identifying MuPAD® objects of type DOM_COMPLEX and checks, whether iszero(Re(obj)) holds, or whether iszero(obj) is TRUE. This does not include arithmetical expressions such as I*exp(1), which are not identified as of type Type::Imaginary.

The call assume(x, Type::Imaginary) marks the identifier x as an imaginary number.

The call is(ex, Type::Imaginary) derives, whether the expression ex is an imaginary number (or this property can be derived).

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

The call assume(Re(x) = 0) has the same meaning as assume(x, Type::Imaginary).

Examples

Example 1

The following numbers are of type Type::Imaginary:

testtype(5*I, Type::Imaginary),
testtype(3/2*I, Type::Imaginary),
testtype(-1.23*I, Type::Imaginary)

The following expressions are exact representations of imaginary numbers. However, syntactically they are not of type Type::Imaginary, because their domain type is not DOM_COMPLEX:

testtype(exp(3)*I, Type::Imaginary),
testtype(PI*I, Type::Imaginary),
testtype(sin(2*I), Type::Imaginary)

In contrast to testtype, the function is performs a semantical test:

is(exp(3)*I, Type::Imaginary),
is(PI*I, Type::Imaginary),
is(sin(2*I), Type::Imaginary)

Example 2

Identifiers may be assumed to represent an imaginary number:

assume(x, Type::Imaginary): is(x, Type::Imaginary), Re(x), Im(x)

The imaginary numbers are a subset of the complex numbers:

is(x, Type::Complex)

unassume(x):

Parameters

obj

Any MuPAD object

x

An identifier

ex

An arithmetical expression

obj

Any MuPAD object

Return Values

See assume, is and testtype

See Also

MuPAD Functions

Was this topic helpful?