ALGORITMLARNI LOYIHALASH Oraliqni teng 2 ga bo’lish usuliga oid masalalar. 1-savol. ๐ฅ 3 + ๐ฅ − 1 = 0 tenglamaning (0;1) oraliqdagi ildizini oraliqni teng ikkiga bo’lish usuli bo’yicha izlanayotgan bo’lsa 2 qadamdan keyin qanday qoladi? A. (0;0.25) B. (0.25;0.5) C. (0.5;0.75) D. (0.75;1) Oraliqni teng 2 ga bo’lish usuli xatolikka qarab berilgan oraliqni teng 2 ga bo’lib taqribiy yechimga yaqinlashtirilib boriladi. f(x) = ๐ฅ 3 + ๐ฅ − 1 funksiyani tekshirib boramiz. 1-qadam: Umumiy oraliq (0; 1) -> teng ikkitaga ajratsak (0; 0.5) va (0.5; 1) Left = 0; right = 1; middle = (left+right)/2 = 0.5 Left: f(0) = 03 + 0 – 1 = -1 (manfiy) Right: f(1) = 13 + 1 – 1 = 1 (musbat) Middle: f(0.5) = 0.53 + 0.5 – 1 = -0.375 (manfiy) 0 0.5 1 manfiy manfiy musbat Ishorasi almashadigan oraliqni tanlaymiz keyingi oraliq uchun. (0; 0.5) -> (manfiy; manfiy) => xato (0.5; 1) -> (manfiy; musbat) => to’g’ri (yechim shu oraliqda) Demak ikkinchi qadamda (0.5; 1) oraliqdan izlaymiz. 2-qadam: Umumiy oraliq (0.5; 1) -> teng ikkitaga ajratsak (0.5; 0.75) va (0.75; 1) Left = 0.5; right = 1; middle = (left+right)/2 = 0.75 Left: f(0.5) = 0.53 + 0.5 – 1 = -0.375 (manfiy) Right: f(1) = 13 + 1 – 1 = 1 (musbat) Middle: f(0.75) = 0.753 + 0.75 – 1 = 0.171875 (musbat) 0.5 0.75 1 manfiy musbat musbat Ishorasi almashadigan oraliqni tanlaymiz keyingi oraliq uchun. (0.5; 0.75) -> (manfiy; musbat) => to’g’ri (yechim bor) (0.75; 1) -> (musbat; musbat) => xato (yechim mavjud emas bu oraliqda) Demak ikkinchi qadamda (0.5; 0.75) oraliqda yechim mavjudligini bildik. 2-qadam oxirida shu (0.5; 0.75) oraliq qolyapti. To’g’ri javob (0.5; 0.75) Xuddi shu usul bo’yicha 2-savol ๐ฅ 4 − ๐ฅ − 1 = 0 tenglamaning (-1;0) oraliqdagi ildizini oraliqni teng ikkiga bo’lish usuli bo’yicha izlanayotgan bo’lsa 2 qadamdan keyin qanday qoladi? A. (-0.75;-0.5) B. (-0.5;-0.25) C. (-1;-0.75) D. (-0.25;0) f(x) = x4 – x – 1 uchun (-1; 0) oraliqda 2 ta qadamdan keyin … 1-qadam: Umumiy oraliq (-1; 0). 2 ga ajratsak (-1; -0.5) va (-0.5; 0) f(-1) -> musbat f(-0.5) -> manfiy f(0) -> manfiy (-1; -0.5) => (musbat; manfiy) yechim mavjud. (-0.5; 0) => (manfiy; manfiy) yechim mavjud emas Demak (-1; -0.5) oraliqni olamiz. 2-qadam: Umumiy oraliq (-1; -0.5). 2 ga ajratsak (-1; -0.75) va (-0.75; -0.5) f(-1) -> musbat f(-0.75) -> musbat f(-0.5) -> manfiy Demak: (-1; -0.75) => (musbat; musbat) bu oraliqda yechim mavjud emas. (-0.75; -0.5) => (musbat; manfiy) Yechim mavjud. Javob: 2-qadamdan keyin (-0.75; -0.5) oraliq qolyapti. Nyuton usuliga oid savollar Nazariyacha. Nyuton usulida: a) Agar ๐(๐)๐ ′′ (๐) > 0 bo’lsa ๐ฅ0 = ๐ b) Agar ๐(๐)๐ ′′ (๐) < 0 bo’lsa ๐ฅ0 = ๐ deb olinadi ๐(๐๐ ) ๐′ (๐๐ ) formula bilan hisoblanadi. Bunda ham yaqinlashtirish jarayoni |๐ฅ๐+1 − ๐ฅ๐ | ≤ ๐ shart bajarilmaguncha davom etadi. ๐๐+๐ = ๐๐ − 3-savol ๐ฅ 4 − ๐ฅ − 1 = 0 tenglamaning (-1;0) oraliqdagi ildizini Nyuton usuli bo’yicha izlaganda hisoblash formulasi qanday bo’ladi? A. ๐ฅ๐+1 = B. ๐ฅ๐+1 = C. ๐ฅ๐+1 = D. ๐ฅ๐+1 = 4 +๐ฅ +1 3๐ฅ๐ ๐ ; (shu javob sal yaqin) 3 −1 4๐ฅ๐ 4 3๐ฅ๐ +2๐ฅ๐ +1 3 −1 4๐ฅ๐ 4 3๐ฅ๐ +3๐ฅ๐ +1 3 −1 4๐ฅ๐ 4 2๐ฅ๐ +๐ฅ๐ +1 3 −1 4๐ฅ๐ ; ; ; Bu savolda xatolik bor. Bu yilgi savollarda xatolar to’g’rilangan. Umumiy formulasi: ๐๐+๐ = ๐๐ − ๐(๐๐ ) ๐′ (๐) ๐(๐ฅ) = ๐ฅ 4 − ๐ฅ − 1 , bundan hosila olsak ๐′ (๐) = ๐๐๐ − ๐ ๐(๐ฅ๐ ) ๐ฅ๐4 − ๐ฅ๐ − 1 ๐ฅ๐ (4๐ฅ๐3 − 1) − (๐ฅ๐4 − ๐ฅ๐ − 1) 3๐ฅ๐4 + 1 ๐ฅ๐+1 = ๐ฅ๐ − ′ = ๐ฅ๐ − = = ๐ (๐ฅ) 4๐ฅ๐3 − 1 4๐ฅ๐3 − 1 4๐ฅ๐3 − 1 4-savol ๐ฅ 3 + ๐ฅ − 1 = 0 tenglamaning (0;1) oraliqdagi ildizini Nyuton usuli bo’yicha izlaganda hisoblash formulasi qanday bo’ladi? A. ๐ฅ๐+1 = B. ๐ฅ๐+1 = C. ๐ฅ๐+1 = D. ๐ฅ๐+1 = 3 −๐ฅ +1 2๐ฅ๐ ๐ ; (sal xatosi bor yaqin javob) 2 +1 3๐ฅ๐ 3 −2๐ฅ +1 2๐ฅ๐ ๐ 3 +1 3๐ฅ๐ 3 3๐ฅ๐ −2๐ฅ๐ +1 2 +1 3๐ฅ๐ 3 ๐ฅ๐ +๐ฅ๐ −2 2 +1 3๐ฅ๐ ; ; ; Xuddi shu usulda ishlasak: ๐(๐ฅ) = ๐ฅ 3 + ๐ฅ − 1 bundan hosila olsak ๐′ (๐) = ๐๐๐ + ๐ ๐(๐ฅ๐ ) ๐ฅ๐ 3 + ๐ฅ๐ − 1 ๐ฅ๐ (3๐ฅ๐ 2 + 1) − (๐ฅ๐ 3 + ๐ฅ๐ − 1) 2๐ฅ๐3 + 1 ๐ฅ๐+1 = ๐ฅ๐ − ′ = ๐ฅ๐ − = = ๐ (๐ฅ) 3๐ฅn 2 + 1 3๐ฅ๐ 2 + 1 3๐ฅ๐ 2 + 1 Vatarlar usuliga oid savollar tahlili Bunga oid 4 ta nazariy (1 tasi tushishi mumkin) va kamida 1 ta masala bor. ๐(๐ฅ) = 0 tenglamaning (a; b) oraliqdagi ildizini topishning vatarlar usuli. 1) Agar ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) > 0 bo’lsa ๐ฅ0 = ๐ hamda b nuqta qo’zga’lmas bo’ladi. xn+1 esa quyidagicha: ๐ฅ๐+1 = ๐(๐ฅ )(๐−๐ฅ ) ๐ ๐ ๐ฅ๐ − ๐(๐)−๐(๐ฅ ) ๐ 2) Agar ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) < 0 bo’lsa ๐ฅ0 = b hamda a nuqta qo’zga’lmas bo’ladi. xn+1 esa quyidagicha: ๐ฅ๐+1 = ๐(๐ฅ )(a−๐ฅ ) ๐ ๐ ๐ฅ๐ − ๐(a)−๐(๐ฅ ) ๐ Eslab qoling: 0 dan katta bo’lsa x0 = a, b esa qo’zgalmas 0 dan kichik bo’lsa x0 = b, a esa qo’zg’almas 5-savol ๐(๐ฅ) = 0 tenglamaning (a; b) oraliqdagi ildizini topishda ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) > 0 shart bajarilsa vatarlar usuli formulasi qanday ko’rinishda bo’ladi? ๐(๐ฅ๐ )(๐−๐ฅ๐ ) A. ๐ฅ๐+1 = ๐ฅ๐ − ๐(๐)−๐(๐ฅ ; ๐ฅ0 = ๐ ) ๐ B. C. D. ๐(๐ฅ๐ )(๐−๐ฅ๐ ) ๐ฅ๐+1 = ๐ฅ๐ − ๐(๐)−๐(๐ฅ ; ๐ฅ0 = ๐ ๐) ๐(๐ฅ ) ๐ฅ๐+1 = ๐ฅ๐ − ๐′ (๐ฅ๐ ) ; ๐ฅ0 = ๐ ๐ ๐(๐ฅ ) ๐ฅ๐+1 = ๐ฅ๐ − ๐′ (๐ฅ๐ ) ; ๐ ๐ฅ0 = ๐ 6-savol ๐(๐ฅ) = 0 tenglamaning (a;b) oraliqdagi ildizini topishda ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) < 0 shart bajarilsa vatarlar usuli formulasi qanday ko’rinishda bo’ladi? ๐(๐ฅ๐ )(๐−๐ฅ๐ ) A. ๐ฅ๐+1 = ๐ฅ๐ − ๐(๐)−๐(๐ฅ ; ๐ฅ0 = ๐ ) ๐ B. C. D. ๐(๐ฅ๐ )(๐−๐ฅ๐ ) ๐ฅ๐+1 = ๐ฅ๐ − ๐(๐)−๐(๐ฅ ; ๐ฅ0 = ๐ ๐) ๐(๐ฅ ) ๐ฅ๐+1 = ๐ฅ๐ − ๐′ (๐ฅ๐ ) ; ๐ฅ0 = ๐ ๐ ๐(๐ฅ ) ๐ฅ๐+1 = ๐ฅ๐ + ๐′ (๐ฅ๐ ) ; ๐ ๐ฅ0 = ๐ 7-savol ๐(๐ฅ) = 0 tenglamaning (a;b) oraliqdagi ildizini vatarlar usulida izlanganda “a” nuqta qo’zg’almas bo’lishi uchun qanday shart bajarilishi kerak? A. ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) < 0 B. ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) > 0 C. ๐(๐)๐(๐) < 0 D. ๐ ′ (๐)๐ ′ (๐) < 0 8-savol ๐(๐ฅ) = 0 tenglamaning (a;b) oraliqdagi ildizini vatarlar usulida izlanganda “b” nuqta qo’zg’almas bo’lishi uchun qanday shart bajarilishi kerak? A. ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) > 0 B. ๐(๐)๐(๐) < 0 C. ๐ ′ (๐ฅ)๐ ′′ (๐ฅ) < 0 D. ๐ ′ (๐)๐ ′ (๐) < 0 9-savol ex − 10x − 2 = 0 funksiyani [-1;0] oraliqdagi ildizini topishda ๐′ (๐ฅ)๐′′ (๐ฅ) < 0 shart bajarilsa vatarlar usuli bilan i=2 qadamlar orasidagi xatoligini aniqlang. A. ๏ฝx2-x1๏ฝ=0.004 (shunga yaqinroq) B. ๏ฝx2-x1๏ฝ=0.0014 C. ๏ฝx2-x1๏ฝ=0.00244 D. ๏ฝx2-x1๏ฝ=0.003444 Berilgan: f(x) = ex − 10x − 2 ; a = -1; b=0 Yuqoridagi shartga ko’ra demak bizda x0 = b bo’lar ekan. ๐(๐ฅ )(a−๐ฅ ) ๐ ๐ ๐ฅ๐+1 = ๐ฅ๐ − ๐(a)−๐(๐ฅ shu formula bo’yicha ishlaymiz. ) ๐ 1-qadam: ๐ฅ1 = ๐ฅ0 − ๐(๐ฅ0 )(a − ๐ฅ0 ) ๐(0) ∗ (−1 − 0) ๐(0) = 0 − = = ๐(a) − ๐(๐ฅ0 ) ๐(−1) − ๐(0) ๐(−1) − ๐(0) ๐ 0 − 10 ∗ 0 − 2 1-2 -1 = -1 = = ≈ -0.10674774 (๐ − 10 ∗ (−1) − 2) − (๐ 0 − 10 ∗ 0 − 2) (e-1 + 8) - (1-2) e-1 + 9 2-qadam: ๐(๐ฅ1 ) = e-0.10674774 − 10 ∗ (−0.10674774) − 2 ≈ -0.03377 ≈ 0 ๐ฅ2 = ๐ฅ1 − ๐(๐ฅ1 ) ∗ (−1 − (−0.10674774)) ๐(๐ฅ1 )(a − ๐ฅ1 ) = −0.10674774 − ≈. . .. ๐(a) − ๐(๐ฅ1 ) ๐(−1) − ๐(๐ฅ1 ) Bunaqa savol tushmasa kerak. Keyin |๐ฅ1 − ๐ฅ2 | ni hisoblash kerak hali. Xullas ishlanishi shunaqa. Shuni osonroq kalkulyatorsiz hisoblasa bo’ladigan variantdagisi tushishi mumkin. Aniq integrallarni taqribiy hisoblashlar (To’g’ri to’rtburchaklar, Trapetsiya, Simpson usullari) Bularning xatoligi ham mos ravishda ๐(โ), ๐(โ2 ), ๐(โ4 ) bo’ladi. To’g’ri to’rtburchaklar usulida xatoligi ๐(โ), formulasida h (belgisi TT) Trapetsiya usulida xatoligi ๐ (โ2 ), formulasida Simpson usulida xatoligi ๐ (โ4 ) formulasida h 3 โ 2 (belgisi T) (belgisi ะก) 10-savol 1 2 ∫0 ๐ −๐ฅ ๐๐ฅ aniq integralni to’g’ri to’rtburchaklar formulasi bo’yicha h=0.01 qadam bilan hisoblansa xatolik tartibi qanday bo’ladi? A. O(0,01) B. O(0,0001) C. O(0,0000001) D. O(0,001) To’g’ri to’rtburchaklar usulida xatoligi ๐(โ) 11-savol ๐ ∫๐ ๐(๐ฅ)๐๐ฅ aniq integralni trapetsiyalar formulasi bo’yicha h=0.01 qadam bilan hisoblansa xatolik tartibi qanday bo’ladi? A. O(0,0001) B. O(0,000001) C. O(0,001) D. O(0,00001) Trapetsiya usulida xatoligi ๐ (โ2 ) 12-savol 1 ∫0 ๐ ๐๐๐ฅ 2 ๐๐ฅ qiymatini Simpson formulasi bo’yicha O(10-4) aniqlikda hisoblash uchun h – qadamni qanday olish kerak? A. h=0,1 B. h=0,01 C. h=0,001 D. h=0,05 Simpson usulida xatoligi ๐ (โ4 ) 13-savol 2 ∫1 ๐๐๐ ๐ฅ 2 ๐๐ฅ qiymatini Simpson formulasi ko’ra h=0,1 qadam bilan hisoblasak xatolik qanday tartibda bo’ladi? A. O(10-4) B. O(10-3) C. O(10-2) D. O(10-1) Simpson usulida xatoligi ๐ (โ4 ) 14-savol To’g’ri to’rtburchak formulasi to'g'ri keltirilgan javobni ko'rsating. A. ๐ฝโ๐๐ (๐) = โ ∑n-1 i=0 ๐๐+0.5 B. h C. ๐ฝโ๐ (๐) = 2 {๐0 + โฏ + ๐๐−1 + ๐๐ } h h D. ๐ฝโ๐ถ (๐) = 3 ∑m-1 i=0 [๐2๐ + 4๐2๐+1 + ๐2๐+2 ] = 3 [๐0 + 4(๐1 + . . . + ๐2๐−1 ) + 2(๐2 +. . . +๐2๐−2 )] To’g’ri to’rtburchaklar formulasida faqat h ishtirok etadi, belgisi TT n-1 ๐ฝโ๐๐ (๐) = โ ∑ ๐๐+0.5 i=0 15-savol Trapetsiya formulasi to'g'ri keltirilgan javobni ko'rsating. โ A. ๐ฝโ๐ (๐) = {๐0 + โฏ + ๐๐−1 + ๐๐ } 2 B. C. ๐ฝโ๐๐ (๐) = โ ∑n-1 i=0 ๐๐+0.5 h h D. ๐ฝโ๐ถ (๐) = 3 ∑m-1 i=0 [๐2๐ + 4๐2๐+1 + ๐2๐+2 ] = 3 [๐0 + 4(๐1 + . . . + ๐2๐−1 ) + 2(๐2 +. . . +๐2๐−2 )] Trapetsiya formulasida h/2 ishtirok etadi, belgisi T h ๐ฝโ๐ (๐) = {๐0 + โฏ + ๐๐−1 + ๐๐ } 2 16-savol Simpson formulasi to'g'ri keltirilgan javobni ko'rsating. A. B. h C. ๐ฝโ๐ (๐) = 2 {๐0 + โฏ + ๐๐−1 + ๐๐ } D. ๐ฝโ๐๐ (๐) = โ ∑n-1 i=0 ๐๐+0.5 Simpson formulasida h/3 ishtirok etadi, belgisi ะก m-1 ๐ฝโ๐ถ (๐) = h h ∑[๐2๐ + 4๐2๐+1 + ๐2๐+2 ] = [๐0 + 4(๐1 + . . . + ๐2๐−1 ) + 2(๐2 +. . . +๐2๐−2 )] 3 3 i=0 Eslab qoling yana bir bor!!! To’g’ri to’rtburchaklar usulida xatoligi ๐(โ), formulasida h (belgisi TT) Trapetsiya usulida xatoligi ๐ (โ2 ), formulasida Simpson usulida xatoligi ๐ (โ4 ) formulasida h 3 โ 2 (belgisi T) (belgisi ะก)