1 | initial version |
It seems like your question has two parts:
This first question is perhaps not best asked in this forum but I'll provide some insight. For the second question I'll suggest some outside resources that can get you started. As for that last question, I'm afraid you'll have to ask your professor about that.
The Matlab function mACfd
creates an $N_2^2 \times N_2^2$ matrixA
and a vector C
of $N_2^2$ components. A
is a banded matrix. (i.e. Tridiagonal with additional diagonals distance $N_2$ away.) The way Matlab is creating this matrix-vector pair is by means of a nested for loop across the indices $i$ and $j$ with an auxillary index $k = (i-1)N_2+j$
Python/Sage/Numpy/Scipy does loops, of course, so starting with the numpy.array
or numpy.matrix
object you should be on your way to writing the same routine. See the Numpy Basics documentation for an introduction to using these data types.
2 | two parts -> three parts |
It seems like your question has two three parts:
This first question is perhaps not best asked in this forum but I'll provide some insight. For the second question I'll suggest some outside resources that can get you started. As for that last question, I'm afraid you'll have to ask your professor about that.
The Matlab function mACfd
creates an $N_2^2 \times N_2^2$ matrixA
and a vector C
of $N_2^2$ components. A
is a banded matrix. (i.e. Tridiagonal with additional diagonals distance $N_2$ away.) The way Matlab is creating this matrix-vector pair is by means of a nested for loop across the indices $i$ and $j$ with an auxillary index $k = (i-1)N_2+j$
Python/Sage/Numpy/Scipy does loops, of course, so starting with the numpy.array
or numpy.matrix
object you should be on your way to writing the same routine. See the Numpy Basics documentation for an introduction to using these data types.