## `rectform` -- the domain of expressions being splitted into real and imaginary part

#### Introduction

`rectform` is the domain of arithmetical expressions being splitted into their real and imaginary part (if possible), i.e., an expression z of this domain is kept in the form Re(z) + I*Im(z), if possible.

#### Creating Elements

`rectform(z)`

#### Parameters

`z` | - | an arithmetical expression

#### Details

- See the help page of the system function `rectform` for a detailed description and examples about working with elements of the domain `rectform`.

#### Operands

An element z of `rectform` consists of three operands:

1. the real part of z,
2. the imaginary part of z,
3. the part of z, for that the real and imaginary part cannot be computed (possibly the integer 0, if there are not such subexpressions).

#### Related Domains

`DOM_COMPLEX`

#### Important Operations

You can apply (almost) each function to elements of `rectform`, functions which mainly expect arithmetical expressions as their input.

For example, you may add or multiply those elements, or apply functions such as `expand` and `diff` to them. The result of such an operation, which is not explicitely overloaded by a method of `rectform` (see below), is an element of `rectform`.

This ``automatic overloading'' works as follows: Each argument of the operation, which is an element of `rectform`, is converted to an expression using the method `"expr"` (see below). Then, the operation is applied and the result is re-converted to an element of `rectform`.

Use the function `expr` to convert an element of `rectform` to an arithmetical expression (as an element of a kernel domain).

The functions `Re` and `Im` return the real and imaginary part of elements of `rectform`.

#### Result of Evaluation

Evaluating an object of type `rectform` returns itself.

#### Function Call

Calling an element of `rectform` as a function yields the object itself, regardless of the arguments. The arguments are not evaluated.

#### Method _mult: multiply elements

- `_mult(rectform z, any x...)`
- - It tries to split the product z*x*... into its real and imaginary part and returns the result as an element of `rectform`.
  - This method overloads the function `_mult` for elements of `rectform`, i.e., you may use it in the form `z*x*...`, or in functional notation: `_mult(z, x...)`.

#### Method _plus: add elements

- `_plus(rectform z, any x...)`
- - It tries to split the sum z+x+... into its real and imaginary part and returns the result as an element of `rectform`.
  - This method overloads the function `_plus` for elements of `rectform`, i.e., you may use it in the form `z+x+ ...`, or in functional notation: `_plus(z, x...)`.

#### Method _power: raise an element to a certain power

- `_power(rectform z, any x)`
- - It tries to split z^x into its real and imaginary part and returns the result as an element of `rectform`.
  - This method overloads the function `_power` for elements of `rectform`, i.e., you may use it in the form `z^x`, or in functional notation: `_power(z, x)`.

#### Method conjugate: the complex conjugate

- `conjugate(rectform z)`
- - Computes the complex conjugate of `z` and returns the result as an element of `rectform`.
  - This method overloads the function `conjugate` for elements of `rectform`, i.e., you may use it in the form `conjugate(z)`.

#### Method float: floating point approximation

- `float(rectform z)`
- - Computes a floating point approximation of `z` by applying `float` to `z`. The result is of the domain type `DOM_FLOAT`.

    The precision of the approximation depends on the environment variable `DIGITS`.

  - This method overloads the function `float` for elements of `rectform`, i.e., you may use it in the form `float(z)`.

#### Method Re: the real part

- `Re(rectform z)`
- - Returns the real part of `z`.
  - This method overloads the function `Re` for elements of `rectform`, i.e., you may use it in the form `Re(z)`.

#### Method Im: the imaginary part

- `Im(rectform z)`
- - Returns the imaginary part of `z`.
  - This method overloads the function `Im` for elements of `rectform`, i.e., you may use it in the form `Im(z)`.

#### Method iszero: test on zero

- `iszero(rectform z)`
- - Returns `TRUE` if `z` is zero, i.e, the three operands of `z` are zero.
  - This method overloads the function `iszero` for elements of `rectform`, i.e., you may use it in the form `iszero(z)`.

