Computer for operations with functions

From HandWiki

Within computer engineering and computer science, a computer for operations with (mathematical) functions (unlike the usual computer) operates with functions at the hardware level (i.e. without programming these operations).[1][2][3]

History

A computing machine for operations with functions was presented and developed by Mikhail Kartsev in 1967.[1] Among the operations of this computing machine were the functions addition, subtraction and multiplication, functions comparison, the same operations between a function and a number, finding the function maximum, computing indefinite integral, computing definite integral of derivative of two functions, derivative of two functions, shift of a function along the X-axis etc. By its architecture this computing machine was (using the modern terminology) a vector processor or array processor, a central processing unit (CPU) that implements an instruction set containing instructions that operate on one-dimensional arrays of data called vectors. In it there has been used the fact that many of these operations may be interpreted as the known operation on vectors: addition and subtraction of functions - as addition and subtraction of vectors, computing a definite integral of two functions derivative— as computing the vector product of two vectors, function shift along the X-axis – as vector rotation about axes, etc.[1] In 1966 Khmelnik had proposed a functions coding method,[2] i.e. the functions representation by a "uniform" (for a function as a whole) positional code. And so the mentioned operations with functions are performed as unique computer operations with such codes on a "single" arithmetic unit.[3]

Positional codes of one-variable functions

Source:[2][3]

The main idea

The positional code of an integer number [math]\displaystyle{ A }[/math] is a numeral notation of digits [math]\displaystyle{ \alpha }[/math] in a certain positional number system of the form

[math]\displaystyle{ A = \alpha_{0} \alpha_{1} \dots \alpha_k \dots \alpha_{n} }[/math].

Such code may be called "linear". Unlike it a positional code of one-variable [math]\displaystyle{ x }[/math] function [math]\displaystyle{ F(x) }[/math] has the form:

[math]\displaystyle{ F(x) = \begin{pmatrix} \ & \ & \cdots \\ \ & \ & \alpha_{22} \cdots \alpha_{2k} \cdots \\ \ & \alpha_{11} & \alpha_{12} \cdots \alpha_{1k} \cdots \\ \alpha_{00} & \alpha_{01} & \alpha_{02} \cdots \alpha_{0k} \cdots \end{pmatrix} }[/math]

and so it is flat and "triangular", as the digits in it comprise a triangle.

The value of the positional number [math]\displaystyle{ A }[/math] above is that of the sum

[math]\displaystyle{ A = \sum_{k=0}^n \alpha_k \rho^k }[/math],

where [math]\displaystyle{ \rho }[/math] is the radix of the said number system. The positional code of a one-variable function correspond to a 'double' code of the form

[math]\displaystyle{ F(x) = \sum_{k=0}^{n} \sum_{m=0}^{k} \alpha_{mk} R^ky^{k-m}(1-y)^m }[/math],

where [math]\displaystyle{ R }[/math] is an integer positive number, quantity of values that taken [math]\displaystyle{ \alpha }[/math], and [math]\displaystyle{ y }[/math] is a certain function of argument [math]\displaystyle{ x }[/math].

Addition of positional codes of numbers is associated with the carry transfer to a higher digit according to the scheme

[math]\displaystyle{ \alpha_{k} \longrightarrow \alpha_{k+1} }[/math].

Addition of positional codes of one-variable functions is also associated with the carry transfer to higher digits according to the scheme:

[math]\displaystyle{ \begin{pmatrix} \ \ & \alpha_{k+1,m+1} \\ \ \nearrow & \ \\ \alpha_{k,m} \longrightarrow & \alpha_{k+1,m} \end{pmatrix} }[/math].

Here the same transfer is carried simultaneously to two higher digits.

R-nary triangular code

A triangular code is called R-nary (and is denoted as [math]\displaystyle{ TK_R }[/math]), if the numbers [math]\displaystyle{ \alpha_{mk} }[/math] take their values from the set

