1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107:
| uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type TForm5 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit5: TEdit; Edit6: TEdit; Label1: TLabel; Label2: TLabel; Button1: TButton; Button2: TButton; Edit7: TEdit; Edit8: TEdit; Edit9: TEdit; Edit10: TEdit; Edit11: TEdit; Edit12: TEdit; Edit13: TEdit; Edit14: TEdit; Edit15: TEdit; Edit4: TEdit; Chart1: TChart; Series1: TLineSeries; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); private public end;
var Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject); var x0,x1,x2,x3,x4,y0,y1,y2,y3,y4, x0x1,x1x2,x2x3,x3x4, x0x1x2,x1x2x3,x2x3x4, x0x1x2x3,x1x2x3x4, x0x1x2x3x4:real; c0,c1,c2,c3,c4,p,x:real; begin
x0:=StrToFloatDef(Edit1.Text,0); x1:=StrToFloatDef(Edit2.Text,0); x2:=StrToFloatDef(Edit3.Text,0); x3:=StrToFloatDef(Edit4.Text,0); x4:=StrToFloatDef(Edit5.Text,0); y0:=StrToFloatDef(Edit6.Text,0); y1:=StrToFloatDef(Edit7.Text,0); y2:=StrToFloatDef(Edit8.Text,0); y3:=StrToFloatDef(Edit9.Text,0); y4:=StrToFloatDef(Edit10.Text,0);
x0x1:=(y1-y0)/(x0-x1); x1x2:=(y2-y1)/(x2-x1); x2x3:=(y3-y2)/(x3-x2); x3x4:=(y4-y3)/(x4-x3);
x0x1x2:=(x1x2-x0x1)/(x2-x0); x1x2x3:=(x2x3-x1x2)/(x3-x1); x2x3x4:=(x3x4-x2x3)/(x4-x2);
x0x1x2x3:=(x1x2x3-x0x1x2)/(x3-x0); x1x2x3x4:=(x2x3x4-x1x2x3)/(x4-x1);
x0x1x2x3x4:=(x1x2x3x4-x0x1x2x3)/(x4-x0);
c0:=y0; c1:=x0x1; c2:=x0x1x2; c3:=x0x1x2x3; c4:=x0x1x2x3x4;
Edit11.Text := FloatToStr(c0); Edit12.Text := FloatToStr(c1); Edit13.Text := FloatToStr(c2); Edit14.Text := FloatToStr(c3); Edit15.Text := FloatToStr(c4);
p:=c0+c1*(x-x0)+c2*(x-x0)*(x-x1)+c3*(x-x0)*(x-x1)*(x-x2)+ c4*(x-x0)*(x-x1)*(x-x2)*(x-x3);
with series1 do begin series1.Clear; series1.AddXY(0,0); series1.AddXY(1,p); end;
end; |