Вы находитесь на странице: 1из 40

( )

: 1101
..
: ..

2012.

:


4

5
()
5.
6.
7
*
7. Z
8. 9
9. Z*
10
10.
WINDOWS

11

11

11
11.
WinAPI

12

15
12.

1.
2.
3.
4.

13.

14.

3
5
6
8

26

27
29

30
30


1) , ,
1 .
2) 2
MathCad.

Z,
K(z,) K()

6

10
2
F ( Z) : = K( Z , ) K3( ) d

0 106 .

Z*
K(z*,)
K() 0 106 .
:
1. .
2. .
1000 .
2 :
1. F(Z) (A,B),
Z*. (10-10 - 10-7 ) .
Z.
2. Z*
MathCad.
:
.
: .
:

, :

1.25*105

0.5

0.598

:
2.5*105 3.75*105 5.00*105 6.25*105 7.50*105 8.75*105
0.691

0.778

0.854

0.916

0.962

0.99

106
1

F(Z)
(A,B),
Z*.


( )

( )

.

R2 R2
R1 C. :

.


,
, Mathad:

, :

.

.

,


,

.. .

(A,B), .
: (10-10-10-7).
, .
F(Z) ,
:

,
[2*10-9;4*10-9].
7

Z*
.

Z* ,

.

Z* .
.

, F(Z) ,
Kz(w) K(z,w) . ,
K(z,w) Kz(w).
, K(Z1, w) Kz(w),
K(Z2, w) K(Z3, w) Z2 Z3, Z1.
Z = Z1= 0.00000000268244779425.
8

(A,B), .
: (10-10-10-7).
, .
F(Z) ,
:

,

[10-10,10-9]

Z*
.

Z* :
, Z*=10-10
K(Z,w) K3(w) [0;10-6],
Z1=Z*,Z2=2*10 - 1 0 ,Z3=5*10 - 1 0 :

, F(Z) ,
Kz(w) K(z,w) . ,
K(z,w) Kz(w).
, K(Z1, w) Kz(w),
K(Z2, w) K(Z3, w) Z2 Z3, Z1.
Z = Z1= 10-10.

10

WINDOWS.
.
x
y

y=x2:
0
1
2
3
0
1
4
9
:

4
16

.
y=x2
0 1.

a=0; b=1; h=0.5; E=0.0001.
:

, ,
.

.
y=x2
-1 1.
0.

,
, .
11

12

13

14

.
Kursovaya.cpp
#include "stdafx.h"
#include "Kursovaya.h"
#define MAX_LOADSTRING 100
HINSTANCE hInst;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szWindowClass[MAX_LOADSTRING];
ATOM
MyRegisterClass(HINSTANCE hInstance);
BOOL
InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK
integralSettings(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK
optimizSettings(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK
aproksimSettings(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK
zadachaSettings(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,


HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int
nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
MSG msg;
HACCEL hAccelTable;
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_VMKURSOVAYA, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_VMKURSOVAYA));
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);

15

wcex.style
= CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc
= WndProc;
wcex.cbClsExtra
= 0;
wcex.cbWndExtra
= 0;
wcex.hInstance
= hInstance;
wcex.hIcon
= LoadIcon(hInstance,
MAKEINTRESOURCE(IDI_VMKURSOVAYA));
wcex.hCursor
= LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground
= (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName
= MAKEINTRESOURCE(IDC_VMKURSOVAYA);
wcex.lpszClassName
= szWindowClass;
wcex.hIconSm
= LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_ZADACHA:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ZADACHA), hWnd, zadachaSettings);
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case ID_ZADANIE:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ZADANIE), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:

16

return DefWindowProc(hWnd, message, wParam, lParam);


}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}

