Love What You Do, Do What You Love

Program Mencari Akar Hampiran dengan Metode Newton Raphson Menggunakan Delphi 7

Posted by : Unknown
Selasa, 26 November 2013

Pseudo Code:

var
  x0,x1,y0,y1,d,e,m:Real;
  i,n:integer;
begin
  x0:=StrToFloat(edit1.text);
  e:=0.000001 ;
  d:=0.000001 ;
  n:=strtoint(edit2.text);
  i:=0;
repeat
  i:=i+1;
  listbox1.Items.add(inttostr(i));
  listbox2.Items.add(format('%8.4f',[x0]));
  y0:=(cos(x0)-(x0*x0));
  y1:=(-(sin(x0))-2*x0);
  listbox4.Items.add(format('%8.4f',[y0]));
  listbox5.Items.add(format('%8.4f',[y1]));
  if (abs(y1))<d then showmessage('kemiringan terlalu kecil');
  x1:=(x0)-(y0/y1);
  listbox3.Items.add(format('%8.4f',[x1]));
  m:=abs((x1-x0)/x1);
  listbox6.Items.add(format('%8.4f',[m]));
  if m>e then x0:=x1;
until
  i=n;
  edit4.Text:=format('%8.4f',[x1]);
end;

end.

0 comments:

Copyright © 2012 Zuka Zuka World | Hatsune Miku Theme | Designed by Johanes DJ