[̲] [] [] [ ]

 

7.10

 

, 6, . , , . , , , , .

:

 

 

tpf = (t1; t2; ...; tn): t;

 

 

 

 

tpf = ( t1; t2; ...; tn; s1; s2; ...; sm; r1; r2; ...; rk);

 

 

t1, t2, ..., tn , s1, s2, ..., sm , r1, r2, ..., rk , t .

:

 

P, Q: tpf;

 

tpf - Dtpf ᒺ :

 

Dtpf = Mp È Mf,

 

Mp = { t1, t2, ..., tn, s1, s2, ..., sm -> s1, s2, ..., sm, r1, r2, ..., rk} t1, t2, ..., tn, s1, s2, ..., sm s1, s2, ..., sm, r1, r2, ..., rk,

 

Mf = { t1, t2, ..., tn -> t} t1, t2, ..., tn t.

 

. , P

 

P(e1, e2, ..., en, v1, v2, ..., vm, w1, w2, ..., wk)

 

(, P tpf. = <>, .

 

7.19. f(x) [a,b] .

. [a,b] n x0 = a, x1, ..., xn = b. [xi,xi+1] ABCD, A=xi, B=f(xi), C=f(xi+1), D= xi+1. : (f(xi)+f(xi+1))*(xi+1-xi)/2 ( , f [xi,xi+1] , ). [a,b] .

S . n=1. n . j- , |Sj Sj-1| < e, Sj j- , Sj-1 (j-1)- e>0 . :

 

MathFunc = (): ;

...........................

{ f(x)}

...........................

Integral (F: MathFunc; A, B, EPS: ):

X, Y, Y1, S, S1, H: ;

N, I: ;

N <- 1; H <- B-A;

S <- (F(B)+F(A))*H/2;

N <- N*2; H:= (B-A)/N;

S1 <- S; S <- 0;

X <- A; Y1 <- F(X);

I <- 1 N

Y <- Y1;

X <- A+H*I; Y1 <- F(X);

S <- S+(Y+Y1)*H/2

;

abs(S-S1)<EPS;

Integral <- S

.

 

:

 

type tpf = function (x1: t1; x2: t2; ...; xn: tn): t;

 

 

type tpf = procedure (x1: t1; x2: t2; ...; xn: tn

var y1: s1; var y2: s2; ...; var ym: sm);

 

x1, x2, ..., xn ; t1, t2, ..., tn ; y1, y2, ..., ym -; s1, s2, ..., sm ; t .

:

 

type

Proc = procedure;

SwapProc = procedure(var X, Y: Integer);

StrProc = procedure(S: string);

MathFunc = function(X: Real): Real;

DeviceFunc = function(var F: text): Integer;

MaxFunc = function(A, B: Real; F: MathFunc): Real;

 

:

 

var P: Proc; F: MathFunc;

 

. ³ . .

: {$F+}.

 

9P. f(x) [a,b] ( 7.19). f(x)=x3-7x-1.

 

{$F+}

Program TrapecInt;

type MathFunc = function(X: real): real;

 

function Poly(X: real):real;

begin

Poly:=x*x*x-7*x-1

end;

 

function Integral (F: MathFunc; A, B, Eps: real): real;

var X, Y, Y1, S, S1, H: real;

N, I: word;

begin

N := 1; H := B-A;

S := (F(B)+F(A))*H/2;

repeat

N := N*2; H:= (B-A)/N;

S1 := S; S := 0;

X := A; Y1 := F(X);

for I := 1 to N do begin

Y := Y1;

X := A+H*I; Y1 := F(X);

S := S+(Y+Y1)*H/2

end;

until abs(S-S1)<Eps;

Integral := S

end;

 

var A, B, Eps, S: real;

begin

write( [a,b]: ); readln(A,B);

write( eps: ); readln(Eps);

S:=Integral(Poly, A, B, Eps);

writeln( , S)

end.

 

ѳ . ѳ , . , , . : == !=. :

 

t (*name)(t1, t2, ..., tn);

 

name ; t ; t1, t2, ..., tn . ѳ, , t void, - . *name , , t.

 

:

 

typedef double (*math_func)(double);

 

void (*proc)();

void (*swap_proc)(int *, int *);

void (*str_proc)(char *);

math_func f;

 

9. f(x) [a,b] ( 7.19). f(x)=x3-7x-1.

 

#include <stdio.h>

#include <math.h>

 

/* TrapecInt */

 

typedef double (*math_func)(double);

 

double polynm(double x)

{

return x*x*x-7*x-1;

}

 

double integral (math_func f, double a, double b, double eps)

{

double x, y, y1, s, s1, h;

unsigned n, i;

 

n = 1; h = b-a;

s = (f(b)+f(a))*h/2;

do

{

n *= 2; h = (b-a)/n;

s1 = s; s = 0;

x = a; y1 = f(x);

for (i=1; i<=n; i++)

{

y = y1;

x = a+h*i; y1 = f(x);

s += (y+y1)*h/2;

}

}

while (fabs(s-s1)>=eps);

return s;

}

 

main()

{

double a, b, eps, s;

 

printf( [a,b]: );

scanf(%lf %lf, &a, &b);

printf( eps: ); scanf(%lf, &eps);

s=integral(polynm, a, b, eps);

printf( %lf\n, s);

}

 

 

7.3. .

 

7.4. .

 

7.5. , .

 

7.6. .

 

7.7. . . .

 

7.8. ij

 

d() = max x-y.

, Î

 

d().

 

7.9.

a) ;

b)

.

 

7.10. Q() - . , , Q().

 

7.11. , .

 

7.12. .

 

7.13. .

 

7.14. " " 7.5 7.11 7.13.

 

7.15. .

 

7.16. .

 

7.17. .

 

7.18. . .

 

7.19. , , , . .

 

7.20.

) ;

b)

.

 

7.21.

) ;

b) .

 

7.22.

) ;

b)

7.10.

 

7.23. k- 7.10.

 

7.24. k- (1, ..., n) (k+1, ..., n, 1, ..., k). .

 

7.25. k- .

 

7.26. .

 

7.27.

) ;

b)

.

 

7.28. .

 

7.29. . ( (1, ..., n) , 1 < ... < n.

7.30. , , .

 

7.31. F t; ( (7.6)) , . .

 

7.32. , .

 

7.33. .

 

7.34. .

 

7.35. F . F G , .

 

7.36. f(x) [a,b] , , .

 

[̲] [] [] [ ]