00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <it/io.h>
00025 #include <it/vec.h>
00026 #include <it/poly.h>
00027
00028 int main ()
00029 {
00030 vec P0 = vec_new_string ("1 6 1");
00031 vec P1 = vec_new_string ("4 4");
00032 vec R;
00033
00034 pvec V;
00035 pmat M;
00036
00037
00038 R = vec_clone (P0);
00039 it_printf ("%P + %P = %P\n", P0, P1, poly_add (R, P1));
00040 vec_copy (R, P0);
00041 it_printf ("%P - %P = %P\n", P0, P1, poly_sub (R, P1));
00042 vec_copy (R, P0);
00043 it_printf ("%P * %P = %P\n", P0, P1, poly_mul (R, P1));
00044 vec_copy (R, P0);
00045 it_printf ("%P / %P = %P\n", P0, P1, poly_div (R, P1));
00046 vec_copy (R, P0);
00047 it_printf ("%P %% %P = %P\n", P0, P1, poly_mod (R, P1));
00048 vec_copy (R, P0);
00049 it_printf ("gcd(%P, %P) = %P\n", P0, P1, poly_gcd (R, P1));
00050 vec_delete (R);
00051
00052
00053 it_printf ("%P(1.5) = %f\n", P0, poly_eval (P0, 1.5));
00054
00055
00056 V = pvec_new (2);
00057 M = pmat_new (2, 2);
00058 V[0] = P0;
00059 V[1] = P1;
00060 M[0][0] = P0;
00061 M[0][1] = P1;
00062 M[1][0] = P1;
00063 M[1][1] = P0;
00064 it_printf ("V = $P\n", V);
00065 it_printf ("M = #P\n", M);
00066
00067 return 0;
00068 }