summaryrefslogtreecommitdiff
path: root/50/DEPENDENCIES/newton63.sce
blob: 186634d2e743b1193c174f46f5bc85b3362d33d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

function x=newton63(x,f,fp,fpp)
    R=100;
    PE=10^-15;
    maxval=10^4;
        
    for n=1:1:R
        x=x-(f(x)*fp(x))/(fp(x)^2-f(x)*fpp(x)); 
        if abs(f(x))<=PE then break
        end
        if (abs(f(x))>maxval) then error('Solution diverges');
            abort
            break
        end
    end
    disp(n," no. of iterations =")
endfunction