Trapetsiya usuli
program trapesiya;
var n,i,k:integer; a,b,h,s:real;
function f(x:real):real; begin f:=x*x end; procedure trap(a,b:real;n:integer; var s:real); var i:integer; h:real;
begin h:=(b-a)/n; s:=(f(a)+f(b))/2;
for i:=1 to n-1 do s:=s+f(a+i*h); s:=s*h; end; begin
write('a,b,n=');readln(a,b,n); trap(a,b,n,s);
writeln('S=',s); end.
Programma asosida eksperimentlar o’tkazamiz. a,b,n=0 1 10 S=0.335
a,b,n=0 1 20 S=0.33375
a,b,n=0 1 100 S=0.33335
a,b,n=0 1 1000 S=0.3333335
Natija to’g’riligi ko’rinib turibdi.
program Simpson_simpl;
var n,i,k,m:integer; a,b,h,s,s1,s2:real; //n=2m
function f(x:real):real;
begin f:=x*x end;
procedure Simp(a,b:real;n:integer; var s:real); var i:integer; h:real;
begin s:=f(a)+f(b); s1:=0;s2:=0; h:=(b-a)/n; m:=n div 2;
for i:=1 to m-1 do
begin s1:=s1+f(a+(2*i-1)*h); s2:=s2+f(a+(2*i)*h) end; s:=s+4*s1+2*s2;s:=s*h/3; end;
begin
write('a,b,n=?'); readln(a,b,n); h:=(b-a)/n; Simp(a,b,n,s); writeln('S=',s);
end.
Programma asosida eksperimentlar o’tkazamiz.
a,b,n=?0
|
1
|
10
|
S=0.225333333333333
|
a,b,n=?0
|
1
|
20
|
S=0.273166666666667
|
a,b,n=?0
|
1
|
40
|
S=0.301645833333333
|
a,b,n=?0
|
1
|
80
|
S=0.317080729166667
|
a,b,n=?0
|
1
|
100
|
S=0.320265333333333
|
a,b,n=?0
|
1
|
200
|
S=0.326733166666667
|
a,b,n=?0
|
1
|
500
|
S=0.330677322666667
|
Natija to’g’riligi ko’rinib turibdi.
Nyuton-Kotes kvadratura formulasini yozing.
Chap va ung to’g’ri to’rtburchaklar formulasini yozing.
Markaziy to’g’ri turtburchaklar formulasini yozing.
Trapetsiya formulasini yozing.
Simpson formulasini yozing.
ma’ruza. Oddiy differensial tenglamalarni taqriban yechish. Funksiya hosilasiga ko‘ra yechilgan birinchi tartibli oddiy differensial tenglamalar uchun Koshi masalasini taqriban yechish. Eyler va Runge-Kutta usullari. Ularning algoritmi va dasturlari. Taqribiy yechimning geometrik ifodasi
REJA:
Do'stlaringiz bilan baham: |