.cpp
//
long double apr(long double w)
{
long double rez = 0;
for (int i = 0; i < aproksimOut.count;i++)
rez += aproksimOut.k[i] * pow(w,i);
return rez;
}
//,
long double wz(long double w, long double z)
{
long double R2 = 1000, R1 = 1000;
if (w == 0) w = 0.00000001;
long double rez = sqrt(R2*R2+(w*w*z*z*R1*R1*R2*R2))/sqrt((R1*R1)+(R2*R2)+
(w*w*z*z*R1*R1*R2*R2));
return rez;
}
//,
long double fw(long double w)
{
long double R2 = 1000, R1 = 1000;
long double rez = R2/(R1+R2)+R1/(R1+R2)*(sin(w*M_PI/(2*pow(10.,6))));
return rez;

17

}
// F(X) ( )
long double f(long double w, long double z, int func)
{
switch (func)
{
case 0:
{
return pow(fw(w)-wz(w,z),2);
break;
}
case 1:
{
return pow(apr(w)-wz(w,z),2);
break;
}
case 2:
{
return pow(w,2);
break;
}
};
return 0;
}

.cpp
long double trapeze(long double a, long double b, long double e, long double z, int func)
{
integralOut.count = 0;
long int n = 1;
long double h = b-a;
long double s = (f(a,z,func)-f(b,z,func))*h/2, s1;
do
{
s1 = s;
n *=2;
h = (b-a)/n;
s = f(a,z,func)+f(b,z,func);
for (int i = 1; i < n;i++)
s+=2*f(a+i*h,z,func);
s*=h/2;
integralOut.s[integralOut.count] = s;
integralOut.h[integralOut.count] = h;
integralOut.n[integralOut.count] = n;
integralOut.count++;
}while (fabs(s-s1)/3 >=e);
return s;
}

.cpp
long double goldCut(long double a,long double b,long double e, long double ei, int func, int method)
{
optimizOut.count=0;
long double ai = 0, bi = 1000000;
long double k1=(3.-sqrt(5.))/2.;
long double k2=(sqrt(5.)-1)/2.;
long double x1=a+k1*(b-a);
long double x2=a+k2*(b-a);
long double F1 = fOpt(ai,bi,ei,x1,func,method), F2 = fOpt(ai,bi,ei,x2,func,method);
while ((b-a)>e)

18

{
if (F1<F2)
{
b=x2;
x2=x1;
x1=a+k1*(b-a);
F2=F1;
F1 = fOpt(ai,bi,ei,x1,func,method);
}
else
{
a=x1;
x1=x2;
x2=a+k2*(b-a);
F1=F2;
F2 = fOpt(ai,bi,ei,x2,func,method);
}
optimizOut.a[optimizOut.count] = a;
optimizOut.b[optimizOut.count] = b;
optimizOut.x1[optimizOut.count] = x1;
optimizOut.x2[optimizOut.count] = x2;
optimizOut.f1[optimizOut.count] = F1;
optimizOut.f2[optimizOut.count] = F2;
optimizOut.count++;
}
long double xm=(a+b)/2;
optimizOut.xmin = xm;
optimizOut.ymin = fOpt(ai,bi,ei,xm,func,method);
return xm;
}

.cpp
void aproksim(int N, int K)
{
long double* ak = new long double[K+1];
long double* b = new long double[K+1];
long double* x = new long double[N+1];
long double* y = new long double[N+1];
long double **sums = new long double*[K+1];
for (int i = 0; i < K + 1; i++)
sums[i] = new long double[K+1];
//
int i,j,k;
for(i=0; i<K+1; i++){
ak[i]=0;
b[i]=0;
for(j=0; j<K+1; j++)
sums[i][j] = 0;
}
// x,y
for(k=0; k<N; k++){
x[k]=aproksimIn.points[k].x;
y[k]=aproksimIn.points[k].y;
}
//
for(i=0; i<K+1; i++)
for(j=0; j<K+1; j++)
{
sums[i][j] = 0;

19

for(k=0; k<N; k++)


sums[i][j] += pow(x[k], i+j);
}
//
for(i=0; i<K+1; i++)
for(k=0; k<N; k++)
b[i] += pow(x[k], i) * y[k];
long double temp=0;
for(i=0; i<K+1; i++)
if(sums[i][i]==0)
for(j=0; j<K+1; j++)
{
if(j==i) continue;
if(sums[j][i] !=0 && sums[i][j]!=0)
{
for(k=0; k<K+1; k++)
{
temp = sums[j][k];
sums[j][k] = sums[i][k];
sums[i][k] = temp;
}
temp = b[j];
b[j] = b[i];
b[i] = temp;
break;
}
}
for(k=0; k<K+1; k++)
for(i=k+1; i<K+1; i++)
{
if(sums[k][k]==0)
return;
long double M = sums[i][k] / sums[k][k];
for(j=k; j<K+1; j++)
sums[i][j] -= M * sums[k][j];
b[i] -= M*b[k];
}
for(i=(K+1)-1; i>=0; i--){
long double s = 0;
for(j = i; j<K+1; j++)
s = s + sums[i][j]*ak[j];
ak[i] = (b[i] - s) / sums[i][i];
}
aproksimOut.count = K+1;
aproksimOut.k = ak;
delete[] b;
delete[] x;
delete[] y;
for (i = 0; i < K+1; i++)
delete[] sums[i];
delete[] sums;
}

