views:

147

answers:

1

I'm trying to solve a Poisson equation on a rectangular domain which ends up being a linear problem like Ax=b but since I know the boundary conditions, there are nodes where I have the solution values. I guess my question is... How can I solve the sparse system Ax=b if I know what some of the coordinates of x are and the undetermined values depend on these as well? It's the same as a normal solve except I know some of the solution to begin with.

Thanks!

+1  A: 

If I understand correctly, some elements of x are known, and some are not, and you want to solve Ax = b for the unknown values of x, correct?

Let Ax = [A1 A2][x1; x2] = b, where the vector x = [x1; x2], the vector x1 has the unknown values of x, and vector x2 have the known values of x. Then, A1x1 = b - A2x2. Therefore, solve for x1 using scipy.linalg.solve or any other desired solver.

Steve
This is probably stupid to ask, but I don't quite understand your notation [A C][x;y] = b. Could you explain it? Your restatement of my question sounds like it solves my problem =]
Brandon Pelfrey
Sorry, I used confusing variable names. See edit. I am partitioning the vector x into x1 and x2, and I am partitioning the matrix A into A1 and A2.
Steve
How do you partition A into A1 and A2?
Brandon Pelfrey
Such that the inner dimensions match those of x1 and x2. Suppose x has n elements, x1 has r elements (i.e., you know r of the elements of x), and x2 has n-r elements. Also suppose b has m elements. Then A is m-by-n, A1 is m-by-r, and A2 is m-by-(n-r).
Steve