function v = testeSpline5(z,k)
%calcula as derivadas k-esima
s = sign(z);
z = abs(z);
dz0 = 0^k;
dz1 = prod(2-k:1)*z^(1-k);
dz2 = prod(3-k:2)*z^(2-k);
dz3 = prod(4-k:3)*z^(3-k);
dz4 = prod(5-k:4)*z^(4-k);
dz5 = prod(6-k:5)*z^(5-k);


% if z <= 1
%     v = dz0 - (5/3)*dz3 + (55/36)*dz4 - ...
%         (85/216)*dz5;
% elseif (z > 1) && (z < 2)
%     v = 1/2*dz0 + (5/2)*dz1 - ...
%         5*dz2 + (10/3)*dz3 - ...
%         (35/36)*dz4 + (23/216)*dz5;
% elseif (z >= 2) && (z <= 3)
%     v = (1/54)*(-1)^k*prod(6-k:5)*(3-z)^(5-k);
% else
%     v = 0;
% end
% 
% v = v*s^k;



if z <= 1
    v = dz0 - (10/11)*dz2 + (5/11)*dz4 - ...
        (5/33)*dz5;
elseif (z > 1) && (z < 2)
    v = 17/22*dz0 + (25/22)*dz1 - (35/11)*dz2 + (25/11)*dz3 - ...
        (15/22)*dz4 + (5/66)*dz5;
elseif (z >= 2) && (z <= 3)
    v = (1/66)*(-1)^k*prod(6-k:5)*(3-z)^(5-k);
else
    v = 0;
end

v = v*s^k;