Sunday, January 29, 2017

Computer science: Mathimatics and Logic





-How computers use Logic: A mathematical approach-

    For a computer to preform meaningful work it has to use some sort of structured way of preforming logic. All things that can preform logic do this. 
Everything from a $3 calculator to the human mind has a methodology of manipulating the information given to it.

    When building a computer that preforms logic based on mathematical calculations the logic behind those calculations are ideally based on math, like how a humans logic of what action to take is based upon the prominence of previous memory's relating to that action.

    Modern computing devices are based upon a few simple mathematically based logical operations that are combined to preform more complex tasks. we call this logic Boolean logic after it's creator in 1854, George Boole. The logic is not directly tied to a medium of computation, only to the methodology. Anything from electricity, to bottles of wine and buckets can use Boolean logic if structured properly.

    In the following examples taken from the book: Introduction to computing by: David Evans, wine is used as an example medium to demonstrate a simpler abstraction of the logic.


"To implement logic using a machine, we need physical ways of representing the



two possible values [true and false]. We use a full bottle of wine to represent true and an empty
bottle of wine to represent false. If the value of an input is true, we pour a bottle
of wine in the input nozzle; for false inputs we do nothing. Similarly, electronic
computers typically use presence of voltage to represent true, and absence of
voltage to represent false.


And. A logical and function takes two inputs and produces one output. The
output is true if both of the inputs are true; otherwise the output is false.



One way to do this is shown in Figure 6.1. Both inputs pour into


a basin. The output nozzle is placed at a height corresponding to one bottle of
wine in the collection basin, so the output bottle will fill (representing true), only

if both inputs are true."(Evans 109)





Figure 6.1: Computing AND with wine





Truth Table for AND:

   A   |   B   | (and A B)
-------------------------
false |false | false
true  |false | false
false |true  | false
true  |true  | false





    The machine above would likely not operate perfectly, some of the wine would likely spill causing the output to not be completely full. To solve this problem we use Digital Abstraction to define the bottle. We could say if the bottle is more than half full it counts as a full bottle. This removes the possibility of infinite possible outputs of a system based in an imperfect reality. An example of Digital Abstraction in modern computers would be the abstraction of if there is electricity present in a part of a circuit, the circuit is representing True.


    Digital Abstraction provides a link between the physical world and the world of discrete values that exists with mathematical logic. It is much simpler to work with these discrete values than with infinite variable ones when mathematical logic is used.


OR: returns true if one of the input values is true.


NOT: The output of not is the opposite of its input value.



Computing NOT with wine



Computing OR with wine






 













    The best part of the 3 basic logical operations is their ability to be combined to preform more complex tasks like addition, subtraction, multiplication, and division of many true or false input values. These structures can then be assembled into an  Arithmetic logic Unit that is the heart of a computers CPU that enables it to manipulate data. If I were to get into exactly how one could design and combine these structures this blog post would be many pages long.




   In this blog post you have learned the basics of how computations are based on mathematically defined logic that uses Digital Abstraction of real world values to return a result. The structures that preform this mathematical logic can be combined to form more complex structures that can preform more complex tasks using true or false input data.


   Knowing how the things around me functioned at the most basic level has always fascinated me since i was a young child. There is always a new level of understanding that can be attained about anything in life. I implore you to go out and ask yourself, what can a learn from this?





Source:
Evans, David. Introduction to Computing: Explorations in Language, Logic, and Machines. N.p.:   n.p., 2011.
page(s): 108-116

No comments:

Post a Comment