Mavzu: Xusussiy xosilali differensial tenglamalarni sonli yechish Birinchi tartibli oddiy differentsial tenglama uchun Koshi masalasini taqribiy yechish
Birinchi tartibli differentsial tenglama
Download 127.78 Kb.
|
Mavzu8-dars
- Bu sahifa navigatsiya:
- Eylerning takomillashgan usulida
Birinchi tartibli differentsial tenglama{Y1=F(X,Y) uchun} {Koshi masalasini Eyler usulida} {taqribiy yechimini topish} #include #include float fne(float x, float y); { return x+cos(y/sqrt(5)) ; } int main() { float x,y,y1,h,b,EPS; int i,n cin>>x>>y>>h>>b; n=c((b-x)/h); for (i=1;i<=n; i++) { y=y+h*fne(x,y); x=x+h; cout< 2. Tenglama yechimini Eylerning ketma-ket yaqinlashish usulida hisoblaymiz. (6) formulada i=0 bo‘lganda y1(0)=y0+hf (x0;y0)=y0+k (x0+cos(y0/ ))= =2.6+ 0.1(8+cos(6/ ))=2.6+0.1(8+0.3968)=2.81968 bo‘ladi. Bu Eyler usulidagi tenglama yechimining birinchi qiymati bo‘ladi. Endi y1(0)=2.81968 dan foydalanib (7) formulaga asosan i=1 bo‘lganda y1(k)= y0+ [f (x0, y0)+ f (x1,y1(k-1))] formulani k = 1,2,3,….. lar uchun ketma-ket y1(1), y1(2), y1(3), …, y1(k) larni y1(k-1) – y1(k) < 0.001 shartni qanoatlantirguncha hisoblaymiz. Demak, k=1, y1(1)=y0+ [f (x0,y0)+f (x1,y1(0))]=2.6+0.05[2.1968+x1+cos (y1(0)/ )] = =2.6+0.05[2.1968+1.9+0.36486] =2.7102 k=2, y1(2)= 2.6+0.05[2.1968+x1+cos(y1(1)/ )] = =2.6+0.05[2.1968+1.9+ cos(7102/ )] =2.82239 k=3, y1(3)= 2.6+0.05[2.1968+1.9+cos(83339/ )] = =2.6+0.05[2.1968+1.9+ 0.303709] =2.82002 Endi xatolikni tekshiramiz. y1(2) – y1(3) =2.8223 – 2.82202=0.0002< 0.001 Bundan 0.001 aniqlikdagi tenglama yechimining birinchi qiymati y1 = 2.82000 2.82 bo‘ladi. Tenglama yechimi y2 qiymatini topish uchun yuqoridagi qoidani takrorlaymiz. i=1 uchun (6) formulaga asosan y2(0)= y1 + hf (x1, y1) = 2.82 + 0.1(x1+cos (y1/ )) = =2.82+0.1(9+cos(82/ ) = 3.04047 i=1 uchun (7) formulaga asosan k=1, y2(1)= y1+ [f (x1, y1)+ f (x2, y2(0))] = =2.82+0.05[2.20471+2+cos(3.0404/ )] =3.0407 k=2, y2(2)=y1+ [f (x1,y1)+f (x2,y2(2))]= y1+ [2.20471+2+ cos(u2(1)/ )]= =2.82+0.05[2.20471+2+cos(3.0407/ )] =3.04071 k=3, y2(3)= y1+ [f (x1, y1)+ f (x2, y2(2))] = =2.82+0.05[2.20471+2+cos (3.0407/ )] = =2.82+0.05[2.20471+2+cos (3.0407/ )] =3.0407 Endi xatolikni baholaymiz. y1(2) – y1(3) =3.04071 – 3.04070=0.0001< 0.001 Bundan tenglama yechimining ikkinchi qiymati y2 = 3.0407 bo‘ladi. Bu qoidani i=2,3,…,10 lar uchun ketma-ket davom ettirib tenglama yechimining qolgan qiymatlarini ham topamiz. y3=3.261, y4=3.483, y5=3.704, y6=3.926 y7=4.147, y8=4.370, y9=4.593, y10=4.817 Bu usul yordamida hisoblash quyidagicha dastur asosida berilgan. 3. Eylerning takomillashgan usuli. Quyidagi y´=f (x,y) birinchi tartibli differentsial tenglamani y(x0)=y0 boshlang‘ich shartni qanoatlantiruvchi yechimni quyidagi takomillashtirish usullari bilan topamiz. Birinchi takomillashtirish usuli. Yuqoridagi masalani yechishda oraliq qiymatlarini aniqlaymiz: xi+1/2=xi+h/2 , yi+1/2=yi+hf (xi,yi)/2 f i+1/2=f (x i+1/2,y i+1/2), i=0, 1, 2, …..n. (8) bu takomillashtirish bo‘yicha yechimning qiymatlarini quyidagicha topamiz. y i+1=yi+hf (x i+1/2,y i+1/2), i=0, 1, 2, …..n. (9) Ikkinchi takomillashtirish yoki Eyler – Koshi usuli. Birinchi navbatda aniqligi yaxshi bo‘lmagan yaqinlashishni =yi+hf (x i,y i), i=0, 1, 2, …..n. ko‘rinishda topamiz va = ni hisoblaymiz. Ikkinchi takomillashtirilgan yaqinlashishni quyidagicha topamiz. y i+1=yi+ [f (x i,y i)+ ] (10) Eylerning birinchi va ikkinchi takomillashgan usullarida qoldiq hadnig tartibi, har qadamda O(h3) bo‘ladi. Har bir nuqtadagi xatolikni baholash takroriy hisob yordamida bo‘ladi, yahni hisob qadam bilan takrorlanadi va ning qiymatini aniqligi ( qadamda) quyidagicha baholanadi: bu yerda u(x) – differentsial tenglamaning aniq yechimi. 2-MASALA. Birinchi va ikkinchi takomillashtirish usul bilan quyidagicha y=y- differentsial tenglamani h=0,2 qadam bilan u(0)=1 shartni qanoatlantiruvchi yechimni toping. Yechish. 1. Birinchi takomillashtirish usuli. (8) va (9) formulalar asosida: 1) i=0, xo=0, yo=1 bo‘lganda quyidagicha hisoblaymiz: f0=f (x0, y0)=y0-2x0/y0=1 x1/2=xo+h/2=0.1 y1/2=y0+hf (x0,y0)=1+0.1*1=1.1 f1/2=f (x 1/2,y1/2)= y 1/2- 2x1/2/y1/2=0.9182 = hf (x 1/2,y1/2)=0.2*0.9182=0.1836 bu holda birinchi yaqinlashishning birinchi qiymati: y1=y0+ =1+0.1836=1.1836 2) i=1, x1=0.2 y1=1.183 bo‘lganda quyidagicha hisoblaymiz: f (x 1,y1)=0.1(y1- )=0.0846 x3/2=0.3 y3/2=y1+ f (x 1,y1)=1.1836+0.0846=1.2682 f (x 3/2,y3/2)= y 3/2- 2x3/2/y3/2=0.7942 y0= h f (x 3/2,y3/2)=0.2*0.7942=0.1590 bu holda birinchi yaqinlashishning ikkinchi qiymati: u2=u’+y1=1.1836+0.1590=1,3426 shuningdek i=2, 3, 4, 5 lar uchun ham hisoblab, natijalarni quyidagi jadvalga yozamiz. 1-jadval
2. Ikkinchi takomillashtirish usuli. 1) i=0, xo=0, yo=1 bo‘lganda quyidagicha hisoblaymiz: f0=f (x0, y0)=1 =y0+hf (x0,y0)=1+0.2*1=1.2 f0=0.1 x1=0.2 =1.2 = f (x1, )=0.1(2- )=0.0867 y0= (f 0+ )=0.1(9+0.867)=0.1867 bu holda ikkinchi yaqinlashishning birinchi qiymati: y1=y0+ =1*0,1867=1,1867 2) i=1, x1=0.2 y1=1.1867 bo‘lganda quyidagicha hisoblaymiz: f1=f (x1, y1)=1.1867- =0.8497 2=1.1867+0.1619 =1.3566 f1=0.0850 x1=0.4 y2=1.3566 = f (x2, 2)=0.0767 y1= (f 1+ )=0.0850+0.0767=0.1617 bu holda ikkinchi yaqinlashishning ikkinchi qiymati: y2=y1+y1=1.1867+0.1617=1.3484 shuningdek i=3,4,5 lar uchun xam hisoblab, natijalarni quyidagi jadvalga yozamiz. 2-jadval
Ushbu misol asosida Eylerning takomillashgan usulida birinchi tartibli differentsial tenglama uchun Koshi masalasini taqribiy yechimini kompyuter yordamida hisoblash quyidagicha dasturida berilgan. Birinchi tartibli differentsial tenglamasi uchun Koshi masalasining taqribiy yechimini Eylerning takomillashgan usulidahisoblash. 1-takomillashtirish 2-takomillashtirish X(1)=0.20 Y2(1)=1.1836 Y5 (1)=1.1867 X(2)= 0.40 Y2(2)= 1.3427 Y5 (2)=1.3483 X(3)= 0.60 Y2 (3)= 1.4850 Y5 (3)=1.4937 X(4)= 0.80 Y2 (4)= 1.6152 Y5 (4)=1.6279 X(5)= 1.0 Y2 (5)= 1.7362 Y5 (5)=1.7542 Download 127.78 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling