#include <stdio.h> #include <numeric.h> #define N 3 /* data array size */ #define M 2 /* response array size */ int main() { int i; array double complex v[N],u[M],q[N+M-2],r[2*N-1]; array double v1[N],u1[M],q1[N+M-2],r1[2*N-1]; v[0]=complex(1,1);v[1]=complex(2,2);v[2]=0; v1[0]=1;v1[1]=2;v1[2]=0; for (i=0;i<M;i++) { u[i]=complex(i+1,i); u1[i]=i+1; } printf("Coef. of polynomial v=%6.3f\n", v); printf("Coef. of polynomial u=%6.3f\n", u); polyder2(q, NULL, u, v); /* derivative of v*u polynomial */ printf("Coef. of derivative of polynomial of v*u=%4.2f\n", q); printf("\n"); polyder2(q, r, u, v); /* derivative of u/v polynomial */ printf("Coef. of derivative of polynomial of u/v\n"); printf("Numerator: %4.2f\n", q); printf("Denormator:%4.2f\n", r); printf("Coef. of polynomial v=%6.3f\n", v1); printf("Coef. of polynomial u=%6.3f\n", u1); polyder2(q1, NULL, u1, v1); /* derivative of b*a polynomial */ printf("Coef. of derivative of polynomial of b*a=%6.3f\n", q1); printf("\n"); polyder2(q1, r1, u1, v1); /* derivative of a/b polynomial */ printf("Coef. of derivative of polynomial of a/b=\n"); printf("Numerator: %6.3f\n", q1); printf("Denormator:%6.3f\n", r1); }
Coef. of polynomial v=complex( 1.000, 1.000) complex( 2.000, 2.000) complex( 0.000, 0.000) Coef. of polynomial u=complex( 1.000, 0.000) complex( 2.000, 1.000) Coef. of derivative of polynomial of v*u=complex(3.00,3.00) complex(2.00,6.00) complex(0.00,0.00) Coef. of derivative of polynomial of u/v Numerator: complex(-1.00,-1.00) complex(-2.00,-6.00) complex(0.00,0.00) Denormator:complex(0.00,2.00) complex(0.00,8.00) complex(0.00,0.00) complex(0.00,0.00) complex(0.00,0.00) Coef. of polynomial v= 1.000 2.000 0.000 Coef. of polynomial u= 1.000 2.000 Coef. of derivative of polynomial of b*a= 3.000 4.000 0.000 Coef. of derivative of polynomial of a/b= Numerator: -1.000 -4.000 0.000 Denormator: 1.000 4.000 0.000 0.000 0.000