diff --git a/changelog b/changelog index 5c96725..0826802 100644 --- a/changelog +++ b/changelog @@ -1,7 +1,10 @@ -20090606 tpd src/axiom-website/patches.html 20090607.02.tpd.patch -20090606 tpd books/bookvol10.4 MAPPKG2 +-> conversion -20090606 tpd src/axiom-website/patches.html 20090607.01.tpd.patch -20090606 tpd books/bookvol10.4 MAPPGK1 +-> conversion +20090607 tpd src/axiom-website/patches.html 20090607.03.tpd.patch +20090607 tpd src/input/Makefile add tpiezas.input algebraic identities +20090607 tpd src/input/tpiezas.input CATS tests of algebraic identities +20090607 tpd src/axiom-website/patches.html 20090607.02.tpd.patch +20090607 tpd books/bookvol10.4 MAPPKG2 +-> conversion +20090607 tpd src/axiom-website/patches.html 20090607.01.tpd.patch +20090607 tpd books/bookvol10.4 MAPPGK1 +-> conversion 20090606 tpd src/axiom-website/patches.html 20090606.07.tpd.patch 20090606 tpd books/bookvol10.4 MKUCFUNC +-> conversion 20090606 tpd src/axiom-website/patches.html 20090606.06.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 9c71f66..8ec5f5d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -1481,5 +1481,7 @@ bookvol10.4 MKUCFUNC +-> conversion
bookvol10.4 MAPPGK1 +-> conversion
20090607.02.tpd.patch bookvol10.4 MAPPGK2 +-> conversion
+20090607.03.tpd.patch +tpieazas.input CATS tests of algebraic identites
diff --git a/src/input/Makefile.pamphlet b/src/input/Makefile.pamphlet index 536385f..f92241d 100644 --- a/src/input/Makefile.pamphlet +++ b/src/input/Makefile.pamphlet @@ -384,6 +384,7 @@ REGRES= algaggr.regress algbrbf.regress algfacob.regress alist.regress \ symbol.regress t111293.regress table.regress tancot.regress \ tanhcoth.regress tanatan.regress tbagg.regress test.regress \ textfile.regress torus.regress \ + tpiezas.regress \ triglim.regress tsetcatvermeer.regress tutchap1.regress \ typetower.regress void.regress uniseg.regress \ unittest1.regress unittest2.regress unittest3.regress unittest4.regress @@ -692,6 +693,7 @@ FILES= ${OUT}/algaggr.input ${OUT}/algbrbf.input ${OUT}/algfacob.input \ ${OUT}/table.input ${OUT}/tancot.input ${OUT}/tanhcoth.input \ ${OUT}/tanatan.input ${OUT}/tbagg.input ${OUT}/test.input \ ${OUT}/tetra.input ${OUT}/textfile.input ${OUT}/tknot.input \ + ${OUT}/tpiezas.input \ ${OUT}/tree.input \ ${OUT}/triglim.input ${OUT}/tschirn.input ${OUT}/tsetcatbutcher.input \ ${OUT}/tsetcatchemical.input ${OUT}/tsetcatvermeer.input \ @@ -1049,7 +1051,9 @@ DOCFILES= \ ${DOC}/tbagg.input.dvi \ ${DOC}/test.input.dvi ${DOC}/tetra.input.dvi \ ${DOC}/textfile.input.dvi ${DOC}/tknot.input.dvi \ - ${DOC}/torus.input.dvi ${DOC}/tree.input.dvi \ + ${DOC}/torus.input.dvi \ + ${DOC}/tpiezas.input.dvi \ + ${DOC}/tree.input.dvi \ ${DOC}/triglim.input.dvi ${DOC}/tschirn.input.dvi \ ${DOC}/tsetcatbutcher.input.dvi \ ${DOC}/tsetcatchemical.input.dvi \ diff --git a/src/input/tpiezas.input.pamphlet b/src/input/tpiezas.input.pamphlet new file mode 100644 index 0000000..f60ad7e --- /dev/null +++ b/src/input/tpiezas.input.pamphlet @@ -0,0 +1,829 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/input tpiezas.input} +\author{Timothy Daly} +\maketitle +\begin{abstract} +This is from ``A Collection of Algebraic Identities'' by T. Piezas III\cite{1} +\end{abstract} +\eject +\tableofcontents +\eject +\section{Part 1. Assorted Identities} +\begin{chunk}{*} +)set break resume +)spool tpiezas.output +)set message test on +)set message auto off +)clear all +\end{chunk} + +\subsection{E. Maillet} +\[(a+b)^3+(a+c)^3+(a+d)^3+(a-b)^3+(a-c)^3+(a-d)^3 = 6a(a^2+b^2+c^2+d^2)\] +\begin{chunk}{*} +--S 1 of 63 +t1a:=(a+b)^3 + (a+c)^3 + (a+d)^3 + (a-b)^3 + (a-c)^3 + (a-d)^3 +--R +--R +--R 2 2 2 3 +--R (1) 6a d + 6a c + 6a b + 6a +--R Type: Polynomial Integer +--E 1 + +--S 2 of 63 +t1b:=6*a*(a^2+b^2+c^2+d^2) +--R +--R +--R 2 2 2 3 +--R (2) 6a d + 6a c + 6a b + 6a +--R Type: Polynomial Integer +--E 2 + +--S 3 of 63 +t1a-t1b +--R +--R +--R (3) 0 +--R Type: Polynomial Integer +--E 3 +\end{chunk} + +\subsection{E. Lucas-Liouville} +\[\begin{array}{ll} +(a+b)^k+(a+c)^k+(a+d)^k+(b+c)^k+(b+d)^k+(c+d)^k+\\ +(a-b)^k+(a-c)^k+(a-d)^k+(b-c)^k+(b-d)^k+(c-d)^k +\end{array}\] +\[=6(a^2+b^2+c^2+d^2)^{k/2}\quad {\rm\ for\ }k=2,4\] +\begin{chunk}{*} +--S 4 of 63 +t2a(k)==(a+b)^k + (a+c)^k + (a+d)^k + (b+c)^k + (b+d)^k + (c+d)^k +_ + (a-b)^k + (a-c)^k + (a-d)^k + (b-c)^k + (b-d)^k + (c-d)^k +--R +--R Type: Void +--E 4 + +--S 5 of 63 +t2b(k)==6*(a^2+b^2+c^2+d^2)^(k/2) +--R +--R Type: Void +--E 5 + +--S 6 of 63 +t2a(k) +--R +--R Compiling function t2a with type Variable k -> Expression Integer +--R +--R (6) +--R k k k k k k +--R (d + c) + (d + b) + (d + a) + (c + b) + (c + a) + (b + a) +--R + +--R k k k k k k +--R (- b + a) + (- c + b) + (- c + a) + (- d + c) + (- d + b) + (- d + a) +--R Type: Expression Integer +--E 6 + +--S 7 of 63 +t2b(k) +--R +--R Compiling function t2b with type Variable k -> Expression Integer +--R +--R k +--R - +--R 2 2 2 2 2 +--R (7) 6(d + c + b + a ) +--R Type: Expression Integer +--E 7 + +--S 8 of 63 +t2a(2) +--R +--R Compiling function t2a with type PositiveInteger -> Polynomial +--R Integer +--R +--R 2 2 2 2 +--R (8) 6d + 6c + 6b + 6a +--R Type: Polynomial Integer +--E 8 + +--S 9 of 63 +t2b(2) +--R +--R Compiling function t2b with type PositiveInteger -> Expression +--R Integer +--R +--R 2 2 2 2 +--R (9) 6d + 6c + 6b + 6a +--R Type: Expression Integer +--E 9 + +--S 10 of 63 +t2a(2)-t2b(2) +--R +--R +--R (10) 0 +--R Type: Expression Integer +--E 10 + +--S 11 of 63 +t2a(4) +--R +--R +--R (11) +--R 4 2 2 2 2 4 2 2 2 4 2 2 4 +--R 6d + (12c + 12b + 12a )d + 6c + (12b + 12a )c + 6b + 12a b + 6a +--R Type: Polynomial Integer +--E 11 + +--S 12 of 63 +t2b(4) +--R +--R +--R (12) +--R 4 2 2 2 2 4 2 2 2 4 2 2 4 +--R 6d + (12c + 12b + 12a )d + 6c + (12b + 12a )c + 6b + 12a b + 6a +--R Type: Expression Integer +--E 12 + +--S 13 of 63 +t2a(4)-t2b(4) +--R +--R +--R (13) 0 +--R Type: Expression Integer +--E 13 +\end{chunk} + +\subsection{Boutin's Identity} +\[S\pm(x_1\pm x_2\pm \ldots \pm x_k)^k = k!\: 2^{k-1} x_1 x_2 \ldots x_k\] +where the exterior sign is the product of the interior signs so +the term is negative if there is an odd number of negative interior signs, +otherwise positive +\begin{chunk}{*} + +--S 14 of 63 +t3a1 := (a+b)^2 - (a-b)^2 +--R +--R +--R (14) 4a b +--R Type: Polynomial Integer +--E 14 + +--S 15 of 63 +t3b1 := 4*a*b +--R +--R +--R (15) 4a b +--R Type: Polynomial Integer +--E 15 + +--S 16 of 63 +t3a1-t3b1 +--R +--R +--R (16) 0 +--R Type: Polynomial Integer +--E 16 + +--S 17 of 63 +t3a2 := (a+b+c)^3 - (a-b+c)^3 - (a+b-c)^3 + (a-b-c)^3 +--R +--R +--R (17) 24a b c +--R Type: Polynomial Integer +--E 17 + +--S 18 of 63 +t3b2 := 24*a*b*c +--R +--R +--R (18) 24a b c +--R Type: Polynomial Integer +--E 18 + +--S 19 of 63 +t3a2-t3b2 +--R +--R +--R (19) 0 +--R Type: Polynomial Integer +--E 19 + +--S 20 of 63 +t3a3 := (a+b+c+d)^4 - (a-b+c+d)^4 - (a+b-c+d)^4 - (a+b+c-d)^4 + + (a-b-c+d)^4 + (a-b+c-d)^4 + (a+b-c-d)^4 - (a-b-c-d)^4 +--R +--R +--R (20) 192a b c d +--R Type: Polynomial Integer +--E 20 + +--S 21 of 63 +t3b3 := 192*a*b*c*d +--R +--R +--R (21) 192a b c d +--R Type: Polynomial Integer +--E 21 + +--S 22 of 63 +t3a3-t3b3 +--R +--R +--R (22) 0 +--R Type: Polynomial Integer +--E 22 + +\end{chunk} +We can create the general case using some functions. + +The ``bitlist'' function creates a list of the sign changes needed +to form each term. If a term is 4 variables long we need all possible +combinations of 3 signs. In order to generate this we create a list +of all possible bit combinations of the numbers from 0 to $2^{n-1}-1$, +which for the case of 4 would be from 0 to 7: +\begin{verbatim} + [[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]] +\end{verbatim} +We do this using an outer loop to generate the correct number of lists +and an inner loop to create each list. +\begin{chunk}{*} +--S 23 of 63 +bitlist(size:Integer):List List INT == + result:List List INT:=[] + size <= 1 => result + bound:PI:=size-1 + bitlength:INT:=2^bound + for i in (bitlength-1)::PI..0 by -1 repeat + t1:=[1::INT for k in 1..bound] + for j in 0..(#t1-1) repeat + if not bit?(i,j) then t1(bound-j):=0 + result:=cons(t1,result) + result +--R +--R Function declaration bitlist : Integer -> List List Integer has been +--R added to workspace. +--R Type: Void +--E 23 + +\end{chunk} +These are the test cases. +\begin{chunk}{*} +--S 24 of 63 +bitlist(1) +--R +--R Compiling function bitlist with type Integer -> List List Integer +--R +--R (24) [] +--R Type: List List Integer +--E 24 + +--S 25 of 63 +bitlist(2) +--R +--I Compiling function G7153 with type Integer -> Boolean +--I Compiling function G7332 with type NonNegativeInteger -> Boolean +--R +--R (25) [[0],[1]] +--R Type: List List Integer +--E 25 + +--S 26 of 63 +bitlist(3) +--R +--R +--R (26) [[0,0],[0,1],[1,0],[1,1]] +--R Type: List List Integer +--E 26 + +--S 27 of 63 +bitlist(4) +--R +--R +--R (27) [[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]] +--R Type: List List Integer +--E 27 + +\end{chunk} + +Now we need a function to generate a list of subscripted symbols +\begin{chunk}{*} +--S 28 of 63 +symgen(var:Symbol,size:PI):List Symbol == [var.[i] for i in size..1 by -1] +--R +--R Function declaration symgen : (Symbol,PositiveInteger) -> List +--R Symbol has been added to workspace. +--R Type: Void +--E 28 + +--S 29 of 63 +symgen('a,4) +--R +--R Compiling function symgen with type (Symbol,PositiveInteger) -> List +--R Symbol +--R +--R (29) [a ,a ,a ,a ] +--R 4 3 2 1 +--R Type: List Symbol +--E 29 + +\end{chunk} + +This is a function to generate the terms for Boutin's Identity. +Each term is of the form: +\[sign * (x_n\pm x_{n-1}\\pm \ldots \pm x_1)^n\] +where the sign is negative if the number of minus signs in the term is odd +\begin{chunk}{*} +--S 30 of 63 +term(size:PI,signs:List INT):Polynomial Integer == + syms:=symgen('x,size) + t1:POLY(INT):=first syms + sign:INT:=if odd? size then 1 else -1 + for i in 1..#signs repeat + if (signs.i = 0) + then t1:=t1-syms.(i+1) + else ( t1:=t1+syms.(i+1) ; sign:=sign*-1 ) + sign*(t1^size) +--R +--R Function declaration term : (PositiveInteger,List Integer) -> +--R Polynomial Integer has been added to workspace. +--R Type: Void +--E 30 +\end{chunk} +Now we test it by hand for the case $n=4$ +\begin{chunk}{*} + +--S 31 of 63 +factor term(4,[0,0,0]) +--R +--R Compiling function term with type (PositiveInteger,List Integer) -> +--R Polynomial Integer +--R +--R 4 +--R (31) - (x - x - x - x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 31 + +--S 32 of 63 +factor term(4,[0,0,1]) +--R +--R +--R 4 +--R (32) (x - x - x + x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 32 + +--S 33 of 63 +factor term(4,[0,1,0]) +--R +--R +--R 4 +--R (33) (x - x + x - x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 33 + +--S 34 of 63 +factor term(4,[0,1,1]) +--R +--R +--R 4 +--R (34) - (x - x + x + x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 34 + +--S 35 of 63 +factor term(4,[1,0,0]) +--R +--R +--R 4 +--R (35) (x + x - x - x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 35 + +--S 36 of 63 +factor term(4,[1,0,1]) +--R +--R +--R 4 +--R (36) - (x + x - x + x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 36 + +--S 37 of 63 +factor term(4,[1,1,0]) +--R +--R +--R 4 +--R (37) - (x + x + x - x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 37 + +--S 38 of 63 +factor term(4,[1,1,1]) +--R +--R +--R 4 +--R (38) (x + x + x + x ) +--R 4 3 2 1 +--R Type: Factored Polynomial Integer +--E 38 + +\end{chunk} +And we test combining the terms using the bitlist function call. +\begin{chunk}{*} +--S 39 of 63 +map(x+->factor(term(1,x)),bitlist(1)) +--R +--R +--R (39) [] +--R Type: List Factored Polynomial Integer +--E 39 + +--S 40 of 63 +map(x+->factor(term(2,x)),bitlist(2)) +--R +--R +--R 2 2 +--R (40) [- (x - x ) ,(x + x ) ] +--R 2 1 2 1 +--R Type: List Factored Polynomial Integer +--E 40 + +--S 41 of 63 +map(x+->factor(term(3,x)),bitlist(3)) +--R +--R +--R 3 3 3 3 +--R (41) [(x - x - x ) ,- (x - x + x ) ,- (x + x - x ) ,(x + x + x ) ] +--R 3 2 1 3 2 1 3 2 1 3 2 1 +--R Type: List Factored Polynomial Integer +--E 41 + +--S 42 of 63 +map(x+->factor(term(4,x)),bitlist(4)) +--R +--R +--R (42) +--R 4 4 4 +--R [- (x - x - x - x ) , (x - x - x + x ) , (x - x + x - x ) , +--R 4 3 2 1 4 3 2 1 4 3 2 1 +--R 4 4 4 +--R - (x - x + x + x ) , (x + x - x - x ) , - (x + x - x + x ) , +--R 4 3 2 1 4 3 2 1 4 3 2 1 +--R 4 4 +--R - (x + x + x - x ) , (x + x + x + x ) ] +--R 4 3 2 1 4 3 2 1 +--R Type: List Factored Polynomial Integer +--E 42 + +\end{chunk} +Next we have two functions, one to create a generic left hand side +of Boutin's Identity: +\begin{chunk}{*} +--S 43 of 63 +lhs(size:PI):POLY(INT) == + size = 1 => 0::POLY(INT) + reduce(+,map(x+->term(size,x),bitlist(size))) +--R +--R Function declaration lhs : PositiveInteger -> Polynomial Integer has +--R been added to workspace. +--R Type: Void +--E 43 + +\end{chunk} +and one to create a generic right hand side of Boutin's Identity: +\begin{chunk}{*} +--S 44 of 63 +rhs(size:PI):POLY(INT) == + size = 1 => 0 + bound:PI:=(size-1) + factorial(size)*2^bound*reduce(*,symgen('x,size))@POLY(INT) +--R +--R Function declaration rhs : PositiveInteger -> Polynomial Integer has +--R been added to workspace. +--R Type: Void +--E 44 + +\end{chunk} +Now we look at the case where $n=2$, showing the factors, the left +hand side, the right hand side, and the fact that they are equal +by subtraction +\begin{chunk}{*} +--S 45 of 63 +map(x+->factor term(2,x),bitlist(2)) +--R +--R +--R 2 2 +--R (45) [- (x - x ) ,(x + x ) ] +--R 2 1 2 1 +--R Type: List Factored Polynomial Integer +--E 45 + +--S 46 of 63 +lhs(2) +--R +--R Compiling function lhs with type PositiveInteger -> Polynomial +--R Integer +--R +--R (46) 4x x +--R 1 2 +--R Type: Polynomial Integer +--E 46 + +--S 47 of 63 +rhs(2) +--R +--R Compiling function rhs with type PositiveInteger -> Polynomial +--R Integer +--R +--R (47) 4x x +--R 1 2 +--R Type: Polynomial Integer +--E 47 + +--S 48 of 63 +lhs(2)-rhs(2) +--R +--R +--R (48) 0 +--R Type: Polynomial Integer +--E 48 + +\end{chunk} +Now we look at the case where $n=3$, showing the factors, the left +hand side, the right hand side, and the fact that they are equal +by subtraction +\begin{chunk}{*} +--S 49 of 63 +map(x+->factor term(3,x),bitlist(3)) +--R +--R +--R 3 3 3 3 +--R (49) [(x - x - x ) ,- (x - x + x ) ,- (x + x - x ) ,(x + x + x ) ] +--R 3 2 1 3 2 1 3 2 1 3 2 1 +--R Type: List Factored Polynomial Integer +--E 49 + +--S 50 of 63 +lhs(3) +--R +--R +--R (50) 24x x x +--R 1 2 3 +--R Type: Polynomial Integer +--E 50 + +--S 51 of 63 +rhs(3) +--R +--R +--R (51) 24x x x +--R 1 2 3 +--R Type: Polynomial Integer +--E 51 + +--S 52 of 63 +lhs(3)-rhs(3) +--R +--R +--R (52) 0 +--R Type: Polynomial Integer +--E 52 + +\end{chunk} +Now we look at the case where $n=4$, showing the factors, the left +hand side, the right hand side, and the fact that they are equal +by subtraction +\begin{chunk}{*} +--S 53 of 63 +map(x+->factor term(4,x),bitlist(4)) +--R +--R +--R (53) +--R 4 4 4 +--R [- (x - x - x - x ) , (x - x - x + x ) , (x - x + x - x ) , +--R 4 3 2 1 4 3 2 1 4 3 2 1 +--R 4 4 4 +--R - (x - x + x + x ) , (x + x - x - x ) , - (x + x - x + x ) , +--R 4 3 2 1 4 3 2 1 4 3 2 1 +--R 4 4 +--R - (x + x + x - x ) , (x + x + x + x ) ] +--R 4 3 2 1 4 3 2 1 +--R Type: List Factored Polynomial Integer +--E 53 + +--S 54 of 63 +lhs(4) +--R +--R +--R (54) 192x x x x +--R 1 2 3 4 +--R Type: Polynomial Integer +--E 54 + +--S 55 of 63 +rhs(4) +--R +--R +--R (55) 192x x x x +--R 1 2 3 4 +--R Type: Polynomial Integer +--E 55 + +--S 56 of 63 +lhs(4)-rhs(4) +--R +--R +--R (56) 0 +--R Type: Polynomial Integer +--E 56 + +\end{chunk} +\subsection{Lagrange's Identity} +\[\left(\sum a_k^2\right) \left(\sum b_k^2\right) = +\left(\sum a_k b_k\right)^2 + \sum \left(a_k b_j - a_j b_k\right)^2\] + +We need two symbol generation functions. First, we need to generate +the units for the term +\[\left(\sum a_k b_k\right)^2\] +so that \verb|symgen2('a,'b,4)| results in +\begin{verbatim} + [a b ,a b ,a b ,a b ] + 4 4 3 3 2 2 1 1 +\end{verbatim} +\begin{chunk}{*} +--S 57 of 63 +symgen2(var1:Symbol,var2:Symbol,size:PI):List POLY INT == + [(var1.[i]*var2.[i]) for i in size..1 by -1] +--R +--R Function declaration symgen2 : (Symbol,Symbol,PositiveInteger) -> +--R List Polynomial Integer has been added to workspace. +--R Type: Void +--E 57 + +--S 58 of 63 +symgen2('a,'b,4) +--R +--R Compiling function symgen2 with type (Symbol,Symbol,PositiveInteger) +--R -> List Polynomial Integer +--R +--R (58) [a b ,a b ,a b ,a b ] +--R 4 4 3 3 2 2 1 1 +--R Type: List Polynomial Integer +--E 58 + +\end{chunk} +Next we need to generate the units for the term +\[\sum \left(a_k b_j - a_j b_k\right)^2\] +so that \verb|symgen3('a,'b,4)| results in +\begin{verbatim} + [0, a b - a b , a b - a b , a b - a b , 0, a b - a b , a b - a b , 0, + 3 4 4 3 2 4 4 2 1 4 4 1 2 3 3 2 1 3 3 1 + a b - a b , 0] + 1 2 2 1 +\end{verbatim} +\begin{chunk}{*} +--S 59 of 63 +symgen3(var1:Symbol,var2:Symbol,size:PI):LIST POLY INT == + result:LIST(POLY(INT)):=[] + for j in 1..size repeat + for k in 1..j repeat + p:POLY(INT):=var1.[k]*var2.[j]-var1.[j]*var2.[k] + result:=cons(p,result) + result +--R +--R Function declaration symgen3 : (Symbol,Symbol,PositiveInteger) -> +--R List Polynomial Integer has been added to workspace. +--R Type: Void +--E 59 + +--S 60 of 63 +symgen3('a,'b,4) +--R +--R Compiling function symgen3 with type (Symbol,Symbol,PositiveInteger) +--R -> List Polynomial Integer +--R +--R (60) +--R [0, a b - a b , a b - a b , a b - a b , 0, a b - a b , a b - a b , 0, +--R 3 4 4 3 2 4 4 2 1 4 4 1 2 3 3 2 1 3 3 1 +--R a b - a b , 0] +--R 1 2 2 1 +--R Type: List Polynomial Integer +--E 60 + +\end{chunk} +Now we are ready to generate and test the Lagrange Identities. +This function will take a given size and print all of the intermediate +working results. It eventually creates the left hand side (lhs) and +the right hand side (rhs) and subtracts them to show that they are equal. +\begin{chunk}{*} +--S 61 of 63 +lagrange(size:PI):POLY(INT) == + t1:=factor reduce(+,map(x+->x^2,symgen('a,size))) + print ["t1=",t1] + t2:=factor reduce(+,map(x+->x^2,symgen('b,size))) + print ["t2=",t2] + t3:=factor reduce(+,symgen2('a,'b,size))^2 + print ["t3=",t3] + t4:=factor reduce(+,map(x+->x^2,symgen3('a,'b,size))) + print ["t4=",t4] + lhs:=t1*t2 + print ["lhs=",lhs] + rhs:=t3+t4 + print ["rhs=",rhs] + lhs-rhs +--R +--R Function declaration lagrange : PositiveInteger -> Polynomial +--R Integer has been added to workspace. +--R Type: Void +--E 61 + +\end{chunk} +Now we test it for the case $n=2$ +\begin{chunk}{*} +--S 62 of 63 +lagrange(2) +--R +--R Function definition for lhs is being overwritten. +--R Function definition for rhs is being overwritten. +--R Compiling function lagrange with type PositiveInteger -> Polynomial +--R Integer +--R 2 2 +--R ["t1=",a + a ] +--R 2 1 +--R 2 2 +--R ["t2=",b + b ] +--R 2 1 +--R 2 +--R ["t3=",(a b + a b ) ] +--R 2 2 1 1 +--R 2 +--R ["t4=",(a b - a b ) ] +--R 1 2 2 1 +--R 2 2 2 2 +--R ["lhs=",(a + a )(b + b )] +--R 2 1 2 1 +--R 2 2 2 2 2 2 +--R ["rhs=",(a + a )b + (a + a )b ] +--R 2 1 2 2 1 1 +--R +--R (62) 0 +--R Type: Polynomial Integer +--E 62 + +\end{chunk} +Now we test it for the case $n=3$ +\begin{chunk}{*} +--S 63 of 63 +lagrange(3) +--R +--R 2 2 2 +--R ["t1=",a + a + a ] +--R 3 2 1 +--R 2 2 2 +--R ["t2=",b + b + b ] +--R 3 2 1 +--R 2 +--R ["t3=",(a b + a b + a b ) ] +--R 3 3 2 2 1 1 +--R ["t4=", +--R +--R 2 2 2 2 2 2 +--R (a + a )b + (- 2a a b - 2a a b )b + (a + a )b - 2a a b b +--R 2 1 3 2 3 2 1 3 1 3 3 1 2 1 2 1 2 +--R + +--R 2 2 2 +--R (a + a )b +--R 3 2 1 +--R ] +--R 2 2 2 2 2 2 +--R ["lhs=",(a + a + a )(b + b + b )] +--R 3 2 1 3 2 1 +--R 2 2 2 2 2 2 2 2 2 2 2 2 +--R ["rhs=",(a + a + a )b + (a + a + a )b + (a + a + a )b ] +--R 3 2 1 3 3 2 1 2 3 2 1 1 +--R +--R (63) 0 +--R Type: Polynomial Integer +--E 63 + +)spool +)lisp (bye) + +\end{chunk} +\eject +\begin{thebibliography}{99} +\bibitem{1} T. Piezas, ``A Collection of Algebraic Identities''\\ +{\bf http://sites.google.com/site/tpiezas/001} +\end{thebibliography} +\end{document} + + +