Departement Informatik Digital Medicine I Welcome to the Course Introduction to the Course Hans-Joachim Böckenhauer Dennis Komm Autumn 2020 – October 1, 2020 Material The Team Lecturers Hans-Joachim Böckenhauer Dennis Komm Lecture website Assistants Imant Daunhawer https://courses.ite.inf.ethz.ch/digiMed20 Fabian Frei Lea Fritschi Sarah Kamp Safira Piasko Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 1 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 2 / 38
Appointments Goal of Today’s Lecture Lecture Thursday, 8:15 – 10:00, HG F 3 General information about the lecture The projects, using [code]expert and PELE Exercises Tuesday, 10:15 – 11:45, CHN F 46 Introduction to computers and algorithms Thursday, 10:15 – 12:00, HG F 3 The first Python program Exam Thursday, 10.12.2020 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 3 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 4 / 38 Computer – Concept What does a computer have to be able to do to compute? Does it have to be able to multiply? Isn’t it sufficient to be able to add? Introduction to the Course Computers and Algorithms Turing Machine [Alan Turing, 1936] Finite number of states Memory consisting of arbitrarily many cells Pointer to current cell Alan Turing [Wikimedia] Pointer can change cell’s content and move left or right Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 5 / 38
Computer – Implementation Algorithm: Central Notion of Computer Science Algorithm Analytical Engine – Charles Babbage (1837) Method for step-by-step solution of a problem Z1 – Konrad Zuse (1938) Execution does not require intellect, only accuracy ENIAC – John von Neumann (1945) after Muhammad al-Chwarizmi ; author of a arabic math book (around 825) Charles Babbage [Wikimedia] Konrad Zuse [Wikimedia] John von Neumann [Wikimedia] "‘Dixit algorizmi. . . "’ Latin translation [Wikimedia] Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 6 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 7 / 38 “The Oldest (Known) Non-Trivial Algorithm” Euclid’s Algorithm from Euclid’s Elements , 300 BC Input: integers a > 0 , b > 0 Introduction to the Course Output: gcd of a and b Goals Input: a and b while b != 0: if a > b : a = a − b else: b = b − a Output: a a b a b a b a b Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 8 / 38
1. Computer Science in the Natural Sciences 2. Computational Thinking computer science problem from praxis modeling problem A ACTGCATGGC A C C G G T A C G T C A communication between C G Systematic solving of given problems A A T C G C A practice and comp. science This implies creativity, abstraction skills etc. algorithmics, ? concepts of Formulation of solution as algorithm programming e n g Solution can be “understood” by a computer e d e e d l s w o b n a s k i c solution to problem solution to comp. from practice science problem interpretation ACGCTAAGCACTGCATGGCCAA Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 9 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 10 / 38 2. Computational Thinking 2. Computational Thinking Seymour Papert Jeannette Wing Erfinder der Programmiersprache Logo Professorin an der Columbia University Schüler von Jean Piaget Popularisierung des Begriffs Professor am MIT "‘Computational thinking is a way humans solve Erste Erwähnung des Begriffs problems; it is not trying to get humans to think like computers. Computers are dull and boring; "‘My central focus is not on the humans are clever and imaginative. We humans machine but on the mind. "’ make computers exciting. "’ Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 11 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 12 / 38
3. Algorithms Design Techniques Most practically relevant problems have easy solutions Easy to implement Introduction to the Course Are based on trying out possibly many possibilities (“solution candidates”) This means impractically large time to spend Projects Many problem allow for “faster” solutions Needs a little more skill Different techniques: greedy algorithms , divide and conquer , dynamic programming etc. Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 13 / 38 Projects Projects During the semester, you work on a few small projects The projects will be presented in the exercise hours Presentation and discussion with assistants via Zoom The project tasks will be published via [code]expert Teams of 2 students each https://expert.ethz.ch Grading by assistants, feedback by students You work on the tasks on your own Presentation is mandatory The exercise hours are meant for answering your questions but without effect on the grade Presentation of the solutions via the PELE system [code]expert allows you to test your solution before handing it in https://pele.ethz.ch Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 14 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 15 / 38
Python Tutorial Easy introduction to Python, no previous knowledge necessary Time needed: roughly two hours Introduction to Python Tutorial website https://et.lecturers.inf.ethz.ch/subscriber/course/ 5TLRsNXvLcMaw229P Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 16 / 38 Programming Tools English vs. Programming Language English “Science is what we understand well enough Editor: Program to modify, edit and store Python program texts to explain to a computer. Compiler: Program to translate a program text into machine language Art is everything else we do. ” (intermediate code, respectively) D ONALD K NUTH Computer: Machine to execute machine language programs Operating System: Program to organize all procedures such as file handling, Python editing, compiling, and program execution # computation b = a * a # b = a**2 b = b * b # b = a**4 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 17 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 18 / 38
Syntax and Semantics Kinds of Errors Illustrated with English Language The car drove too fast. Syntactically and semantically correct Thecar drove too fsat. Syntax error: word building Red the car is. Syntax error: word order Like our language, programs have to be formed according to certain rules I find inspiration in cooking Syntax error: missing punctuation marks Syntax: Connection rules for elementary symbols (characters) my dog and my cat Semantics: Interpretation rules for connected symbols She is not tall and red-haired. Syntactically correct, but ambiguous [no analogon] Corresponding rules for a computer program are simpler, but also more strict Syntactically correct, but gramatically and semanti- because computers are relatively stupid I own an red car. cally wrong: wrong article [type error] Syntactically and gramatically correct, but semanti- The bike gallops fast. cally wrong [run-time error] Syntactically and sematically correct, but ambiguous We saw her duck. [no analogon] Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 19 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 20 / 38 Used Software There are numerous Python development environments (IDEs) These contain an editor and several tools Introduction to Python We use [code]expert Used Software https://expert.ethz.ch Also recommended (offline): PyCharm Education https://www.jetbrains.com/pycharm-educational/download/ Download the Community Edition Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 21 / 38
A First Python Program print("This is a Python program") Introduction to Python x = 20 A First Python Program print("The value of x is", x) y = x*x # y is the square of x print("The value of y is", y) z = y*y # z is the square of y print("The value of z is", x*x*x*x) Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 22 / 38 Behavior of a Program Comments At compile time Program accepted by the compiler (syntactically correct) print("This is a Python program") Compiler error x = 20 print("The value of x is", x) During runtime y = x*x # y is the square of x Comments print("The value of y is", y) correct result z = y*y # z is the square of y incorrect result print("The value of z is", x*x*x*x) program crashes program does not terminate (endless loop) Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 23 / 38 Digital Medicine I – Introduction to the Course Autumn 2020 Böckenhauer, Komm 24 / 38
Recommend
More recommend