# Integrated computational problem solving

Physics I · Computer Science · https://tryals.app/learn/physics-i/integrated-computational-problem-solving

## Complete Scientific Workflows

**Integrated computational problem solving** combines algorithms, data structures, numerical methods, and visualisation into end-to-end scientific pipelines. 

A typical pipeline flows from definition to insight:

| Pipeline Stage | Action / Purpose |
| --- | --- |
| **Define** | Formulate the scientific question |
| **Model** | Write the governing equations |
| **Discretise** | Choose numerical methods & step size |
| **Code** | Implement in Python (NumPy/Matplotlib) |
| **Validate** | Check limits and edge cases |
| **Visualise** | Plot and interpret results |

**Core Strategy:** Always start simple. Build your code without drag or friction first, validate that baseline, and add complexity incrementally.

## Projectile Simulation & Pitfalls

Consider a **projectile with drag** modelled via Newton's second law. The position updates use velocity components affected by gravity $g$ and drag coefficient $b$:

$v_x^{(i)} = v_x^{(i-1)} - b \cdot \text{speed} \cdot v_x^{(i-1)} \cdot dt$

$v_y^{(i)} = v_y^{(i-1)} - (g + b \cdot \text{speed} \cdot v_y^{(i-1)}) \cdot dt$

**Validation check:** Set $b=0$ to ensure your simulation recovers the standard textbook parabolic trajectory.

> **Common pitfall:** **Premature optimisation** wastes massive effort. First make your code correct and clear, measure performance bottlenecks, and only then speed up what the profiler actually indicts.

## Practice questions

5 of this lesson's 13 practice questions, with answers. The full set is in the app.

### 1. Match each problem-solving strategy to its description.

**Answer:**

- Decomposition → Break problem into sub-problems
- Abstraction → Focus on essential details, ignore the rest
- Pattern recognition → Identify similarities with known problems
- Algorithm design → Create a step-by-step solution procedure

**Why:** These four pillars form the foundation of computational thinking.

Page: https://tryals.app/practice/physics-i/integrated-computational-problem-solving/match-each-problem-solving-strategy-to-its-description

### 2. A program spends **95% of its time in one function**. You optimise everything else until it is instant. How much faster is the program?

A. About 5% faster: the untouched 95% still has to run
B. Impossible to say without knowing the language
C. Twice as fast, since half the program was improved
D. Twenty times faster, since 95% of the code has been removed

**Answer:** A. About 5% faster: the untouched 95% still has to run

**Why:** 100 units become 95, so the gain is about 5%. Amdahl’s law: the untouched fraction bounds the total speed-up however perfectly the rest is optimised. This is the argument for profiling before optimising: effort spent outside the hot path is capped before it starts, and intuitions about where time goes are usually wrong.

Page: https://tryals.app/practice/physics-i/integrated-computational-problem-solving/a-program-spends-95-of-its-time-in-one-function-you-optimise

### 3. Which are steps in the computational problem-solving cycle?

A. Design an algorithm
B. Define the problem
C. Test and refine
D. Memorise all formulas

**Answer:** A. Design an algorithm; B. Define the problem; C. Test and refine

**Why:** Memorising formulas is not a step; understanding and applying them is.

Page: https://tryals.app/practice/physics-i/integrated-computational-problem-solving/which-are-steps-in-the-computational-problem-solving-cycle

### 4. Complete the paragraph about integrated problem solving.

**Answer:** First, **decompose** the problem into manageable parts. Then build a computational **model** for each part. After coding, **validate** the results against known cases and **iterate** to improve accuracy.

**Why:** The cycle of decompose $\to$ model $\to$ validate $\to$ iterate drives reliable computational solutions.

Page: https://tryals.app/practice/physics-i/integrated-computational-problem-solving/complete-the-paragraph-about-integrated-problem-solving

### 5. Complete the statement with the correct term.

**Answer:** The process of translating a real-world problem into a mathematical or computational form is called **modelling**.

**Why:** Modelling abstracts real phenomena into equations or code that a computer can process.

Page: https://tryals.app/practice/physics-i/integrated-computational-problem-solving/complete-the-statement-with-the-correct-term
