Monte Carlo for Linear Operator Equations Fall 2012 By Hao Ji Review • Last Class – Quasi-Monte Carlo • This Class – Monte Carlo Linear Solver • von Neumann and Ulam method • Randomize Stationary iterative methods • Variations of Monte Carlo solver – Fredholm integral equations of the second kind – The Dirichlet Problem – Eigenvalue Problems • Next Class – Monte Carlo method for Partial Differential Equations Solving Linear System • The simultaneous equations, π₯ = π»π₯ + π where π» = (βππ ) ∈ π π×π is a π × π matrix , a ∈ π π is a given vector and π₯ ∈ π π is the unknown solution vector. • Define the norm of matrix to be π» = max π βππ π Solving Linear System • Direct methods – Gaussian elimination – LU decomposition –… • Iterative methods – Stationary iterative methods (Jacobi method, Gauss Seidel method, …) – Krylov subspace methods(CG, Bicg, GMRES,…) –… • Stochastic linear solvers – Monte Carlo methods –… Monte Carlo Linear Solver • The Monte Carlo method proposed by von Neumann and Ulam: 1. Define the transition probabilities and the terminating probabilities. 2. Build an unbiased estimator of the solution. 3. Produce Random Walks and calculate the average value. Monte Carlo Linear Solver • Let π be a π × π matrix based on the matrix π», such that πππ ≥ 0, πππ ≤ 1 π and βππ ≠ 0 → πππ ≠ 0 ππ = 1 − πππ ≤ 1 π • A special case: πππ = βππ Monte Carlo Linear Solver • A terminating random walk stopping after k steps is πΎ = π0 , π1 , … , ππ which passes through the sequence of integers (the row indices) • The successive integers (states) are determined by the transition probabilities π ππ+1 = π ππ = π, π > π = πππ and the termination probabilities π π = π ππ = π, π > π − 1 = ππ Monte Carlo Linear Solver • Define ππ πΎ = π£ π0 π1 π£ π1π2 … π£ ππ−1ππ (π ≤ π) where π£ ππ β ππ = π ππ 0 (π ππ ≠ 0) (π ππ = 0) Then, π πΎ = ππ πΎ a ππ /p π π is an unbiased estimator of π₯ π0 in the solution π₯ if the Neumann series πΌ + π» + π» 2 + β― converges. Monte Carlo Linear Solver • Proof: The expectation of π πΎ is πΈ π πΎ = πΎ ∞ = … π=0 π1 = ∞ π=0 π πΎ π(πΎ) ππ 0 π1 ππ 1 π2 …π π π−1 ππ π π π£ π0π1 π£ π1π2 … π£ ππ−1ππ a ππ /p π π π ππ ππ β π0 π1 β π1 π2 … β ππ−1 ππ a ππ π1 … = a π0 + π»π π0 + π»2 π π0 (Since π£ ππ = +β― If the Neumann Series π» + π» 2 + β― converges, πΌ+π»+π»2+β― π = πΌ−π» then πΈ π πΎ = π₯ π0 . −1 π =π₯ β ππ ) π ππ Monte Carlo Linear Solver • Produce π random walks starting from π0 , 1 π πΎ ≈ πΈ π πΎ = π₯ π0 π can evaluate only one component of the solution. • The transition matrix is critical for the convergence of the Monte Carlo Linear Solver. In the special case: πππ = βππ – π» ≥ 1 Monte Carlo breaks down – π» = 0.9 Monte Carlo is less efficient than a conventional method ( 1% accuracy n<=554, 10% accuracy n<=84) – π» = 0.5 (1% accuracy n<=151, 10% accuracy n<=20) Monte Carlo Linear Solver • To approximate the sum π = π π π based on sampling, define a π random variable z with possible values π , and the probabilities ππ = π(π§ = ππ π π ) ππ Since π= π π = π π π π ππ = πΈ(π§) ππ we can use π random samples of π§ to estimate the sum π. • The essence of Monte Carlo method in solving linear system is to sample the underlying Neumann series πΌ+π»+π»2+β― Randomize Stationary iterative methods • Consider π΄π₯ = π – Jacobi method: decompose A into a diagonal component π· and the reminder π . π₯ (π+1) = π»π₯ (π) + π where H = −π· −1 π and π = π· −1 b – Gauss Seidel method: decomposed A into a lower triangular component πΏ, and a strictly upper triangular component π π₯ (π+1) = π»π₯ (π) + π where H = −πΏ −1 π and π = πΏ −1 b • Stationary iterative methods can easily be randomized by using Monte Carlo to statistically sample the underlying Neumann Series. Variations of Monte Carlo Linear Solver • Wasow uses another estimator π π∗ πΎ = ππ πΎ a ππ π=0 in some situations to obtain smaller variance than π πΎ . • Adjoint Method π€ ππ β ππ = π ππ 0 (π ππ ≠ 0) (π ππ = 0) to find the solution π₯ instead of π₯ π only. Variations of Monte Carlo Linear Solver • Sequential Monte Carlo method To accelerate Monte Carlo method of simultaneous equations, Halton uses a rough estimate π₯ for π₯ to transform the original linear system. Let π¦ = π₯ − π₯ and π = π + π»π₯ − π₯, then π₯ = π»π₯ + π βΉ π¦ = π»π¦ + π Since the elements of π are much smaller than π, the transformed linear system could be much faster to get solution than solving the original one. Variations of Monte Carlo Linear Solver • Dimov uses a different transtion matrix βππ πππ = π βππ Since the terminating probabilities not exist anymore, the random walk πΎ terminates when π πΎ is small enough, where π πΎ = π£ π0π1 π£ π1π2 … π£ ππ−1ππ = π βπ0 π ∗ π βπ1 π ∗ β― ∗ π βππ−1π Fredholm integral equations of the second kind • The integral equation π π₯ =π π₯ + πΎ π₯, π¦ π π¦ ππ¦ may be solved by Monte Carlo methods. Since the integral can be approximated by a quadrature formula: π π π¦ π₯ ππ₯ = π π€π π¦ π₯π π=1 Fredholm integral equations of the second kind • The integral equation can be transformed to be π π π₯ =π π₯ + π€π πΎ π₯, π¦π π π¦π π=1 evaluate it at the quadrature points: π π π₯π = π π₯π + π€π πΎ π₯π , π¦π π π¦π π=1 Let π be the vector π π₯π , π be the vector π π₯π and πΎ be the matrix π€π πΎ π₯π , π¦π , the integral equation becomes π = πΎπ + π where π is the unknown vector. The Dirichlet Problem • Dirichlet’s problem is to find a function π’, which is continuous and differentiable over a closed domain π· with boundary πΆ, satisfying π» 2 π’ = 0 ππ π·, π’ = π ππ πΆ. where π is a prescribed function, and operator. π»2 = π2 π’ ππ₯ + π2 π’ ππ₯ is the Laplacian Replacing π» 2 by its finite-difference approximation, 1 π’ π₯, π¦ = π’ π₯, π¦ + β + π’ π₯, π¦ − β + π’ π₯ + β, π¦ + π’ π₯ − β, π¦ 4 The Dirichlet Problem • Suppose the boundary πΆ lies on the mesh, the previous equations can be transformed into π’ = π»π’ + π – The order of π» is equal to the number of mesh points in π·. 1 – π» has four elements equal to in each row corresponding to an 4 interior point of π·, all other elements being zero. – π has boundary values corresponding to an boundary point of πΆ, all other interior elements being zero. – The random walk starting from an interior point π, terminates when it hits a boundary point π. The π(π) is an unbiased estimator of π’(π). Eigenvalue Problems • For a given π × π symmetric matrix π» π»π₯π = ππ π₯π , π₯π ≠ 0 assume that π1 > π2 ≥ β― ≥ ππ , so that π1 is the dominant eigenvalue and π₯1 is the corresponding eigenvector. For any nonzero vector π’ = π1 π₯1 + π2 π₯2 + β― + ππ π₯π , according to the power method, π»π π’ lim = π1 π₯1 π→∞ π π 1 We can obtain a good approximation of the dominant eigenvector of π» from the above. Eigenvalue Problems Similar to the idea behinds Monte Carlo solver that π» π π’ = π1 … ππ β π0π1 β π1π2 … β ππ−1ππ a ππ = π1 … ππ π π0 π1 π π1 π2 …π π π−1 ππ ππ π£ π π0 π1 π£ π1π2 … π£ ππ−1ππ u ππ /p π π we can do sampling on π» π π’ to estimate its value, and then evaluate the dominant eigenvector π₯1 by a proper scaling. From the Rayleigh quotient, π₯ π π»π₯ π= π π₯ π₯ the dominant eigenvalue π1 be approximated based on the estimated vector of π₯1 . Summary • This Class – Monte Carlo Linear Solver • von Neumann and Ulam method • Randomize Stationary iterative methods • Variations of Monte Carlo solver – Fredholm integral equations of the second kind – The Dirichlet Problem – Eigenvalue Problems What I want you to do? • Review Slides • Work on Assignment 4