Challenge - 5 Problems
Numerical Computation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of matrix inversion with numerical precision
What is the output of this MATLAB code snippet?
MATLAB
A = [1 2; 3 4]; B = inv(A); disp(B * A);
Attempts:
2 left
💡 Hint
Matrix multiplied by its inverse should be identity matrix.
✗ Incorrect
Multiplying a matrix by its inverse results in the identity matrix. MATLAB displays floating point numbers with 4 decimals by default.
🧠 Conceptual
intermediate1:30remaining
Why numerical methods approximate solutions
Why do numerical computations often provide approximate rather than exact solutions in real problems?
Attempts:
2 left
💡 Hint
Think about how computers store numbers.
✗ Incorrect
Computers store numbers with limited digits, so irrational or very precise numbers are approximated, causing numerical methods to produce approximate results.
🔧 Debug
advanced2:00remaining
Identify the error in numerical integration code
What error does this MATLAB code produce when run?
MATLAB
f = @(x) x.^2; result = integral(f, 0, 1, 'AbsTol', -1); disp(result);
Attempts:
2 left
💡 Hint
Check the tolerance parameter value.
✗ Incorrect
The 'AbsTol' parameter for integral must be a positive number. Negative values cause an error.
📝 Syntax
advanced1:30remaining
Correct syntax for element-wise operations
Which option correctly computes the element-wise square of vector v in MATLAB?
MATLAB
v = [1, 2, 3, 4];
Attempts:
2 left
💡 Hint
Remember MATLAB uses dot for element-wise operations.
✗ Incorrect
In MATLAB, the dot operator before ^ means element-wise power. Without dot, ^ is matrix power which is invalid for vectors.
🚀 Application
expert3:00remaining
Result of iterative numerical method for root finding
What is the approximate value of x after 3 iterations of Newton's method starting at x=1 for f(x)=x^2-2?
MATLAB
f = @(x) x^2 - 2; f_prime = @(x) 2*x; x = 1; for i = 1:3 x = x - f(x)/f_prime(x); end disp(x);
Attempts:
2 left
💡 Hint
Newton's method converges quickly to sqrt(2).
✗ Incorrect
Starting at 1, Newton's method for f(x)=x^2-2 converges to sqrt(2) ≈ 1.4142 after 3 iterations.