Algorithms and flowcharts for numerical analysis problems
At a Glance
- Frequency: 2 sub-parts across 2 of 13 years (2014, 2019)
- Priority tier: T3
- Marks (count): 15 (1), 10 (1)
- Average solve time: ~10 min
- Difficulty mix: medium 1, easy 1
- Section: B | Dominant type: derivation
Why This Chapter Matters
Flowchart questions test whether you can translate a numerical integration formula into a procedural algorithm using standard symbols. The 2014 question (15 marks) asks for a Simpson’s 1/3 rule flowchart including the even- validation; the 2019 question (10 marks) asks for a trapezoidal rule flowchart and algorithm for a specific integral. Both are entirely formula-to-diagram translations — there is no numerical computation. The key skill is knowing the correct weight pattern for each rule and expressing it as an accumulator loop.
Minimum Theory
Standard flowchart symbols. Oval (rounded rectangle): START/STOP. Rectangle: process (computation or assignment). Diamond: decision (yes/no branch). Parallelogram: input/output (READ/PRINT). Arrows connect the symbols.
Composite trapezoidal rule algorithm. Input . Compute . Initialise . Loop to : , . Result: .
Composite Simpson’s 1/3 rule algorithm. Input (with even). Compute . Validate: if is odd, stop with error. Initialise . Loop to : if is odd add ; if is even (interior) add . Result: . Weight pattern: .
Question Archetypes
| Archetype | Recognition |
|---|---|
| flowchart-algorithm | ”Draw a flowchart for [numerical method]”; or “Draw a flowchart and write an algorithm/program for evaluating [integral] by [method]“ |
flowchart-algorithm (2 question(s); 2014, 2019)
Recognition Cues
- “Draw a flowchart for Simpson’s one-third rule.”
- “Draw a flow chart and write a basic algorithm for evaluating using the trapezoidal rule.”
- No numerical data given — purely procedural.
Solution Template
- State the formula (one line). Identify the weights: endpoints, odd-indexed, even-indexed interior.
- Write the algorithm as numbered pseudocode steps (READ, compute , initialise sum, loop, multiply, PRINT, STOP).
- Draw the flowchart using proper symbols. Include: START READ inputs compute initialise sum decision (loop condition) process (accumulate) loop back multiply PRINT STOP.
- For Simpson’s: add a validation diamond: “Is even?” — branch to error/STOP if not.
Worked Example
2014 Paper 2, 2014-P2-Q7b (15 marks)
Draw a flowchart for Simpson’s one-third rule.
Formula. , , even.
Algorithm (pseudocode):
1. START
2. READ f(x), a, b, n
3. IF n is ODD: PRINT "n must be even"; STOP
4. h ← (b − a) / n
5. S ← f(a) + f(b)
6. i ← 1
7. WHILE i ≤ n−1:
8. x_i ← a + i·h
9. IF i is ODD: S ← S + 4·f(x_i)
10. ELSE: S ← S + 2·f(x_i)
11. i ← i + 1
12. integral ← (h/3) · S
13. PRINT integral
14. STOP
Flowchart description (symbols):
[START]
↓
[READ: f(x), a, b, n]
↓
<Is n even?>─No─→[PRINT "n must be even"]─→[STOP]
│ Yes
↓
[h = (b-a)/n; S = f(a)+f(b); i = 1]
↓
<i ≤ n−1?>─No─→[I = (h/3)·S]
│ Yes ↓
↓ [PRINT I]
[x_i = a+i·h] ↓
↓ [STOP]
<i is odd?>─Yes─→[S = S + 4·f(x_i)]
│ No ↓
↓ [i = i + 1]─────┐
[S = S + 2·f(x_i)] │
↓ │
[i = i + 1]────────────────────→(loop back to <i ≤ n−1?>)
2019 Paper 2, 2019-P2-Q5e (10 marks)
Draw a flowchart and write a basic algorithm for evaluating using the trapezoidal rule.
Formula. , , , .
Algorithm:
1. START
2. READ a=0, b=6, n
3. h ← (b − a) / n
4. S ← f(a) + f(b) [f(x) = 1/(1 + x²)]
5. FOR i = 1 TO n−1:
6. x ← a + i·h
7. S ← S + 2·f(x)
8. END FOR
9. y ← (h/2) · S
10. PRINT y
11. STOP
Flowchart (trapezoidal — no even- check needed):
[START]
↓
[READ a, b, n]
↓
[h=(b-a)/n; S=f(a)+f(b); i=1]
↓
<i ≤ n−1?>─No─→[y = (h/2)·S]
│ Yes ↓
↓ [PRINT y]
[x = a+i·h] ↓
[S = S+2·f(x)] [STOP]
[i = i+1]
↓
(loop back to <i ≤ n−1?>)
Common Traps
- Forgetting the even- validation for Simpson’s. The rule requires an even number of subintervals. The flowchart must include a decision diamond that branches to an error message if is odd. Omitting this costs marks.
- Weight pattern error. For trapezoidal: weights are . For Simpson’s: weights are . A common mistake is applying weight 4 to all interior points.
- Initialise correctly. Add (weight 1 each) outside the loop, then accumulate or inside. Starting the loop from or double-counts the endpoints.
- Final multiplier. Apply for trapezoidal and for Simpson’s exactly once, after the loop ends.
Marks-Aware Writing
A 15-mark flowchart answer must show all standard symbols used correctly (oval for start/stop, diamond for decisions, rectangle for processes), all variable assignments visible, the validation step (for Simpson’s), the loop structure with correct bounds, and the final formula. A 10-mark answer must show the pseudocode algorithm plus a flowchart; the code listing alone without the diagram does not satisfy the question.
Practice Set
- 2014-P2-Q7b (15 m) — — Hint: Simpson’s needs even- check; weight pattern ; verify with , , giving .
- 2019-P2-Q5e (10 m) — — Hint: trapezoidal on ; no validation needed; interior loop to , weight ; exact value is .