[GAP Forum] solving equations

stefan at mcs.st-and.ac.uk stefan at mcs.st-and.ac.uk
Tue May 18 21:11:12 BST 2010


Dear Forum,

Jan Schneider asked:

> can anybody tell me how to solve multiple equations with GAP?
> I know, it's a pretty easy question, but I just started working with GAP.
> For example, what do I have to do to let GAP calculate 5*x+y = 17, x*y=18?

You can proceed as follows:

First define the variables you need:

gap> x := Indeterminate(Rationals,1);; SetName(x,"x");
gap> y := Indeterminate(Rationals,2);; SetName(y,"y");

Then compute a reduced Groebner basis for the ideal of C[x,y] defined by
your equations, for lex order:

gap> ReducedGroebnerBasis([5*x+y-17,x*y-18],MonomialLexOrdering());
[ y^2-17*y+90, x+1/5*y-17/5 ]

Then solve the first equation y^2-17*y+90 = 0 for y (note that it is
an equation in y, only). Finally, insert the solutions into the second
equation x+1/5*y-17/5 = 0 to compute the possible values of x.

This process works in a similar way general.
-- You can find details in standard textbooks like

Cox, Little, O'Shea: Ideals, Varieties, and Algorithms:
An Introduction to Computational Algebraic Geometry and Commutative Algebra.

If you encounter a univariate polynomial whose Galois group is solvable,
you can use the GAP Package RadiRoot
( see http://www.gap-system.org/Packages/radiroot.html ) by Andreas Distler
to compute representations of its roots in terms of radicals.

There is presently no code in GAP to compute solutions numerically.

Hope this helps,

    Stefan Kohl





More information about the Forum mailing list