Foundations of programming (CK0030)

The course overviews introductory topics in computer programming using Python (primarily 2.7.x) and examples from mathematics and natural sciences. The main bulk of covered material consists of the following topics:
  1. Introductory technicalities: Getting Python, writing and executing programs;
  2. Basic computations: Programs, variables and computer arithmetics;
  3. Loops and lists: WHILE-loops, lists and tuples;
  4. Functions and branching: Functions, arguments and variables, IF-ELSE blocks.
If time allows, the following topics will also be briefly discussed
  1. User input/output and errors: Input reading and output writing;
  2. Introduction to classes: Function classes, methods and attributes;
  3. Object-oriented programming: Inheritance and class hierarchies.
Stuff from the past: Previous versions of the course are available for 2018.1 and 2017.1 (internal links may need adjustment.)



Instructor : Francesco Corona (FC), francesco döt corona ät ufc döt br

Physical location : Tuesdays and Thursdays (Bloco 951, Sala 3), 08:00-10:00
Internet location : Here! Or, here (CK0030) for mambojumbo related to administration.

Evaluation : Approximately half a dozen problem sets will be assigned as homework: Home assignments are for training but are not mandatory (they can be handed-in but they will not be evaluated). The actual evaluation will be based on TWO or THREE partial evaluations (APs) in class: The average. If needed a final evaluation (AF) will be arranged.

Results :


Go to:   Lectures and schedule | Problem sets | Supplementary material | As it pops out |

News

Lectures and schedule

  1. About this course

    A Introductory stuff (FC)
    • Generalities about the course
    • Technicalities about setting up a Python ecosystem


  2. Basic computations

    A Computing with formulas (FC)
    • Programs and programming, writing and running code
    • Variables, comments, text formatting and numbers
    • Arithmetic operators, integer division and objects
    B Interactive computing (FC)
    • The shell, IPython, notebooks, ...
    C Complex numbers (FC)
    • Complex arithmetics and complex functions
    D Symbolic computing (FC)
    • Differentiation, integration, equation solving, series ...


  3. Loops and lists

    A WHILE-loops and lists (FC)
    • Definition, naive and efficient solutions, Boolean expressions
    • List operations, sublists
    B FOR-loops and more Lists (FC)
    • FOR-loops, nested lists, tuples


  4. Functions and branching

    A Mathematical functions (FC)
    • Math functions as Python functions, local and global variables, arguments and returns
    • Keyword arguments, DocStrings, Lambda functions
    B Branching (FC)
    • IF-ELSE loops and inline IF-tests


  5. User input/output and error handling

    A User input/output (FC)
    • Reading from the command line, EVAL and EXEC functions
    • Reading from file, writing to file
    B Error handling (FC)
    • Exception handling and raising
    C Modules (FC)
    • Making, testing, using modules

  6. Array computing and plotting

    A Vectors and arrays (FC)
    • Definitions and basic operations in numpy
    • Allocation, generalised indexing, shape manipulation
    B Curve plotting (FC)
    • Matplotlib (MATLAB-style and Pyplot prefix)
    • Function vectorisation
    C Linear algebra (FC)
    • Inverse, determinant, eigenvalues, products, norms
    • Extreme values, transpose, lower/upper triangles
    • Linear systems, row/column operations
    • Symbolic linear algebra
    D Plotting scalar and vector fields (FC)
    • Surface plots, parameterised curves, contour lines
    • The gradient vector field

[Top]

Problem sets

As we use problem set questions covered by books, papers and webpages, we expect you not to copy, refer to, or look at the solutions in preparing your answers. We expect you to want to learn and not google for answers: If you do happen to use other material, it must be acknowledged clearly with a citation on the submitted solution.
The purpose of problem sets is to help you think about the material, not just give us the right answers.

Homeworks must be done individually: Each of you must hand in his/her own answers. In addition, each of you must write his/her own code when requested. It is acceptable, however, for you to collaborate in figuring out answers. We are assuming that you take the responsibility to make sure you personally understand the solution to any work arising from collaboration (though, you must indicate on each homework with whom you collaborated).
We are likely to request you to defend the content of your homeworks.

To typeset assignments, you are encouraged to use this LaTeX template (to be updated): Source (PDF). [Top]

Material

Course slides and notebooks will suffice. Slides and notebooks are mostly based on the following textbook: Other primary references are the official Python documentation website (with tutorials, library and language references) and the many Python books, among which the following ones are related to this course: Copies of the books are floating around.

>>>>>> Course material is prone to a typo or two - Please inbox FC to report <<<<<<

Top

Read me or watch me

Top