unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, math, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Image2: TImage;
Edit1: TEdit;
Edit2: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Button1: TButton;
Edit7: TEdit;
Memo1: TMemo;
Edit3: TEdit;
Label8: TLabel;
Label9: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
function Newton(a,b,c,d,e,x:real):real;
begin
result:=x-((a*(x*x*x*x)+b*(x*x*x)+c*(x*x)+d*x+e) / (4*a*(x*x*x)+3*b*(x*x)+2*c*x+d));
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,c,d,e,x,ergebnis,xalt,eps: real;
count : integer;
begin
count:= 1;
xalt:= 0;
a:=strtofloat(edit1.text);
b:=strtofloat(edit2.text);
c:=strtofloat(edit3.text);
d:=strtofloat(edit4.text);
e:=strtofloat(edit5.text);
x:=strtofloat(edit6.text);
eps:=strtofloat(edit7.text);
repeat
xalt:= x;
ergebnis:=Newton(a,b,c,d,e,x);
x:= ergebnis;
memo1.lines.add(inttostr(count) +': ' +floattostr(ergebnis));
count := count+1;
until count =101;
if xalt >= eps then
label8.Caption := floattostr(x);
end;
end.