From Wikipedia, the free encyclopedia
[edit] What is a computer program?
How does a Mathematician move a pot on a stove?
Given a stove with the top-right burner warming, how does a Mathematician move a pot from the top-left burner to the top-right burner?
- 1) Lift the pot 3 inches.
- 2) Move the pot 18 inches to the right.
- 3) Lower the pot 3 inches.
- 4) Call these steps algorithm number 1.
Now, how does a Mathematician move a pot from the bottom-left burner to the top-right burner?
- 1) Lift the pot 3 inches.
- 2) Move the pot 12 inches forward.
- 3) Lower the pot 3 inches.
- 4) Execute algorithm number 1.
As you can see, an algorithm is a sequence of instructions. Also notice, an algorithm can become a single instruction in a subsequent algorithm.
How does a Computer Scientist move a pot on a stove?
How does a Computer Scientist move a pot from the bottom-left burner to the top-right burner?
- procedure move_right( pot )
- begin
- pot.lift( 3, inches )
- pot.move( right, 18, inches )
- pot.lower( 3, inches )
- end
- main()
- begin
- stove.burner_heat( top_right, warm )
- pot = stove.create_pot( bottom_left )
- pot.lift( 3, inches )
- pot.move( forward, 12, inches )
- pot.lower( 3, inches )
- execute move_right( pot )
- end
As you can see, the Computer Scientist moves the pot the same way as the Mathematician, except for the special syntax. Because the Computer Scientist moves the pot as a computer program and the Mathematician moves the pot as an algorithm, a computer program is a special case of algorithm. Because this is the definition of a subset, a computer program is essentially an algorithm. Notice that the Computer Scientist moves the pot in a syntax that can be parsed by a compiler, interpreter, virtual machine, or CPU. (Stretch your imagination with virtual machine or CPU.) The Computer Scientist moves the pot as a computer program, a computer program is an algorithm, and an algorithm is a sequence of instructions. Therefore, a computer program is a sequence of instructions in a syntax that can be parsed by a compiler, interpreter, virtual machine, or CPU.
[edit] Why the sky is blue.
- Teacher: The sky is blue because ...
- Student: Wrong. The clouds are white.
- Teacher: The sky is blue — except for the white clouds — because ...
- Student: That's improper and meaningless mumbo jumbo. During an overcast, the sky has no blue.
- Teacher: The sky is blue — except for the white clouds and not during overcast days — because ...
- Student: You're not qualified to teach. At night the sky is black.
- Teacher: The sky is blue — except for the white clouds, not during overcast days, and not at night — because ...
- Student: That's rubbish. Air pollution is gray.
- Teacher: The sky is blue — except for the white clouds, not during overcast days, not at night, and away from pollution — because ...
- Student: You lack knowledge and expertise, and are not a natural teacher. During a solar eclipse, the sky is dark.
- Teacher: The sky is blue — except for the white clouds, not during overcast days, not at night, away from pollution, and not during a solar eclipse — because ...
- Student: That's black magic nonsense. On the moon, the sky is dark.
- Teacher: The sky is blue — except for the white clouds, not during overcast days, not at night, away from pollution, not during a solar eclipse, and here on Earth — because ...
- Student: That's sloppy, and you have a poor writing skills and a very narrow view of the subject. During evenings, the sky is orange.
- Teacher: The sky is blue — except for the white clouds, not during overcast days, not at night, away from pollution, not during a solar eclipse, here on Earth, and not at evenings — because nitrogen and oxygen scatter the blue wavelength.
|
This user believes peripherals should not cloud the essence of the message. |
|
|
This user believes Be Afraid is an unfortunate reality. "You should also learn that Wikipedia users often display ownership of articles they've edited, and jealously guard the fiefdoms and cliques they've developed..." |
|
[edit] How to form a definition.
A definition of a word/term is its super-category plus the minimum characteristics that make it unique. As examples: A dog is a canine that barks. A cat is a feline that purrs.
A good definition can be identified by reversing the subject and predicate. If the statement still holds true, then the definition is a good one. As examples: A canine that barks can only be a dog. A feline that purrs can only be a cat. A bad definition can be identified if ambiguity develops when reversed. For example: A dog is a canine with fur. Reversed: A canine with fur can only be a dog, is false -- a fox is also a canine with fur.
Notice that a word/term can have more than one good definition. As examples: A dog is a canine that barks. A dog is a canine that has been domesticated. Also, a word/term can have more than one good definition if the word/term is a subset of multiple super-categories. For example: Light is a particle that ... or Light is a wave that ...
A good definition can be substituted for its corresponding word/term and still make sense. For example: A {canine that has been domesticated} let me pet her. A {canine that barks} let me pet him.
A definition does not have to contain all of the word/term's characteristics. A concise definition only needs to contain the minimum characteristics that make it unique. For example: A dog is a canine that barks and has been domesticated. This is a true statement and will reverse and substitute correctly. However, this definition is not concise. Being concise means that if you take away any words, it will lose its meaning. Not being concise means that you can take away some words and not lose its meaning. In this case, you can take away either "that barks" or "has been domesticated" and still mean a dog.
Because a word/term might have multiple definitions, using a correct definition out of context leads to nonsense. For example: Given the phrase "time flies like an arrow", since "time" means "measure the duration of", and since "flies" means "a group of insects", and since "like" means "in the same manner as" then you would have to agree that we should "measure the duration of a group of insects in the same manner as one would measure an arrow". (Thanks to HappyDog for this example.)