. , , ,

,,,

,

. .

:

:

:

2010


1.

1.1

1.2

1.3

2.

3.

4.

4.1

4.2

4.3

5.

5.1

5.2

5.3

5.4

5.5

6.

6.1

6.2

6.3

6.4

6.5

6.6

7.

7.1

7.2

7.3

7.4

7.5

8.


1.

1.1

, C.

 

1.2

.

.

, , .

( ).

:

1/x2 [0.5, 3]

1/x [0.1, 9]

sin mx [0, π] m=1,2,7,9

1.3

, [a,b] n (). . .

x, = x0 + ih, (i = 0,1,..,n), 0 = , n = b, h=(b-a)/n


:

yi=f(xi)

:

 

n .

 


2.

1/x, , , , .

: ( 1), ( -2), , , , m, 1.

10-7 10-3, 101/24, , 25 , . - , , . n = 2iter, itter - . .

D:\Zavisimost1.txt. MS Excel 1 , 1.

1

1,00E-07 1,47E-07 2,15E-07 3,16E-07 4,64E-07 6,81E-07 1,00E-06 1,47E-06 2,15E-06
- 22 21 20 20 19 19 18 18 17
3,16E-06 4,64E-06 6,81E-06 1,00E-05 1,47E-05 2,15E-05 3,16E-05 4,64E-05 6,81E-05
- 17 16 16 15 15 14 14 13 13
1,00E-04 1,47E-04 2,15E-04 3,16E-04 4,64E-04 6,81E-04 1,00E-03
- 12 12 11 11 11 10 10

1

2, 3, 4, 5, 6.

2 - - 1/x, 1/x^2, sin x

-

1/x2

1/x sin x

1/x2

1/x sin x

1/x2

1/x sin x

1/x2

1/x sin x
1,00E-07 22 22 10 21 21 15 22 22 10 21 21 15
1,47E-07 21 21 10 20 20 14 21 21 10 20 20 14
2,15E-07 20 20 10 20 20 13 20 20 10 20 20 13
3,16E-07 20 20 10 19 19 13 20 20 10 19 19 13
4,64E-07 19 19 10 19 19 12 19 19 10 19 19 12
6,81E-07 19 19 10 18 18 12 19 19 10 18 18 12
1,00E-06 18 18 10 18 18 11 18 18 10 18 18 11
1,47E-06 18 18 10 17 17 11 18 18 10 17 17 11
2,15E-06 17 17 10 17 17 10 17 17 10 17 17 10
3,16E-06 17 17 10 16 16 10 17 17 10 16 16 10
4,64E-06 16 16 9 15 15 9 16 16 9 15 15 9
6,81E-06 16 16 9 15 15 8 16 16 9 15 15 8
1,00E-05 15 15 9 14 14 8 15 15 9 14 14 8
1,47E-05 15 15 9 14 14 7 15 15 9 14 14 7
2,15E-05 14 14 9 13 13 7 14 14 9 13 13 7
3,16E-05 14 14 8 13 13 6 14 14 8 13 13 6
4,64E-05 13 13 8 12 12 6 13 13 8 12 12 6
6,81E-05 13 13 8 12 12 5 13 13 8 12 12 5
1,00E-04 12 12 8 11 11 5 12 12 8 11 11 5
1,47E-04 12 12 7 11 11 5 12 12 7 11 11 5
2,15E-04 11 11 7 10 10 5 11 11 7 10 10 5
3,16E-04 11 11 7 10 10 4 11 11 7 10 10 4
4,64E-04 11 11 7 9 9 4 11 11 7 9 9 4
6,81E-04 10 10 6 9 9 4 10 10 6 9 9 4
1,00E-03 10 10 6 9 9 4 10 10 6 9 9 4

3 - 1/x^2, 1/x

-
-

1/x2

1/x

1/x2

1/x

1/x2

1/x

1/x2

