Еще надо поставить ограничения для коэффициентов а2-а6. И с графиком разобраться.
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart;
type
TForm11 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Button1: TButton;
Chart1: TChart;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form11: TForm11;
implementation
{$R *.dfm}
procedure TForm11.Button1Click(Sender: TObject);
Var a0,a1,a2,a3,a4,a5,a6,x0,x,epsilon:real;
begin
x:=strtofloat(edit1.Text);
epsilon:=strtofloat(edit2.Text);
a0:=strtofloat(edit3.Text);
a1:=strtofloat(edit4.Text);
if a1=0 then
Showmessage('Ошибка')
else
Showmessage('Ошибки нет');
a2:=strtofloat(edit5.Text);
a3:=strtofloat(edit6.Text);
a4:=strtofloat(edit7.Text);
a5:=strtofloat(edit8.Text);
a6:=strtofloat(edit9.Text);
repeat
x0:=x;
x:=-(a0+a2*x*x+a3*ln(a4*x)+a5*ln(a6*x*x))/a1;
until
abs(x0-x)<=epsilon;
Edit10.text:=floattostr(x);
end;
procedure TForm11.Button2Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit7.Clear;
Edit8.Clear;
Edit9.Clear;
Edit10.Clear;
end;
end.