Skip to main content
Engineering LibreTexts

5: What is a computer?

  • Page ID
    39189
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    To ask what a computer is we must first define what type of computer. A computer is someone or something that does computations, usually assumed to be quite complicated calculations. In the movie Hidden Figures you probably noticed they referred to Katherine Johnson, Dorothy Vaughan, and Mary Jackson as "computers." That was not just something for the movie, that is indeed what people who did complicated calculations were called in real life. You might also have notice that one of the characters, Dorothy Vaughan, taught herself FORTRAN (a very smart move) so that she could transfer over to working with Electronic Computers.

    When we refer to computers today we are referring to Electronic Computers. Electronic computers are an electronic machine that does not think but carries out our instructions (commands). They are generally faster then human computers, but they don't think like human computers (this does not change given the advent of newer more sophisticated AI) and they still need a thinking person to provide them with instructions. Anyone can do this, but for complicated calculations like you might find at NASA you would have an engineer, computer scientist, scientist, or someone studying to enter one of these fields preparing these instructions. From here on any reference to computers will mean electronic computers.

    In the previous chapter we discussed the differences between engineers and scientists, but we only lightly touched on computer scientists. Academically there are different types of computer science degrees. For engineering students the distinction is important as other computer science tracks are not sufficient.

    ¬ BS in computer science (engineering program)
    • Science and engineering track
    • Mathematics
      • Calculus
      • Differential Calculus (depends on school)
      • Linear Algebra (depends on school)
      • Probability (calculus-based)
      • Mathematics distributed through out courses such as numerical methods
    • Science
      • First year calculus-based chemistry
      • First year calculus-based physics
    • More computer science courses than BA in computer science
    • Regular engineering program basically
    ¬ BA in computer science
    • Humanities track
    • Mathematics
      • Calculus I
      • Calculus II in some schools
    • Science
      • Only the science for non-scientists level core course required by most universities and colleges (these courses usually consist of teaching students to understand science for newspaper purposes)
    • Fewer computer science courses than BS in computer science
    • Similar to engineering technologist (electronic technologist)
    ¬ BS in computer science (not through engineering program)
    • Similar to BA in computer science with some schools being more rigorous and others being less rigorous
    • Mathematics
      • General school requirement though some schools have specific requirements
    • Science
      • General school requirement though some schools have specific requirements
    • Generally offered by schools who do not have an engineering department

    This course will assume an engineering perspective (BS) and will therefore assume the you are in a science/engineering track (or interested in that track). This will mean the programs discussed and ask for here will assume a high level of mathematical preparation, however this course does not delve into computer science theory which can be even more complicated (though quite interesting). So hard but not as hard as it could be...:)

    What is a computer? From a technical point of view a computer is an electronic machine just like our brain is an electronic organic machine. OR the computer is a lump of materials that is just a large man-made ore deposit that can do nothing without some sort of instructions. This is similar to our brain which is a lump of flesh unless instructions are put into it (of course this is a simplistic analogy useful for building up an understanding of what a computer is but missing nuance). That is, the hardware itself really cannot be a full-fledge computer without some sort of instructional system. Therefore we really need to view the computer as a whole system which includes hardware (the machine or the brain) and software (instructions). But first let us look at the hardware.

    Computer hardware is the physical aspects of the computer which is center around the Central Processing Unit (CPU) and memory.

    ¬ Central Processing Unit (CPU)
    • This is cerebrum part of the brain
    • Does basic operations like shifting, multiplexing, adding, counting and minimal memory
    • Controls input and output through an I/O chip called a Universal Asynchronous Receiver/Transmitter (UART)
    • Cache memory is a fast memory that is part of the CPU
      • Smaller than the general memory
      • Meant for data that is accessed frequently
      • Speed of CPU is determined by frequency AND the size of the cache memory (which is usually more important)
      • From a brain point of view this could be seen as the prefrontal cortex
    • Registers
      • Memory that is part of the CPU that is meant for immediate response
      • This memory can interrupt a current process (the press of a key on a keyboard is the most obvious example)
      • From a brain point of view this could be seen as the basal ganglia and cerebellum
    • Tasks our synchronized through an crystal oscillator (quartz usually)
    ¬ Memory
    • This is the neocortex part of the brain
    • This is where the data and programs (instructional lists) are stored for the CPU to execute
      • Programs are like instructions to say get from your home to the grocery store (turn left on A street, drive x miles, then turn right on B street, etc.)
      • Without this instructional lists a computer would be a useless mixture of materials
    • Three different parts
      • Read only memory (ROM or if programmable PROM) is the memory that contains essential operations of the computer that act as a kind of basic operating system (we will discuss later)
        • This memory is not erased when you turn off the computer
        • Lacking this you would need to load a basic operating system in each time you boot up a computer...a very time consuming task
      • Random Access Memory (RAM) which is most of our medium speed memory is for programs and data that is actively in use
        • This memory is erased when you turn off the computer
        • Technically you don't need this memory and could use a disk instead but the computer would go awfully slow
      • Disk drive (a number of computers don't have this anymore) is a very large memory bank that is slower than all the other memories and contains all the data and programs to be saved for later use
    • Recently some or all of the memory has been moved off into a general cloud of memory which has many benefits, but has one big drawback of being the slowest memory of all the memories and depends on the internet (which can be a significant problem sometimes)
    Cartoon describing the system design of a computer.  The memory would contain both data and program in same location.  Listed items for the input and output are examples and could included many different items.
    Cartoon describing the system design of a computer. The memory would contain both data and program in same location. Listed items for the input and output are examples and could included many different items.
    Hardware specific cartoon describing the system design of a computer.  The memory would contain both data and program in same location.  Listed items for the input and output are examples and could included many different items.
    Same cartoon as above but more hardware oriented...

    Now let us look at the software.

    Computer Software is the virtual aspects of the computer. While it is not physical it plays a crucial part in the whole computer system. Software has flexibility that hardware doesn't have in that you can change your instructions to maybe speed up a calculation but you can't change say the cache of the CPU (hardware which is a fixed size) to speed them up. In our analogy, software is just the electronics computers version of instructions that is store in memory and execute when requested by the user. All virtual aspects of a computer is a form of computer software or a "program". The operating system or systems which work directly with the hardware and the programs that users run to get their jobs done are all forms of software. Operating systems are discussed latter in the course. Here we discuss just the programming languages and user programs. Most engineers will only need to deal with this aspect of computer software.

    Software like human languages has many different "languages." Lists of almost all the known programming languages (even extinct ones) can be found on Wikipedia or for a bit of fun on http://99-bottes-of-beer.net (note this web site has disappear for unknown reasons but a backup is available at https://99-bottles-of-beer.spielmannspiel.com) which has programs in different languages that display the famous "long trip" song. You will see there are over 200 programming languages, however, only about twenty of them are the basis for the bulk of programs. In addition, most of the programming languages have many different versions. As an example, Fortran has about 12 versions (not including variants) that go from Fortran I to Fortran 2023, which can seem as different as old English is to modern English. Fortunately like human language there are certain ideas that encompass all languages. It is these ideas that are more relevant than the languages themselves.

    Like many other aspects in engineering, software starts from basic building blocks which are then combined to form more complex building boxes which are then combined to form even more complex building boxes and so on. The basic building block for the computer is the transistor which by its design can only have an off and on state. Because of this software at its basic level is binary. There are some well agreed upon "levels" of software which will be listed here.

    ¬ Level 1
    • Machine code (binary)
    • Fast
    • Turing machine
    • Not user friendly
    • Difficult to program
    ¬ Level 2
    • Mnemonics
      • Assembly Language
      • A code is associated with the machine code (opcode)
    • Fast
    • Not user friendly but better than binary
    • Typical opcode names: MOV, NOP, CMP
    ¬ Level 3
    • Programming languages like Fortran (gfortran), COBOL (gnucobol), C (gcc), and C++ (g++)
    • More consistent with human language
    • A little slower (though there are tricks to get them as fast as level 2)
    • User friendly
    • Compiled (a program that "rework" your program to opcode)
    ¬ Level 4
    • Advanced programming languages like MATLAB (Octave or Scilab), Mathematica (wxmaxima), Python, IDL (gdl), and LABVIEW
    • Add commands that are larger concepts, like matrix multiply
    • Slower
    • Strongly user friendly
    • Generally not compiled but interpreted (reason for being slower than compiled programs)
    ¬ Level 5
    • Artificial Intelligence Languages and languages the try to go beyond the computer realm (ChatGPT is an AI program not a language)
    • Slower in general
    • Not generally user friendly

    The levels of the programs leads us to discuss the types of programming language, in particular the two most common types: Compiled languages and interpreted languages. Each has their pros and cons and a good programmer usually has at least one favorite compiled language (Fortran, eh?) and one favorite interpreted language (Octave, eh?).

    ¬ Compiled Languages
    • C, C++, Fortran, D, etc.
    • Some interpreted languages can have so called compiled versions (Python and Java) which are a conversion to an opcode. However these are not the same as a completely compiled version (where users have the ability to skillfully influence the compiling), so we will call Python and Java interpreted languages here.
    • Need to compile and then link the programs to produce an executable
      • Example of compiling and linking (and executing)
        • gcc -c lround.c -g -O2
        • gcc lround.o -lm -o lround
        • ./lround
      • Line one represents the compiling of the program with -g asking for debugging and -O2 asking for a specific optimization
      • Line two represents the linking of the program with other libraries with -l asking for linking to the math library and -o naming the executable lround
      • Line three executes the program
    • The executable can be transferred to similar computer systems with the same operating system (though the program Wine might allow you to run the executable on a different operating system) without a compiler on the destination computer.
    • Generally faster especially if you know how to write, compile, and link your program efficiently (this could be a course onto itself however)
    ¬ Interpreted languages
    • BASIC, MATLAB/Octave/Scilab, LabVIEW, IDL/gdl, Maple, Mathematica, Python, Java (and javascript), Julia, R,  etc.
    • Only runs on its own command interpreter (for instance MATLAB needs the program MATLAB to run on any computer)
    • Programs transferred to other computers will not run unless you have that particular command interpreter
    • Somewhat slower than a compiled program (assuming an expert compiled it)
    • Shell programs
      • This is like an interpreted language but it runs on a shell (the prompt)
      • Perl, Awk, Python, Sed, etc.

    While computer programming suggests the user makes "programs" for computers, the field has some different names for what could be construed as programs (like, for example, "functions"). The words we will "define" will be program, scripts, functions, and some other words that computer savvy people might use.

    ¬ Programs
    • The software command list for what you want to achieve as well as its executable
    • Operates independently of an application
    • Needs to be compiled and linked in general
    ¬ Subroutine or Function
    • A piece of a program that is run more than once
    • Functions use to return only one value and subroutines would return more than one value, but in modern languages functions usually can return more than one value (so subroutines don't exist in most languages any more)
    ¬ Script
    • Runs as part of an application and is general used for quick calculations of projects
    • Needs a command interpreter
    • Is not a good way of creating large programs
    ¬ Functions
    • Many modern programming languages use function in the same sense as program as used above, this unfortunately causes confusion with the an actual function rather than a program
    • Function here is referring to the traditional view of what a function is...
    • Programs (or the "main" function) usually run many different functions within them
    • sin(theta) is an common example of a function (with the variable theta) that looks like the real sine function in mathematics

    This course will focus on "GNU Octave"/MATLAB/Scilab but also explore Fortran, C++, Python, IDL/PV-Wave, LISP, and Spice. Why study many different languages? Because the main objective is to study the theory which will allow an engineer to master programming in almost any of the over 200 programming languages in the "real" world. When going out to a new job or academic/research center it is impossible to predict what programming languages will be primarily used so it is important to create as large a toolbox as you can before you go off to the "real" world. Why is the most popular language Java not in this list? Because this is an engineering/science course and Java is not as relevant in this world, but the study of the theory should allow you to learn Java on your own if you wish.

    There are a vast array of ideas you can program into a computer using the languages described above. The program language themselves give a high level of flexibility. A range of programs can be written from very simple programs to fairly difficult programs. While a simple program can be programmed by just about anyone, ones that require difficult concepts need skilled practitioners in the field. This course assumes an engineering perspective (BS) and will therefore assume that you are in a science/engineering track (or interested in that track). This will mean the programs discussed and ask for here will assume a high level of mathematical understanding and the ability to create a complex program.

    Programming large complicated systems can be very difficult for a typical programmer even a practitioner of the field. In these cases teams of people program the programs with (interestingly) programs that help them work together without over-writing each others work. As an engineer/scientist you might find yourself as part of a team writing these programs or you might find yourself using the final product. Let's discuss more about the final product.

    Very large programs require a team of people to develop and usually the user just gets the final product. These type of programs are referred to as canned programs in that they really are not modifiable by the user but are very useful. An example of a layperson canned program is Apple's Pages or Microsoft's Word. There are also some canned programs that have programming languages in them (so they are not fully "canned"). There are many useful canned programs for use by engineers and scientists.

    Some useful programs (with the targeted discipline in braces) in engineering and science include Autocad {CE}, Creo Elements {ME}, MultiSim {EE}, ProSim {ChemE}, COMSOL Multiphysics {Physics, any Engineering disciple}, Molecular Workbench {Chemistry, Biology, any Engineering disciple, mostly educational/free}, RockWorks {Geology/Mining Engineering}, Zemax's OpticalStudio {Optical Engineering}, CMISS {BioEngineering, and maybe ME and CE since this is a finite element package}, and many others. In general you can find less capable but still useful freeware or open-source versions of the aforementioned software packages. This is just a small sample of engineering and science programs, but you can see already that many disciplines have programs associated with them.

    Can anyone use these engineering/science type programs? Not really. Engineering and Scientific software requires an understanding of underlying numerical techniques used in the programs as you are often asked to make a choice between different numerical methods. Some have there own underlying language (like Molecular Workbench). The understanding of the theory of programming language and the underlying numerical techniques is required to be able to use these software packages. This is engineering.

    Canned software is pretty much as is and anything new or not standard would not be found in said software. To avoid the limitations of canned software the engineer can program their problems in one of a variety of programming languages. In this course only a set of programming languages will be mentioned and discussed to different degrees.

    So let us outline some important points:

    • There are over 5000 programming languages (in the most broadest viewpoint), just like there are over 5000 spoken languages (in the most broadest viewpoint).
    • Excluding programming languages that were not meant for electronic computers (like loom paper punch cards) and assembler languages, the oldest languages include FORTRAN (Speedcoding), LISP, and COBOL.
      • FORTRAN, LISP, and COBOL are still active languages
      • FORTRAN now referred to as Fortran had it's latest version issued recently as Fortran 2023.
    • Some languages are "independent," some languages are unique to a software package (not independent), some "independent" languages are attached to certain software packages, some languages have a non-standard character set (APL as the most unusual - like ancient Egyptian hieroglyphics), etc.
    • Computer languages in general differ in purpose. A sample of some prominent languages are presented here.
      • Fortran is for scientists (and engineers)
        • Equation based
        • Very backward compatible
        • Tries to resemble English words and is one of the most readable.
        • Newest versions of Fortran have interoperability with C build-in (before that there were programs that did that) - this benefits both languages
      • Octave/MATLAB/Scilab and LabVIEW is for engineers (and scientists)
        • Octave, MATLAB, and Scilab have similar syntax and commands.
        • These programs all have numerous packages that extend their command set.
        • LabVIEW is graphical with glyphs similar to how some written languages use pictograms.
      • COBOL is for business (although it influenced many non-business languages)
      • LISP is for artificial intelligence and is sometimes used for robotic engineering
      • C and C++ is designed for computer science (operating systems, embedded systems, etc.)
      • IDL/PVWave is for science in particular Astronomy and Earth Science
        • IDL is used more on the East Coast of the United States where as PVWave is used more on the West Coast.
        • PVWave evolved from an older version of IDL.
      • Python is a general purpose language (heavily influenced by C and Haskell)
        • While a great language it has a disturbing habit of not maintaining compatibility
        • Python 2 (which is end-of-life) is not compatible with Python 3, a source of many complaints
        • Reaching into science through its packages: numpy, scipy, matlibplot, etc.
      • Java is an enterprise language (business and entertainment; heavily influenced by C++)
        • Developed by Sun Microsystems (now Oracle) for interactive television
        • The most popular language but not really for science or engineering
        • Sun licensed OpenJDK to GNU General Public License however Oracle still has a license for their Java components (IceTea which is GNU GPL has similar components)
        • Javascript is not Java though it is similar (yet distinct) and obviously influenced by it
          • Javascript is an essential language for web pages
    • Learning a number of languages ensures that any "new" language will be easily self taught, hence the theory behind this book/course.

    To review a computer is hardware (the physical, like the brain) and software (the non-physical, like a set of instructions).

    So this is what a computer is...now we will go into some history and into more depth...but first a quick sideline to discuss how you should do research on a topic (whether for writing an essay or for trying to figure out something on your own)...


    5: What is a computer? is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by LibreTexts.