|
Algorithmic Modeling
In addition to representing data in digital form, the computer also represents processes in digital form. The computer represents these processes as algorithms. An algorithm is set of carefully defined instructions that take a set of inputs, manipulate them, and produce some output. A recipe is an informal example of this. It takes a set of inputs, called ingredients, manipulates them in specific ways, and produces a (usually!) edible output. Algorithms can include simple sequences of instructions, or instructions that involve decision points or iteration. More information on algorithms can be found at Wikipedia. A
computer programmer encodes algorithms in software using programming
A simple example would be a program to compute the amount of interest to credit for savings accounts at a bank. Such a program must use information on the account balance, the interest rate, and the period of time over which the interest should be computed. This program could be written into a single sequence of statements such as float balance, interestRate, term, interest; This program is written in the Java programming language. The first statement tells the computer that all three numbers have decimal points; the next three statements set values for the variables balance, interestRate, and time; and the last line calculates the interest. Note how similar the last line is to the original formula. A more complicated example would be software to manage the flight of an aircraft, which must account for wind speed, the weight of the plane, the position of the various flight surfaces on the wings and tail, and so forth. This sort of program would have an algorithm that iterates (repeats) forever, constantly checking the current speed of the aircraft and adjusting as necessary: Loop forever This example shows the use of iteration (a loop) and selection (the "if" statements). All programs, regardless of how simple or complicated they are, make use of the three basic control structures. How well a program works depends on how carefully the algorithms are designed and how accurately it models physical reality. The programmer must make wise choices when deciding what to include or exclude from the software model of the world. In order to produce the most accurate model, the programmer would have to include virtually every detail related to the plane, from the color of the paint on the wings to the smell of the sweater of the passenger in seat 4B. Obviously, including everything is impractical, so one must judiciously choose those variables that have a significant effect on the answer being sought (such as how much fuel is required to get from Detroit, Michigan, to Paris, France). |
|
|||
|
If you encounter technical errors, contact computing@calvin.edu. |