# Programming in Delphi

## Other releases:   200620052004

Everything you always wanted to know about Splines but never dared to ask ...
The point I want to make here is that there is no need to use
Cubic (or whatever higher order) splines in two dimensions. Because they offer no significant advantage, when compared with the simplest member of the family: the Quadratic Spline. Convince yourself by reading / running the stuff I have brewed on this subject:

Sober thinking reveals that you can combine sets of straight line segments with parabolic splines to generate virtually any shape you can dream of, with any desired accuracy. I simply find arguments that sound otherwise not very convincing. The incredible fact that higher order splines, nevertheless, have gained much more attention is due, a great deal, to patents, CopyRights & the like. In short: misplaced commercial interests rule the roast. Splines have too much to do with the costly (!) design of fonts, for example. This explains something, but, in my humble opinion, doesn't justify anything. It is sad to remark that non-mathematical arguments prevail, most of the time. But, that such a thing can happen even in the area of Pure Mathematics, is almost unbelievable, to me at last.

Note: my son said to me that the prevalence of cubic splines is maybe due to the fact that one can easily build an interactive designing program with the latter, but not with the former. Well, I must admit that would be a "legal" consideration, at last.

(*) But .. I've made a mistake with terminology. The following is a comment by Rob Johnson.

• The second order counterpart of cubic splines are quadratic splines, which, as you have noted in your citations, are parabolic sections. However, [ your PDF ] seems to say that quadratic splines and conic splines are the same. While all quadratic splines are conic splines, not all conic splines are quadratic. In fact, quadratic splines are the intersection of cubic splines and conic splines, and proper subsets of both. Conic splines are rational splines, and as such are closed under not only affine transformations, but also perspective transformations.

Kind of a Test Facility has been devised for Discrete / Random / Continuous Densities and Senses. The purpose of it being able to test some theory, and also getting familiar with the subject as such. A prototype of this has been published earlier, in a chapter called Continue Bovenbouw which is part of a whole book (written in Dutch, my mother's tongue). The book is about what I thought to be Foundational Issues in Mathematics, at that time. Meanwhile, I have come to a quite different belief. I am convinced, nowadays, that all Mathematics is complicated from the beginning and there is NO such thing as an evolution from the simple to the more complicated. So far so good. Let's return to the point. Our Densities and Senses Test Bank has been made available as:

Densities and Senses are quite intimately related to the subjects that follow.

• Wazige Optiek
Further thinking has given rise to a couple of new delightful insights, which should not be missing in my Snippets of Pure Applicable Mathematics (SPAM ;-) . This ultimate Anti-Aliasing demo has been made available as:

What's highly frustrating for a computer minded musician is the fact that those stupid machines still aren't capable of reading ordinary Music Score. No, they can't ! Even though certain brave vendors (as always) claim that they can. Have you ever fed a hand-written document into your scanner and expect something sensible to come out ? Neat copies - having been generated already with a Midi to Score comverter like the (excellent !) NoteWorthy Composer - do not represent a real-world problem, do they ? I'm So Sorry ...
What could have been the first step in Music Score Recognition, according to my humble viewpoint, is the mere Recognition of Straight Lines. My Pixel Thinning demonstration program doesn't actually do this, but may be thought as a first step in the right direction:

This Pixel Thinning program has been deprecated because it is possible to generate negative areas within contours of " thinned " pixels. Thus exposing the basic Running Mean Iteration procedure implemented here as unreliable. Meanwhile, the software has been replaced by a better product.

Have you ever seen the transformations of a Continuous (Lie-) Group in action ? I mean, 2-D transformations which do Continuous Scaling, Deformation, Rotation and Translation of an Image. Of course you have. Certainly such transformations are shipped with expensive Image Processing Packages (like Corel version x.y) . But I'm quite sure that nobody has ever told you how to develop such techniques entirely by yourself. Continuization instead of Discretization, again, makes it simple and straightforward to accomplish such things. Here comes:

The program has been extended now with "Nyquist Scaling". Herewith I mean that Scaling of the picture is adapted in such a way that the Amount of Fuzzyness effectively remains equal to those 2 pixels. As if you look at the picture from a greater distance, which is proportional to Fuzzyness. The advantage of this ? An enormous gain in efficiency ! Because the amount of work is: the square of fuzzyness times the size of the picture in both directions. But, there is no loss of information at all, with small-less-fuzzy pictures, when compared with large-more-fuzzy pictures.
Nyquist Scaling has a potential for recognizing patterns in pictures. This may be demonstrated by setting the fuzzyness in X direction to a large value, while leaving the fuzzyness in Y direction normal. Now load the Temnapo Fortran listing and set the Contouring Level to a suitable value. You will see that the text lines in the listing are actually distinguished by the program, as a first step (and maybe also the last)-; to recognition.

### GRAPH THEORY

It should be well known that establishing Isomorphism (read: Equality) of Graphs is a highly non-trivial problem.
Almost any search on the Web ends up in a Reference to an
algorithm by Brendan McKay.
He was the first one to find all non-equivalent graphs up to order 11, for example.
Here comes a much more simple minded Program & Results
for Graphs of order (number of interconnected nodes) up to and including eight:
A combinatorial explosion makes these calculations of mine too cumbersome above the order 8 boundary (due to the Brute Force method used). BTW, did you know that there are so many non-equivalent (connected) graphs of such order, namely:
• 1 graphs of order 2
• 3 graphs of order 3
• 6 graphs of order 4
• 21 graphs of order 5
• 112 graphs of order 6
• 853 graphs of order 7
• 11,117 graphs of order 8
A relevant reference was found on the Web, giving instead the following numbers:
• 1 , 2 , 4 , 11 , 34 , 156 , 1044 , 12346
The above is nevertheless correct, since the latter sequence encompasses also graphs having subgraphs which are not mutually connected. And we have simply excluded the latter. For this reason, a new variable 'netjes' has been added to the program. Setting it to 'false' will generate the numbers of Polya's Enumeration Theory for graphs.
Here are some more, thanks to The Online Encyclopedia of Integer Sequences.
Sequence:  1 , 1 , 2 , 4 , 11 , 34 , 156 , 1044 , 12346 , 274668 , 12005168 ,
1018997864 , 165091172592 , 50502031367952 , 29054155657235488 ,
31426485969804308768 , 64001015704527557894928 ,
245935864153532932683719776 , 1787577725145611700547878190848 ,
24637809253125004524383007491432768
Name:      Graphs with n nodes.


One of the methods used in my FCP project has been the finding of Cliques.
But, of course (and again), I have not been the first one who has done this:

	BK73
C. Bron and J. Kerbosch.
Finding All Cliques of an Undirected Graph.
Communications of the ACM 9, 16(9):575--577, 1973.

Anyway, here is my (recursive) program for Finding All Cliques in an Undirected Graph:
• All Cliques in undirected Graphs
• And how its was done
(with sample input files)

Here is a helper program for the Decomposition of Permutations into Cycle Factors and the Composition of Permutations from Disjoint Cycle Factors:

Quoted without permission: According to Vardi (1991), the Mathematica code for ToCycles is one of the most obscure ever written. Why, oh why ? Since it is clear from this contribution that the problem is quite easy to solve !

How to do calculations in a Galois Field ? And how to define such a weird monster in the first place ?

• Modulo Rings, Polynomials & Galois Fields.
Source code for doing some elementary algebra in Discrete Mathematics.
Reed-Solomon error correcting codes  . . .  Sigh ! Giving up. Sorry.

The so-called Term Structure of Interest Rates can be explained a great deal by a theory which takes into account the psychology of (positive) interest-bearing Money. This theory reveals that the primary interest (: mind the word !) of our GOD, the Grand Omnipotent Dollar, is in the Depreciation of our goods.
This may be called the Interest BY Depreciation theory.
There are two versions of the software: an English and a Dutch one. The Dutch version is found at the SP site.
The English version is found here:

• Term Structure of Interest Rates executable
• And how it was done
• Term Structure Data needed to run

Punch Cards have been a popular medium of data storage in the good old days of computer technology. I still have a bunch of these items at home. And once upon a day I wondered if it would still be possible, not only to write these cards, but also to read them, back into our memory ;-) This has lead to my software version of an IBM PunchCard Reader.

