### 3.103 $$\int \frac{(g+h x) (d+e x+f x^2)}{\sqrt{a+c x^2}} \, dx$$

Optimal. Leaf size=136 $-\frac{\sqrt{a+c x^2} \left (2 \left (2 a f h^2+c \left (f g^2-3 h (d h+e g)\right )\right )+c h x (f g-3 e h)\right )}{6 c^2 h}+\frac{\tanh ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a+c x^2}}\right ) (2 c d g-a (e h+f g))}{2 c^{3/2}}+\frac{f \sqrt{a+c x^2} (g+h x)^2}{3 c h}$

[Out]

(f*(g + h*x)^2*Sqrt[a + c*x^2])/(3*c*h) - ((2*(2*a*f*h^2 + c*(f*g^2 - 3*h*(e*g + d*h))) + c*h*(f*g - 3*e*h)*x)
*Sqrt[a + c*x^2])/(6*c^2*h) + ((2*c*d*g - a*(f*g + e*h))*ArcTanh[(Sqrt[c]*x)/Sqrt[a + c*x^2]])/(2*c^(3/2))

________________________________________________________________________________________

Rubi [A]  time = 0.178773, antiderivative size = 135, normalized size of antiderivative = 0.99, number of steps used = 4, number of rules used = 4, integrand size = 27, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.148, Rules used = {1654, 780, 217, 206} $-\frac{\sqrt{a+c x^2} \left (2 \left (2 a f h^2-3 c h (d h+e g)+c f g^2\right )+c h x (f g-3 e h)\right )}{6 c^2 h}+\frac{\tanh ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a+c x^2}}\right ) (2 c d g-a (e h+f g))}{2 c^{3/2}}+\frac{f \sqrt{a+c x^2} (g+h x)^2}{3 c h}$

Antiderivative was successfully veriﬁed.

[In]

Int[((g + h*x)*(d + e*x + f*x^2))/Sqrt[a + c*x^2],x]

[Out]

(f*(g + h*x)^2*Sqrt[a + c*x^2])/(3*c*h) - ((2*(c*f*g^2 + 2*a*f*h^2 - 3*c*h*(e*g + d*h)) + c*h*(f*g - 3*e*h)*x)
*Sqrt[a + c*x^2])/(6*c^2*h) + ((2*c*d*g - a*(f*g + e*h))*ArcTanh[(Sqrt[c]*x)/Sqrt[a + c*x^2]])/(2*c^(3/2))

Rule 1654

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = Expon[Pq, x], f = Coeff
[Pq, x, Expon[Pq, x]]}, Simp[(f*(d + e*x)^(m + q - 1)*(a + c*x^2)^(p + 1))/(c*e^(q - 1)*(m + q + 2*p + 1)), x]
+ Dist[1/(c*e^q*(m + q + 2*p + 1)), Int[(d + e*x)^m*(a + c*x^2)^p*ExpandToSum[c*e^q*(m + q + 2*p + 1)*Pq - c*
f*(m + q + 2*p + 1)*(d + e*x)^q - f*(d + e*x)^(q - 2)*(a*e^2*(m + q - 1) - c*d^2*(m + q + 2*p + 1) - 2*c*d*e*(
m + q + p)*x), x], x], x] /; GtQ[q, 1] && NeQ[m + q + 2*p + 1, 0]] /; FreeQ[{a, c, d, e, m, p}, x] && PolyQ[Pq
, x] && NeQ[c*d^2 + a*e^2, 0] &&  !(EqQ[d, 0] && True) &&  !(IGtQ[m, 0] && RationalQ[a, c, d, e] && (IntegerQ[
p] || ILtQ[p + 1/2, 0]))

Rule 780

