tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
13
Task/Nth-root/MATLAB/nth-root-1.m
Normal file
13
Task/Nth-root/MATLAB/nth-root-1.m
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function answer = nthRoot(number,root)
|
||||
|
||||
format long
|
||||
|
||||
answer = number / root;
|
||||
guess = number;
|
||||
|
||||
while not(guess == answer)
|
||||
guess = answer;
|
||||
answer = (1/root)*( ((root - 1)*guess) + ( number/(guess^(root - 1)) ) );
|
||||
end
|
||||
|
||||
end
|
||||
5
Task/Nth-root/MATLAB/nth-root-2.m
Normal file
5
Task/Nth-root/MATLAB/nth-root-2.m
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
>> nthRoot(2,2)
|
||||
|
||||
ans =
|
||||
|
||||
1.414213562373095
|
||||
Loading…
Add table
Add a link
Reference in a new issue