Forward-looking thinkers imagined and experimented with computing devices centuries before the first electronic computers were built and tested.
Blaise Pascal, a 17th century French mathematician, was the first to invent a computing machine. His "Pascaline" used a series of cogged wheels and gears to perform addition and subtraction; therefore it was really the first calculator, not the first computer.
In 1822, another mathematician, Charles Babbage, conceived of a machine that could perform much more difficult computations, including algorithms. He was the first to have the idea of "programming" - his computing machine would receive its instructions through punched cards ("programs"). It would also have a memory, capable of storing partial answers to be used in later computations.
Babbage was able to convince the British government to provide the first round of funding for the construction of his computing machine. But the money ran out and the Babbage computer was never completed. The unfinished computer built by Babbage is on display in the Science Museum in London.
William Gibson and Bruce Sterling, two leading SF authors in the cyberpunk genre, ask "what if" Babbage has successful completed his computing machine in their 1991 novel, The Difference Engine. The book portrays England as controlling the entire planet by 1855 through cybersurveillance.
Pascal and Babbage were several steps ahead of the science fiction writers: the first story to feature a computer was Edward Page Mitchell's "The Ablest Man in the World" (1879). John Campbell wrote about benevolent computers in "The Metal Horde" (1930), "Twilight" (1934), and "The Machine" (1936).
In 1958, Isaac Asimov wrote about a handheld calculator capable of performing complex calculations. Texas Instruments was the first company to build and market sophisticated, lightweight, affordable hand-held calculators, capable of performing complex mathematical functions, to high school and college students, scientists, and engineers in the 1970s.
When these calculators first became available to students, parents worried that their children would become reliant on calculating machines and lose the ability to do math. In his 1958 short story "The Feeling of Power," Isaac Asimov takes this idea to the extreme, imaging a society where people can't even add single-digit numbers without the aid of calculators.
In the 1950s, Arthur C. Clarke wrote The City and the Stars, in which an enclosed city is run entirely by a large computer, the Central Computer. It materializes whatever the residents need something out of its memory banks.