program gauss;
var
n,i,j,s:integer;
sum:real;
c:array[1..20,1..21] of real;
x:array[1..20] of real;
begin
writeln('Podaj n >');
read(n);
for i:=1 to n do
for j:=1 to n+1 do
read(c[i,j]);
for s:=1 to n-1 do
for i:=s+1 to n do
for j:=s+1 to n+1 do
c[i,j]:=c[i,j]-c[i,s]*c[s,j]/c[s,s];
x[n]:=c[n,n+1]/c[n,n];
for i:=n-1 downto 1 do
sum:=0;
for s:=i+1 to n do
sum:=sum+c[i,s]*x[s];
x[i]:=(c[i,n+1]-sum)/c[i,i];
end;
writeln(x[i]);
end.
program calkagaussa;
uses crt;
i:integer;
a,b,c:real;
w,z:array[1..4] of real;
function f(x:real):real;
f:=x*x+1;
function g(z:real):real;
g:=(b-a)/2*f((a+b)/2+((b-a)/2)*z);
clrscr;
write('podaj a=');
readln(a);
write('podaj b=');
readln(b);
z[1]:=-0.77459;
z[2]:=0;
z[3]:=0.77459;
w[1]:=0.555555;
w[2]:=0.888888;
w[3]:=0.555555;
c:=0;
for i:=1 to 3 do
c:=c+g(z[i])*w[i];
writeln('calka=',c:6:4);
readln;
Readln
Program calkagaussakubatury; Uses crt; Var I:integer; A,j,c:real; X,y,w,z,n:array[1..3] of real; Function f(x,y:real):real; Begin F:=x*y; End; Function g(z,n:real):real; Begin G:=j*f((x[1]+(x[2]-x[1])*z+(x[3]-x[1])*n),(y[1]+(y[2]-y[1])*z+(y[3]-y[1])*n));
End;
Begin
Clrscr;
Write('podaj x1=');
Readln(x[1]);
Write('podaj y1=');
Readln(y[1]);
Write('podaj x2=');
Readln(x[2]);
Write('podaj y2=');
Readln(y[2]);
Write('podaj x3=');
Readln(x[3]);
Write('podaj y3=');
Readln(y[3]);
J:=abs((x[2]-x[1])*(y[3]-y[1])-(x[3]-x[1])*(x[2]-x[1]));
Z[1]:=0.5;
N[1]:=0.5;
W[1]:=1/3;
Z[2]:=0;
N[2]:=0.5;
W[2]:=w[1];
Z[3]:=0.5;
N[3]:=0;
W[3]:=w[1];
C:=0;
For i:=1 to 3 do
c:=c+0.5*g(z[i],n[i])*w[i];
readln; end.
program calka; uses crt; var x,y:array[1..100] of real; a,b:real; n:integer; function f(x:real):real; begin f:=x*x+2*x+1; end; procedure dane; begin write('podaj a:'); readln(a);
write('podaj b:');
write('podaj n:');
readln(n);
procedure licz;
v,s,h:real;
h:=(b-a)/n;
s:=0;
for i:=0 to n do
x[i]:=a+i*h;
y[i]:=f(x[i]);
for i:=1 to (n-1) do
s:=s+y[i];
v:=h*((f(a)+f(b))/2+s);
writeln('calka od',a:2:0,' do',b:2:0,' z funkcji x*x+2*x+1 wynosi w przyblizeniu: ',v:5:5);
dane;
licz;
repeat until keypressed; end.
Program calkaprostokaty;
Uses crt;
Var
i,n:integer;
a,b,h,sum,c:real;
x:array[1..100] of real;
procedure dane;
write('podaj n=');
sum:=sum+f(x[i]);
c:=h*sum;
readln
Tomplus