summaryrefslogtreecommitdiff
path: root/tutorials/module_1
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-05-09 09:53:20 -0600
committerChristian Kolset <christian.kolset@gmail.com>2025-05-09 09:53:20 -0600
commit0d4e770dc06763d225dce66f82bd49b052bead06 (patch)
tree3b4e9fa683c89f8eafb8a7454fc191d9e8739a34 /tutorials/module_1
parent3eb4be2a880eed828c983c8a30d73faa8e6f4746 (diff)
Added auto-generated (md converted) notebooks to modules. Added module 3 tutorials
Diffstat (limited to 'tutorials/module_1')
-rw-r--r--tutorials/module_1/notebook_1/1_excel_to_python.ipynb99
-rw-r--r--tutorials/module_1/notebook_1/array.ipynb251
-rw-r--r--tutorials/module_1/notebook_1/basics_of_python.ipynb192
-rw-r--r--tutorials/module_1/notebook_1/jupyter_lab_notebook.ipynb138
4 files changed, 680 insertions, 0 deletions
diff --git a/tutorials/module_1/notebook_1/1_excel_to_python.ipynb b/tutorials/module_1/notebook_1/1_excel_to_python.ipynb
new file mode 100644
index 0000000..98d8a02
--- /dev/null
+++ b/tutorials/module_1/notebook_1/1_excel_to_python.ipynb
@@ -0,0 +1,99 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Excel to Python\n",
+ "\n",
+ "- Importing\n",
+ "- Plotting\n",
+ "- Statistical analysis\n",
+ "\n",
+ "## **How Excel Translates to Python**\n",
+ "\n",
+ "Here’s how common Excel functionalities map to Python:\n",
+ "\n",
+ "| **Excel Feature** | **Python Equivalent** |\n",
+ "|----------------------|--------------------------------------------------|\n",
+ "| Formulas (SUM, AVERAGE) | `numpy`, `pandas` (`df.sum()`, `df.mean()`) |\n",
+ "| Sorting & Filtering | `pandas.sort_values()`, `df[df['col'] > value]` |\n",
+ "| Conditional Formatting | `matplotlib` for highlighting |\n",
+ "| Pivot Tables | `pandas.pivot_table()` |\n",
+ "| Charts & Graphs | `matplotlib`, `seaborn`, `plotly` |\n",
+ "| Regression Analysis | `scipy.stats.linregress`, `sklearn.linear_model` |\n",
+ "| Solver/Optimization | `scipy.optimize` |\n",
+ "| VBA Macros | Python scripting with `openpyxl`, `pandas`, or `xlwings` |\n",
+ "\n",
+ "## Statistical functions\n",
+ "\n",
+ "#### SUM\n",
+ "\n",
+ "Built-in:\n",
+ "\n",
+ "``` python\n",
+ "my_array = [1, 2, 3, 4, 5]\n",
+ "total = sum(my_array)\n",
+ "print(total) # Output: 15\n",
+ "```\n",
+ "\n",
+ "Numpy:\n",
+ "\n",
+ "``` python\n",
+ "import numpy as np\n",
+ "\n",
+ "my_array = np.array([1, 2, 3, 4, 5])\n",
+ "total = np.sum(my_array)\n",
+ "print(total) # Output: 15\n",
+ "```\n",
+ "\n",
+ "### Average\n",
+ "\n",
+ "Built-in:\n",
+ "\n",
+ "``` python\n",
+ "my_array = [1, 2, 3, 4, 5]\n",
+ "average = sum(my_array) / len(my_array)\n",
+ "print(average) # Output: 3.0\n",
+ "```\n",
+ "\n",
+ "Numpy:\n",
+ "\n",
+ "``` python\n",
+ "import numpy as np\n",
+ "\n",
+ "my_array = np.array([1, 2, 3, 4, 5])\n",
+ "average = np.mean(my_array)\n",
+ "print(average) # Output: 3.0\n",
+ "```\n",
+ "\n",
+ "## Plotting\n",
+ "\n",
+ "We can use the package *matplotlib* to plot our graphs in python.\n",
+ "Matplotlib provides data visualization tools for the Scientific Python\n",
+ "Ecosystem. You can make very professional looking figures with this\n",
+ "tool.\n",
+ "\n",
+ "Here is a section from the matplotlib documentation page that you can\n",
+ "run in python.\n",
+ "\n",
+ "``` python\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "fig, ax = plt.subplots() # Create a figure containing a single Axes.\n",
+ "ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the Axes.\n",
+ "plt.show() # Show the figure.\n",
+ "```\n",
+ "\n",
+ "Check out the documentation pages for a [simple\n",
+ "example](https://matplotlib.org/stable/users/explain/quick_start.html#a-simple-example)\n",
+ "or more information on the types of plots you came create\n",
+ "[here](https://matplotlib.org/stable/plot_types/index.html)."
+ ],
+ "id": "3e04cd8a-c731-494a-bf4f-dfe745a8a487"
+ }
+ ],
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "metadata": {}
+}
diff --git a/tutorials/module_1/notebook_1/array.ipynb b/tutorials/module_1/notebook_1/array.ipynb
new file mode 100644
index 0000000..f087b7e
--- /dev/null
+++ b/tutorials/module_1/notebook_1/array.ipynb
@@ -0,0 +1,251 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Arrays\n",
+ "\n",
+ "In computer programming, an array is a structure for storing and\n",
+ "retrieving data. We often talk about an array as if it were a grid in\n",
+ "space, with each cell storing one element of the data. For instance, if\n",
+ "each element of the data were a number, we might visualize a\n",
+ "“one-dimensional” array like a list:\n",
+ "\n",
+ "| 1 | 5 | 2 | 0 |\n",
+ "|-----|-----|-----|-----|\n",
+ "\n",
+ "A two-dimensional array would be like a table:\n",
+ "\n",
+ "| 1 | 5 | 2 | 0 |\n",
+ "|-----|-----|-----|-----|\n",
+ "| 8 | 3 | 6 | 1 |\n",
+ "| 1 | 7 | 2 | 9 |\n",
+ "\n",
+ "A three-dimensional array would be like a set of tables, perhaps stacked\n",
+ "as though they were printed on separate pages. If we visualize the\n",
+ "position of each element as a position in space. Then we can represent\n",
+ "the value of the element as a property. In other words, if we were to\n",
+ "analyze the stress concentration of an aluminum block, the property\n",
+ "would be stress.\n",
+ "\n",
+ "- From [Numpy\n",
+ " documentation](https://numpy.org/doc/2.2/user/absolute_beginners.html)\n",
+ "\n",
+ "<figure>\n",
+ "<img src=\"attachment:figures/multi-dimensional-array.png\"\n",
+ "alt=\"Mathworks 3-D array\" />\n",
+ "<figcaption aria-hidden=\"true\">Mathworks 3-D array</figcaption>\n",
+ "</figure>\n",
+ "\n",
+ "If the load on this block changes over time, then we may want to add a\n",
+ "4th dimension i.e. additional sets of 3-D arrays for each time\n",
+ "increment. As you can see - the more dimensions we add, the more\n",
+ "complicated of a problem we have to solve. It is possible to increase\n",
+ "the number of dimensions to the n-th order. This course we will not be\n",
+ "going beyond dimensional analysis.\n",
+ "\n",
+ "## Numpy - the python’s array library\n",
+ "\n",
+ "In this tutorial we will be introducing arrays and we will be using the\n",
+ "numpy library. Arrays, lists, vectors, matrices, sets - You might’ve\n",
+ "heard of them before, they all store data. In programming, an array is a\n",
+ "variable that can hold more than one value at a time. We will be using\n",
+ "the Numpy python library to create arrays. Since we already have\n",
+ "installed Numpy previously, we can start using the package.\n",
+ "\n",
+ "Before importing our first package, let’s as ourselves *what is a\n",
+ "package?* A package can be thought of as pre-written python code that we\n",
+ "can re-use. This means the for every script that we write in python we\n",
+ "need to tell it to use a certain package. We call this importing a\n",
+ "package.\n",
+ "\n",
+ "### Importing Numpy\n",
+ "\n",
+ "When using packages in python, we need to let it know what package we\n",
+ "will be using. This is called importing. To import numpy we need to\n",
+ "declare it a the start of a script as follows:\n",
+ "\n",
+ "``` python\n",
+ "import numpy as np\n",
+ "```\n",
+ "\n",
+ "- `import` - calls for a library to use, in our case it is Numpy.\n",
+ "- `as` - gives the library an alias in your script. It’s common\n",
+ " convention in Python programming to make the code shorter and more\n",
+ " readable. We will be using *np* as it’s a standard using in many\n",
+ " projects.\n",
+ "\n",
+ "## Creating arrays\n",
+ "\n",
+ "Now that we have imported the library we can create a one dimensional\n",
+ "array or *vector* with three elements.\n",
+ "\n",
+ "``` python\n",
+ "x = np.array([1,2,3])\n",
+ "```\n",
+ "\n",
+ "To create a *matrix* we can nest the arrays to create a two dimensional\n",
+ "array. This is done as follows.\n",
+ "\n",
+ "``` python\n",
+ "matrix = np.array([[1,2,3],\n",
+ " [4,5,6],\n",
+ " [7,8,9]])\n",
+ "```\n",
+ "\n",
+ "*Note: for every array we nest, we get a new dimension in our data\n",
+ "structure.*\n",
+ "\n",
+ "### Numpy array creation functions\n",
+ "\n",
+ "Numpy comes with some built-in function that we can use to create arrays\n",
+ "quickly. Here are a couple of functions that are commonly used in\n",
+ "python. \\#### np.arange The `np.arange()` function returns an array with\n",
+ "evenly spaced values within a specified range. It is similar to the\n",
+ "built-in `range()` function in Python but returns a Numpy array instead\n",
+ "of a list. The parameters for this function are the start value\n",
+ "(inclusive), the stop value (exclusive), and the step size. If the step\n",
+ "size is not provided, it defaults to 1.\n",
+ "\n",
+ "``` python\n",
+ ">>> np.arange(4)\n",
+ "array([0. , 1., 2., 3. ])\n",
+ "```\n",
+ "\n",
+ "In this example, `np.arange(4)` generates an array starting from 0 and\n",
+ "ending before 4, with a step size of 1.\n",
+ "\n",
+ "#### np.linspace\n",
+ "\n",
+ "The `np.linspace()` function returns an array of evenly spaced values\n",
+ "over a specified range. Unlike `np.arange()`, which uses a step size to\n",
+ "define the spacing between elements, `np.linspace()` uses the number of\n",
+ "values you want to generate and calculates the spacing automatically. It\n",
+ "accepts three parameters: the start value, the stop value, and the\n",
+ "number of samples.\n",
+ "\n",
+ "``` python\n",
+ ">>> np.linspace(1., 4., 6)\n",
+ "array([1. , 1.6, 2.2, 2.8, 3.4, 4. ])\n",
+ "```\n",
+ "\n",
+ "In this example, `np.linspace(1., 4., 6)` generates 6 evenly spaced\n",
+ "values between 1. and 4., including both endpoints.\n",
+ "\n",
+ "Try this and see what happens:\n",
+ "\n",
+ "``` python\n",
+ "x = np.linspace(0,100,101)\n",
+ "y = np.sin(x)\n",
+ "```\n",
+ "\n",
+ "#### Other useful functions\n",
+ "\n",
+ "- `np.zeros()`\n",
+ "- `np.ones()`\n",
+ "- `np.eye()`\n",
+ "\n",
+ "### Working with Arrays\n",
+ "\n",
+ "Now that we have been introduced to some ways to create arrays using the\n",
+ "Numpy functions let’s start using them. \\#### Indexing Indexing in\n",
+ "Python allows you to access specific elements within an array based on\n",
+ "their position. This means you can directly retrieve and manipulate\n",
+ "individual items as needed.\n",
+ "\n",
+ "Python uses **zero-based indexing**, meaning the first element is at\n",
+ "position **0** rather than **1**. This approach is common in many\n",
+ "programming languages. For example, in a list with five elements, the\n",
+ "first element is at index `0`, followed by elements at indices `1`, `2`,\n",
+ "`3`, and `4`.\n",
+ "\n",
+ "Here’s an example of data from a rocket test stand where thrust was\n",
+ "recorded as a function of time.\n",
+ "\n",
+ "``` python\n",
+ "thrust_lbf = np.array(0.603355, 2.019083, 2.808092, 4.054973, 1.136618, 0.943668)\n",
+ "\n",
+ "print(thrust_lbs[3])\n",
+ "```\n",
+ "\n",
+ "Due to the nature of zero-based indexing. If we want to call the value\n",
+ "`4.054973` that will be the 3rd index. \\#### Operations on arrays -\n",
+ "Arithmetic operations (`+`, `-`, `*`, `/`, `**`) - `np.add()`,\n",
+ "`np.subtract()`, `np.multiply()`, `np.divide()` - `np.dot()` for dot\n",
+ "product - `np.matmul()` for matrix multiplication - `np.linalg.inv()`,\n",
+ "`np.linalg.det()` for linear algebra \\##### Statistics - `np.mean()`,\n",
+ "`np.median()`, `np.std()`, `np.var()` - `np.min()`, `np.max()`,\n",
+ "`np.argmin()`, `np.argmax()` - Summation along axes:\n",
+ "`np.sum(arr, axis=0)`\n",
+ "\n",
+ "## Exercise\n",
+ "\n",
+ "Let’s solve a statics problem given the following problem\n",
+ "\n",
+ "A simply supported bridge of length L = 20 m is subjected to three point\n",
+ "loads:\n",
+ "\n",
+ "- $P_1 = 10 kN$ at $x = 5 m$\n",
+ "- $P_2 = 15 kN$ at $x = 10 m$\n",
+ "- $P_3 = 20 kN$ at $x = 15 m$\n",
+ "\n",
+ "The bridge is supported by two reaction forces at points AAA (left\n",
+ "support) and BBB (right support). We assume the bridge is in static\n",
+ "equilibrium, meaning the sum of forces and sum of moments about any\n",
+ "point must be zero.\n",
+ "\n",
+ "##### Equilibrium Equations:\n",
+ "\n",
+ "1. **Sum of Forces in the Vertical Direction**:\n",
+ " $R_A + R_B - P_1 - P_2 - P_3 = 0$\n",
+ "2. **Sum of Moments About Point A**:\n",
+ " $5 P_1 + 10 P_2 + 15 P_3 - 20 R_B = 0$\n",
+ "3. **Sum of Moments About Point B**:\n",
+ " $20 R_A - 15 P_3 - 10 P_2 - 5 P_1 = 0$\n",
+ "\n",
+ "##### System of Equations:\n",
+ "\n",
+ "$$\n",
+ "\\begin{cases} R_A + R_B - 10 - 15 - 20 = 0 \\\\ 5(10) + 10(15) + 15(20) - 20 R_B = 0 \\\\ 20 R_A - 5(10) - 10(15) - 15(20) = 0 \\end{cases}\n",
+ "$$\n",
+ "\n",
+ "### Solution\n",
+ "\n",
+ "``` python\n",
+ "import numpy as np\n",
+ "\n",
+ "# Define the coefficient matrix A\n",
+ "A = np.array([\n",
+ " [1, 1],\n",
+ " [0, -20],\n",
+ " [20, 0]\n",
+ "])\n",
+ "\n",
+ "# Define the right-hand side vector b\n",
+ "b = np.array([\n",
+ " 45,\n",
+ " 5*10 + 10*15 + 15*20,\n",
+ " 5*10 + 10*15 + 15*20\n",
+ "])\n",
+ "\n",
+ "# Solve the system of equations Ax = b\n",
+ "x = np.linalg.lstsq(A, b, rcond=None)[0] # Using least squares to handle potential overdetermination\n",
+ "\n",
+ "# Display the results\n",
+ "print(f\"Reaction force at A (R_A): {x[0]:.2f} kN\")\n",
+ "print(f\"Reaction force at B (R_B): {x[1]:.2f} kN\")\n",
+ "```"
+ ],
+ "attachments": {
+ "figures/multi-dimensional-array.png": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcwAAADPBAMAAACKFvyvAAAAMFBMVEX///8AAAB3d3fd3d2ZmZlE\nREQREREiIiLu7u5mZma7u7szMzPMzMxVVVWqqqqIiIigNNJfAAAMa0lEQVR42u1dv48cSRWu2mXH\nu17b92pty8ePYPZwgnQrYSS4hGAiYk+GQKA9S0cAyR5CiNB3gSMCrPsLSCw2BF8A2RHABCTOQRwB\n6CSEhM4ZGV1VXVWvfsxMd3VVV832tqzZqTc9nvmqX1e97+v6pgmpYmPk6m+UsYnAhGnAvD6YVwYl\nUJgCygkMt+i0pGwKKMW8kmmDelA2OPOdGDVlbDaYBGo5lizb0eQdWBAm9c6YtDCfoQ6EKlAyA/ND\nQk758z3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6vk0urUbmJ0OrZdul1Zb5KUkVRFMfTW1z\ncmk1Mj8hWi3aHq025qdUtJokhqkNTR6tPgvRatH2aDUyPyWg1QzSw9SGJpdWI/OTodVt26HV2PyU\ngFYzkgNma35yaDUyPyFaLdoerUbmp1S0OjVMZXNyabW0Obm0umkHaLXeKwGtZnlgVkaraSaYldLq\n5DArKvYoTAEmTTqT/OjW+4sfv/WvCo9m0q9z9/Z/Lj79wVt1M5QEyUoJ/O+v36sMZvIhFuhT+NP3\nf18ZTJb6u8Dx2xc3vvb4yidtMwTd/u+8JpgMMsKthlanL31CtLq9+ZFDq5H5ydBq/avNFq22zE91\nVkHa5uTSamR+MrRa/2qzRauR+SmCVrMxYGpDk0ursfkJbJuTR6uR+ak3rWajwNSGJu9q9SpAq82v\nNmNajc1Pia5Wp4fZsmSHViPzE6LV5lebMa1G5qd6aXXLkh1aLW1OLq3Wv9ps0Wp9T6W+tDptsV4t\nraYw1tG8ptWZq6AxDmUFMNk0juYUkpZNAiadBsxJJC1MAiabBkwok7Sb7ubkbsGbRPker+rOTX3f\nJlc9EFFvrbu6u5OlHlger83F3ohDrKseaNpvqQfI42XUA313J0s9QB6vbeoBhTIwtW/LVQ+wxwts\nN5erHmCPV6K17ulptaH9WD3AHi+jHrwOrnV/3XGtO4OCMA3tx+oB8ngh9eCUf1NPPRDR7erB+Ocl\nVg+qXOu+s+oBKwpzLPWAFYZ5Xbpfw+wFkxaZScaHCddJe0VgUjYJmGwaR3MKScsmAZOWh8mrrwkk\nbX6YUANMmjtp2TRgVoFSwGR1/pDX7mzFM/b/4f8cdYyaKi8AAAAASUVORK5CYII=\n"
+ }
+ },
+ "id": "06fdd8f8-bc8a-40fd-92c8-758d43e6e2a6"
+ }
+ ],
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "metadata": {}
+}
diff --git a/tutorials/module_1/notebook_1/basics_of_python.ipynb b/tutorials/module_1/notebook_1/basics_of_python.ipynb
new file mode 100644
index 0000000..023d3a0
--- /dev/null
+++ b/tutorials/module_1/notebook_1/basics_of_python.ipynb
@@ -0,0 +1,192 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Basics of Python\n",
+ "\n",
+ "This page contains important fundamental concepts used in Python such as\n",
+ "syntax, operators, order or precedence and more.\n",
+ "\n",
+ "## Syntax\n",
+ "\n",
+ "### Indentations and blocks\n",
+ "\n",
+ "In python *indentations* or the space at the start of each line,\n",
+ "signifies a block of code. This becomes important when we start working\n",
+ "with function and loops. We will talk more about this in the controls\n",
+ "structures tutorial.\n",
+ "\n",
+ "### Comments\n",
+ "\n",
+ "Comments can be added to your code using the hash operator (#). Any text\n",
+ "behind the comment operator till the end of the line will be rendered as\n",
+ "a comment. If you have an entire block of text or code that needs to be\n",
+ "commented out, the triple quotation marks (“““) can be used. Once used\n",
+ "all the code after it will be considered a comment until the comment is\n",
+ "ended with the triple quotation marks.f\n",
+ "\n",
+ "## Operators\n",
+ "\n",
+ "In python, operators are special symbols or keywords that perform\n",
+ "operations on values or variables. This section covers some of the most\n",
+ "common operator that you will see in this course.\n",
+ "\n",
+ "### Arithmetic operators\n",
+ "\n",
+ "| Operator | Name |\n",
+ "|----------|----------------|\n",
+ "| \\+ | Addition |\n",
+ "| \\- | Subtraction |\n",
+ "| \\* | Multiplication |\n",
+ "| / | Division |\n",
+ "| % | Modulus |\n",
+ "| \\*\\* | Exponentiation |\n",
+ "| // | Floor division |\n",
+ "\n",
+ "### Comparison operators\n",
+ "\n",
+ "Used in conditional statements such as `if` statements or `while` loops.\n",
+ "Note that in the computer world a double equal sign (`==`) means *is\n",
+ "equal to*, where as the single equal sign assigns the variable or\n",
+ "defines the variable to be something.\n",
+ "\n",
+ "| Operator | Name |\n",
+ "|----------|--------------------------|\n",
+ "| == | Equal |\n",
+ "| != | Not equal |\n",
+ "| \\> | Greater than |\n",
+ "| \\< | Less than |\n",
+ "| \\>= | Greater than or equal to |\n",
+ "| \\<= | Less than or equal to |\n",
+ "\n",
+ "### Logical operators\n",
+ "\n",
+ "| Operator | Descrription |\n",
+ "|----------|--------------------------------------------------------|\n",
+ "| and | Returns True if both statemetns are true |\n",
+ "| or | Returns True if one of the statements is true |\n",
+ "| not | Reerse the result, returns False if the result is true |\n",
+ "\n",
+ "### Identity operators\n",
+ "\n",
+ "| Operator | Description |\n",
+ "|----------|--------------------------------------------------------|\n",
+ "| is | Returns True if both variables are the same object |\n",
+ "| is not | Returns True if both variables are not the same object |\n",
+ "\n",
+ "## Order of Operation\n",
+ "\n",
+ "Similarly to the order or precedence in mathematics, different computer\n",
+ "languages have their own set of rules. Here is a comprehensive table of\n",
+ "the order of operation that python follows.\n",
+ "\n",
+ "| Operator | Description |\n",
+ "|-------------------------------------|-----------------------------------|\n",
+ "| `()` | Parentheses |\n",
+ "| `**` | Exponentiation |\n",
+ "| `+x` `-x` `~x` | Unary plus, unary minus, and bitwise NOT |\n",
+ "| `*` `/` `//` `%` | Multiplication, Division, floor division, and modulus |\n",
+ "| `+` `-` | Addition and subtraction |\n",
+ "| `<<` `>>` | Bitwise left and right shifts |\n",
+ "| & | Bitwise AND |\n",
+ "| ^ | Bitwise XOR |\n",
+ "| \\| | Bitwise OR |\n",
+ "| `==` `!=` `>` `>=` `<` `<=` `is` `is not` `in` `not in` | Comparision, identity and membership operators |\n",
+ "| `not` | logical NOT |\n",
+ "| `and` | AND |\n",
+ "| `or` | OR |\n",
+ "\n",
+ "## Data types\n",
+ "\n",
+ "Data types are different ways a computer stores data. Other data types\n",
+ "use fewer bits than others allowing you to better utilize your computer\n",
+ "memory. This is important for engineers because The most common data\n",
+ "types that an engineer encounters in python are numeric types. - `int` -\n",
+ "integer - `float` - a decimal number - `complex` - imaginary number\n",
+ "\n",
+ "The comprehensive table below show all built-in data types available in\n",
+ "python.\n",
+ "\n",
+ "| Category | Data Type |\n",
+ "|----------|------------------------------|\n",
+ "| Text | int, float, complex |\n",
+ "| Sequance | list, tuple, range |\n",
+ "| Mapping | dict |\n",
+ "| Set | set, frozenset |\n",
+ "| Boolean | bytes, bytearray, memoryview |\n",
+ "| Binary | bytes, bytearray, memoryview |\n",
+ "| None | NoneType |\n",
+ "\n",
+ "## Variables\n",
+ "\n",
+ "A **variable** in Python is a name that stores a value, allowing you to\n",
+ "use and manipulate data efficiently.\n",
+ "\n",
+ "#### Declaring and Assigning Variables\n",
+ "\n",
+ "It is common in low-level computer languages to declare the datatype if\n",
+ "the variable. In python, the datatype is set whilst you assign it. We\n",
+ "assign values to variables using a single `=`.\n",
+ "\n",
+ "``` python\n",
+ "x = 10 # Integer\n",
+ "y = 3.14 # Float\n",
+ "name = \"Joe\" # String\n",
+ "is_valid = True # Boolean\n",
+ "```\n",
+ "\n",
+ "You can assign multiple variables at once:\n",
+ "\n",
+ "``` python\n",
+ "a, b, c = 1, 2, 3\n",
+ "```\n",
+ "\n",
+ "Similarly we can assign the same value to multiple variables:\n",
+ "\n",
+ "``` python\n",
+ "x = y = z = 100\n",
+ "```\n",
+ "\n",
+ "##### Rules\n",
+ "\n",
+ "- Must start with a letter or `_`\n",
+ "- Cannot start with a number\n",
+ "- Can only contain letters, numbers, and `_`\n",
+ "- Case-sensitive (`Name` and `name` are different)\n",
+ "\n",
+ "#### Updating Variables\n",
+ "\n",
+ "You can change a variable’s value at any time.\n",
+ "\n",
+ "``` python\n",
+ "x = 5\n",
+ "x = x + 10 # Now x is 15\n",
+ "```\n",
+ "\n",
+ "Or shorthand:\n",
+ "\n",
+ "``` python\n",
+ "x += 10 # Same as x = x + 10\n",
+ "```\n",
+ "\n",
+ "#### Variable Types & Type Checking\n",
+ "\n",
+ "Use `type()` to check a variable’s type.\n",
+ "\n",
+ "``` python\n",
+ "x = 10\n",
+ "print(type(x)) # Output: <class 'int'>\n",
+ "\n",
+ "y = \"Hello\"\n",
+ "print(type(y)) # Output: <class 'str'>\n",
+ "```"
+ ],
+ "id": "e14d8bfc-8b11-4e2b-aaf1-2b676706e16f"
+ }
+ ],
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "metadata": {}
+}
diff --git a/tutorials/module_1/notebook_1/jupyter_lab_notebook.ipynb b/tutorials/module_1/notebook_1/jupyter_lab_notebook.ipynb
new file mode 100644
index 0000000..2c00bd0
--- /dev/null
+++ b/tutorials/module_1/notebook_1/jupyter_lab_notebook.ipynb
@@ -0,0 +1,138 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Introduction\n",
+ "\n",
+ "Jupyter Notebooks are often used for data science and scientific\n",
+ "computing such as machine learning as the interactive design allow you\n",
+ "to experiment easily with your code. For our purpose, we will use\n",
+ "Notebooks as it’s a useful tool to learn how to code as well as writing\n",
+ "reports.\n",
+ "\n",
+ "*Note on the difference between Notebook and Lab: Jupyter Notebook\n",
+ "offers a simplified, lightweight notebook authoring experience, where\n",
+ "as, JupyterLab offers a feature-rich, tabbed multi-notebook editing\n",
+ "environment with additional tools like a customizable interface layout\n",
+ "and system console*\n",
+ "\n",
+ "## Setup and Installation\n",
+ "\n",
+ "Jupyter Notebooks can be installed either from the Anaconda Navigator\n",
+ "home page or directly from your Conda terminal.\n",
+ "\n",
+ "Terminal: `conda install conda-forge::jupyterlab`\n",
+ "\n",
+ "## Notebook Basics\n",
+ "\n",
+ "Jupyter Notebooks are files which allows you to combine *Code* and\n",
+ "*Markdown* cells in one single document. The code cells, allow you to\n",
+ "interactively run python code and print and plot data in your document.\n",
+ "If you wish to update or change data your code you can re-run the cell\n",
+ "to update the output. The markdown cells allows you to write text,\n",
+ "titles and insert images in your documentation using the markup language\n",
+ "*Markdown*.\n",
+ "\n",
+ "To start a new notebook select `File > New > Notebook` or right click\n",
+ "the file browser and select `New notebook`, this will prompt you to\n",
+ "select a kernel (the Jupyter notebook “engine”). For now, just select\n",
+ "the default Kernel 3. This will start a new fresh kernel for us to use.\n",
+ "Next, it’s recommended to rename the file.\n",
+ "\n",
+ "Now that we have a blank notebook we can start to add cells. Add a cell\n",
+ "and change the type to Markdown. Add a title with the hash symbol (`#`).\n",
+ "As shown below.\n",
+ "\n",
+ "``` markdown\n",
+ "# Title here\n",
+ "```\n",
+ "\n",
+ "Press `Shift + Enter` to run the cell. You just entered created your\n",
+ "first markdown cell. Now let’s do the same but instead select code as\n",
+ "the cell type, we’re going to add some python code to the document.\n",
+ "\n",
+ "``` python\n",
+ "x = 4\n",
+ "y = 3\n",
+ "\n",
+ "x**2+2*y\n",
+ "```\n",
+ "\n",
+ "Again, run the cell and see what happens. You should’ve gotten an output\n",
+ "of `22`. You can now use the notebook as a calculator, but there is so\n",
+ "much more we can do.\n",
+ "\n",
+ "The order of running code matters. Think of the code cells as code\n",
+ "snippets. Every time you run a cell variable will be updated. This means\n",
+ "that the current state of all variables, functions, and imports depends\n",
+ "on the history of what cells have been executed and in what order. In\n",
+ "other words, if you run a later cell before running an earlier one that\n",
+ "defines a variable or function it needs, you will get an error. If you\n",
+ "change a variable in one cell and rerun it, that new value immediately\n",
+ "affects the results of any cells that use that variable afterward — but\n",
+ "not any previously run results unless you rerun them too. Variables and\n",
+ "imports persist in memory between cells, but only based on the current\n",
+ "session state — if you restart the kernel, you lose all previous\n",
+ "definitions unless you re-run the necessary cells. Therefore, let’s\n",
+ "press the `Restart the kernel` button on the top window.3\n",
+ "\n",
+ "Because of this, it’s best practice to; Run cells in order, restart the\n",
+ "kernel and run all cells (`Kernel -> Restart & Run All`) to make sure\n",
+ "everything works cleanly and predictably and lastly, initialize\n",
+ "important variables or imports in early cells, so they are always\n",
+ "defined before they are needed.\n",
+ "\n",
+ "## Making your document look good with Markdown\n",
+ "\n",
+ "Creating titles or headers is done with the hash symbol. The number of\n",
+ "hashes determines whether it’s a sub-title `#`, `##`, `###`\n",
+ "\n",
+ "### Lists\n",
+ "\n",
+ "There are two types of list in - Bullet lists: `- item` - Numbered\n",
+ "lists: `1. item` \\### Style - Emphasis: *italic*, **bold**, `monospace`\n",
+ "\n",
+ "### Mathematical Equation\n",
+ "\n",
+ "Markdown supports LaTeX format equations. Inline equation is opened and\n",
+ "closed with a single `$`. For a block math a double `$$` is used instead\n",
+ "of single.\n",
+ "\n",
+ "- Inline: This equation is inline `$E = mc^2$` in with the markdown\n",
+ " text.\n",
+ "- Block: Whilst this is a block:\n",
+ " `$$\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}$$`\n",
+ "\n",
+ "### Links and images\n",
+ "\n",
+ "You can insert links to a different local file or online urls like this:\n",
+ "\\[Link\\](file.md). I insert an image it’s the same however start with an\n",
+ "exclamation mark `!` like this: \\![Image Caption\\](picture.png)\n",
+ "\n",
+ "## Exporting and Sharing\n",
+ "\n",
+ "To export your notebook go to\n",
+ "\n",
+ "`File` \\> `Download As`\n",
+ "\n",
+ "You can then select these options.\n",
+ "\n",
+ "- Notebook (`.ipynb`)\n",
+ "- HTML\n",
+ "- PDF (requires LaTeX)\n",
+ "- Markdown\n",
+ "\n",
+ "For homework assignments, download an HTML version of your document,\n",
+ "then from your browser, save or print as a PDF. Alternatively, you can\n",
+ "install the LaTeX typesetting system and export your document directly\n",
+ "as PDF from jupyter."
+ ],
+ "id": "0a5caa39-8f07-4d57-ad69-dc7470ed07ac"
+ }
+ ],
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "metadata": {}
+}