diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2022-10-30 03:42:11 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2022-10-30 03:42:11 +1300 |
commit | 95ebd2d6acfa744c5e93287cc6385f4f1359376e (patch) | |
tree | 87cea8951f3ef00b9ad53679c7fe70c208b0ec62 /src/polytest.ml | |
parent | 3f290e0d6c3ef1435253095de2cf53016855840e (diff) |
wallgen and wallsolve working, visualwall partially done, license added
Diffstat (limited to 'src/polytest.ml')
-rw-r--r-- | src/polytest.ml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/polytest.ml b/src/polytest.ml new file mode 100644 index 0000000..c378279 --- /dev/null +++ b/src/polytest.ml @@ -0,0 +1,51 @@ + + +(* 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 (); + + |