Aha! Quite the challenge is it not? On Sun, Apr 19, 2009 at 7:44 AM, Maurizio <maurizio.gran...@gmail.com>wrote:
> > Hi all > > > Well, we just need a resultant algorithm that doesn't go through > > Singular. I'm planning to write such a thing as part of my > > cylindrical algebraic decomposition implementation sometime in the > > next few months. > > > > Carl > > yes, I agree with that. > > William, unfortunately I can't understand what the function "variety" > will help for. Basically, I just wanted to see if I could implement > the most basic algorithm for rational functions integration, and I > followed the link in the Pynac wiki. Probably, my mistake was to > introduce polynomials in this path, but that's the only place where I > found the "resultant()" function. Do you have any alternative > suggestion? > > Carl, I took advantage of your suggestion, even though I assume I > can't still go through the whole process with the current gcd > capabilities in Pynac. But before than that, I'd like to point out > something strange I did notice, and maybe also Burcin can help with > that: > > reset() > # P.<x,y,z> = PolynomialRing(QQ) > # P.<x,y,z> = GF(5)[] > P.<x,z> = QQ[] > > A = 1 > B = x^3 + x > > tores = A - z*diff(B,x) > res = tores.resultant(B,x); factor(res) > res1 = res.univariate_polynomial() > sol1 = res1.roots(ring = QQbar) > > with this code, I get the roots over QQbar, which is useful. Then I'd > like to move to the symbolic field and I do this: > > var('x, zs', ns = 1) > from sage.symbolic.ring import NSR > As = NSR(A) > Bs = NSR(B) > Bs > x^3 + x > Bs.diff(x) > 0 > > So, the derivative is not working. Which is the cause? It seems that > the "x" in Bs is not the "x" I declared, so the derivative gets 0 as a > result. Which is the reason? > > Assuming to go on (manually for the moment), I do: > c1 = QQbar(sol1[0][0]) > v1a = A - c1*(3*x^2 + 1) > Bs.gcd(v1a) > > Traceback (click to the left for traceback) > ... > RuntimeError: gcd: arguments must be polynomials over the rationals > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/notebook/sage_notebook/worksheets/admin/4/code/135.py", > line 9, in <module> > Bs.gcd(v1a) > File "/usr/local/sage/local/lib/python2.5/site-packages/ > zope.interface-3.3.0-py2.5-linux-i686.egg/", line 1, in <module> > > File "expression.pyx", line 1624, in > sage.symbolic.expression.Expression.gcd (sage/symbolic/expression.cpp: > 8608) > RuntimeError: gcd: arguments must be polynomials over the rationals > > My point is: even though I could get the roots in QQbar (which are > exact), it seems that Pynac is not happy to work with QQbar > quantities, the only supported seems to be QQ pure rationals. > > Moreover, I don't see this being the right way to do this, because > (for this particular problem: integration) I don't like having the > numerical representation of things like sqrt(5), even if the result is > still correct, so that > > temp = QQbar(sqrt(5)); temp > 2.236067977499790? > > temp^2 > 5.000000000000000? > > So, please tell me. Which should be the right way to try to approach > this indefinite integration problem? You can see that I'm not that > good in deep mathematical theory, but approaching the simplest problem > (that could be different from this one I'm looking at right now) is > fun :) > > Regards > > Maurizio > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---