Solving large systems of equations is not conceptually distinct from optimisation. But, er, there are differences in emphasis between
finding an optimal vector solution to an equation whose dimension is presumably smaller than your data, and
finite element methods and PDE wrangling, where the solution might be much larger than your data.
Here I concentrate on the latter.
There are many iterative methods for this kind of system.
Keywords: Geometric multigrid, algebraic multigrid. Stochastic methods…
fipy is original school:
FiPy is an object oriented, partial differential equation (PDE) solver, written in Python, based on a standard finite volume (FV) approach. … The FiPy framework includes terms for transient diffusion, convection and standard sources, enabling the solution of arbitrary combinations of coupled elliptic, hyperbolic and parabolic PDEs. Currently implemented models include phase field treatments of polycrystalline, dendritic, and electrochemical phase transformations as well as a level set treatment of the electrodeposition process.
pyamg is an algebraic multigrid solver, which is to say, multi-resolution method:
AMG is a multilevel technique for solving large-scale linear systems with optimal or near-optimal efficiency. Unlike geometric multigrid, AMG requires little or no geometric information about the underlying problem and develops a sequence of coarser grids directly from the input matrix. This feature is especially important for problems discretised on unstructured meshes and irregular grids:
A = poisson((500,500), format='csr') # 2D Poisson problem on 500x500 grid ml = ruge_stuben_solver(A) # construct the multigrid hierarchy print ml # print hierarchy information b = rand(A.shape) # pick a random right hand side x = ml.solve(b, tol=1e-10) # solve Ax=b to a tolerance of 1e-8 print("residual norm is", norm(b - A*x)) # compute norm of residual vector
See Yousef Saad’s textbooks on algebraic multigrid methods. (free online)