[math]\displaystyle{ D_R = \{-r_1,-r_1+1,\dots, -1,0,1,\dots,r_2-1,r_2 \} }[/math], where [math]\displaystyle{ r_1,\;r_2\geq 0 }[/math] and [math]\displaystyle{ R_{}^{} =r_1+r_2+1 }[/math].

For example, a triangular code is a ternary code [math]\displaystyle{ TK_3 }[/math], if [math]\displaystyle{ \alpha_{mk} \in (-1,0,1) }[/math], and quaternary [math]\displaystyle{ TK_4 }[/math], if [math]\displaystyle{ \alpha_{mk} \in (-2,-1,0,1) }[/math].
For R-nary triangular codes the following equalities are valid:

[math]\displaystyle{ \begin{pmatrix} \ \ & 0 \\ \ \nearrow & \ \\ aR \longrightarrow & 0 \end{pmatrix}=\begin{pmatrix} \ \ & a \\ \ \nearrow & \ \\ 0 \longrightarrow & a \end{pmatrix}, \quad \begin{pmatrix} \ \ & a \\ \ \nearrow & \ \\ 0 \longrightarrow & 0 \end{pmatrix}=\begin{pmatrix} \ \ & 0 \\ \ \nearrow & \ \\ aR \longrightarrow & -a \end{pmatrix}, \quad \begin{pmatrix} \ \ & 0 \\ \ \nearrow & \ \\ 0 \longrightarrow & a \end{pmatrix}=\begin{pmatrix} \ \ & -a \\ \ \nearrow & \ \\ aR \longrightarrow & 0 \end{pmatrix} }[/math],

where [math]\displaystyle{ a }[/math] is an arbitrary number. There exists [math]\displaystyle{ TK_R }[/math] of an arbitrary integer real number. In particular, [math]\displaystyle{ TK_R(\alpha)=\alpha }[/math]. Also there exists [math]\displaystyle{ TK_R }[/math] of any function of the form [math]\displaystyle{ y^{k} }[/math]. For instance, [math]\displaystyle{ TK_R(y^{2})=(0\ 0\ 1) }[/math].

Single-digit addition

in R-nary triangular codes consists in the following:

  • in the given [math]\displaystyle{ (mk) }[/math]-digit there is determined the sum [math]\displaystyle{ S_{mk}^{} }[/math] of the digits that are being added [math]\displaystyle{ \alpha_{mk}, \ \beta_{mk} }[/math] and two carries [math]\displaystyle{ p_{m,k-1}, \ p_{m-1,k-1} }[/math], transferred into this digit from the left, i.e.
[math]\displaystyle{ S_{mk}^{}=\alpha_{mk}+\beta_{mk}+p_{m,k-1}+p_{m-1,k-1} }[/math],
  • this sum is presented in the form [math]\displaystyle{ S_{mk}^{}=\sigma_{mk}+Rp_{mk} }[/math], where [math]\displaystyle{ \sigma_{mk} \in D_R }[/math],
  • [math]\displaystyle{ \sigma_{mk} }[/math] is written in the [math]\displaystyle{ (mk) }[/math]-digit of summary code, and the carry [math]\displaystyle{ p_{mk} }[/math] from the given digit is carried into [math]\displaystyle{ (m,k+1) }[/math]-digit and [math]\displaystyle{ (m+1,k+1) }[/math]—digit.

This procedure is described (as also for one-digit addition of the numbers) by a table of one-digit addition, where all the values of the terms [math]\displaystyle{ \alpha_{mk} \in D_R }[/math] and [math]\displaystyle{ \beta_{mk} \in D_R }[/math] must be present and all the values of carries appearing at decomposition of the sum [math]\displaystyle{ S_{mk}^{}=\sigma_{mk}+Rp_{mk} }[/math]. Such a table may be synthesized for [math]\displaystyle{ R\gt 2. }[/math]
Below we have written the table of one-digit addition for [math]\displaystyle{ R=3 }[/math]:

