Пользовательского поиска

-

b

I = ò f(x)dx -

n a

I = (1/n)* å (f(xi))/(g(xi)) , n ;g(x)

i=1 b

X, ò g(x)dx = 1 ,

a

g(x) = 1/(b-a) .

TURBO PASCAL 7.0

 

Program pmk;

Uses crt;

Var k,p,s,g,x,Integral : real;

n,i,a,b : integer;

BEGIN

randomize;

writeln( (a;b):);

readln(a);

readln(b);

writeln( ( ):);

readln(n);

k:=b-a;{k }

writeln(k=,k);

for i:= 1 to n do begin { n }

g:=random; {g ,

[0;1]}

x:= a + g*(b-a);{ [a;b] }

s:=s + (1+x); {s:=s +(x*x)}{ }

delay(10000); {, }

end;{ }

writeln(s=,s);{ n }

Integral:=(1/n)*k*s ;

writeln(=,Integral);

readln;

END.

, ( ).

3 3

ò(x+1)dx = 6 ; ò (x*x)dx = 9; ( -).

1

 

 

 

k

 

 

N= 10

 

N= 100

 

N= 500

 

N= 1000

 

 

f(x)=1 + x

 

 

2

 

 

 

 

 

5.737

 

 

5.9702

 

 

6.02

 

 

5.99

 

 

f(x)=x * x

 

 

3

 

 

9.6775

 

 

8.528

 

 

8.7463

 

 

8.937

 

 

 Rambler's Top100