Complexes.mesa
Last Edited by: Arnon, June 10, 1985 4:19:22 pm PDT
DIRECTORY
Rope,
Vector2 USING [VEC],
Basics,
IO,
AlgebraClasses,
Points;
Complexes: CEDAR DEFINITIONS
= BEGIN OPEN AC: AlgebraClasses, PTS: Points;
Types and Variables
ROPE: TYPE = Rope.ROPE;
Complex: TYPE = REF ComplexRep;
ComplexRep: TYPE = RECORD [
val: Vector2.VEC
];
ComplexPoint: TYPE = PTS.Point;
Complexes: AC.Structure;
I/O and Conversion
Read: PROC [in: IO.STREAM] RETURNS [out: Complex];
FromRope: PROC [in: Rope.ROPE] RETURNS [out: Complex];
ToRope: PROC [in: Complex] RETURNS [out: Rope.ROPE];
Write: PROC [stream: IO.STREAM, in: Complex];
FromPairREAL: PROC [realPart, imagPart: REAL] RETURNS [Complex];
ToPairREAL: PROC [in: Complex] RETURNS [realPart, imagPart: REAL];
Arithmetic
Add: PROC [a, b: Complex] RETURNS [Complex];
Negate: PROC [a: Complex] RETURNS [result: Complex];
Subtract: PROC [a, b: Complex] RETURNS [Complex];
Multiply: PROC [a, b: Complex] RETURNS [result: Complex];
Conjugate: PROCEDURE [a: Complex] RETURNS [Complex];
ModulusSquared: PROCEDURE [a: Complex] RETURNS [REAL];
Modulus: PROCEDURE [a: Complex] RETURNS [REAL];
Invert: PROC [a: Complex] RETURNS [result: Complex];
Divide: PROC [a, b: Complex] RETURNS [result: Complex];
AlmostEqual: PROCEDURE [a: Complex, b: Complex, mag:[-126..0] ← -20] RETURNS [BOOLEAN];
FromPolar: PROCEDURE [r: REAL, radians: REAL] RETURNS [Complex];
Arg: PROCEDURE [a: Complex] RETURNS [REAL];
returns the angle from the x axis to a, in radians.
Exp: PROCEDURE [a: Complex] RETURNS [Complex];
complex exponential function
Ln: PROCEDURE [a: Complex] RETURNS [Complex];
complex natural logarithm
Sqr: PROCEDURE [a: Complex] RETURNS [Complex]; -- like Mul[a,a]
SqRt: PROCEDURE [a: Complex] RETURNS [Complex]; -- complex square root
END.