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.

Dom::Natural

Semi-ring of natural integer 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

Dom::Natural(x)

Description

Dom::Natural is the semi-ring of integer numbers represented by elements of the domain DOM_INT.

Dom::Natural is the domain of natural integer numbers represented by expressions of type DOM_INT.

Elements of Dom::Natural are usually not created explicitly. However, if one creates elements using the usual syntax, it is checked whether the input is an integer number. This means that Dom::Natural is a façade domain which creates elements of domain type DOM_INT.

Viewed as a differential ring Dom::Natural is trivial, it contains constants only.

Dom::Natural has the domain Dom::Numerical as its super domain, i.e., it inherits each method which is defined by Dom::Numerical and not re-implemented by Dom::Natural. Methods described below are those implemented by Dom::Natural.

Superdomain

Dom::Numerical

Examples

Example 1

Creating some integer numbers using Dom::Natural. This example also shows that Dom::Natural is a façade domain.

Dom::Natural(2); domtype(%)

Dom::Natural(2/3)
Error: The arguments are invalid. [Dom::Natural::new]

Example 2

By tracing the method Dom::Natural::testtypeDom we can see the interaction between testtype and Dom::Natural::testtypeDom.

prog::trace(Dom::Natural::testtypeDom):
delete x:
testtype(x, Dom::Natural);
testtype(3, Dom::Natural);
prog::untrace(Dom::Natural::testtypeDom):
enter Dom::Natural::testtypeDom(x, Dom::Natural)
computed FAIL


enter Dom::Natural::testtypeDom(3, Dom::Natural)
computed TRUE

Parameters

x

An integer

Methods

expand all

Mathematical Methods

_divide(x, y)

_divides(x, y)

euclideanDegree(x)

factor(x)

gcd(x1, x2, …)

gcdex(x, y)

_invert(x)

irreducible(x)

isUnit(x)

lcm(x1, x2, …)

quo(x, y)

random()

random(n)

random(m, …, n)

This methods returns a random number between 0 and n - 1.

This methods returns a random number between m and n.

rem(x, y)

unitNormal(x)

unitNormalRep(x)

Conversion Methods

convert(x)

convert_to(x, T)

The following domains are allowed for for T: DOM_INT, Dom::Natural, Dom::Rational, DOM_FLOAT, Dom::Float and Dom::Numerical.

testtype(x, T)

Usually, this method is called from the function testtype and not directly by the user. Example 2 demonstrates this behavior.

Was this topic helpful?