I want to solve the following non-linear system of equations.
0in the first equation represents
0in the second equation is
- all the matrices are sparse if that matters.
n x n(positive definite) matrix
A_kis a known (symmetric) matrix
a_kis a known n x 1 vector
Nis known (let's say N = 50). But I need a method where I can easily change N.
Unknown (trying to solve for)
n x 1a vector.
1 <= k <= Na scaler
I am thinking of using scipy root to find x and each alpha_k. We essentially have
n equations from each row of the first equation and another
N equations from the constraint equations to solve for our
n + N variables. Therefore we have the required number of equations to have a solution.
I also have a reliable initial guess for
x and the
n = 4 N = 2 K = np.matrix([[0.5, 0, 0, 0], [0, 1, 0, 0],[0,0,1,0], [0,0,0,0.5]]) A_1 = np.matrix([[0.98,0,0.46,0.80],[0,0,0.56,0],[0.93,0.82,0,0.27],[0,0,0,0.23]]) A_2 = np.matrix([[0.23, 0,0,0],[0.03,0.01,0,0],[0,0.32,0,0],[0.62,0,0,0.45]]) a_1 = np.matrix(scipy.rand(4,1)) a_2 = np.matrix(scipy.rand(4,1))
We are trying to solve for
x = [x1, x2, x3, x4] and alpha_1, alpha_2
- I can actually brute force this toy problem and feed it to the solver. But how do I do I solve this toy problem in such a way that I can extend it easily to the case when I have let's say
- I will probably have to explicitly compute the Jacobian for larger matrices??.
Can anyone give me any pointers?