20

.cpp
BOOL CALLBACK zadachaSettings(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
static int methodOpt = 0;
static int methodInt = 0;
static int func = 1;
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg,IDC_EDIT_A,TEXT("0.0000000001"));
SetDlgItemText(hDlg,IDC_EDIT_B,TEXT("0.0000001"));
SetDlgItemText(hDlg,IDC_EDIT_E,TEXT("0.00000000001"));
SetDlgItemText(hDlg,IDC_EDIT_EI,TEXT("0.000001"));
SetDlgItemText(hDlg,IDC_EDIT_K,TEXT("2"));
SendMessage(GetDlgItem(hDlg, IDC_RADIO_TABL),BM_SETCHECK,1,0);
if (aproksimIn.count == NULL) aproksimIn.count=0;
else
{
TCHAR bufText[300];
for (int i = 0; i < aproksimIn.count; i++)
{
pointBuf = aproksimIn.points[i];
bufText[0]=0;
addSubstr(bufText,TEXT("%.20lf"),pointBuf.x);
addSubstr(bufText,TEXT("%.20lf"),pointBuf.y);
SendMessage(GetDlgItem(hDlg,IDC_LIST_TABL),LB_ADDSTRING,0,
(LPARAM)bufText);
}
}
changeList(hDlg);
return TRUE;
case WM_COMMAND:
switch (wParam)
{
methodInt = 0;
methodOpt = 0;
case IDC_RADIO_TABL:
{
func = 1;
break;
}
case IDC_RADIO_ANALIT:
{
func = 0;
break;
}
case IDC_BUTTON_ADD:
{
if (DialogBox((HINSTANCE)GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_ADD_XY), hDlg, addSettings))
{
aproksimIn.points[aproksimIn.count] = pointBuf;
aproksimIn.count++;
TCHAR bufText[300];
bufText[0]=0;
addSubstr(bufText,TEXT("%.20lf"),pointBuf.x);
addSubstr(bufText,TEXT("%.20lf"),pointBuf.y);
SendMessage(GetDlgItem(hDlg,IDC_LIST_TABL),LB_ADDSTRING,0,(LPARAM)bufText);

21

}
break;

}
case IDC_BUTTON_DELETE:
{
SendMessage(GetDlgItem(hDlg,
IDC_LIST_TABL),LB_RESETCONTENT,0,0);
aproksimIn.count = 0;
break;
}
case IDC_BUTTON_START:
{
int k;
long double a,b,d,e,ei;
readIntegral(hDlg,a,b,ei,a);
readOptimiz(hDlg,a,b,e,d);
readAproksim(hDlg,k);
if (func == 1 && k > aproksimIn.count)
{
MessageBox(hDlg, TEXT("
"),TEXT(""),MB_OK);
break;
}
if (func == 1)
{
aproksim(aproksimIn.count,k);
printAproksim(hDlg);
}

}
case IDOK:
{

goldCut(a,b,e,ei,func,methodInt);
printOptimiz(hDlg);
break;

EndDialog(hDlg, TRUE);
return TRUE;
break;

}
case IDCANCEL:
EndDialog(hDlg, FALSE);
return TRUE;
break;
break;
}

break;
}
return FALSE;