Int[((d_.) + (e_.)*(x_))*((f_.) + (g_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(((e*f + d*g)*(2*p
+ 3) + 2*e*g*(p + 1)*x)*(a + c*x^2)^(p + 1))/(2*c*(p + 1)*(2*p + 3)), x] - Dist[(a*e*g - c*d*f*(2*p + 3))/(c*
(2*p + 3)), Int[(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g, p}, x] &&  !LeQ[p, -1]

Rule 217

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 206

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

Rubi steps

\begin{align*} \int \frac{(g+h x) \left (d+e x+f x^2\right )}{\sqrt{a+c x^2}} \, dx &=\frac{f (g+h x)^2 \sqrt{a+c x^2}}{3 c h}+\frac{\int \frac{(g+h x) \left ((3 c d-2 a f) h^2-c h (f g-3 e h) x\right )}{\sqrt{a+c x^2}} \, dx}{3 c h^2}\\ &=\frac{f (g+h x)^2 \sqrt{a+c x^2}}{3 c h}-\frac{\left (2 \left (c f g^2+2 a f h^2-3 c h (e g+d h)\right )+c h (f g-3 e h) x\right ) \sqrt{a+c x^2}}{6 c^2 h}+\frac{(2 c d g-a f g-a e h) \int \frac{1}{\sqrt{a+c x^2}} \, dx}{2 c}\\ &=\frac{f (g+h x)^2 \sqrt{a+c x^2}}{3 c h}-\frac{\left (2 \left (c f g^2+2 a f h^2-3 c h (e g+d h)\right )+c h (f g-3 e h) x\right ) \sqrt{a+c x^2}}{6 c^2 h}+\frac{(2 c d g-a f g-a e h) \operatorname{Subst}\left (\int \frac{1}{1-c x^2} \, dx,x,\frac{x}{\sqrt{a+c x^2}}\right )}{2 c}\\ &=\frac{f (g+h x)^2 \sqrt{a+c x^2}}{3 c h}-\frac{\left (2 \left (c f g^2+2 a f h^2-3 c h (e g+d h)\right )+c h (f g-3 e h) x\right ) \sqrt{a+c x^2}}{6 c^2 h}+\frac{(2 c d g-a (f g+e h)) \tanh ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a+c x^2}}\right )}{2 c^{3/2}}\\ \end{align*}

Mathematica [A]  time = 0.113045, size = 96, normalized size = 0.71 $\frac{\sqrt{a+c x^2} \left (c \left (6 d h+6 e g+3 e h x+3 f g x+2 f h x^2\right )-4 a f h\right )+3 \sqrt{c} \tanh ^{-1}\left (\frac{\sqrt{c} x}{\sqrt{a+c x^2}}\right ) (2 c d g-a (e h+f g))}{6 c^2}$

Antiderivative was successfully veriﬁed.

[In]

Integrate[((g + h*x)*(d + e*x + f*x^2))/Sqrt[a + c*x^2],x]

[Out]

(Sqrt[a + c*x^2]*(-4*a*f*h + c*(6*e*g + 6*d*h + 3*f*g*x + 3*e*h*x + 2*f*h*x^2)) + 3*Sqrt[c]*(2*c*d*g - a*(f*g
+ e*h))*ArcTanh[(Sqrt[c]*x)/Sqrt[a + c*x^2]])/(6*c^2)

________________________________________________________________________________________

