# Sympyまとめ (N-dim array)

Sympyのtensor用機能

• We have two tensors $A \in \mathbb{R}^{I_1 \times \ldots \times I_N}$ and $B \in \mathbb{R}^{J_1 \times \ldots \times J_N}$.
• An element is specified by $A(i_1, \ldots, i_N)$, where $1 \leq i_k \leq I_k, k = 1, \ldots, N$ and $B(j_1, \ldots, j_M)$, where $1 \leq j_k \leq J_k, k = 1, \ldots, M$.
from sympy.tensor.array import Array
A = Array(...)
B = Array(...)


1. Tensor product
Tensor product combines two tensors. The result tensor C is (N+M)-d array.
$C = A \otimes B$
$C(i_1, \ldots, i_N, j_1, \ldots, j_M) = A(i_1, \ldots, i_N)B(j_1, \ldots, j_M)$

from sympy.tensor.array import tensorproduct
C = tensorproduct(A, B)