1/x
1 4,25E-01 4,79E-01 3,81E-01 4,69E-01 1,38E+00 4,89E+00 8,68E-01 3,26E+00
2 3,06E-01 4,46E-01 2,15E-01 4,17E-01 5,72E-01 2,38E+00 3,03E-01 1,54E+00
3 1,57E-01 3,81E-01 7,35E-02 3,27E-01 2,04E-01 1,12E+00 8,14E-02 7,06E-01
4 5,87E-02 2,77E-01 1,71E-02 2,06E-01 6,42E-02 5,05E-01 1,75E-02 2,99E-01
5 1,89E-02 1,58E-01 4,52E-03 9,55E-02 1,95E-02 2,09E-01 4,55E-03 1,10E-01
6 6,17E-03 6,89E-02 1,81E-03 3,13E-02 6,23E-03 7,66E-02 1,82E-03 3,26E-02
7 2,20E-03 2,38E-02 8,72E-04 7,28E-03 2,21E-03 2,47E-02 8,74E-04 7,35E-03
8 8,77E-04 7,16E-03 4,34E-04 1,42E-03 8,79E-04 7,24E-03 4,34E-04 1,42E-03
9 3,82E-04 2,08E-03 2,17E-04 3,66E-04 3,82E-04 2,08E-03 2,17E-04 3,66E-04
10 1,77E-04 6,32E-04 1,08E-04 1,49E-04 1,77E-04 6,33E-04 1,09E-04 1,49E-04
11 8,49E-05 2,12E-04 5,42E-05 7,19E-05 8,49E-05 2,12E-04 5,43E-05 7,19E-05
12 4,16E-05 7,99E-05 2,71E-05 3,58E-05 4,16E-05 7,99E-05 2,71E-05 3,58E-05
13 2,06E-05 3,34E-05 1,36E-05 1,79E-05 2,06E-05 3,34E-05 1,36E-05 1,79E-05
14 1,02E-05 1,51E-05 6,78E-06 8,94E-06 1,02E-05 1,51E-05 6,78E-06 8,94E-06
15 5,10E-06 7,12E-06 3,39E-06 4,47E-06 5,10E-06 7,12E-06 3,39E-06 4,47E-06
16 2,55E-06 3,46E-06 1,70E-06 2,24E-06 2,55E-06 3,46E-06 1,70E-06 2,24E-06
17 1,27E-06 1,70E-06 8,48E-07 1,12E-06 1,27E-06 1,70E-06 8,48E-07 1,12E-06
18 6,36E-07 8,45E-07 4,24E-07 5,59E-07 6,36E-07 8,45E-07 4,24E-07 5,59E-07
19 3,18E-07 4,21E-07 2,12E-07 2,79E-07 3,18E-07 4,21E-07 2,12E-07 2,79E-07
20 1,59E-07 2,10E-07 1,06E-07 1,40E-07 1,59E-07 2,10E-07 1,06E-07 1,40E-07

4. - sin 7x, sin 9x

-
sin(7x) sin(9x) sin(7x) sin(9x) sin(7x) sin(9x) sin(7x) sin(9x)
1,00E-07 21 21 20 21 21 21 20 21
1,47E-07 20 21 20 20 20 21 20 20
2,15E-07 20 20 19 20 20 20 19 20
3,16E-07 19 20 18 19 19 20 18 19
4,64E-07 19 19 18 19 19 19 18 19
6,81E-07 18 19 17 18 18 19 17 18
1,00E-06 17 18 17 18 17 18 17 18
1,47E-06 17 18 16 17 17 18 16 17
2,15E-06 16 17 16 16 16 17 16 16
3,16E-06 16 16 15 16 16 16 15 16
4,64E-06 10 16 15 15 10 16 15 15
6,81E-06 10 15 14 15 10 15 14 15
1,00E-05 10 10 13 14 10 10 13 14
1,47E-05 10 10 13 14 10 10 13 14
2,15E-05 10 10 12 13 10 10 12 13
3,16E-05 10 10 12 13 10 10 12 13
4,64E-05 10 10 11 12 10 10 11 12
6,81E-05 10 10 11 11 10 10 11 11
1,00E-04 10 10 10 11 10 10 10 11
1,47E-04 10 10 10 10 10 10 10 10
2,15E-04 10 10 9 10 10 10 9 10
3,16E-04 9 10 9 9 9 10 9 9
4,64E-04 9 9 8 9 9 9 8 9
6,81E-04 9 9 8 8 9 9 8 8
1,00E-03 9 9 7 8 9 9 7 8

