Lecture III - Packages and Data Management
Applied Optimization with Julia
Quick Recap from last Week
Variables and Data Types
- Variables are used to store values
- Assign a value to a variable using the
=
operator - You can use different data types for variables
- You can change the value of a variable
. . .
You can use the typeof
function to check the type of a variable.
Vectors and Matrices
- Vectors and matrices are used to store multiple values
- You can create a them using the
[
and]
operators - Access their elements using square brackets
. . .
You can use the push!
function to add elements to a vector or the pop!
function to remove elements from a vector.
Comparisons and Logic
- Comparisons are used to compare values
==
checks if two values are equal!=
checks if two values are not equal<
checks if one value is smaller than the other>=
checks if one value is greater than or equal to the other&&
checks if two values are true||
checks if at least one of two values is true
Loops
- Loops are used to repeat code
for
loop repeats code for a fixed number of timeswhile
loop repeats code until a condition is metif
statement checks if a condition is trueelse
executes code if a condition is falseelseif
checks if a condition is true and executes if it is
Scope
- Scope determines where a variable is defined and lives
global
keyword defines a global variablelocal
keyword defines a local variablelet
keyword defines a local variable
. . .
Global variables usually make your code much slower, if they are not defined as constants. But for this leeture this is not that important.
Solutions from last Week
- The tutorials from last week will be available on Friday
- You can access them in the project folder on Github
- Click on the little cat icon on the bottom right
. . .
You can ask questions anytime in class or via email!
Five Tutorials for this Week
Topics of the Tutorials
- Functions: Learn how to define and use functions
- Packages: Learn how to install and use packages
- DataFrames: Learn how to work with tabular data in Julia
- IO: Learn how to read and write data in Julia
- Plots: Learn how to create plots in Julia
Get started with the tutorials
- Download this weeks tutorials and start with the first one
- Remember, you can ask questions anytime!
. . .
The remaining time we will already start working on the problems of the third lecture.
Literature
Literature
Lauwens, B., & Downey, A. B. (2019). Think Julia: How to think like a computer scientist (First edition). O’Reilly®. Link to the free book website.
For more interesting literature to learn more about Julia, take a look at the literature list of this course.