]> gitweb.factorcode.org Git - factor.git/commitdiff
Moved math.polynomials to extra
authorAaron Schaefer <aaron@elasticdog.com>
Tue, 18 Nov 2008 15:19:29 +0000 (10:19 -0500)
committerAaron Schaefer <aaron@elasticdog.com>
Tue, 18 Nov 2008 15:19:29 +0000 (10:19 -0500)
basis/math/polynomials/authors.txt [new file with mode: 0644]
basis/math/polynomials/polynomials-docs.factor [new file with mode: 0644]
basis/math/polynomials/polynomials-tests.factor [new file with mode: 0644]
basis/math/polynomials/polynomials.factor [new file with mode: 0644]
basis/math/polynomials/summary.txt [new file with mode: 0644]
extra/math/polynomials/authors.txt [deleted file]
extra/math/polynomials/polynomials-docs.factor [deleted file]
extra/math/polynomials/polynomials-tests.factor [deleted file]
extra/math/polynomials/polynomials.factor [deleted file]
extra/math/polynomials/summary.txt [deleted file]

diff --git a/basis/math/polynomials/authors.txt b/basis/math/polynomials/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/math/polynomials/polynomials-docs.factor b/basis/math/polynomials/polynomials-docs.factor
new file mode 100644 (file)
index 0000000..08b7ca7
--- /dev/null
@@ -0,0 +1,94 @@
+USING: help.markup help.syntax math sequences ;
+IN: math.polynomials
+
+ARTICLE: "polynomials" "Polynomials"
+"A polynomial is a vector with the highest powers on the right:"
+{ $code "{ 1 1 0 1 } -> 1 + x + x^3" "{ } -> 0" }
+"Numerous words are defined to help with polynomial arithmetic:"
+{ $subsection p= }
+{ $subsection p+ }
+{ $subsection p- }
+{ $subsection p* }
+{ $subsection p-sq }
+{ $subsection powers }
+{ $subsection n*p }
+{ $subsection p/mod }
+{ $subsection pgcd }
+{ $subsection polyval }
+{ $subsection pdiff }
+{ $subsection pextend-conv }
+{ $subsection ptrim }
+{ $subsection 2ptrim } ;
+
+ABOUT: "polynomials"
+
+HELP: powers
+{ $values { "n" integer } { "x" number } { "seq" sequence } }
+{ $description "Output a sequence having " { $snippet "n" } " elements in the format: " { $snippet "{ 1 x x^2 x^3 ... }" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "4 2 powers ." "{ 1 2 4 8 }" } } ;
+
+HELP: p=
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "?" "a boolean" } }
+{ $description "Tests if two polynomials are equal." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 } { 0 1 0 } p= ." "t" } } ;
+
+HELP: ptrim
+{ $values { "p" "a polynomial" } { "p" "a polynomial" } }
+{ $description "Trims excess zeros from a polynomial." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } ptrim ." "{ 0 1 }" } } ;
+
+HELP: 2ptrim
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
+{ $description "Trims excess zeros from two polynomials." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ;
+
+HELP: p+
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
+{ $description "Adds " { $snippet "p" } " and " { $snippet "q" } " component-wise." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } p+ ." "{ 1 1 1 }" } } ;
+
+HELP: p-
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
+{ $description "Subtracts " { $snippet "q" } " from " { $snippet "p" } " component-wise." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 } { 0 1 } p- ." "{ 1 0 1 }" } } ;
+
+HELP: n*p
+{ $values { "n" number } { "p" "a polynomial" } { "n*p" "a polynomial" } }
+{ $description "Multiplies each element of " { $snippet "p" } " by " { $snippet "n" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "4 { 3 0 1 } n*p ." "{ 12 0 4 }" } } ;
+
+HELP: pextend-conv
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
+{ $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ;
+
+HELP: p*
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
+{ $description "Multiplies two polynomials." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 3 0 0 0 } { 1 2 0 0 } p* ." "{ 1 4 7 6 0 0 0 0 0 }" } } ;
+
+HELP: p-sq
+{ $values { "p" "a polynomial" } { "p^2" "a polynomial" } }
+{ $description "Squares a polynomial." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 0 } p-sq ." "{ 1 4 4 0 0 }" } } ;
+
+HELP: p/mod
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } }
+{ $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ;
+
+HELP: pgcd
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "a" "a polynomial" } { "d" "a polynomial" } }
+{ $description "Computes the greatest common divisor " { $snippet "d" } " of " { $snippet "p" } " and " { $snippet "q" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*q = d mod p" } }
+{ $notes "GCD in the case of polynomials is a monic polynomial of the highest possible degree that divides into both " { $snippet "p" } " and " { $snippet "q" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1} { 1 1 } pgcd swap . ." "{ 0 0 }\n{ 1 1 }" } } ;
+
+HELP: pdiff
+{ $values { "p" "a polynomial" } { "p'" "a polynomial" } }
+{ $description "Finds the derivative of " { $snippet "p" } "." } ;
+
+HELP: polyval
+{ $values { "p" "a polynomial" } { "x" number } { "p[x]" number } }
+{ $description "Evaluate " { $snippet "p" } " with the input " { $snippet "x" } "." }
+{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } 2 polyval ." "5" } } ;
+
diff --git a/basis/math/polynomials/polynomials-tests.factor b/basis/math/polynomials/polynomials-tests.factor
new file mode 100644 (file)
index 0000000..cd88d19
--- /dev/null
@@ -0,0 +1,30 @@
+USING: kernel math math.polynomials tools.test ;
+IN: math.polynomials.tests
+
+[ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test
+[ { 1 } ] [ { 1 0 0 } ptrim ] unit-test
+[ { 0 } ] [ { 0 } ptrim ] unit-test
+[ { 3 10 8 } ] [ { 1 2 } { 3 4 } p* ] unit-test
+[ { 3 10 8 } ] [ { 3 4 } { 1 2 } p* ] unit-test
+[ { 0 0 0 0 0 0 0 0 0 0 } ] [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
+[ { 0 1 } ] [ { 0 1 } { 1 } p* ] unit-test
+[ { 0 } ] [ { } { } p* ] unit-test
+[ { 0 } ] [ { 0 } { } p* ] unit-test
+[ { 0 } ] [ { } { 0 } p* ] unit-test
+[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
+[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
+[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
+[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
+[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
+[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
+[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
+[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
+[ V{ 5.0 } V{ 0 } ] [ { 10.0 } { 2.0 } p/mod ] unit-test
+[ V{ 15/16 } V{ 0 } ] [ { 3/4 } { 4/5 } p/mod ] unit-test
+[ t ] [ { 0 1 } { 0 1 0 } p= ] unit-test
+[ f ] [ { 0 0 1 } { 0 1 0 } p= ] unit-test
+[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
+[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
+
diff --git a/basis/math/polynomials/polynomials.factor b/basis/math/polynomials/polynomials.factor
new file mode 100644 (file)
index 0000000..13090b6
--- /dev/null
@@ -0,0 +1,84 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays kernel make math math.order math.vectors sequences shuffle
+    splitting vectors ;
+IN: math.polynomials
+
+<PRIVATE
+
+: 2pad-left ( p q n -- p q ) [ 0 pad-left ] curry bi@ ;
+: 2pad-right ( p q n -- p q ) [ 0 pad-right ] curry bi@ ;
+: pextend ( p q -- p q ) 2dup [ length ] bi@ max 2pad-right ;
+: pextend-left ( p q -- p q ) 2dup [ length ] bi@ max 2pad-left ;
+: unempty ( seq -- seq ) [ { 0 } ] when-empty ;
+: 2unempty ( seq seq -- seq seq ) [ unempty ] bi@ ;
+
+PRIVATE>
+
+: powers ( n x -- seq )
+    <array> 1 [ * ] accumulate nip ;
+
+: p= ( p q -- ? ) pextend = ;
+
+: ptrim ( p -- p )
+    dup length 1 = [ [ zero? ] trim-right ] unless ;
+
+: 2ptrim ( p q -- p q ) [ ptrim ] bi@ ;
+: p+ ( p q -- r ) pextend v+ ;
+: p- ( p q -- r ) pextend v- ;
+: n*p ( n p -- n*p ) n*v ;
+
+: pextend-conv ( p q -- p q )
+    2dup [ length ] bi@ + 1- 2pad-right [ >vector ] bi@ ;
+
+: p* ( p q -- r )
+    2unempty pextend-conv <reversed> dup length
+    [ over length pick <slice> pick [ * ] 2map sum ] map 2nip reverse ;
+
+: p-sq ( p -- p^2 )
+    dup p* ;
+
+<PRIVATE
+
+: p/mod-setup ( p p -- p p n )
+    2ptrim
+    2dup [ length ] bi@ -
+    dup 1 < [ drop 1 ] when
+    [ over length + 0 pad-left pextend ] keep 1+ ;
+
+: /-last ( seq seq -- a )
+    #! divide the last two numbers in the sequences
+    [ peek ] bi@ / ;
+
+: (p/mod) ( p p -- p p )
+    2dup /-last
+    2dup , n*p swapd
+    p- >vector
+    dup pop* swap rest-slice ;
+
+PRIVATE>
+
+: p/mod ( p q -- z w )
+    p/mod-setup [ [ (p/mod) ] times ] V{ } make
+    reverse nip swap 2ptrim pextend ;
+
+<PRIVATE
+
+: (pgcd) ( b a y x -- a d )
+    dup V{ 0 } clone p= [
+        drop nip
+    ] [
+        tuck p/mod [ pick p* swap [ swapd p- ] dip ] dip (pgcd)
+    ] if ;
+
+PRIVATE>
+
+: pgcd ( p q -- a d )
+    swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] bi@ ;
+
+: pdiff ( p -- p' )
+    dup length v* { 0 } ?head drop ;
+
+: polyval ( p x -- p[x] )
+    [ dup length ] dip powers v. ;
+
diff --git a/basis/math/polynomials/summary.txt b/basis/math/polynomials/summary.txt
new file mode 100644 (file)
index 0000000..5c237a2
--- /dev/null
@@ -0,0 +1 @@
+Polynomial arithmetic
diff --git a/extra/math/polynomials/authors.txt b/extra/math/polynomials/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/extra/math/polynomials/polynomials-docs.factor b/extra/math/polynomials/polynomials-docs.factor
deleted file mode 100644 (file)
index 08b7ca7..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-USING: help.markup help.syntax math sequences ;
-IN: math.polynomials
-
-ARTICLE: "polynomials" "Polynomials"
-"A polynomial is a vector with the highest powers on the right:"
-{ $code "{ 1 1 0 1 } -> 1 + x + x^3" "{ } -> 0" }
-"Numerous words are defined to help with polynomial arithmetic:"
-{ $subsection p= }
-{ $subsection p+ }
-{ $subsection p- }
-{ $subsection p* }
-{ $subsection p-sq }
-{ $subsection powers }
-{ $subsection n*p }
-{ $subsection p/mod }
-{ $subsection pgcd }
-{ $subsection polyval }
-{ $subsection pdiff }
-{ $subsection pextend-conv }
-{ $subsection ptrim }
-{ $subsection 2ptrim } ;
-
-ABOUT: "polynomials"
-
-HELP: powers
-{ $values { "n" integer } { "x" number } { "seq" sequence } }
-{ $description "Output a sequence having " { $snippet "n" } " elements in the format: " { $snippet "{ 1 x x^2 x^3 ... }" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "4 2 powers ." "{ 1 2 4 8 }" } } ;
-
-HELP: p=
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "?" "a boolean" } }
-{ $description "Tests if two polynomials are equal." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 } { 0 1 0 } p= ." "t" } } ;
-
-HELP: ptrim
-{ $values { "p" "a polynomial" } { "p" "a polynomial" } }
-{ $description "Trims excess zeros from a polynomial." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } ptrim ." "{ 0 1 }" } } ;
-
-HELP: 2ptrim
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
-{ $description "Trims excess zeros from two polynomials." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ;
-
-HELP: p+
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
-{ $description "Adds " { $snippet "p" } " and " { $snippet "q" } " component-wise." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } p+ ." "{ 1 1 1 }" } } ;
-
-HELP: p-
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
-{ $description "Subtracts " { $snippet "q" } " from " { $snippet "p" } " component-wise." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 } { 0 1 } p- ." "{ 1 0 1 }" } } ;
-
-HELP: n*p
-{ $values { "n" number } { "p" "a polynomial" } { "n*p" "a polynomial" } }
-{ $description "Multiplies each element of " { $snippet "p" } " by " { $snippet "n" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "4 { 3 0 1 } n*p ." "{ 12 0 4 }" } } ;
-
-HELP: pextend-conv
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
-{ $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ;
-
-HELP: p*
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } }
-{ $description "Multiplies two polynomials." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 3 0 0 0 } { 1 2 0 0 } p* ." "{ 1 4 7 6 0 0 0 0 0 }" } } ;
-
-HELP: p-sq
-{ $values { "p" "a polynomial" } { "p^2" "a polynomial" } }
-{ $description "Squares a polynomial." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 0 } p-sq ." "{ 1 4 4 0 0 }" } } ;
-
-HELP: p/mod
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } }
-{ $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ;
-
-HELP: pgcd
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "a" "a polynomial" } { "d" "a polynomial" } }
-{ $description "Computes the greatest common divisor " { $snippet "d" } " of " { $snippet "p" } " and " { $snippet "q" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*q = d mod p" } }
-{ $notes "GCD in the case of polynomials is a monic polynomial of the highest possible degree that divides into both " { $snippet "p" } " and " { $snippet "q" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1} { 1 1 } pgcd swap . ." "{ 0 0 }\n{ 1 1 }" } } ;
-
-HELP: pdiff
-{ $values { "p" "a polynomial" } { "p'" "a polynomial" } }
-{ $description "Finds the derivative of " { $snippet "p" } "." } ;
-
-HELP: polyval
-{ $values { "p" "a polynomial" } { "x" number } { "p[x]" number } }
-{ $description "Evaluate " { $snippet "p" } " with the input " { $snippet "x" } "." }
-{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } 2 polyval ." "5" } } ;
-
diff --git a/extra/math/polynomials/polynomials-tests.factor b/extra/math/polynomials/polynomials-tests.factor
deleted file mode 100644 (file)
index cd88d19..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-USING: kernel math math.polynomials tools.test ;
-IN: math.polynomials.tests
-
-[ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test
-[ { 1 } ] [ { 1 0 0 } ptrim ] unit-test
-[ { 0 } ] [ { 0 } ptrim ] unit-test
-[ { 3 10 8 } ] [ { 1 2 } { 3 4 } p* ] unit-test
-[ { 3 10 8 } ] [ { 3 4 } { 1 2 } p* ] unit-test
-[ { 0 0 0 0 0 0 0 0 0 0 } ] [ { 0 0 0 } { 0 0 0 0 0 0 0 0 } p* ] unit-test
-[ { 0 1 } ] [ { 0 1 } { 1 } p* ] unit-test
-[ { 0 } ] [ { } { } p* ] unit-test
-[ { 0 } ] [ { 0 } { } p* ] unit-test
-[ { 0 } ] [ { } { 0 } p* ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p+ ] unit-test
-[ { 0 0 0 } ] [ { 0 0 0 } { 0 0 0 } p- ] unit-test
-[ { 0 0 0 } ] [ 4 { 0 0 0 } n*p ] unit-test
-[ { 4 8 0 12 } ] [ 4 { 1 2 0 3 } n*p ] unit-test
-[ { 1 4 7 6 0 0 0 0 0 } ] [ { 1 2 3 0 0 0 } { 1 2 0 0 } p* ] unit-test
-[ V{ 7 -2 1 } V{ -20 0 0 } ] [ { 1 1 1 1 } { 3 1 } p/mod ] unit-test
-[ V{ 0 0 } V{ 1 1 } ] [ { 1 1 } { 1 1 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 } { 1 1 0 0 0 0 0 0 } p/mod ] unit-test
-[ V{ 1 0 1 } V{ 0 0 0 } ] [ { 1 1 1 1 0 0 0 0 } { 1 1 0 0 } p/mod ] unit-test
-[ V{ 5.0 } V{ 0 } ] [ { 10.0 } { 2.0 } p/mod ] unit-test
-[ V{ 15/16 } V{ 0 } ] [ { 3/4 } { 4/5 } p/mod ] unit-test
-[ t ] [ { 0 1 } { 0 1 0 } p= ] unit-test
-[ f ] [ { 0 0 1 } { 0 1 0 } p= ] unit-test
-[ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test
-[ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test
-
diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor
deleted file mode 100644 (file)
index 13090b6..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel make math math.order math.vectors sequences shuffle
-    splitting vectors ;
-IN: math.polynomials
-
-<PRIVATE
-
-: 2pad-left ( p q n -- p q ) [ 0 pad-left ] curry bi@ ;
-: 2pad-right ( p q n -- p q ) [ 0 pad-right ] curry bi@ ;
-: pextend ( p q -- p q ) 2dup [ length ] bi@ max 2pad-right ;
-: pextend-left ( p q -- p q ) 2dup [ length ] bi@ max 2pad-left ;
-: unempty ( seq -- seq ) [ { 0 } ] when-empty ;
-: 2unempty ( seq seq -- seq seq ) [ unempty ] bi@ ;
-
-PRIVATE>
-
-: powers ( n x -- seq )
-    <array> 1 [ * ] accumulate nip ;
-
-: p= ( p q -- ? ) pextend = ;
-
-: ptrim ( p -- p )
-    dup length 1 = [ [ zero? ] trim-right ] unless ;
-
-: 2ptrim ( p q -- p q ) [ ptrim ] bi@ ;
-: p+ ( p q -- r ) pextend v+ ;
-: p- ( p q -- r ) pextend v- ;
-: n*p ( n p -- n*p ) n*v ;
-
-: pextend-conv ( p q -- p q )
-    2dup [ length ] bi@ + 1- 2pad-right [ >vector ] bi@ ;
-
-: p* ( p q -- r )
-    2unempty pextend-conv <reversed> dup length
-    [ over length pick <slice> pick [ * ] 2map sum ] map 2nip reverse ;
-
-: p-sq ( p -- p^2 )
-    dup p* ;
-
-<PRIVATE
-
-: p/mod-setup ( p p -- p p n )
-    2ptrim
-    2dup [ length ] bi@ -
-    dup 1 < [ drop 1 ] when
-    [ over length + 0 pad-left pextend ] keep 1+ ;
-
-: /-last ( seq seq -- a )
-    #! divide the last two numbers in the sequences
-    [ peek ] bi@ / ;
-
-: (p/mod) ( p p -- p p )
-    2dup /-last
-    2dup , n*p swapd
-    p- >vector
-    dup pop* swap rest-slice ;
-
-PRIVATE>
-
-: p/mod ( p q -- z w )
-    p/mod-setup [ [ (p/mod) ] times ] V{ } make
-    reverse nip swap 2ptrim pextend ;
-
-<PRIVATE
-
-: (pgcd) ( b a y x -- a d )
-    dup V{ 0 } clone p= [
-        drop nip
-    ] [
-        tuck p/mod [ pick p* swap [ swapd p- ] dip ] dip (pgcd)
-    ] if ;
-
-PRIVATE>
-
-: pgcd ( p q -- a d )
-    swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] bi@ ;
-
-: pdiff ( p -- p' )
-    dup length v* { 0 } ?head drop ;
-
-: polyval ( p x -- p[x] )
-    [ dup length ] dip powers v. ;
-
diff --git a/extra/math/polynomials/summary.txt b/extra/math/polynomials/summary.txt
deleted file mode 100644 (file)
index 5c237a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Polynomial arithmetic