5 - sin x, sin 2x

-
-
sin x sin 2x sin x sin 2x sin x sin 2x sin x sin 2x
1 2,09E+02 6,67E-01 2,50E+02 9,00E-01 7,83E-01 3,94E+03 1,04E+00 5,91E+03
2 2,06E-01 5,00E-01 4,32E-02 1,59E-03 1,62E-01 9,87E+02 4,52E-02 1,05E+00
3 4,08E-02 5,01E-01 2,34E-03 5,01E-01 3,87E-02 4,93E+02 2,35E-03 3,29E+02
4 9,62E-03 5,01E-01 2,30E-04 5,02E-01 9,50E-03 2,46E+02 2,30E-04 1,64E+02
5 2,34E-03 5,02E-01 5,98E-05 5,03E-01 2,33E-03 1,23E+02 5,99E-05 8,21E+01
6 5,63E-04 5,04E-01 2,65E-05 5,06E-01 5,63E-04 6,16E+01 2,65E-05 4,11E+01
7 1,31E-04 5,08E-01 1,31E-05 5,12E-01 1,31E-04 3,08E+01 1,31E-05 2,05E+01
8 2,78E-05 5,17E-01 6,51E-06 5,26E-01 2,78E-05 1,54E+01 6,51E-06 1,03E+01
9 4,52E-06 5,35E-01 3,26E-06 5,54E-01 4,52E-06 7,70E+00 3,26E-06 5,13E+00
10 9,11E-08 5,75E-01 1,63E-06 6,21E-01 9,11E-08 3,85E+00 1,63E-06 2,57E+00
11 6,33E-07 6,75E-01 8,14E-07 8,19E-01 6,33E-07 1,93E+00 8,14E-07 1,28E+00
12 4,64E-07 1,04E+00 4,07E-07 2,26E+00 4,64E-07 9,63E-01 4,07E-07 6,42E-01
13 2,69E-07 1,29E+01 2,03E-07 8,96E-01 2,69E-07 4,81E-01 2,03E-07 3,21E-01
14 1,43E-07 4,64E-01 1,02E-07 2,36E-01 1,43E-07 2,41E-01 1,02E-07 1,60E-01
15 7,40E-08 1,58E-01 5,09E-08 9,56E-02 7,40E-08 1,20E-01 5,09E-08 8,02E-02
16 3,76E-08 6,84E-02 2,54E-08 4,36E-02 3,76E-08 6,02E-02 2,54E-08 4,01E-02
17 1,89E-08 3,20E-02 1,27E-08 2,09E-02 1,89E-08 3,01E-02 1,27E-08 2,01E-02
18 9,50E-09 1,55E-02 6,36E-09 1,02E-02 9,50E-09 1,50E-02 6,36E-09 1,00E-02
19 4,75E-09 7,62E-03 3,18E-09 5,06E-03 4,75E-09 7,51E-03 3,18E-09 5,01E-03
20 2,39E-09 3,81E-03 1,58E-09 2,51E-03 2,39E-09 3,79E-03 1,58E-09 2,49E-03

6 - sin 7x, sin 9x

