Cody

Solution 582218

Submitted on 14 Feb 2015 by Romain Dupouy
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% fh=@sin; x0=pi/4; h=1e-4; y_correct = 0.707106780007960; tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

ans = 0.7071

2   Pass
%% fh=@(x) x^2+1; x0=2; h=1e-4; y_correct = 4.000000 tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

y_correct = 4 ans = 4

3   Pass
%% fh=@(x) 3*sqrt(x^2+1); x0=5; h=1e-4; y_correct = 2.941742027049443 tol=1e-4; assert(abs(diffquot(fh,x0,h)-y_correct)<tol);

y_correct = 2.9417 ans = 2.9417