Программа для вычисления интегралов

Курсовой проект - Компьютеры, программирование

Другие курсовые по предмету Компьютеры, программирование

rToCountType(param: integer): CountType;

GetResult(x: real):real;:= cos(Pi/6)*x/sqrt(x);;

CountIntegral( Low, High, Step: Real;: TChart; Func: MyFunc;: CountType): real;x, buf: real;:= 0;

:= Low - 0.2;x <= High + 0.2 do.Series[1].AddXY(x, Func(x));:= x + 0.001;;

:= Low;CountIntegralType of: begin:= x;.Series[0].AddXY(buf, Func(buf));:= x + Step;

x <= High do.Series[0].AddXY(x, Func(x));:= result + Step*(Func(buf)+Func(x))/2;:= x;:= x + Step;;

(x - Step) < High then:= High;.Series[0].AddXY(x, Func(x));:= result + (x - buf)*(Func(buf)+Func(x))/2;;;: begin:= x;:= x + Step;x <= High do.Series[0].AddXY(buf, Func(x));.Series[0].AddXY(x, Func(x));:= result + Step*Func(x);:= x + Step;:= buf + Step;;

(x - Step) < High then:= High;.Series[0].AddXY(buf, Func(x));.Series[0].AddXY(x, Func(x));:= result + (x - buf)*Func(x);;;

: begin:= x;:= x + Step;

x <= High do.Series[0].AddXY(buf, Func(Buf + Step/2));.Series[0].AddXY(x, Func(Buf + Step/2));:= result + Step*Func(buf + Step/2);:= x + Step;:= buf + Step;;

(x - Step) < High then:= High;.Series[0].AddXY(buf, Func(buf+(x - buf)/2));.Series[0].AddXY(x, Func(buf+(x - buf)/2));:= result + (x - buf)*Func(buf + (x - buf)/2);;;: begin:= x;:= x + Step;x <= High do.Series[0].AddXY(buf, Func(buf));.Series[0].AddXY(x, Func(buf));:= result + Step*Func(buf);:= x;:= x + Step;;

(x - Step) < High then:= High;.Series[0].AddXY(buf, Func(buf));.Series[0].AddXY(x, Func(buf));:= result + (x - buf)*Func(x);;;

:begin:= x;.Series[0].AddXY(buf, Func(buf));:= x + Step;

x <= High do.Series[0].AddXY(x, Func(x));:= result + (Step/6)*(Func(buf)+4*Func(buf + Step/2)+Func(x));:= x;:= x + Step;;

(x - Step) < High then:= High;:= x - buf;.Series[0].AddXY(x, Func(x));:= result + (Step/6)*(Func(buf)+4*Func(buf + Step/2)+Func(x));;;;

;

IntegerToCountType(param: integer): CountType;param of

: result := Trap;

: result := LeftRect;

: result := MiddleRect;

: result := RightRect;

: result := Simpson;;;