# Numerically solving linear equation and optimization

I have to solve for $x$ in the linear equation $Ax=B$. However, $A$ has singular values that are close to zero (very small). So direct inversion is not a good idea. I wanted to solve for $x$ using one of the numerical equation solvers? Does any one know which is the best one I could use? I used conjugate gradient method but the convergence is not achieved. Any better method?

-

## 1 Answer

Most solvers today use Singular Value Decomposition. See, for example, Numerical Recipes in C, Sec. 2.6.

-
thanks for the reply. The problem is A has singular value that is falling below machine precision. I have tried using truncated SVD and I find that does no better job than conjugate gradient. Even though conjugate gradient does not converge (is unstable) it still looks gives solution that are closer to the expected one. At the moment I dont know where to truncate it and how small a singular value can the algorithm handle. I was wondering if there was some other algorithm that would ensure convergence. –  SPB Jan 2 '13 at 15:51