• A rational integral in Rubi

    From Sam Blake@21:1/5 to All on Tue Oct 10 21:06:00 2023
    I was pleased to see the following concise result from Rubi

    In[8203]:= Int[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8203]= ArcTan[u^2/(Sqrt[2] (1 + u))]/Sqrt[2]

    My implementation of Bronstein's Risch algorithm (from Symbolic Integration I) returns two arctangents

    In[8206]:= Risch[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8206]= (ArcTan[(-1 + u)/Sqrt[2]] - ArcTan[(2 + 2 u + (-1 + u) u^2)/Sqrt[2]])/Sqrt[2]

    and Mathematica returns the naive form

    In[8207]:= Integrate[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8207]= 1/4 RootSum[
    2 + 4 #1 + 2 #1^2 + #1^4 &, (2 Log[u - #1] #1 + Log[u - #1] #1^2)/(
    1 + #1 + #1^3) &]

    FriCAS also returns two arctangents

    (8) -> integrate((2*u + u^2)/(2 + 4*u + 2*u^2 + u^4), u)

    +-+ 3 2
    (u - 1)\|2 u - u + 2 u + 2
    atan(-----------) - atan(-----------------)
    2 +-+
    \|2
    (8) -------------------------------------------
    +-+
    \|2
    Type: Union(Expression(Integer),...)

    Perhaps there is still some room for improvement in the log to arctan conversions in symbolic integrators...

    Sam

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nasser M. Abbasi@21:1/5 to Sam Blake on Tue Oct 10 23:29:51 2023
    On 10/10/2023 11:06 PM, Sam Blake wrote:
    I was pleased to see the following concise result from Rubi

    In[8203]:= Int[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8203]= ArcTan[u^2/(Sqrt[2] (1 + u))]/Sqrt[2]



    Fyi, the rules used are (3 rules)

    TraceScan[Print[#/. Rubi`Private`ShowStep[i_,___]:>i]&,Int[(2 u+u^2)/(2+4 u+2 u^2+u^4),u],Rubi`Private`ShowStep[i_,___]]
    1607
    2119
    209

    Rule 1607 is

    Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol]
    :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; FreeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

    2119 is

    Int[((x_)^(m_.)*((A_) + (B_.)*(x_)^(n_.)))/((a_) + (b_.)*(x_)^(k_.) + (c_.)*(x_)^(n_.) + (d_.)*(x_)^(n2_)), x_Symbol] :>
    Dist[A^2*((m - n + 1)/(m + 1)), Subst[Int[1/(a + A^2*b*(m - n + 1)^2*x^2), x], x, x^(m + 1)/(A*(m - n + 1) + B*(m + 1)*x^n)], x] /; FreeQ[{a, b, c, d, A, B, m, n}, x]
    && EqQ[n2, 2*n] && EqQ[k, 2*(m + 1)] && EqQ[a*B^2*(m + 1)^2 -
    A^2*d*(m - n + 1)^2, 0] && EqQ[B*c*(m + 1) - 2*A*d*(m - n + 1), 0]

    Rule 209 is

    Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :>
    Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x]
    && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])


    My implementation of Bronstein's Risch algorithm (from Symbolic Integration I) returns two arctangents

    In[8206]:= Risch[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8206]= (ArcTan[(-1 + u)/Sqrt[2]] - ArcTan[(2 + 2 u + (-1 + u) u^2)/Sqrt[2]])/Sqrt[2]

    and Mathematica returns the naive form

    In[8207]:= Integrate[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8207]= 1/4 RootSum[
    2 + 4 #1 + 2 #1^2 + #1^4 &, (2 Log[u - #1] #1 + Log[u - #1] #1^2)/(
    1 + #1 + #1^3) &]

    FriCAS also returns two arctangents

    (8) -> integrate((2*u + u^2)/(2 + 4*u + 2*u^2 + u^4), u)

    +-+ 3 2
    (u - 1)\|2 u - u + 2 u + 2
    atan(-----------) - atan(-----------------)
    2 +-+
    \|2
    (8) -------------------------------------------
    +-+
    \|2
    Type: Union(Expression(Integer),...)

    Perhaps there is still some room for improvement in the log to arctan conversions in symbolic integrators...

    Sam

    --Nasser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nobody@nowhere.invalid@21:1/5 to Sam Blake on Thu Oct 12 11:38:59 2023
    Sam Blake schrieb:

    I was pleased to see the following concise result from Rubi

    In[8203]:= Int[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8203]= ArcTan[u^2/(Sqrt[2] (1 + u))]/Sqrt[2]

    My implementation of Bronstein's Risch algorithm (from Symbolic
    Integration I) returns two arctangents

    In[8206]:= Risch[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8206]= (ArcTan[(-1 + u)/Sqrt[2]] - ArcTan[(2 + 2 u + (-1 + u) u^2)/Sqrt[2]])/Sqrt[2]

    and Mathematica returns the naive form

    In[8207]:= Integrate[(2 u + u^2)/(2 + 4 u + 2 u^2 + u^4), u]
    Out[8207]= 1/4 RootSum[
    2 + 4 #1 + 2 #1^2 + #1^4 &, (2 Log[u - #1] #1 + Log[u - #1] #1^2)/(
    1 + #1 + #1^3) &]

    FriCAS also returns two arctangents

    (8) -> integrate((2*u + u^2)/(2 + 4*u + 2*u^2 + u^4), u)

    +-+ 3 2
    (u - 1)\|2 u - u + 2 u + 2
    atan(-----------) - atan(-----------------)
    2 +-+
    \|2
    (8) -------------------------------------------
    +-+
    \|2
    Type: Union(Expression(Integer),...)

    Perhaps there is still some room for improvement in the log to arctan conversions in symbolic integrators...


    Bronstein's Risch algorithm presumably involves Rioboo's decomposition
    of arc tangents to ensure continuity on the real axis (see chapter 2.8
    in his Symbolic Integration I). Indeed, ATAN(u^2/(SQRT(2)*(1 + u)))/
    SQRT(2) is discontinuous at x = -1. However, a user can easily change
    this antiderivative to -ATAN(SQRT(2)*(1 + u)/u^2)/SQRT(2), but he then
    needs a limit to evaluate it at x = 0.

    Martin.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)