.


:




:

































 

 

 

 


3.




(0,1) ξ=10-5
x2-0,5=0 .

f()=0. x0=(a+b)/2. f(x0)=0, x0 . f(x0)≠0, f(x0)×f(b)<0 f(x0)×f(a)<0 [ a, 0 ],[ 0, b ], (.. f() ).

x1.

1 f(1)=0 , , f(1)≠0 . . , , , e. f(xk) |ak-bk|.

 

 

-

 

Visual Basic

,

 

Caption Label1 a=.

Caption Label2 b=.

Caption Label3 eps=.

Caption Label4 =.

Caption Label5 .

Caption Label6 .

Caption Label7 .

Caption CommandButton1 .

:

CommandButton1 :

Private Sub CommandButton1_Click()

a = Val(TextBox1.Text)

b = Val(TextBox2.Text)

eps = Val(TextBox3.Text)

Do

c = (a + b) / 2

If (a ^ 2 - 0.5) * (c ^ 2 - 0.5) > 0 Then

a = c

Else

b = c

End If

Label6.Caption = Label6.Caption & c & Chr(13)

Label7.Caption = Label7.Caption & (a - b) & Chr(13)

Loop While Abs(a - b) > eps

Label5.Caption = c

End Sub

: Run Run

Borland C++

#include <iostream.h>

#include <math.h>

int main() {

float a, b, c;

float eps;

cout << " a, b eps: ";

cin >>a>>b>>eps;

do {

c=(a+b)/2;

if ((a*a-0.5)*(c*c-0.5)>0)

a=c;

else

b=c;

cout << (a+b)/2;

cout << endl;

} while (fabs(a-b) < eps);

cout << c;

cout << endl;

return 0;

}

: Run Run

Borland Delphi ( )

Program z3;

Var a,b,eps,x,f:real;

Begin

Write( a, b eps: );

Readln(a,b,eps);

repeat

c=(a+b)/2;

if (a*a-0.5)*(c*c-0.5)>0 then

a = c

else

b = c;

writeln( c = ,c, (a-b)= ,(a-b));

until abs(a-b)<=eps

writeln( = ,c);

End.

: Run Run

 

 

1.

x= φ(x). , x0 , , x0=m. : x1= φ(x0), x2= φ(x1), x3= φ(x2)
..

2. ( )

f()=0. x0 x, : f(x)×f(x)>0. :

xk= xk-1 - f(xk-1) / f(xk-1).

3.

f()=0. x0 x, : f(x)×f(x)>0. : xk= xk-1 - f(xk-1) / f(x0). f(x0) . .

4.

f()=0. :

5.

f()=0. x0=m, .

:

.

:

(k+1) - :

.

:

.

.

 





:


: 2016-11-18; !; : 828 |


:

:

, , .
==> ...

1743 - | 1440 -


© 2015-2024 lektsii.org - -

: 0.013 .