# [GiNaC-list] solving linear systems with ginac

Kent-Andre Mardal kent-and at simula.no
Wed Dec 14 11:22:55 CET 2005

```First of all, I would like to say that the GiNaC package is great!
I have used it a lot lately!

Now, I am trying to solve a linear system, which consists of
18 equations and 18 variables. The matrix and right-hand side
do not contain floating point numbers.

I have done similar things with smaller matrices
and I very much appreciate that GiNaC gives
the solution in non-floating point numbers. However,
in this concrete case (which is list below).
GiNaC is not able to solve the system
on my machine with 1 Gb RAM. It runs out of memory!

It is of course possible to solve this linear system by using some
other library, but it also seems a bit strange that a 18x18 matrix
should be that hard to invert. The matrix is non-singular and non
of the eigenvalues are "close to 0".

The matrix and right-hand side are as follows:

Matrix:
[
[0,0,0,0,-1/5,0,0,0,0,0,0,0,0,0,-1/30,-1/10,0,0],
[0,0,0,0,-1/20,0,0,0,0,0,0,0,0,0,-1/20,-1/15,0,0],
[0,0,0,0,-1/30,0,0,0,0,0,0,0,0,0,-1/5,-1/10,0,0],
[0,0,0,0,0,0,1/30,1/5,0,0,0,0,0,1/10,0,0,0,0],
[0,0,0,0,0,0,1/20,1/20,0,0,0,0,0,1/15,0,0,0,0],
[0,0,0,0,0,0,1/5,1/30,0,0,0,0,0,1/10,0,0,0,0],
[1/30*sqrt(2),1/10*sqrt(2),0,0,1/30*sqrt(2),0,0,1/5*sqrt(2),1/10*sqrt(2),0,1/5*sqrt(2),1/30*sqrt(2),0,0,0,0,1/10*sqrt(2),1/5*sqrt(2)],
[1/20*sqrt(2),1/15*sqrt(2),0,0,1/20*sqrt(2),0,0,1/20*sqrt(2),1/15*sqrt(2),0,1/20*sqrt(2),1/20*sqrt(2),0,0,0,0,1/15*sqrt(2),1/20*sqrt(2)],
[1/5*sqrt(2),1/10*sqrt(2),0,0,1/5*sqrt(2),0,0,1/30*sqrt(2),1/10*sqrt(2),0,1/30*sqrt(2),1/5*sqrt(2),0,0,0,0,1/10*sqrt(2),1/30*sqrt(2)],
[1/60,1/30,0,1/360,0,1/180,1/60,1/20,0,1/180,0,1/120,1/60,1/30,0,0,1/90,1/120],
[1/20,1/30,0,1/180,0,1/60,1/60,1/60,0,1/180,0,1/30,1/30,1/60,0,0,1/60,1/180],
[1/60,1/60,0,1/120,0,1/90,1/20,1/60,0,1/180,0,1/120,1/30,1/30,0,0,1/180,1/360],
[0,0,1/30,1/180,1/60,1/180,0,0,1/30,1/60,1/20,1/180,0,0,1/60,1/60,1/60,1/30],
[0,0,1/60,1/360,1/20,1/180,0,0,1/30,1/180,1/60,1/120,0,0,1/60,1/30,1/90,1/120],
[0,0,1/30,1/120,1/60,1/180,0,0,1/60,1/90,1/60,1/360,0,0,1/20,1/30,1/180,1/120],
[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,-2,0,0,0,0,0,2,0,0,0,0,0,0,0,0],
[0,0,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0]]
rhs:
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]

Kent-Andre Mardal
Simula Research Laboratory

```