[GiNaC-list] Randomness when using lsolve
Federico Bergero
fedebergero at gmail.com
Thu Jan 16 20:20:31 CET 2014
Hello everybody I'm new to GiNaC.
I'm trying to use it to solve linear algebraic system of equations and
running the example from the tutorial
https://www.ginac.de/tutorial/Solving-linear-systems-of-equations.html#Solving-linear-systems-of-equations
symbol a("a"), b("b"), x("x"), y("y");
lst eqns, vars;
eqns = a*x+b*y==3, x-y==b;
vars = x, y;
cout << lsolve(eqns, vars) << endl;
While it works perfectly when I run it several times I get different
solutions (they are all equivalent though). For example:
{x==(3+b^2)*(a+b)^(-1),y==-(a+b)^(-1)*(-3+a*b)}
or
{x==(b+a)^(-1)*(3+b^2),y==-(-3+b*a)*(b+a)^(-1)}
what is going on there? Is there a way to have a deterministic solution?
Thanks in advance.
Fede
--
I find television very educational. Every time someone switches it on,
I go into another room and read a good book.
More information about the GiNaC-list
mailing list