Hi all: Is there a Sage command similar to Maple 11's 'simplify/siderels' which simplifies an expression with respect to given relations? I couldn't find mention of such a command in the Sage documentation. For more details, here's the Maple 11 help documentation.
Alex ================================================== simplify/siderels - simplify with respect to side relations Calling Sequence simplify(expr, eqns) simplify(expr, eqns, vars) simplify(expr, eqns, tord) simplify(expr, eqns, 'mindeg') Parameters expr - expression eqns - set or list of equations (an expression e is understood as the equation e=0) vars - (optional) set or list of variables appearing in eqns tord - (optional) a monomial order in the variables appearing in eqns Description Simplification of expr with respect to the side relations eqns is performed. The result is an expression which is mathematically equivalent to expr but which is in normal form with respect to the specified side relations. In all cases simplify computes a Groebner basis for the set of side relations. This basis contains all the algebraic consequences of eqns, so that if a expr can be rewritten in terms of the relations then simplify will reduce it to zero. Otherwise, simplify returns a remainder in which none of the terms are reducible. To ensure a finite division process simplify must impose a total order on terms which can appear. This order, called a monomial order, is used for both the Groebner basis computation and the division. The monomial order is specified by an optional third argument, and different orders can drastically affect a non-zero result: If vars is a list then pure lexicographic (plex) order is used and the leftmost variables are eliminated first. If vars is a set then a total degree (tdeg) order is used and terms with the highest degree in all the variables are eliminated first. Terms with the same total degree are ordered heuristically. If no third argument was specified then lexicographic order is used and variables appearing on the left hand side of an equation (in eqns) are eliminated first. If a monomial order tord is specified, then that order is used for all computations. See Groebner[MonomialOrders] for a list of the available monomial orders. If expr is a rational expression then one of three algorithms can be used. If the optional third argument vars is specified (or omitted) then simplification is applied to the numerator and denominator separately. This method is very fast, however no attempt is made to simplify the ratio of the numerator and denominator so simpler representations of the fraction may be missed. If a monomial order tord is specified then the largest monomial appearing in the numerator and denominator is minimized with respect to tord. The result is a simplified canonical form with respect to the monomial order. Note that in some cases a common factor may be introduced to satisfy this requirement, as in example 2 below. If the denominator is invertible or if it divides the numerator modulo the side relations then a quotient is computed and returned instead. The optional argument 'mindeg' minimizes the sum of the degrees of the resulting fraction. It uses a global search to find an equivalent fraction a/b with deg(a)+deg(b) minimal. The result is not canonical, however in some cases the output may be preferable to a canonical form (see example 3). In general the search is exponential time in deg(a) +deg(b). If the expression is neither a polynomial nor a rational function in the variables, simplify will recurse on the input expr and apply the normalization to any subexpressions which are rational functions in the variables. Examples Example 1: trigonometric polynomials eqns := {sin(x)^2 + cos(x)^2 = 1}: e := sin(x)^3-11*sin(x)^2*cos(x)+3*cos(x)^3-sin(x)*cos(x)+2; 3 2 3 e := sin(x) - 11 sin(x) cos(x) + 3 cos(x) - sin(x) cos(x) + 2 simplify(e, eqns); 2 3 2 - sin(x) cos(x) - 14 sin(x) cos(x) + sin(x) + 3 cos(x) simplify(e, eqns, [sin(x),cos(x)]); # eliminate sin(x) first 3 2 2 - sin(x) cos(x) + 14 cos(x) - 11 cos(x) + sin(x) - sin(x) cos(x) simplify(e, eqns, [cos(x),sin(x)]); # eliminate cos(x) first 2 3 2 - sin(x) cos(x) - 14 sin(x) cos(x) + sin(x) + 3 cos(x) f := 8*sin(x)^4*cos(x)+15*sin(x)^2*cos(x)^3-15*sin(x)^2*cos(x) +7*cos(x)^5-14*cos(x)^3+7*cos(x); 4 2 3 2 5 f := 8 sin(x) cos(x) + 15 sin(x) cos(x) - 15 sin(x) cos(x) + 7 cos(x) 3 - 14 cos(x) + 7 cos(x) simplify(f, eqns); 0 r := (1-cos(x)^2+sin(x)*cos(x))/(sin(x)*cos(x)+cos(x)^2); 2 1 - cos(x) + sin(x) cos(x) r := --------------------------- 2 sin(x) cos(x) + cos(x) simplify(r, eqns); # numerator and denominator reduced seperately 2 sin(x) cos(x) + sin(x) --------------------------- 2 sin(x) cos(x) + 1 - sin(x) simplify(r, eqns, 'mindeg'); # their ratio is simplified sin(x) ------ cos(x) Example 2: a non trivial example eqns2 := {x*y^5-x-y}; / 5 \ eqns2 := { x y - x - y } \ / r := (y^5+x+y)/(x-y); 5 y + x + y r := ---------- x - y simplify(r, eqns2, tdeg(x,y)); # a common factor of x is introduced 2 x + x y + x + y ---------------- 2 x - x y simplify(r, eqns2, plex(x,y)); # highest degree in x is minimized 5 9 4 y + y - y ------------ 5 -y + 2 simplify(r, eqns2, 'mindeg'); # sum of degrees is minimized 2 x + x y + x + y ---------------- 2 x - x y r2 := (-x^3-y*x^2-x^4-y*x^3+2*x*y^4+2*y^4+y^5+x+y)/ (y*x^3-x^4+2*x*y^4-4+x-y); 3 2 4 3 4 4 5 -x - y x - x - y x + 2 x y + 2 y + y + x + y r2 := --------------------------------------------------- 3 4 4 y x - x + 2 x y - 4 + x - y simplify(r2,eqns2); # numerator and denominator are reduced seperately 3 2 4 3 4 4 5 x + y x + x + y x - 2 x y - 2 y - y - x - y -------------------------------------------------- 3 4 4 -y x + x - 2 x y + 4 - x + y simplify(r2,eqns2,tdeg(x,y)); # fraction is simplified to a canonical form 2 x + x y + x + y ---------------- 2 x - x y Example 3: the canonical form algorithm may increase total degree eqns3 := {x^5+x*y-1}; / 5 \ eqns3 := { x + x y - 1 } \ / r := (x^3*y^3-x^4+x-1)/(x^2-y^2+1); 3 3 4 y x - x + x - 1 r := ------------------ 2 2 x - y + 1 simplify(r, eqns3, tdeg(x,y)); # smaller monomials are obtained at the cost of degree 4 3 2 3 2 x y - x - y x - y + x + x ------------------------------ 4 2 2 2 -x + x y - x simplify(r, eqns3, 'mindeg'); # the input had minimal degree 3 3 4 y x - x + x - 1 ------------------ 2 2 x - y + 1 Example 4: the side relations define a field eqns4 := {z^3-z^2-z*y+2*y^2=1, z^3+y^2=1, z^2+z*y-y^2=0, x+y=z}; / 3 2 2 3 2 2 2 eqns4 := { z - z - z y + 2 y = 1, z + y = 1, z + z y - y = 0, x + y = z \ \ } / h1 := 36*z^4*y^2+36*z*y^4-36*z*y^2-1/2*z^2+z*y-1/2*y^2+1/2*x*z-1/2*x*y +2/3*z^4+4/3*z^3*y-2/3*z^2*y^2-4/3*z*y^3+2/3*y^4; 4 2 4 2 1 2 1 2 1 1 2 4 h1 := 36 z y + 36 z y - 36 z y - - z + z y - - y + - x z - - x y + - z 2 2 2 2 3 4 3 2 2 2 4 3 2 4 + - z y - - z y - - z y + - y 3 3 3 3 simplify(h1, eqns4); 0 h2 := z*y^2+z^3*y^3-3*z^2*y +23/3+5/6*z^2+7/3*z*y-11/6*y^2+1/2*x*z-1/2*x*y +2/3*z^4+4/3*z^3*y-2/3*z^2*y^2-4/3*z*y^3+2/3*y^4; 2 3 3 2 23 5 2 7 11 2 1 1 2 4 h2 := z y + z y - 3 z y + -- + - z + - z y - -- y + - x z - - x y + - z 3 6 3 6 2 2 3 4 3 2 2 2 4 3 2 4 + - z y - - z y - - z y + - y 3 3 3 3 simplify(h2, eqns4, {x,y,z}); 34 2 2 - -- + 8 z + 13 y + 16 z - 34 z y + 14 z y 3 simplify(h2, eqns4, lexdeg([x,z],[y])); 29 5 2 -- - y - 2 y 3 h2inv := simplify(1/h2, eqns4, tdeg(x,z,y)); # inverse is computed 4473752523 236183994 321405507 36881532 h2inv := ----------- + ----------- z + ----------- y + ----------- z y 42772565971 42772565971 42772565971 42772565971 815384160 2 252548433 3 + ----------- y + ----------- y 42772565971 42772565971 simplify(h2*h2inv, eqns4); 1 Example 5: a difficult example that can not be handled by other methods eqns5 := {y^2-x^3+x*y-1}; / 2 3 \ eqns5 := { y - x + x y - 1 } \ / algcurves[parametrization](op(eqns5), x, y, t); # can not map into Q(t) Error, (in algcurves/ratpar) genus is not zero r := (-y^3+1-2*y*x^2-x^2*y^5-2*x*y^2-y^6*x-y^7+y^6)/(y^3-2*y^2+1); 3 2 2 5 2 6 7 6 -y + 1 - 2 y x - x y - 2 x y - x y - y + y r := -------------------------------------------------- 3 2 y - 2 y + 1 simplify(r,eqns5,tdeg(x,y)); 5 y + x + y ---------- x - y See Also algcurves[parametrization], Groebner[Basis], Groebner[NormalForm], Groebner[MonomialOrders] References D. Cox, J. Little, D. O'Shea. Ideals, Varieties, and Algorithms. Second Edition. Springer-Verlag, 1997 M. Monagan, R. Pearce. Rational Simplification Modulo a Polynomial Ideal. ISSAC 2006 proceedings. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---