CET105Computational Thinking
Session 1What is Computational Thinking?
Objectives
• Introduction to the module• Module Plan• Assessments• Reading materials• Sunspace• Introduction to Discrete Mathematics• Instructions for the “History of Computer
Science” group-based activity (sessions 2-3)
What will you learn?
• Knowledge– Discuss computing as a profession and a discipline from an historical
and developmental perspective, evaluating the development of software, hardware and computer systems.
– Discuss how the principles of the engineering ethos contribute to computing and computer science as disciplines
• Abilities– Apply the principles of computational thinking to problem solving in a
computing domain.– Apply relevant principles and practices from contributory disciplines
such as mathematics to computing and computer science
Module Plan (Term 1)Week Number
Date (week commencing)
Topic
1 26/09/11 What is Computer Science? What is discrete maths?2 03/10/11 History of Computer Science (Group work)3 10/10/11 History of Computer Science (Group work)4 17/10/11 Discrete structures and logical reasoning5 24/10/11 Number systems6 31/10/11 Graph theory7 07/11/11 Parallel computing and threading8 14/11/11 Algorithms and machines9 21/11/11 Legal, social, ethical issues and the role of professional
bodies 10 28/11/11 Sorting/Searching11 05/12/11 Complexity of Algorithms12 12/12/11 Feedback and summary activity
Module Plan (Term 2)Week Number
Date (week commencing)
Topic
13 09/01/12 Set theory and data modelling14 16/01/12 2D space geometry and trigonometry15 23/01/12 3D space Geometry16 30/01/12 Probability17 06/02/12 Statistics18 13/02/12 Module Summary/overview/feedback19 20/02/12 Poster/Slide Presentations20 27/02/12 Poster/Slide Presentations21 05/03/12 Poster/Slide Presentations22 12/03/12 Poster/Slide Presentations23 19/03/12 Poster/Slide Presentations
Assessments
Submission Date Description Mark weighting
Part 1: Week 9(w/c 21/11/2011)
Part 2: Week 22(w/c 12/03/2012)
Report: Reflecting back on selected topics covered in the module, what is their importance to the field of computer science and what part of the history of computational thinking required their development.
60%
Poster/Slides: Week 19(w/c 20/02/2012)
Individual presentations will take place in weeks 19-23
Poster/Presentation: Take an area of computational thinking and apply it to a chosen practical problem, presenting the results in a 10min presentation supported by a poster or slides.
40%
Module Resources
• The core text which supports this module is:
Janacek, G.J. & Close, M.L., Mathematics for Computer Scientists, Ventus, 2011. ISBN: 978-87-7681-426-7. Free download from:http://bookboon.com/uk/textbooks/mathematics/gentle-introduction-to-mathematics-for-computer
• Details of additional reading materials, resources and links will
be posted in the Reading List on Sunspace (in the Module Information folder).
• This document will be updated through the year as more resources become available so check it regularly.
Where to find everything?
sunspace.sunderland.ac.uk
Introduction to Discrete Mathematics
Objectives
• How does mathematics underpin computer science?• Provide an introduction to number theory.• Decide which branch of mathematics we fall into.• This will help us:
– understand the need for formal methods in the context of computer science.
– formally define the number types most commonly encountered in traditional computing.
– describe the difference between continuous and discrete mathematics.
What is Computer Science?
“Computer Science is no more about computers than Astronomy is about telescopes.”
Edsger Dijkstra (1930 – 2002)
Activity – What is Computer Science?
Some example definitions• “The science that deals with the theory and methods of processing
information in digital computers, the design of computer hardware and software, and the applications of computers.” (dictionary.com)
• “Computer science and engineering is the systematic study of algorithmic processes - their theory, analysis, design, efficiency, implementation, and application - that describe and transform information.” (Denning, P. J.; Comer, D. E.; Gries, D.; Mulder, M. C.; Tucker, A.; Turner, A. J.; Young, P. R. (Jan 1989). "Computing as a discipline". Communications of the ACM 32: 9–23. volume = 64)
• “Computer science or computing science (abbreviated CS) is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems. Computer scientists invent algorithmic processes that create, describe, and transform information and formulate suitable abstractions to model complex systems.” (Wikipedia)
Why do we need the maths?
• As a Computer Scientist *you* need to be able to ….• Understand the types of problems that can be solved
by a computer program.• Understand the data types and structures available
to address particular problems.• Provide proof that your program is an effective
solution to a problem. • Provide proof that your program is an efficient
solution to a problem.
How is it relevant?• Number Theory: Type systems, data
structures, algorithms, cryptography, programming, language design and compiling.
• Logic and Reasoning: Computer architectures, flow control, testing and verification, software engineering, artificial intelligence
• Sets and Relations: Data structures, programming, information systems, databases.
How is it relevant?
• Algorithms: Problem solving, software engineering, design, programming
• Complexity: Software engineering, artificial intelligence, testing, cost estimation, control systems, programming, project management
• Graph Theory: 3D graphics, networking, file systems, information retrieval, data structures, visualization, social networking.
An Introduction to Number Theory
• Once upon a time, when the world was young…..
17
Types of Numbers - Natural
• Natural Language: – The set of positive whole numbers running from 1
to infinity.• Formal Definition:
– ℕ = {0,1,2,3,4,5,6, .. n}– ℕ1 = {1,2,3,4,5,6, .. n}
Integers
• Natural Language: – The set of integers includes all natural numbers
but in addition recognizes the existence of both their negative counterparts and zero.
• Formal Definition:– ℤ = {.. ,-4,-3,-2,-1,0,1,2,3,4, ..}
Rational
• Natural Language: – In simple terms, rational numbers are those that can be
made by dividing one positive integer by another.
• Formal Definition (Rational):– ℚ = {.. (-1/2),(-1/1),(1/1),(1/2),(2/1) ..}
Fraction Decimal
⅓ 0.33
⅔ 0.66
⅕ 0.2
⅚ 0.83
⅞ 0.875
Irrational
• Natural Language: – In simple terms, irrational numbers are those that
can not be made by dividing one positive integer by another.
Example Decimalπ 3.1415926535897932384626433832795..rε 2.718281828459045235360..rφ 1.61803398874989484820..r√3 1.7320508075688772935274463415059..r
Real Numbers
ℕ = {0,1,2,3,4,5,6, .. n} ℤ = {.. ,-4,-3,-2,-1,0,1,2,3,4, ..} ℚ = {.. (-1/2),(-1/1),(1/1),(1/2),(2/1) ..}
• Natural Language: – The set of all Natural, Integer, Rational and
Irrational Numbers.• Formal Definition:
– ℝ = (( ) )ℕ∪ ℤ ∪ℚ
So what's left?
Other types of numbers
• Imaginary numbers– Defined as any number that, when squared, results in a real number
less than zero.– When a real number is squared the result is never negative.– The square of an imaginary number is always negative.– Imaginary numbers have the form bi where b is a non-zero real
number and i is the imaginary unit, defined such that i2 = −1
• Complex numbers– A complex number is a number consisting of a real part and an
imaginary part.– Complex numbers are used in many scientific fields, including
engineering, electromagnetism, quantum physics, applied mathematics, and chaos theory.
... so back to computers?
The Human Brain is incredibly versatile at navigating all these different types of numbers and allocating enough space to store them….. Computers aren’t!
Lush
Top man
O2
M&S
Ikea
Asda
=
... and programming?
• Computer programming languages require a complicated type system in order to allocate the correct storage for all these different kinds of numbers…..
• e.g. 1 / 2 = 0.5
int x = 1;int y = 2;
int result1 = x / y;float result2 = x / y;float result3 = (float)x / (float)y;Console.WriteLine(result1, result2, result3);
This will make more sense to you once you start programming!
... Supported Types in C#C# Signed Memory Rangesbyte Yes 1 byte –128 to 127short Yes 2 bytes –32768 to 32767int Yes 4 bytes –2147483648 to 2147483647long Yes 8 bytes –9223372036854775808 to
9223372036854775807
byte No 1 byte 0 to 255ushort No 2 bytes 0 to 65535uint No 4 bytes 0 to 4294967295ulong No 8 bytes 0 to 18446744073709551615float Yes 4 bytes –1.5x(10⁻⁴⁵) to 3.4 x (10³⁸)double Yes 8 bytes –5.0x(10⁻³²⁴) to 1.7x(10³⁰⁸)decimal Yes 12 bytes -1.0x(10⁻²⁸) to 7.9x(10²⁸)char 2 bytes Unicode charactersboolean 1 byte True or False
Supported Operations in C#Arithmetic Purpose*, /, % Multiplication, Division, Modulus+, - Addition , Subtraction
Relational Purpose== Checks for equality.!= Checks for inequality.> Greater than.< Less than.>= Greater than or equal to.<= Less than or equal to.
Logical Purpose&& Conditional AND.|| Conditional OR.! Conditional NOT.
Algebraic Properties of Operators
• We use Integers to represent numbers where possible as they are faster to compute and easier to store than real numbers!
• That’s fine for + and * operations but……
Addition Multiplication
Closure: a + b is an integer a × b is an integer
Associativity: a + (b + c) = (a + b) + c a × (b × c) = (a × b) × c
Commutativity: a + b = b + a a × b = b × a
Existence of an identity element: a + 0 = a a × 1 = a
Inverse Law: a + (−a) = 0
Distributive: a × (b + c) = (a × b) + (a × c)
.... one last thing!
• Why is it called Discrete Structures? • In Continuous Maths we work with the set of complex
numbers where you can take any two number’s and find a third number that falls equally between the two.
1 (5) 101 (1.5) 2
• Computers can *not* operate seamlessly on complex numbers
• Discrete structures are ones where this smoothing property doesn’t hold true e.g. Integers, floats, rationals, arrays, logic tables, graphs, trees, sets.
Summary• Computer Science makes extensive use of discrete structures because we
don’t have the chip architecture, memory management or processing power to deal with continuous maths.
• To be a good programmer *you* need to understand how computers make use of discrete structures.
• If you don’t, get used to seeing these errors:
Illegal division by zerocannot be applied to operand of typecannot covert type(x) to type(y)
Use of null is not valid in this contextInvalid base type
Invalid cast exceptionOverflow exception
History of Computer Science • Group Activity (weeks 2-3)• You will be allocated one of the following:
– Babbage/Lady Lovelace– Turing/Taylor– Von Neumann– Tom Kilburn/Freddie Williams– Minski– Steve Jobbs/Bill Gates
• In week 3 your group will be given a 15 minute slot to answer the following question:– Why did I choose your historical character(s) and why are they important to
Computer Science?• Be as imaginative as possible in how you make use of your 15 minutes!