I want to create a matrix which contains parameters from a series of ODEs I have. I have 5 ODEs, and all the parameters from them must be in this matrix in a certain order
Howver I cannot find the most logical way of doing this. I setup a 5x5 matrix of zeroes, and tried to replace certain positions in the matrix with my parameters, but these parameters are not defined previously and I am entering them as they are (undefined values) as I will use them later. My code is this:
import numpy as np
####create matrix
zeros = np.zeros((5,5))
params = ['-lambda', 'lambda', '-u-v', 'u', '-w', 'v', 'w','-gamma', 'gamma']
pos = [(0,0),(1,0),(1,1),(2,1),(2,2),(3,1),(3,2),(3,3),(4,3)]
rows, cols = zip(*pos)
zeros[rows, cols] = params
What I am trying to get coded is something that looks like this:
--------------------------------edit
the purpose for all this is so when I multiply out my matrix with another vector, I will be left with the equations for my ODEs (see below as an example, multiplying first row with the vector gives 'dU', and so on.