-
-
sin 7x sin 9x sin 7x sin 9x sin 7x sin 9x sin 7x sin 9x
1 3,04E+01 2,28E+01 3,66E+01 2,72E+01 5,59E+00 6,91E+00 7,47E+00 9,18E+00
2 2,17E-01 1,95E-01 4,10E-02 4,53E-02 1,17E+00 1,41E+00 2,98E-01 4,31E-01
3 1,04E+00 1,04E+00 1,37E+00 1,36E+00 6,87E+00 8,95E+00 9,55E+00 1,24E+01
4 1,92E+00 3,28E+00 6,00E-01 1,33E+00 5,56E-01 1,06E+00 1,55E+00 4,40E+00
5 1,41E-01 2,74E-01 2,58E-02 7,72E-02 1,19E-01 2,02E-01 2,66E-02 8,43E-02
6 2,89E-02 4,93E-02 2,50E-03 5,57E-03 2,79E-02 4,64E-02 2,51E-03 5,61E-03
7 6,48E-03 1,08E-02 7,11E-04 1,25E-03 6,43E-03 1,07E-02 7,12E-04 1,26E-03
8 1,37E-03 2,26E-03 3,23E-04 5,39E-04 1,37E-03 2,26E-03 3,24E-04 5,40E-04
9 2,22E-04 3,66E-04 1,60E-04 2,64E-04 2,22E-04 3,66E-04 1,60E-04 2,65E-04
10 4,46E-06 7,37E-06 7,98E-05 1,32E-04 4,46E-06 7,37E-06 7,98E-05 1,32E-04
11 3,10E-05 5,13E-05 3,99E-05 6,59E-05 3,10E-05 5,13E-05 3,99E-05 6,59E-05
12 2,27E-05 3,75E-05 1,99E-05 3,30E-05 2,27E-05 3,75E-05 1,99E-05 3,30E-05
13 1,32E-05 2,17E-05 9,97E-06 1,65E-05 1,32E-05 2,17E-05 9,97E-06 1,65E-05
14 7,03E-06 1,16E-05 4,99E-06 8,24E-06 7,03E-06 1,16E-05 4,99E-06 8,24E-06
15 3,63E-06 6,00E-06 2,49E-06 4,12E-06 3,63E-06 6,00E-06 2,49E-06 4,12E-06
16 1,84E-06 3,04E-06 1,25E-06 2,06E-06 1,84E-06 3,04E-06 1,25E-06 2,06E-06
17 9,28E-07 1,53E-06 6,23E-07 1,03E-06 9,28E-07 1,53E-06 6,23E-07 1,03E-06
18 4,66E-07 7,70E-07 3,12E-07 5,15E-07 4,66E-07 7,70E-07 3,12E-07 5,15E-07
19 2,33E-07 3,86E-07 1,56E-07 2,58E-07 2,33E-07 3,86E-07 1,56E-07 2,58E-07
20 1,17E-07 1,93E-07 7,79E-08 1,29E-07 1,17E-07 1,93E-07 7,79E-08 1,29E-07

2.

3.


4. ( )

5. ( )

6.


7.

8.

9.


10. 1/ .

11


3. 

 

, - sin2x. [0, π], 0 ( ). , , , , 32 , - , - n, , int, . 31 n , 0, , , . ( 10^-3).

1/x, 1/x^2, sin7x sin9x , sinx ( , ).

, sinx, , , - . , - . sinx, , - , ( ), sin mx , 1/x 1/x^2 .

1/x sin2x , 1/x , 10.

sin2x . , > 4-5 .


4. 

4.1

.

 

4.2 .

. Microsoft Visual ++ 2005.

 

4.3

.

.

, , .

( ).


5.

 

5.1

, : .

 

5.2

.

 

5.3

.

 

5.4

.1.2. .

 

5.5

.

. 2 ENTER. , ( 2 ENTER). , 1 ENTER. m/x ( 2). 1 3 m=1. , , y. , ESC. D:\Zavisimost1.txt .

D:\Zavisimost1.txt:

-

-2

-1

-2

a=2,000000

b=3,000000

m=1,000000

-

1 4,316031e-001

2 2,108191e-001

3 1,040970e-001

4 5,171560e-002

5 2,577427e-002

6 1,286624e-002

7 6,427892e-003

8 3,212639e-003

9 1,605993e-003

10 8,029148e-004

