Saturday, May 24, 2003

 

Delphi For Fun Newsletter #32

 

It has been  nearly 3 months since the last newsletter, so guess  I had better catch everyone up.  Running a non-profit website means that you can work on what is most fun.  It also makes it easy to defer other tasks like this newsletter.    Our host site had a major email server crash  a couple of weeks ago, so this list has been pretty thoroughly rebuilt.   So we'll treat this newsletter as a beta test of the restored setup. 

But  I did want to let everyone know that the national finals of the MATHCOUNTS competition are scheduled to be televised on ESPN next Thursday, May 29 at noon, Eastern Time.  I hope to help establish this math program for 6th, 7th, and 8th graders here in Floyd County next fall.   There must be at least one future computer programmer in that group!   You can check out MathCounts at http://mathcounts.org

 

Here are the  "What's New" items since last time.


 

March 6, 2003:   A couple of weeks ago, a viewer introduced me to the TV game "Countdown: which appears daily on BBC British television.  It's apparently quite popular in Europe,   but is virtually unknown on this side of the ocean.  The game has word anagram and arithmetic expression finding components.  Here's my version, Countdown Plus, which solves the arithmetic side of the game plus at least one other problem.  The idea is to form a parenthesized expression from a given set of 6 input values which matches a given target value as closely as possible, and you have a whole 30 seconds to do it!    This version finds countdown solutions in a few seconds, but also solves a problem proposed last year in Expressions 2002, an expression solver which uses the digits 1-9 to form an expression which evaluates to the year.    That program used only + and × operations but allowed the digits to be concatenated into larger numbers (e.g. 12 or 45, etc.).  The challenge posed at that time was to solve the problem allowing parentheses, but without allowing concatenations of digits.  Today's program does that handily. 

March13, 2003:  Playing with the Windows Calculator program the other day got me curious about real number arithmetic.  Why do they only allow 4 digit exponents in most cases?  Using the X^Y function why does it calculate 10^43429 OK, but give an error for 10^43430?  Why is there limit of 32 significant digits?    The result is today's Big Float program which  provides a glimpse into the world of arithmetic with large real numbers  (but not many answers to the original questions).     

March 17, 2003:  A persistent viewer really wanted a 10X10 version of our Token Flip puzzle  posted a few months ago so here it is.  This in spite of the fact that neither I nor the program, nor anyone else I know of  can consistently solve random games larger than 5X5.  If someone analyzes this darned thing  and comes up with an efficient algorithm for solving, please let me know, so I can mark it complete and move on.   
 

Brook Taylor

March 21, 2003:  Last week's Big Float posting handled basic arithmetic, but brought up questions about how  the Windows calculator program (and other scientific calculators) evaluate  log, trig, and exponential  functions with  lots of precision. 

This Taylor series demo posted today over in the Math Topics section provides a likely answer.  Big Float's arbitrarily large real numbers are not yet incorporated, but I believe that  we now know how to do it.   

 

 

 

March 23, 2003:  I added the missing Divide operation to Big Float today, thanks to a suggestion from a viewer.    The algorithm  divides by making successive approximations to the quotient and checks each guess by multiplying by the divisor.  Each guess is the average of the last guess that was too high and the last guess that was too low and it seems to converge fairly rapidly.  I guess that  this is an application of Newton's Method to solve the equation  Dividend ÷ Q - Divisor = 0 for Q. 

March 27, 2003:  Here is a program that calculates the dates of new and full moons for any past or future range  of dates.  At a user's request,  I extracted the calculations for this Moon Dates program  from a complete TAstronomy unit that is waiting in the wings for me to get around to documenting it.  

 

 

April 5, 2003: One of my kids bought me  "The Code Book"  (Simon Singh, Anchor Books) for my birthday last month.  It's an excellent history of cryptography - very readable with fascinating codemaking/codebreaking stories from Egyptian hieroglyphics and ancient Roman times through current "Public Key" and "Pretty Good Privacy" cryptography techniques.   There are enough  examples along the way to make you feel that you might even understand some of it.    

