Awesome
Engineering Computations Module 1
Engineering Computations is a collection of stackable learning modules, flexible for adoption in different situations. It aims to develop computational skills for students in engineering, but it can also be used by students in other science majors. The course uses the Python programming language and the Jupyter open-source tools for interactive computing.
This first module assumes no coding experience, so the first three lessons are focused on creating a foundation with Python programming constructs using essentially no mathematics. The fourth lesson introduces the basic data structure in scientific computing: arrays. The final lesson is a worked example of linear regression with real data.
Module 1: Get data off the ground with Python
Learn to interact with Python and handle data with Python.
Get an interactive session in MyBinder.org with these course materials by clicking on the button below. Select the folder
notebooks_en
to access the five lessons of this course as fully executable Jupyter notebooks.
-
Join the open online course in our Open edX platform.
-
Get a PDF version to print: Engineering Computations Module 1: Get data off the ground. figshare. https://doi.org/10.6084/m9.figshare.5673454.v1
Lesson 1: Interacting with Python.
Background: What is Python? Idea of interpreted vs. compiled language. Why use Python? It is a general-purpose and high-productivity language.
Getting started: interactive Python (IPython).
Using Python as a calculator.
New concepts: function, string, variables, assignment, type, special variables (True
, False
, None
).
Supported operations, logical operations. Reading error messages.
Lesson 2: Play with data in Jupyter
What is Jupyter? Working with Jupyter. Playing with Python strings: assignment, indexing, slicing. String methods: count, find, index, strip, startswith, split. Play with Python lists: assignment, nested lists, indexing, slicing. String methods: append, index. List membership. Iteration with for-statements. Conditionals.
Lesson 3: Strings and lists in action
A full example using what you learned in lessons 1 and 2: playing with a text file containing the MAE Bulletin (list of courses with their numbers, description, pre-requisites). Reading a data from a file. Cleaning and organizing text data.
Lesson 4: Play with NumPy arrays
Two of the most important libraries for scientific computing with Python: NumPy and Matplotlib. Importing libraries. NumPy functions to create arrays: linspace, ones, zeros, empty, copy. Array operations. Multidimensional arrays. Performance advantage of arrays over lists. Drawing 2D line plots of array data.
Lesson 5: Linear regression with real data
A full worked example using real data of earth temperature over time. Step 1: reading data from a file. Step 2: plotting the data; making beautiful plots. Step 3: least-squares linear regression. Step 4: applying linear regression using NumPy. Split regression.
Copyright and License
(c) 2017 Lorena A. Barba, Natalia C. Clementi. All content is under Creative Commons Attribution CC-BY 4.0, and all code is under BSD-3 clause. We are happy if you re-use the content in any way!