Contoh Pengerjaan soal Persamaan Non Linier Metode Numerik Menggunkan Pascal
Selamat pagi kawan thegaptek, kali ini saya akan menposting bagaimana menyelesaikan soal Mata Kuliah Metode Numerik Persamaan Non Linier Bagi 2 sebagai berikut.
f(x)= ex -4x7+ 11
Nilai epsilonnya = 0.001
Ini dia codingnya:
Pertama:
Buat Coding ini dulu dengan nama file: Math.PAS
————————————————————————————————————-
(* Turbo Pascal 5.0 Math Functions *)
unit MATH;
{$IFDEF VER40} {$N+} {$ELSE} {$N+,E+} {$ENDIF}
interface
Function Power( base, exponent : Real ) : Real; {power of base raised
to exponent}
Function Log( argument : Real ) : Real; { log (base10) of argument}
Function Rad( degrees : Real ) : Real; {convert radians to degrees}
Function Deg( radians : Real ) : Real; {convert degrees to radians}
Function Fact( x : Integer) : Double; {factorial of x}
Function Perm( n, r : Integer) : Double; {permutations of n taken r at
a time}
Function Comb( n, r : Integer) : Double; {combinations of n taken r at
a time}
implementation
Function Power( base, exponent : Real) : Real;
begin
If Base=0 Then
Power:=0
Else
Power := EXP( exponent * LN( base));
end; {Power}
Function Log( argument : Real) : Real;
const BASE = 10;
begin
Log := Ln( argument ) / Ln( BASE )
end; {Log}
Function Rad( degrees : Real) : Real;
const DEGCONVERT = 180.0;
begin
Rad := Degrees * Pi / DEGCONVERT
end; {Rad}
Function Deg( Radians : Real) : Real;
const RADCONVERT = 180.0;
begin
Deg := Radians * RADCONVERT / Pi
end; {Deg}
Function Fact( x : Integer ) : Double;
var loop : Integer; mult : Double;
begin
mult := 1;
For loop :=1 To x Do
mult := mult * loop;
Fact := mult
end; {Fact}
Function Perm( n, r : Integer ) : Double;
begin
Perm := Fact( n ) / Fact( n – r )
end; {Perm}
Function Comb( n, r : Integer ) : Double;
begin
Comb := Perm( n, r ) / Fact( r )
end; {Comb}
end. {Math unit}
————————————————————————————————————-
Kedua:
————————————————————————————————————-
Program MetodeNumerik1;
Uses Crt,Math;
var a,b,c:real;
Function Fungsi(X:Real):real;
begin
Fungsi:=EXP(X)-(4*POWER(X,8)+11);
end;
Procedure BagiDua(a,b:real);
Const
Epsilon2=0.001;
Epsilon1=0.001;
Begin
Repeat
c:=(a+b)/2;
If Fungsi(a) * Fungsi(c) < 0 then
b:=c
else
a:=c;
Writeln(‘Akar :=’,c:10:10,’ ‘,Fungsi(c):10:10);
until (ABS(Fungsi(c))<epsilon1) or (ABS(a-b) < epsilon2);
end;
Begin
Clrscr;
a:=0;
b:=1;
BagiDua(a,b);
readln;
end.
————————————————————————————————————-
Catatan, untuk mencari selang akar menggunakan excel.
Ini Hasil Gambarnya;
Gambar Codingnya dalam Pascal :
Bagi kawan thegaptek Cuma ini yang bisa saya posting mohon kritiknya apabila ada kesalahan dalam codingnya 🙂
https://www.thegaptek.com/2015/07/cara-cepat-tuntaskan-soal-persamaan-non-linier-metode-numerik-menggunkan-pascal.htmlKomputerWindows Dan AplikasiPengerjaan soal Persamaan Non Linier Metode Numerik Menggunkan PascalSelamat pagi kawan thegaptek, kali ini saya akan menposting bagaimana menyelesaikan soal Mata Kuliah Metode Numerik Persamaan Non Linier Bagi 2 sebagai berikut. f(x)= ex -4x7+ 11 Nilai epsilonnya = 0.001 Ini dia codingnya: Pertama: Buat Coding ini dulu dengan nama file: Math.PAS ------------------------------------------------------------------------------------------------------------- (* Turbo Pascal 5.0 Math Functions *) unit MATH; {$IFDEF VER40} {$N+} {$ELSE} {$N+,E+} {$ENDIF} interface Function Power( base,...Roshan F.ARoshan F.A[email protected]EditorThe Gaptek