home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.math.symbolic      Symbolic algebra discussion      10,432 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,372 of 10,432   
   Sam Blake to Sam Blake   
   Re: A rational integral and Rioboo's alg   
   03 Jan 24 18:34:50   
   
   From: samuel.thomas.blake@gmail.com   
      
   On Thursday, January 4, 2024 at 12:24:05 PM UTC+11, Sam Blake wrote:   
   > On Thursday, January 4, 2024 at 5:07:54 AM UTC+11, nob...@nowhere.invalid   
   wrote:    
   > > Richard Fateman schrieb:    
   > > >    
   > > > On Tuesday, January 2, 2024 at 12:32:26 PM UTC-8, nob...   
   nowhere.invalid wrote:    
   > > > >    
   > > > > Sam Blake schrieb:    
   > > > > >    
   > > > > > For fun I have been implementing the rational integral routines from    
   > > > > > Bronstein's Symbolic Integration I in Mathematica. As part of my    
   > > > > > testing I stumbled across the following example integral    
   > > > > >    
   > > > > > \int x/(2 + 4 x + 5 x^2 + 2 x^3 + x^4) dx    
   > > > > >    
   > > > > > Rubi does well on this example    
   > > > > >    
   > > > > > In[66]:= Int[x/(2 + 4 x + 5 x^2 + 2 x^3 + x^4), x]    
   > > > > >    
   > > > > > Out[66]= -(ArcTan[(1 + 2 x)/Sqrt[7 - 4 Sqrt[2]]]/(    
   > > > > > 2 Sqrt[2 (7 - 4 Sqrt[2])])) +    
   > > > > > ArcTan[(1 + 2 x)/Sqrt[7 + 4 Sqrt[2]]]/(2 Sqrt[2 (7 + 4 Sqrt[2])]) -    
   > > > > > ArcTanh[(7 + 4 (1/2 + x)^2)/(4 Sqrt[2])]/(2 Sqrt[2])    
   > > > > >    
   > > > > > While my rational function integrator returns    
   > > > > >    
   > > > > > In[67]:= IntegrateRational[x/(2 + 4 x + 5 x^2 + 2 x^3 + x^4), x]    
   > > > > >    
   > > > > > Out[67]= 1/2 (((-1 + I Sqrt[7 - 4 Sqrt[2]]) Log[    
   > > > > > 1/2 (1 - I Sqrt[7 - 4 Sqrt[2]]) + x])/(    
   > > > > > 2 (2 + 5/2 (-1 + I Sqrt[7 - 4 Sqrt[2]]) +    
   > > > > > 3/4 (-1 + I Sqrt[7 - 4 Sqrt[2]])^2 +    
   > > > > > 1/4 (-1 + I Sqrt[7 - 4 Sqrt[2]])^3)) + ((-1 -    
   > > > > > I Sqrt[7 - 4 Sqrt[2]]) Log[    
   > > > > > 1/2 (1 + I Sqrt[7 - 4 Sqrt[2]]) + x])/(    
   > > > > > 2 (2 + 5/2 (-1 - I Sqrt[7 - 4 Sqrt[2]]) +    
   > > > > > 3/4 (-1 - I Sqrt[7 - 4 Sqrt[2]])^2 +    
   > > > > > 1/4 (-1 - I Sqrt[7 - 4 Sqrt[2]])^3)) + ((-1 +    
   > > > > > I Sqrt[7 + 4 Sqrt[2]]) Log[    
   > > > > > 1/2 (1 - I Sqrt[7 + 4 Sqrt[2]]) + x])/(    
   > > > > > 2 (2 + 5/2 (-1 + I Sqrt[7 + 4 Sqrt[2]]) +    
   > > > > > 3/4 (-1 + I Sqrt[7 + 4 Sqrt[2]])^2 +    
   > > > > > 1/4 (-1 + I Sqrt[7 + 4 Sqrt[2]])^3)) + ((-1 -    
   > > > > > I Sqrt[7 + 4 Sqrt[2]]) Log[    
   > > > > > 1/2 (1 + I Sqrt[7 + 4 Sqrt[2]]) + x])/(    
   > > > > > 2 (2 + 5/2 (-1 - I Sqrt[7 + 4 Sqrt[2]]) +    
   > > > > > 3/4 (-1 - I Sqrt[7 + 4 Sqrt[2]])^2 +    
   > > > > > 1/4 (-1 - I Sqrt[7 + 4 Sqrt[2]])^3)))    
   > > > > >    
   > > > > > I find similar results from AXIOM and FriCAS. Is this a limitation   
   of    
   > > > > > Rioboo's algorithm?    
   > > > > >    
   > > > >    
   > > > > This is an interesting example. Derive 6.10 also solves the integral   
   in    
   > > > > real terms:    
   > > > >    
   > > > > INT(x/(2 + 4*x + 5*x^2 + 2*x^3 + x^4), x)    
   > > > >    
   > > > > SQRT(238 - 136*SQRT(2))*ATAN(SQRT(119 - 68*SQRT(2))*(2*x + 1)/17)/68    
   > > > > - SQRT(136*SQRT(2) + 238)*ATAN(SQRT(68*SQRT(2) + 119)*(2*x + 1)/17)/68    
   > > > > + SQRT(2)*LN((x^2 + x - SQRT(2) + 2)/(x^2 + x + SQRT(2) + 2))/8    
   > > > >    
   > > > > as it starts by factoring the denominator:    
   > > > >    
   > > > > 2 + 4*x + 5*x^2 + 2*x^3 + x^4 =    
   > > > > (x^2 + x + SQRT(2) + 2)*(x^2 + x - SQRT(2) + 2)    
   > > > >    
   > > > > and then expands the integrand into partial fractions. Indeed, the    
   > > > > cubic resolvent of the denominator factors as (y - 4)*(y^2 - y - 4).    
   > > > >    
   > > > > By contrast, FriCAS 1.3.9 returns a whopping:    
   > > > >    
   > > > > [...]    
   > > > >    
   > > > > which is the sum of three logarithms involving many nested rootOf()s    
   > > > > where the %%En denote local variables. The quartic of the inner    
   > > > > rootOf() factors as:    
   > > > >    
   > > > > 544*z^4 - 20*z^2 + 4*z + 1 =    
   > > > > 1/17*(68*SQRT(2)*z^2 + 34*z + 3*SQRT(2) - 1)    
   > > > > *(68*SQRT(2)*z^2 - 34*z + 3*SQRT(2) + 1)    
   > > > >    
   > > > > and its cubic resolvent is (34*y - 3)*(272*y^2 + 34*y + 1).    
   > > > >    
   > > > > Let's see if FriCAS version 1.3.10 will do better.    
   > > > >    
   > > >    
   > > > In Maxima ... factor the denominator in an algebraic field...    
   > > >    
   > > > (%o4) x^4+2*x^3+5*x^2+4*x+2    
   > > > (%i5) factor(%, subst(a,x,%));    
   > > >    
   > > > (%o5) (x-a)*(x+a+1)*(x^2+x+a^2+a+4)    
   > > >    
   > > > from which integration produces a relatively compact form.    
   > > This expresses the factors of the denominator in terms of any one still    
   > > unknown root. Even though all of the roots are complex:    
   > >    
   > > SOLUTIONS(a^4 + 2*a^3 + 5*a^2 + 4*a + 2 = 0, a)    
   > >    
   > > [- 1/2 + #i*SQRT(4*SQRT(2) + 7)/2, - 1/2 - #i*SQRT(4*SQRT(2) + 7)/2,    
   > > - 1/2 + #i*SQRT(7 - 4*SQRT(2))/2, - 1/2 - #i*SQRT(7 - 4*SQRT(2))/2]    
   > >    
   > > the constant a^2 + a in the quadratic factor is real for any of them,    
   > > and so will then be an antiderivative based on the decomposition:    
   > >    
   > > x^4 + 2*x^3 + 5*x^2 + 4*x + 2 =    
   > > (x^2 + x - a^2 - a)*(x^2 + x + a^2 + a + 4)    
   > >    
   > > in which the pair of linear factors is treated as a another quadratic.    
   > >    
   > > If the code in Bronstein's book is indeed claimed to produce a real    
   > > antiderivative for    
   > > IntegrateRational[x/(2 + 4 x + 5 x^2 + 2 x^3 + x^4), x]    
   > > and nothing has been overlooked in the code itself, there should be a    
   > > bug in the Mathematica implementation. Breaking four complex logarithms    
   > > up into real and imaginary parts should be within the capabilities of    
   > > programming on Mathematica - the imaginary parts would finally cancel.    
   > > If the code can identify complex conjugate pairs, the imaginary parts    
   > > could be ignored right away.    
   > >    
   > > Martin.   
   > One issue is in simplification of polynomial coefficients in LogToAtan that   
   must happen prior to calling PolynomialGCD. Here is one of the coefficients:    
   >    
   > In[78]:=    
   > 162 Sqrt[1/17 (7 + 4 Sqrt[2])] - (2030 Sqrt[1/17 (7 + 4 Sqrt[2])])/(    
   > 7 - 4 Sqrt[2]) - 112 Sqrt[2/17 (7 + 4 Sqrt[2])] + (    
   > 1432 Sqrt[2/17 (7 + 4 Sqrt[2])])/(7 - 4 Sqrt[2]) // FullSimplify    
   >    
   > Out[78]= 0    
   >    
   > With this fixed I get the following result:    
   >    
   > In[79]:= IntegrateRational[x/(2 + 4 x + 5 x^2 + 2 x^3 + x^4), x]    
   >    
   > Out[79]=    
   > 1/2 Sqrt[1/34 (7 - 4 Sqrt[2])]    
   > ArcTan[(Sqrt[7 - 4 Sqrt[2]] + 2 Sqrt[7 - 4 Sqrt[2]] x)/Sqrt[17]] +    
   > Sqrt[7/136 + 1/(17 Sqrt[2])]    
   > ArcTan[1/17 (-Sqrt[17 (7 + 4 Sqrt[2])] - 2 Sqrt[17 (7 + 4 Sqrt[2])] x)] -    
   > ArcTanh[(2 + x + x^2)/Sqrt[2]]/(2 Sqrt[2])    
   >    
   > Which is still not as nice as Rubi, but a lot closer...    
   >    
   > Sam   
      
   In this example AXIOM and FriCAS both have polynomials in the denominator of   
   arctan terms:    
      
   integrate((5 - 6*x^2 - 12*x^5 - 15*x^6 + 10*x^9)/(1 + 5*x^2 - 4*x^3 - 3*x^4 -   
   10*x^5 + 6*x^6 + 5*x^8 - 4*x^9 + x^12),x)   
      
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca