-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
84 lines (64 loc) · 2.04 KB
/
main.cpp
File metadata and controls
84 lines (64 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <cfloat>
#include <cmath>
#include "functions/exponenta.h"
#include "functions/hiperbola.h"
#include "functions/parabola.h"
#include "functions/polinom.h"
using namespace std;
void complex_function(Function &firstFunc, Function &secondfunc, double x){
double res = secondfunc.differentiate(x);
double res2 = firstFunc.differentiate(res);
cout << "Дифференциал сложной функции " << res * res2 << endl;
}
int main(){
setlocale(LC_ALL, "rus");
// Задаем функцию y = 2^x
Exponent exp(2.0);
cout << "=============================================" << endl;
// Функция в точке x = 3
double x = 3.0;
double y = exp.evaluate(x);
exp.displayResult(x, y);
// Задаем интервал
double a = 1.0;
double b = 5.0;
exp.findMinimum(a, b);
exp.findMaximum(a, b);
exp.differentiate(x);
exp.integrate(a, b);
cout << "=============================================" << endl;
Hyperbola hyp(2.0, 1.0, -1.0);
y = hyp.evaluate(x);
hyp.displayResult(x, y);
hyp.findMinimum(a, b);
hyp.findMaximum(a, b);
x = 3.0;
hyp.differentiate(x);
hyp.integrate(a, b);
cout << "=============================================" << endl;
Parabola par(2.0, 1.0, 3.0);
x = 4.0;
y = par.evaluate(x);
par.displayResult(x, y);
par.findMinimum(a, b);
par.findMaximum(a, b);
par.integrate(a, b);
x = 3.0;
par.differentiate(x);
cout << "=============================================" << endl;
std::vector<double> coeffs = {1.0, 2.0, 3.0};
Polynomial poly(coeffs);
double x4 = 4.0;
double y4 = poly.evaluate(x4);
poly.displayResult(x4, y4);
poly.findMaximum(a, b);
poly.findMinimum(a, b);
poly.integrate(a, b);
x = 3.0;
poly.differentiate(x);
cout << "=============================================" << endl;
complex_function(par, hyp, x);
//hyp.differentiate(par.differentiate(x));
return 0;
}