Maple [A]  time = 0.055, size = 172, normalized size = 1.3 \begin{align*}{\frac{fh{x}^{2}}{3\,c}\sqrt{c{x}^{2}+a}}-{\frac{2\,afh}{3\,{c}^{2}}\sqrt{c{x}^{2}+a}}+{\frac{ehx}{2\,c}\sqrt{c{x}^{2}+a}}+{\frac{fgx}{2\,c}\sqrt{c{x}^{2}+a}}-{\frac{aeh}{2}\ln \left ( x\sqrt{c}+\sqrt{c{x}^{2}+a} \right ){c}^{-{\frac{3}{2}}}}-{\frac{afg}{2}\ln \left ( x\sqrt{c}+\sqrt{c{x}^{2}+a} \right ){c}^{-{\frac{3}{2}}}}+{\frac{dh}{c}\sqrt{c{x}^{2}+a}}+{\frac{eg}{c}\sqrt{c{x}^{2}+a}}+{dg\ln \left ( x\sqrt{c}+\sqrt{c{x}^{2}+a} \right ){\frac{1}{\sqrt{c}}}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int((h*x+g)*(f*x^2+e*x+d)/(c*x^2+a)^(1/2),x)

[Out]

1/3*h*f*x^2/c*(c*x^2+a)^(1/2)-2/3*h*f*a/c^2*(c*x^2+a)^(1/2)+1/2*x/c*(c*x^2+a)^(1/2)*e*h+1/2*x/c*(c*x^2+a)^(1/2
)*f*g-1/2*a/c^(3/2)*ln(x*c^(1/2)+(c*x^2+a)^(1/2))*e*h-1/2*a/c^(3/2)*ln(x*c^(1/2)+(c*x^2+a)^(1/2))*f*g+1/c*(c*x
^2+a)^(1/2)*d*h+1/c*(c*x^2+a)^(1/2)*e*g+d*g*ln(x*c^(1/2)+(c*x^2+a)^(1/2))/c^(1/2)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)*(f*x^2+e*x+d)/(c*x^2+a)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 2.20611, size = 482, normalized size = 3.54 \begin{align*} \left [\frac{3 \,{\left (a e h -{\left (2 \, c d - a f\right )} g\right )} \sqrt{c} \log \left (-2 \, c x^{2} + 2 \, \sqrt{c x^{2} + a} \sqrt{c} x - a\right ) + 2 \,{\left (2 \, c f h x^{2} + 6 \, c e g + 2 \,{\left (3 \, c d - 2 \, a f\right )} h + 3 \,{\left (c f g + c e h\right )} x\right )} \sqrt{c x^{2} + a}}{12 \, c^{2}}, \frac{3 \,{\left (a e h -{\left (2 \, c d - a f\right )} g\right )} \sqrt{-c} \arctan \left (\frac{\sqrt{-c} x}{\sqrt{c x^{2} + a}}\right ) +{\left (2 \, c f h x^{2} + 6 \, c e g + 2 \,{\left (3 \, c d - 2 \, a f\right )} h + 3 \,{\left (c f g + c e h\right )} x\right )} \sqrt{c x^{2} + a}}{6 \, c^{2}}\right ] \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)*(f*x^2+e*x+d)/(c*x^2+a)^(1/2),x, algorithm="fricas")

[Out]

[1/12*(3*(a*e*h - (2*c*d - a*f)*g)*sqrt(c)*log(-2*c*x^2 + 2*sqrt(c*x^2 + a)*sqrt(c)*x - a) + 2*(2*c*f*h*x^2 +
6*c*e*g + 2*(3*c*d - 2*a*f)*h + 3*(c*f*g + c*e*h)*x)*sqrt(c*x^2 + a))/c^2, 1/6*(3*(a*e*h - (2*c*d - a*f)*g)*sq
rt(-c)*arctan(sqrt(-c)*x/sqrt(c*x^2 + a)) + (2*c*f*h*x^2 + 6*c*e*g + 2*(3*c*d - 2*a*f)*h + 3*(c*f*g + c*e*h)*x
)*sqrt(c*x^2 + a))/c^2]

________________________________________________________________________________________

