Escolar Documentos
Profissional Documentos
Cultura Documentos
unit Programa;
interface
uses
type
TForm1 = class(TForm)
label1: TLabel;
Label2: TLabel;
Label3: TLabel;
cajaH: TEdit;
Button1: TButton;
cajaIteraciones: TEdit;
areaTexto: TMemo;
tablaResultado: TStringGrid;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
begin
TablaResultado.Cells[0,0] := 'Item';
TablaResultado.Cells[1,0] := 'Descripcion';
TablaResultado.Cells[2,0] := 'h = 0.0';
TablaResultado.Cells[0,1] := '1';
TablaResultado.Cells[0,2] := '2';
TablaResultado.Cells[0,3] := '3';
TablaResultado.Cells[0,4] := '4';
TablaResultado.Cells[0,5] := '5';
areaTexto.Text := '';
end;
VAR
i, iter: Integer;
begin
y0 := 1;
yi := y0;
h := StrToFloat(cajaH.Text);
areaTexto.Text := '';
iter := StrToInt(cajaIteraciones.Text);
FOR i := 1 TO iter DO
begin
funcion := -1*i*i;
IF i = 1 THEN
yi := yi + h*funcion
ELSE yi := yi - h*yi;
IF i = 1 THEN
areaTexto.Lines.Add('['+IntToStr(i)+'] '+FloatToStr(yi));
areaTexto.Lines.Add('['+IntToStr(i)+'] '+FloatToStr(yi));
end;
TablaResultado.Cells[1,1] := 'e^-1';//FloatToStr(valorE);
TablaResultado.Cells[2,1] := FloatToStr(valorE);
TablaResultado.Cells[2,2] := FloatToStr(yi);
TablaResultado.Cells[2,3] := FloatToStr(errorActual);
TablaResultado.Cells[2,4] := FloatToStr(deltaY);
TablaResultado.Cells[2,5] := FloatToStr(errorAbs);
end;
end.