# Recursive Searches

## Recursive Searches

This tool is a proof of concept for the notion of recursive forms (RFs). A two-dimensional array representing the Periodic Table of Elements is used.
Search the Periodic Table

### Background

This tool, in the modality of a search tool of the oracle type, is a proof of concept for the notion of recursive forms (RFs). The Periodic Table of Elements (IUPAC, 2021) is recursively searched.

RFs automatically submit themselves when a user completes the following steps (see Theory section).

1. Select an initial option or accept the default one.
2. Input a value compatible with said option.
3. Select a new option.

### On Oracle-like Tools

This tool defaults to a verbose mode that can be disabled by selecting a dynamically displayed checkbox. The default mode is aimed at reformulating an input/output session as an oracle-like session.

Here the term oracle is used in the context of a black box that responds to questions. Thus input is transformed into a question and output into the answer to that question.

As posted in the IR Thoughts Blog, our first attempt at building a tool that behaves as an oracle came in the form of the Ideal Gas Law Oracle. It was clear from the onset that the interactive behavior of oracle-like tools might be relevant to the educational experience of teachers and students.

For instance, teachers can use oracle sessions to add content to lecture notes, quizzes, and tests. Students can use this type of tools to double-check exercise results from homeworks and textbooks.

### Examples

The following examples illustrate how this RF works. Upon selecting the "atomic weight" option, entering "50", and switching to the "atomic number" option, the tool returns:

Q: An element has an atomic weight closest to 50. What is its atomic number?
A: Its atomic number is 23, weighing said element 50.942.

Now switching to the "element name" option, that output becomes the new input and the RF returns

Q: What element has an atomic number of 23?

Switching to the "chemical symbol" option, said output becomes the new input so the RF returns

Q: What is the symbol of vanadium?
A: The symbol of vanadium is V.

These examples are quite interesting. Without consulting the Periodic Table, it is difficult to figure out the name, symbol, or atomic number of a chemical element with an atomic weight closest to a given number X (e.g., X = 100, 200, ...). This is particularly true for heavy elements like transition metals and above.

### Discussion

We define a recursive form (RF) as an HTML form where the name/value pairs of successful controls are recursively generated through the decision-making process of users.

### Algorithm

The algorithm implemented by this RF consists in representing the Periodic Table of Elements as a two-dimenisonal associative array of the form

\$index = [
[
"chemical symbol" => "chemical_symbol_value",
"element name" => "element_name_value",
"atomic number" => "atomic_number_value",
"atomic weight" => "atomic_weight_value"
],
⋮
[
...
⋮
]
];


Although not done here, it is possible to code additional key-value pairs to account for electronegativities, densities, boiling points, electron configurations, and so forth.

The algorigthm works as follows. The index is searched in two steps. First, the subarray that matches the initial value, stored in the hidden field, is located. This subarray is then searched for the new option (i.e., the option switched to). If there is a match, its value is retrieved and displayed in the input field as the new value.

Users can repeat this process as many times as they wish to by simply switching to a new option.

### Exercises

• What is the name, symbol, and atomic number of an element having an atomic weight closest to 230?