1-masala: integralni (1.9) formula bilan hisoblaymiz.
Bu yerda a=2, b=3, bo‘ladi. Bundan 2x3 x=2+, y=36. Tasodifiy sonlar jadvalidan (, ) 20 tasini olamiz (N=20). Hisoblash jadvali quyidagicha bo‘ladi.
I
|
i
|
|
i
|
xi=2+ I
|
yi = 36i
|
|
|
Yi= +
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
0,857
0,499
0,431
0,038
0,651
0,609
0,974
0,098
0,316
0,149
0,070
0,696
0,350
0,451
0,798
0,933
0,183
0,338
0,190
0,449
|
|
0,457
0,762
0,608
0,558
0,573
0,179
0,011
0,805
0,296
0,815
0,692
0,203
0,900
0,318
0,111
0,199
0,421
0,104
0,150
0,320
|
2,857
2,499
2,431
2,038
2,653
2,609
2,974
2,098
2,516
2,140
2,070
2,696
2,350
0,451
2,798
2,933
2,183
2,338
2,190
2,449
|
16,452
27,432
25,128
20,088
20,628
6,444
0,396
28,980
10,656
29,340
24,912
7,308
32,400
11,448
3,906
7,164
15,155
3,744
5,400
11,520
|
8,162
6,245
5,910
4,153
7,038
6,807
8,845
4,402
6,330
4,618
4,285
7,266
5,523
6,007
7,829
8,602
4,765
5,466
4,706
5,998
|
23,319
15,606
14,367
8,464
18,672
17,759
26,305
9,235
15,926
9,924
8,870
15,595
12,979
14,723
21,906
25,230
10,402
12,780
10,503
14,689
|
31,481
21,851
20,727
12,617
25,710
24,566
35,150
13,637
22,256
14,542
13,155
26,863
18,502
20,730
20,736
33,832
15,167
18,246
15,299
20687
|
|
|
|
|
|
|
|
|
|
Jadvaldan ko‘ramizki yii shartni bajaruvchi (nuqta) qiymatlar soni n=13 ga teng. (1.9) formulaga asosan:
KARRALI INTEGRALLARNI TAQRIBIY HISOBLASHNING MONTE-KARLO USULI
1. integralni D={axb, 1(x)y2(x)} soha bo‘yicha hisoblang.
Ko‘rsatilgan D sohadagi [a, b] kesmada uzluksiz bo‘lgan 1(x), 2(x) lar 1(x)s, 2(x)d tengsizliklarni qanoatlantiradi. O‘zgaruvchilarni quyidagicha almashtiramiz:
x = a + (b - a), u = c + (d – c)
Bu almashtirish bilan D soha, 01, 01 kvadratdan iborat bo‘lgan sohaga o‘tadi (8.10, 8.11 – rasm)
Aytaylik, n - sohaga tushuvchi (i, i) (I = 1, 2, …, n) tasodifiy nuqtalar soni, N – birlik kvadratga tushuvchi tasodifiy nuqtalar soniga bo‘lsin. Ma’lumki D sohaga tushuvchi n ta (xi, yi) nuqta bo‘lsa, bunda
xi = a + (b - a)i, yi = c + (d – c)i (i = 1, 2, …, n)
Bu sohada o‘rta qiymat haqidagi teoremaga asosan:
(2.37)
bunda D, S – D soha yuzasi.
f qiymat uchun f(x, y) funktsiyaning D sohaga tushuvchi n ta tasodifiy nuqtalardagi qiymatlarning o‘rta arifmetik qiymatni olamiz:
(2.38)
(8.37) va (8.38) formulalar asosida quyidagi formulaga ega bo‘lamiz:
(2.39)
Bunda S yuza oson hisoblanadigan bo‘lishi kerak. (1.9) formulaga o‘xshash
bunda S – D soha yuzasi. Bu holda
(2.40)
(2.39) va (2.40) formulalardan ikkilangan integralni taqribiy hisoblash formulasini yozamiz:
(2.41)
Bu integralni taqribiy hisoblashda quyidagi jadvaldan foydalanish qulay bo‘ladi:
2.8-jadval
I
|
i
|
i
|
xi=a+(b-a)i
|
yi=c+(d–c)i
|
=1(xi)
|
=2(xi)
|
F(xi, yi)
|
1
2
.
.
.
N
|
1
2
.
.
.
N
|
1
2
.
.
.
N
|
x1
x2
.
.
.
xN
|
y1
y2
.
.
.
yN
|
1(x1)
1(x2)
.
.
.
1(xN)
|
2(x1)
2(x2)
.
.
.
2(xN)
|
F(x1, y1)
f(x2, y2)
.
.
.
F(xN, yN)
|
yi (i = 1, 2, …, N) lar ichidan yi shartni qanoatlantiruvchilarini to‘playmiz. Ularning soni n ga teng bo‘ladi.
2. (1.9) formulani ikkinlangan integral uchun umumlashtiramiz. integralda integrallash sohasi
D = {axb, 1(x)y2(x)}
bo‘lsin. Bu sohada quyidagi tengsizlik o‘rinli bo‘lsin:
Ikkilangan integral:
soha bilan chegaralangan tsilindrik jism hajmini ifodalaydi. Bu tsilindrik jism axb, syd, 0zM bo‘lgan parallelo‘i’ed ichiga joylashadi.
Bu sohada x = a + (b - a)
y = c + (d – c)
z = M
formulalar yordamida yangi , , o‘zgaruvchilarga o‘tamiz. Bu holda V soha sohaga almashadi, bu soha quyidagi tengsizliklar bilan aniqlanadi
Bu soha birlik kubning ichiga joylashgan. Bu kub =0, =1, =0, =1, =0, =1 tekisliklar bilan chegaralangan.
Demak ikkilangan integralni quyidagicha topamiz:
bunda
- o‘zgaruvchilar almashinishidan (D sohadan) xosil bo‘lgan soha.
Birlik kub ichiga normal taqsimlangan
(1, 1, 1), (2, 2, 2), …., (n, n, n)
tasodifiy nuqtalar to‘plamini ko‘ramiz. Bu tasodifiy nuqtalardan sohaga tushuvchilar soni n bo‘lsin. Tasodifiy nuqtalar tekis taqsimlangan bo‘lgani uchun
yoki
x va y o‘zgaruvchilarga qaytib ikkilangan integralni Monte-Karlo usulida taqribiy hisoblash formulasini topamiz:
(2.42)
(2.42) formuladan foydalanish uchun jadval:
2.9-jadval
i
|
i
|
i
|
I
|
xi=a+(b-a)I
|
yi=c+(d–c)i
|
= 1(xi)
|
zi=Mi
|
=2(xi)
|
zi=f(xi, yi)
|
1
2
.
.
.
N
|
1
2
.
.
.
N
|
1
2
.
.
.
N
|
1
2
.
.
.
N
|
x1
x2
.
.
.
xN
|
y1
y2
.
.
.
yN
|
1(x1)
1(x2)
.
.
.
1(xN)
|
z1
z2
.
.
.
ZN
|
2(x1)
2(x2)
.
.
.
2(xN)
|
F(x1, y1)
f(x2, y2)
.
.
.
F(xN, yN)
|
N sonini quyidagicha aniqlaymiz. yi (i = 1, 2, …, N) lar orasidan quyidagi tengsizlikni qanoatlantruvchilar sonini sanaymiz.
yi (2.43)
bu ui larga mos bo‘lgan zi larni quyidagi shart asosida olamiz:
z1i (2.44)
Demak, zi= f(xi, yi) ning qiymatlarini (2.43) shartga asosan ui larga moslarini olish kifoya bo‘ladi.
1-masala. Monte-Karlo usulida ikkilangan integralni hisoblashdagi (2.41) formula asosida integrallash sohasi:
D = {0x1, x/2yx}
bo‘lgan
integralni hisoblang.
Bu misolda a=0, b=1, bo‘lib, intgerallash sohasi birlik kvadratda joylashgani uchun yangi o‘zgaruvchilarga o‘tish shart emas.
Tasodifiy sonlar jadvalidan ketma-ket N=10 ta qiymatni olamiz. Integrallash sohasiga tushuvchi sonlarning sonini aniqlash uchun xi, yi lardan xi/2 < yi xi shartni qanoatlantruvchilar sonini n ni aniqlaymiz. Ular
<yi<
0,428 < 0,457 < 0,857
0,325 < 0,573 < 0,653
0,258 < 0,296 < 0,516
Demak, N=10, n=3. (1.9) formulaga asosan
Endi aniq yechimni topamiz:
bunda xatolik bahosida ko‘ramizki integrallash sohasiga tushuvchi tasodifiy nuqtalar statistik taqsimot uchun yetarli emas ekan.
1-masalaning yechimini Basic dasturlash tilida topish:
(2.42) formula asosida
‘Monte-Karlo usulida ikkilangan integralni hisoblash
DEF FNF (x, y) = x + 2 * y #2 o`zgaruvchili funksiya ko`rinishi
DEF FNF1 (x) = x / 2 #integral quyi chegarasi
DEF FNF2 (x) = x #integral yuqori chegarasi
DIM x(100), xt(100), y(100), y1(100), y2(100), yt(100)
n1 = 0: INPUT "N="; N: INPUT "AC = FNF1(a): D = FNF2(b): PRINT "c="; C, " b="; b
'INPUT "CFOR i = 1 TO N
X(I) = A + (B - A) * RND(1): y(i) = C + (D - C) * RND(1)
y1(i) = FNF1(x(i)): y2(i) = FNF2(x(i)): NEXT i
PRINT " xi yi y1(i) y2(i) FNF(xi, yi)"
FOR i = 1 TO N
PRINT USING "###.#####"; x(i); y(i); y1(i); y2(i); FNF(x(i), y(i)): NEXT i
FOR i = 1 TO N
IF y1(i) < y(i) AND y(i) < y2(i) THEN n1 = n1 + 1: xt(n1) = x(i): yt(n1) = y(i)
NEXT i: PRINT "N1="; n1
PRINT " xt(i) yt(i) FNF(xt, yt)"
FOR i = 1 TO n1
PRINT USING "###.#####"; xt(i); yt(i); FNF(xt(i), yt(i))
S = S + FNF(xt(i), yt(i))
NEXT i
S1 = (B - A) * (D - C) * S / N: PRINT " S1="; s1
END
N=? 10
Ac= 0 d= 1
xi yi y1(i) y2(i) FNF(xi, yi)
0.70555 0.53342 0.35277 0.70555 1.77240
0.57952 0.28956 0.28976 0.57952 1.15864
0.30195 0.77474 0.15097 0.30195 1.85143
0.01402 0.76072 0.00701 0.01402 1.53546
0.81449 0.70904 0.40725 0.81449 2.23257
0.04535 0.41403 0.02268 0.04535 0.87342
0.86262 0.79048 0.43131 0.86262 2.44358
0.37354 0.96195 0.18677 0.37354 2.29744
0.87145 0.05624 0.43572 0.87145 0.98392
0.52487 0.76711 0.26243 0.52487 2.05909
0.05350 0.59246 0.02675 0.05350 1.23842
0.46870 0.29817 0.23435 0.46870 1.06503
0.62270 0.64782 0.31135 0.62270 1.91834
0.26379 0.27934 0.13190 0.26379 0.82248
0.82980 0.82460 0.41490 0.82980 2.47901
0.58916 0.98609 0.29458 0.58916 2.56135
0.91096 0.22687 0.45548 0.91096 1.36470
0.69512 0.98000 0.34756 0.69512 2.65512
0.24393 0.53387 0.12197 0.24393 1.31168
N1= 5
xt(i) yt(i) FNF(xt, yt)
0.70555 0.53342 1.77240
0.81449 0.70904 2.23257
0.86262 0.79048 2.44358
0.46870 0.29817 1.06503
0.82980 0.82460 2.47901
S1= 0.4941289
Yuqoridan ko`rinib turibdiki aniq yechim y=0.417 va biz Basic tilida hisoblab topgan yechimimiz s1=0.494. endi xatolikni baholab olamiz:
=(s1-y)/y=(0.494-0.417)/0.417=0.18=18% Demak, xatolik 18% , bundan ko`rinib turibdiki biz random orqali tanlab olgan ixtiyoriy 5ta x, y o`zgaruvchilarimiz hisoblashda katta xatolikni keltirib chiqarar ekan.
Do'stlaringiz bilan baham: |