-
Notifications
You must be signed in to change notification settings - Fork 0
/
polynom_test.c
60 lines (49 loc) · 1.43 KB
/
polynom_test.c
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
/*
Main module for polynom operations testing.
*/
#include <stdio.h>
#include "polynom.h"
#include "dumper.h"
int main()
{
double a[] = { 1, 2, 3, 4 };
int na = sizeof(a) / sizeof(a[0]);
double b[] = { 5, 6, 7 };
int nb = sizeof(b) / sizeof(b[0]);
int nc = 20;
double c[nc];
double zl[] = { 1, 2, 3, 4 };
int nzl = sizeof(zl) / sizeof(zl[0]);
double zk = 1;
int nr = nzl + 1;
double r[nr];
complex szero[] = { { 1, 2 }, { 3, 4 } };
complex spole[] = { { 5, 6 }, { 7, 8 } };
complex szerok = { 9, 0 };
complex spolek = { 1, 0 };
int nszero = sizeof(szero) / sizeof(szero[0]);
int nspole = sizeof(spole) / sizeof(spole[0]);
int nrzero = nszero + 1;
complex rzero[nrzero];
int nrpole = nspole + 1;
complex rpole[nrpole];
printf("a (%d):\n", na);
print_polynom(a, na, 'x');
printf("b (%d):\n", nb);
print_polynom(b, nb, 'x');
clear_polynom(c, nc);
expand_polynom(a, na, b, nb, c);
printf("c (%d):\n", nc);
print_polynom(c, nc, 'x');
clear_polynom(c, nc);
pow_polynom(a, na, 2, c);
printf("c (%d):\n", nc);
print_polynom(c, nc, 'x');
expand_zerolist(zl, nzl, zk, r);
printf("r (%d):\n", nr);
print_polynom(r, nr, 'x');
expand_zerolist_c(szero, nszero, szerok, rzero);
expand_zerolist_c(spole, nspole, spolek, rpole);
print_polynom_nd_c(rzero, nrzero, rpole, nrpole, 's', "zp nd");
return 0;
}