Skip to content

Commit 79ee49d

Browse files
committed
an explicit basis
1 parent 7441cf4 commit 79ee49d

File tree

1 file changed

+68
-4
lines changed

1 file changed

+68
-4
lines changed

vignettes/tensorprod.Rmd

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ $$
5858
T\left(v_1,\ldots, v_i + {v'}_i,\ldots, v_k\right)=
5959
T\left(v_1,\ldots,v_i,\ldots,v_k\right)+
6060
T\left(v_1,\ldots,{v'}_i,\ldots,v_k\right),\\
61-
T\left(v_1,\ldots,av_i,\ldots,v_k\right)=aT\left(v_1,\ldots,v_i,\ldots,v_k\right)
61+
T\left(v_1,\ldots,av_i,\ldots,v_k\right)=aT\left(v_1,\ldots,v_i,\ldots,v_k\right).
6262
$$
6363

64-
A multilinear function $T\colon v^k\longrightarrow\mathbb{R}$ is
64+
A multilinear function $T\colon V^k\longrightarrow\mathbb{R}$ is
6565
called a *$k$-tensor* on $V$ and the set of all $k$-tensors, denoted
6666
by $\mathcal{J}^k(V)$, becomes a vector space (over $\mathbb{R}$) if
6767
for $S,T\in\mathcal{J}^k(V)$ and $a\in\mathbb{R}$ we define
6868

6969
$$
70-
(S+T)(v_1,\ldots,v_k) = S(v_1,\ldots,v_k) + T(v_1,\ldots,v_k)
71-
(aS)(v_1,\ldots,v_k) = a\cdot S(v_1,\ldots,v_k)
70+
(S+T)(v_1,\ldots,v_k) = S(v_1,\ldots,v_k) + T(v_1,\ldots,v_k)\\
71+
(aS)(v_1,\ldots,v_k) = a\cdot S(v_1,\ldots,v_k).
7272
$$
7373

7474
There is also an operation connecting the various spaces
@@ -154,4 +154,68 @@ different order.
154154
rm(T) # tidyup
155155
```
156156

157+
## An explicit basis
158+
159+
160+
We will consider an element $X$ of $\mathcal{J}^{2}(V)$ where
161+
$V=\mathbb{R}^3$ and construct an explicit basis for it along the
162+
lines of Spivak's observation above.
163+
164+
```{r}
165+
(X <- ktensor(spray(matrix(c(1,2,3,2,1,1),3,2),1:3)))
166+
```
167+
168+
Thus $X=\phi_1\otimes\phi_2 +2\phi_2\otimes\phi_1
169+
+3\phi_3\otimes\phi_1$. Spivak asserts that $\mathcal{J}^{2}(V)$ has
170+
dimension $n^k=3^2=9$.
171+
172+
In package idiom, for example, $\phi_2\otimes\phi_5$ would be
173+
constructed as follows:
174+
175+
```{r}
176+
(phi2_x_phi5 <- ktensor(spray(t(c(1,3)))))
177+
```
178+
179+
Using this notation we can construct a basis for $\mathcal{J}^{2}(V)$
180+
as follows:
181+
182+
```{r}
183+
f <- function(v){ktensor(spray(t(v)))}
184+
f(c(2,5))
185+
```
186+
187+
Thus `f()` creates an element of the basis set, in this case
188+
$\phi_2\otimes\phi_5$. We can construct $X$ line by line:
189+
190+
```{r}
191+
1*f(c(1,2)) + 2*f(c(2,1)) + 3*f(c(3,1))
192+
```
193+
194+
With a little effort, we can create all $3^2=9$ elements of a basis as
195+
follows:
196+
197+
```{r}
198+
basis <- apply(expand.grid(rep(list(seq_len(3)),2)),1,f)
199+
length(basis)
200+
basis[[6]]
201+
```
202+
203+
Or it might be better to use ellipsis constructs to pass multiple
204+
arguments at once:
205+
206+
207+
```{r}
208+
s <- function(...){f(unlist(list(...)))}
209+
s(3,4,6)
210+
```
211+
212+
Then we could have
213+
214+
```{r}
215+
1*s(1,2) + 2*s(2,1) + 3*s(3,1)
216+
1*s(1,2) + 2*s(2,1) + 3*s(3,1) == X
217+
```
218+
219+
220+
157221
# References

0 commit comments

Comments
 (0)