Turing Exercise

From Predictive Chemistry
Jump to: navigation, search

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:
  1. Compute QLA = (TL – TA)/2
  2. Compute QAB = (TA – TB)/2
  3. Compute QBC = (TB – TC)/2
  4. Compute QCD = (TC – TD)/2
  5. Compute QDE = (TD – TE)/2
  6. Compute QER = (TE – TR)/2
  7. Set TA = TA + QLA - QAB
  8. Set TB = TB + QAB - QBC
  9. Set TC = TC + QBC - QCD
  10. Set TD = TD + QCD - QDE
  11. Set TE= TE + QDE - QER
  12. 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…).