This routine finds a root of a polynomial with complex coefficients.
MODE C serves as the type of the coefficients and root.
Different users may want to change the number of LONGs there.
0, 1 or 2 LONGs all make sense in the Genie algol.
It is tedious to do this because the following changes are concomitant:
- Change MODE C = LONG COMPLEX to MODE C = LONG LONG COMPLEX,
- Change (LONG REAL x) to (LONG LONG REAL x),
- Change SHORTEN x to SHORTEN SHORTEN x,
- Change long small real to long long small real,
The diagnostic messages may not lead the new user thru this process well.
The revised report suffers from this problem and introduces a glyph that stands for some number of LONGs coordinated with another glyph that denotes the same number of longs.
This luxury is denied the programmer.
I know no language that does much better but I think that modern Fortrans may have some good ideas.
It seems more critical here because of Genie algol’s unusual high precision options.
Modules
I am having to import various fragments of code into the project to find eigenvalues and vectors for general square matrices.
Fixes to the copied code will probably not get back to their source.
I also need to parameterize the types; for instance the inversion routine did reals and in this context it needs to do LONG COMPLEX.
There are templates in C++ for this sort of thing but I detest them.
All this is simple in my Scheme modules, but it is indeed more complicated for a typed language.
The code still fails when the first several derivatives are zero at the point that I probe.
Suppose we have the polynomial:
p(x) = x5 + 2.3 i x3 − 1.0 .
We begin at zero but while p(0) ≠ 0, p'(0) = p''(0) = 0.
p'''(x) = 60x2 + 6∙2.3 i.
If we move in the direction (−1)⅓ 2.3 i we come to points where |p(x)| is smaller.
There are three such directions and any one will do.