EL2310 Scientific Programming

Introduction

Scientific Programming is a course that covers introductory and intermediate topics of programming in Matlab, C and C++. The aim is to ensure that everyone can use Matlab, which will be used in many advanced courses, as well as program in C and C++. The examination of this course is through projects that should be solved individually. The course is given in the autumn term in Period 1 (HT1) and it is worth 7.5 ECTS. It is a part of the Master's program in Systems, Control and Robotics. The course description can be also found in the KTH Course Handbook.

Course Structure

The course consists of 16 lectures, 3 voluntary labs and 3 obligatory individual projects. The idea is that the lectures and lab sessions will introduce the tools necessary to solve the projects. Each of the three projects covers one part of the course: programming in Matlab, C and C++. The theme for the projects is robotics. For example, we will develop methods for path planning with probabilistic road maps or control of robot manipulator arms.

BILDA System

During the course, we will use BILDA for all communication. You can find there the latest news and announcements, course schedule in the ICal/VCal format and a student forum. You should also submit your project assignments via BILDA.

Course Coordinator

Andrzej Pronobis, es.htk@sibonorp
If you are already registered for the course, please ask questions using BILDA!

Schedule

Date Room Part Event Downloads
Aug 27, Mon
10:00-12:00
D42 Programming in Matlab Lecture 1: Introduction to the Course and Matlab Lecture Slides
Aug 30, Thu
10:00-12:00
V32   Lecture 2: Matlab as a Tool Lecture Slides
Task Solutions
Sep 3, Mon
10:00-12:00
Q24   Lecture 3: Scripts and Functions  Lecture Slides
Task Solutions
Sep 5, Wed
10:00-12:00
Q24   Lecture 4: Programming in Matlab Lecture Slides
Task Solutions
Sep 6, Thu
13:00-15:00
Q33   Lecture 5: Programming in Matlab Lecture Slides
Task Solutions
Sep 10, Mon
10:00-12:00
Q22 Programming in C Lecture 6: Introduction to C Lecture Slides
Sep 13, Thu
10:00-12:00
V11   Lecture 7: Introduction to C  Lecture Slides
Task Solutions
Sep 14, Fri
10:00-12:00
V11   Lecture 8: Basics of C Lecture Slides
Task Solutions
Sep 17, Mon
10:00-12:00
304
(22:an)
  Lecture 9: Scope and Pointers Lecture Slides
Task Solutions
Sep 17, Mon
13:00-15:00
304
(22:an)
  Help session  
Sep 19, Wed
23:59
    Project deadline: Matlab  
Sep 20, Thu

527
5th floor
  Project exam: Matlab Book your time here
Sep 21, Fri
13:00-15:00
304
(22:an)
Lecture 10: Pointers and Structures Lecture Slides
Task Solutions
Sep 24, Mon
10:00-12:00
304
(22:an)
  Lecture 11: Structures and Memory Lecture Slides
Task Solutions
Sep 27, Thu
10:00-12:00
304
(22:an)
  Lecture 12: Memory, Files and Bitoperation Lecture Slides
(Changed!) Sep 28, Fri
13:00-15:00
304
(22:an)
Programming in C++ Lecture 13: Intro to C++ Lecture Slides
Task Solutions
Oct 1, Mon
10:00-11:30
304
(22:an)

  Lecture 14: Object Oriented Programming in C++ Lecture Slides
Task Solutions
Oct 1, Mon
13:00-15:00
304
(22:an)
  Help session  
(Changed!) Oct 3, Wed
10:00-12:00
304
(22:an)
  Lecture 15: Inheritance and Polymorphism, STL Lecture Slides
Oct 3, Wed
13:00-15:00
304
(22:an)
  Help session  
Oct 4, Thu
13:00-14:00
523
5th floor
  Help session  
Oct 4, Thu
23:59
    Project deadline: C  
Oct 5, Fri

525
5th floor
  Project exam: C Book your time here
Oct 8, Mon
13:00-15:00
523
(5th floor)
  Help session  
(Canceled!) Oct 9, Tue
10:00-12:00
304
(22:an)
  Lecture canceled  
Oct 10, Wed
17:00-19:00
304
(22:an)
  Help session
 
Oct 12, Fri
10:00-12:00
(10:00-13:00
for interested students)
304
(22:an)
  Invited Lecture by Mikael Kalms
(Dice, www.dice.se)
Lecture Slides
Oct 12, Fri
13:00-15:00
304
(22:an)
  Help session  
Oct 14, Sun
23:59
    Project deadline: C++  