As a result,  I worked this week on the decryption program, Decrypt, and incorporated the revised version into Word Stuff 2.     It's better than  the original, but still leaves lots of room for improvement.  I did add the ability for users to make suggestions to the program to speed it along its decipherment path.   Fully automated decryption in the general case, even for simple mono-alphabetic encryptions, is still far from reality.     Working on the problem does make you appreciate the achievements of all those high IQ codemakers and codebreakers.  

 

April 6, 2003:  I recently upgraded to Delphi 7.   One of the advantages of being a substitute teacher at our local high school is access to academic software.  I couldn't pass up acquiring D7 Professional for $99!    However, there are some downward incompatibilities between D7 and  D5 (or earlier, I presume) even if no D7 enhancements are used.    I have  been trying to make sure that postings here will compile under D5, but missed checking yesterday's Wordstuff 2.  Bottom line, if you downloaded the program yesterday, and it does not compile successfully, try downloading again     

   

April 8, 2003: About a year ago  I posted Eight Queens Wirth, a program which uses Niklaus Wirth's clever algorithm to solve the "Eight Queens" problem - place 8 chess queens on a standard 8x8 chessboard in such a way that no queen threatened another.   The program actually resides as an addendum to the Eight Queens Plus program page, an extension of the problem that requires that the main diagonals remain unoccupied.

 

Eight Queens Wirth finds all 92 solutions and also finds the largest set of solutions that can co-exist on the board without overlapping any other solution (6 solutions).   Recently a viewer asked about the smallest set of solutions that could cover all squares of the board.  I posted a new version today that tries to answer that question as well.  My answer finds 12 solutions that cover the board,  I suspect that this is the smallest set.  But I haven't  proved that it could not be done with 9, 10 or 11 solutions.   If anyone has any more information about a definitive answer to this question, please let me know

 

April 16, 2003:  A month ago we published the 10X10 version of the Token Flip Puzzle even though no one I knew (at the time) could solve it.   I also requested help in finding an solution algorithm so I could stop worrying on it.  Viewer Bernd Hellema came through with a linear programming solution that solves any practical size in milliseconds!   Personally, I wouldn't know a Gaussian Elimination from a hole-in-the-ground, but Bernd does.    Check out Token Flip - the Final Chapter!

Also,  in case your great emails don't get answered right away, we're off on vacation to visit grandkids over Easter.  See you in a week or so. 
     

.  April 25, 2003: A couple of years ago I wrote and posted   Fibonacci Sunflowers, which draws primitive sunflowers showing the "double spiral effect"  if seeds are spaced by an angle approximating the ratio of two consecutive Fibonacci numbers.  A sharp eyed viewer just discovered that one example separated seeds by 31/55 radians instead of 34/55 radians.  It's now fixed.  If you haven't had a chance to investigate Fibonacci numbers and their relationship to the "Golden Ratio", here's a small start.   

 

 

April 29, 2003:  Finally, a new program!  Not that all the fixups this month weren't needed, but  sooner or later one needs something new to exercise the "design-side" brain lobes.  Crossword  Generator V0.0  solves the problem of placing a set of intersecting words on a crossword puzzle board.   Only a half dozen steps away from a complete generator program. 

May 5, 2003:  It's been a long while since we posted a new Beginner's program.   Here's one with about 30 lines of user code that finds the only positive integer that is equal to the sum of the 6th powers of its digits.   The number would fit on a T-Shirt so we'll add it to our numeric T-shirt series, and call it T-Shirt #6.

May 11, 2003:  Our Olympic tennis coach is faced with the problem of quickly replacing his team (all received minor injuries in a plane crash!).   He needs to rank the 8 substitutes as quickly as possible.   This puzzle is from the  "Puzzling Adventures of Doctor Ecco", Dennis Shasha, Dover Books.  You can read the rest of the puzzle and  and download the program that will let you or the computer solve it over at The Coach's Dilemma page.

 

   

Gary Darby
http://www.delphiforfun.org/

 


"It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment. When I have clarified and exhausted a subject, then I turn away from it, in order to go into darkness again." - Karl Friedrich Gauss (Mathematician) 

"I am enough of an artist to draw freely upon my imagination.  Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." -- Albert Einstein

 

To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm

42,900 home page visitors since Sept, 2000.    154,000 program downloads in the past 12 months!