login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxTensorProductPolynomial revision 4 of 13

1 2 3 4 5 6 7 8 9 10 11 12 13
Editor: Bill Page
Time: 2008/08/25 14:58:25 GMT-7
Note: check axioms

changed:
-$$
\begin{equation}

changed:
-$$
-$$
\end{equation}
\begin{equation}

changed:
-$$
-$$
\end{equation}
\begin{equation}

changed:
-$$
\end{equation}

added:

Demonstrating the axioms (1) (2) and (3) of the tensor product:
\begin{axiom}
w:= 13*y^2+17*y+19
test( tensorPoly(p+q,w) = (tensorPoly(p,w) + tensorPoly(q,w)) )
test( tensorPoly(p,q+w) = (tensorPoly(p,q) + tensorPoly(p,w)) )
test( tensorPoly(p,23*w) = 23*tensorPoly(p,w) )
test( tensorPoly(23*p,w) = 23*tensorPoly(p,w) )
\end{axiom}
I suppose that we could give an inductive proof that this
implementation of the tensor product of polynomials is
correct ... but for now lets take this demonstration as
reassurance.
 

http://en.wikipedia.org/wiki/Tensor_product

A tensor product is "the most general bilinear operation" available in a specified domain of computation, satisfying:


\label{eq1}
(v_1+v_2)\otimes w - (v_1\otimes w+v_2\otimes w) = 0
(1)

\label{eq2}
v\otimes (w_1+w_2) - (v\otimes w_1+v\otimes w_2) = 0
(2)

\label{eq3}
cv\otimes w=v\otimes cw=c(v\otimes w)
(3)

We can use the domain constructor Sum [SandBoxSum]?

fricas
(1) -> )lib SUM
Sum is now explicitly exposed in frame initial Sum will be automatically loaded when needed from /var/aw/var/LatexWiki/SUM.NRLIB/SUM

First we can define some recursive operations on the polynomials

fricas
scanPoly(p,n) == _
  (p=0 => 0; mapMonomial(leadingMonomial(p),n)+scanPoly(reductum p,n))
Type: Void
fricas
mapMonomial(p,n) == _
  monomial(coefficient(p,degree p),scanIndex(degree(p),n))$SMP(Integer,Sum(Symbol,Symbol))
Type: Void
fricas
scanIndex(p,n) == _
  (zero? p => 0$IndexedExponents(Sum(Symbol,Symbol)); _
    monomial(leadingCoefficient(p), _
      if n=1 then in1(leadingSupport(p))$Sum(Symbol,Symbol) _
             else in2(leadingSupport(p))$Sum(Symbol,Symbol) _
    )$IndexedExponents(Sum(Symbol,Symbol))+ _
      scanIndex(reductum(p),n))
Type: Void

For example:

fricas
-- functions are first compiled here
--
scanPoly(x,1)
There are 1 exposed and 3 unexposed library operations named leadingMonomial having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op leadingMonomial to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named leadingMonomial with argument type(s) Variable(x)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 1 exposed and 3 unexposed library operations named leadingMonomial having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op leadingMonomial to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named leadingMonomial with argument type(s) Variable(x)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

injects the polynomial x in to the tensor product. So now the full tensor product is just:

fricas
tensorPoly(p,q) == _
  scanPoly(p,1)*scanPoly(q,2)
Type: Void

For example:

fricas
p:=2*x^2+3

\label{eq4}{2 \ {{x}^{2}}}+ 3(4)
Type: Polynomial(Integer)
fricas
q:=5*x*y+7*y+11

\label{eq5}{{\left({5 \  x}+ 7 \right)}\  y}+{11}(5)
Type: Polynomial(Integer)
fricas
r:=tensorPoly(p,q)
>> System error: The function BOOT::PUT is undefined.

Demonstrating the axioms (1) (2) and (3) of the tensor product:

fricas
w:= 13*y^2+17*y+19

\label{eq6}{{13}\ {{y}^{2}}}+{{17}\  y}+{19}(6)
Type: Polynomial(Integer)
fricas
test( tensorPoly(p+q,w) = (tensorPoly(p,w) + tensorPoly(q,w)) )
fricas
Compiling function tensorPoly with type (Polynomial(Integer), 
      Polynomial(Integer)) -> NonNegativeInteger 
>> System error: The function BOOT::|*2;scanPoly;1;initial| is undefined.

I suppose that we could give an inductive proof that this implementation of the tensor product of polynomials is correct ... but for now lets take this demonstration as reassurance.