Previous Page Next Page Contents

Dom::Numerical -- the field of numbers

Introduction

Dom::Numerical is the field of numbers.

Details

Creating Elements

Dom::Numerical(x)

Parameters

x - an arithmetical expression

Categories

Cat::DifferentialRing

, Cat::Field

Related Domains

Dom::Complex, Dom::Float, Dom::Integer, Dom::Rational, Dom::Real

Details

Entries

characteristic

is zero.

Method D: the differential operator for numbers

Method diff: differentiation of numbers

Method norm: the absolute value of numbers

Method random: random number generation

Method convert: conversion of objects into numbers

Method convert_to: conversion into other domains

Method testtype: type checking

Example 1

Dom::Numerical contains numbers of the domains DOM_INT, DOM_RAT, DOM_FLOAT and DOM_COMPLEX:

>> Dom::Numerical(2), Dom::Numerical(2/3), 
   Dom::Numerical(3.141), Dom::Numerical(2 + 3*I)
                          2, 2/3, 3.141, 2 + 3 I

Constant arithmetical expressions are converted into a real and complex floating point number, respectively, i.e., into an element of the domain DOM_FLOAT or DOM_COMPLEX (see the function float for details):

>> Dom::Numerical(exp(5)), Dom::Numerical(sin(2/3*I) + 3)
                     148.4131591, 3.0 + 0.717158461 I

Note that the elements of this domain are elements of kernel domains, there are no elements of the domain type Dom::Numerical!

An error message is issued for non-constant arithmetical expressions:

>> Dom::Numerical(sin(x))
      Error: illegal arguments [Dom::Numerical::new]

Example 2

Dom::Numerical is regarded as a field, and it therefore can be used as a coefficient ring of polynomials or as a component ring of matrices, for example.

We create the domain of matrices of arbitrary size (see Dom::Matrix) with numerical components:

>> MatN := Dom::Matrix(Dom::Numerical)
                        Dom::Matrix(Dom::Numerical)

Next we create a banded matrix, such as:

>> A := MatN(4, 4, [-PI, 0, PI], Banded)
        +-                                                       -+
        |        0,       3.141592654,       0,           0       |
        |                                                         |
        |  -3.141592654,       0,       3.141592654,      0       |
        |                                                         |
        |        0,      -3.141592654,       0,      3.141592654  |
        |                                                         |
        |        0,            0,      -3.141592654,      0       |
        +-                                                       -+

and a row vector with four components as a 1 x 4 matrix:

>> v := MatN([[2, 3, -1, 0]])
                              +-           -+
                              | 2, 3, -1, 0 |
                              +-           -+

Vector-matrix multiplication can be performed with the standard operator * for multiplication:

>> v * A
         +-                                                    -+
         | -9.424777961, 9.424777961, 9.424777961, -3.141592654 |
         +-                                                    -+

Finally we compute the determinant of the matrix A, using the function linalg::det of the linalg package:

>> linalg::det(A)
                                97.40909104

Super-Domain

Dom::ArithmeticalExpression

Axioms

Ax::canonicalRep

, Ax::systemRep, Ax::efficientOperation("_divide"), Ax::efficientOperation("_mult"), Ax::efficientOperation("_invert")

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000