• And how it was done.
Also contains data which are needed to run the program.
• Accompanying documentation has been deprecated.
IBM Punch Card definitions are included as 'ibmkaart.tex':
Non ASCII: a
Non Fortran: f
Card Punch: O

f         a f            f   f          a ffff           ff  f
&ABCDEFGHI .<(+-JKLMNOPQR!$*);0/STUVWXYZ ,%_>^ 123456789:#@'=" ----------------------------------------------------------------- 2 | OOOOOOOOOOOOOOO | 2 1 | OOOOOOOOOOOOOOO | 1 0 | OOOOOOOOOOOOOOOO | 0 1 | O O O O | 1 2 | O O O O O O O O | 2 3 | O O O O O O O O | 3 4 | O O O O O O O O | 4 5 | O O O O O O O O | 5 6 | O O O O O O O O | 6 7 | O O O O O O | 7 8 | O OOOOO O OOOOO O OOOOOO O OOOOOO | 8 9 | O O O O | 9 ----------------------------------------------------------------- &ABCDEFGHI .<(+-JKLMNOPQR!$*);0/STUVWXYZ ,%_>^ 123456789:#@'=?

Precautions and Limitations:
1. Use a conventional flatbed (A4) scanner to scan the punchcards
2. I think it's important to callibrate the scanner properly, before trying to read in any pictures (because the program employs the resolution)
3. The background color of the (white) cards should be Black. This can be accomplished by covering them with black paper before scanning begins
4. Cards must be scanned with their backside down as the surface which contains the data. The human-readable side should be for your eyes only ;-)
5. More than one card can be processed simultaneously. However, punchcards should Not be mutually overlapping.
6. All cards must be scanned in Black and White, resulting in monochrome BMP files to be processed
7. The examples were all scanned are at 100 DPI. Therefore I am not quite certain what behaviour of the program is to be expected at other resolutions.
8. Due to the kind of algorithm implemented, the program behaves best if there are as "many" data on the punchcard as possible. Degenerate cases - such as almost empty cards - have not been tested to a sufficient extent.

RSI is rapidly becoming a common disease amomg programmers. Not surprisingly - but also somewhat contradictory - computer programs have been developed, in an attempt to prevent (other) people from being exposed to Repititive Strain Injury. Probably the best in its kind is WorkPace. I have developed a much less advanced - say lightweight - version of this, which does only the basic thing: force you to take a break from time to time. Here comes:

Power Series in cosk(x) and Fourier Series in cos(k x) can be converted into each other.
I clearly re-invented the wheel again, since references on this subject could be found on the Internet at:

• SVIBOR - Collecting Data on Projects in Croatia.
Especially the numbers 28 and 43. (: broken link)
• TrigTricks, a Mathematica Notebook file.
MAPLE supports the whole idea, for some time, with its expand command:
> expand(cos(7*x));

64 cos(x)7 - 112 cos(x)5 + 56 cos(x)3 - 7 cos(x)

Nevertheless, here comes: a mathematical theory of Cosine Expansions.