Simon, thanks! But in general there is no (Sage) algoritm to simplify expressions given some equalities?
Rolandb On 21 jul, 08:05, Simon King <simon.k...@uni-jena.de> wrote: > Hi Roland, > > On 21 Jul., 06:33, Rolandb <rola...@planet.nl> wrote: > > > Hi, > > How to simplify an expression if you have some known relations > > (equalities)? Example: > > > relation: 0 = a*x1^2 + b*x2^2 > > expression = (a*x1^2 + b*x2^2)*y1+b*y2^3 > > Are all your relations polynomial? Then the standard solution is to > use Gröbner bases and reduction. For example: > > sage: R.<x,y,z> = QQ[] > sage: I = [x*y+z,y*z+x]*R > > So, the ideal I contains some relations, namely x*y+z=0 and y*z+x=0, > and all of its consequences. > > It is easy to see that x^2-z^2 is a consequence of the relations. > Indeed: > > sage: G = I.groebner_basis() > sage: G > [x^2 - z^2, x*y + z, y*z + x] > sage: f = x^2 + x*y*z + x*z > sage: f.reduce(G) > x*z > > Of course, it is essential that one uses a Gröbner basis in the > reduction: The original generating set of I is not appropriate: > > sage: (x^2-z^2).reduce(I) > x^2 - z^2 > sage: (x^2-z^2).reduce(G) > 0 > > Cheers, > Simon --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---