Sympy [A]  time = 7.04748, size = 282, normalized size = 2.07 \begin{align*} \frac{\sqrt{a} e h x \sqrt{1 + \frac{c x^{2}}{a}}}{2 c} + \frac{\sqrt{a} f g x \sqrt{1 + \frac{c x^{2}}{a}}}{2 c} - \frac{a e h \operatorname{asinh}{\left (\frac{\sqrt{c} x}{\sqrt{a}} \right )}}{2 c^{\frac{3}{2}}} - \frac{a f g \operatorname{asinh}{\left (\frac{\sqrt{c} x}{\sqrt{a}} \right )}}{2 c^{\frac{3}{2}}} + d g \left (\begin{cases} \frac{\sqrt{- \frac{a}{c}} \operatorname{asin}{\left (x \sqrt{- \frac{c}{a}} \right )}}{\sqrt{a}} & \text{for}\: a > 0 \wedge c < 0 \\\frac{\sqrt{\frac{a}{c}} \operatorname{asinh}{\left (x \sqrt{\frac{c}{a}} \right )}}{\sqrt{a}} & \text{for}\: a > 0 \wedge c > 0 \\\frac{\sqrt{- \frac{a}{c}} \operatorname{acosh}{\left (x \sqrt{- \frac{c}{a}} \right )}}{\sqrt{- a}} & \text{for}\: c > 0 \wedge a < 0 \end{cases}\right ) + d h \left (\begin{cases} \frac{x^{2}}{2 \sqrt{a}} & \text{for}\: c = 0 \\\frac{\sqrt{a + c x^{2}}}{c} & \text{otherwise} \end{cases}\right ) + e g \left (\begin{cases} \frac{x^{2}}{2 \sqrt{a}} & \text{for}\: c = 0 \\\frac{\sqrt{a + c x^{2}}}{c} & \text{otherwise} \end{cases}\right ) + f h \left (\begin{cases} - \frac{2 a \sqrt{a + c x^{2}}}{3 c^{2}} + \frac{x^{2} \sqrt{a + c x^{2}}}{3 c} & \text{for}\: c \neq 0 \\\frac{x^{4}}{4 \sqrt{a}} & \text{otherwise} \end{cases}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)*(f*x**2+e*x+d)/(c*x**2+a)**(1/2),x)

[Out]

sqrt(a)*e*h*x*sqrt(1 + c*x**2/a)/(2*c) + sqrt(a)*f*g*x*sqrt(1 + c*x**2/a)/(2*c) - a*e*h*asinh(sqrt(c)*x/sqrt(a
))/(2*c**(3/2)) - a*f*g*asinh(sqrt(c)*x/sqrt(a))/(2*c**(3/2)) + d*g*Piecewise((sqrt(-a/c)*asin(x*sqrt(-c/a))/s
qrt(a), (a > 0) & (c < 0)), (sqrt(a/c)*asinh(x*sqrt(c/a))/sqrt(a), (a > 0) & (c > 0)), (sqrt(-a/c)*acosh(x*sqr
t(-c/a))/sqrt(-a), (c > 0) & (a < 0))) + d*h*Piecewise((x**2/(2*sqrt(a)), Eq(c, 0)), (sqrt(a + c*x**2)/c, True
)) + e*g*Piecewise((x**2/(2*sqrt(a)), Eq(c, 0)), (sqrt(a + c*x**2)/c, True)) + f*h*Piecewise((-2*a*sqrt(a + c*
x**2)/(3*c**2) + x**2*sqrt(a + c*x**2)/(3*c), Ne(c, 0)), (x**4/(4*sqrt(a)), True))

________________________________________________________________________________________

Giac [A]  time = 1.2111, size = 149, normalized size = 1.1 \begin{align*} \frac{1}{6} \, \sqrt{c x^{2} + a}{\left ({\left (\frac{2 \, f h x}{c} + \frac{3 \,{\left (c^{2} f g + c^{2} h e\right )}}{c^{3}}\right )} x + \frac{2 \,{\left (3 \, c^{2} d h - 2 \, a c f h + 3 \, c^{2} g e\right )}}{c^{3}}\right )} - \frac{{\left (2 \, c d g - a f g - a h e\right )} \log \left ({\left | -\sqrt{c} x + \sqrt{c x^{2} + a} \right |}\right )}{2 \, c^{\frac{3}{2}}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)*(f*x^2+e*x+d)/(c*x^2+a)^(1/2),x, algorithm="giac")

[Out]

1/6*sqrt(c*x^2 + a)*((2*f*h*x/c + 3*(c^2*f*g + c^2*h*e)/c^3)*x + 2*(3*c^2*d*h - 2*a*c*f*h + 3*c^2*g*e)/c^3) -
1/2*(2*c*d*g - a*f*g - a*h*e)*log(abs(-sqrt(c)*x + sqrt(c*x^2 + a)))/c^(3/2)