Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
f = @sin;
df = Derivative(f);
x = 10*rand(10000,1);
dy = cos(x);
assert(max(abs((dy-df(x))./dy))<1e-13)
|
2 | Pass |
%%
f = @log;
df = Derivative(f);
x = exp(500*rand(10000,1));
dy = 1./x;
assert(max(abs((dy-df(x))./dy))<1e-13)
|
3 | Pass |
%%
f = @exp;
df = Derivative(f);
x = 50*(rand(10000,1)-0.5);
dy = exp(x);
assert(max(abs((dy-df(x))./dy))<1e-13)
|
4 | Pass |
%%
t = 10*rand;
f = @(x)1./(x+t);
df = Derivative(f);
x = 100*(rand(10000,1)-0.5); x(x==-t) = 1;
dy = -1./(x+t).^2;
assert(max(abs((dy-df(x))./dy))<1e-13)
|
5 | Pass |
%%
t = 10*rand-5;
f = @(x)atan(t*x);
df = Derivative(f);
x = 100*(rand(10000,1)-0.5);
dy = t./(t^2*x.^2 + 1);
assert(max(abs((dy-df(x))./dy))<1e-13)
|
6 | Pass |
%%
for t = 2:6
f = @(x)t.^x./(sin(x).^t+cos(x).^t);
df = Derivative(f);
x = 3+rand(10000,1);
dy = (t.^x.*log(t))./(cos(x).^t+sin(x).^t)-...
(t.^x.*(t.*cos(x).*sin(x).^(t-1)-...
t.*cos(x).^(t-1).*sin(x)))./(cos(x).^t+sin(x).^t).^2;
assert(max(abs((dy-df(x))./dy))<1e-13)
end
|
Read a column of numbers and interpolate missing data
1235 Solvers
584 Solvers
Create a Multiplication table matrix...
283 Solvers
365 Solvers
669 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!