Smk TK(Smk) [math]\displaystyle{ \sigma_{mk}^{} }[/math] [math]\displaystyle{ p_{mk}^{} }[/math]
. . 0 . .
0 0 0 0 0
. . 0 . .
1 1 0 1 0
. . 0 . .
(-1) (-1) 0 (-1) 0
. . 1 . .
2 (-1) 1 (-1) 1
. . 1 . .
3 0 1 0 1
. . 1 . .
4 1 1 1 1
. . (-1) . .
(-2) 1 (-1) 1 (-1)
. . (-1) . .
(-3) 0 (-1) 0 (-1)
. . (-1) . .
(-4) (-1) (-1) (-1) (-1)

One-digit subtraction

in R-nary triangular codes differs from the one-digit addition only by the fact that in the given [math]\displaystyle{ (mk) }[/math]-digit the value [math]\displaystyle{ S_{mk}^{} }[/math] is determined by the formula

[math]\displaystyle{ S_{mk}^{}=\alpha_{mk}-\beta_{mk}+p_{m,k-1}+p_{m-1,k-1} }[/math].

One-digit division by the parameter R

in R-nary triangular codes is based on using the correlation:

[math]\displaystyle{ \begin{pmatrix} \ \ & a \\ \ \nearrow & \ \\ 0 \longrightarrow & 0 \end{pmatrix}=\begin{pmatrix} \ \ & 0 \\ \ \nearrow & \ \\ aR \longrightarrow & -a \end{pmatrix} }[/math],

from this it follows that the division of each digit causes carries into two lowest digits. Hence, the digits result in this operation is a sum of the quotient from the division of this digit by R and two carries from two highest digits. Thus, when divided by parameter R

  • in the given [math]\displaystyle{ (mk) }[/math]-digit the following sum is determined
[math]\displaystyle{ S_{mk}^{}=\alpha_{mk}/R-p_{m+1,k}/R+p_{m+1,k+1} }[/math],
  • this sum is presented as [math]\displaystyle{ S_{mk}^{}=\sigma_{mk}+p_{mk}/R }[/math], where [math]\displaystyle{ \sigma_{mk} \in D_R }[/math],
  • [math]\displaystyle{ \sigma_{mk} }[/math] is written into [math]\displaystyle{ (mk) }[/math]—digit of the resulting code, and carry [math]\displaystyle{ p_{mk} }[/math] from the given digit is transferred into the [math]\displaystyle{ (m-1,k-1) }[/math]-digit and [math]\displaystyle{ (m-1,k) }[/math]-digit.

This procedure is described by the table of one-digit division by parameter R, where all the values of terms and all values of carries, appearing at the decomposition of the sum [math]\displaystyle{ S_{mk}^{}=\sigma_{mk}+p_{mk}/R }[/math], must be present. Such table may be synthesized for [math]\displaystyle{ R\gt 2. }[/math]
Below the table will be given for the one-digit division by the parameter R for [math]\displaystyle{ R=3 }[/math]:

Smk TK(Smk) [math]\displaystyle{ \sigma_{mk}^{} }[/math] [math]\displaystyle{ p_{mk}^{} }[/math]
. . 0 . .
0 0 0 0 0
. . 1 . .
1 0 0 1 0
. . (-1) . .
(-1) 0 0 (-1) 0
. . 0 . .
1/3 1 (-1/3) 0 1
. . 1 . .
2/3 (-1) 1/3 1 (-1)
. . 1 . .
4/3 1 (-1/3) 1 1
. . 2 . .
5/3 (-1) 1/3 2 (-1)
. . 0 . .
(-1/3) (-1) 1/3 0 (-1)
. . (-1) . .
(-2/3) 1 (-1/3) (-1) 1
. . (-1) . .
(-4/3) (-1) 1/3 (-1) (-1)
. . (-2) . .
(-5/3) 1 (-1/3) (-2) 1

Addition and subtraction

