summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-04-29 18:38:21 -0600
committerChristian Kolset <christian.kolset@gmail.com>2025-04-29 18:38:21 -0600
commitdc13208abd61cc3ac7c64a4373f3ad85689f1293 (patch)
treeb8775c75daefe5c5f183b7fbb561b6d18e82f0d3
parentce478a33e25759b901d401609175713a5ded3522 (diff)
Finished of module 1 tutorials (.md) and added documentation to module 2
-rw-r--r--book/computingME.pdfbin3597869 -> 3782618 bytes
-rw-r--r--book/computingME.tex2
-rw-r--r--book/module0/module0.tex2
-rw-r--r--book/module1/array.tex19
-rw-r--r--book/module1/jupyter_lab_notebook.tex131
-rw-r--r--book/module1/spyder_getting_started.tex8
-rw-r--r--book/module2/problem_solving_strategies.tex145
-rw-r--r--tutorials/module_1/array.md8
-rw-r--r--tutorials/module_1/jupyter_lab_notebook.md67
-rw-r--r--tutorials/module_1/notebook_1/functions.ipynb26
-rw-r--r--tutorials/module_1/spyder_getting_started.md2
-rw-r--r--tutorials/module_2/problem_solving_strategies.md67
12 files changed, 195 insertions, 282 deletions
diff --git a/book/computingME.pdf b/book/computingME.pdf
index fcfddc1..145ae15 100644
--- a/book/computingME.pdf
+++ b/book/computingME.pdf
Binary files differ
diff --git a/book/computingME.tex b/book/computingME.tex
index 31cba87..2267856 100644
--- a/book/computingME.tex
+++ b/book/computingME.tex
@@ -5,7 +5,7 @@
\input{preamble.inc}
\title{MECH 305 - Computing for Mechanical: Tutorials}
\author{Christian Kolset}
-\date{July 2013}
+\date{April 2025}
\titlehead{Tutorials for MECH 305 - Computing for Mechanical Engineers}
\publishers{Walter Scott Jr. College of Engineering\\Colorado State University}
diff --git a/book/module0/module0.tex b/book/module0/module0.tex
index 9b3c8dc..6f2a4ad 100644
--- a/book/module0/module0.tex
+++ b/book/module0/module0.tex
@@ -1,3 +1,3 @@
\chapter{Getting Started}
\input{module0/intro_to_programming}
-\input{module0/intro_to_anaconda}
+\input{module0/installing_anaconda}
diff --git a/book/module1/array.tex b/book/module1/array.tex
index c79c6c0..9482065 100644
--- a/book/module1/array.tex
+++ b/book/module1/array.tex
@@ -35,13 +35,7 @@ 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.
-\begin{itemize}
-\tightlist
-\item
- From
- \href{https://numpy.org/doc/2.2/user/absolute_beginners.html}{Numpy
- documentation} \includegraphics{figures/multi-dimensional-array.gif}
-\end{itemize}
+\includegraphics{figures/multi-dimensional-array.png}
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
@@ -197,7 +191,7 @@ recorded as a function of time.
\begin{Highlighting}[]
\NormalTok{thrust\_lbf }\OperatorTok{=}\NormalTok{ np.array(}\FloatTok{0.603355}\NormalTok{, }\FloatTok{2.019083}\NormalTok{, }\FloatTok{2.808092}\NormalTok{, }\FloatTok{4.054973}\NormalTok{, }\FloatTok{1.136618}\NormalTok{, }\FloatTok{0.943668}\NormalTok{)}
-\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ thrust\_lbs[}\DecValTok{3}\NormalTok{]}
+\BuiltInTok{print}\NormalTok{(thrust\_lbs[}\DecValTok{3}\NormalTok{])}
\end{Highlighting}
\end{Shaded}
@@ -211,10 +205,7 @@ product - \texttt{np.matmul()} for matrix multiplication -
\#\#\#\#\# Statistics - \texttt{np.mean()}, \texttt{np.median()},
\texttt{np.std()}, \texttt{np.var()} - \texttt{np.min()},
\texttt{np.max()}, \texttt{np.argmin()}, \texttt{np.argmax()} -
-Summation along axes: \texttt{np.sum(arr,\ axis=0)} \#\#\#\#\# Combining
-arrays - Concatenation: \texttt{np.concatenate((arr1,\ arr2),\ axis=0)}
-- Stacking: \texttt{np.vstack()}, \texttt{np.hstack()} - Splitting:
-\texttt{np.split()}
+Summation along axes: \texttt{np.sum(arr,\ axis=0)}
\subsection{Exercise}\label{exercise}
@@ -256,9 +247,9 @@ point must be zero.
\subparagraph{System of Equations:}\label{system-of-equations}
-\{RA+RB−10−15−20=05(10)+10(15)+15(20)−20RB=020RA−5(10)−10(15)−15(20)=0
-
+\[
\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}
+\]
\subsubsection{Solution}\label{solution}
diff --git a/book/module1/jupyter_lab_notebook.tex b/book/module1/jupyter_lab_notebook.tex
index 5c06f5d..c08fd74 100644
--- a/book/module1/jupyter_lab_notebook.tex
+++ b/book/module1/jupyter_lab_notebook.tex
@@ -21,32 +21,6 @@ Terminal: \texttt{conda\ install\ conda-forge::jupyterlab}
\subsection{Notebook Basics}\label{notebook-basics}
-\begin{itemize}
-\tightlist
-\item
- Creating a new notebook (\texttt{.ipynb})
-\item
- Types of cells:
-
- \begin{itemize}
- \tightlist
- \item
- Code
- \item
- Markdown
- \item
- Raw
- \end{itemize}
-\item
- Running a cell: \texttt{Shift\ +\ Enter}
-\item
- Adding/removing cells
-\item
- Restarting the kernel
-\item
- Saving and auto-checkpoints
-\end{itemize}
-
Jupyter Notebooks are files which allows you to combine \emph{Code} and
\emph{Markdown} cells in one single document. The code cells, allow you
to interactively run python code and print and plot data in your
@@ -100,7 +74,8 @@ affects the results of any cells that use that variable afterward ---
but not any previously run results unless you rerun them too. Variables
and imports persist in memory between cells, but only based on the
current session state --- if you restart the kernel, you lose all
-previous definitions unless you re-run the necessary cells.
+previous definitions unless you re-run the necessary cells. Therefore,
+let's press the \texttt{Restart\ the\ kernel} button on the top window.3
Because of this, it's best practice to; Run cells in order, restart the
kernel and run all cells
@@ -109,85 +84,57 @@ everything works cleanly and predictably and lastly, initialize
important variables or imports in early cells, so they are always
defined before they are needed.
-\subsection{Writing and Running Code}\label{writing-and-running-code}
+\subsection{Making your document look good with
+Markdown}\label{making-your-document-look-good-with-markdown}
-\begin{itemize}
-\tightlist
-\item
- Python syntax: - \texttt{print("Hello,\ world!")} - Variables and
- functions - Loops and conditionals
-\item
- Importing libraries: - \texttt{import\ numpy\ as\ np} -
- \texttt{import\ pandas\ as\ pd} -
- \texttt{import\ matplotlib.pyplot\ as\ plt}
-\end{itemize}
+Creating titles or headers is done with the hash symbol. The number of
+hashes determines whether it's a sub-title \texttt{\#}, \texttt{\#\#},
+\texttt{\#\#\#}
-\subsection{Using Markdown}\label{using-markdown}
+\subsubsection{Lists}\label{lists}
+
+There are two types of list in - Bullet lists: \texttt{-\ item} -
+Numbered lists: \texttt{1.\ item} \#\#\# Style - Emphasis:
+\emph{italic}, \textbf{bold}, \texttt{monospace} \#\#\# Mathematical
+Equation Markdown supports LaTeX format equations. Inline equation is
+opened and closed with a single \texttt{\$}. For a block math a double
+\texttt{\$\$} is used instead of single.
\begin{itemize}
\tightlist
\item
- Headers: \texttt{\#}, \texttt{\#\#}, \texttt{\#\#\#}
-\item
- Bullet lists: \texttt{-\ item}
-\item
- Numbered lists: \texttt{1.\ item}
-\item
- Emphasis: \emph{italic}, \textbf{bold}, \texttt{monospace}
+ Inline: This equation is inline \texttt{\$E\ =\ mc\^{}2\$} in with the
+ markdown text.
\item
- LaTeX equations:
-
- \begin{itemize}
- \tightlist
- \item
- Inline: \texttt{\$E\ =\ mc\^{}2\$}
- \item
- Block:
- \texttt{\$\$\textbackslash{}int\_0\^{}\textbackslash{}infty\ e\^{}\{-x\^{}2\}\ dx\ =\ \textbackslash{}frac\{\textbackslash{}sqrt\{\textbackslash{}pi\}\}\{2\}\$\$}
- \end{itemize}
-\item
- Embedding links and images
+ Block: Whilst this is a block:
+ \texttt{\$\$\textbackslash{}int\_0\^{}\textbackslash{}infty\ e\^{}\{-x\^{}2\}\ dx\ =\ \textbackslash{}frac\{\textbackslash{}sqrt\{\textbackslash{}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 \texttt{!} like this:
+ !{[}Image Caption{]}(picture.png)
\end{itemize}
-\subsection{Interactive Widgets
-(optional)}\label{interactive-widgets-optional}
-
-Install \texttt{ipywidgets} from your package manager
-
-\begin{Shaded}
-\begin{Highlighting}[]
-\ImportTok{import}\NormalTok{ ipywidgets }\ImportTok{as}\NormalTok{ widgets}
-\NormalTok{widgets.IntSlider()}
-\end{Highlighting}
-\end{Shaded}
-
-Example using interact:
+\subsection{Exporting and Sharing}\label{exporting-and-sharing}
-\begin{Shaded}
-\begin{Highlighting}[]
-\ImportTok{from}\NormalTok{ ipywidgets }\ImportTok{import}\NormalTok{ interact}
-\NormalTok{interact(}\KeywordTok{lambda}\NormalTok{ x: x}\OperatorTok{**}\DecValTok{2}\NormalTok{, x}\OperatorTok{=}\DecValTok{5}\NormalTok{)}
-\end{Highlighting}
-\end{Shaded}
+To export your notebook go to
-\subsection{Exporting and Sharing}\label{exporting-and-sharing}
+\texttt{File} \textgreater{} \texttt{Download\ As}
-By default, jupyter auto-saves your notebooks as you work.
+You can then select these options.
\begin{itemize}
\tightlist
\item
- File \textgreater{} Download As:
-
- \begin{itemize}
- \tightlist
- \item
- Notebook (\texttt{.ipynb})
- \item
- HTML
- \item
- PDF (requires LaTeX)
- \item
- Markdown
- \end{itemize}
+ Notebook (\texttt{.ipynb})
+\item
+ HTML
+\item
+ PDF (requires LaTeX)
+\item
+ Markdown
\end{itemize}
+
+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/book/module1/spyder_getting_started.tex b/book/module1/spyder_getting_started.tex
index 70a3d41..3133b15 100644
--- a/book/module1/spyder_getting_started.tex
+++ b/book/module1/spyder_getting_started.tex
@@ -86,9 +86,11 @@ computations, assign and modify variables.
\item
Display of Matplotlib graphics in Spyder's
\href{https://docs.spyder-ide.org/5/panes/plots.html}{Plots} 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.
+ the Inline backend is selected under \texttt{Preferences}
+ \textgreater{} \texttt{IPython\ console} \textgreater{}
+ \texttt{Graphics} \textgreater{} \texttt{Graphics\ backend}, and
+ inline in the console if Mute inline plotting is unchecked under the
+ Plots pane's options menu.
\end{itemize}
\subsubsection{Variable Explorer}\label{variable-explorer}
diff --git a/book/module2/problem_solving_strategies.tex b/book/module2/problem_solving_strategies.tex
index 4b908f8..2f7a360 100644
--- a/book/module2/problem_solving_strategies.tex
+++ b/book/module2/problem_solving_strategies.tex
@@ -1,44 +1,49 @@
\section{Algorithmic thinking}\label{algorithmic-thinking}
-\subsection{Learning Objectives}\label{learning-objectives}
-
-By the end of this lesson, students will be able to:
-
-\begin{itemize}
-\tightlist
-\item
- Apply algorithmic thinking to solve engineering problems using
- computational tools.
-\item
- Translate engineering problems into structured programming logic.
-\item
- Use software tools to implement, test, and refine engineering
- solutions.
-\end{itemize}
+In engineering, solving a problem begins long before we start coding or
+building models. Like any other engineering challenge, computational
+problems must first be clearly framed and understood. In this section,
+you will learn to \textbf{apply algorithmic thinking} to systematically
+approach engineering problems, \textbf{translate real-world situations
+into structured programming logic}, and \textbf{use computational tools
+to implement, test, and refine solutions}.
+
+Before diving into code, it's crucial to define the problem carefully,
+frame the problem so that logically so that a computer can understand
+then execute so that
\subsection{Define the Problem}\label{define-the-problem}
-Like many other classes we need to frame the problem before working it.
-So before jumping straight into coding or building models, clearly
-define the engineering problem.
+As any other engineering problem, we need to frame it before we can
+start working on it. So before jumping straight into coding or building
+models, clearly define the engineering problem.
-\begin{itemize}
+\begin{enumerate}
+\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
- \textbf{List knowns and unknowns.} What inputs are given? What outputs
- are required?
+ List your givens, this includes any constants or equations. What
+ inputs do we know?
\item
- \textbf{Establish system constraints and assumptions.} Identify
- physical laws, design requirements, and performance limits.
+ Find: List what you're trying to solve for. What outputs do we need to
+ find?
\item
- \textbf{Clarify computational objectives.} What are you trying to
- calculate, simulate, or optimize?
-\end{itemize}
+ Establish the assumptions based on your engineering knowledge that you
+ deem to be appropriate to use for the problem. This determines what
+ mathematical models we can apply to the problem (i.e.~equations or
+ formulas).
+\item
+ Solution: Show the works of the problem, this will include any code
+ used together with documentation or any explanations of the code.
+\item
+ Comment: reflect and comment on your findings.
+\end{enumerate}
\subsection{Think Algorithmically}\label{think-algorithmically}
-Since we are going to use computers to calculate our solution we first
+Since we are going to use computers to compute our calculate we first
need to break the problem into logical steps that a computer can follow.
+This can be done with tools such as flowchart or psuedo-code.
\begin{itemize}
\tightlist
@@ -49,79 +54,69 @@ need to break the problem into logical steps that a computer can follow.
\textbf{Break the problem into sub-tasks.} Identify steps such as data
input, logic processing and output.
\item
- \textbf{Outline the algorithm.} Write pseudocode or flowcharts that
+ \textbf{Outline the algorithm.} Write pseudo-code or flowcharts that
describe the computational steps.
\item
\textbf{Identify patterns or formulas.} Can loops, conditionals, or
equations be used to automate parts of the solution?
\end{itemize}
-\textbf{Example:} For processing stress-strain data: 1. Import data from
-a file. 2. Convert force and displacement to stress and strain. 3. Plot
-the stress-strain curve. 4. Identify the yield point or modulus.
+\subsubsection{Flowchart for fixing
+lamp}\label{flowchart-for-fixing-lamp}
-\subsection{Write \& Execute the Code}\label{write-execute-the-code}
+\begin{figure}
+\centering
+\includegraphics{figures/LampFlowchart.png}
+\caption{Lamp Flowchart}
+\end{figure}
-\begin{itemize}
+\subsubsection{Psuedo-Code for processing and plotting stress-strain
+data:}\label{psuedo-code-for-processing-and-plotting-stress-strain-data}
+
+\begin{enumerate}
+\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
- \textbf{Choose the right tools.} Are there libraries I can use to get
- to my objective more effectively?
+ Import force and displacement data from file.
\item
- \textbf{Write modular code.} Use functions to separate different tasks
- (e.g., reading data, computing values, plotting).
+ Convert data from force and displacement to stress and strain.
\item
- \textbf{Check for syntax and logic errors.} Debug line-by-line using
- print statements or a debugger.
-\end{itemize}
+ Plot the stress-strain curve.
+\item
+ Identify the yield point or modulus.
+\end{enumerate}
-\textbf{Example:} Write a Python script that uses NumPy and Matplotlib
-to load a CSV file, compute stress and strain, and generate plots.
+\subsection{Write \& Execute the Code}\label{write-execute-the-code}
-\subsection{Test and Validate}\label{test-and-validate}
+When writing the code it is important to ask yourself whether you're
+using the right tools, libraries or method to solve the problem.
+\textbf{Check for any syntax and logic errors} then debug line-by-line
+using print statements or by using a debugging tool.
-\begin{itemize}
-\tightlist
-\item
- \textbf{Assess the feasibility of your results.} Do the values align
- with expected physical behavior?
-\item
- \textbf{Compare against established benchmarks.} Validate solutions
- using experimental data, literature values, or known theoretical
- limits.
-\item
- \textbf{Check units and scaling.} Ensure computations are consistent
- with physical meaning.
-\end{itemize}
+\subsection{Verify and Validate}\label{verify-and-validate}
-\textbf{Example:} If your plot shows stress values in the thousands when
-you expect hundreds, check unit conversions in your formula.
+When writing code it is crucial to test and confirm your code. It is
+therefore important to ask yourself the following questions. Does the
+code do what you intended it to do? And, is the mathematical model used
+in the code valid for the current problem?
-\subsection{Case Study: Simulating a Spring-Mass
-System}\label{case-study-simulating-a-spring-mass-system}
+\subsection{Exercise: Design a derivative finding
+algorithm}\label{exercise-design-a-derivative-finding-algorithm}
-\textbf{Scenario:} Model the motion of a mass-spring-damper system using
-a numerical solver.
+Set up the problem and write pseudo-code to calculate the gradient of an
+unknown function.
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
- \textbf{Define the Problem:} Set up the differential equation from
- Newton's Second Law.
-\item
- \textbf{Develop a Strategy:} Discretize time, apply numerical
- integration (e.g., Euler or Runge-Kutta).
+ \textbf{Given:}
\item
- \textbf{Execute the Code:} Write a Python function that computes
- motion over time.
+ **Find:
\item
- \textbf{Test the Model:} Compare results with analytical solutions for
- undamped or lightly damped systems.
+ \textbf{Assumptions:}
\item
- \textbf{Refine the Model:} Add adjustable damping and stiffness
- parameters.
+ \textbf{Solution:}
\item
- \textbf{Troubleshoot Issues:} If the model becomes unstable, reduce
- the time step or use a more accurate integrator.
+ \textbf{Comment:}
\end{enumerate}
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)
-![Mathworks 3-D array](figures/multi-dimensional-array.gif)
+![Mathworks 3-D array](figures/multi-dimensional-array.png)
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.
diff --git a/tutorials/module_2/problem_solving_strategies.md b/tutorials/module_2/problem_solving_strategies.md
index 50216ab..b79b57e 100644
--- a/tutorials/module_2/problem_solving_strategies.md
+++ b/tutorials/module_2/problem_solving_strategies.md
@@ -1,64 +1,49 @@
# Algorithmic thinking
-## Learning Objectives
+In engineering, solving a problem begins long before we start coding or building models. Like any other engineering challenge, computational problems must first be clearly framed and understood. In this section, you will learn to **apply algorithmic thinking** to systematically approach engineering problems, **translate real-world situations into structured programming logic**, and **use computational tools to implement, test, and refine solutions**.
-By the end of this lesson, students will be able to:
-
-- Apply algorithmic thinking to solve engineering problems using computational tools.
-- Translate engineering problems into structured programming logic.
-- Use software tools to implement, test, and refine engineering solutions.
+Before diving into code, it's crucial to define the problem carefully, frame the problem so that logically so that a computer can understand then execute so that
## Define the Problem
-Like many other classes we need to frame the problem before working it. So before jumping straight into coding or building models, clearly define the engineering problem.
-
-- **List knowns and unknowns.** What inputs are given? What outputs are required?
-- **Establish system constraints and assumptions.** Identify physical laws, design requirements, and performance limits.
-- **Clarify computational objectives.** What are you trying to calculate, simulate, or optimize?
+As any other engineering problem, we need to frame it before we can start working on it. So before jumping straight into coding or building models, clearly define the engineering problem.
+1. List your givens, this includes any constants or equations. What inputs do we know?
+2. Find: List what you're trying to solve for. What outputs do we need to find?
+3. Establish the assumptions based on your engineering knowledge that you deem to be appropriate to use for the problem. This determines what mathematical models we can apply to the problem (i.e. equations or formulas).
+4. Solution: Show the works of the problem, this will include any code used together with documentation or any explanations of the code.
+5. Comment: reflect and comment on your findings.
## Think Algorithmically
-Since we are going to use computers to calculate our solution we first need to break the problem into logical steps that a computer can follow.
+Since we are going to use computers to compute our calculate we first need to break the problem into logical steps that a computer can follow. This can be done with tools such as flowchart or psuedo-code.
- **Define the inputs and outputs.** What variables will the program take in, and what results will it produce?
- **Break the problem into sub-tasks.** Identify steps such as data input, logic processing and output.
-- **Outline the algorithm.** Write pseudocode or flowcharts that describe the computational steps.
+- **Outline the algorithm.** Write pseudo-code or flowcharts that describe the computational steps.
- **Identify patterns or formulas.** Can loops, conditionals, or equations be used to automate parts of the solution?
-**Example:** For processing stress-strain data:
-1. Import data from a file.
-2. Convert force and displacement to stress and strain.
+### Flowchart for fixing lamp
+![Lamp Flowchart](figures/LampFlowchart.png)
+
+### Psuedo-Code for processing and plotting stress-strain data:
+1. Import force and displacement data from file.
+2. Convert data from force and displacement to stress and strain.
3. Plot the stress-strain curve.
4. Identify the yield point or modulus.
-
## Write & Execute the Code
+When writing the code it is important to ask yourself whether you're using the right tools, libraries or method to solve the problem. **Check for any syntax and logic errors** then debug line-by-line using print statements or by using a debugging tool.
-- **Choose the right tools.** Are there libraries I can use to get to my objective more effectively?
-- **Write modular code.** Use functions to separate different tasks (e.g., reading data, computing values, plotting).
-- **Check for syntax and logic errors.** Debug line-by-line using print statements or a debugger.
-
-**Example:** Write a Python script that uses NumPy and Matplotlib to load a CSV file, compute stress and strain, and generate plots.
-
-
-## Test and Validate
-
-- **Assess the feasibility of your results.** Do the values align with expected physical behavior?
-- **Compare against established benchmarks.** Validate solutions using experimental data, literature values, or known theoretical limits.
-- **Check units and scaling.** Ensure computations are consistent with physical meaning.
-
-**Example:** If your plot shows stress values in the thousands when you expect hundreds, check unit conversions in your formula.
-
-
-## Case Study: Simulating a Spring-Mass System
+## Verify and Validate
+When writing code it is crucial to test and confirm your code. It is therefore important to ask yourself the following questions. Does the code do what you intended it to do? And, is the mathematical model used in the code valid for the current problem?
-**Scenario:** Model the motion of a mass-spring-damper system using a numerical solver.
+## Exercise: Design a derivative finding algorithm
+Set up the problem and write pseudo-code to calculate the gradient of an unknown function.
-1. **Define the Problem:** Set up the differential equation from Newton’s Second Law.
-2. **Develop a Strategy:** Discretize time, apply numerical integration (e.g., Euler or Runge-Kutta).
-3. **Execute the Code:** Write a Python function that computes motion over time.
-4. **Test the Model:** Compare results with analytical solutions for undamped or lightly damped systems.
-5. **Refine the Model:** Add adjustable damping and stiffness parameters.
-6. **Troubleshoot Issues:** If the model becomes unstable, reduce the time step or use a more accurate integrator. \ No newline at end of file
+1. **Given:**
+2. **Find:
+3. **Assumptions:**
+4. **Solution:**
+5. **Comment:** \ No newline at end of file