Untuk penjelasan secara matematis buka aja di sini
ini listing programnya
PROGRAM NEWTON_RAPHSON;
USES CRT;
FUNCTION F(X:REAL):REAL;
BEGIN
F:=EXP(X)-4*X;
END;
FUNCTION G(X:REAL):REAL;
BEGIN
G:=EXP(X)-4;
END;
VAR XL,XB,E,M : REAL;
X : INTEGER;
BEGIN
CLRSCR;
WRITELN('PROGRAM METODE NEWTON RAPHSON');
WRITELN('=============================');
E:=0.0001;
WRITE('MASUKKAN X : ');READLN(XL);WRITELN;
X:=0;
REPEAT
XB:=XL-(F(XL)/G(XL));
M:= ABS(XL-XB);
XL:=XB;
X:=X+1;
WRITELN ('ITERASI KE ',X,'= ',XB:0:8);
UNTIL M
WRITELN;
WRITELN ('AKARNYA ADALAH = ',XB:0:6);
READLN;
END.
ini listing programnya
PROGRAM NEWTON_RAPHSON;
USES CRT;
FUNCTION F(X:REAL):REAL;
BEGIN
F:=EXP(X)-4*X;
END;
FUNCTION G(X:REAL):REAL;
BEGIN
G:=EXP(X)-4;
END;
VAR XL,XB,E,M : REAL;
X : INTEGER;
BEGIN
CLRSCR;
WRITELN('PROGRAM METODE NEWTON RAPHSON');
WRITELN('=============================');
E:=0.0001;
WRITE('MASUKKAN X : ');READLN(XL);WRITELN;
X:=0;
REPEAT
XB:=XL-(F(XL)/G(XL));
M:= ABS(XL-XB);
XL:=XB;
X:=X+1;
WRITELN ('ITERASI KE ',X,'= ',XB:0:8);
UNTIL M
WRITELN;
WRITELN ('AKARNYA ADALAH = ',XB:0:6);
READLN;
END.
Tidak ada komentar:
Posting Komentar