of R-nary triangular codes consists (as in positional codes of numbers) in subsequently performed one-digit operations. Mind that the one-digit operations in all digits of each column are performed simultaneously.

Multiplication

of R-nary triangular codes. Multiplication of a code [math]\displaystyle{ TK_R'^{} }[/math] by [math]\displaystyle{ (mk) }[/math]-digit of another code [math]\displaystyle{ TK_R''^{} }[/math] consists in [math]\displaystyle{ (mk) }[/math]-shift of the code [math]\displaystyle{ TK_R'^{} }[/math], i.e. its shift k columns left and m rows up. Multiplication of codes [math]\displaystyle{ TK_R'^{} }[/math] and [math]\displaystyle{ TK_R''^{} }[/math] consists in subsequent [math]\displaystyle{ (mk) }[/math]-shifts of the code [math]\displaystyle{ TK_R'^{} }[/math] and addition of the shifted code [math]\displaystyle{ TK_R'^{} }[/math] with the part-product (as in the positional codes of numbers).

Derivation

of R-nary triangular codes. The derivative of function [math]\displaystyle{ F(x) }[/math], defined above, is

[math]\displaystyle{ \frac{\partial F(x)}{\partial x}=\frac{\partial y}{\partial x} \frac{\partial F(x)}{\partial y} }[/math].

So the derivation of triangular codes of a function [math]\displaystyle{ F(x) }[/math] consists in determining the triangular code of the partial derivative [math]\displaystyle{ \frac{\partial F(x)}{\partial y} }[/math] and its multiplication by the known triangular code of the derivative [math]\displaystyle{ \frac{\partial y}{\partial x} }[/math]. The determination of the triangular code of the partial derivative [math]\displaystyle{ \frac{\partial F(x)}{\partial y} }[/math] is based on the correlation

[math]\displaystyle{ \frac{\partial }{\partial x} \begin{pmatrix} \ & \ & 0 \\ \ & 0 & \alpha_{mk} \\ 0 & 0 & 0 \end{pmatrix}=\begin{pmatrix} \ & \ & (k-m) \alpha_{mk} \\ \ & 0 & (k-2m) \alpha_{mk} \\ 0 & 0 & (-m) \alpha_{mk} \end{pmatrix} }[/math].

The derivation method consists of organizing carries from mk-digit into (m+1,k)-digit and into (m-1,k)-digit, and their summing in the given digit is performed in the same way as in one-digit addition.

Coding and decoding

of R-nary triangular codes. A function represented by series of the form

[math]\displaystyle{ F(x) = \sum_{k=0}^{n} A_k y^k }[/math],

with integer coefficients [math]\displaystyle{ A_k }[/math], may be represented by R-nary triangular codes, for these coefficients and functions [math]\displaystyle{ y^k }[/math] have R-nary triangular codes (which was mentioned in the beginning of the section). On the other hand, R-nary triangular code may be represented by the said series, as any term [math]\displaystyle{ \alpha_{mk} R^ky^k(1-y)^m }[/math] in the positional expansion of the function (corresponding to this code) may be represented by a similar series.

Truncation

of R-nary triangular codes. This is the name of an operation of reducing the number of "non"-zero columns. The necessity of truncation appears at the emergence of carries beyond the digit net. The truncation consists in division by parameter R. All coefficients of the series represented by the code are reduced R times, and the fractional parts of these coefficients are discarded. The first term of the series is also discarded. Such reduction is acceptable if it is known that the series of functions converge. Truncation consists in subsequently performed one-digit operations of division by parameter R. The one-digit operations in all the digits of a row are performed simultaneously, and the carries from lower row are discarded.

Scale factor

R-nary triangular code is accompanied by a scale factor M, similar to exponent for floating-point number. Factor M permits to display all coefficients of the coded series as integer numbers. Factor M is multiplied by R at the code truncation. For addition factors M are aligned, to do so one of added codes must be truncated. For multiplication the factors M are also multiplied.

Positional code for functions of many variables

Source:[4]

Positional code for function of two variables is depicted on Figure 1. It corresponds to a "triple" sum of the form:: [math]\displaystyle{ F(x,v) = \sum_{k=0}^{n} \sum_{m1=0}^{k} \sum_{m2=0}^{k} \alpha_{m1,m2,k} R^k y^{k-m1}(1-y)^{m1} z^{k-m2}(1-z)^{m2} }[/math],
where [math]\displaystyle{ R }[/math] is an integer positive number, number of values of the figure [math]\displaystyle{ \alpha_{m1,m2,k} }[/math], and [math]\displaystyle{ y(x), ~ z(v) }[/math] — certain functions of arguments [math]\displaystyle{ x, ~ v }[/math] correspondingly. On Figure 1 the nodes correspond to digits [math]\displaystyle{ \alpha_{m1,m2,k} }[/math], and in the circles the values of indexes [math]\displaystyle{ {m1,m2,k} }[/math] of the corresponding digit are shown. The positional code of the function of two variables is called "pyramidal". Positional code is called R-nary (and is denoted as [math]\displaystyle{ PK_R }[/math]), if the numbers [math]\displaystyle{ \alpha_{m1,m2,k} }[/math] assume the values from the set [math]\displaystyle{ D_R }[/math]. At the addition of the codes [math]\displaystyle{ PK_R }[/math] the carry extends to four digits and hence [math]\displaystyle{ R \geq 7 }[/math].

A positional code for the function from several variables corresponds to a sum of the form

[math]\displaystyle{ F(x_1,\ldots, x_i, \ldots, x_a ) = \sum_{k=0}^{n} \sum_{m_1=0}^{k} \ldots \sum_{m_a=0}^{k} (\alpha_{m_1, \ldots, m_a,k} R^k \prod^a_{i=1}(y_i^{k-m_i}(1-y_i)^{m_i})) }[/math],

where [math]\displaystyle{ R }[/math] is an integer positive number, number of values of the digit [math]\displaystyle{ \alpha_{m_1, \ldots, m_a,k} }[/math], and [math]\displaystyle{ y_i(x_i) }[/math] certain functions of arguments [math]\displaystyle{ x_i }[/math]. A positional code of a function of several variables is called "hyperpyramidal". Of Figure 2 is depicted for example a positional hyperpyramidal code of a function of three variables. On it the nodes correspond to the digits [math]\displaystyle{ \alpha_{m1,m2,m3,k} }[/math], and the circles contain the values of indexes [math]\displaystyle{ {m1,m2,m3,k} }[/math] of the corresponding digit. A positional hyperpyramidal code is called R-nary (and is denoted as [math]\displaystyle{ GPK_R }[/math]), if the numbers [math]\displaystyle{ \alpha_{m_1, \ldots, m_a,k} }[/math] assume the values from the set [math]\displaystyle{ D_R }[/math]. At the codes addition [math]\displaystyle{ GPK_R }[/math] the carry extends on a-dimensional cube, containing [math]\displaystyle{ 2^a }[/math] digits, and hence [math]\displaystyle{ R \geq (2^{a-1}-1) }[/math].

See also

References

  1. 1.0 1.1 1.2 Malinovsky, B.N. (1995). The history of computer technology in their faces (in Russian). Kiew: Firm "KIT". ISBN 5-7707-6131-8.  (see also here http://www.sigcis.org/files/SIGCISMC2010_001.pdf and english version here)
  2. 2.0 2.1 2.2 Khmelnik, S.I. (1966). Coding of functions. 4. Cybernetics, USSR Academy of Sciences. (see also here in Russian)
  3. 3.0 3.1 3.2 Khmelnik, S.I. (2004). Computer Arithmetic of Functions. Algorithms and Hardware Design. Israel. ISBN 978-0-557-07520-1.  (see also here in Russian)
  4. Khmelnik, S.I. (1970). Several types of positional functions codes. 5. Cybernetics, USSR Academy of Sciences.  (see also here in Russian)