I want to construct a Toeplitz matrix in Mathematica. Usually it is done in Mathematica using the following command:
ToeplitzMatrix[{a,b,...},{a,y,...}]
I want to have the first and the second list like {a,b,...}
and {a,y,...}
above to each contain N
elements for a given number N
(say 5 or 6; I want to keep the option of changing it). I want a=0
. From b
onwards I want to have (-1)^n nx
(starting with n=1
) and from y
onwards -(-1)^n nx
alternatively.
So at the end, it should look like \begin{pmatrix} 0\quad x\quad -2x\quad\dots\\ -x\quad 0\quad x\quad \dots\\ 2x\quad -x\quad 0\quad \dots\\ \dots \end{pmatrix}
I am quite new to all the powers of Mathematica. So some help will be greatly appreciated.