Delphi For Fun Newsletter #2
Wednesday, Sept.27, 2000
We have posted three programs since last week's newsletter.
Century Sundays examines which centuries can (and can't) begin on a Sunday. If you want the answer, you'll have to check the site. Even there, the explanation only appears as comments in the source code, or when you download and run the program. After all, one objective of the site is to let people see how readable Delphi code is.
X4X2 is a math oriented program that proves that for any integer X, if you raise it to the 4th power and subtract the square of the number, the result is always divisible by 12! No program could prove that this is true for all integers by examining all integers - too many of them. It could possibly prove that it's false by a finding single case that is not true. And if it's true for the first few million integers, you start to suspect that it's true for all. Fortunately, there is some not too complicated math reasoning that proves that it's true for all integers.
SimpleCalc is a prototype 4-function calculator if you're curious about what's involved. The one posted here took only a few lines of Delphi code. The final version of this project is being used at Oxford! I had volunteered to help the Psychology department develop an on-screen calculator to be used as part of a study of learning by primary grade school children. The requirements included: 1) display the user input as well as the result, 2) be shaped to fit across the bottom of the screen, 3) log user entries to a file with time and action information, 4) control an MS PowerPoint slide show presentation, 5) stay on top of the presentation. They say it's working perfectly (which I doubt). I haven't posted the full source code because it's kind of specialized but if anyone would have use for such a program, let me know.
I also wrote a scientific function grapher this week at the request of a teacher looking for a scientific calculator. It's pretty cool and the initial version has about 20 lines of Pascal code because it uses a charting component that comes with Delphi and an open-source downloaded expression parser component. The 20-line version plots polynomials including arithmetic operators, log and trig functions, etc. It only works for single valued functions of X though, so it has trouble drawing a circle. The "final" version solves that problem, includes printing ability, and allows 2 independent functions to be plotted on the same graph. Again, it's kind of specialized so I may not post it to the website, but if anyone is interested send an email.
We're up to 530 hits today. I'm putting this info in mainly so that I can track usage over time (I'm not a very organized record keeper).
I think, at a child's birth, if a mother could ask a fairy godmother to endow it with the most useful gift, that gift would be curiosity. -- Eleanor Roosevelt