TDT4127
Programming and Numerics
Autumn and Spring
Trondheim
English
About this course
Content
The course consists of two parts: Introduction to procedure-oriented programming in Python (2/3) and Numerics (1/3). The Python skills will be generally applicable to many different problems, but as soon as the level is high enough, most of the examples will be directed towards problem-solving in the Numerics domain.
Procedure-oriented programming:
- Variables and data types.
- Input and output.
- Control structures: Sequence, conditional program flow and repetitions.
- Structuring and modularisation of programs; functions and modules.
- Data structures: Lists, tables, text strings, sets, tuples and dictionaries.
- Persistent storage of data, file input and output, and exceptions.
- Recursion.
- Python as a programming environment.
- Computation of N-dimensional matrixes
- Plot of functions.
Numerics:
- Numeric Integration of Functions: Trapezoidal rule, Simpson's rule, Adaptive Simpson's rule
- Newton's method for finding zeros of a real-valued function
- Gaussian elimination for solving systems of linear equations
- Numerical solution of ordinary differential equations
- Fixed-point iteration
Learning outcomes
Knowledge: By the end of the course, the candidate can:
- explain central concepts and mechanisms of procedural programming
- derive the result of small programs and functions
- explain number representation, precision of calculations, and the workings of central numerical methods
Skills: By the end of the course, the candidate can:
- use relevant tools for editing and running Python code.
- use viable data structures, control structures and decomposition in functions and modules to make well-structured, working code.
- apply some central numerical methods to solve calculation problems, and import and use numerical library functions in Python.
- identify causes for errors and lack of precision in programs, and correct the errors.
- demonstrate and explain your own program code to others.
Teaching methods
Lectures, exercise lectures, mandatory exercises.