Z/W | 1,5 | 4,5 | 7,5 | 10,5 | 13,5 | ||||||
0,2 | 7.27 | 8.19 | 10.24 | 14.53 | 17.5 | 10.75 | 6.3 | 4.15 | 2.97 | 2.25 | |
0,45 | 7.17 | 7.65 | 8.36 | 8.69 | 7.78 | 4.41 | 3.29 | 2.53 | |||
0,7 | 6.93 | 6.62 | 5.95 | 4.03 | 3.2 | 2.56 | 2.07 | 1.7 |
(z) (W) (A(W)) .
3.
.
f(x) [a,b]:
,
( ):
f(x) | a | b | n1 | n2 |
i | N1 | N2 | S1 | S2 | H1 | H2 | I1 | I2 |
a | b | Sum1 | Sum2 |
1. f.
2. 2 .
3. .
Type
fact = record
a:real;
b:real;
end;// .
var i:integer;
n1,n2:integer;
s1,s2:fact;
h1,h2,i1,i2,a,b:real;
sum1,sum2:real;
function f(x:real):real;
Begin
f:=ln(x+1)/(1+sqr(x));//
end;
Begin
a:=0;
b:=1;
n1:=12;
n2:=24;
h1:=(b-a)/n1;
h2:=(b-a)/n2;//
for i:=1 to (n1 div 2) do // . .
Begin
s1.a:=a+(i-1)*2*h1+h1;//
s1.b:=a+(i-1)*2*h1; // { }
sum1:=sum1+(4*f(s1.a)+2*f(s1.b));//
end;
I1:=h1/3*(-f(a)+sum1+f(b)); //
for i:=1 to (n2 div 2) do
Begin
s2.a:=a+(i-1)*2*h2+h2;
s2.b:=a+(i-1)*2*h2;
sum2:=sum2+(4*f(s2.a)+2*f(s2.b));
end;
I2:=h2/3*(-f(a)+sum2+f(b));//
writeln(' n1 n2 ', n1,' ',n2,' ');
write('I1 = ',i1:0:6,', I2 = ',i2:0:6);//.
readln;
end.
n=10 | 0.272200 |
n=20 | 0.272198 |
(n) , .
4.
.
|
|
F(x)=0,
F(x) ,
[a, b],
E ().
.
f(x) | a | b | N | E |
10-5 |
i | x | a | b | res | n | lim |
1. , .
2. repeat :
a). ;
b). F(x).
). F(x)>0 F(a)>0 F(x)<0 F(a)<0 (.. F(x) ), a=x (.. ), , , , b=x ( ).
d). b-a<E. ,, x E . , ( ).) .
3. .
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Math, StdCtrls;
type
TForm1 = class(TForm)
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
Edit3: TEdit;
Button1: TButton;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
E:real;
implementation
{$R *.dfm}
function f(x:real):real;
begin
f:=x-2+sin(1/x);
end;
function f1(x:real):real;
begin
f1:=(f(x+e)-f(x))/e;
end;
procedure TForm1.Button1Click(Sender: TObject);
var a,b,x:real;
begin
a:=strtofloat(Edit1.text);
b:=strtofloat(Edit2.text);
E:=strtofloat(Edit3.text);
x:=a;
While (abs(x-b)>e) do
begin
x:=b;
b:=x-f(x)/f1(x);
end;
Label5.caption:= 'X= '+floattostr(x);
end;
end.