diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-03-25 18:05:17 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-03-25 18:05:17 -0600 |
| commit | 49758f4f4d41c2061bf71a64598f726916bc2105 (patch) | |
| tree | e766234fd7cf8a87fdf7e3f9414344c69b32026d /tutorials/module_2 | |
| parent | cb0a7bab95342534d48b15d82250a81a9c91287d (diff) | |
Changed problem solving strategies tutorial to apply to computational methods. And added to TOC list in tutorials/readme.md
Diffstat (limited to 'tutorials/module_2')
| -rw-r--r-- | tutorials/module_2/2_problem_solving_strategies.md | 81 |
1 files changed, 11 insertions, 70 deletions
diff --git a/tutorials/module_2/2_problem_solving_strategies.md b/tutorials/module_2/2_problem_solving_strategies.md index cfc9c19..1a50aec 100644 --- a/tutorials/module_2/2_problem_solving_strategies.md +++ b/tutorials/module_2/2_problem_solving_strategies.md @@ -1,6 +1,6 @@ # Algorithmic thinking -## ## Learning Objectives +## Learning Objectives By the end of this lesson, students will be able to: @@ -9,85 +9,50 @@ By the end of this lesson, students will be able to: - Use software tools to implement, test, and refine engineering solutions. --- - ## 1. Define the Problem -In many fields of engineering we must. Before writing code or building models, clearly define the engineering 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? - - -**Example:** Given force and displacement data from a materials test, write a program to compute and plot stress-strain behavior. --- +## 2. Think Algorithmically -## 2. Develop a Strategy - -To think algorithmically, break the problem into logical steps that a computer can follow. +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. - **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, processing, and visualization. +- **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. - **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. 3. Plot the stress-strain curve. 4. Identify the yield point or modulus. - --- +## 3. Write & Execute the Code -## 3. Execute the Code - -- **Choose the right tools.** Use Python, MATLAB, or similar platforms. +- **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. --- - ## 4. Test and Validate -- **Run test cases.** Use small inputs with known outputs to check correctness. -- **Compare with theoretical or experimental results.** Does the output match expected behavior? +- **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. --- - -## 5. Refine and Optimize - -- **Improve readability and efficiency.** Refactor code to use vectorized operations or clearer variable names. -- **Add flexibility.** Allow the user to change input files or parameters without modifying code. -- **Document the process.** Include comments and a user guide. - -**Example:** Upgrade your script so that it can analyze any stress-strain dataset provided in a CSV file with minimal setup. - ---- - -## 6. Troubleshooting Strategies - -When your code doesn’t work as expected: - -- **Isolate the error.** Use print statements or breakpoints to trace the bug. -- **Check assumptions.** Are inputs being read correctly? Are formulas implemented correctly? -- **Consult documentation.** Use official libraries’ documentation or community resources like Stack Overflow. - -**Example:** If an array is returning NaN values, check whether division by zero is occurring or if missing data is in the input file. - ---- - -## 7. Case Study: Simulating a Spring-Mass System +## Case Study: Simulating a Spring-Mass System **Scenario:** Model the motion of a mass-spring-damper system using a numerical solver. @@ -96,28 +61,4 @@ When your code doesn’t work as expected: 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. - ---- -## Summary - -To solve engineering problems with computers: - -1. **Define the problem and computational goals.** -2. **Develop an algorithmic strategy.** -3. **Implement the solution in code.** -4. **Test and validate with known cases.** -5. **Refine the code and enhance usability.** -6. **Troubleshoot and learn from failures.** - -With algorithmic thinking and the right tools, engineers can automate analysis, simulate systems, and make data-driven decisions more efficiently. - ---- - -## 4. Verify and Interpret Results - -- **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. -- **Conduct a sensitivity analysis.** Examine how slight variations in input parameters influence the outcome. - -**Example:** If a rocket nozzle expansion ratio results in an unrealistic exit velocity, revisit the assumptions regarding isentropic flow and compressibility effects.
\ No newline at end of file +6. **Troubleshoot Issues:** If the model becomes unstable, reduce the time step or use a more accurate integrator.
\ No newline at end of file |