11 4,014370e-004

12 2,007134e-004

13 1,003554e-004

14 5,017739e-005

15 2,508862e-005

16 1,254429e-005

17 6,272139e-006

18 3,136068e-006

19 1,568034e-006

20 7,840168e-007


6.

 

6.1

 

.

 

6.2

PC c Intel Core 2 Duo CPU 7350 2.0GHz, Windows XP SP 3 5.1 2600.xpsp.080413-2111.

IBM PC.

Microsoft Visual ++ 2005 Express Edition Microsoft Visual Studio 2008.

 

6.3

.

 

6.4

, , :

- : ( ) .

- : - .

- : - .

- a= - .

- b= - .

- m= - .

- ?? Y??? - y, , .

 

6.5

( - ), ( ), , ( ), m.

25 , D:\ Zavisimost1.txt D:\ Zavisimost2.txt .

 

6.6

( 4 ) Microsoft Visual ++ 2005 Express Edition.

 


7.

7.1

.

IBM PC.

++, Microsoft Visual ++ 2005 Express Edition.

 

7.2

( ) sin(mx), m/x, m/x2.

 

7.3

void Zavisimost1(char,int,int,int)- - , ( 49), .

void Zavisimost2(char,int,int,int) , - .

double Trapecia(int,double,double,int,double) , - , , , m, .

double Simpson(int,double,double,int,double) , .

double analitIntegral(int,double,double,double) , , .

double calcKritCorrectTrapecia(int ,int ,double ,double ,int ,double)

double calcKritCorrectSimpson(int ,int ,double ,double ,int ,double) , , , , , , - , .

double selectedFunctionValue(int,double,double) - , , , .

:

int selectZavisimost()- .

int selectedZavisimostFunction()-, .

int selectOtnoshenie()

int selectedOtnoshenieFunction(FILE*,int)

int selectMethod()-

int selectedMethodFunction(FILE*,int,int)

int selectFunction()-

int selectedFunctionFunction(FILE*,int,int,int)

double selectedVerhPredel(FILE*)-

double selectedNizhPredel(FILE*,int,int,int,int); -

double selectedKoefM(FILE*)

 


7.4

PC c Intel Core 2 Duo CPU 7350 2.0GHz, Windows XP SP 3 5.1 2600.xpsp.080413-2111.

IBM PC.

 

7.5

( - ), ( ), , ( ), m.

25 , D:\ Zavisimost1.txt D:\ Zavisimost2.txt .


8.

// Kursovoy.h

//

#ifndef Kursovoy_h

#define Kursovoy_h

#include "stdafx.h"

#include <iostream>

#include "math.h"

#include "locale.h"

#include "conio.h"

using namespace std;

void main(); // ,

int selectZavisimost(); //

int selectedZavisimostFunction(); //

int selectOtnoshenie(); //

int selectedOtnoshenieFunction(FILE*,int); //

int selectMethod(); // ,

int selectedMethodFunction(FILE*,int,int); // , - ,

int selectFunction(); //

int selectedFunctionFunction(FILE*,int,int,int); //

double selectedVerhPredel(FILE*); //

double selectedNizhPredel(FILE*,int,int,int,int); //

double selectedKoefM(FILE*); //

void Zavisimost1(char,int,int,int); // , (- )

void Zavisimost2(char,int,int,int); // 2 ( - )

double selectedFunctionValue(int, double,double); // ( y=f(x))

double calcKritCorrectTrapecia(int ,int ,double ,double ,int ,double); //

double calcKritCorrectSimpson(int ,int ,double ,double ,int ,double); //_________________________________

double Trapecia(int,double,double,int,double); // ( , - )

double Simpson(int,double,double,int,double); //

double analitIntegral(int,double,double,double); //

char uvelicVerhPredel(); //

void Zagolovok(); //" " - Windows XP

#endif

// Kursovoy2.cpp,

#include "stdafx.h"

#include "Kursovoy.h"

void main()

