Alisher navoiy nomidagi samarqand davlat universiteti hisoblash usullari kafedrasi
Progonka usulining Paskal dasturi
Download 5.01 Kb. Pdf ko'rish
|
- Bu sahifa navigatsiya:
- Dasturning natijalari
- Laboratoriya ishi № 8
- Mustaqil ishlash bo’yicha savollar
- 10. ANIQ INTEGRALLARNI TAQRIBIY HISOBLASh Ishdan maqsad
Progonka usulining Paskal dasturi Program P1; Uses Crt; Const n=10; Var i,j : integer; A,B,A0,B0,Al0,Al1,Bet0,Bet1,h : real; M,K,C,D,Y,P,q,f,x : array[0..100] of real; f1 : text; Procedure progonka; BEGIN for i:=0 to n-2 do Begin M[i]:=-2+h*p[i]; K[i]:=1-h*p[i]+h*h*q[i]; End; c[0]:=(al1-al0*h)/(M[0]*(al1-al0*h)+K[0]*al1); d[0]:=k[0]*A0*h/(al1-al0*h)+f[0]*h*h; for i:=1 to n-2 do Begin c[i]:=1/(m[i]-k[i]*c[i-1]); d[i]:=f[i]*h*h-k[i]*c[i-1]*d[i-1]; End; y[n]:=(B0*h-Bet1*c[n-2]*d[n-2])/(Bet0*h+Bet1*(1+c[n-2])); for j:=1 to n-1 do Begin 265 i:=n-j; y[i]:=c[i-1]*(d[i-1]-y[i+1]); End; y[0]:=(al1*y[1]-A0*h)/(al1-al0*h); END; BEGIN {Asosiy qism} ClrScr; assign(f1,'c:Progonka.otv'); rewrite(f1); a:=0; b:=1; h:=(b-a)/n; Al0:=1; Al1:=-1; Bet0:=1; Bet1:=0; A0:=0; B0:=3.718; for i:=0 to n do Begin x[i]:=a+i*h; p[i]:=-2*x[i]; q[i]:=-2; f[i]:=-4*x[i]; End; Progonka; for i:=0 to n do Begin writeln(f1,'i=',i:2,' x=',x[i]:6:4,' M=',M[i]:6:4,' K=',k[i]:6:4); End; writeln(f1); for i:=0 to n do Begin writeln(f1,'i=',i:2,' c=',c[i]:6:4,' d=',d[i]:6:4,' y=',y[i]:6:4); End; Close(f1); END. Dasturning natijalari i= 0 x=0.0000 M=-2.0000 K=0.9800 i= 1 x=0.1000 M=-2.0200 K=1.0000 i= 2 x=0.2000 M=-2.0400 K=1.0200 i= 3 x=0.3000 M=-2.0600 K=1.0400 i= 4 x=0.4000 M=-2.0800 K=1.0600 i= 5 x=0.5000 M=-2.1000 K=1.0800 i= 6 x=0.6000 M=-2.1200 K=1.1000 i= 7 x=0.7000 M=-2.1400 K=1.1200 i= 8 x=0.8000 M=-2.1600 K=1.1400 i= 9 x=0.9000 M= 0.0000 K=0.0000 i=10 x=1.0000 M=0.0000 K=0.0000 i= 0 c=-0.9016 d=0.0000 y=1.1180 i= 1 c=-0.8942 d=-0.0040 y=1.2297 i= 2 c=-0.8866 d=-0.0116 y=1.3639 i= 3 c=-0.8788 d=-0.0227 y=1.5213 i= 4 c=-0.8707 d=-0.0372 y=1.7043 i= 5 c=-0.8623 d=-0.0550 y=1.9168 i= 6 c=-0.8536 d=-0.0761 y=2.1643 i= 7 c=-0.8447 d=-0.1008 y=2.4548 i= 8 c=-0.8354 d=-0.1291 y=2.7996 i= 9 c=0.0000 d=0.0000 y=3.2137 i=10 c=0.0000 d=0.0000 y=3.7180 Laboratoriya ishi № 8 Berilgan chegaraviy masalani progonka usulida yeching. 1. 5 cos " 3 y x y 6 , 2 8 , 1 0 y 8 , 2 ; 8 , 1 x 2. 3 cos " 2 y x y 6 , 4 6 , 1 0 y 6 , 2 ; 6 , 1 x 266 3. 10 cos " y x y 8 , 0 6 , 0 0 y 6 , 1 ; 6 , 0 x 4. 2 cos " 4 y x y 4 , 1 8 , 0 0 y 8 , 1 ; 8 , 0 x 5. 11 cos " y x y 5 , 2 1 , 2 0 y 1 , 3 ; 1 , 2 x 6. 5 sin " 2 y x y 6 , 2 8 , 1 0 y 8 , 2 ; 8 , 1 x 7. 3 sin " 3 y x y 6 , 4 6 , 1 0 y 6 , 2 ; 6 , 1 x 8. 10 sin " 3 y x y 8 , 0 6 , 0 0 y 6 , 1 ; 6 , 0 x 9. 3 sin " y x y 4 , 1 8 , 0 0 y 8 , 1 ; 8 , 0 x 10. 11 sin " y x y 5 , 2 1 , 2 0 y 1 , 3 ; 1 , 2 x 11. 12 cos " 3 y x y 6 , 2 8 , 1 0 y 8 , 2 ; 8 , 1 x 12. 2 cos " 3 2 y x y 6 , 4 6 , 1 0 y 6 , 2 ; 6 , 1 x 13. 4 cos " 3 y x y 8 , 0 6 , 0 0 y 6 , 1 ; 6 , 0 x 14. 5 sin " 2 y x y 4 , 1 8 , 0 0 y 8 , 1 ; 8 , 0 x 15. 2 sin 1 " y x y 5 , 2 1 , 2 0 y 1 , 3 ; 1 , 2 x 16. 10 9 " 2 x y y x y 4 0 0 y 1 ; 0 x 17. 4 9 6 3 " 3 x x xy y 3 0 0 y 1 ; 0 x 18. 2 2 " 2 x y x y 6 1 0 y 2 ; 1 x 19. 10 3 " 2 x y y x y 7 1 0 y 2 ; 1 x 20. 2 3 " x y y x y 2 0 0 y 1 ; 0 x 21. 3 2 " 2 x x y y y 1 0 0 y 1 ; 0 x 22. 1 2 " 2 x x y y y 2 1 0 y 2 ; 1 x 23. 1 " 2 x y y x y 5 2 0 y 3 ; 2 x 24. 1 " 2 x x y y 4 1 0 y 2 ; 1 x 25. x x y y 2 2 2 " 2 1 0 0 y 1 ; 0 x 26. x y y 4 2 " 0 0 0 y 1 ; 0 x Mustaqil ishlash bo’yicha savollar 267 1. Ikkinchi tartibli differensial tenglamani taqribiy yechish masalasi qanday qo’yiladi ? 2. Birinchi va ikkinchi tartibli hosilani chekli ayirmalarda ifodalang. 3. Ikkinchi tartibli differensial tenglamalarni yechishning Progonka usulini tushintirib bering. 10. ANIQ INTEGRALLARNI TAQRIBIY HISOBLASh Ishdan maqsad: Aniq integrallarning qiymatini taqribiy hisoblashning trapesiya va Simpson formulalari hamda ularning qoldiq hadlarini baholashni o’rganish; hisoblash ishini tashkil qilish va bajarish; masalani yechish dasturini tuzish va sonli natijalar olish. Quyidagi b a dx x f f I (1) aniq integralning qiymatini taqribiy hisoblashni qaraylik. Bu yerda x f - b a, oraliqda uzluksiz bo’lgan funksiya. b a, integrallash oralig’ini n ta uzunligi n a b h ga teng bo’lgan n n x x x x x x , ,....., , , , 1 2 1 1 0 kesmalarga ajratamiz. Agar tugunlarda x f ning qiymatini n i x f y i i ,..., 2 , 1 , 0 kabi belgilasak b a n n y y y y y h dx x f f I 2 ...... 2 1 2 1 0 (2) umumiy trapesiyalar formulasi deyiladi. Bu formula geometrik nuktai-nazardan integral ostidagi x f y funksiyaning grafigini tugun nuqtalarni tutashtiruvchi siniq chiziq bilan almashtirishdan iboratdir. Faraz qilaylik m n 2 juft son bo’lsin. b a, integrallash oralig’ini n ta uzunligi m a b n a b h 2 ga teng bo’lgan n n x x x x x x , ,....., , , , 1 2 1 1 0 kesmalarga ajratamiz. 2 2 4 2 1 2 3 1 2 0 ...... 2 ...... 4 3 m b a m m y y y y y y y y h dx x f f I (3) Simpson formulasi deyiladi. (3) formula geometrik nuktai-nazardan integral ostidagi x f y funksiyaning grafigini har bir oraliqda parabolalar bilan almashtirishdan iboratdir. Misol. 1 0 1 x dx I integralning qiymatini trapesiyalar va Simpson formulalari yordamida taqribiy hisoblang. 268 Yechish. 1 , 0 kesmani 10 n ta 10 9 2 1 1 0 , ,....., , , , x x x x x x kesmalarga ajratamiz. Har bir i x nuqtada 10 ,..., 2 , 1 , 0 i x f y i i qiymatlarni hisoblaymiz va quyidagi jadvalga joylashtiramiz. i x i y i 0 0 1,000 1 0,1 0,909 2 0,2 0,833 3 0,3 0,769 4 0,4 0,715 5 0,5 0,667 6 0,6 0,625 7 0,7 0,588 8 0,8 0,556 9 0,9 0,526 10 1,0 0,500 Trapesiyalar formulasiga ko’ra 694 , 0 938 , 6 1 , 0 25 , 0 526 , 0 556 , 0 588 , 0 625 , 0 667 , 0 715 , 0 769 , 0 833 , 0 909 , 0 5 , 0 1 , 0 2 ...... 2 1 1 0 10 9 2 1 0 y y y y y h x dx I T Simpson formulasiga ko’ra 8 6 4 2 1 0 9 7 5 3 1 10 0 2 4 3 1 y y y y y y y y y y y h x dx I S 693 , 0 458 , 5 836 , 13 75 , 0 3 1 , 0 729 , 2 2 459 , 3 4 75 , 0 3 1 , 0 556 , 0 625 , 0 715 , 0 833 , 0 2 526 , 0 588 , 0 667 , 0 769 , 0 909 , 0 4 25 , 0 5 , 0 3 1 , 0 Quyida ushbu integralni trapesiya va Simpson formulalarida taqribiy hisoblashning Paskal dasturi va natijalarini keltiramiz. Program INTEG; var i,n : integer; a,b,h,s,s1,s2 : real; x,y : array [0..10] of real; txt : text; Procedure SIMP; Begin s1:=0; s2:=0; for i:=1 to n-1 do Begin if i mod 2=0 then s1:=s1+2*y[i]; if i mod 2<>0 then s2:=s2+4*y[i]; End; s:=(h/3)*(y[0]+y[n]+s1+s2); End; 269 Procedure Trap; Begin s:=0; for i:=1 to n-1 do s:=s+h*y[i]; s:=s+h*(y[0]+y[n])/2; End; Begin assign(txt,'Simp.otv'); rewrite(txt); a:=0.0; b:=1.0; n:=10; h:=(b-a)/n; for i:=0 to n do Begin x[i]:=a+i*h; y[i]:=1/(1+x[i]); End; Trap; writeln(txt,'Trapetsiyalar formulasi I=',s:12:4); Writeln(txt); SIMP; writeln(txt,'Simpson formulasi I=',s:12:4); Close(txt); END. Trapetsiyalar formulasi I= 0.6938 Simpson formulasi I= 0.6932 Laboratoriya ishi № 9 Integrallarning qiymatini 3 xona aniqlikda trapesiya va Simpson formulalari yordamida hisoblang. 1. 6 , 1 8 , 0 2 1 2x dx 2. 8 , 2 2 , 1 2 2 , 3 x dx 3. 2 1 2 3 , 1 2x dx 4. 2 , 1 2 , 0 2 1 x dx 5. 4 , 1 6 , 0 2 3 2x dx 6. 2 , 1 4 , 0 2 5 , 0 2 x dx 7. 4 , 2 4 , 1 2 1 3x dx 8. 4 , 2 2 , 1 2 5 , 0 x dx 9. 2 , 1 4 , 0 2 3 x dx 10. 6 , 1 6 , 0 2 2 1 x dx 11. 3 2 2 1 x dx 12. 5 , 1 5 , 0 2 2 x dx 13. 6 , 2 2 , 1 2 6 , 0 x dx 14. 2 , 2 4 , 1 2 1 3x dx 15. 8 , 1 8 , 0 2 4 x dx 16. 6 , 2 8 , 1 2 25 , 0 x dx 17. 6 , 1 6 , 0 2 8 , 0 x dx 18. 2 2 , 1 2 2 , 1 x dx 270 19. 2 , 2 4 , 1 2 6 , 0 2x dx 20. 2 , 4 2 , 3 2 1 5 , 0 x dx 21. 8 , 1 8 , 0 2 3 , 0 2x dx 22. 0 , 2 2 , 1 2 5 , 1 5 , 0 x dx 23. 1 , 3 1 , 2 2 3 x dx 24. 3 , 2 3 , 1 2 1 2 , 0 x dx 25. 4 , 1 4 , 0 2 5 , 0 12x dx 26. 3 , 2 3 , 1 2 4 , 0 3x dx 27. 8 , 2 4 , 1 2 7 , 0 5 , 1 x dx Download 5.01 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling