Laman

Rabu, 11 April 2012

Metode Regulafalsi Pada Program Pascal









Ini adalah salah satu metode Bisection and regulafalsi dengan program Pascal yang bisa anda tiru untuk belajar .
                                                                  
  LISTING PROGRAM

PROCEDURE RegulaFalsi(a,b,eps:Real; VAR xsol:Real);
{ Required condition: f(a)*f(b)<0 }
{ eps = accuracy of the root, e.g.: 0.000001 }
VAR
   c, fa, fb:Real;
BEGIN
   REPEAT
     fa:=f(a); fb:=f(b);
     c:=b - (b-a)*fb/(fb-fa);
     IF fa*f(c)<0 THEN b:=c
     ELSE a:=c
   UNTIL b-a<eps;
   xsol:=c
END; {Regula Falsi method - Pascal code}


PROCEDURE Bisection(a,b,eps:Real; VAR xsol:Real);
{ Required condition: f(a)*f(b)<0 }
{ eps = accuracy of the root, e.g.: 0.000001 }
VAR
   c:Real;
BEGIN
   REPEAT
     c:=(a+b)/2;
     IF f(a)*f(c)<0 THEN b:=c
     ELSE a:=c
   UNTIL b-a<eps;
   xsol:=c
END; {Bisection method - Pascal code}


Related Article:

0 komentar:

Posting Komentar


 

Gunadarma BAAK News

Gunadarma BAAK News

Gunadarma BAAK News

Total Tayangan Halaman

Pengikut

Powered By Blogger
Copyright 2010 Anggun Blogg's. All rights reserved.
Themes by Bonard Alfin l Home Recording l Distorsi Blog