On Jan 11, 3:09 pm, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > I was able to do the job with SAGE, but I have to confess it was not as easy > as in Maple (however I am still more fluent in Maple): > > ---------------------------------------------------------------------- > | SAGE Version 2.9.3, Release Date: 2008-01-05 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > sage: var('x1,y1,x2,y2,x3,y3,a,b') > sage: eq1 = y1^2 -(x1^3+a*x1+b) > sage: eq2 = y2^2 -(x2^3+a*x2+b) > sage: eq3 = y3^2 -(x3^3+a*x3+b) > sage: lambda12 = (y1 - y2)/(x1 - x2) > sage: x4 = (lambda12*lambda12 - x1 - x2) > sage: nu12 = (y1 - lambda12*x1) > sage: y4 = (-lambda12*x4 - nu12) > sage: lambda23 = ((y2 - y3)/(x2 - x3)) > sage: x5 = (lambda23*lambda23 - x2 - x3) > sage: nu23 = (y2 - lambda23*x2) > sage: y5 = (-lambda23*x5 - nu23) > sage: s1 =(x1 - x5)*(x1 - x5)*((y3 - y4)*(y3-y4) - (x3+x4)*(x3-x4)*(x3-x4)) > sage: s2 =(x3 - x4)*(x3 - x4)*((y1 - y5)*(y1-y5) - (x1+x5)*(x1-x5)*(x1-x5)) > sage: n12 = numerator(factor(s1-s2)) > sage: R = singular.ring(0, '(a,b,x1,x2,x3,y1,y2,y3)') > sage: I = singular.ideal([repr(eq1), repr(eq2), repr(eq3)]) > sage: I2 = I.groebner() > sage: singular.reduce(repr(n12), I2) > > 0
Here is a more idiomatic way to do this computation in Sage. We work in the fraction field of a multivariate polynomial ring; this means that our polynomial arithmetic is handled by libSingular instead of by maxima, and that we can get the numerator directly with "numerator", since fraction field elements are always normalized. Also, we use Sage's wrapper of ideals and Groebner bases (which I believe is implemented with libSingular), rather than calling Singular. (Avoiding the call to "factor(s1-s2)" means that this version is much faster.) sage: R.<x1,y1,x2,y2,x3,y3,a,b> = QQ[] sage: eq1 = y1^2 -(x1^3+a*x1+b) sage: eq2 = y2^2 -(x2^3+a*x2+b) sage: eq3 = y3^2 -(x3^3+a*x3+b) sage: lambda12 = (y1 - y2)/(x1 - x2) sage: x4 = (lambda12*lambda12 - x1 - x2) sage: nu12 = (y1 - lambda12*x1) sage: y4 = (-lambda12*x4 - nu12) sage: lambda23 = ((y2 - y3)/(x2 - x3)) sage: x5 = (lambda23*lambda23 - x2 - x3) sage: nu23 = (y2 - lambda23*x2) sage: y5 = (-lambda23*x5 - nu23) sage: s1 =(x1 - x5)*(x1 - x5)*((y3 - y4)*(y3-y4) - (x3+x4)*(x3-x4)*(x3- x4)) sage: s2 =(x3 - x4)*(x3 - x4)*((y1 - y5)*(y1-y5) - (x1+x5)*(x1-x5)*(x1- x5)) sage: n12 = numerator(s1-s2) sage: I = ideal([eq1,eq2,eq3]) sage: I.reduce(n12) 0 > Paul Zimmermann Carl Witty --~--~---------~--~----~------------~-------~--~----~ 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---