summaryrefslogtreecommitdiff
path: root/book/module2
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-04-24 23:28:53 -0600
committerChristian Kolset <christian.kolset@gmail.com>2025-04-24 23:28:53 -0600
commit0fc68d39cf23955f443c75fa536922b45cf2e1dc (patch)
tree3411ce1ba48b1cc39f67ed132a1059ac435aa40f /book/module2
parent1cdf11068535106b87c4b696e9aba025f23fabde (diff)
Updated .tex files
Diffstat (limited to 'book/module2')
-rw-r--r--book/module2/ai_assisted_programming.tex52
-rw-r--r--book/module2/module2.tex5
-rw-r--r--book/module2/problem_solving_strategies.tex127
-rw-r--r--book/module2/version_control.tex42
4 files changed, 183 insertions, 43 deletions
diff --git a/book/module2/ai_assisted_programming.tex b/book/module2/ai_assisted_programming.tex
index 2fee22b..4d6dcde 100644
--- a/book/module2/ai_assisted_programming.tex
+++ b/book/module2/ai_assisted_programming.tex
@@ -11,17 +11,23 @@ suggestions and allows you to focus on solving the problem at hand
rather. AI is a technology that is constantly improving. As engineers we
need to \emph{understand} how we can use AI as a tool to achieve our
goals more efficiently. This section cover good practices of how we can
-implement AI and lists some AI assistant tools that we can use. \#\#
-Good vs.~Bad uses of AI Don't try to get AI to do work \emph{for you}
-but \emph{with you}. You need to understand what you're doing. If you
-don't understand what the AI is doing, then you're not in control of the
-work. You're not going to go far until something unexpected happens.
+implement AI and lists some AI assistant tools that we can use.
+
+\subsection{Good vs.~Bad uses of AI}\label{good-vs.-bad-uses-of-ai}
+
+Don't try to get AI to do work \emph{for you} but \emph{with you}. You
+need to understand what you're doing. If you don't understand what the
+AI is doing, then you're not in control of the work. You're not going to
+go far until something unexpected happens.
AI is a great learning tool, research as show that students can benefit
from using AI as personal tutor
\href{https://hbsp.harvard.edu/inspiring-minds/ai-as-personal-tutor}{more}.
-\#\# Available tools Below is a comprehensive list of tools that are
-available at not cost to you.
+
+\subsection{Available tools}\label{available-tools}
+
+Below is a comprehensive list of tools that are available at not cost to
+you.
\begin{longtable}[]{@{}ll@{}}
\toprule\noalign{}
@@ -44,12 +50,16 @@ aiXcoder & Free \\
Many of the tools above come with similar, if not, the same features.
Some of the tools come as chatbots on the web and others are extensions
-that can be implemented in your favorite IDE. \#\# VSCode and GitHub
-Copilot Integration We will not cover how to use VSCode in this course,
-however it is a very versatile IDE that comes with many other extension,
-for example git, github and github copilot integration. There are also
-other extensions for other IDE's however we will only cover some basic
-features that the GithHub Copilot extension in VSCode can do.
+that can be implemented in your favorite IDE.
+
+\subsection{VSCode and GitHub Copilot
+Integration}\label{vscode-and-github-copilot-integration}
+
+We will not cover how to use VSCode in this course, however it is a very
+versatile IDE that comes with many other extension, for example git,
+github and github copilot integration. There are also other extensions
+for other IDE's however we will only cover some basic features that the
+GithHub Copilot extension in VSCode can do.
Copilot Comes with the following features: - Get code suggestions as you
type - Ask questions about the code - Inline chat to generate code. -
@@ -57,9 +67,13 @@ Fix and debug code using the chat window - Generate code documentation
\href{https://code.visualstudio.com/}{VSCode}
\href{https://code.visualstudio.com/docs/copilot/setup-simplified}{Copilot
-extension} \#\# A note on integrity If you have a
-non-disclosure-agreement (NDA) with your employer, it may not always be
-possible to use AI for security and integrity reasons as you may risk
-exposing confidential information with third party vendors. It is highly
-recommended to be able to be able to write program independently of an
-AI assistant. Always think before you share data.
+extension}
+
+\subsection{A note on intellectual
+property}\label{a-note-on-intellectual-property}
+
+If you have a non-disclosure-agreement (NDA) with your employer, it may
+not always be possible to use AI for security and integrity reasons as
+you may risk exposing confidential information with third party vendors.
+It is highly recommended to be able to be able to write program
+independently of an AI assistant. Always think before you share data.
diff --git a/book/module2/module2.tex b/book/module2/module2.tex
index f16e7e2..2781a0e 100644
--- a/book/module2/module2.tex
+++ b/book/module2/module2.tex
@@ -1,5 +1,6 @@
-\chapter{Module 2}
+\chapter{Module 2: Algorithm Development}
+\input{module2/problem_solving_strategies}
+\input{module2/intro_to_numerical_methods}
\input{module2/ai_assisted_programming}
\input{module2/debugging_code}
-\input{module2/intro_to_numerical_methods}
\input{module2/version_control}
diff --git a/book/module2/problem_solving_strategies.tex b/book/module2/problem_solving_strategies.tex
new file mode 100644
index 0000000..4b908f8
--- /dev/null
+++ b/book/module2/problem_solving_strategies.tex
@@ -0,0 +1,127 @@
+\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}
+
+\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.
+
+\begin{itemize}
+\tightlist
+\item
+ \textbf{List knowns and unknowns.} What inputs are given? What outputs
+ are required?
+\item
+ \textbf{Establish system constraints and assumptions.} Identify
+ physical laws, design requirements, and performance limits.
+\item
+ \textbf{Clarify computational objectives.} What are you trying to
+ calculate, simulate, or optimize?
+\end{itemize}
+
+\subsection{Think Algorithmically}\label{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.
+
+\begin{itemize}
+\tightlist
+\item
+ \textbf{Define the inputs and outputs.} What variables will the
+ program take in, and what results will it produce?
+\item
+ \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
+ 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.
+
+\subsection{Write \& Execute the Code}\label{write-execute-the-code}
+
+\begin{itemize}
+\tightlist
+\item
+ \textbf{Choose the right tools.} Are there libraries I can use to get
+ to my objective more effectively?
+\item
+ \textbf{Write modular code.} Use functions to separate different tasks
+ (e.g., reading data, computing values, plotting).
+\item
+ \textbf{Check for syntax and logic errors.} Debug line-by-line using
+ print statements or a debugger.
+\end{itemize}
+
+\textbf{Example:} Write a Python script that uses NumPy and Matplotlib
+to load a CSV file, compute stress and strain, and generate plots.
+
+\subsection{Test and Validate}\label{test-and-validate}
+
+\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}
+
+\textbf{Example:} If your plot shows stress values in the thousands when
+you expect hundreds, check unit conversions in your formula.
+
+\subsection{Case Study: Simulating a Spring-Mass
+System}\label{case-study-simulating-a-spring-mass-system}
+
+\textbf{Scenario:} Model the motion of a mass-spring-damper system using
+a numerical solver.
+
+\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).
+\item
+ \textbf{Execute the Code:} Write a Python function that computes
+ motion over time.
+\item
+ \textbf{Test the Model:} Compare results with analytical solutions for
+ undamped or lightly damped systems.
+\item
+ \textbf{Refine the Model:} Add adjustable damping and stiffness
+ parameters.
+\item
+ \textbf{Troubleshoot Issues:} If the model becomes unstable, reduce
+ the time step or use a more accurate integrator.
+\end{enumerate}
diff --git a/book/module2/version_control.tex b/book/module2/version_control.tex
index 3c5ac6a..1c327c6 100644
--- a/book/module2/version_control.tex
+++ b/book/module2/version_control.tex
@@ -17,8 +17,6 @@ In this section is divided up into two major sections. The first section
project. The second section will cover how to use git with GitHub to
\emph{collaborate} on projects.
-\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
-
\subsection{Git}\label{git}
Git is a version control program that tracks changes to files and
@@ -51,25 +49,25 @@ committed:
This leads us to the three main sections of a Git project: the working
tree, the staging area, and the Git directory.
-\includegraphics{https://git-scm.com/book/en/v2/images/areas.png} \#\#\#
-Branching In git, branches allow for parallel workflow on a project. It
-give contributors the ability to work different features at the same
-time. Each branch represents an independent line of development, and
-once a feature or fix is complete, it can be merged back into the main
-branch. Here is a common branching structure used in many Git projects:
-- Main Branch - The main branch (a.k.a. master branch) is the default
-branch in a Git repository and contains the stable version of the code.
-- Development Branch - is created to develop a new feature or fix a bug
-without affecting the main branch. It isn't necessarily always stable,
-but whenever it gets to a stable state, it can be merged into master. -
+\includegraphics{figures/git_areas.png} \#\#\# Branching In git,
+branches allow for parallel workflow on a project. It give contributors
+the ability to work different features at the same time. Each branch
+represents an independent line of development, and once a feature or fix
+is complete, it can be merged back into the main branch. Here is a
+common branching structure used in many Git projects: - Main Branch -
+The main branch (a.k.a. master branch) is the default branch in a Git
+repository and contains the stable version of the code. - Development
+Branch - is created to develop a new feature or fix a bug without
+affecting the main branch. It isn't necessarily always stable, but
+whenever it gets to a stable state, it can be merged into master. -
Topic Branch - A topic branch is a short-lived branch that you create
and use for a single particular feature or related work.
-\includegraphics{https://git-scm.com/book/en/v2/images/lr-branches-2.png}
-\#\#\# Best Practices - Use descriptive commit messages. - Commit early
-and often. - Keep commits focused on a single change. - Use feature
-branches for new features or bug fixes. - Review and test changes before
-merging. - Resolve conflicts promptly. - Keep the commit history clean
-and organized.
+\includegraphics{figures/git_silo_branching.png} \#\#\# Best Practices -
+Use descriptive commit messages. - Commit early and often. - Keep
+commits focused on a single change. - Use feature branches for new
+features or bug fixes. - Review and test changes before merging. -
+Resolve conflicts promptly. - Keep the commit history clean and
+organized.
\subsubsection{Basic Commands}\label{basic-commands}
@@ -114,19 +112,19 @@ be using for this course.
\textbf{Centralized}: The project has only one central hub or
\emph{repository}, can accept code and everybody synchronizes their work
with it. This model is suitable for small and closed-sourced projects.
-\includegraphics{https://git-scm.com/book/en/v2/images/centralized_workflow.png}
+\includegraphics{figures/git_workflow_centralized.png}
\textbf{Integration-Manager:} There are multiple public variants of the
code original code known as \emph{forks}. The integration manager can
decide what features to pull from the forks. This is the model that is
similar to the one used on GitHub
-\includegraphics{https://git-scm.com/book/en/v2/images/integration-manager.png}
+\includegraphics{figures/git_workflow_int_manager.png}
\textbf{Dictator and Lieutenants Workflow:} This is similar to the
integration-manager model, however due to the size of the project. A
rank of integration managers is formed. one example of this is the
development of the Linux kernel.
-\includegraphics{https://git-scm.com/book/en/v2/images/benevolent-dictator.png}
+\includegraphics{figures/git_workflow_dictator.png}
GitHub is designed around a particular collaboration workflow, centered
on Pull Requests. This flow works whether you're collaborating with a