{

system("cls");

setlocale(LC_ALL, "RUSSIAN");

selectedZavisimostFunction();

}

// , - ( 10^-7 10^-3)

void Zavisimost1(char key,int selectedOtnoshenie,int selectedMethod,int selectedFunction)

{

FILE *f;

f=fopen("D:\\Zavisimost1.txt","at");//

fprintf(f,"%s"," - \t\n");

double krT; //,

// ( )

do

{

if (key==49) selectedOtnoshenie=selectedOtnoshenieFunction(f,1);// 1 ( ),

if (key==49||key==50) selectedMethod=selectedMethodFunction(f,1,selectedOtnoshenie);// 2 (

if (key==49||key==50||key==51) selectedFunction=selectedFunctionFunction(f,1,selectedOtnoshenie,selectedMethod); // 3

else {cout<<"\n ";key=_getch();}//

}

while((key!=49)&&(key!=50)&&(key!=51)); //

double a = selectedNizhPredel(f,1,selectedOtnoshenie,selectedMethod,selectedFunction);//

double b = selectedVerhPredel(f); //

double m = selectedKoefM(f); // m

printf("%s\t"," ");

printf("%s\n","- "); //

fprintf(f,"%s\t"," "); //

fprintf(f,"%s\n","- ");

double krT0=1e-7; //

for(int i=0; i<25; i++) //25

{

double itter=0;

int N=1;

do

{

itter++; //

N=2*N; //-

if(selectedMethod==1) // 1, ,

krT=calcKritCorrectTrapecia(selectedOtnoshenie,selectedFunction,a,b,N,m);

if(selectedMethod==2) //

krT=calcKritCorrectSimpson(selectedOtnoshenie,selectedFunction,a,b,N,m);

}

while(krT>krT0); //

cout<<krT0<<"\t\t\t"<<itter<<"\n"; //

fprintf(f,"%e",krT0);

fprintf(f,"\t%f\n",itter);

krT0=pow(10,0.166666667)*krT0; // 10^(1/24) , 25 10^-3

} // 25

cout<<"\n :\n1 - \n2 - \n3 - \nESC - \n";

key=_getch(); //

if(key==27) main(); // ESC -

fclose(f); //

Zavisimost1(key,selectedOtnoshenie,selectedMethod,selectedFunction); //

}

// , -

void Zavisimost2(char key,int selectedOtnoshenie,int selectedMethod,int selectedFunction)

{

FILE *f;

f=fopen("D:\\Zavisimost2.txt","at"); //

fprintf(f,"%s"," - \t\n");

double krT; // ,

do //

{

if (key==49) selectedOtnoshenie=selectedOtnoshenieFunction(f,2);

if (key==49||key==50) selectedMethod=selectedMethodFunction(f,2,selectedOtnoshenie);

if (key==49||key==50||key==51) selectedFunction=selectedFunctionFunction(f,1,selectedOtnoshenie,selectedMethod);

else {cout<<"\n ";key=_getch();}

}

while((key!=49)&&(key!=50)&&(key!=51));

double a = selectedNizhPredel(f,2,selectedOtnoshenie,selectedMethod,selectedFunction); //

double b = selectedVerhPredel(f);

double m = selectedKoefM(f);

fprintf(f,"%s\t","- ");

fprintf(f,"%s\n"," ");

char verhPredelIsled = uvelicVerhPredel(); // ?

int jj;

if (verhPredelIsled=='Y'||'y') jj=10; // , 10 b

else jj=1;

for (int j=0;j<jj;j++)

{

int N=1;

for(int i=1; i<21; i++) //, -

{

N=N*2; // - 2

if(selectedMethod==1)

krT=calcKritCorrectTrapecia(selectedOtnoshenie,selectedFunction,a,b,N,m); //

if(selectedMethod==2)

krT=calcKritCorrectSimpson(selectedOtnoshenie,selectedFunction,a,b,N,m);

cout<<"\nkrT="<<krT<<"\ni="<<i<<"\nN="<<N/2<<"\n";

fprintf(f,"%d\t",i); //

fprintf(f,"%e\n",krT);

}

b=b+0.5; //

}

cout<<"\n :\n1 - \n2 - \n3 - \nESC - \n";

key=_getch(); // , ))

if(key==27) main();

fclose(f);

Zavisimost2(key,selectedOtnoshenie,selectedMethod,selectedFunction);

}

