Lecture III - Packages and Data Management

Applied Optimization with Julia

Author
Affiliation

Dr. Tobias Vlćek

University of Hamburg - Fall 2024

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

. . .

Tip

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

. . .

Tip

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 times
  • while loop repeats code until a condition is met
  • if statement checks if a condition is true
  • else executes code if a condition is false
  • elseif 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 variable
  • local keyword defines a local variable
  • let keyword defines a local variable

. . .

Tip

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

. . .

Tip

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!

. . .

And that’s it for this lecture!

The remaining time we will already start working on the problems of the third lecture.

Literature

Literature

For more interesting literature to learn more about Julia, take a look at the literature list of this course.