-.cpp

bool readIntegral(HWND hDlg, long double &a, long double &b, long double &ei, long double &z)
{
TCHAR bufText[300];
GetDlgItemText(hDlg,IDC_EDIT_A,bufText,30);
swscanf(bufText,TEXT("%lf"),&a);
GetDlgItemText(hDlg,IDC_EDIT_B,bufText,30);
swscanf(bufText,TEXT("%lf"),&b);
GetDlgItemText(hDlg,IDC_EDIT_EI,bufText,30);
swscanf(bufText,TEXT("%lf"),&ei);
return 1;
}

22

bool printIntegral(HWND hDlg)


{
HWND hListBox = GetDlgItem(hDlg, IDC_LIST_OUT);
SendMessage(hListBox,LB_RESETCONTENT,0,0);
TCHAR bufText[300];
for (int i = 0; i < integralOut.count;i++)
{
swprintf(bufText,4,TEXT("%d"),i+1);
int n = wcslen(bufText);
bufText[n] = TEXT(')');
bufText[n+1] = 0;
addSubstr(bufText, TEXT("%.20lf"),integralOut.s[i]);
addSubstr(bufText, TEXT("%.20lf"),integralOut.h[i]);
addSubstr(bufText, TEXT("%.0lf"),integralOut.n[i]);
SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)bufText);
}
return 1;
}
bool readOptimiz(HWND hDlg, long double &a, long double &b, long double &e, long double &d)
{
TCHAR bufText[300];
GetDlgItemText(hDlg,IDC_EDIT_A,bufText,30);
swscanf(bufText,TEXT("%lf"),&a);
GetDlgItemText(hDlg,IDC_EDIT_B,bufText,30);
swscanf(bufText,TEXT("%lf"),&b);
GetDlgItemText(hDlg,IDC_EDIT_E,bufText,30);
swscanf(bufText,TEXT("%lf"),&e);
}

return 1;

bool printOptimiz(HWND hDlg)


{
HWND hListBox = GetDlgItem(hDlg, IDC_LIST_OUT);
SendMessage(hListBox,LB_RESETCONTENT,0,0);
TCHAR bufText[300];
int step = 27;
for (int i = 0; i < step*7; i++)
{
bufText[i] = TEXT(' ');
if ((i-step/2)%step==0)
switch (i / step)
{
case 0: bufText[i] = TEXT('a'); break;
case 1: bufText[i] = TEXT('b'); break;
case 2:
{
bufText[i] = TEXT('x');
i++;
bufText[i] = TEXT('1');
break;
}
case 3:
{
bufText[i] = TEXT('x');
i++;
bufText[i] = TEXT('2');
break;
}
case 4:
{

23

}
case 5:

case 6:

bufText[i]
i++;
bufText[i]
i++;
bufText[i]
i++;
bufText[i]
i++;
bufText[i]
break;

= TEXT('F');

bufText[i]
i++;
bufText[i]
i++;
bufText[i]
i++;
bufText[i]
i++;
bufText[i]
break;

= TEXT('F');

= TEXT('(');
= TEXT('x');
= TEXT('1');
= TEXT(')');

{
= TEXT('(');
= TEXT('x');
= TEXT('2');
= TEXT(')');

}
{

bufText[i] = TEXT('b');
i++;
bufText[i] = TEXT('-');
i++;
bufText[i] = TEXT('a');
break;

}
bufText[step*7] = 0;
SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)bufText);
for (int i = 0; i < optimizOut.count;i++)
{
swprintf(bufText,4,TEXT("%d"),i+1);
int n = wcslen(bufText);
bufText[n] = TEXT(')');
bufText[n+1] = 0;
addSubstr(bufText,
addSubstr(bufText,
addSubstr(bufText,
addSubstr(bufText,
addSubstr(bufText,
addSubstr(bufText,
addSubstr(bufText,
}

TEXT("%.20lf"),optimizOut.a[i]);
TEXT("%.20lf"),optimizOut.b[i]);
TEXT("%.20lf"),optimizOut.x1[i]);
TEXT("%.20lf"),optimizOut.x2[i]);
TEXT("%.20lf"),optimizOut.f1[i]);
TEXT("%.20lf"),optimizOut.f2[i]);
TEXT("%.20lf"),optimizOut.b[i]-optimizOut.a[i]);

SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)bufText);

