someone wrote:
How to initialize my array directly using variables ?

It could also be that I wanted:

test11 = 1
test12 = 1.5
test13 = 2
test21 = 0
test22 = 5

Dx = numpy.matrix('test11 test12 test13; test21 test22 -0.5; 0 -0.5 1.5')

Etc... for many variables...

Appreciate ANY help, thank you very much!

You could use string interpolation:

Dx = numpy.matrix('%s %s %s; %s %s -0.5; 0 -0.5 1.5'
              % (test11 test12 test13 test21 test22))


Emile

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to