diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-04-29 18:38:21 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-04-29 18:38:21 -0600 |
| commit | dc13208abd61cc3ac7c64a4373f3ad85689f1293 (patch) | |
| tree | b8775c75daefe5c5f183b7fbb561b6d18e82f0d3 /tutorials/module_1 | |
| parent | ce478a33e25759b901d401609175713a5ded3522 (diff) | |
Finished of module 1 tutorials (.md) and added documentation to module 2
Diffstat (limited to 'tutorials/module_1')
| -rw-r--r-- | tutorials/module_1/array.md | 8 | ||||
| -rw-r--r-- | tutorials/module_1/jupyter_lab_notebook.md | 67 | ||||
| -rw-r--r-- | tutorials/module_1/notebook_1/functions.ipynb | 26 | ||||
| -rw-r--r-- | tutorials/module_1/spyder_getting_started.md | 2 |
4 files changed, 48 insertions, 55 deletions
diff --git a/tutorials/module_1/array.md b/tutorials/module_1/array.md index 3c0290e..9fa1c88 100644 --- a/tutorials/module_1/array.md +++ b/tutorials/module_1/array.md @@ -15,7 +15,7 @@ A two-dimensional array would be like a table: A three-dimensional array would be like a set of tables, perhaps stacked as though they were printed on separate pages. If we visualize the position of each element as a position in space. Then we can represent the value of the element as a property. In other words, if we were to analyze the stress concentration of an aluminum block, the property would be stress. - From [Numpy documentation](https://numpy.org/doc/2.2/user/absolute_beginners.html) - + If the load on this block changes over time, then we may want to add a 4th dimension i.e. additional sets of 3-D arrays for each time increment. As you can see - the more dimensions we add, the more complicated of a problem we have to solve. It is possible to increase the number of dimensions to the n-th order. This course we will not be going beyond dimensional analysis. @@ -96,7 +96,7 @@ Here's an example of data from a rocket test stand where thrust was recorded as ```python thrust_lbf = np.array(0.603355, 2.019083, 2.808092, 4.054973, 1.136618, 0.943668) ->>> thrust_lbs[3] +print(thrust_lbs[3]) ``` Due to the nature of zero-based indexing. If we want to call the value `4.054973` that will be the 3rd index. @@ -110,10 +110,6 @@ Due to the nature of zero-based indexing. If we want to call the value `4.054973 - `np.mean()`, `np.median()`, `np.std()`, `np.var()` - `np.min()`, `np.max()`, `np.argmin()`, `np.argmax()` - Summation along axes: `np.sum(arr, axis=0)` -##### Combining arrays -- Concatenation: `np.concatenate((arr1, arr2), axis=0)` -- Stacking: `np.vstack()`, `np.hstack()` -- Splitting: `np.split()` ## Exercise Let's solve a statics problem given the following problem diff --git a/tutorials/module_1/jupyter_lab_notebook.md b/tutorials/module_1/jupyter_lab_notebook.md index f9b3393..ab52654 100644 --- a/tutorials/module_1/jupyter_lab_notebook.md +++ b/tutorials/module_1/jupyter_lab_notebook.md @@ -12,15 +12,6 @@ Jupyter Notebooks can be installed either from the Anaconda Navigator home page Terminal: `conda install conda-forge::jupyterlab` ## Notebook Basics -- Creating a new notebook (`.ipynb`) -- Types of cells: - - Code - - Markdown - - Raw -- Running a cell: `Shift + Enter` -- Adding/removing cells -- Restarting the kernel -- Saving and auto-checkpoints Jupyter Notebooks are files which allows you to combine *Code* and *Markdown* cells in one single document. The code cells, allow you to interactively run python code and print and plot data in your document. If you wish to update or change data your code you can re-run the cell to update the output. The markdown cells allows you to write text, titles and insert images in your documentation using the markup language *Markdown*. @@ -45,47 +36,35 @@ The order of running code matters. Think of the code cells as code snippets. Eve Because of this, it's best practice to; Run cells in order, restart the kernel and run all cells (`Kernel -> Restart & Run All`) to make sure everything works cleanly and predictably and lastly, initialize important variables or imports in early cells, so they are always defined before they are needed. -## Writing and Running Code -- Python syntax: - - `print("Hello, world!")` - - Variables and functions - - Loops and conditionals -- Importing libraries: - - `import numpy as np` - - `import pandas as pd` - - `import matplotlib.pyplot as plt` - -## Using Markdown -- Headers: `#`, `##`, `###` + +## Making your document look good with Markdown +Creating titles or headers is done with the hash symbol. The number of hashes determines whether it's a sub-title +`#`, `##`, `###` + +### Lists +There are two types of list in - Bullet lists: `- item` - Numbered lists: `1. item` +### Style - Emphasis: _italic_, **bold**, `monospace` -- LaTeX equations: - - Inline: `$E = mc^2$` - - Block: `$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$` -- Embedding links and images +### Mathematical Equation +Markdown supports LaTeX format equations. Inline equation is opened and closed with a single `$`. For a block math a double `$$` is used instead of single. +- Inline: This equation is inline `$E = mc^2$` in with the markdown text. +- Block: Whilst this is a block: `$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$` +### Links and images +You can insert links to a different local file or online urls like this: \[Link](file.md). I insert an image it's the same however start with an exclamation mark `!` like this: !\[Image Caption](picture.png) -## Interactive Widgets (optional) +## Exporting and Sharing +To export your notebook go to -Install `ipywidgets` from your package manager + `File` > `Download As` -```python -import ipywidgets as widgets -widgets.IntSlider() -``` -Example using interact: +You can then select these options. -```python -from ipywidgets import interact -interact(lambda x: x**2, x=5) -``` - -## Exporting and Sharing -By default, jupyter auto-saves your notebooks as you work. +- Notebook (`.ipynb`) +- HTML +- PDF (requires LaTeX) +- Markdown -- File > Download As: - - Notebook (`.ipynb`) - - HTML - - PDF (requires LaTeX) - - Markdown +For homework assignments, download an HTML version of your document, then from your browser, save or print as a PDF. Alternatively, you can install the LaTeX typesetting system and export your document directly as PDF from jupyter. diff --git a/tutorials/module_1/notebook_1/functions.ipynb b/tutorials/module_1/notebook_1/functions.ipynb index 28a9201..b3a56af 100644 --- a/tutorials/module_1/notebook_1/functions.ipynb +++ b/tutorials/module_1/notebook_1/functions.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "c549f9ae-7280-471e-a7e3-92d3340b7514", "metadata": {}, "source": [ "# Functions\n", @@ -94,11 +95,28 @@ " script, the return keyword is used. The keyword can be followed by\n", " an output variable or a constant. For multiple output variables,\n", " separate them by a comma." - ], - "id": "c549f9ae-7280-471e-a7e3-92d3340b7514" + ] } ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.2" + } + }, "nbformat": 4, - "nbformat_minor": 5, - "metadata": {} + "nbformat_minor": 5 } diff --git a/tutorials/module_1/spyder_getting_started.md b/tutorials/module_1/spyder_getting_started.md index c79568b..faa5db5 100644 --- a/tutorials/module_1/spyder_getting_started.md +++ b/tutorials/module_1/spyder_getting_started.md @@ -32,7 +32,7 @@ This pane allows you to interactively run functions, do math computations, assig - Real-time function calltips - Full GUI integration with the enhanced Spyder [Debugger](https://docs.spyder-ide.org/5/panes/debugging.html). - The [Variable Explorer](https://docs.spyder-ide.org/5/panes/variableexplorer.html), with GUI-based editors for many built-in and third-party Python objects. -- Display of Matplotlib graphics in Spyder’s [Plots](https://docs.spyder-ide.org/5/panes/plots.html) pane, if the Inline backend is selected under Preferences ‣ IPython console ‣ Graphics ‣ Graphics backend, and inline in the console if Mute inline plotting is unchecked under the Plots pane’s options menu. +- Display of Matplotlib graphics in Spyder’s [Plots](https://docs.spyder-ide.org/5/panes/plots.html) pane, if the Inline backend is selected under `Preferences` > `IPython console` > `Graphics` > `Graphics backend`, and inline in the console if Mute inline plotting is unchecked under the Plots pane’s options menu. ### Variable Explorer This pane shows all the defined variables (objects) stored. This can be used to identify the data type of variables, the size and inspect larger arrays. Double clicking the value cell opens up a window which allowing you to inspect the data in a spreadsheet like view. |
