summaryrefslogtreecommitdiff
path: root/tutorials/module_2
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 /tutorials/module_2
parentce478a33e25759b901d401609175713a5ded3522 (diff)
Finished of module 1 tutorials (.md) and added documentation to module 2
Diffstat (limited to 'tutorials/module_2')
-rw-r--r--tutorials/module_2/problem_solving_strategies.md67
1 files changed, 26 insertions, 41 deletions
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