Page **1** of **1**

### estimating the best solution for hom. lin. equations

Posted:

**Sun Feb 19, 2006 1:02 pm**
by **alexatlapack**

Hallo,

I have the following problem:

I used dgesvx to solve the problem Ax=B. I now have some cases, where

B=0, -> a set of homogenous equations. dgesvx returns the trivial

solution x=0 which does not help much. What I need is the vector x which produces the lowest error (~the best nontrivial x).

I checked the lls routines, but think that they work only for b

.notequal. 0.

any tips how to solve this problem?

thanks

alex

Posted:

**Sun Feb 19, 2006 1:46 pm**
by **Julien Langou**

Hello,

I assume your matrix is nonsingular (i.e. full rank)? and there is no symmetry in it? (This will not make much difference however.)

If A is nonsingular and you want to solve Ax=b with b=0 with DGESV (or DGESVX) then there is a unique solution, it is the trivial solution x=0 and there is nothing to do about it. This is the answer given by DGESV (or DGESVX). Trivial solution for trivial problem. You will have the same answer (x=0) using Linear Least Squares (LLS) routines (e.g. DGELS).

If you want some help, you need to specify your problem more specifically and I can not figure which problem you want to solve.

So from what you wrote, I'd say you want to solve the problem:

(*) min_{|| x ||_2=1} { || A x ||_2 }

Is it what you want to solve?

The residual of Ax=b when be b=0 is ||Ax|| right?

That's what you are calling error?

If your only constraint on the norm of x is 'x is different from 0' then your problem is not well posed since for any solution x, 1/10.x has 1/10 smaller ||Ax||.

So in general you impose ||x||_2=1.

Then the problem (*) is the problem of finding the minimum singular vector of the matrix A. Then we can help. For example you can use DGESVD or some other routines. Just confirm this is your problem. Also how large n is going to be?

Julien

Posted:

**Tue Feb 21, 2006 3:12 am**
by **alexatlapack**

Hello Julien,

thank you for your advice. I took a close look at the 'coupled differential equations' problem which I want to solve and found, that I can reduce the problem to n-1 inhomogenous equations [instead of n homogenous].

I have an extra free parameter which needs to be determined [for the curious ones: I (try) to solve SchrÃ¶dinger's equation for nonspherical potentials on a logarithmic radial grid].

I now use a 2 step mechanism:

The inhomogeneous system can be solved by DGESV(X) and I can then use the n-th condition to get a hint in which direction the free parameter should be changed. Then I use a better estimate for the parameter, call DGESV and so on.

seems to work.

Thank you

Alex