unit PROYECTO;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, math,Grids;
type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Edit1: TEdit; StringGrid1: TStringGrid; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; Label3: TLabel; Label4: TLabel; GroupBox1: TGroupBox; Label6: TLabel; Label7: TLabel; Label8: TLabel;
Label9: TLabel; Label10: TLabel; GroupBox2: TGroupBox; GroupBox3: TGroupBox; GroupBox4: TGroupBox; GroupBox5: TGroupBox; GroupBox6: TGroupBox; GroupBox7: TGroupBox; Chart1: TChart; Series1: TLineSeries; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label5: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; StringGrid2: TStringGrid; Button10: TButton; Button11: TButton; procedure Button1Click(Sender: TObject); procedure Button9Click(Sender: TObject); procedure Button8Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button10Click(Sender: TObject); procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button11Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; n:Integer; coor:Array [1..1000, 1..1000] of Integer; xinicial,xfinal:integer; sy,sx,sx2,sy2,sxy:Real; x,y,b,a,ss:Real; r:Real; i,j,t,f,w,c,k:INteger;
implementation
{$R *.dfm} procedure TForm1.Button10Click(Sender: TObject); begin n:=StrToInt(Edit1.Text); StringGrid1.RowCount:=n+1; StringGrid1.ColCount:=2; for i := 0 to StringGrid1.colCount - 1 do begin for j := 1 to StringGrid1.rowCount - 1 do
begin StringGrid1.Cells[i,j]:=IntToStr(StrToInt(InputBox('Columna: ' +IntToStr(i), 'Valor: '+IntToStr(j),''))); coor[i,j]:=StrToInt(StringGrid1.Cells[i,j]); end; end; end;
procedure TForm1.Button11Click(Sender: TObject); begin showMessage(' REALIZADO POR: Chavez Aguayo Mijail Ausbert y Sauce Canaza Jacqueline Materia mat-1104 Paralelo:I '); end;
procedure TForm1.Button1Click(Sender: TObject);
begin n:=StrToInt(Edit1.Text); StringGrid1.RowCount:=n+1; StringGrid1.ColCount:=2; for i := 0 to StringGrid1.colCount - 1 do begin for j := 1 to StringGrid1.rowCount - 1 do begin // StringGrid1.Cells[i,j]:=IntToStr(StrToInt(InputBox('Columna: ' +IntToStr(i+1), 'Valor: '+IntToStr(j+1),''))); //coor[i,j]:=StrToInt(StringGrid1.Cells[i,j]); end; sx := 0; for t := 0 to StringGrid1.RowCount do
sx := sx + StrToFloatDEf(StringGrid1.Cells[0, t],0); sy := 0; for w := 0 to StringGrid1.RowCount do sy := sy + StrToFloatDEf(StringGrid1.Cells[1, w],0); sx2 := 0; for f := 0 to StringGrid1.RowCount do sx2 := sx2 + (StrToFloatDEf(StringGrid1.Cells[0, f],0)*StrToFloatDEf(StringGrid1.Cells[0, f],0)); sy2 := 0; for c := 0 to StringGrid1.RowCount do sy2 := sy2 + (StrToFloatDEf(StringGrid1.Cells[1, c],0)*StrToFloatDEf(StringGrid1.Cells[1, c],0)); sxy := 0; for k := 0 to StringGrid1.RowCount do sxy := sxy + (StrToFloatDEf(StringGrid1.Cells[0, k],0)*StrToFloatDEf(StringGrid1.Cells[1, k],0)); b:=((n*sxy)-(sx*sy))/((n*sx2-(sx*sx))); a:=((sy-(b*sx))/n); label7.Caption:=FormatFloat('0.00',a); label9.Caption:=FormatFloat('0.00',b); end; StringGrid2.RowCount:=n+1; a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a+b*x); end; end;
procedure TForm1.Button2Click(Sender: TObject);
var r:real; begin a:=strtofloat(label7.caption); n:=strtoint(Edit1.Text); ss:=0; for j := 1 to n do begin r:=1; x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); for i := 1 to j do begin r:=r*x; end; ss:=ss+a*r; end; label11.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a*power(x,i)); end; end;
procedure TForm1.Button3Click(Sender: TObject); begin a:=strtofloat(label7.caption); n:=strtoint(Edit1.Text);
ss:=0; for j := 1 to n do begin r:=1; x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); ss:=ss+a*x; end; label5.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a*x); end; end; function Potencia(Base, Exponente: Double): Extended; begin Result:= Exp( Ln(Base) * Exponente ); end; procedure TForm1.Button4Click(Sender: TObject); var r:real; begin a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); n:=strtoint(Edit1.Text); ss:=0; for j := 1 to n do begin
x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); r:=power(x,b); ss:=ss+a*r; end; label13.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a*power(x,b)); end; end;
procedure TForm1.Button5Click(Sender: TObject); begin a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); n:=strtoint(Edit1.Text); ss:=0; for j := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); r:=exp(b*x); ss:=ss+a*r; end; label14.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption);
for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a*exp(b*x)); end; end;
procedure TForm1.Button6Click(Sender: TObject); begin a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); n:=strtoint(Edit1.Text); ss:=0; for j := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); r:=power(x,a); ss:=ss*a*r; end; label15.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr(a*power(x,a)); end; end;
procedure TForm1.Button7Click(Sender: TObject); begin a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); n:=strtoint(Edit1.Text); ss:=0; for j := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, j],0); r:=(a*x)/(b+x); ss:=ss+a*r; end; label16.Caption:=FormatFloat('0.00',ss); a:=strtofloat(label7.caption); b:=strtofloat(label9.caption); for i := 1 to n do begin x:=StrTofloatDEf(StringGrid1.Cells[0, i],0); StringGrid2.Cells[0, i]:=floattostr((a*x)/(b+x)); end; end;
procedure TForm1.Button8Click(Sender: TObject); begin n:=StrToInt(Edit1.Text); a:=Strtofloat(Label7.caption); b:=Strtofloat(Label9.caption); for i:=0 to n do begin
x:=StrTofloatDEf(StringGrid1.Cells[0, i+1],0); y:=StrTofloatDEf(StringGrid2.Cells[0, i+1],0); series1.addXY(x,y); end; end;
procedure TForm1.Button9Click(Sender: TObject); begin close; end;
end.