Dipunyai persamaan :
dengan x0=2 error=0.00001
Penyelesaian:
x^3-2x+1=0
<=> x^3-2x=-1
<=> x(x^2-2)=-1
<=>x=-1/(x^2-2)
Source Code Scilab
function y=g(x)
y=-1/(x^2-2);
endfunction
n=100;
i=0;
x0=1;
x1=2;
err=0.00001;
while abs(x1-x0)>err
x2=g(x1);
x0=x1;
x1=x2;
i=i+1;
disp("iterasi "+string(i)+ " => "+string(x0)+" "+string(x1));
if i >= n then
disp("Maks iteration exceed");
end;
end
disp("Solusi= "+string(x2));
Senin, 11 Mei 2015
Posts by : Admin
Langganan:
Posting Komentar (Atom)
You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "
0 komentar:
Posting Komentar