ITPEC FE Subject B April 2025 Question 15
ITPEC FE Subject B April 2025 — Question 15 of 20
Math & Numbers — Minkowski distance calculation with varying exponent n
The function calcDistance(p1, p2, n) computes the Minkowski distance of order n:
(Σ|p1[i] - p2[i]|^n)^(1/n)
Given p1 = {3, 1, 5, 2} and p2 = {4, 6, 2, 3}:
- •Absolute differences:
|3-4|=1,|1-6|=5,|5-2|=3,|2-3|=1
For n=1 (Manhattan distance):
- distance = 1 + 5 + 3 + 1 = 10
- ex = 1/1 = 1
- result = 10^1 = 10 → A = 10
For n=2 (Euclidean distance):
- distance = 1 + 25 + 9 + 1 = 36
- ex = 1/2 = 0.5
- result = 36^0.5 = 6 → B = 6
Why not others:
- A=4 options (a–d): incorrect sum for n=1; forgetting to include all four terms or miscalculating
- B=10 or B=18: wrong exponent application or summing without taking the root
- B=4: would imply √16, but the sum of squares is 36, not 16
Key rule: As n → ∞, Minkowski distance converges to the Chebyshev distance = max(|p1[i] - p2[i]|). Here max(1,5,3,1) = 5, confirming the problem statement.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.