Mécanique
Fiche de lecture : Mécanique. Recherche parmi 299 000+ dissertationsPar edemos • 4 Mars 2015 • Fiche de lecture • 209 Mots (1 Pages) • 415 Vues
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var n,i:integer;
begin
n:=strtoint(edit1.Text);
StringGrid1.ColCount:=n;
Label17.Caption:=edit4.Text;
for i:=0 to n-1 do
begin
StringGrid1.Cells[i,0]:='A'+inttostr(i);
end;
StringGrid1.Visible:=true;
Button2.Visible:=true;
Button3.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var n,i,a,a1:integer;
s,s1:string;
x,x1,x0:real;
begin
n:=strtoint(edit1.Text);
x0:=strtofloat(edit4.Text);
s:=StringGrid1.Cells[0,1]+' + '+StringGrid1.Cells[1,1]+'x';
s1:=StringGrid1.Cells[1,1]+' + '+inttostr(2*strtoint(StringGrid1.Cells[2,1]))+'x';
x:=strtofloat(StringGrid1.Cells[0,1])+(strtofloat(StringGrid1.Cells[1,1])*x0);
x1:=strtofloat(StringGrid1.Cells[1,1])+(2*strtofloat(StringGrid1.Cells[2,1])*x0);
for i:=2 to n-1 do
begin
a:=strtoint(StringGrid1.Cells[i,1]);
s:=s+' + '+inttostr(a)+'x^'+inttostr(i);
x:=x+(a*(power(x0,i)));
end;
for i:=3 to n-1 do
begin
a1:=strtoint(StringGrid1.Cells[i,1]);
s1:=s1+' + '+inttostr(i*a1)+'x^'+inttostr(i-1);
x1:=x1+(i*a1*(power(x0,i-1)));
end;
Label10.Caption:=floattostr(x);
Label12.Caption:=floattostr(x1);
Label7.Caption:=s;
label8.Caption:=s1;
label8.Visible:=true;
label7.Visible:=true;
label5.Visible:=true;
Label6.Visible:=true;
label9.Visible:=true;
label10.Visible:=true;
label11.Visible:=true;
Label12.Visible:=true;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
button2.Visible:=false;
Button3.Visible:=false;
StringGrid1.Visible:=false;
label5.Visible:=false;
Label6.Visible:=false;
label7.Visible:=false;
label8.Visible:=false;
label9.Visible:=false;
label10.Visible:=false;
label11.Visible:=false;
Label12.Visible:=false;
end;
procedure TForm1.Button4Click(Sender: TObject);
var n,i,a,a1,j,i1:integer;
x,x1,xi,xi1,r,e,ri,k,ri1:real;
begin
j:=0;
k:=strtofloat(edit2.Text);
n:=strtoint(edit1.Text);
e:=strtofloat(edit3.Text);
repeat
j:=j+1;
xi:=strtofloat(label17.Caption);
x:=strtofloat(StringGrid1.Cells[0,1])+(strtofloat(StringGrid1.Cells[1,1])*xi);
x1:=strtofloat(StringGrid1.Cells[1,1])+(2*strtofloat(StringGrid1.Cells[2,1])*xi);
for i:=2 to n-1 do
begin
a:=strtoint(StringGrid1.Cells[i,1]);
...