COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### trouble solving system of linear equations for symbolic computation #2

• Follow

```Hi,

I have run into a problem of solving a system of linear equations. When solving A*x = b' by x = linsolve(A, b'), I get

Matrix is close to singular or badly scaled.  Results may be inaccurate. RCOND = 8.968388e-20.

Here is what matrix A and vector b look like:

A = [
1.0 0.99 0.9801 0.9702989999999999 0.96059601 0.9509900498999999 0.9414801494009999 ... 0.38692390084819756 0.3791854228312336 ;
1.0 0.97 0.9409 0.912673 0.8852928099999999 0.8587340256999999 0.8329720049289999 ... 0.23893045520948622 0.23176254155320164 ;
......
1.0 0.51 0.2601 0.132651 0.06765201 0.0345025251 0.017596287801 ... 1.802180460114414E-14 9.191120346583511E-15 ;
];

b = [5.8469156198187576E-46 6.0370427295048585E-46 6.177503822919101E-46 ... 5.743590076653649E-48 4.637078172618629E-48 ];

Basically I have a function F(x) which can be evaluated by running an algorithm on a graph, which takes time and for a different input x, I need to rerun the same procedure. But I know by construction, F(x) is a polynomial of x up to 50th degree, i.e.,
F(x) = c_{0}*x^{0} + c_{1}*x^{1} + ... + c_{50}*x^{50}. However I don't know the coefficient, knowing which would allow me to evaluate F(x) symbolically and more efficient than operating on a graph. What I am doing above is pick 51 different x's and evaluate F(x) for them, then I get the matrix A =

[ x_{1}^0 x_{1}^1 ... x_{1}^50 ;
x_{2}^0 x_{2}^1 ... x_{2}^50 ;
...
x_{51}^0 x_{51}^1 ... x_{51}^50 ;]

and b = [ F(x_{1}) F(x_{2}) ... F(x_{51})];

Since x can be only taken from [0,1] and F(x) evaluates to a really small number (probility), that's why I am getting the above matrix with tiny numerics. I think the matrix is not singular since x's are picked random. So it must be badly scaled.

Anyone can spot the problem and/or propose a way to precondition the system?

Thanks a lot!
Ming
```
 0

```"Ming " <mingsu@u.washington.edu> wrote in message <iao389\$n81\$1@fred.mathworks.com>...
> Hi,
>
> I have run into a problem of solving a system of linear equations. When solving A*x = b' by x = linsolve(A, b'), I get
>
> Matrix is close to singular or badly scaled.  Results may be inaccurate. RCOND = 8.968388e-20.
>
> Here is what matrix A and vector b look like:
>
> A = [
> 1.0 0.99 0.9801 0.9702989999999999 0.96059601 0.9509900498999999 0.9414801494009999 ... 0.38692390084819756 0.3791854228312336 ;
> 1.0 0.97 0.9409 0.912673 0.8852928099999999 0.8587340256999999 0.8329720049289999 ... 0.23893045520948622 0.23176254155320164 ;
>                                               ......
> 1.0 0.51 0.2601 0.132651 0.06765201 0.0345025251 0.017596287801 ... 1.802180460114414E-14 9.191120346583511E-15 ;
> ];
>
> b = [5.8469156198187576E-46 6.0370427295048585E-46 6.177503822919101E-46 ... 5.743590076653649E-48 4.637078172618629E-48 ];
>
> Basically I have a function F(x) which can be evaluated by running an algorithm on a graph, which takes time and for a different input x, I need to rerun the same procedure. But I know by construction, F(x) is a polynomial of x up to 50th degree, i.e.,
> F(x) = c_{0}*x^{0} + c_{1}*x^{1} + ... + c_{50}*x^{50}. However I don't know the coefficient, knowing which would allow me to evaluate F(x) symbolically and more efficient than operating on a graph. What I am doing above is pick 51 different x's and evaluate F(x) for them, then I get the matrix A =
>
> [ x_{1}^0 x_{1}^1 ... x_{1}^50 ;
>   x_{2}^0 x_{2}^1 ... x_{2}^50 ;
>                ...
>   x_{51}^0 x_{51}^1 ... x_{51}^50 ;]
>
> and b = [ F(x_{1}) F(x_{2}) ... F(x_{51})];
>
> Since x can be only taken from [0,1] and F(x) evaluates to a really small number (probility), that's why I am getting the above matrix with tiny numerics. I think the matrix is not singular since x's are picked random. So it must be badly scaled.
>
> Anyone can spot the problem and/or propose a way to precondition the system?
>

Trying to solve for the coefficients of a 50th degree
polynomial in the first place.

People think that because a quadratic polynomial fits
better than a linear polynomial, and then they do
even better with a cubic, so why not use a 50th
degree polynomial? Surprise!

You cannot push things forever. There are limits to
everything. To go anywhere near that point is folly.

John
```
 0

1 Replies
347 Views

Similiar Articles:

7/25/2012 10:14:25 AM