Routine determ computes the determinant of a square matrix represented as a list of lists of numbers.
(rp n) produces a degree n polynomial f(x) with random rational coefficients. ((rp n) x) = f(x).
(el n x y) is a list of the (n+1)(n+2)/2 products of powers of x and y, and of degree ≤ n. For instance (el 3 x y) is the list (x3 x2y xy2 y3 x2 xy y2 x y 1).
(mat n) produces a square matrix by choosing (n+1)(n+1)/2 points along the parametric curve with random rational parameter values. Each row of the determinant is (el n x y) for one of these points. If the determinant of such a matrix is 0, then for some nth degree plane curve all the points lie on that curve.
A n-list is a list of (n−1)-lists. A 0-list is a real.
((cmp n) f): (((cmp 0) f) x) = x.
(((cmp (+ n 1)) f) x) = (f (((cmp n) f) x)).
((cmp 3) car) = caaar; ((cmp n) f) = fn.
((G2 f) x y) = (map f x y) but allowing short inputs.
((G2 cons) '(2 3 4 5 6) '(8 9)) => ((2 . 8) (3 . 9) 4 5 6)
((G2 cons) '(2 3 4) '(5 6 7 8 9)) => ((2 . 5) (3 . 6) (4 . 7) 8 9)
((Gs +) 3 '( 5 6 7)) => (8 9 10)
A polynomial of n variables is coded as an n-list whose elements are coefficients of the first variable. The coefficients are polynomials in n−1 variables and coded as (n−1)-lists.
If c is an n-list then (pf n c) is an n-curried polynomial in n variables.
(pf 0 c) is c which is presumably a number.
(((pf 2 '((2 5) (7))) x) y) => 7x+5y+2
(((pf 2 '((2 5) (7))) 3) 5) => 48
(rp k n) produces a coded degree n polynomial of k variables, with random rational coefficients. (rp 2 n) is thus suitable for triangular Béziers.
(el n x y z) is a list of the products of powers of x, y and z, and of degree ≤ n.
For instance (el 2 x y z) is the list (1 z z2 y yz y2 x xz xy x2)
The list has (n+1)(n+2)(n+3)/6 elements.
I want 3 random 3rd degree polynomials in two variables to parametrically define a 2D surface in 3D. Then I want 20 points (number pairs) which produce a triple via the three polynomials. This gives 20 triples which fed to el produces 20 lists of 20 reals. Then we compute the determinant of this matrix.
The determinant is 0 for first degree parametric functions, but not zero for degrees 2 and 3!