Skip to main content
added 850 characters in body
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114

The easiest way for me to think about would be something like that:

$$f([],[])=[],$$ \begin{align} f(s:L_1,L_2)&=s\cdot L_2 + (0:f(L_1,L_2)), \\ f(L_1,s:L_2)&=s\cdot L_1 + (0:f(L_1,L_2)). \end{align}

The multiplication and addition are meant componentwise. If you add lists of different length, then make them equally long by appending zeros. I think there is no way without accessing the "inner" list elements

One problem with this list representation of polynomials is the ambiguity of representing the zero polynomial. All of the following lists will represent the same polynomial:

$$[], [0],[0,0],...,[0,...,0],...$$

and the presented rescursive procedure will distingish them: $f(L,[])=0\cdot L$. More general

$$f(L,[\underbrace{0,...,0}_n])=(0\cdot L):[\underbrace{0,...,0}_n]=[\underbrace{0,...,0}_{n+\text{ length of }L}].$$

And you will have this problem in any multiplication:

\begin{align} 1\cdot 1 \overset{\sim}=f([1],[1])&=f(1:[],[1])\\ &=1\cdot[1]+(0:f([],[1]))\\ &=[1]+(0:[0])\\ &=[1]+[0,0] = [1,0]\overset{\sim}=1 \end{align}

So it would be recommended to trim trailing zeros after any calculation. Alternatively, instead of appending zeros to fix unqual length in list addition, at first, try to trim trailing zeros.

The easiest way for me to think about would be something like that:

$$f([],[])=[],$$ \begin{align} f(s:L_1,L_2)&=s\cdot L_2 + (0:f(L_1,L_2)), \\ f(L_1,s:L_2)&=s\cdot L_1 + (0:f(L_1,L_2)). \end{align}

The multiplication and addition are meant componentwise. If you add lists of different length, then make them equally long by appending zeros. I think there is no way without accessing the "inner" list elements

The easiest way for me to think about would be something like that:

$$f([],[])=[],$$ \begin{align} f(s:L_1,L_2)&=s\cdot L_2 + (0:f(L_1,L_2)), \\ f(L_1,s:L_2)&=s\cdot L_1 + (0:f(L_1,L_2)). \end{align}

The multiplication and addition are meant componentwise. If you add lists of different length, then make them equally long by appending zeros. I think there is no way without accessing the "inner" list elements

One problem with this list representation of polynomials is the ambiguity of representing the zero polynomial. All of the following lists will represent the same polynomial:

$$[], [0],[0,0],...,[0,...,0],...$$

and the presented rescursive procedure will distingish them: $f(L,[])=0\cdot L$. More general

$$f(L,[\underbrace{0,...,0}_n])=(0\cdot L):[\underbrace{0,...,0}_n]=[\underbrace{0,...,0}_{n+\text{ length of }L}].$$

And you will have this problem in any multiplication:

\begin{align} 1\cdot 1 \overset{\sim}=f([1],[1])&=f(1:[],[1])\\ &=1\cdot[1]+(0:f([],[1]))\\ &=[1]+(0:[0])\\ &=[1]+[0,0] = [1,0]\overset{\sim}=1 \end{align}

So it would be recommended to trim trailing zeros after any calculation. Alternatively, instead of appending zeros to fix unqual length in list addition, at first, try to trim trailing zeros.

deleted 197 characters in body
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114

The easiest way for me to think about would be something like that:

$$f(L_1,[])=0\cdot L_1,\qquad f([],L_2)=0\cdot L_2,\qquad \text{or just } f([],[])=[],$$$$f([],[])=[],$$ \begin{align} f(L_1:s,L_2)&=s\cdot (0:L_2) +(f(L_1,L_2) : 0), \\ f(L_1,L_2:s)&=s\cdot (0:L_2) +(f(L_1,L_2):0). \end{align}\begin{align} f(s:L_1,L_2)&=s\cdot L_2 + (0:f(L_1,L_2)), \\ f(L_1,s:L_2)&=s\cdot L_1 + (0:f(L_1,L_2)). \end{align}

The multiplication and addition are meant componentwise. If you add lists of different length, then make them equally long by appending zeros. I think there is no way without accessing the "inner" list elements.