Oct 15/16, Mon/Tue
525
5th floor
  Project exam: C++ Book your time here
Nov 11, Sun 23:59     Final deadline!  
Nov 12/13 Mon/Tue
9:00-13:00


Final exam! Book your time here

Rooms 304 and 523 and 525 are located in the building at Teknikringen 14. Please use stairs to access 5th floor for the rooms 523 and 525 (elevator requires card access) and wait outside the lab doors until you are let in.

Coursework

Requirements

The examination of the course is in the form of projects. There are three obligatory individual projects to be solved before specific deadlines and passed during the project exam sessions (20 min meeting with the lecturer). All three projects need to be passed to complete the course. The final course grade will be either Pass or Fail.

Labs

The labs are intended to give a hands-on experience and help to set you up for doing the projects. You are encouraged to work on the labs together to learn from each other and discuss problems. As the background knowledge between participants usually varies much, you are encouraged to explore on your own and discuss in groups. You can download lab instructions below:

Help Sessions

During the course, three help sessions will be organized to help you with practical programming problems. Attending the help sessions is not obligatory but highly recommended.

Projects

With the projects you are supposed to show that you have grasped and understood the material presented in the course and show that you can make proper use of the programming languages in order to solve a task. The projects are to be undertaken individually. You can download the project instructions below:

Project Examination

In order to pass the project exam:
  • You need to submit a solution to the project (source files) using Bilda. The solution needs to be submitted before the project deadline in order to be able to approach the project exam session. Deadlines can be found here.
  • There are three project exam sessions, one for each project in: Matlab, C and C++. During your presentations you should be able to answer questions, general and specific, regarding the methodologies applied. The project will be graded: Pass or Fail. Upon failure you may be requested to complement the project and present it once again.
An additional fourth re-exam session will be organized at the end of the course.

Evaluation Criteria with Minimum Requirements

The following criteria must be satisfied in order to pass the project examination:
  • Completeness of the submitted project solution
    • In order to be allowed for the project examination, the student must submit a code implementing a complete solution to the problem.
  • Correctness of results
    • The program should generate correct results. Minor bugs can be tolerated (e.g. a small error in an equation) as long as they do not prevent from evaluation of the other criteria. 
  • Understanding of the submitted code
    • The student must be able to show that he understands the code submitted and justify the implementation and design decisions.
  • Understanding the lecture material
    • The student must be able to answer questions about the majority of the material presented in the lectures.

In order to pass, the majority of the following criteria must be satisfied:
  • Quality and style of the code
    • Code should be well documented and follow standard coding conventions. It should be easy to read.
  • Structure of the code
    • Code should be well structured into files, scripts, functions, classes (for C++) and follow the principles of Object Oriented Programming (OOP, for C++).
  • Optimal use of language constructs
    • Code should use the available language constructs and tools to solve problems optimally.
  • Quality of visualizations
    • Result visualizations (especially in case of Matlab) should be clearly readable.

Course Materials

There is no course book per se, since a wide choice of different topics will be covered. Lecture notes will be available along the way of the course here. There is plenty of good information online. You can find some selected links below.

Online Materials

Matlab
Programming in C
Programming in C++
Programming in Linux
  • Beginners guides to Linux
  • Emacs
    • Editing Files with Emacs - A short tutorial on basic Emacs usage
    • Run the interactive Emacs tutorial: start emacs, click on Emacs Tutorial
  • Make and Makefiles
    • Makefile Tutorial - A tutorial discussing the the fundamentals of writing Makefiles (pretty much as much as is needed for the course) 
    • GNU Make E-Book - A complete book about make, with a nice Part I discussing basic concepts and usage.

Books

The following books can be also helpful, but you are not obliged to use them:
  • "Matlab for Engineers Explained", F. Gustafsson och N. Bergman, Springer Verlag, 2003 (ISBN 1-85233-697-8)
  • "C Programming Language (2nd Edition)", Brian W. Kernighan, Dennis M. Ritchie, Prentice Hall, 1988

Virtual Machine

In order to provide an identical environment for all students working on the C and C++ projects, an Ubuntu virtual machine was prepared in VirtualBox. The VM has all the required tools preinstalled (gcc/g++/emacs/SDL etc.) and will be used to run the submitted project code for grading. You can download a RAR compressed VirtualBox VM here.

To use the virtual machine, download and install VirtualBox. Then, download and unpack the virtual machine and add it to VirtualBox using Machine->Add. To exchange files between the virtual machine (guest operating system) and your OS (host OS), use shared folders. More information about VirtualBox can be found here.