-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
22 lines (17 loc) · 776 Bytes
/
main.cpp
File metadata and controls
22 lines (17 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include "complex.hpp"
#include "roots.hpp"
void test(const char* name, func f, cmplx z1, cmplx z2) {
std::cout << name << " в прямоугольнике " << z1 << " " << z2 << std::endl;
auto answer = roots(f, z1, z2);
for (auto i: answer)
std::cout << i << std::endl;
std::cout << std::endl;
}
int main() {
test("1/z", [](cmplx z){return 1. / z;}, cmplx(-0.1, -0.2), cmplx(1., 2.));
test("z", [](cmplx z){return z;}, cmplx(-0.1, -0.2), cmplx(1., 2.));
test("z + 1/z", [](cmplx z){return z + 1. / z;}, cmplx(-1, -2), cmplx(1., 2.));
test("sin z", [](cmplx z){return sin(z);}, cmplx(-10, -10), cmplx(10, 10));
test("sinh z", [](cmplx z){return sinh(z);}, cmplx(-10, -10), cmplx(10, 10));
}