This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| void FillMatrix(double **matrix, const int size){ | |
| for (int i=0; i<size; i++){ | |
| for (int j=0; j<size; j++){ | |
| cout << "a[" << i+1 << "][" << j+1 << "] = "; | |
| cin >> matrix[i][j]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| void FillMatrix(double **matrix, const int size){ | |
| for (int i=0; i<size; i++){ | |
| for (int j=0; j<size; j++){ | |
| matrix[i][j] = rand()%30; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <ctime> | |
| #include <time.h> | |
| #define INTEGER | |
| //#define DECIMAL //you'll have to change the type of an array from int to float | |
| using namespace std; | |
| #ifdef INTEGER | |
| void FillMatrix(int **matrix, const int size){ | |
| for (int i=0; i<size; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| void PrintMatrix(int **matrix, const int size){ | |
| for (int i=0; i<size; i++){ | |
| for (int j=0; j<size+1; j++){ | |
| if (j<size) { | |
| cout << matrix[i][j] << "*X" << j+1 << " "; | |
| } | |
| else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| void clearMemory(double** matrix, int size){ | |
| for (int i = 0; i < size; i++){ | |
| delete[] matrix[i]; | |
| } | |
| delete [] matrix; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <math.h> | |
| using namespace std; | |
| double f(double x){ | |
| return log(x)-3; //use your function | |
| } | |
| double BisectionMethod(double Xl, double Xr, double epsilon){ | |
| if (fabs(f(Xl)) < epsilon){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <math.h> | |
| using namespace std; | |
| double f(double x){ | |
| return log(x) - 5; | |
| } | |
| double rightDerivative (double x, double h){ | |
| double rightDer = (f(x+h) - f(x))/h; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <math.h> | |
| using namespace std; | |
| double foo(double x){ | |
| return log(x) - 5; | |
| } | |
| double SecantMethod(double x0, double x1, const double epsilon){ | |
| double x2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| double f(double x){ | |
| return sin(x); | |
| } | |
| double rightDerivative (double x, double h){ | |
| double rightDer = (f(x+h) - f(x))/h; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cmath> | |
| using namespace std; | |
| double Function(double x){ | |
| return sin(x); | |
| } | |
| double Trapezoid_1 (double a, double b, double N){ //методом трапеций 1 | |
| double Integral = 0, delta_x = (b - a) / N; |
OlderNewer