// ReturnKurs.cpp, , , ...

#include "stdafx.h"

#include "Kursovoy.h"

double calcKritCorrectTrapecia(int selectedOtnoshenie,int selectedFunction,double a,double b,int N,double m) //

{

double prevI,I,tempI;

prevI=Trapecia(N/2,a,b,selectedFunction,m);

I=Trapecia(N,a,b,selectedFunction,m);

if(selectedOtnoshenie==2) tempI=analitIntegral(selectedFunction,a,b,m);

if(selectedOtnoshenie==1) tempI=prevI;

return(abs((prevI-I)/tempI));

}

double calcKritCorrectSimpson(int selectedOtnoshenie,int selectedFunction,double a,double b,int N,double m)//

{

double prevI,I,tempI;

prevI=Simpson(N/2,a,b,selectedFunction,m);

I=Simpson(N,a,b,selectedFunction,m);

if(selectedOtnoshenie==2) tempI=analitIntegral(selectedFunction,a,b,m);

if(selectedOtnoshenie==1) tempI=prevI;

return(abs((prevI-I)/tempI));

}

double Trapecia(int N,double a,double b,int selectedFunction,double m) // -

{

double I,h,x; // , ,

x=a;

h=(b-a)/N; // h

I=h*(selectedFunctionValue(selectedFunction,b,m)+selectedFunctionValue(selectedFunction,a,m))/2;//

for(int i=0;i<N;++i) //

{

x=x+h;

I=I+h*selectedFunctionValue(selectedFunction,x,m);//

}

return I; // ( , )

}

double Simpson(int N,double a,double b,int selectedFunction,double m) //

{

double I,h,x; //

h=(b-a)/N;

I=h*(selectedFunctionValue(selectedFunction,b,m)+selectedFunctionValue(selectedFunction,a,m))/3;//

x=a;

for(int i=1;i<N;++i) // , x ,

{

x=x+2*h; //.

I=I+2*h*selectedFunctionValue(selectedFunction,x,m)/3; //

i++;

}

x=a-h; // h

for(int i=0;i<N;++i)

{

x=x+2*h; //

I=I+4*h*selectedFunctionValue(selectedFunction,x,m)/3; // ,

i++;

}

return I; //

}

double selectedFunctionValue(int selectedFunction,double argumentValue,double m) //

{

switch(selectedFunction)

{

case 1:return (m/(argumentValue*argumentValue));break;

case 2:return (m/(argumentValue));break;

case 3:return (sin(m*argumentValue));break;

default:return 0;break;

}

}

double analitIntegral(int selectedFunction,double a,double b, double m) // ,

{

switch(selectedFunction)

{

case 1:return m*((1/a)-(1/b));break;

case 2:return m*((log(b))-(log(a)));break;

case 3:return 1/m*((cos(m*a))-(cos(m*b)));break;

default:return 0;break;

}

}

// Select.cpp, ))) , , , ))

#include "stdafx.h"

#include "Kursovoy.h"

int selectZavisimost() // ( )

{ int numberZavisimost;

Zagolovok();

cout<<" :\n"

<<"1. - \n"

<<"2. - \n"

<<" - ";

cin>>numberZavisimost;

return numberZavisimost;

}

int selectedZavisimostFunction() // ( )

{

int selectedZavisimost=selectZavisimost();

while (selectedZavisimost!=1&&selectedZavisimost!=2)

{

cout<<" , ..."; // ,

selectedZavisimost=selectZavisimost(); // , . ,

}

if(selectedZavisimost==1) Zavisimost1(49,1,0,0); // ( 49, . )

if(selectedZavisimost==2) Zavisimost2(49,1,0,0);

return selectedZavisimost; // ,

}