For example calculate $x\cdot x$ with $x=[1]$, then

\begin{align} f([1],[1])&=f([]:1,[1])\\ &=1\cdot(0:[1])+(\underbrace{f([],[1])}_{[0]}:0)\\ &=1\cdot[0,1]+[0,0]=[0,1]\equiv x^2. \end{align}

The easiest way for me to think about would be something like that:

$$f(L_1,[])=0\cdot L_1,\qquad f([],L_2)=0\cdot L_2,\qquad \text{or just } f([],[])=[],$$ \begin{align} f(L_1:s,L_2)&=s\cdot (0:L_2) +(f(L_1,L_2) : 0), \\ f(L_1,L_2:s)&=s\cdot (0:L_2) +(f(L_1,L_2):0). \end{align}

The multiplication and addition are meant componentwise. I think there is no way without accessing the "inner" list elements.

For example calculate $x\cdot x$ with $x=[1]$, then

\begin{align} f([1],[1])&=f([]:1,[1])\\ &=1\cdot(0:[1])+(\underbrace{f([],[1])}_{[0]}:0)\\ &=1\cdot[0,1]+[0,0]=[0,1]\equiv x^2. \end{align}

The easiest way for me to think about would be something like that:

$$f([],[])=[],$$ \begin{align} f(s:L_1,L_2)&=s\cdot L_2 + (0:f(L_1,L_2)), \\ f(L_1,s:L_2)&=s\cdot L_1 + (0:f(L_1,L_2)). \end{align}

The multiplication and addition are meant componentwise. If you add lists of different length, then make them equally long by appending zeros. I think there is no way without accessing the "inner" list elements

added 38 characters in body
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114

The easiest way for me to think about would be something like that:

$$f(L_1,[])=[],\qquad f([],L_2)=[],\qquad \text{or just } f([],[])=[],$$$$f(L_1,[])=0\cdot L_1,\qquad f([],L_2)=0\cdot L_2,\qquad \text{or just } f([],[])=[],$$ \begin{align} f(L_1:s,L_2)&=s\cdot (0:L_2) +(f(L_1,L_2) : 0), \\ f(L_1,L_2:s)&=s\cdot (0:L_2) +(f(L_1,L_2):0). \end{align}

The multiplication and addition are meant componentwise. I think there is no way without accessing the "inner" list elements.

For example calculate $x\cdot x$ with $x=[1]$, then

\begin{align} f([1],[1])&=f([]:1,[1])\\ &=1\cdot(0:[1])+(\underbrace{f([],[1])}_{[0]}:0)\\ &=1\cdot[0,1]+[0,0]=[0,1]\equiv x^2. \end{align}

The easiest way for me to think about would be something like that:

$$f(L_1,[])=[],\qquad f([],L_2)=[],\qquad \text{or just } f([],[])=[],$$ \begin{align} f(L_1:s,L_2)&=s\cdot (0:L_2) +(f(L_1,L_2) : 0), \\ f(L_1,L_2:s)&=s\cdot (0:L_2) +(f(L_1,L_2):0). \end{align}

The multiplication and addition are meant componentwise. I think there is no way without accessing the "inner" list elements.

The easiest way for me to think about would be something like that:

$$f(L_1,[])=0\cdot L_1,\qquad f([],L_2)=0\cdot L_2,\qquad \text{or just } f([],[])=[],$$ \begin{align} f(L_1:s,L_2)&=s\cdot (0:L_2) +(f(L_1,L_2) : 0), \\ f(L_1,L_2:s)&=s\cdot (0:L_2) +(f(L_1,L_2):0). \end{align}

The multiplication and addition are meant componentwise. I think there is no way without accessing the "inner" list elements.

For example calculate $x\cdot x$ with $x=[1]$, then

\begin{align} f([1],[1])&=f([]:1,[1])\\ &=1\cdot(0:[1])+(\underbrace{f([],[1])}_{[0]}:0)\\ &=1\cdot[0,1]+[0,0]=[0,1]\equiv x^2. \end{align}

added 38 characters in body
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114
Loading
added 30 characters in body
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114
Loading
Source Link
M. Winter
  • 31k
  • 8
  • 51
  • 114
Loading