Code covered by the BSD License  

Highlights from
GetNegativeRoot similar to That of Positive Integers

GetNegativeRoot similar to That of Positive Integers

by

 

GetNegativeRoot similar to That of Positive Integers

GetNegativeRoot(value,root )
function varint = GetNegativeRoot(value,root )
%This function calculates Negative Root as Integer
% Eg (-32)^(1/5) = -2 and not complex number
% Usage :- GetNegativeRoot(-32,5)

if value > 0
    disp('Error: Entered value is non-Negative Integer, Kindly enter Negative Integer');
    return;
end

varint = (value)^(1/root);
if ~isreal(varint)
    varint = (-1)*abs(varint);
end


end

Contact us