#### Method has: existence of an object

- `has(rectform z, any x...)`
- - Test whether an operand of `z` contains `x`. See the system function `has` for a detailed description of the parameters.
  - This method overloads the function `has` for elements of `rectform`, i.e., you may use it in the form `has(z, x...)`.

#### Method nops: the number of operands

- `nops(rectform z)`
- - Returns the number of operands of `z`, which is 3 for any element of `rectform`.
  - This method overloads the function `nops` for elements of `rectform`, i.e., you may use it in the form `nops(z)`.

#### Method op: extract an operand

- `op(rectform z, positive integer i)`
- - Returns the `i`-th operand of `z` (see above for a description of the operands of such elements).
  - Returns `FAIL`, if `i` is greater than 3 (i.e., the number of operands of `z`).
  - This method overloads the function `op` for elements of `rectform`, i.e., you may use it in the form `op(z, i)`.

#### Method subs: substitute subexpressions

- `subs(rectform z, equation x = a...)`
- - Substitute subexpressions in the operands of `z`. See the system function `subs` for a detailed description of the parameters.
  - This method overloads the function `subs` for elements of `rectform`, i.e., you may use it in the form `subs(z, x = a...)`.

#### Method subsex: substitute subexpressions (extended)

- `subsex(rectform z, equation x = a...)`
- - Substitute subexpressions in the operands of `z`. See the system function `subsex` for a detailed description of the parameters.
  - This method overloads the function `subsex` for elements of `rectform`, i.e., you may use it in the form `subsex(z, x = a...)`.

#### Method convert: convert an object to this domain

- `convert(any x)`
- - This method converts `x` to an element of the domain type `rectform`, if `x` is an arithmetical expression (see `Type::Arithmetical`). Otherwise `FAIL` is returned.

#### Method convert_to: convert an element of this domain to other domains

- `convert_to(rectform z, any T)`
- - This method tries to convert `z` to an element of domain type `T`, or, if `T` is not a domain, to the domain type of `T`.
  - It is implemented in the following way: First, `z` is converted to an arithmetical expression using the method `"expr"`. Then, the method `"convert"` of the domain `T` (or its domain type) is called to perform the conversion.
  - Use the function `expr` to convert `z` to an object of a kernel domain.

#### Method expr: convert an element of this domain to a kernel domain

- `expr(rectform z)`
- - Converts `z` to an element of a kernel domain, i.e., the expression `o1 + I*o2 + o3` is returned, where `o1, o2` and `o3` are the operands of `z`.

#### Method expr2text: convert an element of this domain to a string

- `expr2text(rectform z)`
- - Converts `z` to a string.
  - This method overloads the function `expr2text` for elements of `rectform`, i.e., you may use it in the form `expr2text(z)`.

#### Method testtype: type testing

- `testtype(rectform z, domain T)`
- - Checks, if `z` can be converted to an element of the domain `T`, and returns `TRUE` or `FALSE`, respectively.
  - It is implemented in the following way: First, `z` is converted to an arithmetical expression using the method `"expr"`. After this, the function `testtype` is called and its result is returned.
  - This method is called from the system function `testtype`.

#### Method TeX: LaTeX formatting

- `TeX(rectform z)`
- - Returns a LaTeX-formatted string for `z`.
  - This method is called from the system function `generate::TeX`.

#### Method length: length of an object

- `length(rectform z)`
- - Returns the length of `f`, which is the length of the expression `o1 + I*o2 + o3`, where `o1, o2` and `o3` are the operands of `z`.
  - This method overloads the function `length` for elements of `rectform`, i.e., you may use it in the form `length(z)`.

#### Method print: pretty-print routine

- `print(rectform z)`
- - Returns the unevaluated expression `o1 + I*o2 + o3`, where `o1, o2` and `o3` are the operands of `z`.
  - This method is used from the system function `print` for printing elements of `rectform` to the screen.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000