swprintf(bufText,50,TEXT("%.20lf"),optimizOut.xmin);
SetDlgItemText(hDlg, IDC_EDIT_XMIN,bufText);
swprintf(bufText,50,TEXT("%.20lf"),optimizOut.ymin);
SetDlgItemText(hDlg, IDC_EDIT_YMIN,bufText);
return 1;
}
BOOL CALLBACK addSettings(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

24

{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg,IDC_EDIT_X,TEXT("0"));
SetDlgItemText(hDlg,IDC_EDIT_Y,TEXT("0"));
return TRUE;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
{
TCHAR bufText[300];
GetDlgItemText(hDlg,IDC_EDIT_X,bufText,30);
swscanf(bufText,TEXT("%lf"),&pointBuf.x);
GetDlgItemText(hDlg,IDC_EDIT_Y,bufText,30);
swscanf(bufText,TEXT("%lf"),&pointBuf.y);
EndDialog(hDlg, TRUE);
return TRUE;
break;
}
case IDCANCEL:
EndDialog(hDlg, FALSE);
return TRUE;
break;
break;
}

break;
}
return FALSE;
}

bool readAproksim(HWND hDlg, int& k)


{
TCHAR bufText[300];
GetDlgItemText(hDlg,IDC_EDIT_K,bufText,30);
swscanf(bufText,TEXT("%d"),&k);
return 1;
}
bool printAproksim(HWND hDlg)
{
HWND hListBox = GetDlgItem(hDlg, IDC_LIST_K);
SendMessage(hListBox,LB_RESETCONTENT,0,0);
TCHAR bufText[300];
for (int i = 0; i < aproksimOut.count;i++)
{
swprintf(bufText,4,TEXT("%d"),i+1);
int n = wcslen(bufText);
bufText[n] = TEXT(')');
bufText[n+1] = 0;
addSubstr(bufText, TEXT("%.20lf"),aproksimOut.k[i]);
SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)bufText);
}
return 1;
}

25

.
.
[a;b] n (. 6.4.3-1)
a, 1, x2, , b
. ,
,
. f(x)
[xi;xi+1] ,
:
y 0 + y1
b a
(x1 x0 ), (x1 x0 )= x= h=
,
2
n
b a y 0 + y1
b a y1 + y 2
b a y2+ y3
S0 =

, S1 =

, S2 =

n 2
n 2
n
2
b a y n2 + yn1
b a yn 1 + yn
Sn 2 =

Sn 1 =

n
2
n
2

S0 =

: I = S0 + S1 + ... + Sn =

b a (y 0 + 2y1 + 2y 2 + ... + yn )

.
n
2

:
b

I = f(x)dx =
a

n 1
ba
(y0 + yn + 2 yi ), y
2n
i =1

f(x ).
i =

- :


f(x)


a, b,
n,EE

[a, b ] -
E
-

n=1; h=(b-a)
s=[f(a)+f(b)]h/2

h -
S -
n -

n=2n; h=(b-a)/n
s1=s
s=f(a)+f(b)

f(x)

f(x)

i=1,n-1

