0% found this document useful (0 votes)
13 views6 pages

Turbo Pascal3: Analisa Metode Numerik

This document discusses the bisection method for finding the root of a non-linear equation. It presents the pseudocode for a program that implements the bisection method in Pascal to find the root of the equation f(x) = x + cos(x). The program takes initial guesses for values a and b, calculates the midpoint c, and evaluates f(a), f(b), and f(c). It then updates the interval based on the signs of f(a) and f(c) and iterates until the interval is less than a given epsilon value.

Uploaded by

Akbar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Turbo Pascal3: Analisa Metode Numerik

This document discusses the bisection method for finding the root of a non-linear equation. It presents the pseudocode for a program that implements the bisection method in Pascal to find the root of the equation f(x) = x + cos(x). The program takes initial guesses for values a and b, calculates the midpoint c, and evaluates f(a), f(b), and f(c). It then updates the interval based on the signs of f(a) and f(c) and iterates until the interval is less than a given epsilon value.

Uploaded by

Akbar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Analisa metode numerik

TU R B O PA S C A L 3

M etode R egula Falsi

f(x) = x + cos (x).

P ersam aan tak linear- B isection


m ethod in Pascal
Program Bisection;
uses wincrt;
var
m,fx,fa,fb,fc,a,b,c,e,x:real;
iterasi:integer;
jawab : string;
begin
repeat
clrscr;
writeln ('
========================================');
writeln ('
Program Bisection Persamaan Tak Linear ');
writeln ('
-=Versi 1.0=');
writeln ('
Programmer :Krisna Febrianto/0608483 ');
writeln ('
Ilmu Komputer - UPI
');
writeln ('
========================================');
writeln;
write('Nilai tebakan awal a : ');readln(a);
write('Nilai tebakan awal b : ');readln(b);
write('Nilai epsilon
: ');readln(e);

iterasi:=1;
repeat
writeln;
writeln('Iterasi ke ',iterasi);
writeln('Akar pada [',a:10:6,',',b:10:6,']');
c:=(a+b)/2;
{cari fa}
x:=a;
fx:=x+cos(x);;
fa:=fx;
writeln('Nilai f(a)= ',fa:10:6);
x:=b;
fx:=x+cos(x);
fb:=fx;
writeln('Nilai f(b)= ',fb:10:6);
x:=c;
fx:=x+cos(x);
fc:=fx;
writeln('Nilai f(c)= ',fc:10:6);
m:=b-a;
if m<0 then m:=m*-1;

x:=c;
fx:=x+cos(x);
fc:=fx;
writeln('Nilai f(c)= ',fc:10:6);
m:=b-a;
if m<0 then m:=m*-1;
if fa*fc<0 then b:=c
else
a:=c;
iterasi:=iterasi+1;
until m<e;
writeln;
writeln('Hampiran akarnya adalah: ',c:10:6);
writeln;
write ('Apakah anda ingin mengulanginya lagi y/t = ');
readln(jawab);
until (jawab = 't');
end.

You might also like