int selectOtnoshenie() //

{ int numberOtnoshenie;

cout<<"\n :\n"

<<"1. \n"

<<"2. \n"

<<" - ";

cin>>numberOtnoshenie;

return numberOtnoshenie;

}

int selectedOtnoshenieFunction(FILE*f,int selectedZavisimost)

{

system("cls");

Zagolovok();

cout<<" - " //

<<selectedZavisimost;

int selectedOtnoshenie=selectOtnoshenie();

while (selectedOtnoshenie!=1&&selectedOtnoshenie!=2) //

{

cout<<" ..."; //

selectedOtnoshenie=selectOtnoshenie(); //

}

fprintf(f,"%s%d%s"," -",selectedOtnoshenie,"\t\n");

return selectedOtnoshenie;

}

int selectMethod() //

{ int numberMethod;

cout<<"\n :\n"

<<"1. \n"

<<"2. \n"

<<" - ";

cin>>numberMethod;

return numberMethod;

}

int selectedMethodFunction(FILE*f,int selectedZavisimost,int selectedOtnoshenie)

{

system("cls");

Zagolovok();

cout<<" - "

<<selectedZavisimost

<<"\n - "

<<selectedOtnoshenie;

int selectedMethod=selectMethod();

while (selectedMethod!=1&&selectedMethod!=2)

{

cout<<" , ...";

selectedMethod=selectMethod();

}

fprintf(f,"%s%d%s"," -",selectedMethod,"\t\n");

return selectedMethod;

}

int selectFunction()

{

int numberFunction;

cout<<"\n :\n"

<<"1. f(x) = m/x^2\n"

<<"2. f(x) = m/x\n"

<<"3. f(x) = sin(mx)\n"

<<" - ";

cin>>numberFunction;

return numberFunction;

}

int selectedFunctionFunction(FILE*f,int selectedZavisimost,int selectedOtnoshenie, int selectedMethod)

{

system("cls");

Zagolovok();

cout<<" - "

<<selectedZavisimost

<<"\n - "

<<selectedOtnoshenie

<<"\n -"

<<selectedMethod;

int selectedFunction=selectFunction();

while (selectedFunction!=1&&selectedFunction!=2&&selectedFunction!=3)

{

cout<<" , ...";

selectedFunction=selectFunction();

}

fprintf(f,"%s%d%s"," -",selectedFunction,"\t\n");

return selectedFunction;

}

double selectedNizhPredel(FILE*f,int selectedZavisimost,int selectedOtnoshenie, int selectedMethod, int selectedFunction) //

{

system("cls");

Zagolovok();

cout<<" - "

<<selectedZavisimost

<<"\n - "

<<selectedOtnoshenie

<<"\n -"

<<selectedMethod

<<"\n - "

<<selectedFunction;

double a;

cout<<"\n a=";

cin>>a;

fprintf(f,"%s%f%s"," a=",a,"\t\n");

return a;

}

double selectedVerhPredel(FILE*f) //

{

double b;

cout<<" b=";

cin>>b;

fprintf(f,"%s%f%s"," b=",b,"\t\n");

return b;

}

double selectedKoefM(FILE*f)

{

double m; // ( )

cout<<" m=";

cin>>m;

cout<<"\n\n ...\n \n";

fprintf(f,"%s%f%s"," m=",m,"\t\n");

return m;

}

char uvelicVerhPredel()

{

char a;

cout<<" ?? Y???";

cin>>a;

return a;

}

void Zagolovok() // ,

{ // , ,

cout<<"* * * * ** * * * * * * * * * * \n"

<<"* * * * * * * * * * * * * * * \n"

<<"** * ** * * * * * * * * * * \n"

<<"* * * * * * * * * * * * * * \n"

<<"* * * * * * * * * * * * * * \n"

<<"___________________________________________________ \n\n";

}

. .

 

 

 

! , , , .
. , :