Love What You Do, Do What You Love

Program Mencari Akar Hampiran dengan Metode Secant Menggunakan Delphi 7

Posted by : Unknown
Selasa, 26 November 2013

Pseudo Code:

var
  x0,x1,x2,y0,y1,y2,e,d,m,j:real;
  i,n:integer;
begin
  x0:=strtofloat(edit1.text);
  x1:=strtofloat(edit2.Text);
  e:=0.000001;
  d:=0.000001;
  i:=0;
  n:=strtoint(edit3.Text);
repeat
  i:=i+1;
  listbox1.Items.Add(inttostr(i));
  listbox2.Items.add(format('%8.4f',[x0]));
  listbox3.items.Add(format('%8.4f',[x1]));
  y0:=(cos(x0)-(x0*x0));
  y1:=(cos(x1)-(x1*x1));
  listbox5.Items.add(format('%8.4f',[y0]));
  listbox6.Items.add(format('%8.4f',[y1]));
  j:=abs(y1-y0);
  if j<d then showmessage ('terlalukecil');
  x2:=((x0*y1)-(x1*y0))/(y1-y0);
  listbox4.Items.add(format('%8.4f',[x2]));
  y2:=(cos(x2)-(x2*x2));
  m:=abs(y2);
  listbox7.Items.add(format('%8.6f',[y2]));
  x0:=x1;
  x1:=x2;
  if i=n then m:=e;
until
  m<e;
  edit4.Text:=format('%8.4f',[x2]);
end;
end.

0 comments:

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