# [GiNaC-list] lsolve problem

Richard B. Kreckel kreckel at ginac.de
Thu Feb 21 23:41:00 CET 2008

```Hi!

Diego Conti wrote:
> Yes, as far as I can tell your patch corrects the problem. The code I
> sent earlier is part of a list of computations I have been doing on the
> group SU(3); the sqrt(3) appears in the structure constants. I have
> repeated the calculations after applying your patch, and I have obtained
> consistent results.

I've just committed a slightly enhanced version of that patch.

I should point out that it doesn't give you any guarantee that systems
of equations containing roots as coefficients can be solved adequately
by any of the elimination algorithms.

Consider this:

#include "ginac/ginac.h"
#include <iostream>
using namespace std;
using namespace GiNaC;

int main()
{
symbol a("a"), b("b");
lst eqns, syms;
eqns.append(8*b+sqrt(ex(24))*a==0);
eqns.append(sqrt(ex(3))*a+b*sqrt(ex(8))==1);
syms = a, b;

cout << lsolve(eqns,syms,solve_algo::gauss) << endl;
cout << lsolve(eqns,syms,solve_algo::divfree) << endl;
cout << lsolve(eqns,syms,solve_algo::bareiss) << endl;
}

All three elimination algorithms will construct solutions of a and b
that are, in fact, divergent.

This is all due to the difficulty of deciding whether an expression is
zero or not. In the example above, GiNaC doesn't recognize that
sqrt(24)*sqrt(3)-3*sqrt(8) is just a blown-up zero. If GiNaC were able
to this, it wouldn't take long until we hit the next barrier:
Richardson's theorem.

However, if sqrt(3) is the only non-numeric term showing up, as I assume
is the case in Diego's SU(3) computations, all goes well.

-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
```