# [Tutor] matrix insertion routine for MNA

CryptoLevel9 at aol.com CryptoLevel9 at aol.com
Wed Oct 20 06:44:18 CEST 2004

```I originally posted under the subject Values in matrices.  The two  responses
that I received from that topic were excellent and helped me a  lot, but I
have run into a problem that I did not anticipate having when I first  asked the
question.  What I need help with now is how to assign  multiple values to the
same locations in a  pre-constructed matrix and then sum the values at those
points.  Unfortunately, there is no way to determine which values  will need
to be summed before placing them into the matrix without  defeating the entire
purpose of the program, that is why the values have to be  summed after they
are placed in the matrix.  My rational behind writing a  program that does
this is that I am trying to implement the MNA (Modified Nodal  Analysis)
Algorithm (a technique for "solving" electrical circuits) in a program  making the
assumptions that the circuit to be solved is planar, that  the user already knows
the values for every element in the circuit  and which nodes the element is
connected to.  I have looked through  the owners manual for numarray and saw
that "The numarray constructor takes a data  argument, an optional type, and an
optional shape argument. If the data argument  is a sequence, then array
creates a new object of type numarray, and fills the array with the elements of the
data  object. The shape of the array is determined by the size and nesting
arrangement  of the elements of data." This gives me the impression that what  I
am asking cannot be done by making every point in the matrix a list and  then
summing the individual lists after the values have been placed in  them,
which is what I thought of doing first.  I would prefer not  making any more
variable names than I had listed in my original post in  order to keep from
confusing myself as too what each internal variable  means.  Any help either on how
to do what I am asking or how to circumvent  the need to sum values after they
have placed in placed in the matrix would  be appreciated.

Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041020/9fae8eb8/attachment.htm
```