Turing Exercise
From Predictive Chemistry
Class Exercise: Understanding Pseudocode and the Turing Machine
The Diffusion algorithm
- Inputs:
- Two end temperatures (TL and TR)
- A list of 5 starting temperatures.
- Outputs:
- A list of 5 steady-state temperatures and the heat current.
- Pseudocode:
- Compute QLA = (TL – TA)/2
- Compute QAB = (TA – TB)/2
- Compute QBC = (TB – TC)/2
- Compute QCD = (TC – TD)/2
- Compute QDE = (TD – TE)/2
- Compute QER = (TE – TR)/2
- Set TA = TA + QLA - QAB
- Set TB = TB + QAB - QBC
- Set TC = TC + QBC - QCD
- Set TD = TD + QCD - QDE
- Set TE= TE + QDE - QER
- If there were changes, go to step 1
Task: Choose 1 person as the CPU, and 11 others as memory locations (5 temperatures in the first row and 6 Q values in the back row). The CPU runs through the algorithm one step at a time and issues instructions to the memory locations (who hopefully remember their numbers).
Assume the starting conditions are:
TL=500 TA=100 TB = 200 TC=300 TD=400 TE=500 TR=100 QLA QAB QBC QCD QDE QER (undefined values at start)
Notes
Our class was able to achieve all 12 steps in about 5 minutes, giving us a processor speed of 0.04 operations per second (compare to giga-flops…).