(* Programmed by Jedidiah Barber *) (* Licensed under the Sunset License v1.0 *) let _ = let p1 = Poly.of_list Z.( [(~$1,~$2);(~$7,~$1);(~$3,~$0)] ) in print_string "dividend: "; Poly.print p1; print_newline (); let p2 = Poly.of_list Z.( [(~$1,~$1);(~$(-1),~$0)] ) in print_string "divisor: "; Poly.print p2; print_newline (); let (p3,p4) = Poly.div_rem p1 p2 in print_string "quotient: "; Poly.print p3; print_newline (); print_string "remainder: "; Poly.print p4; print_newline (); let p5 = Poly.add (Poly.mul p3 p2) p4 in print_string "reconstituted: "; Poly.print p5; print_newline (); print_newline (); let p6 = Poly.of_list Z.( [(~$(-3),~$2);(~$7,~$0)] ) in print_string "dividend: "; Poly.print p6; print_newline (); let p7 = Poly.of_list Z.( [(~$2,~$1);(~$2,~$0)] ) in print_string "divisor: "; Poly.print p7; print_newline (); let (p8,p9) = Poly.div_rem p6 p7 in print_string "quotient: "; Poly.print p8; print_newline (); print_string "remainder: "; Poly.print p9; print_newline (); let p10 = Poly.add (Poly.mul p8 p7) p9 in print_string "reconstituted: "; Poly.print p10; print_newline (); print_newline (); let p11 = Poly.of_list Z.( [(~$1,~$8);(~$(-1),~$0)] ) in print_string "dividend: "; Poly.print p11; print_newline (); let p12 = Poly.of_list Z.( [(~$1,~$1);(~$(-1),~$0)] ) in print_string "divisor: "; Poly.print p12; print_newline (); let (p13,p14) = Poly.div_rem p11 p12 in print_string "quotient: "; Poly.print p13; print_newline (); print_string "remainder: "; Poly.print p14; print_newline (); let p15 = Poly.add (Poly.mul p13 p12) p14 in print_string "reconstituted: "; Poly.print p15; print_newline ();