The Mathematica Journal
Volume 10, Issue 2

Search

In This Issue
Articles
In and Out
Trott's Corner
Beyond Sudoku
New Products
New Publications
Calendar
News Bulletins
New Resources
Classifieds

Download This Issue 

About the Journal
Editorial Policy
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

T R O T T ' S   C O R N E R
Michael Trott

Search Function for the Constants

In this section we implement the main search function. Some of the searches we carry out run for many hours or even days. So, to see some progress, we define a function, printProgressCell, that prints the current state of the search.

The function SearchForTrottConstants searches for a Trott constant in base base starting with the initial sequences initialSequences. Options for this function are: RecordSearchHistory, which determines if the maximal number of coinciding digits as a function of the iteration number should be recorded through the function searchHistoryData; AllowZeroDigits, which determines if 0 is allowed as a digit; PrintSearchProgress, which determines if cells showing the search progress should be printed; MaxIterations, which determines the maximal number of iterations; and MinDigitsWanted, which determines the minimum number of digits that agree that are wanted.

Here is the search function SearchForTrottConstants. The method is quite simple. Starting with the pool of given initial sequences initialSequences, we repeatedly add base digits, evaluate their quality (which means the number of coinciding digits in the two representations), and keep the best poolSize sequences in the pool. We repeat this process until either the best sequence no longer shows improvements or the specified number of digits that agree has been achieved. The comments in the code explain the individual steps.

This example shows SearchForTrottConstants during the search.



     
About Mathematica | Download Mathematica Player 
© Wolfram Media, Inc. All rights reserved.