c
P1 (x

s=s+2*f(a+i*h)

a=x0 x1

x2

X n-1

b=xn

xi

Xi+1

s = s * h/2

h, n
s1, s

|s-s1|<E
3

E ,s,
n, h

S
n
E
h

26

.
[a;b]

, ,
:
l
l2

l1

l2 l1
= ,
=l +l 1 l , 2 > l 2 l . 1
l l2
l =1, l22= 1 - l2 , l22 + l2 -1= 0,
l2 =

1 + 5
3 5
0.618, l1 = l l2 =
0.382 ,
2
2
l
l
k1 = 1 = 0.382,
k 2 = 2 = 0.618,
l
l

k1, k2- .
(1 2)
.
5 1
x1 = a +
(b a) = a + k1 (b a),
2
3 5
x2 = a +
(b a) = a + k2 (b a),
2
k1 = 0.382, k 2 = 0.618,
x1 = a + 0.382(b a)
x1 = a + k1(b a)

x 2 = a + 0.618(b a)
x 2 = a + k 2 (b a)
, 1
[a;b], [a;2]. 2
[a;b], [1;b]. ,
( ) .
1.618 .
n = 0.618n 0,
0= (b-a)
.
n .
, :

n
n 0.618n 0 0.618 = n , ,
0
lg( / 0 ) lg lg 0
n
=
.
lg0.618
lg0.618

27

- :

f(x)

a, b, E

[a;b] -

E
-

k1 = ( 3 5 ) / 2

2=1-1

k 2 = ( 5 1) / 2

x1=a+k1*(b-a)
x2=a+k2*(b-a)
F1=f(x1)
F2=f(x2)

(b-a)<E

F1<F2

a=x1; x1=x2
x2=a+k2*(b-a)

b=x2; x2=x1
x1=a+k1*(b-a)

F1=F2
F2=f(x2)

F2=F1
F1=f(x1)

x*=(a+b)/2
f*=f(x)

x* -
f* -

x*, f*

28

.
, ,
. :
, [a, b] x* , f(x*) f(x) [a, b] f(x) xx* xx*.
.
:

,
.
, x1, x2 [a,
b], , x1 x2, X* f(x2) < f(x1). , X* x1 < x2 x1
X* b. , x1 < x2 f(x1) > f(x2) , x1 X* b f(x1) < f(x2), a X* x2.
.

29

.

,
Z ,



.
3
, .
,
.

MathCad

10^-10
2.682448*10^-9
0.00000000010317106901
0.00000000268244779425

MathCad

F(
)

3.607812523*10^4
36078.12958170481600000000

F(
)

5.98021387986*10^3
5980.19987888225570000000

.
.. 6: 6.7, 6.4, 6.6.

30

!!!!!!!!

.

,
Z*.


.

31

(A,B), .
: (10-10-10-7).

.

, , Mathad:

, :

32

,
. F(Z)
, :

,
[2*10-9;4*10-9].

33

Z*
.

Z* ,

.

Z* .
.

34


Z:

Z :

Z :

35


, F(Z) ,
Kz(w) K(z,w) . ,
K(z,w) Kz(w).
, K(Z1, w) Kz(w),
K(Z2, w) K(Z3, w) Z2 Z3, Z1.
Z = Z1= 0.00000000268244779425.

36

Z*
.

Z* :
, Z*=10-10
K(Z,w) K3(w) [0;10-6],
Z1=Z*,Z2=2*10 - 1 0 ,Z3=5*10 - 1 0 :

37

, F(Z) ,
Kz(w) K(z,w) . ,
K(z,w) Kz(w).
, K(Z1, w) Kz(w),
K(Z2, w) K(Z3, w) Z2 Z3, Z1.
Z = Z1= 10-10.

38

WINDOWS.
.
x
y

y=x2:
0
1
2
3
0
1
4
9
:

4
16

F(x)=0+0*x+1*x2=x2.
,
.

MathCad.



10-10 10-7,
10-10.

39

.

,
Z ,



.
, 3
, .
,
.

:
MathCad

10^-10
0.00000000010317106901

2.682379*10^-9
0.00000000268244779425

MathCad

F(
)

3.60761005*10^4
36078.12958170481600000000

F(
)

5.980214*10^3
5980.19987888225570000000

.
.. 6: 6.7, 6.4, 6.6.

40

Оценить