Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ PrefaceContents1 Introduction2 The basic language3 Storage and block structure of programs4 Routines5 Data I/O6 Monitor printing and fault diagnosis7 Presentation of complete programs8 Complex arithmetic9 Store Mapping10 The use of machine instructions11 Permanent routines □ Appendices and indices □ A1 Phrase structure notationA2 Standard functions and permanent routinesA3 DelimitersA4 Monitored faultsA5 Numerical equivalents of symbols
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureAtlas manualsAtlas Autocode :: ATLAS AUTOCODE REFERENCE MANUAL
ACLLiteratureAtlas manualsAtlas Autocode :: ATLAS AUTOCODE REFERENCE MANUAL
ACL ACD C&A INF CCD CISD Archives
Further reading

Preface
Contents
1 Introduction
2 The basic language
3 Storage and block structure of programs
4 Routines
5 Data I/O
6 Monitor printing and fault diagnosis
7 Presentation of complete programs
8 Complex arithmetic
9 Store Mapping
10 The use of machine instructions
11 Permanent routines
Appendices and indices
A1 Phrase structure notation
A2 Standard functions and permanent routines
A3 Delimiters
A4 Monitored faults
A5 Numerical equivalents of symbols

8 Complex Arithmetic

As indicated previously, facilities exist for the manipulation of complex as well as real and integer quantities. complex quantities are stored as a pair of real numbers in consecutive locations (the real and imaginary parts respectively). The address of the complex quantity is that of the real part.

8.1 Declarations

All quantities must be declared before they are referred to. For example:-

 
real   R1, R2, R3
complex    z
complex array   P(1:10), Q(1:10,1:10)

causes 3 locations to be reserved for R1, R2, R3, 2 for z, 20 for P and 200 for Q.

8.2 Standard Functions

The following standard functions are added to those previously given:-

re(z)      (real part of z)
im(z)      (imaginary part of z)
mag(z)     (modulus of z)
arg(z)     (argument of z  - in radians)
conj(z)    (complex conjugate of z)

The argument z may be any [EXPR] (in the complex sense as described below) The functions

csin, ccos, ctan, cexp, clog, csqrt

have complex [EXPR]'s as arguments and yield results of complex type. For example if z = x + iy, cexp(z) = exp(x)(cos(y) + i sin(y)) In the case of clog and csqrt it is the principal value which is computed, i.e., the value for which the argument θ lies in the range -π≤θ<π

8.3 Arithmetic Expressions

The arithmetic expression [EXPR] is still of the form

[±'][OPERAND][OPERATOR][OPERAND][OPERATOR] ........ [OPERAND]

but [OPERAND] is now expanded to be

[VARIABLE],[CONSTANT],([EXPR]),|[EXPR]|,[FUNCTION] or i
         

Here i is a delimiter denoting the i (or j) of complex algebra notation.

Examples of this more general expression are:-

(V*conj(I) - I*conj(V))/(2i)
(Z1Z2 + Z2Z3 + Z3Z1)/Z3
Y(1,2) + csin(conj(Y(2,1)))
R0*(1 + 2iQ0d)
i
         

When a complex number is written out explicitly (say x + iy), then it is regarded as 3 operands (x,i and y) connected by the two operators + and (implied) *. Thus if the brackets were omitted from the denominator in the first example it would mean

((V*conj(I) - I*conj(V))/i)2

8.4 Arithmetic Instructions

The form of an assignment instruction remains

[VARIABLE] = [EXPR]

but [VARIABLE] now includes complex scalars and complex array elements. For example:-

Z = Z1Z2/(Z1 + Z2)
Y = G + i2πf*c
A(p,q) = 2csin(2πz)
R = R1 + re(Z)
P = ½re(V*conj(I) + I*conj(V))
NOTES

1. Just as real quantities may not appear on the r.h.s. of an integer assignment (except as arguments of integer functions), so complex quantities may not appear in real or integer expressions. However, the functions

re(z), im(z), mag(z), arg(z)

convert from complex to real quantities and may therefore appear on the r.h.s. of a real assignment. In fact any function whose value is real regardless of its arguments may be used in a real expression (just as any integer function, regardless of its argument, may appear in an integer expression). Thus if X and B are real and Y complex then:-

X = B + im(Y)

is valid.

2. re(z) and im(z) are actual locations in the store and can therefore be used on the l.h.s. of an instruction (whose mode is then real). For example:-

re(z) = sqrt(2)
im(y) = 5 + im(z1)

However, mag(z) and arg(z), even though they do define z, are not locations in the store and cannot be used on the l.h.s. If a complex quantity is being evaluated by means of the evaluation of its magnitude (m) and argument (a), the assignment is done by

z = m*(cos(a) + i sin(a))
or      
z = m*cexp(ia)

8.5 Conditions

In conditional operators, [EXPR]'s must be real (in the sense of note 1 of the previous section ). Hence the following are legitimate:-

 
  if arg (z) ≥ π/2 then -> 3
3 case mag(z) ≥ 1 :

8.6 Routine and Functions

Since routines and functions are allowed to operate on complex quantities, the parameter types have been expanded to include

Formal parameter type Corresponding actual parameter
complex name name of a complex variable
complex any expression (which will be evaluated as if for a complex assignment)
complex array name name of a complex array
complex array name of a complex array

The routine types [RT] have also been expanded to include complex fn. As an example we will rewrite the function routine for the polynomial

a(m) + a(m+1)x+.......... + a(m+n)x↑n

assuming x and the coefficients a(i) to be complex.

 
complex fn poly (complex arrayname a, complex x, integer m,n)
integer i ; complex y
y = a(m+n) ; result = y if n = 0
cycle i = m+n-1, -1, m
y = y*x + a(i)
repeat 
result = y
end
         

8.7 Input and Output of Complex Numbers

Data is punched in the form

[REAL PART] ± i [IMAGINARY PART]

but the individual parts can be punched in any acceptable 'real' form. Both parts must be punched however. For example:-

3+i4  0+i1  -0.5+i 0   1.17α3 -i2.13α4

They may be read by the instruction

read(Z1,Z2,Z3,Z4)

The permanent routines

print complex(complex z, integer m,n)
print complex fl(complex z, integer n)

print the value of z in the form

[REAL PART] ± i [IMAGINARY PART]

the individual parts being printed with the aid of the corresponding real routines, 'print' and 'print fl', using the same digit layout parameters. For 7-hole tape this form of output is compatible with the format for punching complex data.

NOTES
  1. Spaces are permitted except in the two number parts themselves. In these they may only appear after an α (see description of basic input routines).
  2. The other input and output routines described in Section 5 have not been generalised to deal with complex numbers.
  3. One may of course read a pair of real numbers on a data tape as a complex number by the 'real' read instruction
    read(re(z),im(z))
    
⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site