On Tue, 4 May 2010, Raymond Toy wrote:
< On 5/3/10 9:41 AM, Raymond Toy wrote:
< > Here is a very rudimentary implementation of the Rothstein-Trager
< > algorithm. Seems to work for the few tests that I've run.
< >
< > f:(x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4)$
< > int_rational_function(f,x);
< > -> lsum(t*log(x^3+t*x^2-3*x-2*t)/2,t,rootsof(t^2+1))
< >
< > One refinement that needs to be done is to try to solve for the roots
< > and substitute them in if possible, instead of leaving the result as a
< > sum over the roots.
<
< I've enhanced the code somewhat, but am now running into a problem.
<
< When trying to integrate (x^7-24*x^4-4*x^2+8*x-8) /
< (x^8+6*x^6+12*x^4+8*x^2), the Rothstein-Trager algorithm is called to
< integrate 1/x.
<
< To do this, the algorithm wants to compute gcd(x,1-t) where t is an
< algebraic number such that t-1=0.
<
< tellrat(t-1)$
< gcd(x,1-t),algebraic:true,gcd:subres;
<
< -> 1.
<
< Is that correct? Based on the algorithm description, it seems that the
< expected answer is x. Then the algorithm would return
< lsum(t*log(x),t,rootsof(t-1)) = log(x).
<
< Ray
Ray, by convention, gcd(a,0)=a when a is a positive integer. Actually,
this is not simply a convention, because a is the greatest common
divisor of a and 0.
Note that Maxima's gcd correctly computes this.
I also see that cvs Maxima gives the correct answer for your problem,
too.
(%i1) declare(a,integer)$ assume(a>0)$
(%i3) gcd(a,0);
(%o3) a
(%i4) gcd(x,0);
(%o4) x
(%i5) tellrat(t-1)$
(%i6) gcd(x,1-t),algebraic:true,gcd:subres;
(%o6) x
(%i7) build_info();
Maxima version: 5.20post
Maxima build date: 14:55 4/30/2010
Host type: i686-pc-linux-gnu
Lisp implementation type: CMU Common Lisp
Lisp implementation version: CVS 19d 19d-release (19D)
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.