In Introduction to Programming with Scientific Applications
Course evaluation 2018 ”Den første forelæsning var meget skræmmende og overvældende ”
Course description – kursuskatalog.au.dk/en/course/82756 /82756/ Introduction to Programming with Scientific Applications ECTS 10 Hours - weeks - periods Description of qualifications Lectures 2 x 2 hours/week TA sessions 1 x 3 hours/week After the course the participants will have knowledge of principles and techniques for systematic Study café construction of programs . Language of instruction At the end of the course, the participants will be able to: Danish apply constructions of a common programming language, Instructor develop well-structured programs and perform testing and debugging of these, Gerth Stølting Brodal explain fundamental programming concepts and basic algorithmic techniques, Academic prerequisites apply standard tools for scientific applications . (Some) Linear algebra Exam Contents 2 hour multiple-choice The course gives an introduction to programming with scientific applications. Aid: None Programming concepts and techniques are introduced using the Python programming language. 7-point grading scale The programming concepts are illustrated in other programming languages . The following content is included. Prerequisites for examination participation Basic programming constructs : Data types, operators, variables, flow of control, conditionals, Submission and approval of 10 loops, functions, recursion, scope, exceptions. Object orientation : Abstract data types, classes, mandatory assignments and 1 project inheritance, encapsulation. Basic algorithmic techniques : Sorting, binary search, dynamic programming. Systematic development of programs : Testing and debugging. File-based Notes Grade reflects an overall assessment input/output, numerical analysis, functional programming. Scientific computing using standard of implementation project and packages for Python. multiple-choice examination.
Lecturer Name Gerth Stølting Brodal Research Algorithms and Data Structures (Computer Science) Teaching 2018- BSc course on Introduction to Programming with Scientific Applications 2004-18 BSc course on Introduction to Algorithms and Data Structures 1999-17 MSc courses on Computational Geometry, Algorithm Engineering, Advanced Data Structures, External Memory Algorithms and Data Structures Python Beginner
Question – Primary ry Education? a) Mathematics b) Mathematics-Economics c) Chemestry d) Other Science-Technology e) Other
Question – Programming languages you know? +750 listed on en.wikipedia.org/wiki/List_of_programming_languages
Question – Programming experience? For the programming language you know best (if any) please state you proficiency level within the language. a) None b) Fundamental awareness (basic knowledge) c) Novice (limited experience) d) Intermediate (practical application) e) Advanced (applied theory) f) Expert (recognized authority)
Week Monday Tuesday Wednesday Thursday Friday 5 Semester starts (no TA classes) F1 / TØ1 Some course practicalities 6 TØ1 TØ1 TØ1 / F2 F3 / TØ2 7 TØ2 TØ2 TØ2 / F4 F5 / TØ3 8 TØ3 TØ3 TØ3 / F6 F7 / TØ4 Lecture 8-10 Lecture 14-16 9 TØ4 TØ4 TØ4 / F8 F9 / TØ5 10 TØ5 TØ5 TØ5 / F10 F11 / TØ6 11 TØ6 TØ6 TØ6 / F12 F13 / TØ7 12 TØ7 TØ7 TØ7 / F14 F15 / TØ8 13 TØ8 TØ8 TØ8 / F16 F17 / TØ9 14 TØ9 TØ9 TØ9 / F18 F19 / TØ10 15 TØ10 TØ10 TØ10 / F20 F21 / TØ11 16 Easter 17 - - / F22 F23 / TØ12 18 TØ11 TØ11 TØ11 / F24 "Kapsejlads" ? 19 TØ12 TØ12 TØ12 / F25 F26 / TØ13 20 TØ13 TØ13 TØ13 / F27 Prayer Day Monday Tuesday Wednesday Thursday Friday 8:15-9:00 Lecture 9:15-10:00 Hold 2 Hold 6 10:15-11:00 Hold 4 11:15-12:00 12:15-13:00 Hold 3 13:15-14:00 Hold 5 14:15-15:00 Hold 1 Lecture 15:15-16:00 16:15-17:00 17:15-18:00
Course page on Bla lackboard
Course text xt book John V. Guttag. Introduction to Computation and Programming Using Python With Application to Understanding Data . Second Edition. 472 pages. MIT Press, 2016 [Guttag, page 8] The reader should be forewarned that this book is by no means a comprehensive introduction to Python Covers all basic features of Python enabling you to deal with data in Chapters 1-8 (134 pages) - remaining chapters are applications Other resources: Google, stack overflow , Python.org, YouTube, ... Comparison to a standard text book on the programming language Python by Cay Horstmann and Rance Necaise: Topic recursion is covered by Guttag on page 50, Horstmann and Necaise do it on page 611
Some other books on Pyt ython O’Reilly , 2013 Wiley, 2016 Addison-Wesley, 2015 Wiley, 2013 Franklin & Beedle, 2016 1684 pages 752 pages 794 pages 580 pages 552 pages ... numerous online introduction texts/courses/videos on Python
Two Pyt ython programs
A Pyt ython program Memory Python shell > x = 7 > print(x * x) | 49 x 7 7 is an integer literal – in Python denoted an “ int ” x is the name of a variable that can hold some value = is assigning a value to a variable * denotes multiplication print is the name of a built-in function , here we call print to print the result of 7*7 A program consists of a sequence of statements , executed sequentially
Question – What is the result of f this program? Python shell Memory > x = 3 > y = 5 > x = 2 x assigned new value > print(x * y) a) 10 old x 3 b) 15 y 5 c) 25 2 new x d) [15, 10] e) Error f) Don’t know
Another Pyt ython program using li lists Memory Python shell > a = [13, 27, 7, 42] > print(a) | [13, 27, 7, 42] > print(a[2]) | 7 13 a[0] 27 a[1] a [13, 27, 7, 42] is a list containing four integers 7 a[2] a[2] refers to the entry in the list with index 2 42 a[3] (the first element has index 0, i.e. a[2] is the 3 rd element of the list) Note that print also can print a list
Question – What is the result of f this program? Memory Python shell > a = [3, 5, 7] > print(a[1] + a[2]) a) 8 3 a[0] b) 10 a 5 a[1] 7 a[2] c) 12 d) 15 e) Don’t know
Why Pyt ython ? th the next xt sl slid ides will ill be technical
TIO IOBE In Index Ja January ry 2019 The TIOBE Programming Community index is an indicator of the popularity of programming languages . The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.
Popularity of f programming languages
C #include <stdio.h> “Hello World” int main(int argc, char **argv) { printf("Hello World"); return 0; In Java, C, C++ a lot of “{“, “}” and “;” } are needed C++ Java tends to have a lot of “public...” #include <iostream> details that need to be spelled out using namespace std; Python is concise int main(int argc, char** argv) { cout << "Hello, World!"; return 0; } Java public class HelloWorld { Python 2 public static void main( String[] args ) { print "Hello world" System.out.println( "Hello World!" ); System.exit( 0 ); Python 3 } } print("Hello world")
Why Pyt ython ? Short concise code
(C developed by Dennis Ritchie 1969-73) Debugging is the process of finding and resolving defects C i index out of f bounds or problems within a computer program that prevent correct operation of computer software or a system. en.wikipedia.org/wiki/Debugging Memory indexing.c #include <stdio.h> int main() { int x = 1; int A[2] = {2, 3}; // A[0] = 2, A[1] = 3 printf("x = %d, A = {%d, %d}\n", x, A[0], A[1]); A[3] = 42; // index A[3] out of bounds 2 A[0] array printf("x = %d, A = {%d, %d}\n", x, A[0], A[1]); A return 0; 3 A[1] } Output x 1 -42 “ A ” only has size 2, but tries to update the 4 th entry. $ gcc indexing.c No warning is giving. $ ./a.exe Something unexpected x = 1, A = {2, 3} is overridden in memory. x = 42, A = {2, 3} Have fun debugging! Skipping checking for invalid indexing makes programs faster, but also requires disciplined programming
(C++ was developed by Bjarne Stroustrup 1985) ... .. . and C++ ++ i index out of f bounds indexing.cpp Memory #include <iostream> int main() { int x = 1; int A[2] = {2, 3}; // A[0] = 2, A[1] = 3 std::cout << "x = " << x << ", A = {" << A[0] << ", " << A[1] << "}" << std::endl; A[2] = 42; // index A[2] out of bounds 2 A[0] array std::cout << "x = " << x << ", A = {" A 3 A[1] << A[0] << ", " << A[1] << "}" << std::endl; x 1 -42 return 0; } Output $ g++ indexing.cpp $ ./a.exe x = 1, A = {2, 3} x = 42, A = {2, 3}
Recommend
More recommend