## Problem: kronecker product (tensor product) does not work for three
## inputs if one (or more) inputs involve symbols from package symbolic
pkg load symbolic
## N_sqrt2 will stand in for 1/sqrt(2)
N_sqrt2 = sym('N_sqrt2')
## Hadamard matrix (numeric and symbolic versions)
H_numeric = 1/sqrt(2) * [1 1 ; 1 -1]
H_symbolic = N_sqrt2 * [1 1 ; 1 -1]
## kronecker product (tensor product) works fine for symbolic with two inputs
kron(H_numeric, eye(2))
kron(H_symbolic, eye(2))
## kronecker product (tensor product) works fine for three numeric
## inputs but does not work for three inputs when at least one is
## symbolic
kron(H_numeric, eye(2), eye(2))
kron(H_symbolic, eye(2), eye(2))
## Problem can be finessed by taking explicit advantage of the associative
## property, that is, use two two-input kronecker products
kron(kron(H_symbolic, eye(2)), eye(2))
kron(H_symbolic, kron(eye(2), eye(2)))
The following code illustrates the problem.