hash
stringlengths
64
64
content
stringlengths
0
1.51M
4edb794ca458591559db4919edb04fdb7ba9968d49b9873b6a770de12258b5f7
from sympy import (meijerg, I, S, integrate, Integral, oo, gamma, cosh, sinc, hyperexpand, exp, simplify, sqrt, pi, erf, erfc, sin, cos, exp_polar, polygamma, hyper, log, expand_func, Rational) from sympy.integrals.meijerint import (_rewrite_single, _rewrite1, meijerint_indefinite, _inflate_g, _create_lookup_table, meijerint_definite, meijerint_inversion) from sympy.utilities import default_sort_key from sympy.testing.pytest import slow from sympy.testing.randtest import (verify_numerically, random_complex_number as randcplx) from sympy.abc import x, y, a, b, c, d, s, t, z def test_rewrite_single(): def t(expr, c, m): e = _rewrite_single(meijerg([a], [b], [c], [d], expr), x) assert e is not None assert isinstance(e[0][0][2], meijerg) assert e[0][0][2].argument.as_coeff_mul(x) == (c, (m,)) def tn(expr): assert _rewrite_single(meijerg([a], [b], [c], [d], expr), x) is None t(x, 1, x) t(x**2, 1, x**2) t(x**2 + y*x**2, y + 1, x**2) tn(x**2 + x) tn(x**y) def u(expr, x): from sympy import Add, exp, exp_polar r = _rewrite_single(expr, x) e = Add(*[res[0]*res[2] for res in r[0]]).replace( exp_polar, exp) # XXX Hack? assert verify_numerically(e, expr, x) u(exp(-x)*sin(x), x) # The following has stopped working because hyperexpand changed slightly. # It is probably not worth fixing #u(exp(-x)*sin(x)*cos(x), x) # This one cannot be done numerically, since it comes out as a g-function # of argument 4*pi # NOTE This also tests a bug in inverse mellin transform (which used to # turn exp(4*pi*I*t) into a factor of exp(4*pi*I)**t instead of # exp_polar). #u(exp(x)*sin(x), x) assert _rewrite_single(exp(x)*sin(x), x) == \ ([(-sqrt(2)/(2*sqrt(pi)), 0, meijerg(((Rational(-1, 2), 0, Rational(1, 4), S.Half, Rational(3, 4)), (1,)), ((), (Rational(-1, 2), 0)), 64*exp_polar(-4*I*pi)/x**4))], True) def test_rewrite1(): assert _rewrite1(x**3*meijerg([a], [b], [c], [d], x**2 + y*x**2)*5, x) == \ (5, x**3, [(1, 0, meijerg([a], [b], [c], [d], x**2*(y + 1)))], True) def test_meijerint_indefinite_numerically(): def t(fac, arg): g = meijerg([a], [b], [c], [d], arg)*fac subs = {a: randcplx()/10, b: randcplx()/10 + I, c: randcplx(), d: randcplx()} integral = meijerint_indefinite(g, x) assert integral is not None assert verify_numerically(g.subs(subs), integral.diff(x).subs(subs), x) t(1, x) t(2, x) t(1, 2*x) t(1, x**2) t(5, x**S('3/2')) t(x**3, x) t(3*x**S('3/2'), 4*x**S('7/3')) def test_meijerint_definite(): v, b = meijerint_definite(x, x, 0, 0) assert v.is_zero and b is True v, b = meijerint_definite(x, x, oo, oo) assert v.is_zero and b is True def test_inflate(): subs = {a: randcplx()/10, b: randcplx()/10 + I, c: randcplx(), d: randcplx(), y: randcplx()/10} def t(a, b, arg, n): from sympy import Mul m1 = meijerg(a, b, arg) m2 = Mul(*_inflate_g(m1, n)) # NOTE: (the random number)**9 must still be on the principal sheet. # Thus make b&d small to create random numbers of small imaginary part. return verify_numerically(m1.subs(subs), m2.subs(subs), x, b=0.1, d=-0.1) assert t([[a], [b]], [[c], [d]], x, 3) assert t([[a, y], [b]], [[c], [d]], x, 3) assert t([[a], [b]], [[c, y], [d]], 2*x**3, 3) def test_recursive(): from sympy import symbols a, b, c = symbols('a b c', positive=True) r = exp(-(x - a)**2)*exp(-(x - b)**2) e = integrate(r, (x, 0, oo), meijerg=True) assert simplify(e.expand()) == ( sqrt(2)*sqrt(pi)*( (erf(sqrt(2)*(a + b)/2) + 1)*exp(-a**2/2 + a*b - b**2/2))/4) e = integrate(exp(-(x - a)**2)*exp(-(x - b)**2)*exp(c*x), (x, 0, oo), meijerg=True) assert simplify(e) == ( sqrt(2)*sqrt(pi)*(erf(sqrt(2)*(2*a + 2*b + c)/4) + 1)*exp(-a**2 - b**2 + (2*a + 2*b + c)**2/8)/4) assert simplify(integrate(exp(-(x - a - b - c)**2), (x, 0, oo), meijerg=True)) == \ sqrt(pi)/2*(1 + erf(a + b + c)) assert simplify(integrate(exp(-(x + a + b + c)**2), (x, 0, oo), meijerg=True)) == \ sqrt(pi)/2*(1 - erf(a + b + c)) @slow def test_meijerint(): from sympy import symbols, expand, arg s, t, mu = symbols('s t mu', real=True) assert integrate(meijerg([], [], [0], [], s*t) *meijerg([], [], [mu/2], [-mu/2], t**2/4), (t, 0, oo)).is_Piecewise s = symbols('s', positive=True) assert integrate(x**s*meijerg([[], []], [[0], []], x), (x, 0, oo)) == \ gamma(s + 1) assert integrate(x**s*meijerg([[], []], [[0], []], x), (x, 0, oo), meijerg=True) == gamma(s + 1) assert isinstance(integrate(x**s*meijerg([[], []], [[0], []], x), (x, 0, oo), meijerg=False), Integral) assert meijerint_indefinite(exp(x), x) == exp(x) # TODO what simplifications should be done automatically? # This tests "extra case" for antecedents_1. a, b = symbols('a b', positive=True) assert simplify(meijerint_definite(x**a, x, 0, b)[0]) == \ b**(a + 1)/(a + 1) # This tests various conditions and expansions: meijerint_definite((x + 1)**3*exp(-x), x, 0, oo) == (16, True) # Again, how about simplifications? sigma, mu = symbols('sigma mu', positive=True) i, c = meijerint_definite(exp(-((x - mu)/(2*sigma))**2), x, 0, oo) assert simplify(i) == sqrt(pi)*sigma*(2 - erfc(mu/(2*sigma))) assert c == True i, _ = meijerint_definite(exp(-mu*x)*exp(sigma*x), x, 0, oo) # TODO it would be nice to test the condition assert simplify(i) == 1/(mu - sigma) # Test substitutions to change limits assert meijerint_definite(exp(x), x, -oo, 2) == (exp(2), True) # Note: causes a NaN in _check_antecedents assert expand(meijerint_definite(exp(x), x, 0, I)[0]) == exp(I) - 1 assert expand(meijerint_definite(exp(-x), x, 0, x)[0]) == \ 1 - exp(-exp(I*arg(x))*abs(x)) # Test -oo to oo assert meijerint_definite(exp(-x**2), x, -oo, oo) == (sqrt(pi), True) assert meijerint_definite(exp(-abs(x)), x, -oo, oo) == (2, True) assert meijerint_definite(exp(-(2*x - 3)**2), x, -oo, oo) == \ (sqrt(pi)/2, True) assert meijerint_definite(exp(-abs(2*x - 3)), x, -oo, oo) == (1, True) assert meijerint_definite(exp(-((x - mu)/sigma)**2/2)/sqrt(2*pi*sigma**2), x, -oo, oo) == (1, True) assert meijerint_definite(sinc(x)**2, x, -oo, oo) == (pi, True) # Test one of the extra conditions for 2 g-functinos assert meijerint_definite(exp(-x)*sin(x), x, 0, oo) == (S.Half, True) # Test a bug def res(n): return (1/(1 + x**2)).diff(x, n).subs(x, 1)*(-1)**n for n in range(6): assert integrate(exp(-x)*sin(x)*x**n, (x, 0, oo), meijerg=True) == \ res(n) # This used to test trigexpand... now it is done by linear substitution assert simplify(integrate(exp(-x)*sin(x + a), (x, 0, oo), meijerg=True) ) == sqrt(2)*sin(a + pi/4)/2 # Test the condition 14 from prudnikov. # (This is besselj*besselj in disguise, to stop the product from being # recognised in the tables.) a, b, s = symbols('a b s') from sympy import And, re assert meijerint_definite(meijerg([], [], [a/2], [-a/2], x/4) *meijerg([], [], [b/2], [-b/2], x/4)*x**(s - 1), x, 0, oo) == \ (4*2**(2*s - 2)*gamma(-2*s + 1)*gamma(a/2 + b/2 + s) /(gamma(-a/2 + b/2 - s + 1)*gamma(a/2 - b/2 - s + 1) *gamma(a/2 + b/2 - s + 1)), And(0 < -2*re(4*s) + 8, 0 < re(a/2 + b/2 + s), re(2*s) < 1)) # test a bug assert integrate(sin(x**a)*sin(x**b), (x, 0, oo), meijerg=True) == \ Integral(sin(x**a)*sin(x**b), (x, 0, oo)) # test better hyperexpand assert integrate(exp(-x**2)*log(x), (x, 0, oo), meijerg=True) == \ (sqrt(pi)*polygamma(0, S.Half)/4).expand() # Test hyperexpand bug. from sympy import lowergamma n = symbols('n', integer=True) assert simplify(integrate(exp(-x)*x**n, x, meijerg=True)) == \ lowergamma(n + 1, x) # Test a bug with argument 1/x alpha = symbols('alpha', positive=True) assert meijerint_definite((2 - x)**alpha*sin(alpha/x), x, 0, 2) == \ (sqrt(pi)*alpha*gamma(alpha + 1)*meijerg(((), (alpha/2 + S.Half, alpha/2 + 1)), ((0, 0, S.Half), (Rational(-1, 2),)), alpha**2/16)/4, True) # test a bug related to 3016 a, s = symbols('a s', positive=True) assert simplify(integrate(x**s*exp(-a*x**2), (x, -oo, oo))) == \ a**(-s/2 - S.Half)*((-1)**s + 1)*gamma(s/2 + S.Half)/2 def test_bessel(): from sympy import besselj, besseli assert simplify(integrate(besselj(a, z)*besselj(b, z)/z, (z, 0, oo), meijerg=True, conds='none')) == \ 2*sin(pi*(a/2 - b/2))/(pi*(a - b)*(a + b)) assert simplify(integrate(besselj(a, z)*besselj(a, z)/z, (z, 0, oo), meijerg=True, conds='none')) == 1/(2*a) # TODO more orthogonality integrals assert simplify(integrate(sin(z*x)*(x**2 - 1)**(-(y + S.Half)), (x, 1, oo), meijerg=True, conds='none') *2/((z/2)**y*sqrt(pi)*gamma(S.Half - y))) == \ besselj(y, z) # Werner Rosenheinrich # SOME INDEFINITE INTEGRALS OF BESSEL FUNCTIONS assert integrate(x*besselj(0, x), x, meijerg=True) == x*besselj(1, x) assert integrate(x*besseli(0, x), x, meijerg=True) == x*besseli(1, x) # TODO can do higher powers, but come out as high order ... should they be # reduced to order 0, 1? assert integrate(besselj(1, x), x, meijerg=True) == -besselj(0, x) assert integrate(besselj(1, x)**2/x, x, meijerg=True) == \ -(besselj(0, x)**2 + besselj(1, x)**2)/2 # TODO more besseli when tables are extended or recursive mellin works assert integrate(besselj(0, x)**2/x**2, x, meijerg=True) == \ -2*x*besselj(0, x)**2 - 2*x*besselj(1, x)**2 \ + 2*besselj(0, x)*besselj(1, x) - besselj(0, x)**2/x assert integrate(besselj(0, x)*besselj(1, x), x, meijerg=True) == \ -besselj(0, x)**2/2 assert integrate(x**2*besselj(0, x)*besselj(1, x), x, meijerg=True) == \ x**2*besselj(1, x)**2/2 assert integrate(besselj(0, x)*besselj(1, x)/x, x, meijerg=True) == \ (x*besselj(0, x)**2 + x*besselj(1, x)**2 - besselj(0, x)*besselj(1, x)) # TODO how does besselj(0, a*x)*besselj(0, b*x) work? # TODO how does besselj(0, x)**2*besselj(1, x)**2 work? # TODO sin(x)*besselj(0, x) etc come out a mess # TODO can x*log(x)*besselj(0, x) be done? # TODO how does besselj(1, x)*besselj(0, x+a) work? # TODO more indefinite integrals when struve functions etc are implemented # test a substitution assert integrate(besselj(1, x**2)*x, x, meijerg=True) == \ -besselj(0, x**2)/2 def test_inversion(): from sympy import piecewise_fold, besselj, sqrt, sin, cos, Heaviside def inv(f): return piecewise_fold(meijerint_inversion(f, s, t)) assert inv(1/(s**2 + 1)) == sin(t)*Heaviside(t) assert inv(s/(s**2 + 1)) == cos(t)*Heaviside(t) assert inv(exp(-s)/s) == Heaviside(t - 1) assert inv(1/sqrt(1 + s**2)) == besselj(0, t)*Heaviside(t) # Test some antcedents checking. assert meijerint_inversion(sqrt(s)/sqrt(1 + s**2), s, t) is None assert inv(exp(s**2)) is None assert meijerint_inversion(exp(-s**2), s, t) is None def test_inversion_conditional_output(): from sympy import Symbol, InverseLaplaceTransform a = Symbol('a', positive=True) F = sqrt(pi/a)*exp(-2*sqrt(a)*sqrt(s)) f = meijerint_inversion(F, s, t) assert not f.is_Piecewise b = Symbol('b', real=True) F = F.subs(a, b) f2 = meijerint_inversion(F, s, t) assert f2.is_Piecewise # first piece is same as f assert f2.args[0][0] == f.subs(a, b) # last piece is an unevaluated transform assert f2.args[-1][1] ILT = InverseLaplaceTransform(F, s, t, None) assert f2.args[-1][0] == ILT or f2.args[-1][0] == ILT.as_integral def test_inversion_exp_real_nonreal_shift(): from sympy import Symbol, DiracDelta r = Symbol('r', real=True) c = Symbol('c', extended_real=False) a = 1 + 2*I z = Symbol('z') assert not meijerint_inversion(exp(r*s), s, t).is_Piecewise assert meijerint_inversion(exp(a*s), s, t) is None assert meijerint_inversion(exp(c*s), s, t) is None f = meijerint_inversion(exp(z*s), s, t) assert f.is_Piecewise assert isinstance(f.args[0][0], DiracDelta) @slow def test_lookup_table(): from random import uniform, randrange from sympy import Add from sympy.integrals.meijerint import z as z_dummy table = {} _create_lookup_table(table) for _, l in sorted(table.items()): for formula, terms, cond, hint in sorted(l, key=default_sort_key): subs = {} for ai in list(formula.free_symbols) + [z_dummy]: if hasattr(ai, 'properties') and ai.properties: # these Wilds match positive integers subs[ai] = randrange(1, 10) else: subs[ai] = uniform(1.5, 2.0) if not isinstance(terms, list): terms = terms(subs) # First test that hyperexpand can do this. expanded = [hyperexpand(g) for (_, g) in terms] assert all(x.is_Piecewise or not x.has(meijerg) for x in expanded) # Now test that the meijer g-function is indeed as advertised. expanded = Add(*[f*x for (f, x) in terms]) a, b = formula.n(subs=subs), expanded.n(subs=subs) r = min(abs(a), abs(b)) if r < 1: assert abs(a - b).n() <= 1e-10 else: assert (abs(a - b)/r).n() <= 1e-10 def test_branch_bug(): from sympy import powdenest, lowergamma # TODO gammasimp cannot prove that the factor is unity assert powdenest(integrate(erf(x**3), x, meijerg=True).diff(x), polar=True) == 2*erf(x**3)*gamma(Rational(2, 3))/3/gamma(Rational(5, 3)) assert integrate(erf(x**3), x, meijerg=True) == \ 2*x*erf(x**3)*gamma(Rational(2, 3))/(3*gamma(Rational(5, 3))) \ - 2*gamma(Rational(2, 3))*lowergamma(Rational(2, 3), x**6)/(3*sqrt(pi)*gamma(Rational(5, 3))) def test_linear_subs(): from sympy import besselj assert integrate(sin(x - 1), x, meijerg=True) == -cos(1 - x) assert integrate(besselj(1, x - 1), x, meijerg=True) == -besselj(0, 1 - x) @slow def test_probability(): # various integrals from probability theory from sympy.abc import x, y from sympy import symbols, Symbol, Abs, expand_mul, gammasimp, powsimp, sin mu1, mu2 = symbols('mu1 mu2', nonzero=True) sigma1, sigma2 = symbols('sigma1 sigma2', positive=True) rate = Symbol('lambda', positive=True) def normal(x, mu, sigma): return 1/sqrt(2*pi*sigma**2)*exp(-(x - mu)**2/2/sigma**2) def exponential(x, rate): return rate*exp(-rate*x) assert integrate(normal(x, mu1, sigma1), (x, -oo, oo), meijerg=True) == 1 assert integrate(x*normal(x, mu1, sigma1), (x, -oo, oo), meijerg=True) == \ mu1 assert integrate(x**2*normal(x, mu1, sigma1), (x, -oo, oo), meijerg=True) \ == mu1**2 + sigma1**2 assert integrate(x**3*normal(x, mu1, sigma1), (x, -oo, oo), meijerg=True) \ == mu1**3 + 3*mu1*sigma1**2 assert integrate(normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == 1 assert integrate(x*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == mu1 assert integrate(y*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == mu2 assert integrate(x*y*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == mu1*mu2 assert integrate((x + y + 1)*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == 1 + mu1 + mu2 assert integrate((x + y - 1)*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == \ -1 + mu1 + mu2 i = integrate(x**2*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) assert not i.has(Abs) assert simplify(i) == mu1**2 + sigma1**2 assert integrate(y**2*normal(x, mu1, sigma1)*normal(y, mu2, sigma2), (x, -oo, oo), (y, -oo, oo), meijerg=True) == \ sigma2**2 + mu2**2 assert integrate(exponential(x, rate), (x, 0, oo), meijerg=True) == 1 assert integrate(x*exponential(x, rate), (x, 0, oo), meijerg=True) == \ 1/rate assert integrate(x**2*exponential(x, rate), (x, 0, oo), meijerg=True) == \ 2/rate**2 def E(expr): res1 = integrate(expr*exponential(x, rate)*normal(y, mu1, sigma1), (x, 0, oo), (y, -oo, oo), meijerg=True) res2 = integrate(expr*exponential(x, rate)*normal(y, mu1, sigma1), (y, -oo, oo), (x, 0, oo), meijerg=True) assert expand_mul(res1) == expand_mul(res2) return res1 assert E(1) == 1 assert E(x*y) == mu1/rate assert E(x*y**2) == mu1**2/rate + sigma1**2/rate ans = sigma1**2 + 1/rate**2 assert simplify(E((x + y + 1)**2) - E(x + y + 1)**2) == ans assert simplify(E((x + y - 1)**2) - E(x + y - 1)**2) == ans assert simplify(E((x + y)**2) - E(x + y)**2) == ans # Beta' distribution alpha, beta = symbols('alpha beta', positive=True) betadist = x**(alpha - 1)*(1 + x)**(-alpha - beta)*gamma(alpha + beta) \ /gamma(alpha)/gamma(beta) assert integrate(betadist, (x, 0, oo), meijerg=True) == 1 i = integrate(x*betadist, (x, 0, oo), meijerg=True, conds='separate') assert (gammasimp(i[0]), i[1]) == (alpha/(beta - 1), 1 < beta) j = integrate(x**2*betadist, (x, 0, oo), meijerg=True, conds='separate') assert j[1] == (1 < beta - 1) assert gammasimp(j[0] - i[0]**2) == (alpha + beta - 1)*alpha \ /(beta - 2)/(beta - 1)**2 # Beta distribution # NOTE: this is evaluated using antiderivatives. It also tests that # meijerint_indefinite returns the simplest possible answer. a, b = symbols('a b', positive=True) betadist = x**(a - 1)*(-x + 1)**(b - 1)*gamma(a + b)/(gamma(a)*gamma(b)) assert simplify(integrate(betadist, (x, 0, 1), meijerg=True)) == 1 assert simplify(integrate(x*betadist, (x, 0, 1), meijerg=True)) == \ a/(a + b) assert simplify(integrate(x**2*betadist, (x, 0, 1), meijerg=True)) == \ a*(a + 1)/(a + b)/(a + b + 1) assert simplify(integrate(x**y*betadist, (x, 0, 1), meijerg=True)) == \ gamma(a + b)*gamma(a + y)/gamma(a)/gamma(a + b + y) # Chi distribution k = Symbol('k', integer=True, positive=True) chi = 2**(1 - k/2)*x**(k - 1)*exp(-x**2/2)/gamma(k/2) assert powsimp(integrate(chi, (x, 0, oo), meijerg=True)) == 1 assert simplify(integrate(x*chi, (x, 0, oo), meijerg=True)) == \ sqrt(2)*gamma((k + 1)/2)/gamma(k/2) assert simplify(integrate(x**2*chi, (x, 0, oo), meijerg=True)) == k # Chi^2 distribution chisquared = 2**(-k/2)/gamma(k/2)*x**(k/2 - 1)*exp(-x/2) assert powsimp(integrate(chisquared, (x, 0, oo), meijerg=True)) == 1 assert simplify(integrate(x*chisquared, (x, 0, oo), meijerg=True)) == k assert simplify(integrate(x**2*chisquared, (x, 0, oo), meijerg=True)) == \ k*(k + 2) assert gammasimp(integrate(((x - k)/sqrt(2*k))**3*chisquared, (x, 0, oo), meijerg=True)) == 2*sqrt(2)/sqrt(k) # Dagum distribution a, b, p = symbols('a b p', positive=True) # XXX (x/b)**a does not work dagum = a*p/x*(x/b)**(a*p)/(1 + x**a/b**a)**(p + 1) assert simplify(integrate(dagum, (x, 0, oo), meijerg=True)) == 1 # XXX conditions are a mess arg = x*dagum assert simplify(integrate(arg, (x, 0, oo), meijerg=True, conds='none') ) == a*b*gamma(1 - 1/a)*gamma(p + 1 + 1/a)/( (a*p + 1)*gamma(p)) assert simplify(integrate(x*arg, (x, 0, oo), meijerg=True, conds='none') ) == a*b**2*gamma(1 - 2/a)*gamma(p + 1 + 2/a)/( (a*p + 2)*gamma(p)) # F-distribution d1, d2 = symbols('d1 d2', positive=True) f = sqrt(((d1*x)**d1 * d2**d2)/(d1*x + d2)**(d1 + d2))/x \ /gamma(d1/2)/gamma(d2/2)*gamma((d1 + d2)/2) assert simplify(integrate(f, (x, 0, oo), meijerg=True)) == 1 # TODO conditions are a mess assert simplify(integrate(x*f, (x, 0, oo), meijerg=True, conds='none') ) == d2/(d2 - 2) assert simplify(integrate(x**2*f, (x, 0, oo), meijerg=True, conds='none') ) == d2**2*(d1 + 2)/d1/(d2 - 4)/(d2 - 2) # TODO gamma, rayleigh # inverse gaussian lamda, mu = symbols('lamda mu', positive=True) dist = sqrt(lamda/2/pi)*x**(Rational(-3, 2))*exp(-lamda*(x - mu)**2/x/2/mu**2) mysimp = lambda expr: simplify(expr.rewrite(exp)) assert mysimp(integrate(dist, (x, 0, oo))) == 1 assert mysimp(integrate(x*dist, (x, 0, oo))) == mu assert mysimp(integrate((x - mu)**2*dist, (x, 0, oo))) == mu**3/lamda assert mysimp(integrate((x - mu)**3*dist, (x, 0, oo))) == 3*mu**5/lamda**2 # Levi c = Symbol('c', positive=True) assert integrate(sqrt(c/2/pi)*exp(-c/2/(x - mu))/(x - mu)**S('3/2'), (x, mu, oo)) == 1 # higher moments oo # log-logistic alpha, beta = symbols('alpha beta', positive=True) distn = (beta/alpha)*x**(beta - 1)/alpha**(beta - 1)/ \ (1 + x**beta/alpha**beta)**2 # FIXME: If alpha, beta are not declared as finite the line below hangs # after the changes in: # https://github.com/sympy/sympy/pull/16603 assert simplify(integrate(distn, (x, 0, oo))) == 1 # NOTE the conditions are a mess, but correctly state beta > 1 assert simplify(integrate(x*distn, (x, 0, oo), conds='none')) == \ pi*alpha/beta/sin(pi/beta) # (similar comment for conditions applies) assert simplify(integrate(x**y*distn, (x, 0, oo), conds='none')) == \ pi*alpha**y*y/beta/sin(pi*y/beta) # weibull k = Symbol('k', positive=True) n = Symbol('n', positive=True) distn = k/lamda*(x/lamda)**(k - 1)*exp(-(x/lamda)**k) assert simplify(integrate(distn, (x, 0, oo))) == 1 assert simplify(integrate(x**n*distn, (x, 0, oo))) == \ lamda**n*gamma(1 + n/k) # rice distribution from sympy import besseli nu, sigma = symbols('nu sigma', positive=True) rice = x/sigma**2*exp(-(x**2 + nu**2)/2/sigma**2)*besseli(0, x*nu/sigma**2) assert integrate(rice, (x, 0, oo), meijerg=True) == 1 # can someone verify higher moments? # Laplace distribution mu = Symbol('mu', real=True) b = Symbol('b', positive=True) laplace = exp(-abs(x - mu)/b)/2/b assert integrate(laplace, (x, -oo, oo), meijerg=True) == 1 assert integrate(x*laplace, (x, -oo, oo), meijerg=True) == mu assert integrate(x**2*laplace, (x, -oo, oo), meijerg=True) == \ 2*b**2 + mu**2 # TODO are there other distributions supported on (-oo, oo) that we can do? # misc tests k = Symbol('k', positive=True) assert gammasimp(expand_mul(integrate(log(x)*x**(k - 1)*exp(-x)/gamma(k), (x, 0, oo)))) == polygamma(0, k) @slow def test_expint(): """ Test various exponential integrals. """ from sympy import (expint, unpolarify, Symbol, Ci, Si, Shi, Chi, sin, cos, sinh, cosh, Ei) assert simplify(unpolarify(integrate(exp(-z*x)/x**y, (x, 1, oo), meijerg=True, conds='none' ).rewrite(expint).expand(func=True))) == expint(y, z) assert integrate(exp(-z*x)/x, (x, 1, oo), meijerg=True, conds='none').rewrite(expint).expand() == \ expint(1, z) assert integrate(exp(-z*x)/x**2, (x, 1, oo), meijerg=True, conds='none').rewrite(expint).expand() == \ expint(2, z).rewrite(Ei).rewrite(expint) assert integrate(exp(-z*x)/x**3, (x, 1, oo), meijerg=True, conds='none').rewrite(expint).expand() == \ expint(3, z).rewrite(Ei).rewrite(expint).expand() t = Symbol('t', positive=True) assert integrate(-cos(x)/x, (x, t, oo), meijerg=True).expand() == Ci(t) assert integrate(-sin(x)/x, (x, t, oo), meijerg=True).expand() == \ Si(t) - pi/2 assert integrate(sin(x)/x, (x, 0, z), meijerg=True) == Si(z) assert integrate(sinh(x)/x, (x, 0, z), meijerg=True) == Shi(z) assert integrate(exp(-x)/x, x, meijerg=True).expand().rewrite(expint) == \ I*pi - expint(1, x) assert integrate(exp(-x)/x**2, x, meijerg=True).rewrite(expint).expand() \ == expint(1, x) - exp(-x)/x - I*pi u = Symbol('u', polar=True) assert integrate(cos(u)/u, u, meijerg=True).expand().as_independent(u)[1] \ == Ci(u) assert integrate(cosh(u)/u, u, meijerg=True).expand().as_independent(u)[1] \ == Chi(u) assert integrate(expint(1, x), x, meijerg=True ).rewrite(expint).expand() == x*expint(1, x) - exp(-x) assert integrate(expint(2, x), x, meijerg=True ).rewrite(expint).expand() == \ -x**2*expint(1, x)/2 + x*exp(-x)/2 - exp(-x)/2 assert simplify(unpolarify(integrate(expint(y, x), x, meijerg=True).rewrite(expint).expand(func=True))) == \ -expint(y + 1, x) assert integrate(Si(x), x, meijerg=True) == x*Si(x) + cos(x) assert integrate(Ci(u), u, meijerg=True).expand() == u*Ci(u) - sin(u) assert integrate(Shi(x), x, meijerg=True) == x*Shi(x) - cosh(x) assert integrate(Chi(u), u, meijerg=True).expand() == u*Chi(u) - sinh(u) assert integrate(Si(x)*exp(-x), (x, 0, oo), meijerg=True) == pi/4 assert integrate(expint(1, x)*sin(x), (x, 0, oo), meijerg=True) == log(2)/2 def test_messy(): from sympy import (laplace_transform, Si, Shi, Chi, atan, Piecewise, acoth, E1, besselj, acosh, asin, And, re, fourier_transform, sqrt) assert laplace_transform(Si(x), x, s) == ((-atan(s) + pi/2)/s, 0, True) assert laplace_transform(Shi(x), x, s) == (acoth(s)/s, 1, True) # where should the logs be simplified? assert laplace_transform(Chi(x), x, s) == \ ((log(s**(-2)) - log((s**2 - 1)/s**2))/(2*s), 1, True) # TODO maybe simplify the inequalities? assert laplace_transform(besselj(a, x), x, s)[1:] == \ (0, And(re(a/2) + S.Half > S.Zero, re(a/2) + 1 > S.Zero)) # NOTE s < 0 can be done, but argument reduction is not good enough yet assert fourier_transform(besselj(1, x)/x, x, s, noconds=False) == \ (Piecewise((0, 4*abs(pi**2*s**2) > 1), (2*sqrt(-4*pi**2*s**2 + 1), True)), s > 0) # TODO FT(besselj(0,x)) - conditions are messy (but for acceptable reasons) # - folding could be better assert integrate(E1(x)*besselj(0, x), (x, 0, oo), meijerg=True) == \ log(1 + sqrt(2)) assert integrate(E1(x)*besselj(1, x), (x, 0, oo), meijerg=True) == \ log(S.Half + sqrt(2)/2) assert integrate(1/x/sqrt(1 - x**2), x, meijerg=True) == \ Piecewise((-acosh(1/x), abs(x**(-2)) > 1), (I*asin(1/x), True)) def test_issue_6122(): assert integrate(exp(-I*x**2), (x, -oo, oo), meijerg=True) == \ -I*sqrt(pi)*exp(I*pi/4) def test_issue_6252(): expr = 1/x/(a + b*x)**Rational(1, 3) anti = integrate(expr, x, meijerg=True) assert not anti.has(hyper) # XXX the expression is a mess, but actually upon differentiation and # putting in numerical values seems to work... def test_issue_6348(): assert integrate(exp(I*x)/(1 + x**2), (x, -oo, oo)).simplify().rewrite(exp) \ == pi*exp(-1) def test_fresnel(): from sympy import fresnels, fresnelc assert expand_func(integrate(sin(pi*x**2/2), x)) == fresnels(x) assert expand_func(integrate(cos(pi*x**2/2), x)) == fresnelc(x) def test_issue_6860(): assert meijerint_indefinite(x**x**x, x) is None def test_issue_7337(): f = meijerint_indefinite(x*sqrt(2*x + 3), x).together() assert f == sqrt(2*x + 3)*(2*x**2 + x - 3)/5 assert f._eval_interval(x, S.NegativeOne, S.One) == Rational(2, 5) def test_issue_8368(): assert meijerint_indefinite(cosh(x)*exp(-x*t), x) == ( (-t - 1)*exp(x) + (-t + 1)*exp(-x))*exp(-t*x)/2/(t**2 - 1) def test_issue_10211(): from sympy.abc import h, w assert integrate((1/sqrt(((y-x)**2 + h**2))**3), (x,0,w), (y,0,w)) == \ 2*sqrt(1 + w**2/h**2)/h - 2/h def test_issue_11806(): from sympy import symbols y, L = symbols('y L', positive=True) assert integrate(1/sqrt(x**2 + y**2)**3, (x, -L, L)) == \ 2*L/(y**2*sqrt(L**2 + y**2)) def test_issue_10681(): from sympy import RR from sympy.abc import R, r f = integrate(r**2*(R**2-r**2)**0.5, r, meijerg=True) g = (1.0/3)*R**1.0*r**3*hyper((-0.5, Rational(3, 2)), (Rational(5, 2),), r**2*exp_polar(2*I*pi)/R**2) assert RR.almosteq((f/g).n(), 1.0, 1e-12) def test_issue_13536(): from sympy import Symbol a = Symbol('a', real=True, positive=True) assert integrate(1/x**2, (x, oo, a)) == -1/a def test_issue_6462(): from sympy import Symbol x = Symbol('x') n = Symbol('n') # Not the actual issue, still wrong answer for n = 1, but that there is no # exception assert integrate(cos(x**n)/x**n, x, meijerg=True).subs(n, 2).equals( integrate(cos(x**2)/x**2, x, meijerg=True))
3f322aec019b58711034b36c3900a91e237e65a9ac5515b0638abea06663db08
from sympy.integrals.transforms import (mellin_transform, inverse_mellin_transform, laplace_transform, inverse_laplace_transform, fourier_transform, inverse_fourier_transform, sine_transform, inverse_sine_transform, cosine_transform, inverse_cosine_transform, hankel_transform, inverse_hankel_transform, LaplaceTransform, FourierTransform, SineTransform, CosineTransform, InverseLaplaceTransform, InverseFourierTransform, InverseSineTransform, InverseCosineTransform, IntegralTransformError) from sympy import ( gamma, exp, oo, Heaviside, symbols, Symbol, re, factorial, pi, arg, cos, S, Abs, And, sin, sqrt, I, log, tan, hyperexpand, meijerg, EulerGamma, erf, erfc, besselj, bessely, besseli, besselk, exp_polar, unpolarify, Function, expint, expand_mul, Rational, gammasimp, trigsimp, atan, sinh, cosh, Ne, periodic_argument, atan2) from sympy.testing.pytest import XFAIL, slow, skip, raises from sympy.matrices import Matrix, eye from sympy.abc import x, s, a, b, c, d nu, beta, rho = symbols('nu beta rho') def test_undefined_function(): from sympy import Function, MellinTransform f = Function('f') assert mellin_transform(f(x), x, s) == MellinTransform(f(x), x, s) assert mellin_transform(f(x) + exp(-x), x, s) == \ (MellinTransform(f(x), x, s) + gamma(s), (0, oo), True) assert laplace_transform(2*f(x), x, s) == 2*LaplaceTransform(f(x), x, s) # TODO test derivative and other rules when implemented def test_free_symbols(): from sympy import Function f = Function('f') assert mellin_transform(f(x), x, s).free_symbols == {s} assert mellin_transform(f(x)*a, x, s).free_symbols == {s, a} def test_as_integral(): from sympy import Function, Integral f = Function('f') assert mellin_transform(f(x), x, s).rewrite('Integral') == \ Integral(x**(s - 1)*f(x), (x, 0, oo)) assert fourier_transform(f(x), x, s).rewrite('Integral') == \ Integral(f(x)*exp(-2*I*pi*s*x), (x, -oo, oo)) assert laplace_transform(f(x), x, s).rewrite('Integral') == \ Integral(f(x)*exp(-s*x), (x, 0, oo)) assert str(2*pi*I*inverse_mellin_transform(f(s), s, x, (a, b)).rewrite('Integral')) \ == "Integral(x**(-s)*f(s), (s, _c - oo*I, _c + oo*I))" assert str(2*pi*I*inverse_laplace_transform(f(s), s, x).rewrite('Integral')) == \ "Integral(f(s)*exp(s*x), (s, _c - oo*I, _c + oo*I))" assert inverse_fourier_transform(f(s), s, x).rewrite('Integral') == \ Integral(f(s)*exp(2*I*pi*s*x), (s, -oo, oo)) # NOTE this is stuck in risch because meijerint cannot handle it @slow @XFAIL def test_mellin_transform_fail(): skip("Risch takes forever.") MT = mellin_transform bpos = symbols('b', positive=True) # bneg = symbols('b', negative=True) expr = (sqrt(x + b**2) + b)**a/sqrt(x + b**2) # TODO does not work with bneg, argument wrong. Needs changes to matching. assert MT(expr.subs(b, -bpos), x, s) == \ ((-1)**(a + 1)*2**(a + 2*s)*bpos**(a + 2*s - 1)*gamma(a + s) *gamma(1 - a - 2*s)/gamma(1 - s), (-re(a), -re(a)/2 + S.Half), True) expr = (sqrt(x + b**2) + b)**a assert MT(expr.subs(b, -bpos), x, s) == \ ( 2**(a + 2*s)*a*bpos**(a + 2*s)*gamma(-a - 2* s)*gamma(a + s)/gamma(-s + 1), (-re(a), -re(a)/2), True) # Test exponent 1: assert MT(expr.subs({b: -bpos, a: 1}), x, s) == \ (-bpos**(2*s + 1)*gamma(s)*gamma(-s - S.Half)/(2*sqrt(pi)), (-1, Rational(-1, 2)), True) def test_mellin_transform(): from sympy import Max, Min MT = mellin_transform bpos = symbols('b', positive=True) # 8.4.2 assert MT(x**nu*Heaviside(x - 1), x, s) == \ (-1/(nu + s), (-oo, -re(nu)), True) assert MT(x**nu*Heaviside(1 - x), x, s) == \ (1/(nu + s), (-re(nu), oo), True) assert MT((1 - x)**(beta - 1)*Heaviside(1 - x), x, s) == \ (gamma(beta)*gamma(s)/gamma(beta + s), (0, oo), re(beta) > 0) assert MT((x - 1)**(beta - 1)*Heaviside(x - 1), x, s) == \ (gamma(beta)*gamma(1 - beta - s)/gamma(1 - s), (-oo, -re(beta) + 1), re(beta) > 0) assert MT((1 + x)**(-rho), x, s) == \ (gamma(s)*gamma(rho - s)/gamma(rho), (0, re(rho)), True) # TODO also the conditions should be simplified, e.g. # And(re(rho) - 1 < 0, re(rho) < 1) should just be # re(rho) < 1 assert MT(abs(1 - x)**(-rho), x, s) == ( 2*sin(pi*rho/2)*gamma(1 - rho)* cos(pi*(rho/2 - s))*gamma(s)*gamma(rho-s)/pi, (0, re(rho)), And(re(rho) - 1 < 0, re(rho) < 1)) mt = MT((1 - x)**(beta - 1)*Heaviside(1 - x) + a*(x - 1)**(beta - 1)*Heaviside(x - 1), x, s) assert mt[1], mt[2] == ((0, -re(beta) + 1), re(beta) > 0) assert MT((x**a - b**a)/(x - b), x, s)[0] == \ pi*b**(a + s - 1)*sin(pi*a)/(sin(pi*s)*sin(pi*(a + s))) assert MT((x**a - bpos**a)/(x - bpos), x, s) == \ (pi*bpos**(a + s - 1)*sin(pi*a)/(sin(pi*s)*sin(pi*(a + s))), (Max(-re(a), 0), Min(1 - re(a), 1)), True) expr = (sqrt(x + b**2) + b)**a assert MT(expr.subs(b, bpos), x, s) == \ (-a*(2*bpos)**(a + 2*s)*gamma(s)*gamma(-a - 2*s)/gamma(-a - s + 1), (0, -re(a)/2), True) expr = (sqrt(x + b**2) + b)**a/sqrt(x + b**2) assert MT(expr.subs(b, bpos), x, s) == \ (2**(a + 2*s)*bpos**(a + 2*s - 1)*gamma(s) *gamma(1 - a - 2*s)/gamma(1 - a - s), (0, -re(a)/2 + S.Half), True) # 8.4.2 assert MT(exp(-x), x, s) == (gamma(s), (0, oo), True) assert MT(exp(-1/x), x, s) == (gamma(-s), (-oo, 0), True) # 8.4.5 assert MT(log(x)**4*Heaviside(1 - x), x, s) == (24/s**5, (0, oo), True) assert MT(log(x)**3*Heaviside(x - 1), x, s) == (6/s**4, (-oo, 0), True) assert MT(log(x + 1), x, s) == (pi/(s*sin(pi*s)), (-1, 0), True) assert MT(log(1/x + 1), x, s) == (pi/(s*sin(pi*s)), (0, 1), True) assert MT(log(abs(1 - x)), x, s) == (pi/(s*tan(pi*s)), (-1, 0), True) assert MT(log(abs(1 - 1/x)), x, s) == (pi/(s*tan(pi*s)), (0, 1), True) # 8.4.14 assert MT(erf(sqrt(x)), x, s) == \ (-gamma(s + S.Half)/(sqrt(pi)*s), (Rational(-1, 2), 0), True) @slow def test_mellin_transform2(): MT = mellin_transform # TODO we cannot currently do these (needs summation of 3F2(-1)) # this also implies that they cannot be written as a single g-function # (although this is possible) mt = MT(log(x)/(x + 1), x, s) assert mt[1:] == ((0, 1), True) assert not hyperexpand(mt[0], allow_hyper=True).has(meijerg) mt = MT(log(x)**2/(x + 1), x, s) assert mt[1:] == ((0, 1), True) assert not hyperexpand(mt[0], allow_hyper=True).has(meijerg) mt = MT(log(x)/(x + 1)**2, x, s) assert mt[1:] == ((0, 2), True) assert not hyperexpand(mt[0], allow_hyper=True).has(meijerg) @slow def test_mellin_transform_bessel(): from sympy import Max MT = mellin_transform # 8.4.19 assert MT(besselj(a, 2*sqrt(x)), x, s) == \ (gamma(a/2 + s)/gamma(a/2 - s + 1), (-re(a)/2, Rational(3, 4)), True) assert MT(sin(sqrt(x))*besselj(a, sqrt(x)), x, s) == \ (2**a*gamma(-2*s + S.Half)*gamma(a/2 + s + S.Half)/( gamma(-a/2 - s + 1)*gamma(a - 2*s + 1)), ( -re(a)/2 - S.Half, Rational(1, 4)), True) assert MT(cos(sqrt(x))*besselj(a, sqrt(x)), x, s) == \ (2**a*gamma(a/2 + s)*gamma(-2*s + S.Half)/( gamma(-a/2 - s + S.Half)*gamma(a - 2*s + 1)), ( -re(a)/2, Rational(1, 4)), True) assert MT(besselj(a, sqrt(x))**2, x, s) == \ (gamma(a + s)*gamma(S.Half - s) / (sqrt(pi)*gamma(1 - s)*gamma(1 + a - s)), (-re(a), S.Half), True) assert MT(besselj(a, sqrt(x))*besselj(-a, sqrt(x)), x, s) == \ (gamma(s)*gamma(S.Half - s) / (sqrt(pi)*gamma(1 - a - s)*gamma(1 + a - s)), (0, S.Half), True) # NOTE: prudnikov gives the strip below as (1/2 - re(a), 1). As far as # I can see this is wrong (since besselj(z) ~ 1/sqrt(z) for z large) assert MT(besselj(a - 1, sqrt(x))*besselj(a, sqrt(x)), x, s) == \ (gamma(1 - s)*gamma(a + s - S.Half) / (sqrt(pi)*gamma(Rational(3, 2) - s)*gamma(a - s + S.Half)), (S.Half - re(a), S.Half), True) assert MT(besselj(a, sqrt(x))*besselj(b, sqrt(x)), x, s) == \ (4**s*gamma(1 - 2*s)*gamma((a + b)/2 + s) / (gamma(1 - s + (b - a)/2)*gamma(1 - s + (a - b)/2) *gamma( 1 - s + (a + b)/2)), (-(re(a) + re(b))/2, S.Half), True) assert MT(besselj(a, sqrt(x))**2 + besselj(-a, sqrt(x))**2, x, s)[1:] == \ ((Max(re(a), -re(a)), S.Half), True) # Section 8.4.20 assert MT(bessely(a, 2*sqrt(x)), x, s) == \ (-cos(pi*(a/2 - s))*gamma(s - a/2)*gamma(s + a/2)/pi, (Max(-re(a)/2, re(a)/2), Rational(3, 4)), True) assert MT(sin(sqrt(x))*bessely(a, sqrt(x)), x, s) == \ (-4**s*sin(pi*(a/2 - s))*gamma(S.Half - 2*s) * gamma((1 - a)/2 + s)*gamma((1 + a)/2 + s) / (sqrt(pi)*gamma(1 - s - a/2)*gamma(1 - s + a/2)), (Max(-(re(a) + 1)/2, (re(a) - 1)/2), Rational(1, 4)), True) assert MT(cos(sqrt(x))*bessely(a, sqrt(x)), x, s) == \ (-4**s*cos(pi*(a/2 - s))*gamma(s - a/2)*gamma(s + a/2)*gamma(S.Half - 2*s) / (sqrt(pi)*gamma(S.Half - s - a/2)*gamma(S.Half - s + a/2)), (Max(-re(a)/2, re(a)/2), Rational(1, 4)), True) assert MT(besselj(a, sqrt(x))*bessely(a, sqrt(x)), x, s) == \ (-cos(pi*s)*gamma(s)*gamma(a + s)*gamma(S.Half - s) / (pi**S('3/2')*gamma(1 + a - s)), (Max(-re(a), 0), S.Half), True) assert MT(besselj(a, sqrt(x))*bessely(b, sqrt(x)), x, s) == \ (-4**s*cos(pi*(a/2 - b/2 + s))*gamma(1 - 2*s) * gamma(a/2 - b/2 + s)*gamma(a/2 + b/2 + s) / (pi*gamma(a/2 - b/2 - s + 1)*gamma(a/2 + b/2 - s + 1)), (Max((-re(a) + re(b))/2, (-re(a) - re(b))/2), S.Half), True) # NOTE bessely(a, sqrt(x))**2 and bessely(a, sqrt(x))*bessely(b, sqrt(x)) # are a mess (no matter what way you look at it ...) assert MT(bessely(a, sqrt(x))**2, x, s)[1:] == \ ((Max(-re(a), 0, re(a)), S.Half), True) # Section 8.4.22 # TODO we can't do any of these (delicate cancellation) # Section 8.4.23 assert MT(besselk(a, 2*sqrt(x)), x, s) == \ (gamma( s - a/2)*gamma(s + a/2)/2, (Max(-re(a)/2, re(a)/2), oo), True) assert MT(besselj(a, 2*sqrt(2*sqrt(x)))*besselk( a, 2*sqrt(2*sqrt(x))), x, s) == (4**(-s)*gamma(2*s)* gamma(a/2 + s)/(2*gamma(a/2 - s + 1)), (Max(0, -re(a)/2), oo), True) # TODO bessely(a, x)*besselk(a, x) is a mess assert MT(besseli(a, sqrt(x))*besselk(a, sqrt(x)), x, s) == \ (gamma(s)*gamma( a + s)*gamma(-s + S.Half)/(2*sqrt(pi)*gamma(a - s + 1)), (Max(-re(a), 0), S.Half), True) assert MT(besseli(b, sqrt(x))*besselk(a, sqrt(x)), x, s) == \ (2**(2*s - 1)*gamma(-2*s + 1)*gamma(-a/2 + b/2 + s)* \ gamma(a/2 + b/2 + s)/(gamma(-a/2 + b/2 - s + 1)* \ gamma(a/2 + b/2 - s + 1)), (Max(-re(a)/2 - re(b)/2, \ re(a)/2 - re(b)/2), S.Half), True) # TODO products of besselk are a mess mt = MT(exp(-x/2)*besselk(a, x/2), x, s) mt0 = gammasimp((trigsimp(gammasimp(mt[0].expand(func=True))))) assert mt0 == 2*pi**Rational(3, 2)*cos(pi*s)*gamma(-s + S.Half)/( (cos(2*pi*a) - cos(2*pi*s))*gamma(-a - s + 1)*gamma(a - s + 1)) assert mt[1:] == ((Max(-re(a), re(a)), oo), True) # TODO exp(x/2)*besselk(a, x/2) [etc] cannot currently be done # TODO various strange products of special orders @slow def test_expint(): from sympy import E1, expint, Max, re, lerchphi, Symbol, simplify, Si, Ci, Ei aneg = Symbol('a', negative=True) u = Symbol('u', polar=True) assert mellin_transform(E1(x), x, s) == (gamma(s)/s, (0, oo), True) assert inverse_mellin_transform(gamma(s)/s, s, x, (0, oo)).rewrite(expint).expand() == E1(x) assert mellin_transform(expint(a, x), x, s) == \ (gamma(s)/(a + s - 1), (Max(1 - re(a), 0), oo), True) # XXX IMT has hickups with complicated strips ... assert simplify(unpolarify( inverse_mellin_transform(gamma(s)/(aneg + s - 1), s, x, (1 - aneg, oo)).rewrite(expint).expand(func=True))) == \ expint(aneg, x) assert mellin_transform(Si(x), x, s) == \ (-2**s*sqrt(pi)*gamma(s/2 + S.Half)/( 2*s*gamma(-s/2 + 1)), (-1, 0), True) assert inverse_mellin_transform(-2**s*sqrt(pi)*gamma((s + 1)/2) /(2*s*gamma(-s/2 + 1)), s, x, (-1, 0)) \ == Si(x) assert mellin_transform(Ci(sqrt(x)), x, s) == \ (-2**(2*s - 1)*sqrt(pi)*gamma(s)/(s*gamma(-s + S.Half)), (0, 1), True) assert inverse_mellin_transform( -4**s*sqrt(pi)*gamma(s)/(2*s*gamma(-s + S.Half)), s, u, (0, 1)).expand() == Ci(sqrt(u)) # TODO LT of Si, Shi, Chi is a mess ... assert laplace_transform(Ci(x), x, s) == (-log(1 + s**2)/2/s, 0, True) assert laplace_transform(expint(a, x), x, s) == \ (lerchphi(s*exp_polar(I*pi), 1, a), 0, re(a) > S.Zero) assert laplace_transform(expint(1, x), x, s) == (log(s + 1)/s, 0, True) assert laplace_transform(expint(2, x), x, s) == \ ((s - log(s + 1))/s**2, 0, True) assert inverse_laplace_transform(-log(1 + s**2)/2/s, s, u).expand() == \ Heaviside(u)*Ci(u) assert inverse_laplace_transform(log(s + 1)/s, s, x).rewrite(expint) == \ Heaviside(x)*E1(x) assert inverse_laplace_transform((s - log(s + 1))/s**2, s, x).rewrite(expint).expand() == \ (expint(2, x)*Heaviside(x)).rewrite(Ei).rewrite(expint).expand() @slow def test_inverse_mellin_transform(): from sympy import (sin, simplify, Max, Min, expand, powsimp, exp_polar, cos, cot) IMT = inverse_mellin_transform assert IMT(gamma(s), s, x, (0, oo)) == exp(-x) assert IMT(gamma(-s), s, x, (-oo, 0)) == exp(-1/x) assert simplify(IMT(s/(2*s**2 - 2), s, x, (2, oo))) == \ (x**2 + 1)*Heaviside(1 - x)/(4*x) # test passing "None" assert IMT(1/(s**2 - 1), s, x, (-1, None)) == \ -x*Heaviside(-x + 1)/2 - Heaviside(x - 1)/(2*x) assert IMT(1/(s**2 - 1), s, x, (None, 1)) == \ -x*Heaviside(-x + 1)/2 - Heaviside(x - 1)/(2*x) # test expansion of sums assert IMT(gamma(s) + gamma(s - 1), s, x, (1, oo)) == (x + 1)*exp(-x)/x # test factorisation of polys r = symbols('r', real=True) assert IMT(1/(s**2 + 1), s, exp(-x), (None, oo) ).subs(x, r).rewrite(sin).simplify() \ == sin(r)*Heaviside(1 - exp(-r)) # test multiplicative substitution _a, _b = symbols('a b', positive=True) assert IMT(_b**(-s/_a)*factorial(s/_a)/s, s, x, (0, oo)) == exp(-_b*x**_a) assert IMT(factorial(_a/_b + s/_b)/(_a + s), s, x, (-_a, oo)) == x**_a*exp(-x**_b) def simp_pows(expr): return simplify(powsimp(expand_mul(expr, deep=False), force=True)).replace(exp_polar, exp) # Now test the inverses of all direct transforms tested above # Section 8.4.2 nu = symbols('nu', real=True) assert IMT(-1/(nu + s), s, x, (-oo, None)) == x**nu*Heaviside(x - 1) assert IMT(1/(nu + s), s, x, (None, oo)) == x**nu*Heaviside(1 - x) assert simp_pows(IMT(gamma(beta)*gamma(s)/gamma(s + beta), s, x, (0, oo))) \ == (1 - x)**(beta - 1)*Heaviside(1 - x) assert simp_pows(IMT(gamma(beta)*gamma(1 - beta - s)/gamma(1 - s), s, x, (-oo, None))) \ == (x - 1)**(beta - 1)*Heaviside(x - 1) assert simp_pows(IMT(gamma(s)*gamma(rho - s)/gamma(rho), s, x, (0, None))) \ == (1/(x + 1))**rho assert simp_pows(IMT(d**c*d**(s - 1)*sin(pi*c) *gamma(s)*gamma(s + c)*gamma(1 - s)*gamma(1 - s - c)/pi, s, x, (Max(-re(c), 0), Min(1 - re(c), 1)))) \ == (x**c - d**c)/(x - d) assert simplify(IMT(1/sqrt(pi)*(-c/2)*gamma(s)*gamma((1 - c)/2 - s) *gamma(-c/2 - s)/gamma(1 - c - s), s, x, (0, -re(c)/2))) == \ (1 + sqrt(x + 1))**c assert simplify(IMT(2**(a + 2*s)*b**(a + 2*s - 1)*gamma(s)*gamma(1 - a - 2*s) /gamma(1 - a - s), s, x, (0, (-re(a) + 1)/2))) == \ b**(a - 1)*(sqrt(1 + x/b**2) + 1)**(a - 1)*(b**2*sqrt(1 + x/b**2) + b**2 + x)/(b**2 + x) assert simplify(IMT(-2**(c + 2*s)*c*b**(c + 2*s)*gamma(s)*gamma(-c - 2*s) / gamma(-c - s + 1), s, x, (0, -re(c)/2))) == \ b**c*(sqrt(1 + x/b**2) + 1)**c # Section 8.4.5 assert IMT(24/s**5, s, x, (0, oo)) == log(x)**4*Heaviside(1 - x) assert expand(IMT(6/s**4, s, x, (-oo, 0)), force=True) == \ log(x)**3*Heaviside(x - 1) assert IMT(pi/(s*sin(pi*s)), s, x, (-1, 0)) == log(x + 1) assert IMT(pi/(s*sin(pi*s/2)), s, x, (-2, 0)) == log(x**2 + 1) assert IMT(pi/(s*sin(2*pi*s)), s, x, (Rational(-1, 2), 0)) == log(sqrt(x) + 1) assert IMT(pi/(s*sin(pi*s)), s, x, (0, 1)) == log(1 + 1/x) # TODO def mysimp(expr): from sympy import expand, logcombine, powsimp return expand( powsimp(logcombine(expr, force=True), force=True, deep=True), force=True).replace(exp_polar, exp) assert mysimp(mysimp(IMT(pi/(s*tan(pi*s)), s, x, (-1, 0)))) in [ log(1 - x)*Heaviside(1 - x) + log(x - 1)*Heaviside(x - 1), log(x)*Heaviside(x - 1) + log(1 - 1/x)*Heaviside(x - 1) + log(-x + 1)*Heaviside(-x + 1)] # test passing cot assert mysimp(IMT(pi*cot(pi*s)/s, s, x, (0, 1))) in [ log(1/x - 1)*Heaviside(1 - x) + log(1 - 1/x)*Heaviside(x - 1), -log(x)*Heaviside(-x + 1) + log(1 - 1/x)*Heaviside(x - 1) + log(-x + 1)*Heaviside(-x + 1), ] # 8.4.14 assert IMT(-gamma(s + S.Half)/(sqrt(pi)*s), s, x, (Rational(-1, 2), 0)) == \ erf(sqrt(x)) # 8.4.19 assert simplify(IMT(gamma(a/2 + s)/gamma(a/2 - s + 1), s, x, (-re(a)/2, Rational(3, 4)))) \ == besselj(a, 2*sqrt(x)) assert simplify(IMT(2**a*gamma(S.Half - 2*s)*gamma(s + (a + 1)/2) / (gamma(1 - s - a/2)*gamma(1 - 2*s + a)), s, x, (-(re(a) + 1)/2, Rational(1, 4)))) == \ sin(sqrt(x))*besselj(a, sqrt(x)) assert simplify(IMT(2**a*gamma(a/2 + s)*gamma(S.Half - 2*s) / (gamma(S.Half - s - a/2)*gamma(1 - 2*s + a)), s, x, (-re(a)/2, Rational(1, 4)))) == \ cos(sqrt(x))*besselj(a, sqrt(x)) # TODO this comes out as an amazing mess, but simplifies nicely assert simplify(IMT(gamma(a + s)*gamma(S.Half - s) / (sqrt(pi)*gamma(1 - s)*gamma(1 + a - s)), s, x, (-re(a), S.Half))) == \ besselj(a, sqrt(x))**2 assert simplify(IMT(gamma(s)*gamma(S.Half - s) / (sqrt(pi)*gamma(1 - s - a)*gamma(1 + a - s)), s, x, (0, S.Half))) == \ besselj(-a, sqrt(x))*besselj(a, sqrt(x)) assert simplify(IMT(4**s*gamma(-2*s + 1)*gamma(a/2 + b/2 + s) / (gamma(-a/2 + b/2 - s + 1)*gamma(a/2 - b/2 - s + 1) *gamma(a/2 + b/2 - s + 1)), s, x, (-(re(a) + re(b))/2, S.Half))) == \ besselj(a, sqrt(x))*besselj(b, sqrt(x)) # Section 8.4.20 # TODO this can be further simplified! assert simplify(IMT(-2**(2*s)*cos(pi*a/2 - pi*b/2 + pi*s)*gamma(-2*s + 1) * gamma(a/2 - b/2 + s)*gamma(a/2 + b/2 + s) / (pi*gamma(a/2 - b/2 - s + 1)*gamma(a/2 + b/2 - s + 1)), s, x, (Max(-re(a)/2 - re(b)/2, -re(a)/2 + re(b)/2), S.Half))) == \ besselj(a, sqrt(x))*-(besselj(-b, sqrt(x)) - besselj(b, sqrt(x))*cos(pi*b))/sin(pi*b) # TODO more # for coverage assert IMT(pi/cos(pi*s), s, x, (0, S.Half)) == sqrt(x)/(x + 1) @slow def test_laplace_transform(): from sympy import fresnels, fresnelc LT = laplace_transform a, b, c, = symbols('a b c', positive=True) t = symbols('t') w = Symbol("w") f = Function("f") # Test unevaluated form assert laplace_transform(f(t), t, w) == LaplaceTransform(f(t), t, w) assert inverse_laplace_transform( f(w), w, t, plane=0) == InverseLaplaceTransform(f(w), w, t, 0) # test a bug spos = symbols('s', positive=True) assert LT(exp(t), t, spos)[:2] == (1/(spos - 1), 1) # basic tests from wikipedia assert LT((t - a)**b*exp(-c*(t - a))*Heaviside(t - a), t, s) == \ ((s + c)**(-b - 1)*exp(-a*s)*gamma(b + 1), -c, True) assert LT(t**a, t, s) == (s**(-a - 1)*gamma(a + 1), 0, True) assert LT(Heaviside(t), t, s) == (1/s, 0, True) assert LT(Heaviside(t - a), t, s) == (exp(-a*s)/s, 0, True) assert LT(1 - exp(-a*t), t, s) == (a/(s*(a + s)), 0, True) assert LT((exp(2*t) - 1)*exp(-b - t)*Heaviside(t)/2, t, s, noconds=True) \ == exp(-b)/(s**2 - 1) assert LT(exp(t), t, s)[:2] == (1/(s - 1), 1) assert LT(exp(2*t), t, s)[:2] == (1/(s - 2), 2) assert LT(exp(a*t), t, s)[:2] == (1/(s - a), a) assert LT(log(t/a), t, s) == ((log(a*s) + EulerGamma)/s/-1, 0, True) assert LT(erf(t), t, s) == (erfc(s/2)*exp(s**2/4)/s, 0, True) assert LT(sin(a*t), t, s) == (a/(a**2 + s**2), 0, True) assert LT(cos(a*t), t, s) == (s/(a**2 + s**2), 0, True) # TODO would be nice to have these come out better assert LT(exp(-a*t)*sin(b*t), t, s) == (b/(b**2 + (a + s)**2), -a, True) assert LT(exp(-a*t)*cos(b*t), t, s) == \ ((a + s)/(b**2 + (a + s)**2), -a, True) assert LT(besselj(0, t), t, s) == (1/sqrt(1 + s**2), 0, True) assert LT(besselj(1, t), t, s) == (1 - 1/sqrt(1 + 1/s**2), 0, True) # TODO general order works, but is a *mess* # TODO besseli also works, but is an even greater mess # test a bug in conditions processing # TODO the auxiliary condition should be recognised/simplified assert LT(exp(t)*cos(t), t, s)[:-1] in [ ((s - 1)/(s**2 - 2*s + 2), -oo), ((s - 1)/((s - 1)**2 + 1), -oo), ] # Fresnel functions assert laplace_transform(fresnels(t), t, s) == \ ((-sin(s**2/(2*pi))*fresnels(s/pi) + sin(s**2/(2*pi))/2 - cos(s**2/(2*pi))*fresnelc(s/pi) + cos(s**2/(2*pi))/2)/s, 0, True) assert laplace_transform(fresnelc(t), t, s) == ( ((2*sin(s**2/(2*pi))*fresnelc(s/pi) - 2*cos(s**2/(2*pi))*fresnels(s/pi) + sqrt(2)*cos(s**2/(2*pi) + pi/4))/(2*s), 0, True)) # What is this testing: Ne(1/s, 1) & (0 < cos(Abs(periodic_argument(s, oo)))*Abs(s) - 1) assert LT(Matrix([[exp(t), t*exp(-t)], [t*exp(-t), exp(t)]]), t, s) ==\ Matrix([ [(1/(s - 1), 1, True), ((s + 1)**(-2), 0, True)], [((s + 1)**(-2), 0, True), (1/(s - 1), 1, True)] ]) def test_issue_8368_7173(): LT = laplace_transform # hyperbolic assert LT(sinh(x), x, s) == (1/(s**2 - 1), 1, True) assert LT(cosh(x), x, s) == (s/(s**2 - 1), 1, True) assert LT(sinh(x + 3), x, s) == ( (-s + (s + 1)*exp(6) + 1)*exp(-3)/(s - 1)/(s + 1)/2, 1, True) assert LT(sinh(x)*cosh(x), x, s) == ( 1/(s**2 - 4), 2, Ne(s/2, 1)) # trig (make sure they are not being rewritten in terms of exp) assert LT(cos(x + 3), x, s) == ((s*cos(3) - sin(3))/(s**2 + 1), 0, True) def test_inverse_laplace_transform(): from sympy import sinh, cosh, besselj, besseli, simplify, factor_terms ILT = inverse_laplace_transform a, b, c, = symbols('a b c', positive=True) t = symbols('t') def simp_hyp(expr): return factor_terms(expand_mul(expr)).rewrite(sin) # just test inverses of all of the above assert ILT(1/s, s, t) == Heaviside(t) assert ILT(1/s**2, s, t) == t*Heaviside(t) assert ILT(1/s**5, s, t) == t**4*Heaviside(t)/24 assert ILT(exp(-a*s)/s, s, t) == Heaviside(t - a) assert ILT(exp(-a*s)/(s + b), s, t) == exp(b*(a - t))*Heaviside(-a + t) assert ILT(a/(s**2 + a**2), s, t) == sin(a*t)*Heaviside(t) assert ILT(s/(s**2 + a**2), s, t) == cos(a*t)*Heaviside(t) # TODO is there a way around simp_hyp? assert simp_hyp(ILT(a/(s**2 - a**2), s, t)) == sinh(a*t)*Heaviside(t) assert simp_hyp(ILT(s/(s**2 - a**2), s, t)) == cosh(a*t)*Heaviside(t) assert ILT(a/((s + b)**2 + a**2), s, t) == exp(-b*t)*sin(a*t)*Heaviside(t) assert ILT( (s + b)/((s + b)**2 + a**2), s, t) == exp(-b*t)*cos(a*t)*Heaviside(t) # TODO sinh/cosh shifted come out a mess. also delayed trig is a mess # TODO should this simplify further? assert ILT(exp(-a*s)/s**b, s, t) == \ (t - a)**(b - 1)*Heaviside(t - a)/gamma(b) assert ILT(exp(-a*s)/sqrt(1 + s**2), s, t) == \ Heaviside(t - a)*besselj(0, a - t) # note: besselj(0, x) is even # XXX ILT turns these branch factor into trig functions ... assert simplify(ILT(a**b*(s + sqrt(s**2 - a**2))**(-b)/sqrt(s**2 - a**2), s, t).rewrite(exp)) == \ Heaviside(t)*besseli(b, a*t) assert ILT(a**b*(s + sqrt(s**2 + a**2))**(-b)/sqrt(s**2 + a**2), s, t).rewrite(exp) == \ Heaviside(t)*besselj(b, a*t) assert ILT(1/(s*sqrt(s + 1)), s, t) == Heaviside(t)*erf(sqrt(t)) # TODO can we make erf(t) work? assert ILT(1/(s**2*(s**2 + 1)),s,t) == (t - sin(t))*Heaviside(t) assert ILT( (s * eye(2) - Matrix([[1, 0], [0, 2]])).inv(), s, t) ==\ Matrix([[exp(t)*Heaviside(t), 0], [0, exp(2*t)*Heaviside(t)]]) def test_inverse_laplace_transform_delta(): from sympy import DiracDelta ILT = inverse_laplace_transform t = symbols('t') assert ILT(2, s, t) == 2*DiracDelta(t) assert ILT(2*exp(3*s) - 5*exp(-7*s), s, t) == \ 2*DiracDelta(t + 3) - 5*DiracDelta(t - 7) a = cos(sin(7)/2) assert ILT(a*exp(-3*s), s, t) == a*DiracDelta(t - 3) assert ILT(exp(2*s), s, t) == DiracDelta(t + 2) r = Symbol('r', real=True) assert ILT(exp(r*s), s, t) == DiracDelta(t + r) def test_inverse_laplace_transform_delta_cond(): from sympy import DiracDelta, Eq, im, Heaviside ILT = inverse_laplace_transform t = symbols('t') r = Symbol('r', real=True) assert ILT(exp(r*s), s, t, noconds=False) == (DiracDelta(t + r), True) z = Symbol('z') assert ILT(exp(z*s), s, t, noconds=False) == \ (DiracDelta(t + z), Eq(im(z), 0)) # inversion does not exist: verify it doesn't evaluate to DiracDelta for z in (Symbol('z', extended_real=False), Symbol('z', imaginary=True, zero=False)): f = ILT(exp(z*s), s, t, noconds=False) f = f[0] if isinstance(f, tuple) else f assert f.func != DiracDelta # issue 15043 assert ILT(1/s + exp(r*s)/s, s, t, noconds=False) == ( Heaviside(t) + Heaviside(r + t), True) def test_fourier_transform(): from sympy import simplify, expand, expand_complex, factor, expand_trig FT = fourier_transform IFT = inverse_fourier_transform def simp(x): return simplify(expand_trig(expand_complex(expand(x)))) def sinc(x): return sin(pi*x)/(pi*x) k = symbols('k', real=True) f = Function("f") # TODO for this to work with real a, need to expand abs(a*x) to abs(a)*abs(x) a = symbols('a', positive=True) b = symbols('b', positive=True) posk = symbols('posk', positive=True) # Test unevaluated form assert fourier_transform(f(x), x, k) == FourierTransform(f(x), x, k) assert inverse_fourier_transform( f(k), k, x) == InverseFourierTransform(f(k), k, x) # basic examples from wikipedia assert simp(FT(Heaviside(1 - abs(2*a*x)), x, k)) == sinc(k/a)/a # TODO IFT is a *mess* assert simp(FT(Heaviside(1 - abs(a*x))*(1 - abs(a*x)), x, k)) == sinc(k/a)**2/a # TODO IFT assert factor(FT(exp(-a*x)*Heaviside(x), x, k), extension=I) == \ 1/(a + 2*pi*I*k) # NOTE: the ift comes out in pieces assert IFT(1/(a + 2*pi*I*x), x, posk, noconds=False) == (exp(-a*posk), True) assert IFT(1/(a + 2*pi*I*x), x, -posk, noconds=False) == (0, True) assert IFT(1/(a + 2*pi*I*x), x, symbols('k', negative=True), noconds=False) == (0, True) # TODO IFT without factoring comes out as meijer g assert factor(FT(x*exp(-a*x)*Heaviside(x), x, k), extension=I) == \ 1/(a + 2*pi*I*k)**2 assert FT(exp(-a*x)*sin(b*x)*Heaviside(x), x, k) == \ b/(b**2 + (a + 2*I*pi*k)**2) assert FT(exp(-a*x**2), x, k) == sqrt(pi)*exp(-pi**2*k**2/a)/sqrt(a) assert IFT(sqrt(pi/a)*exp(-(pi*k)**2/a), k, x) == exp(-a*x**2) assert FT(exp(-a*abs(x)), x, k) == 2*a/(a**2 + 4*pi**2*k**2) # TODO IFT (comes out as meijer G) # TODO besselj(n, x), n an integer > 0 actually can be done... # TODO are there other common transforms (no distributions!)? def test_sine_transform(): from sympy import EulerGamma t = symbols("t") w = symbols("w") a = symbols("a") f = Function("f") # Test unevaluated form assert sine_transform(f(t), t, w) == SineTransform(f(t), t, w) assert inverse_sine_transform( f(w), w, t) == InverseSineTransform(f(w), w, t) assert sine_transform(1/sqrt(t), t, w) == 1/sqrt(w) assert inverse_sine_transform(1/sqrt(w), w, t) == 1/sqrt(t) assert sine_transform((1/sqrt(t))**3, t, w) == 2*sqrt(w) assert sine_transform(t**(-a), t, w) == 2**( -a + S.Half)*w**(a - 1)*gamma(-a/2 + 1)/gamma((a + 1)/2) assert inverse_sine_transform(2**(-a + S( 1)/2)*w**(a - 1)*gamma(-a/2 + 1)/gamma(a/2 + S.Half), w, t) == t**(-a) assert sine_transform( exp(-a*t), t, w) == sqrt(2)*w/(sqrt(pi)*(a**2 + w**2)) assert inverse_sine_transform( sqrt(2)*w/(sqrt(pi)*(a**2 + w**2)), w, t) == exp(-a*t) assert sine_transform( log(t)/t, t, w) == -sqrt(2)*sqrt(pi)*(log(w**2) + 2*EulerGamma)/4 assert sine_transform( t*exp(-a*t**2), t, w) == sqrt(2)*w*exp(-w**2/(4*a))/(4*a**Rational(3, 2)) assert inverse_sine_transform( sqrt(2)*w*exp(-w**2/(4*a))/(4*a**Rational(3, 2)), w, t) == t*exp(-a*t**2) def test_cosine_transform(): from sympy import Si, Ci t = symbols("t") w = symbols("w") a = symbols("a") f = Function("f") # Test unevaluated form assert cosine_transform(f(t), t, w) == CosineTransform(f(t), t, w) assert inverse_cosine_transform( f(w), w, t) == InverseCosineTransform(f(w), w, t) assert cosine_transform(1/sqrt(t), t, w) == 1/sqrt(w) assert inverse_cosine_transform(1/sqrt(w), w, t) == 1/sqrt(t) assert cosine_transform(1/( a**2 + t**2), t, w) == sqrt(2)*sqrt(pi)*exp(-a*w)/(2*a) assert cosine_transform(t**( -a), t, w) == 2**(-a + S.Half)*w**(a - 1)*gamma((-a + 1)/2)/gamma(a/2) assert inverse_cosine_transform(2**(-a + S( 1)/2)*w**(a - 1)*gamma(-a/2 + S.Half)/gamma(a/2), w, t) == t**(-a) assert cosine_transform( exp(-a*t), t, w) == sqrt(2)*a/(sqrt(pi)*(a**2 + w**2)) assert inverse_cosine_transform( sqrt(2)*a/(sqrt(pi)*(a**2 + w**2)), w, t) == exp(-a*t) assert cosine_transform(exp(-a*sqrt(t))*cos(a*sqrt( t)), t, w) == a*exp(-a**2/(2*w))/(2*w**Rational(3, 2)) assert cosine_transform(1/(a + t), t, w) == sqrt(2)*( (-2*Si(a*w) + pi)*sin(a*w)/2 - cos(a*w)*Ci(a*w))/sqrt(pi) assert inverse_cosine_transform(sqrt(2)*meijerg(((S.Half, 0), ()), ( (S.Half, 0, 0), (S.Half,)), a**2*w**2/4)/(2*pi), w, t) == 1/(a + t) assert cosine_transform(1/sqrt(a**2 + t**2), t, w) == sqrt(2)*meijerg( ((S.Half,), ()), ((0, 0), (S.Half,)), a**2*w**2/4)/(2*sqrt(pi)) assert inverse_cosine_transform(sqrt(2)*meijerg(((S.Half,), ()), ((0, 0), (S.Half,)), a**2*w**2/4)/(2*sqrt(pi)), w, t) == 1/(t*sqrt(a**2/t**2 + 1)) def test_hankel_transform(): from sympy import gamma, sqrt, exp r = Symbol("r") k = Symbol("k") nu = Symbol("nu") m = Symbol("m") a = symbols("a") assert hankel_transform(1/r, r, k, 0) == 1/k assert inverse_hankel_transform(1/k, k, r, 0) == 1/r assert hankel_transform( 1/r**m, r, k, 0) == 2**(-m + 1)*k**(m - 2)*gamma(-m/2 + 1)/gamma(m/2) assert inverse_hankel_transform( 2**(-m + 1)*k**(m - 2)*gamma(-m/2 + 1)/gamma(m/2), k, r, 0) == r**(-m) assert hankel_transform(1/r**m, r, k, nu) == ( 2*2**(-m)*k**(m - 2)*gamma(-m/2 + nu/2 + 1)/gamma(m/2 + nu/2)) assert inverse_hankel_transform(2**(-m + 1)*k**( m - 2)*gamma(-m/2 + nu/2 + 1)/gamma(m/2 + nu/2), k, r, nu) == r**(-m) assert hankel_transform(r**nu*exp(-a*r), r, k, nu) == \ 2**(nu + 1)*a*k**(-nu - 3)*(a**2/k**2 + 1)**(-nu - S( 3)/2)*gamma(nu + Rational(3, 2))/sqrt(pi) assert inverse_hankel_transform( 2**(nu + 1)*a*k**(-nu - 3)*(a**2/k**2 + 1)**(-nu - Rational(3, 2))*gamma( nu + Rational(3, 2))/sqrt(pi), k, r, nu) == r**nu*exp(-a*r) def test_issue_7181(): assert mellin_transform(1/(1 - x), x, s) != None def test_issue_8882(): # This is the original test. # from sympy import diff, Integral, integrate # r = Symbol('r') # psi = 1/r*sin(r)*exp(-(a0*r)) # h = -1/2*diff(psi, r, r) - 1/r*psi # f = 4*pi*psi*h*r**2 # assert integrate(f, (r, -oo, 3), meijerg=True).has(Integral) == True # To save time, only the critical part is included. F = -a**(-s + 1)*(4 + 1/a**2)**(-s/2)*sqrt(1/a**2)*exp(-s*I*pi)* \ sin(s*atan(sqrt(1/a**2)/2))*gamma(s) raises(IntegralTransformError, lambda: inverse_mellin_transform(F, s, x, (-1, oo), **{'as_meijerg': True, 'needeval': True})) def test_issue_7173(): from sympy import cse x0, x1, x2, x3 = symbols('x:4') ans = laplace_transform(sinh(a*x)*cosh(a*x), x, s) r, e = cse(ans) assert r == [ (x0, arg(a)), (x1, Abs(x0)), (x2, pi/2), (x3, Abs(x0 + pi))] assert e == [ a/(-4*a**2 + s**2), 0, ((x1 <= x2) | (x1 < x2)) & ((x3 <= x2) | (x3 < x2))] def test_issue_8514(): from sympy import simplify a, b, c, = symbols('a b c', positive=True) t = symbols('t', positive=True) ft = simplify(inverse_laplace_transform(1/(a*s**2+b*s+c),s, t)) assert ft == (I*exp(t*cos(atan2(0, -4*a*c + b**2)/2)*sqrt(Abs(4*a*c - b**2))/a)*sin(t*sin(atan2(0, -4*a*c + b**2)/2)*sqrt(Abs( 4*a*c - b**2))/(2*a)) + exp(t*cos(atan2(0, -4*a*c + b**2) /2)*sqrt(Abs(4*a*c - b**2))/a)*cos(t*sin(atan2(0, -4*a*c + b**2)/2)*sqrt(Abs(4*a*c - b**2))/(2*a)) + I*sin(t*sin( atan2(0, -4*a*c + b**2)/2)*sqrt(Abs(4*a*c - b**2))/(2*a)) - cos(t*sin(atan2(0, -4*a*c + b**2)/2)*sqrt(Abs(4*a*c - b**2))/(2*a)))*exp(-t*(b + cos(atan2(0, -4*a*c + b**2)/2) *sqrt(Abs(4*a*c - b**2)))/(2*a))/sqrt(-4*a*c + b**2) def test_issue_12591(): x, y = symbols("x y", real=True) assert fourier_transform(exp(x), x, y) == FourierTransform(exp(x), x, y) def test_issue_14692(): b = Symbol('b', negative=True) assert laplace_transform(1/(I*x - b), x, s) == \ (-I*exp(I*b*s)*expint(1, b*s*exp_polar(I*pi/2)), 0, True)
554713ca0c984f24ba102179a60c06513f45362f07d13fc7f4db06dc19bf72c7
"""Most of these tests come from the examples in Bronstein's book.""" from sympy.integrals.risch import DifferentialExtension, derivation from sympy.integrals.prde import (prde_normal_denom, prde_special_denom, prde_linear_constraints, constant_system, prde_spde, prde_no_cancel_b_large, prde_no_cancel_b_small, limited_integrate_reduce, limited_integrate, is_deriv_k, is_log_deriv_k_t_radical, parametric_log_deriv_heu, is_log_deriv_k_t_radical_in_field, param_poly_rischDE, param_rischDE, prde_cancel_liouvillian) from sympy.polys.polymatrix import PolyMatrix as Matrix from sympy import Poly, S, symbols, Rational from sympy.abc import x, t, n t0, t1, t2, t3, k = symbols('t:4 k') def test_prde_normal_denom(): DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1 + t**2, t)]}) fa = Poly(1, t) fd = Poly(x, t) G = [(Poly(t, t), Poly(1 + t**2, t)), (Poly(1, t), Poly(x + x*t**2, t))] assert prde_normal_denom(fa, fd, G, DE) == \ (Poly(x, t, domain='ZZ(x)'), (Poly(1, t, domain='ZZ(x)'), Poly(1, t, domain='ZZ(x)')), [(Poly(x*t, t, domain='ZZ(x)'), Poly(t**2 + 1, t, domain='ZZ(x)')), (Poly(1, t, domain='ZZ(x)'), Poly(t**2 + 1, t, domain='ZZ(x)'))], Poly(1, t, domain='ZZ(x)')) G = [(Poly(t, t), Poly(t**2 + 2*t + 1, t)), (Poly(x*t, t), Poly(t**2 + 2*t + 1, t)), (Poly(x*t**2, t), Poly(t**2 + 2*t + 1, t))] DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t, t)]}) assert prde_normal_denom(Poly(x, t), Poly(1, t), G, DE) == \ (Poly(t + 1, t), (Poly((-1 + x)*t + x, t), Poly(1, t, domain='ZZ[x]')), [(Poly(t, t), Poly(1, t)), (Poly(x*t, t), Poly(1, t, domain='ZZ[x]')), (Poly(x*t**2, t), Poly(1, t, domain='ZZ[x]'))], Poly(t + 1, t)) def test_prde_special_denom(): a = Poly(t + 1, t) ba = Poly(t**2, t) bd = Poly(1, t) G = [(Poly(t, t), Poly(1, t)), (Poly(t**2, t), Poly(1, t)), (Poly(t**3, t), Poly(1, t))] DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t, t)]}) assert prde_special_denom(a, ba, bd, G, DE) == \ (Poly(t + 1, t), Poly(t**2, t), [(Poly(t, t), Poly(1, t)), (Poly(t**2, t), Poly(1, t)), (Poly(t**3, t), Poly(1, t))], Poly(1, t)) G = [(Poly(t, t), Poly(1, t)), (Poly(1, t), Poly(t, t))] assert prde_special_denom(Poly(1, t), Poly(t**2, t), Poly(1, t), G, DE) == \ (Poly(1, t), Poly(t**2 - 1, t), [(Poly(t**2, t), Poly(1, t)), (Poly(1, t), Poly(1, t))], Poly(t, t)) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(-2*x*t0, t0)]}) DE.decrement_level() G = [(Poly(t, t), Poly(t**2, t)), (Poly(2*t, t), Poly(t, t))] assert prde_special_denom(Poly(5*x*t + 1, t), Poly(t**2 + 2*x**3*t, t), Poly(t**3 + 2, t), G, DE) == \ (Poly(5*x*t + 1, t), Poly(0, t, domain='ZZ[x]'), [(Poly(t, t), Poly(t**2, t)), (Poly(2*t, t), Poly(t, t))], Poly(1, x)) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly((t**2 + 1)*2*x, t)]}) G = [(Poly(t + x, t), Poly(t*x, t)), (Poly(2*t, t), Poly(x**2, x))] assert prde_special_denom(Poly(5*x*t + 1, t), Poly(t**2 + 2*x**3*t, t), Poly(t**3, t), G, DE) == \ (Poly(5*x*t + 1, t), Poly(0, t, domain='ZZ[x]'), [(Poly(t + x, t), Poly(x*t, t)), (Poly(2*t, t, x), Poly(x**2, t, x))], Poly(1, t)) assert prde_special_denom(Poly(t + 1, t), Poly(t**2, t), Poly(t**3, t), G, DE) == \ (Poly(t + 1, t), Poly(0, t, domain='ZZ[x]'), [(Poly(t + x, t), Poly(x*t, t)), (Poly(2*t, t, x), Poly(x**2, t, x))], Poly(1, t)) def test_prde_linear_constraints(): DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) G = [(Poly(2*x**3 + 3*x + 1, x), Poly(x**2 - 1, x)), (Poly(1, x), Poly(x - 1, x)), (Poly(1, x), Poly(x + 1, x))] assert prde_linear_constraints(Poly(1, x), Poly(0, x), G, DE) == \ ((Poly(2*x, x, domain='QQ'), Poly(0, x, domain='QQ'), Poly(0, x, domain='QQ')), Matrix([[1, 1, -1], [5, 1, 1]])) G = [(Poly(t, t), Poly(1, t)), (Poly(t**2, t), Poly(1, t)), (Poly(t**3, t), Poly(1, t))] DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t, t)]}) assert prde_linear_constraints(Poly(t + 1, t), Poly(t**2, t), G, DE) == \ ((Poly(t, t, domain='QQ'), Poly(t**2, t, domain='QQ'), Poly(t**3, t, domain='QQ')), Matrix(0, 3, [])) G = [(Poly(2*x, t), Poly(t, t)), (Poly(-x, t), Poly(t, t))] DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) assert prde_linear_constraints(Poly(1, t), Poly(0, t), G, DE) == \ ((Poly(0, t, domain='QQ[x]'), Poly(0, t, domain='QQ[x]')), Matrix([[2*x, -x]])) def test_constant_system(): A = Matrix([[-(x + 3)/(x - 1), (x + 1)/(x - 1), 1], [-x - 3, x + 1, x - 1], [2*(x + 3)/(x - 1), 0, 0]]) u = Matrix([(x + 1)/(x - 1), x + 1, 0]) DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) assert constant_system(A, u, DE) == \ (Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 0], [0, 0, 1]]), Matrix([0, 1, 0, 0])) def test_prde_spde(): D = [Poly(x, t), Poly(-x*t, t)] DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) # TODO: when bound_degree() can handle this, test degree bound from that too assert prde_spde(Poly(t, t), Poly(-1/x, t), D, n, DE) == \ (Poly(t, t), Poly(0, t, domain='ZZ(x)'), [Poly(2*x, t, domain='ZZ(x)'), Poly(-x, t, domain='ZZ(x)')], [Poly(-x**2, t, domain='ZZ(x)'), Poly(0, t, domain='ZZ(x)')], n - 1) def test_prde_no_cancel(): # b large DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) assert prde_no_cancel_b_large(Poly(1, x), [Poly(x**2, x), Poly(1, x)], 2, DE) == \ ([Poly(x**2 - 2*x + 2, x), Poly(1, x)], Matrix([[1, 0, -1, 0], [0, 1, 0, -1]])) assert prde_no_cancel_b_large(Poly(1, x), [Poly(x**3, x), Poly(1, x)], 3, DE) == \ ([Poly(x**3 - 3*x**2 + 6*x - 6, x), Poly(1, x)], Matrix([[1, 0, -1, 0], [0, 1, 0, -1]])) assert prde_no_cancel_b_large(Poly(x, x), [Poly(x**2, x), Poly(1, x)], 1, DE) == \ ([Poly(x, x, domain='ZZ'), Poly(0, x, domain='ZZ')], Matrix([[1, -1, 0, 0], [1, 0, -1, 0], [0, 1, 0, -1]])) # b small # XXX: Is there a better example of a monomial with D.degree() > 2? DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t**3 + 1, t)]}) # My original q was t**4 + t + 1, but this solution implies q == t**4 # (c1 = 4), with some of the ci for the original q equal to 0. G = [Poly(t**6, t), Poly(x*t**5, t), Poly(t**3, t), Poly(x*t**2, t), Poly(1 + x, t)] assert prde_no_cancel_b_small(Poly(x*t, t), G, 4, DE) == \ ([Poly(t**4/4 - x/12*t**3 + x**2/24*t**2 + (Rational(-11, 12) - x**3/24)*t + x/24, t), Poly(x/3*t**3 - x**2/6*t**2 + (Rational(-1, 3) + x**3/6)*t - x/6, t), Poly(t, t), Poly(0, t), Poly(0, t)], Matrix([[1, 0, -1, 0, 0, 0, 0, 0, 0, 0], [0, 1, Rational(-1, 4), 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, -1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, -1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, -1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, -1]])) # TODO: Add test for deg(b) <= 0 with b small DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1 + t**2, t)]}) b = Poly(-1/x**2, t, field=True) # deg(b) == 0 q = [Poly(x**i*t**j, t, field=True) for i in range(2) for j in range(3)] h, A = prde_no_cancel_b_small(b, q, 3, DE) V = A.nullspace() assert len(V) == 1 assert V[0] == Matrix([Rational(-1, 2), 0, 0, 1, 0, 0]*3) assert (Matrix([h])*V[0][6:, :])[0] == Poly(x**2/2, t, domain='ZZ(x)') assert (Matrix([q])*V[0][:6, :])[0] == Poly(x - S.Half, t, domain='QQ(x)') def test_prde_cancel_liouvillian(): ### 1. case == 'primitive' # used when integrating f = log(x) - log(x - 1) # Not taken from 'the' book DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) p0 = Poly(0, t, field=True) h, A = prde_cancel_liouvillian(Poly(-1/(x - 1), t), [Poly(-x + 1, t), Poly(1, t)], 1, DE) V = A.nullspace() h == [p0, p0, Poly((x - 1)*t, t), p0, p0, p0, p0, p0, p0, p0, Poly(x - 1, t), Poly(-x**2 + x, t), p0, p0, p0, p0] assert A.rank() == 16 assert (Matrix([h])*V[0][:16, :]) == Matrix([[Poly(0, t, domain='QQ(x)')]]) ### 2. case == 'exp' # used when integrating log(x/exp(x) + 1) # Not taken from book DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(-t, t)]}) assert prde_cancel_liouvillian(Poly(0, t, domain='QQ[x]'), [Poly(1, t, domain='QQ(x)')], 0, DE) == \ ([Poly(1, t, domain='QQ'), Poly(x, t, domain='ZZ(x)')], Matrix([[-1, 0, 1]])) def test_param_poly_rischDE(): DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) a = Poly(x**2 - x, x, field=True) b = Poly(1, x, field=True) q = [Poly(x, x, field=True), Poly(x**2, x, field=True)] h, A = param_poly_rischDE(a, b, q, 3, DE) assert A.nullspace() == [Matrix([0, 1, 1, 1])] # c1, c2, d1, d2 # Solution of a*Dp + b*p = c1*q1 + c2*q2 = q2 = x**2 # is d1*h1 + d2*h2 = h1 + h2 = x. assert h[0] + h[1] == Poly(x, x, domain='QQ') # a*Dp + b*p = q1 = x has no solution. a = Poly(x**2 - x, x, field=True) b = Poly(x**2 - 5*x + 3, x, field=True) q = [Poly(1, x, field=True), Poly(x, x, field=True), Poly(x**2, x, field=True)] h, A = param_poly_rischDE(a, b, q, 3, DE) assert A.nullspace() == [Matrix([3, -5, 1, -5, 1, 1])] p = -Poly(5, DE.t)*h[0] + h[1] + h[2] # Poly(1, x) assert a*derivation(p, DE) + b*p == Poly(x**2 - 5*x + 3, x, domain='QQ') def test_param_rischDE(): DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) p1, px = Poly(1, x, field=True), Poly(x, x, field=True) G = [(p1, px), (p1, p1), (px, p1)] # [1/x, 1, x] h, A = param_rischDE(-p1, Poly(x**2, x, field=True), G, DE) assert len(h) == 3 p = [hi[0].as_expr()/hi[1].as_expr() for hi in h] V = A.nullspace() assert len(V) == 2 assert V[0] == Matrix([-1, 1, 0, -1, 1, 0]) y = -p[0] + p[1] + 0*p[2] # x assert y.diff(x) - y/x**2 == 1 - 1/x # Dy + f*y == -G0 + G1 + 0*G2 # the below test computation takes place while computing the integral # of 'f = log(log(x + exp(x)))' DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t, t)]}) G = [(Poly(t + x, t, domain='ZZ(x)'), Poly(1, t, domain='QQ')), (Poly(0, t, domain='QQ'), Poly(1, t, domain='QQ'))] h, A = param_rischDE(Poly(-t - 1, t, field=True), Poly(t + x, t, field=True), G, DE) assert len(h) == 5 p = [hi[0].as_expr()/hi[1].as_expr() for hi in h] V = A.nullspace() assert len(V) == 3 assert V[0] == Matrix([0, 0, 0, 0, 1, 0, 0]) y = 0*p[0] + 0*p[1] + 1*p[2] + 0*p[3] + 0*p[4] assert y.diff(t) - y/(t + x) == 0 # Dy + f*y = 0*G0 + 0*G1 def test_limited_integrate_reduce(): DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) assert limited_integrate_reduce(Poly(x, t), Poly(t**2, t), [(Poly(x, t), Poly(t, t))], DE) == \ (Poly(t, t), Poly(-1/x, t), Poly(t, t), 1, (Poly(x, t), Poly(1, t, domain='ZZ[x]')), [(Poly(-x*t, t), Poly(1, t, domain='ZZ[x]'))]) def test_limited_integrate(): DE = DifferentialExtension(extension={'D': [Poly(1, x)]}) G = [(Poly(x, x), Poly(x + 1, x))] assert limited_integrate(Poly(-(1 + x + 5*x**2 - 3*x**3), x), Poly(1 - x - x**2 + x**3, x), G, DE) == \ ((Poly(x**2 - x + 2, x), Poly(x - 1, x, domain='QQ')), [2]) G = [(Poly(1, x), Poly(x, x))] assert limited_integrate(Poly(5*x**2, x), Poly(3, x), G, DE) == \ ((Poly(5*x**3/9, x), Poly(1, x, domain='QQ')), [0]) def test_is_log_deriv_k_t_radical(): DE = DifferentialExtension(extension={'D': [Poly(1, x)], 'exts': [None], 'extargs': [None]}) assert is_log_deriv_k_t_radical(Poly(2*x, x), Poly(1, x), DE) is None DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(2*t1, t1), Poly(1/x, t2)], 'exts': [None, 'exp', 'log'], 'extargs': [None, 2*x, x]}) assert is_log_deriv_k_t_radical(Poly(x + t2/2, t2), Poly(1, t2), DE) == \ ([(t1, 1), (x, 1)], t1*x, 2, 0) # TODO: Add more tests DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(t0, t0), Poly(1/x, t)], 'exts': [None, 'exp', 'log'], 'extargs': [None, x, x]}) assert is_log_deriv_k_t_radical(Poly(x + t/2 + 3, t), Poly(1, t), DE) == \ ([(t0, 2), (x, 1)], x*t0**2, 2, 3) def test_is_deriv_k(): DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t1), Poly(1/(x + 1), t2)], 'exts': [None, 'log', 'log'], 'extargs': [None, x, x + 1]}) assert is_deriv_k(Poly(2*x**2 + 2*x, t2), Poly(1, t2), DE) == \ ([(t1, 1), (t2, 1)], t1 + t2, 2) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t1), Poly(t2, t2)], 'exts': [None, 'log', 'exp'], 'extargs': [None, x, x]}) assert is_deriv_k(Poly(x**2*t2**3, t2), Poly(1, t2), DE) == \ ([(x, 3), (t1, 2)], 2*t1 + 3*x, 1) # TODO: Add more tests, including ones with exponentials DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(2/x, t1)], 'exts': [None, 'log'], 'extargs': [None, x**2]}) assert is_deriv_k(Poly(x, t1), Poly(1, t1), DE) == \ ([(t1, S.Half)], t1/2, 1) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(2/(1 + x), t0)], 'exts': [None, 'log'], 'extargs': [None, x**2 + 2*x + 1]}) assert is_deriv_k(Poly(1 + x, t0), Poly(1, t0), DE) == \ ([(t0, S.Half)], t0/2, 1) # Issue 10798 # DE = DifferentialExtension(log(1/x), x) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(-1/x, t)], 'exts': [None, 'log'], 'extargs': [None, 1/x]}) assert is_deriv_k(Poly(1, t), Poly(x, t), DE) == ([(t, 1)], t, 1) def test_is_log_deriv_k_t_radical_in_field(): # NOTE: any potential constant factor in the second element of the result # doesn't matter, because it cancels in Da/a. DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) assert is_log_deriv_k_t_radical_in_field(Poly(5*t + 1, t), Poly(2*t*x, t), DE) == \ (2, t*x**5) assert is_log_deriv_k_t_radical_in_field(Poly(2 + 3*t, t), Poly(5*x*t, t), DE) == \ (5, x**3*t**2) DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(-t/x**2, t)]}) assert is_log_deriv_k_t_radical_in_field(Poly(-(1 + 2*t), t), Poly(2*x**2 + 2*x**2*t, t), DE) == \ (2, t + t**2) assert is_log_deriv_k_t_radical_in_field(Poly(-1, t), Poly(x**2, t), DE) == \ (1, t) assert is_log_deriv_k_t_radical_in_field(Poly(1, t), Poly(2*x**2, t), DE) == \ (2, 1/t) def test_parametric_log_deriv(): DE = DifferentialExtension(extension={'D': [Poly(1, x), Poly(1/x, t)]}) assert parametric_log_deriv_heu(Poly(5*t**2 + t - 6, t), Poly(2*x*t**2, t), Poly(-1, t), Poly(x*t**2, t), DE) == \ (2, 6, t*x**5)
3a5cfcfe1b8702485cca390c51fbee80af2b89c5272d05a25f20fae05fa43607
""" Parser for FullForm[Downvalues[]] of Mathematica rules. This parser is customised to parse the output in MatchPy rules format. Multiple `Constraints` are divided into individual `Constraints` because it helps the MatchPy's `ManyToOneReplacer` to backtrack earlier and improve the speed. Parsed output is formatted into readable format by using `sympify` and print the expression using `sstr`. This replaces `And`, `Mul`, 'Pow' by their respective symbols. Mathematica =========== To get the full form from Wolfram Mathematica, type: ``` ShowSteps = False Import["RubiLoader.m"] Export["output.txt", ToString@FullForm@DownValues@Int] ``` The file ``output.txt`` will then contain the rules in parseable format. References ========== [1] http://reference.wolfram.com/language/ref/FullForm.html [2] http://reference.wolfram.com/language/ref/DownValues.html [3] https://gist.github.com/Upabjojr/bc07c49262944f9c1eb0 """ import re import os import inspect from sympy import sympify, Function, Set, Symbol from sympy.printing import StrPrinter from sympy.utilities.misc import debug class RubiStrPrinter(StrPrinter): def _print_Not(self, expr): return "Not(%s)" % self._print(expr.args[0]) def rubi_printer(expr, **settings): return RubiStrPrinter(settings).doprint(expr) replacements = dict( # Mathematica equivalent functions in SymPy Times="Mul", Plus="Add", Power="Pow", Log='log', Exp='exp', Sqrt='sqrt', Cos='cos', Sin='sin', Tan='tan', Cot='1/tan', cot='1/tan', Sec='1/cos', sec='1/cos', Csc='1/sin', csc='1/sin', ArcSin='asin', ArcCos='acos', # ArcTan='atan', ArcCot='acot', ArcSec='asec', ArcCsc='acsc', Sinh='sinh', Cosh='cosh', Tanh='tanh', Coth='1/tanh', coth='1/tanh', Sech='1/cosh', sech='1/cosh', Csch='1/sinh', csch='1/sinh', ArcSinh='asinh', ArcCosh='acosh', ArcTanh='atanh', ArcCoth='acoth', ArcSech='asech', ArcCsch='acsch', Expand='expand', Im='im', Re='re', Flatten='flatten', Polylog='polylog', Cancel='cancel', #Gamma='gamma', TrigExpand='expand_trig', Sign='sign', Simplify='simplify', Defer='UnevaluatedExpr', Identity = 'S', Sum = 'Sum_doit', Module = 'With', Block = 'With', Null = 'None' ) temporary_variable_replacement = { # Temporarily rename because it can raise errors while sympifying 'gcd' : "_gcd", 'jn' : "_jn", } permanent_variable_replacement = { # Permamenely rename these variables r"\[ImaginaryI]" : 'ImaginaryI', "$UseGamma": '_UseGamma', } # These functions have different return type in different cases. So better to use a try and except in the constraints, when any of these appear f_diff_return_type = ['BinomialParts', 'BinomialDegree', 'TrinomialParts', 'GeneralizedBinomialParts', 'GeneralizedTrinomialParts', 'PseudoBinomialParts', 'PerfectPowerTest', 'SquareFreeFactorTest', 'SubstForFractionalPowerOfQuotientOfLinears', 'FractionalPowerOfQuotientOfLinears', 'InverseFunctionOfQuotientOfLinears', 'FractionalPowerOfSquareQ', 'FunctionOfLinear', 'FunctionOfInverseLinear', 'FunctionOfTrig', 'FindTrigFactor', 'FunctionOfLog', 'PowerVariableExpn', 'FunctionOfSquareRootOfQuadratic', 'SubstForFractionalPowerOfLinear', 'FractionalPowerOfLinear', 'InverseFunctionOfLinear', 'Divides', 'DerivativeDivides', 'TrigSquare', 'SplitProduct', 'SubstForFractionalPowerOfQuotientOfLinears', 'InverseFunctionOfQuotientOfLinears', 'FunctionOfHyperbolic', 'SplitSum'] def contains_diff_return_type(a): """ This function returns whether an expression contains functions which have different return types in diiferent cases. """ if isinstance(a, list): for i in a: if contains_diff_return_type(i): return True elif type(a) == Function('With') or type(a) == Function('Module'): for i in f_diff_return_type: if a.has(Function(i)): return True else: if a in f_diff_return_type: return True return False def parse_full_form(wmexpr): """ Parses FullForm[Downvalues[]] generated by Mathematica """ out = [] stack = [out] generator = re.finditer(r'[\[\],]', wmexpr) last_pos = 0 for match in generator: if match is None: break position = match.start() last_expr = wmexpr[last_pos:position].replace(',', '').replace(']', '').replace('[', '').strip() if match.group() == ',': if last_expr != '': stack[-1].append(last_expr) elif match.group() == ']': if last_expr != '': stack[-1].append(last_expr) stack.pop() current_pos = stack[-1] elif match.group() == '[': stack[-1].append([last_expr]) stack.append(stack[-1][-1]) last_pos = match.end() return out[0] def get_default_values(parsed, default_values={}): """ Returns Optional variables and their values in the pattern """ if not isinstance(parsed, list): return default_values if parsed[0] == "Times": # find Default arguments for "Times" for i in parsed[1:]: if i[0] == "Optional": default_values[(i[1][1])] = 1 if parsed[0] == "Plus": # find Default arguments for "Plus" for i in parsed[1:]: if i[0] == "Optional": default_values[(i[1][1])] = 0 if parsed[0] == "Power": # find Default arguments for "Power" for i in parsed[1:]: if i[0] == "Optional": default_values[(i[1][1])] = 1 if len(parsed) == 1: return default_values for i in parsed: default_values = get_default_values(i, default_values) return default_values def add_wildcards(string, optional={}): """ Replaces `Pattern(variable)` by `variable` in `string`. Returns the free symbols present in the string. """ symbols = [] # stores symbols present in the expression p = r'(Optional\(Pattern\((\w+), Blank\)\))' matches = re.findall(p, string) for i in matches: string = string.replace(i[0], "WC('{}', S({}))".format(i[1], optional[i[1]])) symbols.append(i[1]) p = r'(Pattern\((\w+), Blank\))' matches = re.findall(p, string) for i in matches: string = string.replace(i[0], i[1] + '_') symbols.append(i[1]) p = r'(Pattern\((\w+), Blank\(Symbol\)\))' matches = re.findall(p, string) for i in matches: string = string.replace(i[0], i[1] + '_') symbols.append(i[1]) return string, symbols def seperate_freeq(s, variables=[], x=None): """ Returns list of symbols in FreeQ. """ if s[0] == 'FreeQ': if len(s[1]) == 1: variables = [s[1]] else: variables = s[1][1:] x = s[2] else: for i in s[1:]: variables, x = seperate_freeq(i, variables, x) return variables, x return variables, x def parse_freeq(l, x, cons_index, cons_dict, cons_import, symbols=None): """ Converts FreeQ constraints into MatchPy constraint """ res = [] cons = '' for i in l: if isinstance(i, str): r = ' return FreeQ({}, {})'.format(i, x) # First it checks if a constraint is already present in `cons_dict`, If yes, use it else create a new one. if r not in cons_dict.values(): cons_index += 1 c = '\n def cons_f{}({}, {}):\n'.format(cons_index, i, x) c += r c += '\n\n cons{} = CustomConstraint({})\n'.format(cons_index, 'cons_f{}'.format(cons_index)) cons_name = 'cons{}'.format(cons_index) cons_dict[cons_name] = r else: c = '' cons_name = next(key for key, value in sorted(cons_dict.items()) if value == r) elif isinstance(i, list): s = sorted(set(get_free_symbols(i, symbols))) s = ', '.join(s) r = ' return FreeQ({}, {})'.format(generate_sympy_from_parsed(i), x) if r not in cons_dict.values(): cons_index += 1 c = '\n def cons_f{}({}):\n'.format(cons_index, s) c += r c += '\n\n cons{} = CustomConstraint({})\n'.format(cons_index, 'cons_f{}'.format(cons_index)) cons_name = 'cons{}'.format(cons_index) cons_dict[cons_name] = r else: c = '' cons_name = next(key for key, value in cons_dict.items() if value == r) if cons_name not in cons_import: cons_import.append(cons_name) res.append(cons_name) cons += c if res != []: return ', ' + ', '.join(res), cons, cons_index return '', cons, cons_index def generate_sympy_from_parsed(parsed, wild=False, symbols=[], replace_Int=False): """ Parses list into Python syntax. Parameters ========== wild : When set to True, the symbols are replaced as wild symbols. symbols : Symbols already present in the pattern. replace_Int: when set to True, `Int` is replaced by `Integral`(used to parse pattern). """ out = "" if not isinstance(parsed, list): try: # return S(number) if parsed is Number float(parsed) return "S({})".format(parsed) except: pass if parsed in symbols: if wild: return parsed + '_' return parsed if parsed[0] == 'Rational': return 'S({})/S({})'.format(generate_sympy_from_parsed(parsed[1], wild=wild, symbols=symbols, replace_Int=replace_Int), generate_sympy_from_parsed(parsed[2], wild=wild, symbols=symbols, replace_Int=replace_Int)) if parsed[0] in replacements: out += replacements[parsed[0]] elif parsed[0] == 'Int' and replace_Int: out += 'Integral' else: out += parsed[0] if len(parsed) == 1: return out result = [generate_sympy_from_parsed(i, wild=wild, symbols=symbols, replace_Int=replace_Int) for i in parsed[1:]] if '' in result: result.remove('') out += "(" out += ", ".join(result) out += ")" return out def get_free_symbols(s, symbols, free_symbols=None): """ Returns free_symbols present in `s`. """ free_symbols = free_symbols or [] if not isinstance(s, list): if s in symbols: free_symbols.append(s) return free_symbols for i in s: free_symbols = get_free_symbols(i, symbols, free_symbols) return free_symbols def set_matchq_in_constraint(a, cons_index): """ Takes care of the case, when a pattern matching has to be done inside a constraint. """ lst = [] res = '' if isinstance(a, list): if a[0] == 'MatchQ': s = a optional = get_default_values(s, {}) r = generate_sympy_from_parsed(s, replace_Int=True) r, free_symbols = add_wildcards(r, optional=optional) free_symbols = sorted(set(free_symbols)) # remove common symbols r = sympify(r, locals={"Or": Function("Or"), "And": Function("And"), "Not":Function("Not")}) pattern = r.args[1].args[0] cons = r.args[1].args[1] pattern = rubi_printer(pattern, sympy_integers=True) pattern = setWC(pattern) res = ' def _cons_f_{}({}):\n return {}\n'.format(cons_index, ', '.join(free_symbols), cons) res += ' _cons_{} = CustomConstraint(_cons_f_{})\n'.format(cons_index, cons_index) res += ' pat = Pattern(UtilityOperator({}, x), _cons_{})\n'.format(pattern, cons_index) res += ' result_matchq = is_match(UtilityOperator({}, x), pat)'.format(r.args[0]) return "result_matchq", res else: for i in a: if isinstance(i, list): r = set_matchq_in_constraint(i, cons_index) lst.append(r[0]) res = r[1] else: lst.append(i) return lst, res def _divide_constriant(s, symbols, cons_index, cons_dict, cons_import): # Creates a CustomConstraint of the form `CustomConstraint(lambda a, x: FreeQ(a, x))` lambda_symbols = sorted(set(get_free_symbols(s, symbols, []))) r = generate_sympy_from_parsed(s) r = sympify(r, locals={"Or": Function("Or"), "And": Function("And"), "Not":Function("Not")}) if r.has(Function('MatchQ')): match_res = set_matchq_in_constraint(s, cons_index) res = match_res[1] res += '\n return {}'.format(rubi_printer(sympify(generate_sympy_from_parsed(match_res[0]), locals={"Or": Function("Or"), "And": Function("And"), "Not":Function("Not")}), sympy_integers = True)) elif contains_diff_return_type(s): res = ' try:\n return {}\n except (TypeError, AttributeError):\n return False'.format(rubi_printer(r, sympy_integers=True)) else: res = ' return {}'.format(rubi_printer(r, sympy_integers=True)) # First it checks if a constraint is already present in `cons_dict`, If yes, use it else create a new one. if not res in cons_dict.values(): cons_index += 1 cons = '\n def cons_f{}({}):\n'.format(cons_index, ', '.join(lambda_symbols)) if 'x' in lambda_symbols: cons += ' if isinstance(x, (int, Integer, float, Float)):\n return False\n' cons += res cons += '\n\n cons{} = CustomConstraint({})\n'.format(cons_index, 'cons_f{}'.format(cons_index)) cons_name = 'cons{}'.format(cons_index) cons_dict[cons_name] = res else: cons = '' cons_name = next(key for key, value in cons_dict.items() if value == res) if cons_name not in cons_import: cons_import.append(cons_name) return cons_name, cons, cons_index def divide_constraint(s, symbols, cons_index, cons_dict, cons_import): """ Divides multiple constraints into smaller constraints. Parameters ========== s : constraint as list symbols : all the symbols present in the expression """ result =[] cons = '' if s[0] == 'And': for i in s[1:]: if i[0]!= 'FreeQ': a = _divide_constriant(i, symbols, cons_index, cons_dict, cons_import) result.append(a[0]) cons += a[1] cons_index = a[2] else: a = _divide_constriant(s, symbols, cons_index, cons_dict, cons_import) result.append(a[0]) cons += a[1] cons_index = a[2] r = [''] for i in result: if i != '': r.append(i) return ', '.join(r),cons, cons_index def setWC(string): """ Replaces `WC(a, b)` by `WC('a', S(b))` """ p = r'(WC\((\w+), S\(([-+]?\d)\)\))' matches = re.findall(p, string) for i in matches: string = string.replace(i[0], "WC('{}', S({}))".format(i[1], i[2])) return string def process_return_type(a1, L): """ Functions like `Set`, `With` and `CompoundExpression` has to be taken special care. """ a = sympify(a1[1]) x = '' processed = False return_value = '' if type(a) == Function('With') or type(a) == Function('Module'): for i in a.args: for s in i.args: if isinstance(s, Set) and not s in L: x += '\n {} = {}'.format(s.args[0], rubi_printer(s.args[1], sympy_integers=True)) if not type(i) in (Function('List'), Function('CompoundExpression')) and not i.has(Function('CompoundExpression')): return_value = i processed = True elif type(i) == Function('CompoundExpression'): return_value = i.args[-1] processed = True elif type(i.args[0]) == Function('CompoundExpression'): C = i.args[0] return_value = '{}({}, {})'.format(i.func, C.args[-1], i.args[1]) processed = True return x, return_value, processed def extract_set(s, L): """ this function extracts all `Set` functions """ lst = [] if isinstance(s, Set) and not s in L: lst.append(s) else: try: for i in s.args: lst += extract_set(i, L) except: # when s has no attribute args (like `bool`) pass return lst def replaceWith(s, symbols, index): """ Replaces `With` and `Module by python functions` """ return_type = None with_value = '' if type(s) == Function('With') or type(s) == Function('Module'): constraints = ' ' result = '\n\n\ndef With{}({}):'.format(index, ', '.join(symbols)) if type(s.args[0]) == Function('List'): # get all local variables of With and Module L = list(s.args[0].args) else: L = [s.args[0]] lst = [] for i in s.args[1:]: lst += extract_set(i, L) L += lst for i in L: # define local variables if isinstance(i, Set): with_value += '\n {} = {}'.format(i.args[0], rubi_printer(i.args[1], sympy_integers=True)) elif isinstance(i, Symbol): with_value += "\n {} = Symbol('{}')".format(i, i) #result += with_value if type(s.args[1]) == Function('CompoundExpression'): # Expand CompoundExpression C = s.args[1] result += with_value if isinstance(C.args[0], Set): result += '\n {} = {}'.format(C.args[0].args[0], C.args[0].args[1]) result += '\n return {}'.format(rubi_printer(C.args[1], sympy_integers=True)) return result, constraints, return_type elif type(s.args[1]) == Function('Condition'): C = s.args[1] if len(C.args) == 2: if all(j in symbols for j in [str(i) for i in C.free_symbols]): result += with_value #constraints += 'CustomConstraint(lambda {}: {})'.format(', '.join([str(i) for i in C.free_symbols]), sstr(C.args[1], sympy_integers=True)) result += '\n return {}'.format(rubi_printer(C.args[0], sympy_integers=True)) else: if 'x' in symbols: result += '\n if isinstance(x, (int, Integer, float, Float)):\n return False' if contains_diff_return_type(s): n_with_value = with_value.replace('\n', '\n ') result += '\n try:{}\n res = {}'.format(n_with_value, rubi_printer(C.args[1], sympy_integers=True)) result += '\n except (TypeError, AttributeError):\n return False' result += '\n if res:' else: result+=with_value result += '\n if {}:'.format(rubi_printer(C.args[1], sympy_integers=True)) return_type = (with_value, rubi_printer(C.args[0], sympy_integers=True)) return_type1 = process_return_type(return_type, L) if return_type1[2]: return_type = (with_value+return_type1[0], rubi_printer(return_type1[1])) result += '\n return True' result += '\n return False' constraints = ', CustomConstraint(With{})'.format(index) return result, constraints, return_type elif type(s.args[1]) == Function('Module') or type(s.args[1]) == Function('With'): C = s.args[1] result += with_value return_type = (with_value, rubi_printer(C, sympy_integers=True)) return_type1 = process_return_type(return_type, L) if return_type1[2]: return_type = (with_value+return_type1[0], rubi_printer(return_type1[1])) result += return_type1[0] result += '\n return {}'.format(rubi_printer(return_type1[1])) return result, constraints, None elif s.args[1].has(Function("CompoundExpression")): C = s.args[1].args[0] result += with_value if isinstance(C.args[0], Set): result += '\n {} = {}'.format(C.args[0].args[0], C.args[0].args[1]) result += '\n return {}({}, {})'.format(s.args[1].func, C.args[-1], s.args[1].args[1]) return result, constraints, None result += with_value result += '\n return {}'.format(rubi_printer(s.args[1], sympy_integers=True)) return result, constraints, return_type else: return rubi_printer(s, sympy_integers=True), '', return_type def downvalues_rules(r, header, cons_dict, cons_index, index): """ Function which generates parsed rules by substituting all possible combinations of default values. """ rules = '[' parsed = '\n\n' repl_funcs = '\n\n' cons = '' cons_import = [] # it contains name of constraints that need to be imported for rules. for i in r: debug('parsing rule {}'.format(r.index(i) + 1)) # Parse Pattern if i[1][1][0] == 'Condition': p = i[1][1][1].copy() else: p = i[1][1].copy() optional = get_default_values(p, {}) pattern = generate_sympy_from_parsed(p.copy(), replace_Int=True) pattern, free_symbols = add_wildcards(pattern, optional=optional) free_symbols = sorted(set(free_symbols)) #remove common symbols # Parse Transformed Expression and Constraints if i[2][0] == 'Condition': # parse rules without constraints separately constriant, constraint_def, cons_index = divide_constraint(i[2][2], free_symbols, cons_index, cons_dict, cons_import) # separate And constraints into individual constraints FreeQ_vars, FreeQ_x = seperate_freeq(i[2][2].copy()) # separate FreeQ into individual constraints transformed = generate_sympy_from_parsed(i[2][1].copy(), symbols=free_symbols) else: constriant = '' constraint_def = '' FreeQ_vars, FreeQ_x = [], [] transformed = generate_sympy_from_parsed(i[2].copy(), symbols=free_symbols) FreeQ_constraint, free_cons_def, cons_index = parse_freeq(FreeQ_vars, FreeQ_x, cons_index, cons_dict, cons_import, free_symbols) pattern = sympify(pattern, locals={"Or": Function("Or"), "And": Function("And"), "Not":Function("Not") }) pattern = rubi_printer(pattern, sympy_integers=True) pattern = setWC(pattern) transformed = sympify(transformed, locals={"Or": Function("Or"), "And": Function("And"), "Not":Function("Not") }) constraint_def = constraint_def + free_cons_def cons += constraint_def index += 1 # below are certain if - else condition depending on various situation that may be encountered if type(transformed) == Function('With') or type(transformed) == Function('Module'): # define separate function when With appears transformed, With_constraints, return_type = replaceWith(transformed, free_symbols, index) if return_type is None: repl_funcs += '{}'.format(transformed) parsed += '\n pattern' + str(index) + ' = Pattern(' + pattern + '' + FreeQ_constraint + '' + constriant + ')' parsed += '\n ' + 'rule' + str(index) + ' = ReplacementRule(' + 'pattern' + rubi_printer(index, sympy_integers=True) + ', With{}'.format(index) + ')\n' else: repl_funcs += '{}'.format(transformed) parsed += '\n pattern' + str(index) + ' = Pattern(' + pattern + '' + FreeQ_constraint + '' + constriant + With_constraints + ')' repl_funcs += '\n\n\ndef replacement{}({}):\n'.format( index, ', '.join(free_symbols) ) + return_type[0] + '\n return '.format(index) + return_type[1] parsed += '\n ' + 'rule' + str(index) + ' = ReplacementRule(' + 'pattern' + rubi_printer(index, sympy_integers=True) + ', replacement{}'.format(index) + ')\n' else: transformed = rubi_printer(transformed, sympy_integers=True) parsed += '\n pattern' + str(index) + ' = Pattern(' + pattern + '' + FreeQ_constraint + '' + constriant + ')' repl_funcs += '\n\n\ndef replacement{}({}):\n return '.format(index, ', '.join(free_symbols), index) + transformed parsed += '\n ' + 'rule' + str(index) + ' = ReplacementRule(' + 'pattern' + rubi_printer(index, sympy_integers=True) + ', replacement{}'.format(index) + ')\n' rules += 'rule{}, '.format(index) rules += ']' parsed += ' return ' + rules +'\n' header += ' from sympy.integrals.rubi.constraints import ' + ', '.join(word for word in cons_import) parsed = header + parsed + repl_funcs return parsed, cons_index, cons, index def rubi_rule_parser(fullform, header=None, module_name='rubi_object'): """ Parses rules in MatchPy format. Parameters ========== fullform : FullForm of the rule as string. header : Header imports for the file. Uses default imports if None. module_name : name of RUBI module References ========== [1] http://reference.wolfram.com/language/ref/FullForm.html [2] http://reference.wolfram.com/language/ref/DownValues.html [3] https://gist.github.com/Upabjojr/bc07c49262944f9c1eb0 """ if header is None: # use default header values path_header = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) header = open(os.path.join(path_header, "header.py.txt"), "r").read() header = header.format(module_name) cons_dict = {} # dict keeps track of constraints that has been encountered, thus avoids repetition of constraints. cons_index = 0 # for index of a constraint index = 0 # indicates the number of a rule. cons = '' # Temporarily rename these variables because it # can raise errors while sympifying for i in temporary_variable_replacement: fullform = fullform.replace(i, temporary_variable_replacement[i]) # Permanently rename these variables for i in permanent_variable_replacement: fullform = fullform.replace(i, permanent_variable_replacement[i]) rules = [] for i in parse_full_form(fullform): # separate all rules if i[0] == 'RuleDelayed': rules.append(i) parsed = downvalues_rules(rules, header, cons_dict, cons_index, index) result = parsed[0].strip() + '\n' cons_index = parsed[1] cons += parsed[2] index = parsed[3] # Replace temporary variables by actual values for i in temporary_variable_replacement: cons = cons.replace(temporary_variable_replacement[i], i) result = result.replace(temporary_variable_replacement[i], i) cons = "\n".join(header.split("\n")[:-2]) + '\n' + cons return result, cons
66cb287371ae9d8fc6c5b276f237d4d3fb0584a45a850d5a9d0043ee55e123f2
import sys from sympy.external import import_module from sympy.integrals.rubi.rubimain import LoadRubiReplacer matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.core.symbol import symbols, Symbol from sympy.functions import log from sympy import (sqrt, simplify, S, atanh, hyper, I, atan, pi, Sum, cos, sin, log, atan) from sympy.integrals.rubi.utility_function import rubi_test from sympy.testing.pytest import SKIP a, b, c, d, e, f, x, m, n, p, k = symbols('a b c d e f x m n p k', real=True, imaginary=False) @SKIP def test_rubi_integrate(): from sympy.integrals.rubi.rubimain import rubi_integrate assert rubi_integrate(x, x) == x**2/2 assert rubi_integrate(x**2, x) == x**3/3 assert rubi_integrate(x**3, x) == x**4/4 assert rubi_integrate(x**a, x) == x**(a + S(1))/(a + S(1)) assert rubi_integrate(S(1)/x, x) == log(x) assert rubi_integrate(a*x, x) == a*(S(1)/S(2))*x**S(2) assert rubi_integrate(1/(x**2*(a + b*x)**2), x) == -b/(a**2*(a + b*x)) - 1/(a**2*x) - 2*b*log(x)/a**3 + 2*b*log(a + b*x)/a**3 assert rubi_integrate(x**6/(a + b*x)**2, x) == (-a**6/(b**7*(a + b*x)) - S(6)*a**5*log(a + b*x)/b**7 + 5*a**4*x/b**6 - S(2)*a**3*x**2/b**5 + a**2*x**3/b**4 - a*x**4/(S(2)*b**3) + x**5/(S(5)*b**2)) assert rubi_integrate(1/(x**2*(a + b*x)**2), x) == -b/(a**2*(a + b*x)) - 1/(a**2*x) - 2*b*log(x)/a**3 + 2*b*log(a + b*x)/a**3 assert rubi_integrate(a + S(1)/x, x) == a*x + log(x) assert rubi_integrate((a + b*x)**2/x**3, x) == -a**2/(2*x**2) - 2*a*b/x + b**2*log(x) assert rubi_integrate(a**3*x, x) == S(1)/S(2)*a**3*x**2 assert rubi_integrate((a + b*x)**3/x**3, x) == -a**3/(2*x**2) - 3*a**2*b/x + 3*a*b**2*log(x) + b**3*x assert rubi_integrate(x**3*(a + b*x), x) == a*x**4/4 + b*x**5/5 assert rubi_integrate((b*x)**m*(d*x + 2)**n, x) == 2**n*(b*x)**(m + 1)*hyper((-n, m + 1), (m + 2,), -d*x/2)/(b*(m + 1)) assert rubi_test(rubi_integrate(1/(1 + x**5), x), x, log(x + S(1))/S(5) + S(2)*Sum(-log((S(2)*x - S(2)*cos(pi*(S(2)*k/S(5) + S(-1)/5)))**S(2) - S(4)*sin(S(2)*pi*k/S(5) + S(3)*pi/S(10))**S(2) + S(4))*cos(pi*(S(2)*k/S(5) + S(-1)/5))/S(2) - (-S(2)*cos(pi*(S(2)*k/S(5) + S(-1)/5))**S(2) + S(2))*atan((-x/cos(pi*(S(2)*k/S(5) + S(-1)/5)) + S(1))/sqrt(-(cos(S(2)*pi*k/S(5) - pi/S(5)) + S(-1))*(cos(S(2)*pi*k/S(5) - pi/S(5)) + S(1))/cos(S(2)*pi*k/S(5) - pi/S(5))**S(2)))/(S(2)*sqrt(-(cos(S(2)*pi*k/S(5) - pi/S(5)) + S(-1))*(cos(S(2)*pi*k/S(5) - pi/S(5)) + S(1))/cos(S(2)*pi*k/S(5) - pi/S(5))**S(2))*cos(pi*(S(2)*k/S(5) + S(-1)/5))), (k, S(1), S(2)))/S(5), _numerical=True)
04198e12269a35838090c396b710ad5307608685d30e378617bdb8f2fa622ef4
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot, sinh, sech, atan, asin, acos, atanh, asinh, acosh from sympy import acsch as arccsch, acsc as arccsc from sympy.integrals.rubi.utility_function import (EllipticE, EllipticF, Int, ArcCsch, ArcCsc, Gamma, hypergeom, rubi_test, AppellF1, EllipticPi, Log, Sqrt, ArcTan, ArcTanh, ArcSin, ArcSinh, ArcCosh, ArcTanh, ArcCos, Hypergeometric2F1) from sympy import pi from sympy import S, hyper, I, simplify, exp_polar, symbols, Ei,erf, erfi,gamma,uppergamma, polylog, Integral, exp from sympy.testing.pytest import SKIP a, b, c, d, e, f, m, n, x, u , k, p, r, s, t= symbols('a b c d e f m n x u k p r s t') A, B, C, D, a, b, c, d, e, f, g, h, i, y, z, m, n, p, q, u, v, w, E, F, G, H = symbols('A B C D a b c d e f g h i y z m n p q u v w E F G H') def test_1(): assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-m)*(d + e*x)**m*Gamma(m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**S(4), x), x, F**(c*(a + b*x))*(d + e*x)**S(4)/(b*c*log(F)) - S(4)*F**(c*(a + b*x))*e*(d + e*x)**S(3)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(12)*F**(c*(a + b*x))*e**S(2)*(d + e*x)**S(2)/(b**S(3)*c**S(3)*log(F)**S(3)) - S(24)*F**(c*(a + b*x))*e**S(3)*(d + e*x)/(b**S(4)*c**S(4)*log(F)**S(4)) + S(24)*F**(c*(a + b*x))*e**S(4)/(b**S(5)*c**S(5)*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**S(3), x), x, F**(c*(a + b*x))*(d + e*x)**S(3)/(b*c*log(F)) - S(3)*F**(c*(a + b*x))*e*(d + e*x)**S(2)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(6)*F**(c*(a + b*x))*e**S(2)*(d + e*x)/(b**S(3)*c**S(3)*log(F)**S(3)) - S(6)*F**(c*(a + b*x))*e**S(3)/(b**S(4)*c**S(4)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**S(2), x), x, F**(c*(a + b*x))*(d + e*x)**S(2)/(b*c*log(F)) - S(2)*F**(c*(a + b*x))*e*(d + e*x)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(2)*F**(c*(a + b*x))*e**S(2)/(b**S(3)*c**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x), x), x, F**(c*(a + b*x))*(d + e*x)/(b*c*log(F)) - F**(c*(a + b*x))*e/(b**S(2)*c**S(2)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x)), x), x, F**(c*(a + b*x))/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x), x), x, F**(c*(a - b*d/e))*Ei(b*c*(d + e*x)*log(F)/e)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**S(2), x), x, -F**(c*(a + b*x))/(e*(d + e*x)) + F**(c*(a - b*d/e))*b*c*log(F)*Ei(b*c*(d + e*x)*log(F)/e)/e**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**S(3), x), x, -F**(c*(a + b*x))*b*c*log(F)/(S(2)*e**S(2)*(d + e*x)) - F**(c*(a + b*x))/(S(2)*e*(d + e*x)**S(2)) + F**(c*(a - b*d/e))*b**S(2)*c**S(2)*log(F)**S(2)*Ei(b*c*(d + e*x)*log(F)/e)/(S(2)*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**S(4), x), x, -F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(6)*e**S(3)*(d + e*x)) - F**(c*(a + b*x))*b*c*log(F)/(S(6)*e**S(2)*(d + e*x)**S(2)) - F**(c*(a + b*x))/(S(3)*e*(d + e*x)**S(3)) + F**(c*(a - b*d/e))*b**S(3)*c**S(3)*log(F)**S(3)*Ei(b*c*(d + e*x)*log(F)/e)/(S(6)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**S(5), x), x, -F**(c*(a + b*x))*b**S(3)*c**S(3)*log(F)**S(3)/(S(24)*e**S(4)*(d + e*x)) - F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(24)*e**S(3)*(d + e*x)**S(2)) - F**(c*(a + b*x))*b*c*log(F)/(S(12)*e**S(2)*(d + e*x)**S(3)) - F**(c*(a + b*x))/(S(4)*e*(d + e*x)**S(4)) + F**(c*(a - b*d/e))*b**S(4)*c**S(4)*log(F)**S(4)*Ei(b*c*(d + e*x)*log(F)/e)/(S(24)*e**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(4) + S(4)*d**S(3)*e*x + S(6)*d**S(2)*e**S(2)*x**S(2) + S(4)*d*e**S(3)*x**S(3) + e**S(4)*x**S(4)), x), x, F**(c*(a + b*x))*(d + e*x)**S(4)/(b*c*log(F)) - S(4)*F**(c*(a + b*x))*e*(d + e*x)**S(3)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(12)*F**(c*(a + b*x))*e**S(2)*(d + e*x)**S(2)/(b**S(3)*c**S(3)*log(F)**S(3)) - S(24)*F**(c*(a + b*x))*e**S(3)*(d + e*x)/(b**S(4)*c**S(4)*log(F)**S(4)) + S(24)*F**(c*(a + b*x))*e**S(4)/(b**S(5)*c**S(5)*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(3) + S(3)*d**S(2)*e*x + S(3)*d*e**S(2)*x**S(2) + e**S(3)*x**S(3)), x), x, F**(c*(a + b*x))*(d + e*x)**S(3)/(b*c*log(F)) - S(3)*F**(c*(a + b*x))*e*(d + e*x)**S(2)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(6)*F**(c*(a + b*x))*e**S(2)*(d + e*x)/(b**S(3)*c**S(3)*log(F)**S(3)) - S(6)*F**(c*(a + b*x))*e**S(3)/(b**S(4)*c**S(4)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(2) + S(2)*d*e*x + e**S(2)*x**S(2)), x), x, F**(c*(a + b*x))*(d + e*x)**S(2)/(b*c*log(F)) - S(2)*F**(c*(a + b*x))*e*(d + e*x)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(2)*F**(c*(a + b*x))*e**S(2)/(b**S(3)*c**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d**S(2) + S(2)*d*e*x + e**S(2)*x**S(2)), x), x, -F**(c*(a + b*x))/(e*(d + e*x)) + F**(c*(a - b*d/e))*b*c*log(F)*Ei(b*c*(d + e*x)*log(F)/e)/e**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d**S(3) + S(3)*d**S(2)*e*x + S(3)*d*e**S(2)*x**S(2) + e**S(3)*x**S(3)), x), x, -F**(c*(a + b*x))*b*c*log(F)/(S(2)*e**S(2)*(d + e*x)) - F**(c*(a + b*x))/(S(2)*e*(d + e*x)**S(2)) + F**(c*(a - b*d/e))*b**S(2)*c**S(2)*log(F)**S(2)*Ei(b*c*(d + e*x)*log(F)/e)/(S(2)*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d**S(4) + S(4)*d**S(3)*e*x + S(6)*d**S(2)*e**S(2)*x**S(2) + S(4)*d*e**S(3)*x**S(3) + e**S(4)*x**S(4)), x), x, -F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(6)*e**S(3)*(d + e*x)) - F**(c*(a + b*x))*b*c*log(F)/(S(6)*e**S(2)*(d + e*x)**S(2)) - F**(c*(a + b*x))/(S(3)*e*(d + e*x)**S(3)) + F**(c*(a - b*d/e))*b**S(3)*c**S(3)*log(F)**S(3)*Ei(b*c*(d + e*x)*log(F)/e)/(S(6)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d**S(5) + S(5)*d**S(4)*e*x + S(10)*d**S(3)*e**S(2)*x**S(2) + S(10)*d**S(2)*e**S(3)*x**S(3) + S(5)*d*e**S(4)*x**S(4) + e**S(5)*x**S(5)), x), x, -F**(c*(a + b*x))*b**S(3)*c**S(3)*log(F)**S(3)/(S(24)*e**S(4)*(d + e*x)) - F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(24)*e**S(3)*(d + e*x)**S(2)) - F**(c*(a + b*x))*b*c*log(F)/(S(12)*e**S(2)*(d + e*x)**S(3)) - F**(c*(a + b*x))/(S(4)*e*(d + e*x)**S(4)) + F**(c*(a - b*d/e))*b**S(4)*c**S(4)*log(F)**S(4)*Ei(b*c*(d + e*x)*log(F)/e)/(S(24)*e**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*((d + e*x)**n)**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-m*n)*((d + e*x)**n)**m*Gamma(m*n + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(4) + S(4)*d**S(3)*e*x + S(6)*d**S(2)*e**S(2)*x**S(2) + S(4)*d*e**S(3)*x**S(3) + e**S(4)*x**S(4))**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-S(4)*m)*((d + e*x)**S(4))**m*Gamma(S(4)*m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(3) + S(3)*d**S(2)*e*x + S(3)*d*e**S(2)*x**S(2) + e**S(3)*x**S(3))**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-S(3)*m)*((d + e*x)**S(3))**m*Gamma(S(3)*m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(2) + S(2)*d*e*x + e**S(2)*x**S(2))**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-S(2)*m)*((d + e*x)**S(2))**m*Gamma(S(2)*m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**m, x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(-m)*(d + e*x)**m*Gamma(m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**(-m), x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**m*(d + e*x)**(-m)*Gamma(-m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(2) + S(2)*d*e*x + e**S(2)*x**S(2))**(-m), x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(S(2)*m)*((d + e*x)**S(2))**(-m)*Gamma(-S(2)*m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d**S(3) + S(3)*d**S(2)*e*x + S(3)*d*e**S(2)*x**S(2) + e**S(3)*x**S(3))**(-m), x), x, F**(c*(a - b*d/e))*(-b*c*(d + e*x)*log(F)/e)**(S(3)*m)*((d + e*x)**S(3))**(-m)*Gamma(-S(3)*m + S(1), -b*c*(d + e*x)*log(F)/e)/(b*c*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(S(5)*x + S(2)), x), x, F**(S(5)*x + S(2))/(S(5)*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x), x), x, F**(a + b*x)/(b*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(10)**(S(5)*x + S(2)), x), x, S(2)**(S(5)*x + S(2))*S(5)**(S(5)*x + S(1))/log(S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)*x**(S(7)/2), x), x, S(105)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/(S(16)*b**(S(9)/2)*log(F)**(S(9)/2)) + F**(a + b*x)*x**(S(7)/2)/(b*log(F)) - S(7)*F**(a + b*x)*x**(S(5)/2)/(S(2)*b**S(2)*log(F)**S(2)) + S(35)*F**(a + b*x)*x**(S(3)/2)/(S(4)*b**S(3)*log(F)**S(3)) - S(105)*F**(a + b*x)*sqrt(x)/(S(8)*b**S(4)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)*x**(S(5)/2), x), x, -S(15)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/(S(8)*b**(S(7)/2)*log(F)**(S(7)/2)) + F**(a + b*x)*x**(S(5)/2)/(b*log(F)) - S(5)*F**(a + b*x)*x**(S(3)/2)/(S(2)*b**S(2)*log(F)**S(2)) + S(15)*F**(a + b*x)*sqrt(x)/(S(4)*b**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)*x**(S(3)/2), x), x, S(3)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/(S(4)*b**(S(5)/2)*log(F)**(S(5)/2)) + F**(a + b*x)*x**(S(3)/2)/(b*log(F)) - S(3)*F**(a + b*x)*sqrt(x)/(S(2)*b**S(2)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)*sqrt(x), x), x, -sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/(S(2)*b**(S(3)/2)*log(F)**(S(3)/2)) + F**(a + b*x)*sqrt(x)/(b*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)/sqrt(x), x), x, sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/(sqrt(b)*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)/x**(S(3)/2), x), x, S(2)*sqrt(pi)*F**a*sqrt(b)*sqrt(log(F))*erfi(sqrt(b)*sqrt(x)*sqrt(log(F))) - S(2)*F**(a + b*x)/sqrt(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)/x**(S(5)/2), x), x, S(4)*sqrt(pi)*F**a*b**(S(3)/2)*log(F)**(S(3)/2)*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/S(3) - S(4)*F**(a + b*x)*b*log(F)/(S(3)*sqrt(x)) - S(2)*F**(a + b*x)/(S(3)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)/x**(S(7)/2), x), x, S(8)*sqrt(pi)*F**a*b**(S(5)/2)*log(F)**(S(5)/2)*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/S(15) - S(8)*F**(a + b*x)*b**S(2)*log(F)**S(2)/(S(15)*sqrt(x)) - S(4)*F**(a + b*x)*b*log(F)/(S(15)*x**(S(3)/2)) - S(2)*F**(a + b*x)/(S(5)*x**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x)/x**(S(9)/2), x), x, S(16)*sqrt(pi)*F**a*b**(S(7)/2)*log(F)**(S(7)/2)*erfi(sqrt(b)*sqrt(x)*sqrt(log(F)))/S(105) - S(16)*F**(a + b*x)*b**S(3)*log(F)**S(3)/(S(105)*sqrt(x)) - S(8)*F**(a + b*x)*b**S(2)*log(F)**S(2)/(S(105)*x**(S(3)/2)) - S(4)*F**(a + b*x)*b*log(F)/(S(35)*x**(S(5)/2)) - S(2)*F**(a + b*x)/(S(7)*x**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**(S(7)/2), x), x, F**(c*(a + b*x))*(d + e*x)**(S(7)/2)/(b*c*log(F)) - S(7)*F**(c*(a + b*x))*e*(d + e*x)**(S(5)/2)/(S(2)*b**S(2)*c**S(2)*log(F)**S(2)) + S(35)*F**(c*(a + b*x))*e**S(2)*(d + e*x)**(S(3)/2)/(S(4)*b**S(3)*c**S(3)*log(F)**S(3)) - S(105)*F**(c*(a + b*x))*e**S(3)*sqrt(d + e*x)/(S(8)*b**S(4)*c**S(4)*log(F)**S(4)) + S(105)*sqrt(pi)*F**(c*(a - b*d/e))*e**(S(7)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(16)*b**(S(9)/2)*c**(S(9)/2)*log(F)**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**(S(5)/2), x), x, F**(c*(a + b*x))*(d + e*x)**(S(5)/2)/(b*c*log(F)) - S(5)*F**(c*(a + b*x))*e*(d + e*x)**(S(3)/2)/(S(2)*b**S(2)*c**S(2)*log(F)**S(2)) + S(15)*F**(c*(a + b*x))*e**S(2)*sqrt(d + e*x)/(S(4)*b**S(3)*c**S(3)*log(F)**S(3)) - S(15)*sqrt(pi)*F**(c*(a - b*d/e))*e**(S(5)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(8)*b**(S(7)/2)*c**(S(7)/2)*log(F)**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**(S(3)/2), x), x, F**(c*(a + b*x))*(d + e*x)**(S(3)/2)/(b*c*log(F)) - S(3)*F**(c*(a + b*x))*e*sqrt(d + e*x)/(S(2)*b**S(2)*c**S(2)*log(F)**S(2)) + S(3)*sqrt(pi)*F**(c*(a - b*d/e))*e**(S(3)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(4)*b**(S(5)/2)*c**(S(5)/2)*log(F)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*sqrt(d + e*x), x), x, F**(c*(a + b*x))*sqrt(d + e*x)/(b*c*log(F)) - sqrt(pi)*F**(c*(a - b*d/e))*sqrt(e)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(2)*b**(S(3)/2)*c**(S(3)/2)*log(F)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/sqrt(d + e*x), x), x, sqrt(pi)*F**(c*(a - b*d/e))*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(sqrt(b)*sqrt(c)*sqrt(e)*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**(S(3)/2), x), x, -S(2)*F**(c*(a + b*x))/(e*sqrt(d + e*x)) + S(2)*sqrt(pi)*F**(c*(a - b*d/e))*sqrt(b)*sqrt(c)*sqrt(log(F))*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/e**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**(S(5)/2), x), x, -S(4)*F**(c*(a + b*x))*b*c*log(F)/(S(3)*e**S(2)*sqrt(d + e*x)) - S(2)*F**(c*(a + b*x))/(S(3)*e*(d + e*x)**(S(3)/2)) + S(4)*sqrt(pi)*F**(c*(a - b*d/e))*b**(S(3)/2)*c**(S(3)/2)*log(F)**(S(3)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(3)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**(S(7)/2), x), x, -S(8)*F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(15)*e**S(3)*sqrt(d + e*x)) - S(4)*F**(c*(a + b*x))*b*c*log(F)/(S(15)*e**S(2)*(d + e*x)**(S(3)/2)) - S(2)*F**(c*(a + b*x))/(S(5)*e*(d + e*x)**(S(5)/2)) + S(8)*sqrt(pi)*F**(c*(a - b*d/e))*b**(S(5)/2)*c**(S(5)/2)*log(F)**(S(5)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(15)*e**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))/(d + e*x)**(S(9)/2), x), x, -S(16)*F**(c*(a + b*x))*b**S(3)*c**S(3)*log(F)**S(3)/(S(105)*e**S(4)*sqrt(d + e*x)) - S(8)*F**(c*(a + b*x))*b**S(2)*c**S(2)*log(F)**S(2)/(S(105)*e**S(3)*(d + e*x)**(S(3)/2)) - S(4)*F**(c*(a + b*x))*b*c*log(F)/(S(35)*e**S(2)*(d + e*x)**(S(5)/2)) - S(2)*F**(c*(a + b*x))/(S(7)*e*(d + e*x)**(S(7)/2)) + S(16)*sqrt(pi)*F**(c*(a - b*d/e))*b**(S(7)/2)*c**(S(7)/2)*log(F)**(S(7)/2)*erfi(sqrt(b)*sqrt(c)*sqrt(d + e*x)*sqrt(log(F))/sqrt(e))/(S(105)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)*exp(-b*x), x), x, -x**(S(13)/2)*exp(-b*x)/b - S(13)*x**(S(11)/2)*exp(-b*x)/(S(2)*b**S(2)) - S(143)*x**(S(9)/2)*exp(-b*x)/(S(4)*b**S(3)) - S(1287)*x**(S(7)/2)*exp(-b*x)/(S(8)*b**S(4)) - S(9009)*x**(S(5)/2)*exp(-b*x)/(S(16)*b**S(5)) - S(45045)*x**(S(3)/2)*exp(-b*x)/(S(32)*b**S(6)) - S(135135)*sqrt(x)*exp(-b*x)/(S(64)*b**S(7)) + S(135135)*sqrt(pi)*erf(sqrt(b)*sqrt(x))/(S(128)*b**(S(15)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x)**(S(4)/3), x), x, -F**(c*(a - b*d/e))*e*(d + e*x)**(S(1)/3)*Gamma(S(7)/3, -b*c*(d + e*x)*log(F)/e)/(b**S(2)*c**S(2)*(-b*c*(d + e*x)*log(F)/e)**(S(1)/3)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**(S(4)/3)*(F**(c*(a + b*x)))**n, x), x, -F**(-c*n*(a + b*x) + c*n*(a - b*d/e))*e*(d + e*x)**(S(1)/3)*(F**(c*(a + b*x)))**n*Gamma(S(7)/3, -b*c*n*(d + e*x)*log(F)/e)/(b**S(2)*c**S(2)*n**S(2)*(-b*c*n*(d + e*x)*log(F)/e)**(S(1)/3)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x), x), x, F**(c*(a + b*x))*(d + e*x)/(b*c*log(F)) - F**(c*(a + b*x))*e/(b**S(2)*c**S(2)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x + f*x**S(2)), x), x, F**(c*(a + b*x))*d/(b*c*log(F)) + F**(c*(a + b*x))*e*x/(b*c*log(F)) + F**(c*(a + b*x))*f*x**S(2)/(b*c*log(F)) - F**(c*(a + b*x))*e/(b**S(2)*c**S(2)*log(F)**S(2)) - S(2)*F**(c*(a + b*x))*f*x/(b**S(2)*c**S(2)*log(F)**S(2)) + S(2)*F**(c*(a + b*x))*f/(b**S(3)*c**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x + f*x**S(2) + g*x**S(3)), x), x, F**(c*(a + b*x))*d/(b*c*log(F)) + F**(c*(a + b*x))*e*x/(b*c*log(F)) + F**(c*(a + b*x))*f*x**S(2)/(b*c*log(F)) + F**(c*(a + b*x))*g*x**S(3)/(b*c*log(F)) - F**(c*(a + b*x))*e/(b**S(2)*c**S(2)*log(F)**S(2)) - S(2)*F**(c*(a + b*x))*f*x/(b**S(2)*c**S(2)*log(F)**S(2)) - S(3)*F**(c*(a + b*x))*g*x**S(2)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(2)*F**(c*(a + b*x))*f/(b**S(3)*c**S(3)*log(F)**S(3)) + S(6)*F**(c*(a + b*x))*g*x/(b**S(3)*c**S(3)*log(F)**S(3)) - S(6)*F**(c*(a + b*x))*g/(b**S(4)*c**S(4)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4)), x), x, F**(c*(a + b*x))*d/(b*c*log(F)) + F**(c*(a + b*x))*e*x/(b*c*log(F)) + F**(c*(a + b*x))*f*x**S(2)/(b*c*log(F)) + F**(c*(a + b*x))*g*x**S(3)/(b*c*log(F)) + F**(c*(a + b*x))*h*x**S(4)/(b*c*log(F)) - F**(c*(a + b*x))*e/(b**S(2)*c**S(2)*log(F)**S(2)) - S(2)*F**(c*(a + b*x))*f*x/(b**S(2)*c**S(2)*log(F)**S(2)) - S(3)*F**(c*(a + b*x))*g*x**S(2)/(b**S(2)*c**S(2)*log(F)**S(2)) - S(4)*F**(c*(a + b*x))*h*x**S(3)/(b**S(2)*c**S(2)*log(F)**S(2)) + S(2)*F**(c*(a + b*x))*f/(b**S(3)*c**S(3)*log(F)**S(3)) + S(6)*F**(c*(a + b*x))*g*x/(b**S(3)*c**S(3)*log(F)**S(3)) + S(12)*F**(c*(a + b*x))*h*x**S(2)/(b**S(3)*c**S(3)*log(F)**S(3)) - S(6)*F**(c*(a + b*x))*g/(b**S(4)*c**S(4)*log(F)**S(4)) - S(24)*F**(c*(a + b*x))*h*x/(b**S(4)*c**S(4)*log(F)**S(4)) + S(24)*F**(c*(a + b*x))*h/(b**S(5)*c**S(5)*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)**S(3)*exp(-a - b*x), x), x, -a**S(3)*x**m*(b*x)**(-m)*Gamma(m + S(1), b*x)*exp(-a)/b - S(3)*a**S(2)*x**m*(b*x)**(-m)*Gamma(m + S(2), b*x)*exp(-a)/b - S(3)*a*x**m*(b*x)**(-m)*Gamma(m + S(3), b*x)*exp(-a)/b - x**m*(b*x)**(-m)*Gamma(m + S(4), b*x)*exp(-a)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**S(3)*exp(-a - b*x), x), x, -a**S(3)*x**S(3)*exp(-a - b*x)/b - S(3)*a**S(3)*x**S(2)*exp(-a - b*x)/b**S(2) - S(6)*a**S(3)*x*exp(-a - b*x)/b**S(3) - S(6)*a**S(3)*exp(-a - b*x)/b**S(4) - S(3)*a**S(2)*x**S(4)*exp(-a - b*x) - S(12)*a**S(2)*x**S(3)*exp(-a - b*x)/b - S(36)*a**S(2)*x**S(2)*exp(-a - b*x)/b**S(2) - S(72)*a**S(2)*x*exp(-a - b*x)/b**S(3) - S(72)*a**S(2)*exp(-a - b*x)/b**S(4) - S(3)*a*b*x**S(5)*exp(-a - b*x) - S(15)*a*x**S(4)*exp(-a - b*x) - S(60)*a*x**S(3)*exp(-a - b*x)/b - S(180)*a*x**S(2)*exp(-a - b*x)/b**S(2) - S(360)*a*x*exp(-a - b*x)/b**S(3) - S(360)*a*exp(-a - b*x)/b**S(4) - b**S(2)*x**S(6)*exp(-a - b*x) - S(6)*b*x**S(5)*exp(-a - b*x) - S(30)*x**S(4)*exp(-a - b*x) - S(120)*x**S(3)*exp(-a - b*x)/b - S(360)*x**S(2)*exp(-a - b*x)/b**S(2) - S(720)*x*exp(-a - b*x)/b**S(3) - S(720)*exp(-a - b*x)/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**S(3)*exp(-a - b*x), x), x, -a**S(3)*x**S(2)*exp(-a - b*x)/b - S(2)*a**S(3)*x*exp(-a - b*x)/b**S(2) - S(2)*a**S(3)*exp(-a - b*x)/b**S(3) - S(3)*a**S(2)*x**S(3)*exp(-a - b*x) - S(9)*a**S(2)*x**S(2)*exp(-a - b*x)/b - S(18)*a**S(2)*x*exp(-a - b*x)/b**S(2) - S(18)*a**S(2)*exp(-a - b*x)/b**S(3) - S(3)*a*b*x**S(4)*exp(-a - b*x) - S(12)*a*x**S(3)*exp(-a - b*x) - S(36)*a*x**S(2)*exp(-a - b*x)/b - S(72)*a*x*exp(-a - b*x)/b**S(2) - S(72)*a*exp(-a - b*x)/b**S(3) - b**S(2)*x**S(5)*exp(-a - b*x) - S(5)*b*x**S(4)*exp(-a - b*x) - S(20)*x**S(3)*exp(-a - b*x) - S(60)*x**S(2)*exp(-a - b*x)/b - S(120)*x*exp(-a - b*x)/b**S(2) - S(120)*exp(-a - b*x)/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**S(3)*exp(-a - b*x), x), x, a*(a + b*x)**S(3)*exp(-a - b*x)/b**S(2) + S(3)*a*(a + b*x)**S(2)*exp(-a - b*x)/b**S(2) + S(6)*a*(a + b*x)*exp(-a - b*x)/b**S(2) + S(6)*a*exp(-a - b*x)/b**S(2) - (a + b*x)**S(4)*exp(-a - b*x)/b**S(2) - S(4)*(a + b*x)**S(3)*exp(-a - b*x)/b**S(2) - S(12)*(a + b*x)**S(2)*exp(-a - b*x)/b**S(2) - S(24)*(a + b*x)*exp(-a - b*x)/b**S(2) - S(24)*exp(-a - b*x)/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(-a - b*x), x), x, -(a + b*x)**S(3)*exp(-a - b*x)/b - S(3)*(a + b*x)**S(2)*exp(-a - b*x)/b - S(6)*(a + b*x)*exp(-a - b*x)/b - S(6)*exp(-a - b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(-a - b*x)/x, x), x, a**S(3)*exp(-a)*Ei(-b*x) - S(3)*a**S(2)*exp(-a - b*x) - S(3)*a*b*x*exp(-a - b*x) - S(3)*a*exp(-a - b*x) - b**S(2)*x**S(2)*exp(-a - b*x) - S(2)*b*x*exp(-a - b*x) - S(2)*exp(-a - b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(-a - b*x)/x**S(2), x), x, -a**S(3)*b*exp(-a)*Ei(-b*x) - a**S(3)*exp(-a - b*x)/x + S(3)*a**S(2)*b*exp(-a)*Ei(-b*x) - S(3)*a*b*exp(-a - b*x) - b**S(2)*x*exp(-a - b*x) - b*exp(-a - b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(-a - b*x)/x**S(3), x), x, a**S(3)*b**S(2)*exp(-a)*Ei(-b*x)/S(2) + a**S(3)*b*exp(-a - b*x)/(S(2)*x) - a**S(3)*exp(-a - b*x)/(S(2)*x**S(2)) - S(3)*a**S(2)*b**S(2)*exp(-a)*Ei(-b*x) - S(3)*a**S(2)*b*exp(-a - b*x)/x + S(3)*a*b**S(2)*exp(-a)*Ei(-b*x) - b**S(2)*exp(-a - b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(-a - b*x)/x**S(4), x), x, -a**S(3)*b**S(3)*exp(-a)*Ei(-b*x)/S(6) - a**S(3)*b**S(2)*exp(-a - b*x)/(S(6)*x) + a**S(3)*b*exp(-a - b*x)/(S(6)*x**S(2)) - a**S(3)*exp(-a - b*x)/(S(3)*x**S(3)) + S(3)*a**S(2)*b**S(3)*exp(-a)*Ei(-b*x)/S(2) + S(3)*a**S(2)*b**S(2)*exp(-a - b*x)/(S(2)*x) - S(3)*a**S(2)*b*exp(-a - b*x)/(S(2)*x**S(2)) - S(3)*a*b**S(3)*exp(-a)*Ei(-b*x) - S(3)*a*b**S(2)*exp(-a - b*x)/x + b**S(3)*exp(-a)*Ei(-b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*x**m*(e + f*x)**S(2), x), x, F**(a + b*c)*e**S(2)*x**m*(-b*d*x*log(F))**(-m)*Gamma(m + S(1), -b*d*x*log(F))/(b*d*log(F)) - S(2)*F**(a + b*c)*e*f*x**m*(-b*d*x*log(F))**(-m)*Gamma(m + S(2), -b*d*x*log(F))/(b**S(2)*d**S(2)*log(F)**S(2)) + F**(a + b*c)*f**S(2)*x**m*(-b*d*x*log(F))**(-m)*Gamma(m + S(3), -b*d*x*log(F))/(b**S(3)*d**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*x**S(3)*(e + f*x)**S(2), x), x, F**(a + b*c + b*d*x)*e**S(2)*x**S(3)/(b*d*log(F)) + S(2)*F**(a + b*c + b*d*x)*e*f*x**S(4)/(b*d*log(F)) + F**(a + b*c + b*d*x)*f**S(2)*x**S(5)/(b*d*log(F)) - S(3)*F**(a + b*c + b*d*x)*e**S(2)*x**S(2)/(b**S(2)*d**S(2)*log(F)**S(2)) - S(8)*F**(a + b*c + b*d*x)*e*f*x**S(3)/(b**S(2)*d**S(2)*log(F)**S(2)) - S(5)*F**(a + b*c + b*d*x)*f**S(2)*x**S(4)/(b**S(2)*d**S(2)*log(F)**S(2)) + S(6)*F**(a + b*c + b*d*x)*e**S(2)*x/(b**S(3)*d**S(3)*log(F)**S(3)) + S(24)*F**(a + b*c + b*d*x)*e*f*x**S(2)/(b**S(3)*d**S(3)*log(F)**S(3)) + S(20)*F**(a + b*c + b*d*x)*f**S(2)*x**S(3)/(b**S(3)*d**S(3)*log(F)**S(3)) - S(6)*F**(a + b*c + b*d*x)*e**S(2)/(b**S(4)*d**S(4)*log(F)**S(4)) - S(48)*F**(a + b*c + b*d*x)*e*f*x/(b**S(4)*d**S(4)*log(F)**S(4)) - S(60)*F**(a + b*c + b*d*x)*f**S(2)*x**S(2)/(b**S(4)*d**S(4)*log(F)**S(4)) + S(48)*F**(a + b*c + b*d*x)*e*f/(b**S(5)*d**S(5)*log(F)**S(5)) + S(120)*F**(a + b*c + b*d*x)*f**S(2)*x/(b**S(5)*d**S(5)*log(F)**S(5)) - S(120)*F**(a + b*c + b*d*x)*f**S(2)/(b**S(6)*d**S(6)*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*x**S(2)*(e + f*x)**S(2), x), x, F**(a + b*c + b*d*x)*e**S(2)*x**S(2)/(b*d*log(F)) + S(2)*F**(a + b*c + b*d*x)*e*f*x**S(3)/(b*d*log(F)) + F**(a + b*c + b*d*x)*f**S(2)*x**S(4)/(b*d*log(F)) - S(2)*F**(a + b*c + b*d*x)*e**S(2)*x/(b**S(2)*d**S(2)*log(F)**S(2)) - S(6)*F**(a + b*c + b*d*x)*e*f*x**S(2)/(b**S(2)*d**S(2)*log(F)**S(2)) - S(4)*F**(a + b*c + b*d*x)*f**S(2)*x**S(3)/(b**S(2)*d**S(2)*log(F)**S(2)) + S(2)*F**(a + b*c + b*d*x)*e**S(2)/(b**S(3)*d**S(3)*log(F)**S(3)) + S(12)*F**(a + b*c + b*d*x)*e*f*x/(b**S(3)*d**S(3)*log(F)**S(3)) + S(12)*F**(a + b*c + b*d*x)*f**S(2)*x**S(2)/(b**S(3)*d**S(3)*log(F)**S(3)) - S(12)*F**(a + b*c + b*d*x)*e*f/(b**S(4)*d**S(4)*log(F)**S(4)) - S(24)*F**(a + b*c + b*d*x)*f**S(2)*x/(b**S(4)*d**S(4)*log(F)**S(4)) + S(24)*F**(a + b*c + b*d*x)*f**S(2)/(b**S(5)*d**S(5)*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*x*(e + f*x)**S(2), x), x, F**(a + b*c + b*d*x)*e**S(2)*x/(b*d*log(F)) + S(2)*F**(a + b*c + b*d*x)*e*f*x**S(2)/(b*d*log(F)) + F**(a + b*c + b*d*x)*f**S(2)*x**S(3)/(b*d*log(F)) - F**(a + b*c + b*d*x)*e**S(2)/(b**S(2)*d**S(2)*log(F)**S(2)) - S(4)*F**(a + b*c + b*d*x)*e*f*x/(b**S(2)*d**S(2)*log(F)**S(2)) - S(3)*F**(a + b*c + b*d*x)*f**S(2)*x**S(2)/(b**S(2)*d**S(2)*log(F)**S(2)) + S(4)*F**(a + b*c + b*d*x)*e*f/(b**S(3)*d**S(3)*log(F)**S(3)) + S(6)*F**(a + b*c + b*d*x)*f**S(2)*x/(b**S(3)*d**S(3)*log(F)**S(3)) - S(6)*F**(a + b*c + b*d*x)*f**S(2)/(b**S(4)*d**S(4)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2), x), x, F**(a + b*c + b*d*x)*(e + f*x)**S(2)/(b*d*log(F)) - S(2)*F**(a + b*c + b*d*x)*f*(e + f*x)/(b**S(2)*d**S(2)*log(F)**S(2)) + S(2)*F**(a + b*c + b*d*x)*f**S(2)/(b**S(3)*d**S(3)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2)/x, x), x, F**(a + b*c)*e**S(2)*Ei(b*d*x*log(F)) + S(2)*F**(a + b*c + b*d*x)*e*f/(b*d*log(F)) + F**(a + b*c + b*d*x)*f**S(2)*x/(b*d*log(F)) - F**(a + b*c + b*d*x)*f**S(2)/(b**S(2)*d**S(2)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2)/x**S(2), x), x, F**(a + b*c)*b*d*e**S(2)*log(F)*Ei(b*d*x*log(F)) + S(2)*F**(a + b*c)*e*f*Ei(b*d*x*log(F)) - F**(a + b*c + b*d*x)*e**S(2)/x + F**(a + b*c + b*d*x)*f**S(2)/(b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2)/x**S(3), x), x, F**(a + b*c)*b**S(2)*d**S(2)*e**S(2)*log(F)**S(2)*Ei(b*d*x*log(F))/S(2) + S(2)*F**(a + b*c)*b*d*e*f*log(F)*Ei(b*d*x*log(F)) + F**(a + b*c)*f**S(2)*Ei(b*d*x*log(F)) - F**(a + b*c + b*d*x)*b*d*e**S(2)*log(F)/(S(2)*x) - F**(a + b*c + b*d*x)*e**S(2)/(S(2)*x**S(2)) - S(2)*F**(a + b*c + b*d*x)*e*f/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2)/x**S(4), x), x, F**(a + b*c)*b**S(3)*d**S(3)*e**S(2)*log(F)**S(3)*Ei(b*d*x*log(F))/S(6) + F**(a + b*c)*b**S(2)*d**S(2)*e*f*log(F)**S(2)*Ei(b*d*x*log(F)) + F**(a + b*c)*b*d*f**S(2)*log(F)*Ei(b*d*x*log(F)) - F**(a + b*c + b*d*x)*b**S(2)*d**S(2)*e**S(2)*log(F)**S(2)/(S(6)*x) - F**(a + b*c + b*d*x)*b*d*e**S(2)*log(F)/(S(6)*x**S(2)) - F**(a + b*c + b*d*x)*b*d*e*f*log(F)/x - F**(a + b*c + b*d*x)*e**S(2)/(S(3)*x**S(3)) - F**(a + b*c + b*d*x)*e*f/x**S(2) - F**(a + b*c + b*d*x)*f**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x))*(e + f*x)**S(2)/x**S(5), x), x, F**(a + b*c)*b**S(4)*d**S(4)*e**S(2)*log(F)**S(4)*Ei(b*d*x*log(F))/S(24) + F**(a + b*c)*b**S(3)*d**S(3)*e*f*log(F)**S(3)*Ei(b*d*x*log(F))/S(3) + F**(a + b*c)*b**S(2)*d**S(2)*f**S(2)*log(F)**S(2)*Ei(b*d*x*log(F))/S(2) - F**(a + b*c + b*d*x)*b**S(3)*d**S(3)*e**S(2)*log(F)**S(3)/(S(24)*x) - F**(a + b*c + b*d*x)*b**S(2)*d**S(2)*e**S(2)*log(F)**S(2)/(S(24)*x**S(2)) - F**(a + b*c + b*d*x)*b**S(2)*d**S(2)*e*f*log(F)**S(2)/(S(3)*x) - F**(a + b*c + b*d*x)*b*d*e**S(2)*log(F)/(S(12)*x**S(3)) - F**(a + b*c + b*d*x)*b*d*e*f*log(F)/(S(3)*x**S(2)) - F**(a + b*c + b*d*x)*b*d*f**S(2)*log(F)/(S(2)*x) - F**(a + b*c + b*d*x)*e**S(2)/(S(4)*x**S(4)) - S(2)*F**(a + b*c + b*d*x)*e*f/(S(3)*x**S(3)) - F**(a + b*c + b*d*x)*f**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*(c + d*x)**S(3)*exp(-a - b*x), x), x, -d**S(3)*(a + b*x)**S(7)*exp(-a - b*x)/b**S(4) - S(7)*d**S(3)*(a + b*x)**S(6)*exp(-a - b*x)/b**S(4) - S(42)*d**S(3)*(a + b*x)**S(5)*exp(-a - b*x)/b**S(4) - S(210)*d**S(3)*(a + b*x)**S(4)*exp(-a - b*x)/b**S(4) - S(840)*d**S(3)*(a + b*x)**S(3)*exp(-a - b*x)/b**S(4) - S(2520)*d**S(3)*(a + b*x)**S(2)*exp(-a - b*x)/b**S(4) - S(5040)*d**S(3)*(a + b*x)*exp(-a - b*x)/b**S(4) - S(5040)*d**S(3)*exp(-a - b*x)/b**S(4) - S(3)*d**S(2)*(a + b*x)**S(6)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(18)*d**S(2)*(a + b*x)**S(5)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(90)*d**S(2)*(a + b*x)**S(4)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(360)*d**S(2)*(a + b*x)**S(3)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(1080)*d**S(2)*(a + b*x)**S(2)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(2160)*d**S(2)*(a + b*x)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(2160)*d**S(2)*(-a*d + b*c)*exp(-a - b*x)/b**S(4) - S(3)*d*(a + b*x)**S(5)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - S(15)*d*(a + b*x)**S(4)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - S(60)*d*(a + b*x)**S(3)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - S(180)*d*(a + b*x)**S(2)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - S(360)*d*(a + b*x)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - S(360)*d*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(4) - (a + b*x)**S(4)*(-a*d + b*c)**S(3)*exp(-a - b*x)/b**S(4) - S(4)*(a + b*x)**S(3)*(-a*d + b*c)**S(3)*exp(-a - b*x)/b**S(4) - S(12)*(a + b*x)**S(2)*(-a*d + b*c)**S(3)*exp(-a - b*x)/b**S(4) - S(24)*(a + b*x)*(-a*d + b*c)**S(3)*exp(-a - b*x)/b**S(4) - S(24)*(-a*d + b*c)**S(3)*exp(-a - b*x)/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*(c + d*x)**S(2)*exp(-a - b*x), x), x, -d**S(2)*(a + b*x)**S(6)*exp(-a - b*x)/b**S(3) - S(6)*d**S(2)*(a + b*x)**S(5)*exp(-a - b*x)/b**S(3) - S(30)*d**S(2)*(a + b*x)**S(4)*exp(-a - b*x)/b**S(3) - S(120)*d**S(2)*(a + b*x)**S(3)*exp(-a - b*x)/b**S(3) - S(360)*d**S(2)*(a + b*x)**S(2)*exp(-a - b*x)/b**S(3) - S(720)*d**S(2)*(a + b*x)*exp(-a - b*x)/b**S(3) - S(720)*d**S(2)*exp(-a - b*x)/b**S(3) - S(2)*d*(a + b*x)**S(5)*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - S(10)*d*(a + b*x)**S(4)*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - S(40)*d*(a + b*x)**S(3)*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - S(120)*d*(a + b*x)**S(2)*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - S(240)*d*(a + b*x)*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - S(240)*d*(-a*d + b*c)*exp(-a - b*x)/b**S(3) - (a + b*x)**S(4)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(3) - S(4)*(a + b*x)**S(3)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(3) - S(12)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(3) - S(24)*(a + b*x)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(3) - S(24)*(-a*d + b*c)**S(2)*exp(-a - b*x)/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*(c + d*x)*exp(-a - b*x), x), x, -d*(a + b*x)**S(5)*exp(-a - b*x)/b**S(2) - S(5)*d*(a + b*x)**S(4)*exp(-a - b*x)/b**S(2) - S(20)*d*(a + b*x)**S(3)*exp(-a - b*x)/b**S(2) - S(60)*d*(a + b*x)**S(2)*exp(-a - b*x)/b**S(2) - S(120)*d*(a + b*x)*exp(-a - b*x)/b**S(2) - S(120)*d*exp(-a - b*x)/b**S(2) - (a + b*x)**S(4)*(-a*d + b*c)*exp(-a - b*x)/b**S(2) - (a + b*x)**S(3)*(-S(4)*a*d + S(4)*b*c)*exp(-a - b*x)/b**S(2) - (a + b*x)**S(2)*(-S(12)*a*d + S(12)*b*c)*exp(-a - b*x)/b**S(2) - (a + b*x)*(-S(24)*a*d + S(24)*b*c)*exp(-a - b*x)/b**S(2) - (-S(24)*a*d + S(24)*b*c)*exp(-a - b*x)/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x), x), x, -(a + b*x)**S(4)*exp(-a - b*x)/b - S(4)*(a + b*x)**S(3)*exp(-a - b*x)/b - S(12)*(a + b*x)**S(2)*exp(-a - b*x)/b - S(24)*(a + b*x)*exp(-a - b*x)/b - S(24)*exp(-a - b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x)/(c + d*x), x), x, -(a + b*x)**S(3)*exp(-a - b*x)/d - S(3)*(a + b*x)**S(2)*exp(-a - b*x)/d - S(6)*(a + b*x)*exp(-a - b*x)/d - S(6)*exp(-a - b*x)/d + (a + b*x)**S(2)*(-a*d + b*c)*exp(-a - b*x)/d**S(2) + (a + b*x)*(-S(2)*a*d + S(2)*b*c)*exp(-a - b*x)/d**S(2) + (-S(2)*a*d + S(2)*b*c)*exp(-a - b*x)/d**S(2) - (a + b*x)*(-a*d + b*c)**S(2)*exp(-a - b*x)/d**S(3) - (-a*d + b*c)**S(2)*exp(-a - b*x)/d**S(3) + (-a*d + b*c)**S(3)*exp(-a - b*x)/d**S(4) + (-a*d + b*c)**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x)/(c + d*x)**S(2), x), x, -b**S(3)*(c + d*x)**S(2)*exp(-a - b*x)/d**S(4) - S(2)*b**S(2)*(c + d*x)*exp(-a - b*x)/d**S(3) + S(4)*b**S(2)*(c + d*x)*(-a*d + b*c)*exp(-a - b*x)/d**S(4) - S(2)*b*exp(-a - b*x)/d**S(2) + S(4)*b*(-a*d + b*c)*exp(-a - b*x)/d**S(3) - S(6)*b*(-a*d + b*c)**S(2)*exp(-a - b*x)/d**S(4) - S(4)*b*(-a*d + b*c)**S(3)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(5) - b*(-a*d + b*c)**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(6) - (-a*d + b*c)**S(4)*exp(-a - b*x)/(d**S(5)*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x)/(c + d*x)**S(3), x), x, -b**S(3)*x*exp(-a - b*x)/d**S(3) - b**S(2)*exp(-a - b*x)/d**S(3) + b**S(2)*(-S(4)*a*d + S(3)*b*c)*exp(-a - b*x)/d**S(4) + S(6)*b**S(2)*(-a*d + b*c)**S(2)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(5) + S(4)*b**S(2)*(-a*d + b*c)**S(3)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(6) + b**S(2)*(-a*d + b*c)**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/(S(2)*d**S(7)) + S(4)*b*(-a*d + b*c)**S(3)*exp(-a - b*x)/(d**S(5)*(c + d*x)) + b*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(2)*d**S(6)*(c + d*x)) - (-a*d + b*c)**S(4)*exp(-a - b*x)/(S(2)*d**S(5)*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x)/(c + d*x)**S(4), x), x, -b**S(3)*exp(-a - b*x)/d**S(4) - S(4)*b**S(3)*(-a*d + b*c)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(5) - S(6)*b**S(3)*(-a*d + b*c)**S(2)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(6) - S(2)*b**S(3)*(-a*d + b*c)**S(3)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(7) - b**S(3)*(-a*d + b*c)**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/(S(6)*d**S(8)) - S(6)*b**S(2)*(-a*d + b*c)**S(2)*exp(-a - b*x)/(d**S(5)*(c + d*x)) - S(2)*b**S(2)*(-a*d + b*c)**S(3)*exp(-a - b*x)/(d**S(6)*(c + d*x)) - b**S(2)*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(6)*d**S(7)*(c + d*x)) + S(2)*b*(-a*d + b*c)**S(3)*exp(-a - b*x)/(d**S(5)*(c + d*x)**S(2)) + b*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(6)*d**S(6)*(c + d*x)**S(2)) - (-a*d + b*c)**S(4)*exp(-a - b*x)/(S(3)*d**S(5)*(c + d*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(-a - b*x)/(c + d*x)**S(5), x), x, b**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(5) + S(4)*b**S(4)*(-a*d + b*c)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(6) + S(3)*b**S(4)*(-a*d + b*c)**S(2)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/d**S(7) + S(2)*b**S(4)*(-a*d + b*c)**S(3)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/(S(3)*d**S(8)) + b**S(4)*(-a*d + b*c)**S(4)*exp(-a + b*c/d)*Ei(-b*(c + d*x)/d)/(S(24)*d**S(9)) + S(4)*b**S(3)*(-a*d + b*c)*exp(-a - b*x)/(d**S(5)*(c + d*x)) + S(3)*b**S(3)*(-a*d + b*c)**S(2)*exp(-a - b*x)/(d**S(6)*(c + d*x)) + S(2)*b**S(3)*(-a*d + b*c)**S(3)*exp(-a - b*x)/(S(3)*d**S(7)*(c + d*x)) + b**S(3)*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(24)*d**S(8)*(c + d*x)) - S(3)*b**S(2)*(-a*d + b*c)**S(2)*exp(-a - b*x)/(d**S(5)*(c + d*x)**S(2)) - S(2)*b**S(2)*(-a*d + b*c)**S(3)*exp(-a - b*x)/(S(3)*d**S(6)*(c + d*x)**S(2)) - b**S(2)*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(24)*d**S(7)*(c + d*x)**S(2)) + S(4)*b*(-a*d + b*c)**S(3)*exp(-a - b*x)/(S(3)*d**S(5)*(c + d*x)**S(3)) + b*(-a*d + b*c)**S(4)*exp(-a - b*x)/(S(12)*d**S(6)*(c + d*x)**S(3)) - (-a*d + b*c)**S(4)*exp(-a - b*x)/(S(4)*d**S(5)*(c + d*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*x**m*(e*n + e*(b*c*x*log(F) + m + S(1))*log(d*x) + e)*log(d*x)**n, x), x, F**(c*(a + b*x))*e*x**(m + S(1))*log(d*x)**(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*x**S(2)*(e*n + e*(b*c*x*log(F) + S(3))*log(d*x) + e)*log(d*x)**n, x), x, F**(c*(a + b*x))*e*x**S(3)*log(d*x)**(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*x*(e*n + e*(b*c*x*log(F) + S(2))*log(d*x) + e)*log(d*x)**n, x), x, F**(c*(a + b*x))*e*x**S(2)*log(d*x)**(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(e*n + e*(b*c*x*log(F) + S(1))*log(d*x) + e)*log(d*x)**n, x), x, F**(c*(a + b*x))*e*x*log(d*x)**(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(b*c*e*x*log(F)*log(d*x) + e*n + e)*log(d*x)**n/x, x), x, F**(c*(a + b*x))*e*log(d*x)**(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(e*n + e*(b*c*x*log(F) + S(-1))*log(d*x) + e)*log(d*x)**n/x**S(2), x), x, F**(c*(a + b*x))*e*log(d*x)**(n + S(1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x))*(e*n + e*(b*c*x*log(F) + S(-2))*log(d*x) + e)*log(d*x)**n/x**S(3), x), x, F**(c*(a + b*x))*e*log(d*x)**(n + S(1))/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(exp(a + b*x)), x), x, S(2)*x**S(4)*sqrt(exp(a + b*x))/b - S(16)*x**S(3)*sqrt(exp(a + b*x))/b**S(2) + S(96)*x**S(2)*sqrt(exp(a + b*x))/b**S(3) - S(384)*x*sqrt(exp(a + b*x))/b**S(4) + S(768)*sqrt(exp(a + b*x))/b**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(exp(a + b*x)), x), x, S(2)*x**S(3)*sqrt(exp(a + b*x))/b - S(12)*x**S(2)*sqrt(exp(a + b*x))/b**S(2) + S(48)*x*sqrt(exp(a + b*x))/b**S(3) - S(96)*sqrt(exp(a + b*x))/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(exp(a + b*x)), x), x, S(2)*x**S(2)*sqrt(exp(a + b*x))/b - S(8)*x*sqrt(exp(a + b*x))/b**S(2) + S(16)*sqrt(exp(a + b*x))/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(exp(a + b*x)), x), x, S(2)*x*sqrt(exp(a + b*x))/b - S(4)*sqrt(exp(a + b*x))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(a + b*x)), x), x, S(2)*sqrt(exp(a + b*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(a + b*x))/x, x), x, exp(-b*x/S(2))*sqrt(exp(a + b*x))*Ei(b*x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(a + b*x))/x**S(2), x), x, b*exp(-b*x/S(2))*sqrt(exp(a + b*x))*Ei(b*x/S(2))/S(2) - sqrt(exp(a + b*x))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(a + b*x))/x**S(3), x), x, b**S(2)*exp(-b*x/S(2))*sqrt(exp(a + b*x))*Ei(b*x/S(2))/S(8) - b*sqrt(exp(a + b*x))/(S(4)*x) - sqrt(exp(a + b*x))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(a + b*x))/x**S(4), x), x, b**S(3)*exp(-b*x/S(2))*sqrt(exp(a + b*x))*Ei(b*x/S(2))/S(48) - b**S(2)*sqrt(exp(a + b*x))/(S(24)*x) - b*sqrt(exp(a + b*x))/(S(12)*x**S(2)) - sqrt(exp(a + b*x))/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) def test_2(): assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(3)/(a + b*f**(c + d*x)), x), x, x**S(3)*log(S(1) + b*f**(c + d*x)/a)/(b*d*log(f)) + S(3)*x**S(2)*polylog(S(2), -b*f**(c + d*x)/a)/(b*d**S(2)*log(f)**S(2)) - S(6)*x*polylog(S(3), -b*f**(c + d*x)/a)/(b*d**S(3)*log(f)**S(3)) + S(6)*polylog(S(4), -b*f**(c + d*x)/a)/(b*d**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(2)/(a + b*f**(c + d*x)), x), x, x**S(2)*log(S(1) + b*f**(c + d*x)/a)/(b*d*log(f)) + S(2)*x*polylog(S(2), -b*f**(c + d*x)/a)/(b*d**S(2)*log(f)**S(2)) - S(2)*polylog(S(3), -b*f**(c + d*x)/a)/(b*d**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x/(a + b*f**(c + d*x)), x), x, x*log(S(1) + b*f**(c + d*x)/a)/(b*d*log(f)) + polylog(S(2), -b*f**(c + d*x)/a)/(b*d**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(a + b*f**(c + d*x)), x), x, log(a + b*f**(c + d*x))/(b*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x*(a + b*f**(c + d*x))), x), x, Integral(f**(c + d*x)/(x*(a + b*f**(c + d*x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x**S(2)*(a + b*f**(c + d*x))), x), x, Integral(f**(c + d*x)/(x**S(2)*(a + b*f**(c + d*x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(3)/(a + b*f**(c + d*x))**S(2), x), x, -x**S(3)/(b*d*(a + b*f**(c + d*x))*log(f)) - S(3)*x**S(2)*log(a*f**(-c - d*x)/b + S(1))/(a*b*d**S(2)*log(f)**S(2)) + S(6)*x*polylog(S(2), -a*f**(-c - d*x)/b)/(a*b*d**S(3)*log(f)**S(3)) + S(6)*polylog(S(3), -a*f**(-c - d*x)/b)/(a*b*d**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(2)/(a + b*f**(c + d*x))**S(2), x), x, -x**S(2)/(b*d*(a + b*f**(c + d*x))*log(f)) - S(2)*x*log(a*f**(-c - d*x)/b + S(1))/(a*b*d**S(2)*log(f)**S(2)) + S(2)*polylog(S(2), -a*f**(-c - d*x)/b)/(a*b*d**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x/(a + b*f**(c + d*x))**S(2), x), x, -x/(b*d*(a + b*f**(c + d*x))*log(f)) + x/(a*b*d*log(f)) - log(a + b*f**(c + d*x))/(a*b*d**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(a + b*f**(c + d*x))**S(2), x), x, -S(1)/(b*d*(a + b*f**(c + d*x))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x*(a + b*f**(c + d*x))**S(2)), x), x, -Integral(S(1)/(x**S(2)*(a + b*f**(c + d*x))), x)/(b*d*log(f)) - S(1)/(b*d*x*(a + b*f**(c + d*x))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x**S(2)*(a + b*f**(c + d*x))**S(2)), x), x, -S(2)*Integral(S(1)/(x**S(3)*(a + b*f**(c + d*x))), x)/(b*d*log(f)) - S(1)/(b*d*x**S(2)*(a + b*f**(c + d*x))*log(f)), expand=True, _diff=True, _numerical=True) # recursion assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(3)/(a + b*f**(c + d*x))**S(3), x), x, -x**S(3)/(S(2)*b*d*(a + b*f**(c + d*x))**S(2)*log(f)) + S(3)*x**S(2)/(S(2)*a*b*d**S(2)*(a + b*f**(c + d*x))*log(f)**S(2)) + x**S(3)/(S(2)*a**S(2)*b*d*log(f)) - S(3)*x**S(2)*log(S(1) + b*f**(c + d*x)/a)/(S(2)*a**S(2)*b*d**S(2)*log(f)**S(2)) + S(3)*x*log(a*f**(-c - d*x)/b + S(1))/(a**S(2)*b*d**S(3)*log(f)**S(3)) - S(3)*x*polylog(S(2), -b*f**(c + d*x)/a)/(a**S(2)*b*d**S(3)*log(f)**S(3)) - S(3)*polylog(S(2), -a*f**(-c - d*x)/b)/(a**S(2)*b*d**S(4)*log(f)**S(4)) + S(3)*polylog(S(3), -b*f**(c + d*x)/a)/(a**S(2)*b*d**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x**S(2)/(a + b*f**(c + d*x))**S(3), x), x, -x**S(2)/(S(2)*b*d*(a + b*f**(c + d*x))**S(2)*log(f)) + x/(a*b*d**S(2)*(a + b*f**(c + d*x))*log(f)**S(2)) + x**S(2)/(S(2)*a**S(2)*b*d*log(f)) - x*log(S(1) + b*f**(c + d*x)/a)/(a**S(2)*b*d**S(2)*log(f)**S(2)) - x/(a**S(2)*b*d**S(2)*log(f)**S(2)) + log(a + b*f**(c + d*x))/(a**S(2)*b*d**S(3)*log(f)**S(3)) - polylog(S(2), -b*f**(c + d*x)/a)/(a**S(2)*b*d**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)*x/(a + b*f**(c + d*x))**S(3), x), x, -x/(S(2)*b*d*(a + b*f**(c + d*x))**S(2)*log(f)) + S(1)/(S(2)*a*b*d**S(2)*(a + b*f**(c + d*x))*log(f)**S(2)) + x/(S(2)*a**S(2)*b*d*log(f)) - log(a + b*f**(c + d*x))/(S(2)*a**S(2)*b*d**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(a + b*f**(c + d*x))**S(3), x), x, -S(1)/(S(2)*b*d*(a + b*f**(c + d*x))**S(2)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x*(a + b*f**(c + d*x))**S(3)), x), x, -Integral(S(1)/(x**S(2)*(a + b*f**(c + d*x))**S(2)), x)/(S(2)*b*d*log(f)) - S(1)/(S(2)*b*d*x*(a + b*f**(c + d*x))**S(2)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c + d*x)/(x**S(2)*(a + b*f**(c + d*x))**S(3)), x), x, -Integral(S(1)/(x**S(3)*(a + b*f**(c + d*x))**S(2)), x)/(b*d*log(f)) - S(1)/(S(2)*b*d*x**S(2)*(a + b*f**(c + d*x))**S(2)*log(f)), expand=True, _diff=True, _numerical=True) def test_3(): assert rubi_test(rubi_integrate(exp(x)/(S(6)*exp(x) + S(4)), x), x, log(S(3)*exp(x) + S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(a + b*exp(x)), x), x, log(a + b*exp(x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(d*x)/(a + b*exp(c + d*x)), x), x, exp(-c)*log(a + b*exp(c + d*x))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(c + d*x)/(a + b*exp(c + d*x)), x), x, log(a + b*exp(c + d*x))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(x))**n*exp(x), x), x, (a + b*exp(x))**(n + S(1))/(b*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c + d*x))**n*exp(d*x), x), x, (a + b*exp(c + d*x))**(n + S(1))*exp(-c)/(b*d*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c + d*x))**n*exp(c + d*x), x), x, (a + b*exp(c + d*x))**(n + S(1))/(b*d*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**x/(F**x*b + a), x), x, log(F**x*b + a)/(b*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(d*x)/(F**(c + d*x)*b + a), x), x, F**(-c)*log(F**(c + d*x)*b + a)/(b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c + d*x)/(F**(c + d*x)*b + a), x), x, log(F**(c + d*x)*b + a)/(b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**x*(F**x*b + a)**n, x), x, (F**x*b + a)**(n + S(1))/(b*(n + S(1))*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(d*x)*(F**(c + d*x)*b + a)**n, x), x, F**(-c)*(F**(c + d*x)*b + a)**(n + S(1))/(b*d*(n + S(1))*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c + d*x)*(F**(c + d*x)*b + a)**n, x), x, (F**(c + d*x)*b + a)**(n + S(1))/(b*d*(n + S(1))*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**m, x), x, -f**a*x**(m + S(1))*(-b*x**S(2)*log(f))**(-m/S(2) + S(-1)/2)*Gamma(m/S(2) + S(1)/2, -b*x**S(2)*log(f))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(11), x), x, -f**a*Gamma(S(6), -b*x**S(2)*log(f))/(S(2)*b**S(6)*log(f)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(9), x), x, f**a*Gamma(S(5), -b*x**S(2)*log(f))/(S(2)*b**S(5)*log(f)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(7), x), x, f**(a + b*x**S(2))*x**S(6)/(S(2)*b*log(f)) - S(3)*f**(a + b*x**S(2))*x**S(4)/(S(2)*b**S(2)*log(f)**S(2)) + S(3)*f**(a + b*x**S(2))*x**S(2)/(b**S(3)*log(f)**S(3)) - S(3)*f**(a + b*x**S(2))/(b**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(5), x), x, f**(a + b*x**S(2))*x**S(4)/(S(2)*b*log(f)) - f**(a + b*x**S(2))*x**S(2)/(b**S(2)*log(f)**S(2)) + f**(a + b*x**S(2))/(b**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(3), x), x, f**(a + b*x**S(2))*x**S(2)/(S(2)*b*log(f)) - f**(a + b*x**S(2))/(S(2)*b**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x, x), x, f**(a + b*x**S(2))/(S(2)*b*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x, x), x, f**a*Ei(b*x**S(2)*log(f))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(3), x), x, b*f**a*log(f)*Ei(b*x**S(2)*log(f))/S(2) - f**(a + b*x**S(2))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(5), x), x, b**S(2)*f**a*log(f)**S(2)*Ei(b*x**S(2)*log(f))/S(4) - b*f**(a + b*x**S(2))*log(f)/(S(4)*x**S(2)) - f**(a + b*x**S(2))/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(7), x), x, b**S(3)*f**a*log(f)**S(3)*Ei(b*x**S(2)*log(f))/S(12) - b**S(2)*f**(a + b*x**S(2))*log(f)**S(2)/(S(12)*x**S(2)) - b*f**(a + b*x**S(2))*log(f)/(S(12)*x**S(4)) - f**(a + b*x**S(2))/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(9), x), x, -b**S(4)*f**a*Gamma(S(-4), -b*x**S(2)*log(f))*log(f)**S(4)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(11), x), x, b**S(5)*f**a*Gamma(S(-5), -b*x**S(2)*log(f))*log(f)**S(5)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(12), x), x, -f**a*x**S(13)*Gamma(S(13)/2, -b*x**S(2)*log(f))/(S(2)*(-b*x**S(2)*log(f))**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(10), x), x, -f**a*x**S(11)*Gamma(S(11)/2, -b*x**S(2)*log(f))/(S(2)*(-b*x**S(2)*log(f))**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(8), x), x, f**(a + b*x**S(2))*x**S(7)/(S(2)*b*log(f)) - S(7)*f**(a + b*x**S(2))*x**S(5)/(S(4)*b**S(2)*log(f)**S(2)) + S(35)*f**(a + b*x**S(2))*x**S(3)/(S(8)*b**S(3)*log(f)**S(3)) - S(105)*f**(a + b*x**S(2))*x/(S(16)*b**S(4)*log(f)**S(4)) + S(105)*sqrt(pi)*f**a*erfi(sqrt(b)*x*sqrt(log(f)))/(S(32)*b**(S(9)/2)*log(f)**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(6), x), x, f**(a + b*x**S(2))*x**S(5)/(S(2)*b*log(f)) - S(5)*f**(a + b*x**S(2))*x**S(3)/(S(4)*b**S(2)*log(f)**S(2)) + S(15)*f**(a + b*x**S(2))*x/(S(8)*b**S(3)*log(f)**S(3)) - S(15)*sqrt(pi)*f**a*erfi(sqrt(b)*x*sqrt(log(f)))/(S(16)*b**(S(7)/2)*log(f)**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(4), x), x, f**(a + b*x**S(2))*x**S(3)/(S(2)*b*log(f)) - S(3)*f**(a + b*x**S(2))*x/(S(4)*b**S(2)*log(f)**S(2)) + S(3)*sqrt(pi)*f**a*erfi(sqrt(b)*x*sqrt(log(f)))/(S(8)*b**(S(5)/2)*log(f)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))*x**S(2), x), x, f**(a + b*x**S(2))*x/(S(2)*b*log(f)) - sqrt(pi)*f**a*erfi(sqrt(b)*x*sqrt(log(f)))/(S(4)*b**(S(3)/2)*log(f)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2)), x), x, sqrt(pi)*f**a*erfi(sqrt(b)*x*sqrt(log(f)))/(S(2)*sqrt(b)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(2), x), x, sqrt(pi)*sqrt(b)*f**a*sqrt(log(f))*erfi(sqrt(b)*x*sqrt(log(f))) - f**(a + b*x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(4), x), x, S(2)*sqrt(pi)*b**(S(3)/2)*f**a*log(f)**(S(3)/2)*erfi(sqrt(b)*x*sqrt(log(f)))/S(3) - S(2)*b*f**(a + b*x**S(2))*log(f)/(S(3)*x) - f**(a + b*x**S(2))/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(6), x), x, S(4)*sqrt(pi)*b**(S(5)/2)*f**a*log(f)**(S(5)/2)*erfi(sqrt(b)*x*sqrt(log(f)))/S(15) - S(4)*b**S(2)*f**(a + b*x**S(2))*log(f)**S(2)/(S(15)*x) - S(2)*b*f**(a + b*x**S(2))*log(f)/(S(15)*x**S(3)) - f**(a + b*x**S(2))/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(8), x), x, S(8)*sqrt(pi)*b**(S(7)/2)*f**a*log(f)**(S(7)/2)*erfi(sqrt(b)*x*sqrt(log(f)))/S(105) - S(8)*b**S(3)*f**(a + b*x**S(2))*log(f)**S(3)/(S(105)*x) - S(4)*b**S(2)*f**(a + b*x**S(2))*log(f)**S(2)/(S(105)*x**S(3)) - S(2)*b*f**(a + b*x**S(2))*log(f)/(S(35)*x**S(5)) - f**(a + b*x**S(2))/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(10), x), x, -f**a*(-b*x**S(2)*log(f))**(S(9)/2)*Gamma(S(-9)/2, -b*x**S(2)*log(f))/(S(2)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(2))/x**S(12), x), x, -f**a*(-b*x**S(2)*log(f))**(S(11)/2)*Gamma(S(-11)/2, -b*x**S(2)*log(f))/(S(2)*x**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**m, x), x, -f**a*x**(m + S(1))*(-b*x**S(3)*log(f))**(-m/S(3) + S(-1)/3)*Gamma(m/S(3) + S(1)/3, -b*x**S(3)*log(f))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(17), x), x, -f**a*Gamma(S(6), -b*x**S(3)*log(f))/(S(3)*b**S(6)*log(f)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(14), x), x, f**a*Gamma(S(5), -b*x**S(3)*log(f))/(S(3)*b**S(5)*log(f)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(11), x), x, f**(a + b*x**S(3))*x**S(9)/(S(3)*b*log(f)) - f**(a + b*x**S(3))*x**S(6)/(b**S(2)*log(f)**S(2)) + S(2)*f**(a + b*x**S(3))*x**S(3)/(b**S(3)*log(f)**S(3)) - S(2)*f**(a + b*x**S(3))/(b**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(8), x), x, f**(a + b*x**S(3))*x**S(6)/(S(3)*b*log(f)) - S(2)*f**(a + b*x**S(3))*x**S(3)/(S(3)*b**S(2)*log(f)**S(2)) + S(2)*f**(a + b*x**S(3))/(S(3)*b**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(5), x), x, f**(a + b*x**S(3))*x**S(3)/(S(3)*b*log(f)) - f**(a + b*x**S(3))/(S(3)*b**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(2), x), x, f**(a + b*x**S(3))/(S(3)*b*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x, x), x, f**a*Ei(b*x**S(3)*log(f))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(4), x), x, b*f**a*log(f)*Ei(b*x**S(3)*log(f))/S(3) - f**(a + b*x**S(3))/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(7), x), x, b**S(2)*f**a*log(f)**S(2)*Ei(b*x**S(3)*log(f))/S(6) - b*f**(a + b*x**S(3))*log(f)/(S(6)*x**S(3)) - f**(a + b*x**S(3))/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(10), x), x, b**S(3)*f**a*log(f)**S(3)*Ei(b*x**S(3)*log(f))/S(18) - b**S(2)*f**(a + b*x**S(3))*log(f)**S(2)/(S(18)*x**S(3)) - b*f**(a + b*x**S(3))*log(f)/(S(18)*x**S(6)) - f**(a + b*x**S(3))/(S(9)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(13), x), x, -b**S(4)*f**a*Gamma(S(-4), -b*x**S(3)*log(f))*log(f)**S(4)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(16), x), x, b**S(5)*f**a*Gamma(S(-5), -b*x**S(3)*log(f))*log(f)**S(5)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(4), x), x, -f**a*x**S(5)*Gamma(S(5)/3, -b*x**S(3)*log(f))/(S(3)*(-b*x**S(3)*log(f))**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x**S(3), x), x, -f**a*x**S(4)*Gamma(S(4)/3, -b*x**S(3)*log(f))/(S(3)*(-b*x**S(3)*log(f))**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))*x, x), x, -f**a*x**S(2)*Gamma(S(2)/3, -b*x**S(3)*log(f))/(S(3)*(-b*x**S(3)*log(f))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3)), x), x, -f**a*x*Gamma(S(1)/3, -b*x**S(3)*log(f))/(S(3)*(-b*x**S(3)*log(f))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(2), x), x, -f**a*(-b*x**S(3)*log(f))**(S(1)/3)*Gamma(S(-1)/3, -b*x**S(3)*log(f))/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**S(3))/x**S(3), x), x, -f**a*(-b*x**S(3)*log(f))**(S(2)/3)*Gamma(S(-2)/3, -b*x**S(3)*log(f))/(S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(S(4)*x**S(3)), x), x, exp(S(4)*x**S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)*x**m, x), x, f**a*x**(m + S(1))*(-b*log(f)/x)**(m + S(1))*Gamma(-m + S(-1), -b*log(f)/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)*x**S(4), x), x, -b**S(5)*f**a*Gamma(S(-5), -b*log(f)/x)*log(f)**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)*x**S(3), x), x, b**S(4)*f**a*Gamma(S(-4), -b*log(f)/x)*log(f)**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)*x**S(2), x), x, -b**S(3)*f**a*log(f)**S(3)*Ei(b*log(f)/x)/S(6) + b**S(2)*f**(a + b/x)*x*log(f)**S(2)/S(6) + b*f**(a + b/x)*x**S(2)*log(f)/S(6) + f**(a + b/x)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)*x, x), x, -b**S(2)*f**a*log(f)**S(2)*Ei(b*log(f)/x)/S(2) + b*f**(a + b/x)*x*log(f)/S(2) + f**(a + b/x)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x), x), x, -b*f**a*log(f)*Ei(b*log(f)/x) + f**(a + b/x)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x, x), x, -f**a*Ei(b*log(f)/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(2), x), x, -f**(a + b/x)/(b*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(3), x), x, -f**(a + b/x)/(b*x*log(f)) + f**(a + b/x)/(b**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(4), x), x, -f**(a + b/x)/(b*x**S(2)*log(f)) + S(2)*f**(a + b/x)/(b**S(2)*x*log(f)**S(2)) - S(2)*f**(a + b/x)/(b**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(5), x), x, -f**(a + b/x)/(b*x**S(3)*log(f)) + S(3)*f**(a + b/x)/(b**S(2)*x**S(2)*log(f)**S(2)) - S(6)*f**(a + b/x)/(b**S(3)*x*log(f)**S(3)) + S(6)*f**(a + b/x)/(b**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(6), x), x, -f**a*Gamma(S(5), -b*log(f)/x)/(b**S(5)*log(f)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x)/x**S(7), x), x, f**a*Gamma(S(6), -b*log(f)/x)/(b**S(6)*log(f)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**m, x), x, f**a*x**(m + S(1))*(-b*log(f)/x**S(2))**(m/S(2) + S(1)/2)*Gamma(-m/S(2) + S(-1)/2, -b*log(f)/x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(9), x), x, -b**S(5)*f**a*Gamma(S(-5), -b*log(f)/x**S(2))*log(f)**S(5)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(7), x), x, b**S(4)*f**a*Gamma(S(-4), -b*log(f)/x**S(2))*log(f)**S(4)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(5), x), x, -b**S(3)*f**a*log(f)**S(3)*Ei(b*log(f)/x**S(2))/S(12) + b**S(2)*f**(a + b/x**S(2))*x**S(2)*log(f)**S(2)/S(12) + b*f**(a + b/x**S(2))*x**S(4)*log(f)/S(12) + f**(a + b/x**S(2))*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(3), x), x, -b**S(2)*f**a*log(f)**S(2)*Ei(b*log(f)/x**S(2))/S(4) + b*f**(a + b/x**S(2))*x**S(2)*log(f)/S(4) + f**(a + b/x**S(2))*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x, x), x, -b*f**a*log(f)*Ei(b*log(f)/x**S(2))/S(2) + f**(a + b/x**S(2))*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x, x), x, -f**a*Ei(b*log(f)/x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(3), x), x, -f**(a + b/x**S(2))/(S(2)*b*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(5), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(2)*log(f)) + f**(a + b/x**S(2))/(S(2)*b**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(7), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(4)*log(f)) + f**(a + b/x**S(2))/(b**S(2)*x**S(2)*log(f)**S(2)) - f**(a + b/x**S(2))/(b**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(9), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(6)*log(f)) + S(3)*f**(a + b/x**S(2))/(S(2)*b**S(2)*x**S(4)*log(f)**S(2)) - S(3)*f**(a + b/x**S(2))/(b**S(3)*x**S(2)*log(f)**S(3)) + S(3)*f**(a + b/x**S(2))/(b**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(11), x), x, -f**a*Gamma(S(5), -b*log(f)/x**S(2))/(S(2)*b**S(5)*log(f)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(13), x), x, f**a*Gamma(S(6), -b*log(f)/x**S(2))/(S(2)*b**S(6)*log(f)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(10), x), x, f**a*x**S(11)*(-b*log(f)/x**S(2))**(S(11)/2)*Gamma(S(-11)/2, -b*log(f)/x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(8), x), x, f**a*x**S(9)*(-b*log(f)/x**S(2))**(S(9)/2)*Gamma(S(-9)/2, -b*log(f)/x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(6), x), x, -S(8)*sqrt(pi)*b**(S(7)/2)*f**a*log(f)**(S(7)/2)*erfi(sqrt(b)*sqrt(log(f))/x)/S(105) + S(8)*b**S(3)*f**(a + b/x**S(2))*x*log(f)**S(3)/S(105) + S(4)*b**S(2)*f**(a + b/x**S(2))*x**S(3)*log(f)**S(2)/S(105) + S(2)*b*f**(a + b/x**S(2))*x**S(5)*log(f)/S(35) + f**(a + b/x**S(2))*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(4), x), x, -S(4)*sqrt(pi)*b**(S(5)/2)*f**a*log(f)**(S(5)/2)*erfi(sqrt(b)*sqrt(log(f))/x)/S(15) + S(4)*b**S(2)*f**(a + b/x**S(2))*x*log(f)**S(2)/S(15) + S(2)*b*f**(a + b/x**S(2))*x**S(3)*log(f)/S(15) + f**(a + b/x**S(2))*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))*x**S(2), x), x, -S(2)*sqrt(pi)*b**(S(3)/2)*f**a*log(f)**(S(3)/2)*erfi(sqrt(b)*sqrt(log(f))/x)/S(3) + S(2)*b*f**(a + b/x**S(2))*x*log(f)/S(3) + f**(a + b/x**S(2))*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2)), x), x, -sqrt(pi)*sqrt(b)*f**a*sqrt(log(f))*erfi(sqrt(b)*sqrt(log(f))/x) + f**(a + b/x**S(2))*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(2), x), x, -sqrt(pi)*f**a*erfi(sqrt(b)*sqrt(log(f))/x)/(S(2)*sqrt(b)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(4), x), x, -f**(a + b/x**S(2))/(S(2)*b*x*log(f)) + sqrt(pi)*f**a*erfi(sqrt(b)*sqrt(log(f))/x)/(S(4)*b**(S(3)/2)*log(f)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(6), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(3)*log(f)) + S(3)*f**(a + b/x**S(2))/(S(4)*b**S(2)*x*log(f)**S(2)) - S(3)*sqrt(pi)*f**a*erfi(sqrt(b)*sqrt(log(f))/x)/(S(8)*b**(S(5)/2)*log(f)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(8), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(5)*log(f)) + S(5)*f**(a + b/x**S(2))/(S(4)*b**S(2)*x**S(3)*log(f)**S(2)) - S(15)*f**(a + b/x**S(2))/(S(8)*b**S(3)*x*log(f)**S(3)) + S(15)*sqrt(pi)*f**a*erfi(sqrt(b)*sqrt(log(f))/x)/(S(16)*b**(S(7)/2)*log(f)**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(10), x), x, -f**(a + b/x**S(2))/(S(2)*b*x**S(7)*log(f)) + S(7)*f**(a + b/x**S(2))/(S(4)*b**S(2)*x**S(5)*log(f)**S(2)) - S(35)*f**(a + b/x**S(2))/(S(8)*b**S(3)*x**S(3)*log(f)**S(3)) + S(105)*f**(a + b/x**S(2))/(S(16)*b**S(4)*x*log(f)**S(4)) - S(105)*sqrt(pi)*f**a*erfi(sqrt(b)*sqrt(log(f))/x)/(S(32)*b**(S(9)/2)*log(f)**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(12), x), x, f**a*Gamma(S(11)/2, -b*log(f)/x**S(2))/(S(2)*x**S(11)*(-b*log(f)/x**S(2))**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(2))/x**S(14), x), x, f**a*Gamma(S(13)/2, -b*log(f)/x**S(2))/(S(2)*x**S(13)*(-b*log(f)/x**S(2))**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**m, x), x, f**a*x**(m + S(1))*(-b*log(f)/x**S(3))**(m/S(3) + S(1)/3)*Gamma(-m/S(3) + S(-1)/3, -b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(14), x), x, -b**S(5)*f**a*Gamma(S(-5), -b*log(f)/x**S(3))*log(f)**S(5)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(11), x), x, b**S(4)*f**a*Gamma(S(-4), -b*log(f)/x**S(3))*log(f)**S(4)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(8), x), x, -b**S(3)*f**a*log(f)**S(3)*Ei(b*log(f)/x**S(3))/S(18) + b**S(2)*f**(a + b/x**S(3))*x**S(3)*log(f)**S(2)/S(18) + b*f**(a + b/x**S(3))*x**S(6)*log(f)/S(18) + f**(a + b/x**S(3))*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(5), x), x, -b**S(2)*f**a*log(f)**S(2)*Ei(b*log(f)/x**S(3))/S(6) + b*f**(a + b/x**S(3))*x**S(3)*log(f)/S(6) + f**(a + b/x**S(3))*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(2), x), x, -b*f**a*log(f)*Ei(b*log(f)/x**S(3))/S(3) + f**(a + b/x**S(3))*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x, x), x, -f**a*Ei(b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(4), x), x, -f**(a + b/x**S(3))/(S(3)*b*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(7), x), x, -f**(a + b/x**S(3))/(S(3)*b*x**S(3)*log(f)) + f**(a + b/x**S(3))/(S(3)*b**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(10), x), x, -f**(a + b/x**S(3))/(S(3)*b*x**S(6)*log(f)) + S(2)*f**(a + b/x**S(3))/(S(3)*b**S(2)*x**S(3)*log(f)**S(2)) - S(2)*f**(a + b/x**S(3))/(S(3)*b**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(13), x), x, -f**(a + b/x**S(3))/(S(3)*b*x**S(9)*log(f)) + f**(a + b/x**S(3))/(b**S(2)*x**S(6)*log(f)**S(2)) - S(2)*f**(a + b/x**S(3))/(b**S(3)*x**S(3)*log(f)**S(3)) + S(2)*f**(a + b/x**S(3))/(b**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(16), x), x, -f**a*Gamma(S(5), -b*log(f)/x**S(3))/(S(3)*b**S(5)*log(f)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(19), x), x, f**a*Gamma(S(6), -b*log(f)/x**S(3))/(S(3)*b**S(6)*log(f)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(4), x), x, f**a*x**S(5)*(-b*log(f)/x**S(3))**(S(5)/3)*Gamma(S(-5)/3, -b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x**S(3), x), x, f**a*x**S(4)*(-b*log(f)/x**S(3))**(S(4)/3)*Gamma(S(-4)/3, -b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))*x, x), x, f**a*x**S(2)*(-b*log(f)/x**S(3))**(S(2)/3)*Gamma(S(-2)/3, -b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3)), x), x, f**a*x*(-b*log(f)/x**S(3))**(S(1)/3)*Gamma(S(-1)/3, -b*log(f)/x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(2), x), x, f**a*Gamma(S(1)/3, -b*log(f)/x**S(3))/(S(3)*x*(-b*log(f)/x**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(3), x), x, f**a*Gamma(S(2)/3, -b*log(f)/x**S(3))/(S(3)*x**S(2)*(-b*log(f)/x**S(3))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b/x**S(3))/x**S(5), x), x, f**a*Gamma(S(4)/3, -b*log(f)/x**S(3))/(S(3)*x**S(4)*(-b*log(f)/x**S(3))**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**m, x), x, -f**a*x**(m + S(1))*(-b*x**n*log(f))**(-(m + S(1))/n)*Gamma((m + S(1))/n, -b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**S(3), x), x, -f**a*x**S(4)*(-b*x**n*log(f))**(-S(4)/n)*Gamma(S(4)/n, -b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**S(2), x), x, -f**a*x**S(3)*(-b*x**n*log(f))**(-S(3)/n)*Gamma(S(3)/n, -b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x, x), x, -f**a*x**S(2)*(-b*x**n*log(f))**(-S(2)/n)*Gamma(S(2)/n, -b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n), x), x, -f**a*x*(-b*x**n*log(f))**(-S(1)/n)*Gamma(S(1)/n, -b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)/x, x), x, f**a*Ei(b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)/x**S(2), x), x, -f**a*(-b*x**n*log(f))**(S(1)/n)*Gamma(-S(1)/n, -b*x**n*log(f))/(n*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)/x**S(3), x), x, -f**a*(-b*x**n*log(f))**(S(2)/n)*Gamma(-S(2)/n, -b*x**n*log(f))/(n*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)/x**S(4), x), x, -f**a*(-b*x**n*log(f))**(S(3)/n)*Gamma(-S(3)/n, -b*x**n*log(f))/(n*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(S(3)*n + S(-1)), x), x, f**(a + b*x**n)*x**(S(2)*n)/(b*n*log(f)) - S(2)*f**(a + b*x**n)*x**n/(b**S(2)*n*log(f)**S(2)) + S(2)*f**(a + b*x**n)/(b**S(3)*n*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(S(2)*n + S(-1)), x), x, f**(a + b*x**n)*x**n/(b*n*log(f)) - f**(a + b*x**n)/(b**S(2)*n*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(n + S(-1)), x), x, f**(a + b*x**n)/(b*n*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)/x, x), x, f**a*Ei(b*x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(-n + S(-1)), x), x, b*f**a*log(f)*Ei(b*x**n*log(f))/n - f**(a + b*x**n)*x**(-n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(-S(2)*n + S(-1)), x), x, b**S(2)*f**a*log(f)**S(2)*Ei(b*x**n*log(f))/(S(2)*n) - b*f**(a + b*x**n)*x**(-n)*log(f)/(S(2)*n) - f**(a + b*x**n)*x**(-S(2)*n)/(S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(S(5)*n/S(2) + S(-1)), x), x, f**(a + b*x**n)*x**(S(3)*n/S(2))/(b*n*log(f)) - S(3)*f**(a + b*x**n)*x**(n/S(2))/(S(2)*b**S(2)*n*log(f)**S(2)) + S(3)*sqrt(pi)*f**a*erfi(sqrt(b)*x**(n/S(2))*sqrt(log(f)))/(S(4)*b**(S(5)/2)*n*log(f)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(S(3)*n/S(2) + S(-1)), x), x, f**(a + b*x**n)*x**(n/S(2))/(b*n*log(f)) - sqrt(pi)*f**a*erfi(sqrt(b)*x**(n/S(2))*sqrt(log(f)))/(S(2)*b**(S(3)/2)*n*log(f)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(n/S(2) + S(-1)), x), x, sqrt(pi)*f**a*erfi(sqrt(b)*x**(n/S(2))*sqrt(log(f)))/(sqrt(b)*n*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(-n/S(2) + S(-1)), x), x, S(2)*sqrt(pi)*sqrt(b)*f**a*sqrt(log(f))*erfi(sqrt(b)*x**(n/S(2))*sqrt(log(f)))/n - S(2)*f**(a + b*x**n)*x**(-n/S(2))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x**n)*x**(-S(3)*n/S(2) + S(-1)), x), x, S(4)*sqrt(pi)*b**(S(3)/2)*f**a*log(f)**(S(3)/2)*erfi(sqrt(b)*x**(n/S(2))*sqrt(log(f)))/(S(3)*n) - S(4)*b*f**(a + b*x**n)*x**(-n/S(2))*log(f)/(S(3)*n) - S(2)*f**(a + b*x**n)*x**(-S(3)*n/S(2))/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(-0.1*x), x), x, -10.0*x*exp(-0.1*x) - 100.0*exp(-0.1*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))*x**m, x), x, Integral(f**(a**S(2)*c + S(2)*a*b*c*x + b**S(2)*c*x**S(2))*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))*x**S(3), x), x, -sqrt(pi)*a**S(3)*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(2)*b**S(4)*sqrt(c)*sqrt(log(f))) + S(3)*a**S(2)*f**(c*(a + b*x)**S(2))/(S(2)*b**S(4)*c*log(f)) - S(3)*a*f**(c*(a + b*x)**S(2))*(a + b*x)/(S(2)*b**S(4)*c*log(f)) + S(3)*sqrt(pi)*a*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(4)*b**S(4)*c**(S(3)/2)*log(f)**(S(3)/2)) + f**(c*(a + b*x)**S(2))*(a + b*x)**S(2)/(S(2)*b**S(4)*c*log(f)) - f**(c*(a + b*x)**S(2))/(S(2)*b**S(4)*c**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))*x**S(2), x), x, sqrt(pi)*a**S(2)*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(2)*b**S(3)*sqrt(c)*sqrt(log(f))) - a*f**(c*(a + b*x)**S(2))/(b**S(3)*c*log(f)) + f**(c*(a + b*x)**S(2))*(a + b*x)/(S(2)*b**S(3)*c*log(f)) - sqrt(pi)*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(4)*b**S(3)*c**(S(3)/2)*log(f)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))*x, x), x, -sqrt(pi)*a*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(2)*b**S(2)*sqrt(c)*sqrt(log(f))) + f**(c*(a + b*x)**S(2))/(S(2)*b**S(2)*c*log(f)), expand=True, _diff=True, _numerical=True) # long time in rubi_test(1940 is matched before 1909) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2)), x), x, sqrt(pi)*erfi(sqrt(c)*(a + b*x)*sqrt(log(f)))/(S(2)*b*sqrt(c)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))/x, x), x, Integral(f**(c*(a + b*x)**S(2))/x, x), expand=True, _diff=True, _numerical=True) # long time in rubi_test(1940 is matched before 1909) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))/x**S(2), x), x, S(2)*a*b*c*log(f)*Integral(f**(c*(a + b*x)**S(2))/x, x) + sqrt(pi)*b*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*(a + b*x)*sqrt(log(f))) - f**(c*(a + b*x)**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(2))/x**S(3), x), x, S(2)*a**S(2)*b**S(2)*c**S(2)*log(f)**S(2)*Integral(f**(c*(a + b*x)**S(2))/x, x) + sqrt(pi)*a*b**S(2)*c**(S(3)/2)*log(f)**(S(3)/2)*erfi(sqrt(c)*(a + b*x)*sqrt(log(f))) - a*b*c*f**(c*(a + b*x)**S(2))*log(f)/x + b**S(2)*c*log(f)*Integral(f**(c*(a + b*x)**S(2))/x, x) - f**(c*(a + b*x)**S(2))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))*x**m, x), x, Integral(f**(c*(a + b*x)**S(3))*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))*x**S(2), x), x, -a**S(2)*(a + b*x)*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))/(S(3)*b**S(3)*(-c*(a + b*x)**S(3)*log(f))**(S(1)/3)) + S(2)*a*(a + b*x)**S(2)*Gamma(S(2)/3, -c*(a + b*x)**S(3)*log(f))/(S(3)*b**S(3)*(-c*(a + b*x)**S(3)*log(f))**(S(2)/3)) + f**(c*(a + b*x)**S(3))/(S(3)*b**S(3)*c*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))*x, x), x, a*(a + b*x)*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))/(S(3)*b**S(2)*(-c*(a + b*x)**S(3)*log(f))**(S(1)/3)) - (a + b*x)**S(2)*Gamma(S(2)/3, -c*(a + b*x)**S(3)*log(f))/(S(3)*b**S(2)*(-c*(a + b*x)**S(3)*log(f))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3)), x), x, (-a/S(3) - b*x/S(3))*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))/(b*(-c*(a + b*x)**S(3)*log(f))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))/x, x), x, Integral(f**(c*(a + b*x)**S(3))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))/x**S(2), x), x, S(3)*a**S(2)*b*c*log(f)*Integral(f**(c*(a + b*x)**S(3))/x, x) - a*b*c*(a + b*x)*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))*log(f)/(-c*(a + b*x)**S(3)*log(f))**(S(1)/3) - b*c*(a + b*x)**S(2)*Gamma(S(2)/3, -c*(a + b*x)**S(3)*log(f))*log(f)/(-c*(a + b*x)**S(3)*log(f))**(S(2)/3) - f**(c*(a + b*x)**S(3))/x, expand=True, _diff=True, _numerical=True) # difference in simplify of sympy and mathematica assert rubi_test(rubi_integrate(f**(c*(a + b*x)**S(3))/x**S(3), x), x, S(9)*a**S(4)*b**S(2)*c**S(2)*log(f)**S(2)*Integral(f**(c*(a + b*x)**S(3))/x, x)/S(2) - S(3)*a**S(3)*b**S(2)*c**S(2)*(a + b*x)*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))*log(f)**S(2)/(S(2)*(-c*(a + b*x)**S(3)*log(f))**(S(1)/3)) - S(3)*a**S(2)*b**S(2)*c**S(2)*(a + b*x)**S(2)*Gamma(S(2)/3, -c*(a + b*x)**S(3)*log(f))*log(f)**S(2)/(S(2)*(-c*(a + b*x)**S(3)*log(f))**(S(2)/3)) - S(3)*a**S(2)*b*c*f**(c*(a + b*x)**S(3))*log(f)/(S(2)*x) + S(3)*a*b**S(2)*c*log(f)*Integral(f**(c*(a + b*x)**S(3))/x, x) - b**S(2)*c*(a + b*x)*Gamma(S(1)/3, -c*(a + b*x)**S(3)*log(f))*log(f)/(S(2)*(-c*(a + b*x)**S(3)*log(f))**(S(1)/3)) - f**(c*(a + b*x)**S(3))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, Integral(x**m*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, -a**S(4)*(a + b*x)*Gamma(S(1)/3, -(a + b*x)**S(3))/(S(3)*b**S(5)*(-(a + b*x)**S(3))**(S(1)/3)) + S(4)*a**S(3)*(a + b*x)**S(2)*Gamma(S(2)/3, -(a + b*x)**S(3))/(S(3)*b**S(5)*(-(a + b*x)**S(3))**(S(2)/3)) + S(2)*a**S(2)*exp((a + b*x)**S(3))/b**S(5) + S(4)*a*(a + b*x)**S(4)*Gamma(S(4)/3, -(a + b*x)**S(3))/(S(3)*b**S(5)*(-(a + b*x)**S(3))**(S(4)/3)) - (a + b*x)**S(5)*Gamma(S(5)/3, -(a + b*x)**S(3))/(S(3)*b**S(5)*(-(a + b*x)**S(3))**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, a**S(3)*(a + b*x)*Gamma(S(1)/3, -(a + b*x)**S(3))/(S(3)*b**S(4)*(-(a + b*x)**S(3))**(S(1)/3)) - a**S(2)*(a + b*x)**S(2)*Gamma(S(2)/3, -(a + b*x)**S(3))/(b**S(4)*(-(a + b*x)**S(3))**(S(2)/3)) - a*exp((a + b*x)**S(3))/b**S(4) - (a + b*x)**S(4)*Gamma(S(4)/3, -(a + b*x)**S(3))/(S(3)*b**S(4)*(-(a + b*x)**S(3))**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, -a**S(2)*(a + b*x)*Gamma(S(1)/3, -(a + b*x)**S(3))/(S(3)*b**S(3)*(-(a + b*x)**S(3))**(S(1)/3)) + S(2)*a*(a + b*x)**S(2)*Gamma(S(2)/3, -(a + b*x)**S(3))/(S(3)*b**S(3)*(-(a + b*x)**S(3))**(S(2)/3)) + exp((a + b*x)**S(3))/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, a*(a + b*x)*Gamma(S(1)/3, -(a + b*x)**S(3))/(S(3)*b**S(2)*(-(a + b*x)**S(3))**(S(1)/3)) - (a + b*x)**S(2)*Gamma(S(2)/3, -(a + b*x)**S(3))/(S(3)*b**S(2)*(-(a + b*x)**S(3))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, (-a/S(3) - b*x/S(3))*Gamma(S(1)/3, -(a + b*x)**S(3))/(b*(-(a + b*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))/x, x), x, Integral(exp(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(sqrt(S(3)*x + S(5))), x), x, S(2)*sqrt(S(3)*x + S(5))*exp(sqrt(S(3)*x + S(5)))/S(3) - S(2)*exp(sqrt(S(3)*x + S(5)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))*x**m, x), x, Integral(f**(c/(a + b*x))*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))*x**S(4), x), x, -a**S(4)*c*log(f)*Ei(c*log(f)/(a + b*x))/b**S(5) + a**S(4)*f**(c/(a + b*x))*(a + b*x)/b**S(5) + S(2)*a**S(3)*c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x))/b**S(5) - S(2)*a**S(3)*c*f**(c/(a + b*x))*(a + b*x)*log(f)/b**S(5) - S(2)*a**S(3)*f**(c/(a + b*x))*(a + b*x)**S(2)/b**S(5) - a**S(2)*c**S(3)*log(f)**S(3)*Ei(c*log(f)/(a + b*x))/b**S(5) + a**S(2)*c**S(2)*f**(c/(a + b*x))*(a + b*x)*log(f)**S(2)/b**S(5) + a**S(2)*c*f**(c/(a + b*x))*(a + b*x)**S(2)*log(f)/b**S(5) + S(2)*a**S(2)*f**(c/(a + b*x))*(a + b*x)**S(3)/b**S(5) - S(4)*a*c**S(4)*Gamma(S(-4), -c*log(f)/(a + b*x))*log(f)**S(4)/b**S(5) - c**S(5)*Gamma(S(-5), -c*log(f)/(a + b*x))*log(f)**S(5)/b**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))*x**S(3), x), x, a**S(3)*c*log(f)*Ei(c*log(f)/(a + b*x))/b**S(4) - a**S(3)*f**(c/(a + b*x))*(a + b*x)/b**S(4) - S(3)*a**S(2)*c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x))/(S(2)*b**S(4)) + S(3)*a**S(2)*c*f**(c/(a + b*x))*(a + b*x)*log(f)/(S(2)*b**S(4)) + S(3)*a**S(2)*f**(c/(a + b*x))*(a + b*x)**S(2)/(S(2)*b**S(4)) + a*c**S(3)*log(f)**S(3)*Ei(c*log(f)/(a + b*x))/(S(2)*b**S(4)) - a*c**S(2)*f**(c/(a + b*x))*(a + b*x)*log(f)**S(2)/(S(2)*b**S(4)) - a*c*f**(c/(a + b*x))*(a + b*x)**S(2)*log(f)/(S(2)*b**S(4)) - a*f**(c/(a + b*x))*(a + b*x)**S(3)/b**S(4) + c**S(4)*Gamma(S(-4), -c*log(f)/(a + b*x))*log(f)**S(4)/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))*x**S(2), x), x, -a**S(2)*c*log(f)*Ei(c*log(f)/(a + b*x))/b**S(3) + a**S(2)*f**(c/(a + b*x))*(a + b*x)/b**S(3) + a*c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x))/b**S(3) - a*c*f**(c/(a + b*x))*(a + b*x)*log(f)/b**S(3) - a*f**(c/(a + b*x))*(a + b*x)**S(2)/b**S(3) - c**S(3)*log(f)**S(3)*Ei(c*log(f)/(a + b*x))/(S(6)*b**S(3)) + c**S(2)*f**(c/(a + b*x))*(a + b*x)*log(f)**S(2)/(S(6)*b**S(3)) + c*f**(c/(a + b*x))*(a + b*x)**S(2)*log(f)/(S(6)*b**S(3)) + f**(c/(a + b*x))*(a + b*x)**S(3)/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))*x, x), x, a*c*log(f)*Ei(c*log(f)/(a + b*x))/b**S(2) - a*f**(c/(a + b*x))*(a + b*x)/b**S(2) - c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x))/(S(2)*b**S(2)) + c*f**(c/(a + b*x))*(a + b*x)*log(f)/(S(2)*b**S(2)) + f**(c/(a + b*x))*(a + b*x)**S(2)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)), x), x, -c*log(f)*Ei(c*log(f)/(a + b*x))/b + f**(c/(a + b*x))*(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))/x, x), x, f**(c/a)*Ei(-b*c*x*log(f)/(a*(a + b*x))) - Ei(c*log(f)/(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))/x**S(2), x), x, -f**(c/(a + b*x))/x - b*f**(c/(a + b*x))/a - b*c*f**(c/a)*log(f)*Ei(-b*c*x*log(f)/(a*(a + b*x)))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x))/x**S(3), x), x, -f**(c/(a + b*x))/(S(2)*x**S(2)) + b**S(2)*f**(c/(a + b*x))/(S(2)*a**S(2)) + b*c*f**(c/(a + b*x))*log(f)/(S(2)*a**S(2)*x) + b**S(2)*c*f**(c/a)*log(f)*Ei(-b*c*x*log(f)/(a*(a + b*x)))/a**S(3) + b**S(2)*c*f**(c/(a + b*x))*log(f)/(S(2)*a**S(3)) + b**S(2)*c**S(2)*f**(c/a)*log(f)**S(2)*Ei(-b*c*x*log(f)/(a*(a + b*x)))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))*x**m, x), x, Integral(f**(c/(a + b*x)**S(2))*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))*x**S(4), x), x, -sqrt(pi)*a**S(4)*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(5) + a**S(4)*f**(c/(a + b*x)**S(2))*(a + b*x)/b**S(5) + S(2)*a**S(3)*c*log(f)*Ei(c*log(f)/(a + b*x)**S(2))/b**S(5) - S(2)*a**S(3)*f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)/b**S(5) - S(4)*sqrt(pi)*a**S(2)*c**(S(3)/2)*log(f)**(S(3)/2)*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(5) + S(4)*a**S(2)*c*f**(c/(a + b*x)**S(2))*(a + b*x)*log(f)/b**S(5) + S(2)*a**S(2)*f**(c/(a + b*x)**S(2))*(a + b*x)**S(3)/b**S(5) + a*c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x)**S(2))/b**S(5) - a*c*f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)*log(f)/b**S(5) - a*f**(c/(a + b*x)**S(2))*(a + b*x)**S(4)/b**S(5) - S(4)*sqrt(pi)*c**(S(5)/2)*log(f)**(S(5)/2)*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/(S(15)*b**S(5)) + S(4)*c**S(2)*f**(c/(a + b*x)**S(2))*(a + b*x)*log(f)**S(2)/(S(15)*b**S(5)) + S(2)*c*f**(c/(a + b*x)**S(2))*(a + b*x)**S(3)*log(f)/(S(15)*b**S(5)) + f**(c/(a + b*x)**S(2))*(a + b*x)**S(5)/(S(5)*b**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))*x**S(3), x), x, sqrt(pi)*a**S(3)*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(4) - a**S(3)*f**(c/(a + b*x)**S(2))*(a + b*x)/b**S(4) - S(3)*a**S(2)*c*log(f)*Ei(c*log(f)/(a + b*x)**S(2))/(S(2)*b**S(4)) + S(3)*a**S(2)*f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)/(S(2)*b**S(4)) + S(2)*sqrt(pi)*a*c**(S(3)/2)*log(f)**(S(3)/2)*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(4) - S(2)*a*c*f**(c/(a + b*x)**S(2))*(a + b*x)*log(f)/b**S(4) - a*f**(c/(a + b*x)**S(2))*(a + b*x)**S(3)/b**S(4) - c**S(2)*log(f)**S(2)*Ei(c*log(f)/(a + b*x)**S(2))/(S(4)*b**S(4)) + c*f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)*log(f)/(S(4)*b**S(4)) + f**(c/(a + b*x)**S(2))*(a + b*x)**S(4)/(S(4)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))*x**S(2), x), x, -sqrt(pi)*a**S(2)*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(3) + a**S(2)*f**(c/(a + b*x)**S(2))*(a + b*x)/b**S(3) + a*c*log(f)*Ei(c*log(f)/(a + b*x)**S(2))/b**S(3) - a*f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)/b**S(3) - S(2)*sqrt(pi)*c**(S(3)/2)*log(f)**(S(3)/2)*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/(S(3)*b**S(3)) + S(2)*c*f**(c/(a + b*x)**S(2))*(a + b*x)*log(f)/(S(3)*b**S(3)) + f**(c/(a + b*x)**S(2))*(a + b*x)**S(3)/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))*x, x), x, sqrt(pi)*a*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b**S(2) - a*f**(c/(a + b*x)**S(2))*(a + b*x)/b**S(2) - c*log(f)*Ei(c*log(f)/(a + b*x)**S(2))/(S(2)*b**S(2)) + f**(c/(a + b*x)**S(2))*(a + b*x)**S(2)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2)), x), x, -sqrt(pi)*sqrt(c)*sqrt(log(f))*erfi(sqrt(c)*sqrt(log(f))/(a + b*x))/b + f**(c/(a + b*x)**S(2))*(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))/x, x), x, Integral(f**(c/(a + b*x)**S(2))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))/x**S(2), x), x, Integral(f**(c/(a + b*x)**S(2))/x**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(2))/x**S(3), x), x, Integral(f**(c/(a + b*x)**S(2))/x**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))*x**m, x), x, Integral(f**(c/(a + b*x)**S(3))*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))*x**S(4), x), x, a**S(4)*(-c*log(f)/(a + b*x)**S(3))**(S(1)/3)*(a + b*x)*Gamma(S(-1)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(5)) - S(4)*a**S(3)*(-c*log(f)/(a + b*x)**S(3))**(S(2)/3)*(a + b*x)**S(2)*Gamma(S(-2)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(5)) - S(2)*a**S(2)*c*log(f)*Ei(c*log(f)/(a + b*x)**S(3))/b**S(5) + S(2)*a**S(2)*f**(c/(a + b*x)**S(3))*(a + b*x)**S(3)/b**S(5) - S(4)*a*(-c*log(f)/(a + b*x)**S(3))**(S(4)/3)*(a + b*x)**S(4)*Gamma(S(-4)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(5)) + (-c*log(f)/(a + b*x)**S(3))**(S(5)/3)*(a + b*x)**S(5)*Gamma(S(-5)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))*x**S(3), x), x, -a**S(3)*(-c*log(f)/(a + b*x)**S(3))**(S(1)/3)*(a + b*x)*Gamma(S(-1)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(4)) + a**S(2)*(-c*log(f)/(a + b*x)**S(3))**(S(2)/3)*(a + b*x)**S(2)*Gamma(S(-2)/3, -c*log(f)/(a + b*x)**S(3))/b**S(4) + a*c*log(f)*Ei(c*log(f)/(a + b*x)**S(3))/b**S(4) - a*f**(c/(a + b*x)**S(3))*(a + b*x)**S(3)/b**S(4) + (-c*log(f)/(a + b*x)**S(3))**(S(4)/3)*(a + b*x)**S(4)*Gamma(S(-4)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))*x**S(2), x), x, a**S(2)*(-c*log(f)/(a + b*x)**S(3))**(S(1)/3)*(a + b*x)*Gamma(S(-1)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(3)) - S(2)*a*(-c*log(f)/(a + b*x)**S(3))**(S(2)/3)*(a + b*x)**S(2)*Gamma(S(-2)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(3)) - c*log(f)*Ei(c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(3)) + f**(c/(a + b*x)**S(3))*(a + b*x)**S(3)/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))*x, x), x, -a*(-c*log(f)/(a + b*x)**S(3))**(S(1)/3)*(a + b*x)*Gamma(S(-1)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(2)) + (-c*log(f)/(a + b*x)**S(3))**(S(2)/3)*(a + b*x)**S(2)*Gamma(S(-2)/3, -c*log(f)/(a + b*x)**S(3))/(S(3)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3)), x), x, (-c*log(f)/(a + b*x)**S(3))**(S(1)/3)*(a/S(3) + b*x/S(3))*Gamma(S(-1)/3, -c*log(f)/(a + b*x)**S(3))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))/x, x), x, Integral(f**(c/(a + b*x)**S(3))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))/x**S(2), x), x, Integral(f**(c/(a + b*x)**S(3))/x**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c/(a + b*x)**S(3))/x**S(3), x), x, Integral(f**(c/(a + b*x)**S(3))/x**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)*x**m, x), x, Integral(f**(c*(a + b*x)**n)*x**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)*x**S(3), x), x, a**S(3)*(-c*(a + b*x)**n*log(f))**(-S(1)/n)*(a + b*x)*Gamma(S(1)/n, -c*(a + b*x)**n*log(f))/(b**S(4)*n) - S(3)*a**S(2)*(-c*(a + b*x)**n*log(f))**(-S(2)/n)*(a + b*x)**S(2)*Gamma(S(2)/n, -c*(a + b*x)**n*log(f))/(b**S(4)*n) + S(3)*a*(-c*(a + b*x)**n*log(f))**(-S(3)/n)*(a + b*x)**S(3)*Gamma(S(3)/n, -c*(a + b*x)**n*log(f))/(b**S(4)*n) - (-c*(a + b*x)**n*log(f))**(-S(4)/n)*(a + b*x)**S(4)*Gamma(S(4)/n, -c*(a + b*x)**n*log(f))/(b**S(4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)*x**S(2), x), x, -a**S(2)*(-c*(a + b*x)**n*log(f))**(-S(1)/n)*(a + b*x)*Gamma(S(1)/n, -c*(a + b*x)**n*log(f))/(b**S(3)*n) + S(2)*a*(-c*(a + b*x)**n*log(f))**(-S(2)/n)*(a + b*x)**S(2)*Gamma(S(2)/n, -c*(a + b*x)**n*log(f))/(b**S(3)*n) - (-c*(a + b*x)**n*log(f))**(-S(3)/n)*(a + b*x)**S(3)*Gamma(S(3)/n, -c*(a + b*x)**n*log(f))/(b**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)*x, x), x, a*(-c*(a + b*x)**n*log(f))**(-S(1)/n)*(a + b*x)*Gamma(S(1)/n, -c*(a + b*x)**n*log(f))/(b**S(2)*n) - (-c*(a + b*x)**n*log(f))**(-S(2)/n)*(a + b*x)**S(2)*Gamma(S(2)/n, -c*(a + b*x)**n*log(f))/(b**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n), x), x, (-c*(a + b*x)**n*log(f))**(-S(1)/n)*(-a - b*x)*Gamma(S(1)/n, -c*(a + b*x)**n*log(f))/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)/x, x), x, Integral(f**(c*(a + b*x)**n)/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)/x**S(2), x), x, Integral(f**(c*(a + b*x)**n)/x**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(c*(a + b*x)**n)/x**S(3), x), x, Integral(f**(c*(a + b*x)**n)/x**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**m, x), x, -F**a*(-b*(c + d*x)**S(2)*log(F))**(-m/S(2) + S(-1)/2)*(c + d*x)**(m + S(1))*Gamma(m/S(2) + S(1)/2, -b*(c + d*x)**S(2)*log(F))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(11), x), x, -F**a*Gamma(S(6), -b*(c + d*x)**S(2)*log(F))/(S(2)*b**S(6)*d*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(9), x), x, F**a*Gamma(S(5), -b*(c + d*x)**S(2)*log(F))/(S(2)*b**S(5)*d*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(7), x), x, F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(6)/(S(2)*b*d*log(F)) - S(3)*F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(4)/(S(2)*b**S(2)*d*log(F)**S(2)) + S(3)*F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(2)/(b**S(3)*d*log(F)**S(3)) - S(3)*F**(a + b*(c + d*x)**S(2))/(b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(5), x), x, F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(4)/(S(2)*b*d*log(F)) - F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(2)/(b**S(2)*d*log(F)**S(2)) + F**(a + b*(c + d*x)**S(2))/(b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(3), x), x, F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(2)/(S(2)*b*d*log(F)) - F**(a + b*(c + d*x)**S(2))/(S(2)*b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x), x), x, F**(a + b*(c + d*x)**S(2))/(S(2)*b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x), x), x, F**a*Ei(b*(c + d*x)**S(2)*log(F))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(3), x), x, F**a*b*log(F)*Ei(b*(c + d*x)**S(2)*log(F))/(S(2)*d) - F**(a + b*(c + d*x)**S(2))/(S(2)*d*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(5), x), x, F**a*b**S(2)*log(F)**S(2)*Ei(b*(c + d*x)**S(2)*log(F))/(S(4)*d) - F**(a + b*(c + d*x)**S(2))*b*log(F)/(S(4)*d*(c + d*x)**S(2)) - F**(a + b*(c + d*x)**S(2))/(S(4)*d*(c + d*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(7), x), x, F**a*b**S(3)*log(F)**S(3)*Ei(b*(c + d*x)**S(2)*log(F))/(S(12)*d) - F**(a + b*(c + d*x)**S(2))*b**S(2)*log(F)**S(2)/(S(12)*d*(c + d*x)**S(2)) - F**(a + b*(c + d*x)**S(2))*b*log(F)/(S(12)*d*(c + d*x)**S(4)) - F**(a + b*(c + d*x)**S(2))/(S(6)*d*(c + d*x)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(9), x), x, -F**a*b**S(4)*Gamma(S(-4), -b*(c + d*x)**S(2)*log(F))*log(F)**S(4)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(11), x), x, F**a*b**S(5)*Gamma(S(-5), -b*(c + d*x)**S(2)*log(F))*log(F)**S(5)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(12), x), x, -F**a*(c + d*x)**S(13)*Gamma(S(13)/2, -b*(c + d*x)**S(2)*log(F))/(S(2)*d*(-b*(c + d*x)**S(2)*log(F))**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(10), x), x, -F**a*(c + d*x)**S(11)*Gamma(S(11)/2, -b*(c + d*x)**S(2)*log(F))/(S(2)*d*(-b*(c + d*x)**S(2)*log(F))**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(8), x), x, S(105)*sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(32)*b**(S(9)/2)*d*log(F)**(S(9)/2)) + F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(7)/(S(2)*b*d*log(F)) - S(7)*F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(5)/(S(4)*b**S(2)*d*log(F)**S(2)) + S(35)*F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(3)/(S(8)*b**S(3)*d*log(F)**S(3)) - S(105)*F**(a + b*(c + d*x)**S(2))*(c + d*x)/(S(16)*b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(6), x), x, -S(15)*sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(16)*b**(S(7)/2)*d*log(F)**(S(7)/2)) + F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(5)/(S(2)*b*d*log(F)) - S(5)*F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(3)/(S(4)*b**S(2)*d*log(F)**S(2)) + S(15)*F**(a + b*(c + d*x)**S(2))*(c + d*x)/(S(8)*b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(4), x), x, S(3)*sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(8)*b**(S(5)/2)*d*log(F)**(S(5)/2)) + F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(3)/(S(2)*b*d*log(F)) - S(3)*F**(a + b*(c + d*x)**S(2))*(c + d*x)/(S(4)*b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(c + d*x)**S(2), x), x, -sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(4)*b**(S(3)/2)*d*log(F)**(S(3)/2)) + F**(a + b*(c + d*x)**S(2))*(c + d*x)/(S(2)*b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2)), x), x, sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(2), x), x, sqrt(pi)*F**a*sqrt(b)*sqrt(log(F))*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/d - F**(a + b*(c + d*x)**S(2))/(d*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(4), x), x, S(2)*sqrt(pi)*F**a*b**(S(3)/2)*log(F)**(S(3)/2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(3)*d) - S(2)*F**(a + b*(c + d*x)**S(2))*b*log(F)/(S(3)*d*(c + d*x)) - F**(a + b*(c + d*x)**S(2))/(S(3)*d*(c + d*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(6), x), x, S(4)*sqrt(pi)*F**a*b**(S(5)/2)*log(F)**(S(5)/2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(15)*d) - S(4)*F**(a + b*(c + d*x)**S(2))*b**S(2)*log(F)**S(2)/(S(15)*d*(c + d*x)) - S(2)*F**(a + b*(c + d*x)**S(2))*b*log(F)/(S(15)*d*(c + d*x)**S(3)) - F**(a + b*(c + d*x)**S(2))/(S(5)*d*(c + d*x)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(8), x), x, S(8)*sqrt(pi)*F**a*b**(S(7)/2)*log(F)**(S(7)/2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(105)*d) - S(8)*F**(a + b*(c + d*x)**S(2))*b**S(3)*log(F)**S(3)/(S(105)*d*(c + d*x)) - S(4)*F**(a + b*(c + d*x)**S(2))*b**S(2)*log(F)**S(2)/(S(105)*d*(c + d*x)**S(3)) - S(2)*F**(a + b*(c + d*x)**S(2))*b*log(F)/(S(35)*d*(c + d*x)**S(5)) - F**(a + b*(c + d*x)**S(2))/(S(7)*d*(c + d*x)**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(10), x), x, -F**a*(-b*(c + d*x)**S(2)*log(F))**(S(9)/2)*Gamma(S(-9)/2, -b*(c + d*x)**S(2)*log(F))/(S(2)*d*(c + d*x)**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(c + d*x)**S(12), x), x, -F**a*(-b*(c + d*x)**S(2)*log(F))**(S(11)/2)*Gamma(S(-11)/2, -b*(c + d*x)**S(2)*log(F))/(S(2)*d*(c + d*x)**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**m, x), x, -F**a*(-b*(c + d*x)**S(3)*log(F))**(-m/S(3) + S(-1)/3)*(c + d*x)**(m + S(1))*Gamma(m/S(3) + S(1)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(17), x), x, -F**a*Gamma(S(6), -b*(c + d*x)**S(3)*log(F))/(S(3)*b**S(6)*d*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(14), x), x, F**a*Gamma(S(5), -b*(c + d*x)**S(3)*log(F))/(S(3)*b**S(5)*d*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(11), x), x, F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(9)/(S(3)*b*d*log(F)) - F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(6)/(b**S(2)*d*log(F)**S(2)) + S(2)*F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(3)/(b**S(3)*d*log(F)**S(3)) - S(2)*F**(a + b*(c + d*x)**S(3))/(b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(8), x), x, F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(6)/(S(3)*b*d*log(F)) - S(2)*F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(3)/(S(3)*b**S(2)*d*log(F)**S(2)) + S(2)*F**(a + b*(c + d*x)**S(3))/(S(3)*b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(5), x), x, F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(3)/(S(3)*b*d*log(F)) - F**(a + b*(c + d*x)**S(3))/(S(3)*b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(2), x), x, F**(a + b*(c + d*x)**S(3))/(S(3)*b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x), x), x, F**a*Ei(b*(c + d*x)**S(3)*log(F))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(4), x), x, F**a*b*log(F)*Ei(b*(c + d*x)**S(3)*log(F))/(S(3)*d) - F**(a + b*(c + d*x)**S(3))/(S(3)*d*(c + d*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(7), x), x, F**a*b**S(2)*log(F)**S(2)*Ei(b*(c + d*x)**S(3)*log(F))/(S(6)*d) - F**(a + b*(c + d*x)**S(3))*b*log(F)/(S(6)*d*(c + d*x)**S(3)) - F**(a + b*(c + d*x)**S(3))/(S(6)*d*(c + d*x)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(10), x), x, F**a*b**S(3)*log(F)**S(3)*Ei(b*(c + d*x)**S(3)*log(F))/(S(18)*d) - F**(a + b*(c + d*x)**S(3))*b**S(2)*log(F)**S(2)/(S(18)*d*(c + d*x)**S(3)) - F**(a + b*(c + d*x)**S(3))*b*log(F)/(S(18)*d*(c + d*x)**S(6)) - F**(a + b*(c + d*x)**S(3))/(S(9)*d*(c + d*x)**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(13), x), x, -F**a*b**S(4)*Gamma(S(-4), -b*(c + d*x)**S(3)*log(F))*log(F)**S(4)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(16), x), x, F**a*b**S(5)*Gamma(S(-5), -b*(c + d*x)**S(3)*log(F))*log(F)**S(5)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x)**S(3), x), x, -F**a*(c + d*x)**S(4)*Gamma(S(4)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(-b*(c + d*x)**S(3)*log(F))**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))*(c + d*x), x), x, -F**a*(c + d*x)**S(2)*Gamma(S(2)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(-b*(c + d*x)**S(3)*log(F))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3)), x), x, -F**a*(c + d*x)*Gamma(S(1)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(-b*(c + d*x)**S(3)*log(F))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(2), x), x, -F**a*(-b*(c + d*x)**S(3)*log(F))**(S(1)/3)*Gamma(S(-1)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(3), x), x, -F**a*(-b*(c + d*x)**S(3)*log(F))**(S(2)/3)*Gamma(S(-2)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(3))/(c + d*x)**S(5), x), x, -F**a*(-b*(c + d*x)**S(3)*log(F))**(S(4)/3)*Gamma(S(-4)/3, -b*(c + d*x)**S(3)*log(F))/(S(3)*d*(c + d*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*sqrt(c + d*x)), x), x, S(2)*f**(a + b*sqrt(c + d*x))*sqrt(c + d*x)/(b*d*log(f)) - S(2)*f**(a + b*sqrt(c + d*x))/(b**S(2)*d*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*(c + d*x)**(S(1)/3)), x), x, S(3)*f**(a + b*(c + d*x)**(S(1)/3))*(c + d*x)**(S(2)/3)/(b*d*log(f)) - S(6)*f**(a + b*(c + d*x)**(S(1)/3))*(c + d*x)**(S(1)/3)/(b**S(2)*d*log(f)**S(2)) + S(6)*f**(a + b*(c + d*x)**(S(1)/3))/(b**S(3)*d*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))*(c + d*x)**m, x), x, F**a*(-b*log(F)/(c + d*x))**(m + S(1))*(c + d*x)**(m + S(1))*Gamma(-m + S(-1), -b*log(F)/(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))*(c + d*x)**S(4), x), x, -F**a*b**S(5)*Gamma(S(-5), -b*log(F)/(c + d*x))*log(F)**S(5)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))*(c + d*x)**S(3), x), x, F**a*b**S(4)*Gamma(S(-4), -b*log(F)/(c + d*x))*log(F)**S(4)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))*(c + d*x)**S(2), x), x, -F**a*b**S(3)*log(F)**S(3)*Ei(b*log(F)/(c + d*x))/(S(6)*d) + F**(a + b/(c + d*x))*b**S(2)*(c + d*x)*log(F)**S(2)/(S(6)*d) + F**(a + b/(c + d*x))*b*(c + d*x)**S(2)*log(F)/(S(6)*d) + F**(a + b/(c + d*x))*(c + d*x)**S(3)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))*(c + d*x), x), x, -F**a*b**S(2)*log(F)**S(2)*Ei(b*log(F)/(c + d*x))/(S(2)*d) + F**(a + b/(c + d*x))*b*(c + d*x)*log(F)/(S(2)*d) + F**(a + b/(c + d*x))*(c + d*x)**S(2)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)), x), x, -F**a*b*log(F)*Ei(b*log(F)/(c + d*x))/d + F**(a + b/(c + d*x))*(c + d*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x), x), x, -F**a*Ei(b*log(F)/(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(2), x), x, -F**(a + b/(c + d*x))/(b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(3), x), x, -F**(a + b/(c + d*x))/(b*d*(c + d*x)*log(F)) + F**(a + b/(c + d*x))/(b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(4), x), x, -F**(a + b/(c + d*x))/(b*d*(c + d*x)**S(2)*log(F)) + S(2)*F**(a + b/(c + d*x))/(b**S(2)*d*(c + d*x)*log(F)**S(2)) - S(2)*F**(a + b/(c + d*x))/(b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(5), x), x, -F**(a + b/(c + d*x))/(b*d*(c + d*x)**S(3)*log(F)) + S(3)*F**(a + b/(c + d*x))/(b**S(2)*d*(c + d*x)**S(2)*log(F)**S(2)) - S(6)*F**(a + b/(c + d*x))/(b**S(3)*d*(c + d*x)*log(F)**S(3)) + S(6)*F**(a + b/(c + d*x))/(b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(6), x), x, -F**a*Gamma(S(5), -b*log(F)/(c + d*x))/(b**S(5)*d*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(c + d*x)**S(7), x), x, F**a*Gamma(S(6), -b*log(F)/(c + d*x))/(b**S(6)*d*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**m, x), x, F**a*(-b*log(F)/(c + d*x)**S(2))**(m/S(2) + S(1)/2)*(c + d*x)**(m + S(1))*Gamma(-m/S(2) + S(-1)/2, -b*log(F)/(c + d*x)**S(2))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(9), x), x, -F**a*b**S(5)*Gamma(S(-5), -b*log(F)/(c + d*x)**S(2))*log(F)**S(5)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(7), x), x, F**a*b**S(4)*Gamma(S(-4), -b*log(F)/(c + d*x)**S(2))*log(F)**S(4)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(5), x), x, -F**a*b**S(3)*log(F)**S(3)*Ei(b*log(F)/(c + d*x)**S(2))/(S(12)*d) + F**(a + b/(c + d*x)**S(2))*b**S(2)*(c + d*x)**S(2)*log(F)**S(2)/(S(12)*d) + F**(a + b/(c + d*x)**S(2))*b*(c + d*x)**S(4)*log(F)/(S(12)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(6)/(S(6)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(3), x), x, -F**a*b**S(2)*log(F)**S(2)*Ei(b*log(F)/(c + d*x)**S(2))/(S(4)*d) + F**(a + b/(c + d*x)**S(2))*b*(c + d*x)**S(2)*log(F)/(S(4)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(4)/(S(4)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x), x), x, -F**a*b*log(F)*Ei(b*log(F)/(c + d*x)**S(2))/(S(2)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(2)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x), x), x, -F**a*Ei(b*log(F)/(c + d*x)**S(2))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(3), x), x, -F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(5), x), x, -F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(2)*log(F)) + F**(a + b/(c + d*x)**S(2))/(S(2)*b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(7), x), x, -F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(4)*log(F)) + F**(a + b/(c + d*x)**S(2))/(b**S(2)*d*(c + d*x)**S(2)*log(F)**S(2)) - F**(a + b/(c + d*x)**S(2))/(b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(9), x), x, -F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(6)*log(F)) + S(3)*F**(a + b/(c + d*x)**S(2))/(S(2)*b**S(2)*d*(c + d*x)**S(4)*log(F)**S(2)) - S(3)*F**(a + b/(c + d*x)**S(2))/(b**S(3)*d*(c + d*x)**S(2)*log(F)**S(3)) + S(3)*F**(a + b/(c + d*x)**S(2))/(b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(11), x), x, -F**a*Gamma(S(5), -b*log(F)/(c + d*x)**S(2))/(S(2)*b**S(5)*d*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(13), x), x, F**a*Gamma(S(6), -b*log(F)/(c + d*x)**S(2))/(S(2)*b**S(6)*d*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(10), x), x, F**a*(-b*log(F)/(c + d*x)**S(2))**(S(11)/2)*(c + d*x)**S(11)*Gamma(S(-11)/2, -b*log(F)/(c + d*x)**S(2))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(8), x), x, F**a*(-b*log(F)/(c + d*x)**S(2))**(S(9)/2)*(c + d*x)**S(9)*Gamma(S(-9)/2, -b*log(F)/(c + d*x)**S(2))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(6), x), x, -S(8)*sqrt(pi)*F**a*b**(S(7)/2)*log(F)**(S(7)/2)*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(105)*d) + S(8)*F**(a + b/(c + d*x)**S(2))*b**S(3)*(c + d*x)*log(F)**S(3)/(S(105)*d) + S(4)*F**(a + b/(c + d*x)**S(2))*b**S(2)*(c + d*x)**S(3)*log(F)**S(2)/(S(105)*d) + S(2)*F**(a + b/(c + d*x)**S(2))*b*(c + d*x)**S(5)*log(F)/(S(35)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(7)/(S(7)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(4), x), x, -S(4)*sqrt(pi)*F**a*b**(S(5)/2)*log(F)**(S(5)/2)*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(15)*d) + S(4)*F**(a + b/(c + d*x)**S(2))*b**S(2)*(c + d*x)*log(F)**S(2)/(S(15)*d) + S(2)*F**(a + b/(c + d*x)**S(2))*b*(c + d*x)**S(3)*log(F)/(S(15)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(5)/(S(5)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(2), x), x, -S(2)*sqrt(pi)*F**a*b**(S(3)/2)*log(F)**(S(3)/2)*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(3)*d) + S(2)*F**(a + b/(c + d*x)**S(2))*b*(c + d*x)*log(F)/(S(3)*d) + F**(a + b/(c + d*x)**S(2))*(c + d*x)**S(3)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2)), x), x, -sqrt(pi)*F**a*sqrt(b)*sqrt(log(F))*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/d + F**(a + b/(c + d*x)**S(2))*(c + d*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(2), x), x, -sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(2)*sqrt(b)*d*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(4), x), x, sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(4)*b**(S(3)/2)*d*log(F)**(S(3)/2)) - F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(6), x), x, -S(3)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(8)*b**(S(5)/2)*d*log(F)**(S(5)/2)) - F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(3)*log(F)) + S(3)*F**(a + b/(c + d*x)**S(2))/(S(4)*b**S(2)*d*(c + d*x)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(8), x), x, S(15)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(16)*b**(S(7)/2)*d*log(F)**(S(7)/2)) - F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(5)*log(F)) + S(5)*F**(a + b/(c + d*x)**S(2))/(S(4)*b**S(2)*d*(c + d*x)**S(3)*log(F)**S(2)) - S(15)*F**(a + b/(c + d*x)**S(2))/(S(8)*b**S(3)*d*(c + d*x)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(10), x), x, -S(105)*sqrt(pi)*F**a*erfi(sqrt(b)*sqrt(log(F))/(c + d*x))/(S(32)*b**(S(9)/2)*d*log(F)**(S(9)/2)) - F**(a + b/(c + d*x)**S(2))/(S(2)*b*d*(c + d*x)**S(7)*log(F)) + S(7)*F**(a + b/(c + d*x)**S(2))/(S(4)*b**S(2)*d*(c + d*x)**S(5)*log(F)**S(2)) - S(35)*F**(a + b/(c + d*x)**S(2))/(S(8)*b**S(3)*d*(c + d*x)**S(3)*log(F)**S(3)) + S(105)*F**(a + b/(c + d*x)**S(2))/(S(16)*b**S(4)*d*(c + d*x)*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(12), x), x, F**a*Gamma(S(11)/2, -b*log(F)/(c + d*x)**S(2))/(S(2)*d*(-b*log(F)/(c + d*x)**S(2))**(S(11)/2)*(c + d*x)**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(2))/(c + d*x)**S(14), x), x, F**a*Gamma(S(13)/2, -b*log(F)/(c + d*x)**S(2))/(S(2)*d*(-b*log(F)/(c + d*x)**S(2))**(S(13)/2)*(c + d*x)**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**m, x), x, F**a*(-b*log(F)/(c + d*x)**S(3))**(m/S(3) + S(1)/3)*(c + d*x)**(m + S(1))*Gamma(-m/S(3) + S(-1)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(14), x), x, -F**a*b**S(5)*Gamma(S(-5), -b*log(F)/(c + d*x)**S(3))*log(F)**S(5)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(11), x), x, F**a*b**S(4)*Gamma(S(-4), -b*log(F)/(c + d*x)**S(3))*log(F)**S(4)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(8), x), x, -F**a*b**S(3)*log(F)**S(3)*Ei(b*log(F)/(c + d*x)**S(3))/(S(18)*d) + F**(a + b/(c + d*x)**S(3))*b**S(2)*(c + d*x)**S(3)*log(F)**S(2)/(S(18)*d) + F**(a + b/(c + d*x)**S(3))*b*(c + d*x)**S(6)*log(F)/(S(18)*d) + F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(9)/(S(9)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(5), x), x, -F**a*b**S(2)*log(F)**S(2)*Ei(b*log(F)/(c + d*x)**S(3))/(S(6)*d) + F**(a + b/(c + d*x)**S(3))*b*(c + d*x)**S(3)*log(F)/(S(6)*d) + F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(6)/(S(6)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(2), x), x, -F**a*b*log(F)*Ei(b*log(F)/(c + d*x)**S(3))/(S(3)*d) + F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(3)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x), x), x, -F**a*Ei(b*log(F)/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(4), x), x, -F**(a + b/(c + d*x)**S(3))/(S(3)*b*d*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(7), x), x, -F**(a + b/(c + d*x)**S(3))/(S(3)*b*d*(c + d*x)**S(3)*log(F)) + F**(a + b/(c + d*x)**S(3))/(S(3)*b**S(2)*d*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(10), x), x, -F**(a + b/(c + d*x)**S(3))/(S(3)*b*d*(c + d*x)**S(6)*log(F)) + S(2)*F**(a + b/(c + d*x)**S(3))/(S(3)*b**S(2)*d*(c + d*x)**S(3)*log(F)**S(2)) - S(2)*F**(a + b/(c + d*x)**S(3))/(S(3)*b**S(3)*d*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(13), x), x, -F**(a + b/(c + d*x)**S(3))/(S(3)*b*d*(c + d*x)**S(9)*log(F)) + F**(a + b/(c + d*x)**S(3))/(b**S(2)*d*(c + d*x)**S(6)*log(F)**S(2)) - S(2)*F**(a + b/(c + d*x)**S(3))/(b**S(3)*d*(c + d*x)**S(3)*log(F)**S(3)) + S(2)*F**(a + b/(c + d*x)**S(3))/(b**S(4)*d*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(16), x), x, -F**a*Gamma(S(5), -b*log(F)/(c + d*x)**S(3))/(S(3)*b**S(5)*d*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(19), x), x, F**a*Gamma(S(6), -b*log(F)/(c + d*x)**S(3))/(S(3)*b**S(6)*d*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x)**S(3), x), x, F**a*(-b*log(F)/(c + d*x)**S(3))**(S(4)/3)*(c + d*x)**S(4)*Gamma(S(-4)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))*(c + d*x), x), x, F**a*(-b*log(F)/(c + d*x)**S(3))**(S(2)/3)*(c + d*x)**S(2)*Gamma(S(-2)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3)), x), x, F**a*(-b*log(F)/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)*Gamma(S(-1)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(2), x), x, F**a*Gamma(S(1)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d*(-b*log(F)/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(3), x), x, F**a*Gamma(S(2)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d*(-b*log(F)/(c + d*x)**S(3))**(S(2)/3)*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x)**S(3))/(c + d*x)**S(5), x), x, F**a*Gamma(S(4)/3, -b*log(F)/(c + d*x)**S(3))/(S(3)*d*(-b*log(F)/(c + d*x)**S(3))**(S(4)/3)*(c + d*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**m, x), x, -F**a*(-b*(c + d*x)**n*log(F))**(-(m + S(1))/n)*(c + d*x)**(m + S(1))*Gamma((m + S(1))/n, -b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**S(3), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(-S(4)/n)*(c + d*x)**S(4)*Gamma(S(4)/n, -b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**S(2), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(-S(3)/n)*(c + d*x)**S(3)*Gamma(S(3)/n, -b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(-S(2)/n)*(c + d*x)**S(2)*Gamma(S(2)/n, -b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(-S(1)/n)*(c + d*x)*Gamma(S(1)/n, -b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)/(c + d*x), x), x, F**a*Ei(b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)/(c + d*x)**S(2), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(S(1)/n)*Gamma(-S(1)/n, -b*(c + d*x)**n*log(F))/(d*n*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)/(c + d*x)**S(3), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(S(2)/n)*Gamma(-S(2)/n, -b*(c + d*x)**n*log(F))/(d*n*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)/(c + d*x)**S(4), x), x, -F**a*(-b*(c + d*x)**n*log(F))**(S(3)/n)*Gamma(-S(3)/n, -b*(c + d*x)**n*log(F))/(d*n*(c + d*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(S(6)*n + S(-1)), x), x, -F**a*Gamma(S(6), -b*(c + d*x)**n*log(F))/(b**S(6)*d*n*log(F)**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(S(5)*n + S(-1)), x), x, F**a*Gamma(S(5), -b*(c + d*x)**n*log(F))/(b**S(5)*d*n*log(F)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(S(4)*n + S(-1)), x), x, F**(a + b*(c + d*x)**n)*(c + d*x)**(S(3)*n)/(b*d*n*log(F)) - S(3)*F**(a + b*(c + d*x)**n)*(c + d*x)**(S(2)*n)/(b**S(2)*d*n*log(F)**S(2)) + S(6)*F**(a + b*(c + d*x)**n)*(c + d*x)**n/(b**S(3)*d*n*log(F)**S(3)) - S(6)*F**(a + b*(c + d*x)**n)/(b**S(4)*d*n*log(F)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(S(3)*n + S(-1)), x), x, F**(a + b*(c + d*x)**n)*(c + d*x)**(S(2)*n)/(b*d*n*log(F)) - S(2)*F**(a + b*(c + d*x)**n)*(c + d*x)**n/(b**S(2)*d*n*log(F)**S(2)) + S(2)*F**(a + b*(c + d*x)**n)/(b**S(3)*d*n*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(S(2)*n + S(-1)), x), x, F**(a + b*(c + d*x)**n)*(c + d*x)**n/(b*d*n*log(F)) - F**(a + b*(c + d*x)**n)/(b**S(2)*d*n*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(n + S(-1)), x), x, F**(a + b*(c + d*x)**n)/(b*d*n*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)/(c + d*x), x), x, F**a*Ei(b*(c + d*x)**n*log(F))/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(-n + S(-1)), x), x, F**a*b*log(F)*Ei(b*(c + d*x)**n*log(F))/(d*n) - F**(a + b*(c + d*x)**n)*(c + d*x)**(-n)/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(2)*n + S(-1)), x), x, F**a*b**S(2)*log(F)**S(2)*Ei(b*(c + d*x)**n*log(F))/(S(2)*d*n) - F**(a + b*(c + d*x)**n)*b*(c + d*x)**(-n)*log(F)/(S(2)*d*n) - F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(2)*n)/(S(2)*d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(3)*n + S(-1)), x), x, F**a*b**S(3)*log(F)**S(3)*Ei(b*(c + d*x)**n*log(F))/(S(6)*d*n) - F**(a + b*(c + d*x)**n)*b**S(2)*(c + d*x)**(-n)*log(F)**S(2)/(S(6)*d*n) - F**(a + b*(c + d*x)**n)*b*(c + d*x)**(-S(2)*n)*log(F)/(S(6)*d*n) - F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(3)*n)/(S(3)*d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(4)*n + S(-1)), x), x, -F**a*b**S(4)*Gamma(S(-4), -b*(c + d*x)**n*log(F))*log(F)**S(4)/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**n)*(c + d*x)**(-S(5)*n + S(-1)), x), x, F**a*b**S(5)*Gamma(S(-5), -b*(c + d*x)**n*log(F))*log(F)**S(5)/(d*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(c*(a + b*x)**n)*(a + b*x)**(n/S(2) + S(-1)), x), x, sqrt(pi)*erfi(sqrt(c)*(a + b*x)**(n/S(2))*sqrt(log(F)))/(b*sqrt(c)*n*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(-c*(a + b*x)**n)*(a + b*x)**(n/S(2) + S(-1)), x), x, sqrt(pi)*erf(sqrt(c)*(a + b*x)**(n/S(2))*sqrt(log(F)))/(b*sqrt(c)*n*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(e + f*x)**S(5), x), x, sqrt(pi)*F**a*(-c*f + d*e)**S(5)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d**S(6)*sqrt(log(F))) - S(5)*sqrt(pi)*F**a*f**S(2)*(-c*f + d*e)**S(3)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*b**(S(3)/2)*d**S(6)*log(F)**(S(3)/2)) + S(15)*sqrt(pi)*F**a*f**S(4)*(-c*f + d*e)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(8)*b**(S(5)/2)*d**S(6)*log(F)**(S(5)/2)) + F**(a + b*(c + d*x)**S(2))*f**S(5)*(c + d*x)**S(4)/(S(2)*b*d**S(6)*log(F)) + S(5)*F**(a + b*(c + d*x)**S(2))*f**S(4)*(c + d*x)**S(3)*(-c*f + d*e)/(S(2)*b*d**S(6)*log(F)) + S(5)*F**(a + b*(c + d*x)**S(2))*f**S(3)*(c + d*x)**S(2)*(-c*f + d*e)**S(2)/(b*d**S(6)*log(F)) + S(5)*F**(a + b*(c + d*x)**S(2))*f**S(2)*(c + d*x)*(-c*f + d*e)**S(3)/(b*d**S(6)*log(F)) + S(5)*F**(a + b*(c + d*x)**S(2))*f*(-c*f + d*e)**S(4)/(S(2)*b*d**S(6)*log(F)) - F**(a + b*(c + d*x)**S(2))*f**S(5)*(c + d*x)**S(2)/(b**S(2)*d**S(6)*log(F)**S(2)) - S(15)*F**(a + b*(c + d*x)**S(2))*f**S(4)*(c + d*x)*(-c*f + d*e)/(S(4)*b**S(2)*d**S(6)*log(F)**S(2)) - S(5)*F**(a + b*(c + d*x)**S(2))*f**S(3)*(-c*f + d*e)**S(2)/(b**S(2)*d**S(6)*log(F)**S(2)) + F**(a + b*(c + d*x)**S(2))*f**S(5)/(b**S(3)*d**S(6)*log(F)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(e + f*x)**S(4), x), x, sqrt(pi)*F**a*(-c*f + d*e)**S(4)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d**S(5)*sqrt(log(F))) - S(3)*sqrt(pi)*F**a*f**S(2)*(-c*f + d*e)**S(2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*b**(S(3)/2)*d**S(5)*log(F)**(S(3)/2)) + S(3)*sqrt(pi)*F**a*f**S(4)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(8)*b**(S(5)/2)*d**S(5)*log(F)**(S(5)/2)) + F**(a + b*(c + d*x)**S(2))*f**S(4)*(c + d*x)**S(3)/(S(2)*b*d**S(5)*log(F)) + S(2)*F**(a + b*(c + d*x)**S(2))*f**S(3)*(c + d*x)**S(2)*(-c*f + d*e)/(b*d**S(5)*log(F)) + S(3)*F**(a + b*(c + d*x)**S(2))*f**S(2)*(c + d*x)*(-c*f + d*e)**S(2)/(b*d**S(5)*log(F)) + S(2)*F**(a + b*(c + d*x)**S(2))*f*(-c*f + d*e)**S(3)/(b*d**S(5)*log(F)) - S(3)*F**(a + b*(c + d*x)**S(2))*f**S(4)*(c + d*x)/(S(4)*b**S(2)*d**S(5)*log(F)**S(2)) - S(2)*F**(a + b*(c + d*x)**S(2))*f**S(3)*(-c*f + d*e)/(b**S(2)*d**S(5)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(e + f*x)**S(3), x), x, sqrt(pi)*F**a*(-c*f + d*e)**S(3)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d**S(4)*sqrt(log(F))) - S(3)*sqrt(pi)*F**a*f**S(2)*(-c*f + d*e)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(4)*b**(S(3)/2)*d**S(4)*log(F)**(S(3)/2)) + F**(a + b*(c + d*x)**S(2))*f**S(3)*(c + d*x)**S(2)/(S(2)*b*d**S(4)*log(F)) + S(3)*F**(a + b*(c + d*x)**S(2))*f**S(2)*(c + d*x)*(-c*f + d*e)/(S(2)*b*d**S(4)*log(F)) + S(3)*F**(a + b*(c + d*x)**S(2))*f*(-c*f + d*e)**S(2)/(S(2)*b*d**S(4)*log(F)) - F**(a + b*(c + d*x)**S(2))*f**S(3)/(S(2)*b**S(2)*d**S(4)*log(F)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(e + f*x)**S(2), x), x, sqrt(pi)*F**a*(-c*f + d*e)**S(2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d**S(3)*sqrt(log(F))) - sqrt(pi)*F**a*f**S(2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(4)*b**(S(3)/2)*d**S(3)*log(F)**(S(3)/2)) + F**(a + b*(c + d*x)**S(2))*f**S(2)*(c + d*x)/(S(2)*b*d**S(3)*log(F)) + F**(a + b*(c + d*x)**S(2))*f*(-c*f + d*e)/(b*d**S(3)*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))*(e + f*x), x), x, sqrt(pi)*F**a*(-c*f/S(2) + d*e/S(2))*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(sqrt(b)*d**S(2)*sqrt(log(F))) + F**(a + b*(c + d*x)**S(2))*f/(S(2)*b*d**S(2)*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2)), x), x, sqrt(pi)*F**a*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/(S(2)*sqrt(b)*d*sqrt(log(F))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(e + f*x), x), x, Integral(F**(a + b*(c + d*x)**S(2))/(e + f*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(e + f*x)**S(2), x), x, sqrt(pi)*F**a*sqrt(b)*d*sqrt(log(F))*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/f**S(2) - F**(a + b*(c + d*x)**S(2))/(f*(e + f*x)) - S(2)*b*d*(-c*f + d*e)*log(F)*Integral(F**(a + b*(c + d*x)**S(2))/(e + f*x), x)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*(c + d*x)**S(2))/(e + f*x)**S(3), x), x, -sqrt(pi)*F**a*b**(S(3)/2)*d**S(2)*(-c*f + d*e)*log(F)**(S(3)/2)*erfi(sqrt(b)*(c + d*x)*sqrt(log(F)))/f**S(4) + F**(a + b*(c + d*x)**S(2))*b*d*(-c*f + d*e)*log(F)/(f**S(3)*(e + f*x)) - F**(a + b*(c + d*x)**S(2))/(S(2)*f*(e + f*x)**S(2)) + S(2)*b**S(2)*d**S(2)*(-c*f + d*e)**S(2)*log(F)**S(2)*Integral(F**(a + b*(c + d*x)**S(2))/(e + f*x), x)/f**S(4) + b*d**S(2)*log(F)*Integral(F**(a + b*(c + d*x)**S(2))/(e + f*x), x)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(e*(c + d*x)**S(3)), x), x, -b**S(3)*(c + d*x)**S(4)*Gamma(S(4)/3, -e*(c + d*x)**S(3))/(S(3)*d**S(4)*(-e*(c + d*x)**S(3))**(S(4)/3)) - b**S(2)*(-a*d + b*c)*exp(e*(c + d*x)**S(3))/(d**S(4)*e) - b*(c + d*x)**S(2)*(-a*d + b*c)**S(2)*Gamma(S(2)/3, -e*(c + d*x)**S(3))/(d**S(4)*(-e*(c + d*x)**S(3))**(S(2)/3)) + (c + d*x)*(-a*d + b*c)**S(3)*Gamma(S(1)/3, -e*(c + d*x)**S(3))/(S(3)*d**S(4)*(-e*(c + d*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*exp(e*(c + d*x)**S(3)), x), x, b**S(2)*exp(e*(c + d*x)**S(3))/(S(3)*d**S(3)*e) + S(2)*b*(c + d*x)**S(2)*(-a*d + b*c)*Gamma(S(2)/3, -e*(c + d*x)**S(3))/(S(3)*d**S(3)*(-e*(c + d*x)**S(3))**(S(2)/3)) - (c + d*x)*(-a*d + b*c)**S(2)*Gamma(S(1)/3, -e*(c + d*x)**S(3))/(S(3)*d**S(3)*(-e*(c + d*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*exp(e*(c + d*x)**S(3)), x), x, -b*(c + d*x)**S(2)*Gamma(S(2)/3, -e*(c + d*x)**S(3))/(S(3)*d**S(2)*(-e*(c + d*x)**S(3))**(S(2)/3)) + (c + d*x)*(-a*d/S(3) + b*c/S(3))*Gamma(S(1)/3, -e*(c + d*x)**S(3))/(d**S(2)*(-e*(c + d*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e*(c + d*x)**S(3)), x), x, (-c/S(3) - d*x/S(3))*Gamma(S(1)/3, -e*(c + d*x)**S(3))/(d*(-e*(c + d*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e*(c + d*x)**S(3))/(a + b*x), x), x, Integral(exp(e*(c + d*x)**S(3))/(a + b*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e*(c + d*x)**S(3))/(a + b*x)**S(2), x), x, -exp(e*(c + d*x)**S(3))/(b*(a + b*x)) - d*e*(c + d*x)**S(2)*Gamma(S(2)/3, -e*(c + d*x)**S(3))/(b**S(2)*(-e*(c + d*x)**S(3))**(S(2)/3)) + S(3)*d*e*(-a*d + b*c)**S(2)*Integral(exp(e*(c + d*x)**S(3))/(a + b*x), x)/b**S(3) - d*e*(c + d*x)*(-a*d + b*c)*Gamma(S(1)/3, -e*(c + d*x)**S(3))/(b**S(3)*(-e*(c + d*x)**S(3))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(e + f*x), x), x, -F**a*Ei(b*log(F)/(c + d*x))/f + F**(a - b*f/(-c*f + d*e))*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(e + f*x)**S(2), x), x, F**(a + b/(c + d*x))*d/(f*(-c*f + d*e)) - F**(a + b/(c + d*x))/(f*(e + f*x)) - F**(a - b*f/(-c*f + d*e))*b*d*log(F)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(-c*f + d*e)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(e + f*x)**S(3), x), x, -F**(a + b/(c + d*x))*b*d**S(2)*log(F)/(S(2)*(-c*f + d*e)**S(3)) + F**(a + b/(c + d*x))*b*d*log(F)/(S(2)*(e + f*x)*(-c*f + d*e)**S(2)) + F**(a + b/(c + d*x))*d**S(2)/(S(2)*f*(-c*f + d*e)**S(2)) - F**(a + b/(c + d*x))/(S(2)*f*(e + f*x)**S(2)) + F**(a - b*f/(-c*f + d*e))*b**S(2)*d**S(2)*f*log(F)**S(2)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(S(2)*(-c*f + d*e)**S(4)) - F**(a - b*f/(-c*f + d*e))*b*d**S(2)*log(F)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(-c*f + d*e)**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b/(c + d*x))/(e + f*x)**S(4), x), x, F**(a + b/(c + d*x))*b**S(2)*d**S(3)*f*log(F)**S(2)/(S(6)*(-c*f + d*e)**S(5)) - F**(a + b/(c + d*x))*b**S(2)*d**S(2)*f*log(F)**S(2)/(S(6)*(e + f*x)*(-c*f + d*e)**S(4)) - S(5)*F**(a + b/(c + d*x))*b*d**S(3)*log(F)/(S(6)*(-c*f + d*e)**S(4)) + S(2)*F**(a + b/(c + d*x))*b*d**S(2)*log(F)/(S(3)*(e + f*x)*(-c*f + d*e)**S(3)) + F**(a + b/(c + d*x))*b*d*log(F)/(S(6)*(e + f*x)**S(2)*(-c*f + d*e)**S(2)) + F**(a + b/(c + d*x))*d**S(3)/(S(3)*f*(-c*f + d*e)**S(3)) - F**(a + b/(c + d*x))/(S(3)*f*(e + f*x)**S(3)) - F**(a - b*f/(-c*f + d*e))*b**S(3)*d**S(3)*f**S(2)*log(F)**S(3)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(S(6)*(-c*f + d*e)**S(6)) + F**(a - b*f/(-c*f + d*e))*b**S(2)*d**S(3)*f*log(F)**S(2)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(-c*f + d*e)**S(5) - F**(a - b*f/(-c*f + d*e))*b*d**S(3)*log(F)*Ei(b*d*(e + f*x)*log(F)/((c + d*x)*(-c*f + d*e)))/(-c*f + d*e)**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(4)*exp(e/(c + d*x)), x), x, -b**S(4)*e**S(5)*Gamma(S(-5), -e/(c + d*x))/d**S(5) - S(4)*b**S(3)*e**S(4)*(-a*d + b*c)*Gamma(S(-4), -e/(c + d*x))/d**S(5) - b**S(2)*e**S(3)*(-a*d + b*c)**S(2)*Ei(e/(c + d*x))/d**S(5) + b**S(2)*e**S(2)*(c + d*x)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/d**S(5) + b**S(2)*e*(c + d*x)**S(2)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/d**S(5) + S(2)*b**S(2)*(c + d*x)**S(3)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/d**S(5) + S(2)*b*e**S(2)*(-a*d + b*c)**S(3)*Ei(e/(c + d*x))/d**S(5) - S(2)*b*e*(c + d*x)*(-a*d + b*c)**S(3)*exp(e/(c + d*x))/d**S(5) - S(2)*b*(c + d*x)**S(2)*(-a*d + b*c)**S(3)*exp(e/(c + d*x))/d**S(5) - e*(-a*d + b*c)**S(4)*Ei(e/(c + d*x))/d**S(5) + (c + d*x)*(-a*d + b*c)**S(4)*exp(e/(c + d*x))/d**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(e/(c + d*x)), x), x, b**S(3)*e**S(4)*Gamma(S(-4), -e/(c + d*x))/d**S(4) + b**S(2)*e**S(3)*(-a*d + b*c)*Ei(e/(c + d*x))/(S(2)*d**S(4)) - b**S(2)*e**S(2)*(c + d*x)*(-a*d + b*c)*exp(e/(c + d*x))/(S(2)*d**S(4)) - b**S(2)*e*(c + d*x)**S(2)*(-a*d + b*c)*exp(e/(c + d*x))/(S(2)*d**S(4)) - b**S(2)*(c + d*x)**S(3)*(-a*d + b*c)*exp(e/(c + d*x))/d**S(4) - S(3)*b*e**S(2)*(-a*d + b*c)**S(2)*Ei(e/(c + d*x))/(S(2)*d**S(4)) + S(3)*b*e*(c + d*x)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/(S(2)*d**S(4)) + S(3)*b*(c + d*x)**S(2)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/(S(2)*d**S(4)) + e*(-a*d + b*c)**S(3)*Ei(e/(c + d*x))/d**S(4) - (c + d*x)*(-a*d + b*c)**S(3)*exp(e/(c + d*x))/d**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*exp(e/(c + d*x)), x), x, -b**S(2)*e**S(3)*Ei(e/(c + d*x))/(S(6)*d**S(3)) + b**S(2)*e**S(2)*(c + d*x)*exp(e/(c + d*x))/(S(6)*d**S(3)) + b**S(2)*e*(c + d*x)**S(2)*exp(e/(c + d*x))/(S(6)*d**S(3)) + b**S(2)*(c + d*x)**S(3)*exp(e/(c + d*x))/(S(3)*d**S(3)) + b*e**S(2)*(-a*d + b*c)*Ei(e/(c + d*x))/d**S(3) - b*e*(c + d*x)*(-a*d + b*c)*exp(e/(c + d*x))/d**S(3) - b*(c + d*x)**S(2)*(-a*d + b*c)*exp(e/(c + d*x))/d**S(3) - e*(-a*d + b*c)**S(2)*Ei(e/(c + d*x))/d**S(3) + (c + d*x)*(-a*d + b*c)**S(2)*exp(e/(c + d*x))/d**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*exp(e/(c + d*x)), x), x, -b*e**S(2)*Ei(e/(c + d*x))/(S(2)*d**S(2)) + b*e*(c + d*x)*exp(e/(c + d*x))/(S(2)*d**S(2)) + b*(c + d*x)**S(2)*exp(e/(c + d*x))/(S(2)*d**S(2)) + e*(-a*d + b*c)*Ei(e/(c + d*x))/d**S(2) + (c + d*x)*(a*d - b*c)*exp(e/(c + d*x))/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)), x), x, -e*Ei(e/(c + d*x))/d + (c + d*x)*exp(e/(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x))/(a + b*x), x), x, exp(b*e/(-a*d + b*c))*Ei(-d*e*(a + b*x)/((c + d*x)*(-a*d + b*c)))/b - Ei(e/(c + d*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x))/(a + b*x)**S(2), x), x, -d*e*exp(b*e/(-a*d + b*c))*Ei(-d*e*(a + b*x)/((c + d*x)*(-a*d + b*c)))/(-a*d + b*c)**S(2) - d*exp(e/(c + d*x))/(b*(-a*d + b*c)) - exp(e/(c + d*x))/(b*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x))/(a + b*x)**S(3), x), x, b*d**S(2)*e**S(2)*exp(b*e/(-a*d + b*c))*Ei(-d*e*(a + b*x)/((c + d*x)*(-a*d + b*c)))/(S(2)*(-a*d + b*c)**S(4)) + d**S(2)*e*exp(e/(c + d*x))/(S(2)*(-a*d + b*c)**S(3)) + d**S(2)*e*exp(b*e/(-a*d + b*c))*Ei(-d*e*(a + b*x)/((c + d*x)*(-a*d + b*c)))/(-a*d + b*c)**S(3) + d*e*exp(e/(c + d*x))/(S(2)*(a + b*x)*(-a*d + b*c)**S(2)) + d**S(2)*exp(e/(c + d*x))/(S(2)*b*(-a*d + b*c)**S(2)) - exp(e/(c + d*x))/(S(2)*b*(a + b*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(e/(c + d*x)**S(2)), x), x, -b**S(3)*e**S(2)*Ei(e/(c + d*x)**S(2))/(S(4)*d**S(4)) + b**S(3)*e*(c + d*x)**S(2)*exp(e/(c + d*x)**S(2))/(S(4)*d**S(4)) + b**S(3)*(c + d*x)**S(4)*exp(e/(c + d*x)**S(2))/(S(4)*d**S(4)) + S(2)*sqrt(pi)*b**S(2)*e**(S(3)/2)*(-a*d + b*c)*erfi(sqrt(e)/(c + d*x))/d**S(4) - S(2)*b**S(2)*e*(c + d*x)*(-a*d + b*c)*exp(e/(c + d*x)**S(2))/d**S(4) - b**S(2)*(c + d*x)**S(3)*(-a*d + b*c)*exp(e/(c + d*x)**S(2))/d**S(4) - S(3)*b*e*(-a*d + b*c)**S(2)*Ei(e/(c + d*x)**S(2))/(S(2)*d**S(4)) + S(3)*b*(c + d*x)**S(2)*(-a*d + b*c)**S(2)*exp(e/(c + d*x)**S(2))/(S(2)*d**S(4)) + sqrt(pi)*sqrt(e)*(-a*d + b*c)**S(3)*erfi(sqrt(e)/(c + d*x))/d**S(4) - (c + d*x)*(-a*d + b*c)**S(3)*exp(e/(c + d*x)**S(2))/d**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*exp(e/(c + d*x)**S(2)), x), x, -S(2)*sqrt(pi)*b**S(2)*e**(S(3)/2)*erfi(sqrt(e)/(c + d*x))/(S(3)*d**S(3)) + S(2)*b**S(2)*e*(c + d*x)*exp(e/(c + d*x)**S(2))/(S(3)*d**S(3)) + b**S(2)*(c + d*x)**S(3)*exp(e/(c + d*x)**S(2))/(S(3)*d**S(3)) + b*e*(-a*d + b*c)*Ei(e/(c + d*x)**S(2))/d**S(3) - b*(c + d*x)**S(2)*(-a*d + b*c)*exp(e/(c + d*x)**S(2))/d**S(3) - sqrt(pi)*sqrt(e)*(-a*d + b*c)**S(2)*erfi(sqrt(e)/(c + d*x))/d**S(3) + (c + d*x)*(-a*d + b*c)**S(2)*exp(e/(c + d*x)**S(2))/d**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*exp(e/(c + d*x)**S(2)), x), x, -b*e*Ei(e/(c + d*x)**S(2))/(S(2)*d**S(2)) + b*(c + d*x)**S(2)*exp(e/(c + d*x)**S(2))/(S(2)*d**S(2)) + sqrt(pi)*sqrt(e)*(-a*d + b*c)*erfi(sqrt(e)/(c + d*x))/d**S(2) + (c + d*x)*(a*d - b*c)*exp(e/(c + d*x)**S(2))/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(2)), x), x, -sqrt(pi)*sqrt(e)*erfi(sqrt(e)/(c + d*x))/d + (c + d*x)*exp(e/(c + d*x)**S(2))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(2))/(a + b*x), x), x, Integral(exp(e/(c + d*x)**S(2))/(a + b*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(2))/(a + b*x)**S(2), x), x, Integral(exp(e/(c + d*x)**S(2))/(a + b*x)**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(2))/(a + b*x)**S(3), x), x, Integral(exp(e/(c + d*x)**S(2))/(a + b*x)**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*exp(e/(c + d*x)**S(3)), x), x, b**S(3)*(-e/(c + d*x)**S(3))**(S(4)/3)*(c + d*x)**S(4)*Gamma(S(-4)/3, -e/(c + d*x)**S(3))/(S(3)*d**S(4)) + b**S(2)*e*(-a*d + b*c)*Ei(e/(c + d*x)**S(3))/d**S(4) - b**S(2)*(c + d*x)**S(3)*(-a*d + b*c)*exp(e/(c + d*x)**S(3))/d**S(4) + b*(-e/(c + d*x)**S(3))**(S(2)/3)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)*Gamma(S(-2)/3, -e/(c + d*x)**S(3))/d**S(4) - (-e/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)*(-a*d + b*c)**S(3)*Gamma(S(-1)/3, -e/(c + d*x)**S(3))/(S(3)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*exp(e/(c + d*x)**S(3)), x), x, -b**S(2)*e*Ei(e/(c + d*x)**S(3))/(S(3)*d**S(3)) + b**S(2)*(c + d*x)**S(3)*exp(e/(c + d*x)**S(3))/(S(3)*d**S(3)) - S(2)*b*(-e/(c + d*x)**S(3))**(S(2)/3)*(c + d*x)**S(2)*(-a*d + b*c)*Gamma(S(-2)/3, -e/(c + d*x)**S(3))/(S(3)*d**S(3)) + (-e/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)*(-a*d + b*c)**S(2)*Gamma(S(-1)/3, -e/(c + d*x)**S(3))/(S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*exp(e/(c + d*x)**S(3)), x), x, b*(-e/(c + d*x)**S(3))**(S(2)/3)*(c + d*x)**S(2)*Gamma(S(-2)/3, -e/(c + d*x)**S(3))/(S(3)*d**S(2)) - (-e/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)*(-a*d/S(3) + b*c/S(3))*Gamma(S(-1)/3, -e/(c + d*x)**S(3))/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(3)), x), x, (-e/(c + d*x)**S(3))**(S(1)/3)*(c + d*x)*Gamma(S(-1)/3, -e/(c + d*x)**S(3))/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(3))/(a + b*x), x), x, Integral(exp(e/(c + d*x)**S(3))/(a + b*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(e/(c + d*x)**S(3))/(a + b*x)**S(2), x), x, Integral(exp(e/(c + d*x)**S(3))/(a + b*x)**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e + f*(a + b*x)/(c + d*x))/(g + h*x), x), x, F**(e + f*(-a*h + b*g)/(-c*h + d*g))*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/h - F**(b*f/d + e)*Ei(f*(a*d - b*c)*log(F)/(d*(c + d*x)))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e + f*(a + b*x)/(c + d*x))/(g + h*x)**S(2), x), x, -F**(e + f*(a + b*x)/(c + d*x))/(h*(g + h*x)) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*f*(-a*d + b*c)*log(F)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(-c*h + d*g)**S(2) + F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d/(h*(-c*h + d*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e + f*(a + b*x)/(c + d*x))/(g + h*x)**S(3), x), x, -F**(e + f*(a + b*x)/(c + d*x))*f*(-a*d/S(2) + b*c/S(2))*log(F)/((g + h*x)*(-c*h + d*g)**S(2)) - F**(e + f*(a + b*x)/(c + d*x))/(S(2)*h*(g + h*x)**S(2)) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*d*f*(-a*d + b*c)*log(F)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(-c*h + d*g)**S(3) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*f**S(2)*h*(-a*d + b*c)**S(2)*log(F)**S(2)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(S(2)*(-c*h + d*g)**S(4)) + F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d**S(2)/(S(2)*h*(-c*h + d*g)**S(2)) + F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d*f*(-a*d + b*c)*log(F)/(S(2)*(-c*h + d*g)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e + f*(a + b*x)/(c + d*x))/(g + h*x)**S(4), x), x, -S(2)*F**(e + f*(a + b*x)/(c + d*x))*d*f*(-a*d + b*c)*log(F)/(S(3)*(g + h*x)*(-c*h + d*g)**S(3)) - F**(e + f*(a + b*x)/(c + d*x))*f**S(2)*h*(-a*d + b*c)**S(2)*log(F)**S(2)/(S(6)*(g + h*x)*(-c*h + d*g)**S(4)) - F**(e + f*(a + b*x)/(c + d*x))*f*(-a*d/S(6) + b*c/S(6))*log(F)/((g + h*x)**S(2)*(-c*h + d*g)**S(2)) - F**(e + f*(a + b*x)/(c + d*x))/(S(3)*h*(g + h*x)**S(3)) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*d**S(2)*f*(-a*d + b*c)*log(F)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(-c*h + d*g)**S(4) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*d*f**S(2)*h*(-a*d + b*c)**S(2)*log(F)**S(2)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(-c*h + d*g)**S(5) + F**(e + f*(-a*h + b*g)/(-c*h + d*g))*f**S(3)*h**S(2)*(-a*d + b*c)**S(3)*log(F)**S(3)*Ei(f*(g + h*x)*(a*d - b*c)*log(F)/((c + d*x)*(-c*h + d*g)))/(S(6)*(-c*h + d*g)**S(6)) + F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d**S(3)/(S(3)*h*(-c*h + d*g)**S(3)) + S(5)*F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d**S(2)*f*(-a*d + b*c)*log(F)/(S(6)*(-c*h + d*g)**S(4)) + F**(b*f/d + e - f*(-a*d + b*c)/(d*(c + d*x)))*d*f**S(2)*h*(-a*d + b*c)**S(2)*log(F)**S(2)/(S(6)*(-c*h + d*g)**S(5)), expand=True, _diff=True, _numerical=True) # fails 1940 and 1939 recursion assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*x**S(3), x), x, -sqrt(pi)*b**S(3)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(16)*c**(S(7)/2)*sqrt(log(f))) + b**S(2)*f**(a + b*x + c*x**S(2))/(S(8)*c**S(3)*log(f)) - b*f**(a + b*x + c*x**S(2))*x/(S(4)*c**S(2)*log(f)) + S(3)*sqrt(pi)*b*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(8)*c**(S(5)/2)*log(f)**(S(3)/2)) + f**(a + b*x + c*x**S(2))*x**S(2)/(S(2)*c*log(f)) - f**(a + b*x + c*x**S(2))/(S(2)*c**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*x**S(2), x), x, sqrt(pi)*b**S(2)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(8)*c**(S(5)/2)*sqrt(log(f))) - b*f**(a + b*x + c*x**S(2))/(S(4)*c**S(2)*log(f)) + f**(a + b*x + c*x**S(2))*x/(S(2)*c*log(f)) - sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(4)*c**(S(3)/2)*log(f)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*x, x), x, -sqrt(pi)*b*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(4)*c**(S(3)/2)*sqrt(log(f))) + f**(a + b*x + c*x**S(2))/(S(2)*c*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2)), x), x, sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(2)*sqrt(c)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/x, x), x, Integral(f**(a + b*x + c*x**S(2))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/x**S(2), x), x, b*log(f)*Integral(f**(a + b*x + c*x**S(2))/x, x) + sqrt(pi)*sqrt(c)*f**(a - b**S(2)/(S(4)*c))*sqrt(log(f))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c)) - f**(a + b*x + c*x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(a + b*x - c*x**S(2)), x), x, -sqrt(pi)*b**S(3)*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(16)*c**(S(7)/2)) - b**S(2)*exp(a + b*x - c*x**S(2))/(S(8)*c**S(3)) - b*x*exp(a + b*x - c*x**S(2))/(S(4)*c**S(2)) - S(3)*sqrt(pi)*b*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(8)*c**(S(5)/2)) - x**S(2)*exp(a + b*x - c*x**S(2))/(S(2)*c) - exp(a + b*x - c*x**S(2))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(a + b*x - c*x**S(2)), x), x, -sqrt(pi)*b**S(2)*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(8)*c**(S(5)/2)) - b*exp(a + b*x - c*x**S(2))/(S(4)*c**S(2)) - x*exp(a + b*x - c*x**S(2))/(S(2)*c) - sqrt(pi)*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(4)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(a + b*x - c*x**S(2)), x), x, -sqrt(pi)*b*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(4)*c**(S(3)/2)) - exp(a + b*x - c*x**S(2))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x - c*x**S(2)), x), x, -sqrt(pi)*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c))/(S(2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x - c*x**S(2))/x, x), x, Integral(exp(a + b*x - c*x**S(2))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x - c*x**S(2))/x**S(2), x), x, b*Integral(exp(a + b*x - c*x**S(2))/x, x) + sqrt(pi)*sqrt(c)*exp(a + b**S(2)/(S(4)*c))*erf((b/S(2) - c*x)/sqrt(c)) - exp(a + b*x - c*x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp((a + b*x)*(c + d*x)), x), x, x**S(2)*exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(S(2)*b*d) - x*(a*d/S(4) + b*c/S(4))*exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(b**S(2)*d**S(2)) - exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(S(2)*b**S(2)*d**S(2)) + (a*d + b*c)**S(2)*exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(S(8)*b**S(3)*d**S(3)) + sqrt(pi)*(S(3)*a*d/S(8) + S(3)*b*c/S(8))*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(b**(S(5)/2)*d**(S(5)/2)) - sqrt(pi)*(a*d + b*c)**S(3)*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(S(16)*b**(S(7)/2)*d**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp((a + b*x)*(c + d*x)), x), x, x*exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(S(2)*b*d) + (-a*d/S(4) - b*c/S(4))*exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(b**S(2)*d**S(2)) - sqrt(pi)*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(S(4)*b**(S(3)/2)*d**(S(3)/2)) + sqrt(pi)*(a*d + b*c)**S(2)*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(S(8)*b**(S(5)/2)*d**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp((a + b*x)*(c + d*x)), x), x, exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/(S(2)*b*d) - sqrt(pi)*(a*d/S(4) + b*c/S(4))*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(b**(S(3)/2)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp((a + b*x)*(c + d*x)), x), x, sqrt(pi)*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d)))/(S(2)*sqrt(b)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp((a + b*x)*(c + d*x))/x, x), x, Integral(exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp((a + b*x)*(c + d*x))/x**S(2), x), x, sqrt(pi)*sqrt(b)*sqrt(d)*exp(-(-a*d + b*c)**S(2)/(S(4)*b*d))*erfi((a*d/S(2) + b*c/S(2) + b*d*x)/(sqrt(b)*sqrt(d))) + (a*d + b*c)*Integral(exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/x, x) - exp(a*c + b*d*x**S(2) + x*(a*d + b*c))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(d + e*x)**S(3), x), x, e*f**(a + b*x + c*x**S(2))*(d + e*x)**S(2)/(S(2)*c*log(f)) - e**S(3)*f**(a + b*x + c*x**S(2))/(S(2)*c**S(2)*log(f)**S(2)) + e*f**(a + b*x + c*x**S(2))*(d + e*x)*(-b*e + S(2)*c*d)/(S(4)*c**S(2)*log(f)) + e*f**(a + b*x + c*x**S(2))*(-b*e + S(2)*c*d)**S(2)/(S(8)*c**S(3)*log(f)) - S(3)*sqrt(pi)*e**S(2)*f**(a - b**S(2)/(S(4)*c))*(-b*e + S(2)*c*d)*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(8)*c**(S(5)/2)*log(f)**(S(3)/2)) + sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*(-b*e + S(2)*c*d)**S(3)*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(16)*c**(S(7)/2)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(d + e*x)**S(2), x), x, e*f**(a + b*x + c*x**S(2))*(d + e*x)/(S(2)*c*log(f)) + e*f**(a + b*x + c*x**S(2))*(-b*e + S(2)*c*d)/(S(4)*c**S(2)*log(f)) - sqrt(pi)*e**S(2)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(4)*c**(S(3)/2)*log(f)**(S(3)/2)) + sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*(-b*e + S(2)*c*d)**S(2)*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(8)*c**(S(5)/2)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(d + e*x), x), x, e*f**(a + b*x + c*x**S(2))/(S(2)*c*log(f)) + sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*(-b*e/S(4) + c*d/S(2))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(c**(S(3)/2)*sqrt(log(f))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(d + e*x), x), x, Integral(f**(a + b*x + c*x**S(2))/(d + e*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(d + e*x)**S(2), x), x, sqrt(pi)*sqrt(c)*f**(a - b**S(2)/(S(4)*c))*sqrt(log(f))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/e**S(2) - f**(a + b*x + c*x**S(2))/(e*(d + e*x)) - (-b*e + S(2)*c*d)*log(f)*Integral(f**(a + b*x + c*x**S(2))/(d + e*x), x)/e**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(d + e*x)**S(3), x), x, -sqrt(pi)*sqrt(c)*f**(a - b**S(2)/(S(4)*c))*(-b*e/S(2) + c*d)*log(f)**(S(3)/2)*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/e**S(4) + c*log(f)*Integral(f**(a + b*x + c*x**S(2))/(d + e*x), x)/e**S(2) - f**(a + b*x + c*x**S(2))/(S(2)*e*(d + e*x)**S(2)) + f**(a + b*x + c*x**S(2))*(-b*e/S(2) + c*d)*log(f)/(e**S(3)*(d + e*x)) + (-b*e + S(2)*c*d)**S(2)*log(f)**S(2)*Integral(f**(a + b*x + c*x**S(2))/(d + e*x), x)/(S(2)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(b + S(2)*c*x)**S(3), x), x, -S(4)*c*f**(a + b*x + c*x**S(2))/log(f)**S(2) + f**(a + b*x + c*x**S(2))*(b + S(2)*c*x)**S(2)/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(b + S(2)*c*x)**S(2), x), x, -sqrt(pi)*sqrt(c)*f**(a - b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/log(f)**(S(3)/2) + f**(a + b*x + c*x**S(2))*(b + S(2)*c*x)/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*(b + S(2)*c*x), x), x, f**(a + b*x + c*x**S(2))/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(b + S(2)*c*x), x), x, f**(a - b**S(2)/(S(4)*c))*Ei((b + S(2)*c*x)**S(2)*log(f)/(S(4)*c))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(b + S(2)*c*x)**S(2), x), x, -f**(a + b*x + c*x**S(2))/(S(2)*c*(b + S(2)*c*x)) + sqrt(pi)*f**(a - b**S(2)/(S(4)*c))*sqrt(log(f))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(4)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))/(b + S(2)*c*x)**S(3), x), x, -f**(a + b*x + c*x**S(2))/(S(4)*c*(b + S(2)*c*x)**S(2)) + f**(a - b**S(2)/(S(4)*c))*log(f)*Ei((b + S(2)*c*x)**S(2)*log(f)/(S(4)*c))/(S(16)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))*(b + S(2)*c*x)**S(3), x), x, -S(4)*c*f**(b*x + c*x**S(2))/log(f)**S(2) + f**(b*x + c*x**S(2))*(b + S(2)*c*x)**S(2)/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))*(b + S(2)*c*x)**S(2), x), x, -sqrt(pi)*sqrt(c)*f**(-b**S(2)/(S(4)*c))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/log(f)**(S(3)/2) + f**(b*x + c*x**S(2))*(b + S(2)*c*x)/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))*(b + S(2)*c*x), x), x, f**(b*x + c*x**S(2))/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))/(b + S(2)*c*x), x), x, f**(-b**S(2)/(S(4)*c))*Ei((b + S(2)*c*x)**S(2)*log(f)/(S(4)*c))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))/(b + S(2)*c*x)**S(2), x), x, -f**(b*x + c*x**S(2))/(S(2)*c*(b + S(2)*c*x)) + sqrt(pi)*f**(-b**S(2)/(S(4)*c))*sqrt(log(f))*erfi((b/S(2) + c*x)*sqrt(log(f))/sqrt(c))/(S(4)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(b*x + c*x**S(2))/(b + S(2)*c*x)**S(3), x), x, -f**(b*x + c*x**S(2))/(S(4)*c*(b + S(2)*c*x)**S(2)) + f**(-b**S(2)/(S(4)*c))*log(f)*Ei((b + S(2)*c*x)**S(2)*log(f)/(S(4)*c))/(S(16)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*exp(c + d*x))), x), x, Integral(S(1)/(x*(a + b*exp(c + d*x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*exp(c + d*x)), x), x, x/a - log(a + b*exp(c + d*x))/(a*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*exp(c + d*x)), x), x, -x*log(a*exp(-c - d*x)/b + S(1))/(a*d) + polylog(S(2), -a*exp(-c - d*x)/b)/(a*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*exp(c + d*x)), x), x, -x**S(2)*log(a*exp(-c - d*x)/b + S(1))/(a*d) + S(2)*x*polylog(S(2), -a*exp(-c - d*x)/b)/(a*d**S(2)) + S(2)*polylog(S(3), -a*exp(-c - d*x)/b)/(a*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*exp(c + d*x)), x), x, -x**S(3)*log(a*exp(-c - d*x)/b + S(1))/(a*d) + S(3)*x**S(2)*polylog(S(2), -a*exp(-c - d*x)/b)/(a*d**S(2)) + S(6)*x*polylog(S(3), -a*exp(-c - d*x)/b)/(a*d**S(3)) + S(6)*polylog(S(4), -a*exp(-c - d*x)/b)/(a*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*exp(c - d*x)), x), x, x/a + log(a + b*exp(c - d*x))/(a*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*exp(-c - d*x)), x), x, x/a + log(a + b*exp(-c - d*x))/(a*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*exp(c + d*x))**S(2)), x), x, Integral(S(1)/(x*(a + b*exp(c + d*x))**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c + d*x))**(S(-2)), x), x, S(1)/(a*d*(a + b*exp(c + d*x))) + x/a**S(2) - log(a + b*exp(c + d*x))/(a**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*exp(c + d*x))**S(2), x), x, x/(a*d*(a + b*exp(c + d*x))) + x**S(2)/(S(2)*a**S(2)) - x*log(S(1) + b*exp(c + d*x)/a)/(a**S(2)*d) - x/(a**S(2)*d) + log(a + b*exp(c + d*x))/(a**S(2)*d**S(2)) - polylog(S(2), -b*exp(c + d*x)/a)/(a**S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*exp(c + d*x))**S(2), x), x, x**S(2)/(a*d*(a + b*exp(c + d*x))) + x**S(3)/(S(3)*a**S(2)) - x**S(2)*log(S(1) + b*exp(c + d*x)/a)/(a**S(2)*d) + S(2)*x*log(a*exp(-c - d*x)/b + S(1))/(a**S(2)*d**S(2)) - S(2)*x*polylog(S(2), -b*exp(c + d*x)/a)/(a**S(2)*d**S(2)) - S(2)*polylog(S(2), -a*exp(-c - d*x)/b)/(a**S(2)*d**S(3)) + S(2)*polylog(S(3), -b*exp(c + d*x)/a)/(a**S(2)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*exp(c + d*x))**S(2), x), x, x**S(3)/(a*d*(a + b*exp(c + d*x))) + x**S(4)/(S(4)*a**S(2)) - x**S(3)*log(S(1) + b*exp(c + d*x)/a)/(a**S(2)*d) + S(3)*x**S(2)*log(a*exp(-c - d*x)/b + S(1))/(a**S(2)*d**S(2)) - S(3)*x**S(2)*polylog(S(2), -b*exp(c + d*x)/a)/(a**S(2)*d**S(2)) - S(6)*x*polylog(S(2), -a*exp(-c - d*x)/b)/(a**S(2)*d**S(3)) + S(6)*x*polylog(S(3), -b*exp(c + d*x)/a)/(a**S(2)*d**S(3)) - S(6)*polylog(S(3), -a*exp(-c - d*x)/b)/(a**S(2)*d**S(4)) - S(6)*polylog(S(4), -b*exp(c + d*x)/a)/(a**S(2)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c - d*x))**(S(-2)), x), x, -S(1)/(a*d*(a + b*exp(c - d*x))) + x/a**S(2) + log(a + b*exp(c - d*x))/(a**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(-c - d*x))**(S(-2)), x), x, -S(1)/(a*d*(a + b*exp(-c - d*x))) + x/a**S(2) + log(a + b*exp(-c - d*x))/(a**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*exp(c + d*x))**S(3)), x), x, Integral(S(1)/(x*(a + b*exp(c + d*x))**S(3)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c + d*x))**(S(-3)), x), x, S(1)/(S(2)*a*d*(a + b*exp(c + d*x))**S(2)) + S(1)/(a**S(2)*d*(a + b*exp(c + d*x))) + x/a**S(3) - log(a + b*exp(c + d*x))/(a**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*exp(c + d*x))**S(3), x), x, x/(S(2)*a*d*(a + b*exp(c + d*x))**S(2)) + x/(a**S(2)*d*(a + b*exp(c + d*x))) - S(1)/(S(2)*a**S(2)*d**S(2)*(a + b*exp(c + d*x))) + x**S(2)/(S(2)*a**S(3)) - x*log(S(1) + b*exp(c + d*x)/a)/(a**S(3)*d) - S(3)*x/(S(2)*a**S(3)*d) + S(3)*log(a + b*exp(c + d*x))/(S(2)*a**S(3)*d**S(2)) - polylog(S(2), -b*exp(c + d*x)/a)/(a**S(3)*d**S(2)), expand=True, _diff=True, _numerical=True) # recursion assert rubi_test(rubi_integrate(x**S(2)/(a + b*exp(c + d*x))**S(3), x), x, x**S(2)/(S(2)*a*d*(a + b*exp(c + d*x))**S(2)) + x**S(2)/(a**S(2)*d*(a + b*exp(c + d*x))) - x/(a**S(2)*d**S(2)*(a + b*exp(c + d*x))) + x**S(3)/(S(3)*a**S(3)) - x**S(2)*log(S(1) + b*exp(c + d*x)/a)/(a**S(3)*d) - S(3)*x**S(2)/(S(2)*a**S(3)*d) + S(3)*x*log(S(1) + b*exp(c + d*x)/a)/(a**S(3)*d**S(2)) - S(2)*x*polylog(S(2), -b*exp(c + d*x)/a)/(a**S(3)*d**S(2)) + x/(a**S(3)*d**S(2)) - log(a + b*exp(c + d*x))/(a**S(3)*d**S(3)) + S(3)*polylog(S(2), -b*exp(c + d*x)/a)/(a**S(3)*d**S(3)) + S(2)*polylog(S(3), -b*exp(c + d*x)/a)/(a**S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)/(a + b*exp(c + d*x))**S(3), x), x, x**S(2)/(S(2)*a*d*(a + b*exp(c + d*x))**S(2)) + x**S(2)/(a**S(2)*d*(a + b*exp(c + d*x))) - x/(a**S(2)*d**S(2)*(a + b*exp(c + d*x))) + x**S(3)/(S(3)*a**S(3)) - x**S(2)*log(S(1) + b*exp(c + d*x)/a)/(a**S(3)*d) - x**S(2)/(S(2)*a**S(3)*d) + x*log(S(1) + b*exp(c + d*x)/a)/(a**S(3)*d**S(2)) + S(2)*x*log(a*exp(-c - d*x)/b + S(1))/(a**S(3)*d**S(2)) - S(2)*x*polylog(S(2), -b*exp(c + d*x)/a)/(a**S(3)*d**S(2)) + x/(a**S(3)*d**S(2)) - log(a + b*exp(c + d*x))/(a**S(3)*d**S(3)) + polylog(S(2), -b*exp(c + d*x)/a)/(a**S(3)*d**S(3)) - S(2)*polylog(S(2), -a*exp(-c - d*x)/b)/(a**S(3)*d**S(3)) + S(2)*polylog(S(3), -b*exp(c + d*x)/a)/(a**S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(c - d*x))**(S(-3)), x), x, -S(1)/(S(2)*a*d*(a + b*exp(c - d*x))**S(2)) - S(1)/(a**S(2)*d*(a + b*exp(c - d*x))) + x/a**S(3) + log(a + b*exp(c - d*x))/(a**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(-c - d*x))**(S(-3)), x), x, -S(1)/(S(2)*a*d*(a + b*exp(-c - d*x))**S(2)) - S(1)/(a**S(2)*d*(a + b*exp(-c - d*x))) + x/a**S(3) + log(a + b*exp(-c - d*x))/(a**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x)/(x**S(2)*(c + d*x**S(2))), x), x, b*exp(a)*Ei(b*x)/c - sqrt(d)*exp(a - b*sqrt(-c)/sqrt(d))*Ei(b*(sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*(-c)**(S(3)/2)) + sqrt(d)*exp(a + b*sqrt(-c)/sqrt(d))*Ei(-b*(-sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*(-c)**(S(3)/2)) - exp(a + b*x)/(c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x)/(x*(c + d*x**S(2))), x), x, exp(a)*Ei(b*x)/c - exp(a - b*sqrt(-c)/sqrt(d))*Ei(b*(sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*c) - exp(a + b*sqrt(-c)/sqrt(d))*Ei(-b*(-sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x)/(c + d*x**S(2)), x), x, -exp(a - b*sqrt(-c)/sqrt(d))*Ei(b*(sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*sqrt(d)*sqrt(-c)) + exp(a + b*sqrt(-c)/sqrt(d))*Ei(-b*(-sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*sqrt(d)*sqrt(-c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(a + b*x)/(c + d*x**S(2)), x), x, exp(a - b*sqrt(-c)/sqrt(d))*Ei(b*(sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*d) + exp(a + b*sqrt(-c)/sqrt(d))*Ei(-b*(-sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(a + b*x)/(c + d*x**S(2)), x), x, -sqrt(-c)*exp(a - b*sqrt(-c)/sqrt(d))*Ei(b*(sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*d**(S(3)/2)) + sqrt(-c)*exp(a + b*sqrt(-c)/sqrt(d))*Ei(-b*(-sqrt(d)*x + sqrt(-c))/sqrt(d))/(S(2)*d**(S(3)/2)) + exp(a + b*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(d + e*x)/(x**S(2)*(a + b*x + c*x**S(2))), x), x, e*exp(d)*Ei(e*x)/a - exp(d + e*x)/(a*x) - b*exp(d)*Ei(e*x)/a**S(2) + (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*a**S(2)) + (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(d + e*x)/(x*(a + b*x + c*x**S(2))), x), x, -(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*a) - (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*a) + exp(d)*Ei(e*x)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(d + e*x)/(a + b*x + c*x**S(2)), x), x, exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/sqrt(-S(4)*a*c + b**S(2)) - exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(d + e*x)/(a + b*x + c*x**S(2)), x), x, (-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c) + (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(d + e*x)/(a + b*x + c*x**S(2)), x), x, exp(d + e*x)/(c*e) - (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c**S(2)) - (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(d + e*x)/(a + b*x + c*x**S(2)), x), x, -b*exp(d + e*x)/(c**S(2)*e) + x*exp(d + e*x)/(c*e) - exp(d + e*x)/(c*e**S(2)) + (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c**S(3)) + (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*exp(d - e*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))*Ei(e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/(S(2)**x*b + a), x), x, S(2)**x/(b*log(S(2))) - a*log(S(2)**x*b + a)/(b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/(S(2)**x*b + a), x), x, S(2)**x/(b*log(S(2))) - a*log(S(2)**x*b + a)/(b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/(-S(2)**x*b + a), x), x, -S(2)**x/(b*log(S(2))) - a*log(-S(2)**x*b + a)/(b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/(-S(2)**x*b + a), x), x, -S(2)**x/(b*log(S(2))) - a*log(-S(2)**x*b + a)/(b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/(a + S(2)**(-x)*b), x), x, -S(2)**x*b/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))/(a*log(S(2))) + b**S(2)*x/a**S(3) + b**S(2)*log(a + S(2)**(-x)*b)/(a**S(3)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/(a + S(2)**(-x)*b), x), x, -S(2)**x*b/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))/(a*log(S(2))) + b**S(2)*x/a**S(3) + b**S(2)*log(a + S(2)**(-x)*b)/(a**S(3)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/(a - S(2)**(-x)*b), x), x, S(2)**x*b/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))/(a*log(S(2))) + b**S(2)*x/a**S(3) + b**S(2)*log(a - S(2)**(-x)*b)/(a**S(3)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/(a - S(2)**(-x)*b), x), x, S(2)**x*b/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))/(a*log(S(2))) + b**S(2)*x/a**S(3) + b**S(2)*log(a - S(2)**(-x)*b)/(a**S(3)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(S(4)**x*b + a), x), x, atan(S(2)**x*sqrt(b)/sqrt(a))/(sqrt(a)*sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(S(2)**(S(2)*x)*b + a), x), x, atan(S(2)**x*sqrt(b)/sqrt(a))/(sqrt(a)*sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(-S(4)**x*b + a), x), x, atanh(S(2)**x*sqrt(b)/sqrt(a))/(sqrt(a)*sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(-S(2)**(S(2)*x)*b + a), x), x, atanh(S(2)**x*sqrt(b)/sqrt(a))/(sqrt(a)*sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(a + S(4)**(-x)*b), x), x, S(2)**x/(a*log(S(2))) - sqrt(b)*atan(S(2)**x*sqrt(a)/sqrt(b))/(a**(S(3)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(a + S(2)**(-S(2)*x)*b), x), x, S(2)**x/(a*log(S(2))) - sqrt(b)*atan(S(2)**x*sqrt(a)/sqrt(b))/(a**(S(3)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(a - S(4)**(-x)*b), x), x, S(2)**x/(a*log(S(2))) - sqrt(b)*atanh(S(2)**x*sqrt(a)/sqrt(b))/(a**(S(3)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/(a - S(2)**(-S(2)*x)*b), x), x, S(2)**x/(a*log(S(2))) - sqrt(b)*atanh(S(2)**x*sqrt(a)/sqrt(b))/(a**(S(3)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(S(4)**x*b + a), x), x, atanh(S(2)**x*sqrt(b)/sqrt(S(2)**(S(2)*x)*b + a))/(sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(S(2)**(S(2)*x)*b + a), x), x, atanh(S(2)**x*sqrt(b)/sqrt(S(2)**(S(2)*x)*b + a))/(sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(-S(4)**x*b + a), x), x, atan(S(2)**x*sqrt(b)/sqrt(-S(2)**(S(2)*x)*b + a))/(sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(-S(2)**(S(2)*x)*b + a), x), x, atan(S(2)**x*sqrt(b)/sqrt(-S(2)**(S(2)*x)*b + a))/(sqrt(b)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(a + S(4)**(-x)*b), x), x, S(2)**x*sqrt(a + S(2)**(-S(2)*x)*b)/(a*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(a + S(2)**(-S(2)*x)*b), x), x, S(2)**x*sqrt(a + S(2)**(-S(2)*x)*b)/(a*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(a - S(4)**(-x)*b), x), x, S(2)**x*sqrt(a - S(2)**(-S(2)*x)*b)/(a*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x/sqrt(a - S(2)**(-S(2)*x)*b), x), x, S(2)**x*sqrt(a - S(2)**(-S(2)*x)*b)/(a*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/sqrt(S(2)**x*b + a), x), x, -S(2)*a*sqrt(S(2)**x*b + a)/(b**S(2)*log(S(2))) + S(2)*(S(2)**x*b + a)**(S(3)/2)/(S(3)*b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/sqrt(S(2)**x*b + a), x), x, -S(2)*a*sqrt(S(2)**x*b + a)/(b**S(2)*log(S(2))) + S(2)*(S(2)**x*b + a)**(S(3)/2)/(S(3)*b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/sqrt(-S(2)**x*b + a), x), x, -S(2)*a*sqrt(-S(2)**x*b + a)/(b**S(2)*log(S(2))) + S(2)*(-S(2)**x*b + a)**(S(3)/2)/(S(3)*b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/sqrt(-S(2)**x*b + a), x), x, -S(2)*a*sqrt(-S(2)**x*b + a)/(b**S(2)*log(S(2))) + S(2)*(-S(2)**x*b + a)**(S(3)/2)/(S(3)*b**S(2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/sqrt(a + S(2)**(-x)*b), x), x, -S(3)*S(2)**(x + S(-2))*b*sqrt(a + S(2)**(-x)*b)/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))*sqrt(a + S(2)**(-x)*b)/(a*log(S(2))) + S(3)*b**S(2)*atanh(sqrt(a + S(2)**(-x)*b)/sqrt(a))/(S(4)*a**(S(5)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/sqrt(a + S(2)**(-x)*b), x), x, -S(3)*S(2)**(x + S(-2))*b*sqrt(a + S(2)**(-x)*b)/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))*sqrt(a + S(2)**(-x)*b)/(a*log(S(2))) + S(3)*b**S(2)*atanh(sqrt(a + S(2)**(-x)*b)/sqrt(a))/(S(4)*a**(S(5)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)**x/sqrt(a - S(2)**(-x)*b), x), x, S(3)*S(2)**(x + S(-2))*b*sqrt(a - S(2)**(-x)*b)/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))*sqrt(a - S(2)**(-x)*b)/(a*log(S(2))) + S(3)*b**S(2)*atanh(sqrt(a - S(2)**(-x)*b)/sqrt(a))/(S(4)*a**(S(5)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(2)*x)/sqrt(a - S(2)**(-x)*b), x), x, S(3)*S(2)**(x + S(-2))*b*sqrt(a - S(2)**(-x)*b)/(a**S(2)*log(S(2))) + S(2)**(S(2)*x + S(-1))*sqrt(a - S(2)**(-x)*b)/(a*log(S(2))) + S(3)*b**S(2)*atanh(sqrt(a - S(2)**(-x)*b)/sqrt(a))/(S(4)*a**(S(5)/2)*log(S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(2)*x) + S(2)*exp(x) + S(1)), x), x, x - log(exp(x) + S(1)) + S(1)/(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(2)*x) + S(3)*exp(x) + S(2)), x), x, x/S(2) - log(exp(x) + S(1)) + log(exp(x) + S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(2)*x) + exp(x) + S(-1)), x), x, -x + (-sqrt(S(5)) + S(5))*log(S(2)*exp(x) + S(1) + sqrt(S(5)))/S(10) + (sqrt(S(5)) + S(5))*log(S(2)*exp(x) - sqrt(S(5)) + S(1))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(2)*x) + S(3)*exp(x) + S(3)), x), x, x/S(3) - log(exp(S(2)*x) + S(3)*exp(x) + S(3))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*exp(x) + S(3))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*exp(x) + c*exp(S(2)*x)), x), x, b*atanh((b + S(2)*c*exp(x))/sqrt(-S(4)*a*c + b**S(2)))/(a*sqrt(-S(4)*a*c + b**S(2))) + x/a - log(a + b*exp(x) + c*exp(S(2)*x))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(exp(S(2)*x) + S(2)*exp(x) + S(1)), x), x, x**S(2)/S(2) - x*log(exp(x) + S(1)) - x + x/(exp(x) + S(1)) + log(exp(x) + S(1)) - polylog(S(2), -exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(exp(S(2)*x) + S(3)*exp(x) + S(2)), x), x, -x*log(S(1) + exp(-x)) + x*log(S(1) + S(2)*exp(-x))/S(2) - polylog(S(2), -S(2)*exp(-x))/S(2) + polylog(S(2), -exp(-x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(exp(S(2)*x) + exp(x) + S(-1)), x), x, S(2)*sqrt(S(5))*x*log(S(1) + (S(1)/2 + sqrt(S(5))/S(2))*exp(-x))/(S(5)*(S(1) + sqrt(S(5)))) - S(2)*sqrt(S(5))*x*log(S(1) + (-sqrt(S(5))/S(2) + S(1)/2)*exp(-x))/(S(5)*(-sqrt(S(5)) + S(1))) + S(2)*sqrt(S(5))*polylog(S(2), (S(-1)/2 + sqrt(S(5))/S(2))*exp(-x))/(S(5)*(-sqrt(S(5)) + S(1))) - S(2)*sqrt(S(5))*polylog(S(2), (-sqrt(S(5))/S(2) + S(-1)/2)*exp(-x))/(S(5)*(S(1) + sqrt(S(5)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(exp(S(2)*x) + S(3)*exp(x) + S(3)), x), x, -S(2)*sqrt(S(3))*x*log(S(1) + (S(3)/2 - sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(sqrt(S(3)) + S(3)*I)) + S(2)*sqrt(S(3))*x*log(S(1) + (S(3)/2 + sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(-sqrt(S(3)) + S(3)*I)) - S(2)*sqrt(S(3))*polylog(S(2), (S(-3)/2 - sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(-sqrt(S(3)) + S(3)*I)) + S(2)*sqrt(S(3))*polylog(S(2), (S(-3)/2 + sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(sqrt(S(3)) + S(3)*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*exp(x) + c*exp(S(2)*x)), x), x, S(2)*c*x*log(S(1) + (b/S(2) + sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*x*log(S(1) + (b/S(2) - sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*polylog(S(2), (-b/S(2) - sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*polylog(S(2), (-b/S(2) + sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(exp(S(2)*x) + S(2)*exp(x) + S(1)), x), x, x**S(3)/S(3) - x**S(2)*log(exp(x) + S(1)) + x**S(2)/(exp(x) + S(1)) + S(2)*x*log(S(1) + exp(-x)) - S(2)*x*polylog(S(2), -exp(x)) - S(2)*polylog(S(2), -exp(-x)) + S(2)*polylog(S(3), -exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(exp(S(2)*x) + S(3)*exp(x) + S(2)), x), x, -x**S(2)*log(S(1) + exp(-x)) + x**S(2)*log(S(1) + S(2)*exp(-x))/S(2) - x*polylog(S(2), -S(2)*exp(-x)) + S(2)*x*polylog(S(2), -exp(-x)) - polylog(S(3), -S(2)*exp(-x)) + S(2)*polylog(S(3), -exp(-x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(exp(S(2)*x) + exp(x) + S(-1)), x), x, S(2)*sqrt(S(5))*x**S(2)*log(S(1) + (S(1)/2 + sqrt(S(5))/S(2))*exp(-x))/(S(5)*(S(1) + sqrt(S(5)))) - S(2)*sqrt(S(5))*x**S(2)*log(S(1) + (-sqrt(S(5))/S(2) + S(1)/2)*exp(-x))/(S(5)*(-sqrt(S(5)) + S(1))) + S(4)*sqrt(S(5))*x*polylog(S(2), (S(-1)/2 + sqrt(S(5))/S(2))*exp(-x))/(S(5)*(-sqrt(S(5)) + S(1))) - S(4)*sqrt(S(5))*x*polylog(S(2), (-sqrt(S(5))/S(2) + S(-1)/2)*exp(-x))/(S(5)*(S(1) + sqrt(S(5)))) + S(4)*sqrt(S(5))*polylog(S(3), (S(-1)/2 + sqrt(S(5))/S(2))*exp(-x))/(S(5)*(-sqrt(S(5)) + S(1))) - S(4)*sqrt(S(5))*polylog(S(3), (-sqrt(S(5))/S(2) + S(-1)/2)*exp(-x))/(S(5)*(S(1) + sqrt(S(5)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(exp(S(2)*x) + S(3)*exp(x) + S(3)), x), x, -S(2)*sqrt(S(3))*x**S(2)*log(S(1) + (S(3)/2 - sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(sqrt(S(3)) + S(3)*I)) + S(2)*sqrt(S(3))*x**S(2)*log(S(1) + (S(3)/2 + sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(-sqrt(S(3)) + S(3)*I)) - S(4)*sqrt(S(3))*x*polylog(S(2), (S(-3)/2 - sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(-sqrt(S(3)) + S(3)*I)) + S(4)*sqrt(S(3))*x*polylog(S(2), (S(-3)/2 + sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(sqrt(S(3)) + S(3)*I)) - S(4)*sqrt(S(3))*polylog(S(3), (S(-3)/2 - sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(-sqrt(S(3)) + S(3)*I)) + S(4)*sqrt(S(3))*polylog(S(3), (S(-3)/2 + sqrt(S(3))*I/S(2))*exp(-x))/(S(3)*(sqrt(S(3)) + S(3)*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*exp(x) + c*exp(S(2)*x)), x), x, S(2)*c*x**S(2)*log(S(1) + (b/S(2) + sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*x**S(2)*log(S(1) + (b/S(2) - sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - S(4)*c*x*polylog(S(2), (-b/S(2) - sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(4)*c*x*polylog(S(2), (-b/S(2) + sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - S(4)*c*polylog(S(3), (-b/S(2) - sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(4)*c*polylog(S(3), (-b/S(2) + sqrt(-S(4)*a*c + b**S(2))/S(2))*exp(-x)/c)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(2)*f**(c + d*x) + f**(S(2)*c + S(2)*d*x) + S(1)), x), x, x - log(f**(c + d*x) + S(1))/(d*log(f)) + S(1)/(d*(f**(c + d*x) + S(1))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*f**(c + d*x) + c*f**(S(2)*c + S(2)*d*x)), x), x, b*atanh((b + S(2)*c*f**(c + d*x))/sqrt(-S(4)*a*c + b**S(2)))/(a*d*sqrt(-S(4)*a*c + b**S(2))*log(f)) + x/a - log(a + b*f**(c + d*x) + c*f**(S(2)*c + S(2)*d*x))/(S(2)*a*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x)), x), x, b*atanh((b + S(2)*c*f**(g + h*x))/sqrt(-S(4)*a*c + b**S(2)))/(a*h*sqrt(-S(4)*a*c + b**S(2))*log(f)) + x/a - log(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x))/(S(2)*a*h*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(S(2)*f**(c + d*x) + f**(S(2)*c + S(2)*d*x) + S(1)), x), x, x**S(2)/S(2) - x*log(f**(c + d*x) + S(1))/(d*log(f)) - x/(d*log(f)) + x/(d*(f**(c + d*x) + S(1))*log(f)) + log(f**(c + d*x) + S(1))/(d**S(2)*log(f)**S(2)) - polylog(S(2), -f**(c + d*x))/(d**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*f**(c + d*x) + c*f**(S(2)*c + S(2)*d*x)), x), x, S(2)*c*x*log(S(1) + f**(-c - d*x)*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d*(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)) - S(2)*c*x*log(S(1) + f**(-c - d*x)*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d*(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)) - S(2)*c*polylog(S(2), -f**(-c - d*x)*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(2)) + S(2)*c*polylog(S(2), -f**(-c - d*x)*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(S(2)*f**(c + d*x) + f**(S(2)*c + S(2)*d*x) + S(1)), x), x, x**S(3)/S(3) - x**S(2)*log(f**(c + d*x) + S(1))/(d*log(f)) + x**S(2)/(d*(f**(c + d*x) + S(1))*log(f)) + S(2)*x*log(f**(-c - d*x) + S(1))/(d**S(2)*log(f)**S(2)) - S(2)*x*polylog(S(2), -f**(c + d*x))/(d**S(2)*log(f)**S(2)) - S(2)*polylog(S(2), -f**(-c - d*x))/(d**S(3)*log(f)**S(3)) + S(2)*polylog(S(3), -f**(c + d*x))/(d**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*f**(c + d*x) + c*f**(S(2)*c + S(2)*d*x)), x), x, S(2)*c*x**S(2)*log(S(1) + f**(-c - d*x)*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d*(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)) - S(2)*c*x**S(2)*log(S(1) + f**(-c - d*x)*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d*(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)) - S(4)*c*x*polylog(S(2), -f**(-c - d*x)*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(2)) + S(4)*c*x*polylog(S(2), -f**(-c - d*x)*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(2)) - S(4)*c*polylog(S(3), -f**(-c - d*x)*(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(3)) + S(4)*c*polylog(S(3), -f**(-c - d*x)*(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c))/(d**S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*f**(g + h*x))/(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x)), x), x, d*x/a - d*log(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x))/(S(2)*a*h*log(f)) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*f**(g + h*x))/sqrt(-S(4)*a*c + b**S(2)))/(a*h*sqrt(-S(4)*a*c + b**S(2))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*f**(g + h*x))/(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x)), x), x, d*x/a - d*log(a + b*f**(g + h*x) + c*f**(S(2)*g + S(2)*h*x))/(S(2)*a*h*log(f)) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*f**(g + h*x))/sqrt(-S(4)*a*c + b**S(2)))/(a*h*sqrt(-S(4)*a*c + b**S(2))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(x) + S(2) + exp(-x)), x), x, -S(1)/(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(exp(x) + S(2) + exp(-x)), x), x, x - x/(exp(x) + S(1)) - log(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(exp(x) + S(2) + exp(-x)), x), x, -x**S(2)/(exp(x) + S(1)) - S(2)*x*log(S(1) + exp(-x)) + S(2)*polylog(S(2), -exp(-x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(f**(-c - d*x) + f**(c + d*x) + S(2)), x), x, -S(1)/(d*(f**(c + d*x) + S(1))*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(f**(-c - d*x) + f**(c + d*x) + S(2)), x), x, x/(d*log(f)) - x/(d*(f**(c + d*x) + S(1))*log(f)) - log(f**(c + d*x) + S(1))/(d**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(f**(-c - d*x) + f**(c + d*x) + S(2)), x), x, -x**S(2)/(d*(f**(c + d*x) + S(1))*log(f)) - S(2)*x*log(f**(-c - d*x) + S(1))/(d**S(2)*log(f)**S(2)) + S(2)*polylog(S(2), -f**(-c - d*x))/(d**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(3)**x + S(2) + S(3)**(-x)), x), x, -S(1)/((S(3)**x + S(1))*log(S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(2)*exp(x) + S(1) - exp(-x)), x), x, log(-S(2)*exp(x) + S(1))/S(3) - log(exp(x) + S(1))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*exp(-x) + c*exp(x)), x), x, -S(2)*atanh((a + S(2)*c*exp(x))/sqrt(a**S(2) - S(4)*b*c))/sqrt(a**S(2) - S(4)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*exp(-x) + c*exp(x)), x), x, x*log(S(2)*c*exp(x)/(a - sqrt(a**S(2) - S(4)*b*c)) + S(1))/sqrt(a**S(2) - S(4)*b*c) - x*log(S(2)*c*exp(x)/(a + sqrt(a**S(2) - S(4)*b*c)) + S(1))/sqrt(a**S(2) - S(4)*b*c) + polylog(S(2), -S(2)*c*exp(x)/(a - sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c) - polylog(S(2), -S(2)*c*exp(x)/(a + sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*exp(-x) + c*exp(x)), x), x, x**S(2)*log(S(2)*c*exp(x)/(a - sqrt(a**S(2) - S(4)*b*c)) + S(1))/sqrt(a**S(2) - S(4)*b*c) - x**S(2)*log(S(2)*c*exp(x)/(a + sqrt(a**S(2) - S(4)*b*c)) + S(1))/sqrt(a**S(2) - S(4)*b*c) + S(2)*x*polylog(S(2), -S(2)*c*exp(x)/(a - sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c) - S(2)*x*polylog(S(2), -S(2)*c*exp(x)/(a + sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c) - S(2)*polylog(S(3), -S(2)*c*exp(x)/(a - sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c) + S(2)*polylog(S(3), -S(2)*c*exp(x)/(a + sqrt(a**S(2) - S(4)*b*c)))/sqrt(a**S(2) - S(4)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*f**(-c - d*x) + c*f**(c + d*x)), x), x, -S(2)*atanh((a + S(2)*c*f**(c + d*x))/sqrt(a**S(2) - S(4)*b*c))/(d*sqrt(a**S(2) - S(4)*b*c)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*f**(-c - d*x) + c*f**(c + d*x)), x), x, x*log(S(2)*c*f**(c + d*x)/(a - sqrt(a**S(2) - S(4)*b*c)) + S(1))/(d*sqrt(a**S(2) - S(4)*b*c)*log(f)) - x*log(S(2)*c*f**(c + d*x)/(a + sqrt(a**S(2) - S(4)*b*c)) + S(1))/(d*sqrt(a**S(2) - S(4)*b*c)*log(f)) + polylog(S(2), -S(2)*c*f**(c + d*x)/(a - sqrt(a**S(2) - S(4)*b*c)))/(d**S(2)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(2)) - polylog(S(2), -S(2)*c*f**(c + d*x)/(a + sqrt(a**S(2) - S(4)*b*c)))/(d**S(2)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*f**(-c - d*x) + c*f**(c + d*x)), x), x, x**S(2)*log(S(2)*c*f**(c + d*x)/(a - sqrt(a**S(2) - S(4)*b*c)) + S(1))/(d*sqrt(a**S(2) - S(4)*b*c)*log(f)) - x**S(2)*log(S(2)*c*f**(c + d*x)/(a + sqrt(a**S(2) - S(4)*b*c)) + S(1))/(d*sqrt(a**S(2) - S(4)*b*c)*log(f)) + S(2)*x*polylog(S(2), -S(2)*c*f**(c + d*x)/(a - sqrt(a**S(2) - S(4)*b*c)))/(d**S(2)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(2)) - S(2)*x*polylog(S(2), -S(2)*c*f**(c + d*x)/(a + sqrt(a**S(2) - S(4)*b*c)))/(d**S(2)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(2)) - S(2)*polylog(S(3), -S(2)*c*f**(c + d*x)/(a - sqrt(a**S(2) - S(4)*b*c)))/(d**S(3)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(3)) + S(2)*polylog(S(3), -S(2)*c*f**(c + d*x)/(a + sqrt(a**S(2) - S(4)*b*c)))/(d**S(3)*sqrt(a**S(2) - S(4)*b*c)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(sqrt(-a*x + S(1))/sqrt(a*x + S(1))))**n/(-a**S(2)*x**S(2) + S(1)), x), x, -F**(-n*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))*(F**(sqrt(-a*x + S(1))/sqrt(a*x + S(1))))**n*Ei(n*sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(S(3)*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -Ei(S(3)*sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(S(2)*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -Ei(S(2)*sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -Ei(sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(-sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -Ei(-sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(-S(2)*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -Ei(-S(2)*sqrt(-a*x + S(1))*log(F)/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)**n/(-c**S(2)*x**S(2) + S(1)), x), x, -Integral((F**x*b + a)**n/x, (x, sqrt(-c*x + S(1))/sqrt(c*x + S(1))))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)**S(3)/(-c**S(2)*x**S(2) + S(1)), x), x, -a**S(3)*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))/c - S(3)*a**S(2)*b*Ei(sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c - S(3)*a*b**S(2)*Ei(S(2)*sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c - b**S(3)*Ei(S(3)*sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)**S(2)/(-c**S(2)*x**S(2) + S(1)), x), x, -a**S(2)*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))/c - S(2)*a*b*Ei(sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c - b**S(2)*Ei(S(2)*sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)/(-c**S(2)*x**S(2) + S(1)), x), x, -a*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))/c - b*Ei(sqrt(-c*x + S(1))*log(F)/sqrt(c*x + S(1)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)*(-c**S(2)*x**S(2) + S(1))), x), x, -Integral(S(1)/(x*(F**x*b + a)), (x, sqrt(-c*x + S(1))/sqrt(c*x + S(1))))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((F**(sqrt(-c*x + S(1))/sqrt(c*x + S(1)))*b + a)**S(2)*(-c**S(2)*x**S(2) + S(1))), x), x, -Integral(S(1)/(x*(F**x*b + a)**S(2)), (x, sqrt(-c*x + S(1))/sqrt(c*x + S(1))))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x*x**S(2), x), x, a**x*b**x*x**S(2)/(log(a) + log(b)) - S(2)*a**x*b**x*x/(log(a) + log(b))**S(2) + S(2)*a**x*b**x/(log(a) + log(b))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x*x, x), x, a**x*b**x*x/(log(a) + log(b)) - a**x*b**x/(log(a) + log(b))**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x, x), x, a**x*b**x/(log(a) + log(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x/x, x), x, Ei(x*(log(a) + log(b))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x/x**S(2), x), x, -a**x*b**x/x + (log(a) + log(b))*Ei(x*(log(a) + log(b))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x/x**S(3), x), x, -a**x*b**x*(log(a) + log(b))/(S(2)*x) - a**x*b**x/(S(2)*x**S(2)) + (log(a) + log(b))**S(2)*Ei(x*(log(a) + log(b)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**x*c**x, x), x, a**x*b**x*c**x/(log(a) + log(b) + log(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**(-x), x), x, a**x*b**(-x)/(log(a) - log(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**x*b**(-x)*x**S(2), x), x, a**x*b**(-x)*x**S(2)/(log(a) - log(b)) - S(2)*a**x*b**(-x)*x/(log(a) - log(b))**S(2) + S(2)*a**x*b**(-x)/(log(a) - log(b))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(a + b*exp(x)), x), x, -a*log(a + b*exp(x))/b**S(2) + exp(x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(a + b*exp(x))**S(2), x), x, a/(b**S(2)*(a + b*exp(x))) + log(a + b*exp(x))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(a + b*exp(x))**S(3), x), x, exp(S(2)*x)/(S(2)*a*(a + b*exp(x))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(a + b*exp(x))**S(4), x), x, a/(S(3)*b**S(2)*(a + b*exp(x))**S(3)) - S(1)/(S(2)*b**S(2)*(a + b*exp(x))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/(a + b*exp(S(2)*x)), x), x, -a*log(a + b*exp(S(2)*x))/(S(2)*b**S(2)) + exp(S(2)*x)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/(a + b*exp(S(2)*x))**S(2), x), x, a/(S(2)*b**S(2)*(a + b*exp(S(2)*x))) + log(a + b*exp(S(2)*x))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/(a + b*exp(S(2)*x))**S(3), x), x, exp(S(4)*x)/(S(4)*a*(a + b*exp(S(2)*x))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/(a + b*exp(S(2)*x))**S(4), x), x, a/(S(6)*b**S(2)*(a + b*exp(S(2)*x))**S(3)) - S(1)/(S(4)*b**S(2)*(a + b*exp(S(2)*x))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/(a + b*exp(S(2)*x))**(S(2)/3), x), x, -S(3)*a*(a + b*exp(S(2)*x))**(S(1)/3)/(S(2)*b**S(2)) + S(3)*(a + b*exp(S(2)*x))**(S(4)/3)/(S(8)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(n*x))*exp(-n*x), x), x, -a*exp(-n*x)/n + b*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(n*x))**S(2)*exp(-n*x), x), x, -a**S(2)*exp(-n*x)/n + S(2)*a*b*x + b**S(2)*exp(n*x)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(n*x))**S(3)*exp(-n*x), x), x, -a**S(3)*exp(-n*x)/n + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*exp(n*x)/n + b**S(3)*exp(S(2)*n*x)/(S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-n*x)/(a + b*exp(n*x)), x), x, -exp(-n*x)/(a*n) - b*x/a**S(2) + b*log(a + b*exp(n*x))/(a**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-n*x)/(a + b*exp(n*x))**S(2), x), x, -b/(a**S(2)*n*(a + b*exp(n*x))) - exp(-n*x)/(a**S(2)*n) - S(2)*b*x/a**S(3) + S(2)*b*log(a + b*exp(n*x))/(a**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-n*x)/(a + b*exp(n*x))**S(3), x), x, -b/(S(2)*a**S(2)*n*(a + b*exp(n*x))**S(2)) - S(2)*b/(a**S(3)*n*(a + b*exp(n*x))) - exp(-n*x)/(a**S(3)*n) - S(3)*b*x/a**S(4) + S(3)*b*log(a + b*exp(n*x))/(a**S(4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x)/(c + d*f**(S(2)*b*x + e)), x), x, f**(a - e/S(2))*atan(sqrt(d)*f**(b*x + e/S(2))/sqrt(c))/(b*sqrt(c)*sqrt(d)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + S(2)*b*x)/(c + d*f**(S(2)*b*x + e)), x), x, f**(a - e)*log(c + d*f**(S(2)*b*x + e))/(S(2)*b*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + S(3)*b*x)/(c + d*f**(S(2)*b*x + e)), x), x, -sqrt(c)*f**(a - S(3)*e/S(2))*atan(sqrt(d)*f**(b*x + e/S(2))/sqrt(c))/(b*d**(S(3)/2)*log(f)) + f**(a + b*x - e)/(b*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + S(4)*b*x)/(c + d*f**(S(2)*b*x + e)), x), x, -c*f**(a - S(2)*e)*log(c + d*f**(S(2)*b*x + e))/(S(2)*b*d**S(2)*log(f)) + f**(a + S(2)*b*x - e)/(S(2)*b*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + S(5)*b*x)/(c + d*f**(S(2)*b*x + e)), x), x, c**(S(3)/2)*f**(a - S(5)*e/S(2))*atan(sqrt(d)*f**(b*x + e/S(2))/sqrt(c))/(b*d**(S(5)/2)*log(f)) - c*f**(a + b*x - S(2)*e)/(b*d**S(2)*log(f)) + f**(a + S(3)*b*x - e)/(S(3)*b*d*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(1)), x), x, atan(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(-exp(S(2)*x) + S(1)), x), x, atanh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x)/(-exp(S(2)*x) + S(1)), x), x, x*atanh(exp(x)) + polylog(S(2), -exp(x))/S(2) - polylog(S(2), exp(x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(x)/(-exp(S(2)*x) + S(1)), x), x, x**S(2)*atanh(exp(x)) + x*polylog(S(2), -exp(x)) - x*polylog(S(2), exp(x)) - polylog(S(3), -exp(x)) + polylog(S(3), exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(x)/(-exp(S(2)*x) + S(1)), x), x, x**S(3)*atanh(exp(x)) + S(3)*x**S(2)*polylog(S(2), -exp(x))/S(2) - S(3)*x**S(2)*polylog(S(2), exp(x))/S(2) - S(3)*x*polylog(S(3), -exp(x)) + S(3)*x*polylog(S(3), exp(x)) + S(3)*polylog(S(4), -exp(x)) - S(3)*polylog(S(4), exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x/(a + b*f**(S(2)*x)), x), x, atan(sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x/(a + b*f**(S(2)*x)), x), x, x*atan(sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)) - I*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + I*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x**S(2)/(a + b*f**(S(2)*x)), x), x, x**S(2)*atan(sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)) - I*x*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(2)) + I*x*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(2)) + I*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - I*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x**S(3)/(a + b*f**(S(2)*x)), x), x, x**S(3)*atan(sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)) - S(3)*I*x**S(2)*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + S(3)*I*x**S(2)*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + S(3)*I*x*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - S(3)*I*x*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - S(3)*I*polylog(S(4), -I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(4)) + S(3)*I*polylog(S(4), I*sqrt(b)*f**x/sqrt(a))/(sqrt(a)*sqrt(b)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x/(a + b*f**(S(2)*x))**S(2), x), x, f**x/(S(2)*a*(a + b*f**(S(2)*x))*log(f)) + atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x/(a + b*f**(S(2)*x))**S(2), x), x, f**x*x/(S(2)*a*(a + b*f**(S(2)*x))*log(f)) + x*atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)) - atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) - I*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(4)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) + I*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(4)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x**S(2)/(a + b*f**(S(2)*x))**S(2), x), x, f**x*x**S(2)/(S(2)*a*(a + b*f**(S(2)*x))*log(f)) + x**S(2)*atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)) - x*atan(sqrt(b)*f**x/sqrt(a))/(a**(S(3)/2)*sqrt(b)*log(f)**S(2)) - I*x*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) + I*x*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) + I*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) - I*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) + I*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) - I*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x**S(3)/(a + b*f**(S(2)*x))**S(2), x), x, f**x*x**S(3)/(S(2)*a*(a + b*f**(S(2)*x))*log(f)) + x**S(3)*atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)) - S(3)*x**S(2)*atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) - S(3)*I*x**S(2)*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(4)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) + S(3)*I*x**S(2)*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(4)*a**(S(3)/2)*sqrt(b)*log(f)**S(2)) + S(3)*I*x*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) - S(3)*I*x*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) + S(3)*I*x*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) - S(3)*I*x*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(3)) - S(3)*I*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(4)) + S(3)*I*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(4)) - S(3)*I*polylog(S(4), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(4)) + S(3)*I*polylog(S(4), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x/(a + b*f**(S(2)*x))**S(3), x), x, f**x*x/(S(4)*a*(a + b*f**(S(2)*x))**S(2)*log(f)) + S(3)*f**x*x/(S(8)*a**S(2)*(a + b*f**(S(2)*x))*log(f)) - f**x/(S(8)*a**S(2)*(a + b*f**(S(2)*x))*log(f)**S(2)) + S(3)*x*atan(sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)) - atan(sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(5)/2)*sqrt(b)*log(f)**S(2)) - S(3)*I*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(16)*a**(S(5)/2)*sqrt(b)*log(f)**S(2)) + S(3)*I*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(16)*a**(S(5)/2)*sqrt(b)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x*x**S(2)/(a + b*f**(S(2)*x))**S(3), x), x, f**x*x**S(2)/(S(4)*a*(a + b*f**(S(2)*x))**S(2)*log(f)) + S(3)*f**x*x**S(2)/(S(8)*a**S(2)*(a + b*f**(S(2)*x))*log(f)) - f**x*x/(S(4)*a**S(2)*(a + b*f**(S(2)*x))*log(f)**S(2)) + S(3)*x**S(2)*atan(sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)) - x*atan(sqrt(b)*f**x/sqrt(a))/(a**(S(5)/2)*sqrt(b)*log(f)**S(2)) - S(3)*I*x*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)**S(2)) + S(3)*I*x*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)**S(2)) + atan(sqrt(b)*f**x/sqrt(a))/(S(4)*a**(S(5)/2)*sqrt(b)*log(f)**S(3)) + I*polylog(S(2), -I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(5)/2)*sqrt(b)*log(f)**S(3)) - I*polylog(S(2), I*sqrt(b)*f**x/sqrt(a))/(S(2)*a**(S(5)/2)*sqrt(b)*log(f)**S(3)) + S(3)*I*polylog(S(3), -I*sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)**S(3)) - S(3)*I*polylog(S(3), I*sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*f**x + b*f**(-x)), x), x, x*atan(sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)) - I*polylog(S(2), -I*sqrt(a)*f**x/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + I*polylog(S(2), I*sqrt(a)*f**x/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*f**x + b*f**(-x)), x), x, x**S(2)*atan(sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)) - I*x*polylog(S(2), -I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(2)) + I*x*polylog(S(2), I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(2)) + I*polylog(S(3), -I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - I*polylog(S(3), I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*f**x + b*f**(-x)), x), x, x**S(3)*atan(sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)) - S(3)*I*x**S(2)*polylog(S(2), -I*sqrt(a)*f**x/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + S(3)*I*x**S(2)*polylog(S(2), I*sqrt(a)*f**x/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)*log(f)**S(2)) + S(3)*I*x*polylog(S(3), -I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - S(3)*I*x*polylog(S(3), I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(3)) - S(3)*I*polylog(S(4), -I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(4)) + S(3)*I*polylog(S(4), I*sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**x/(a + b*f**(S(2)*x))**S(3), x), x, f**x/(S(4)*a*(a + b*f**(S(2)*x))**S(2)*log(f)) + S(3)*f**x/(S(8)*a**S(2)*(a + b*f**(S(2)*x))*log(f)) + S(3)*atan(sqrt(b)*f**x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*f**x + b*f**(-x)), x), x, atan(sqrt(a)*f**x/sqrt(b))/(sqrt(a)*sqrt(b)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*f**x + b*f**(-x))**(S(-2)), x), x, -S(1)/(S(2)*a*(a*f**(S(2)*x) + b)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*f**x + b*f**(-x))**S(2), x), x, -x/(S(2)*a*(a*f**(S(2)*x) + b)*log(f)) + x/(S(2)*a*b*log(f)) - log(a*f**(S(2)*x) + b)/(S(4)*a*b*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*f**x + b*f**(-x))**S(2), x), x, -x**S(2)/(S(2)*a*(a*f**(S(2)*x) + b)*log(f)) - x*log(S(1) + b*f**(-S(2)*x)/a)/(S(2)*a*b*log(f)**S(2)) + polylog(S(2), -b*f**(-S(2)*x)/a)/(S(4)*a*b*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*f**x + b*f**(-x))**S(2), x), x, -x**S(3)/(S(2)*a*(a*f**(S(2)*x) + b)*log(f)) - S(3)*x**S(2)*log(S(1) + b*f**(-S(2)*x)/a)/(S(4)*a*b*log(f)**S(2)) + S(3)*x*polylog(S(2), -b*f**(-S(2)*x)/a)/(S(4)*a*b*log(f)**S(3)) + S(3)*polylog(S(3), -b*f**(-S(2)*x)/a)/(S(8)*a*b*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*f**x + b*f**(-x))**(S(-3)), x), x, -f**x/(S(4)*a*(a*f**(S(2)*x) + b)**S(2)*log(f)) + f**x/(S(8)*a*b*(a*f**(S(2)*x) + b)*log(f)) + atan(sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*f**x + b*f**(-x))**S(3), x), x, -f**x*x/(S(4)*a*(a*f**(S(2)*x) + b)**S(2)*log(f)) + f**x*x/(S(8)*a*b*(a*f**(S(2)*x) + b)*log(f)) + f**x/(S(8)*a*b*(a*f**(S(2)*x) + b)*log(f)**S(2)) + x*atan(sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)) - I*polylog(S(2), -I*sqrt(a)*f**x/sqrt(b))/(S(16)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(2)) + I*polylog(S(2), I*sqrt(a)*f**x/sqrt(b))/(S(16)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*f**x + b*f**(-x))**S(3), x), x, -f**x*x**S(2)/(S(4)*a*(a*f**(S(2)*x) + b)**S(2)*log(f)) + f**x*x**S(2)/(S(8)*a*b*(a*f**(S(2)*x) + b)*log(f)) + f**x*x/(S(4)*a*b*(a*f**(S(2)*x) + b)*log(f)**S(2)) + x**S(2)*atan(sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)) - I*x*polylog(S(2), -I*sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(2)) + I*x*polylog(S(2), I*sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(2)) - atan(sqrt(a)*f**x/sqrt(b))/(S(4)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(3)) + I*polylog(S(3), -I*sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(3)) - I*polylog(S(3), I*sqrt(a)*f**x/sqrt(b))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(a + b*x + c*x**S(2))*g**(d + e*x + f*x**S(2)), x), x, sqrt(pi)*f**a*g**d*exp(-(b*log(f) + e*log(g))**S(2)/(S(4)*(c*log(f) + f*log(g))))*erfi((b*log(f)/S(2) + e*log(g)/S(2) + x*(c*log(f) + f*log(g)))/sqrt(c*log(f) + f*log(g)))/(S(2)*sqrt(c*log(f) + f*log(g))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e*(c + d*x))*(G**(h*(f + g*x))*b + a)**n, x), x, F**(e*(c + d*x))*(G**(h*(f + g*x))*b + a)**(n + S(1))*hyper((S(1), d*e*log(F)/(g*h*log(G)) + n + S(1)), (d*e*log(F)/(g*h*log(G)) + S(1),), -G**(h*(f + g*x))*b/a)/(a*d*e*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e*(c + d*x))*H**(t*(r + s*x))/(F**(e*(c + d*x))*b + a), x), x, H**(t*(r + s*x))*hyper((S(1), -s*t*log(H)/(d*e*log(F))), (S(1) - s*t*log(H)/(d*e*log(F)),), -F**(-e*(c + d*x))*a/b)/(b*s*t*log(H)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(e*(d*x + f))*H**(t*(r + s*x))/(F**(e*(c + d*x))*b + a), x), x, F**(-e*(c - f))*H**(t*(r + s*x))*hyper((S(1), -s*t*log(H)/(d*e*log(F))), (S(1) - s*t*log(H)/(d*e*log(F)),), -F**(-e*(c + d*x))*a/b)/(b*s*t*log(H)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*exp(h + i*x))*(f + g*x)**S(3)/(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x)), x), x, S(6)*g**S(3)*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(4), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(4)*(b + sqrt(-S(4)*a*c + b**S(2)))) + S(6)*g**S(3)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(4), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(4)*(b - sqrt(-S(4)*a*c + b**S(2)))) + S(6)*g**S(2)*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)*polylog(S(3), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))) + S(6)*g**S(2)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)*polylog(S(3), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))) + S(3)*g*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(2)*polylog(S(2), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + S(3)*g*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(2)*polylog(S(2), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))) - (e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(3)*log(S(1) + (b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b + sqrt(-S(4)*a*c + b**S(2)))) - (e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(3)*log(S(1) + (b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*exp(h + i*x))*(f + g*x)**S(2)/(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x)), x), x, S(2)*g**S(2)*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(3), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))) + S(2)*g**S(2)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(3), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))) + S(2)*g*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)*polylog(S(2), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + S(2)*g*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)*polylog(S(2), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))) - (e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(2)*log(S(1) + (b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b + sqrt(-S(4)*a*c + b**S(2)))) - (e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)**S(2)*log(S(1) + (b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*exp(h + i*x))*(f + g*x)/(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x)), x), x, g*(e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -(b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + g*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -(b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))) - (e + (b*e - S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(f + g*x)*log(S(1) + (b + sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b + sqrt(-S(4)*a*c + b**S(2)))) + (e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*(-f - g*x)*log(S(1) + (b - sqrt(-S(4)*a*c + b**S(2)))*exp(-h - i*x)/(S(2)*c))/(i*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*exp(h + i*x))/(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x)), x), x, d*x/a - d*log(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))/(S(2)*a*i) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*exp(h + i*x))/sqrt(-S(4)*a*c + b**S(2)))/(a*i*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate((d + e*exp(h + i*x))/((f + g*x)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x), x, d*Integral(S(1)/((f + g*x)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x) + e*Integral(exp(h + i*x)/((f + g*x)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate((d + e*exp(h + i*x))/((f + g*x)**S(2)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x), x, d*Integral(S(1)/((f + g*x)**S(2)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x) + e*Integral(exp(h + i*x)/((f + g*x)**S(2)*(a + b*exp(h + i*x) + c*exp(S(2)*h + S(2)*i*x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(-a*e*exp(c + d*x) + b*e)/(-S(2)*a*e*exp(c + d*x) - b*e*exp(S(2)*c + S(2)*d*x) + b*e), x), x, -x*log(S(1) + (a - sqrt(a**S(2) + b**S(2)))*exp(-c - d*x)/b)/(S(2)*d) - x*log(S(1) + (a + sqrt(a**S(2) + b**S(2)))*exp(-c - d*x)/b)/(S(2)*d) + polylog(S(2), -(a - sqrt(a**S(2) + b**S(2)))*exp(-c - d*x)/b)/(S(2)*d**S(2)) + polylog(S(2), -(a + sqrt(a**S(2) + b**S(2)))*exp(-c - d*x)/b)/(S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(a + b*x + c*x**S(3))*(b + S(3)*c*x**S(2)), x), x, F**(a + b*x + c*x**S(3))/log(F), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(F**(S(1)/(a + b*x + c*x**S(2)))*(b + S(2)*c*x)/(a + b*x + c*x**S(2))**S(2), x), x, -F**(S(1)/(a + b*x + c*x**S(2)))/log(F), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**m*exp(a + b*x + c*x**S(2)), x), x, (-a - b*x - c*x**S(2))**(-m)*(a + b*x + c*x**S(2))**m*Gamma(m + S(1), -a - b*x - c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**S(3)*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))**S(3)*exp(a + b*x + c*x**S(2)) - S(3)*(a + b*x + c*x**S(2))**S(2)*exp(a + b*x + c*x**S(2)) + S(6)*(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)) - S(6)*exp(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**S(2)*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))**S(2)*exp(a + b*x + c*x**S(2)) - S(2)*(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)) + S(2)*exp(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)) - exp(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2)), x), x, exp(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2)), x), x, Ei(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**S(2), x), x, Ei(a + b*x + c*x**S(2)) - exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**S(3), x), x, Ei(a + b*x + c*x**S(2))/S(2) - exp(a + b*x + c*x**S(2))/(S(2)*(a + b*x + c*x**S(2))) - exp(a + b*x + c*x**S(2))/(S(2)*(a + b*x + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**(S(7)/2)*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))**(S(7)/2)*exp(a + b*x + c*x**S(2)) - S(7)*(a + b*x + c*x**S(2))**(S(5)/2)*exp(a + b*x + c*x**S(2))/S(2) + S(35)*(a + b*x + c*x**S(2))**(S(3)/2)*exp(a + b*x + c*x**S(2))/S(4) - S(105)*sqrt(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2))/S(8) + S(105)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**(S(5)/2)*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))**(S(5)/2)*exp(a + b*x + c*x**S(2)) - S(5)*(a + b*x + c*x**S(2))**(S(3)/2)*exp(a + b*x + c*x**S(2))/S(2) + S(15)*sqrt(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2))/S(4) - S(15)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**(S(3)/2)*exp(a + b*x + c*x**S(2)), x), x, (a + b*x + c*x**S(2))**(S(3)/2)*exp(a + b*x + c*x**S(2)) - S(3)*sqrt(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2))/S(2) + S(3)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*sqrt(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)), x), x, sqrt(a + b*x + c*x**S(2))*exp(a + b*x + c*x**S(2)) - sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/sqrt(a + b*x + c*x**S(2)), x), x, sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**(S(3)/2), x), x, S(2)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2))) - S(2)*exp(a + b*x + c*x**S(2))/sqrt(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**(S(5)/2), x), x, S(4)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(3) - S(4)*exp(a + b*x + c*x**S(2))/(S(3)*sqrt(a + b*x + c*x**S(2))) - S(2)*exp(a + b*x + c*x**S(2))/(S(3)*(a + b*x + c*x**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**(S(7)/2), x), x, S(8)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(15) - S(8)*exp(a + b*x + c*x**S(2))/(S(15)*sqrt(a + b*x + c*x**S(2))) - S(4)*exp(a + b*x + c*x**S(2))/(S(15)*(a + b*x + c*x**S(2))**(S(3)/2)) - S(2)*exp(a + b*x + c*x**S(2))/(S(5)*(a + b*x + c*x**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*exp(a + b*x + c*x**S(2))/(a + b*x + c*x**S(2))**(S(9)/2), x), x, S(16)*sqrt(pi)*erfi(sqrt(a + b*x + c*x**S(2)))/S(105) - S(16)*exp(a + b*x + c*x**S(2))/(S(105)*sqrt(a + b*x + c*x**S(2))) - S(8)*exp(a + b*x + c*x**S(2))/(S(105)*(a + b*x + c*x**S(2))**(S(3)/2)) - S(4)*exp(a + b*x + c*x**S(2))/(S(35)*(a + b*x + c*x**S(2))**(S(5)/2)) - S(2)*exp(a + b*x + c*x**S(2))/(S(7)*(a + b*x + c*x**S(2))**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-x)/sqrt(S(1) - exp(-S(2)*x)), x), x, -asin(exp(-x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(4)), x), x, atan(exp(x)/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(-exp(S(2)*x) + S(1)), x), x, atanh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(-S(4)*exp(S(2)*x) + S(3)), x), x, sqrt(S(3))*atanh(S(2)*sqrt(S(3))*exp(x)/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-S(4)*exp(S(2)*x) + S(3))*exp(x), x), x, sqrt(-S(4)*exp(S(2)*x) + S(3))*exp(x)/S(2) + S(3)*asin(S(2)*sqrt(S(3))*exp(x)/S(3))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(x**S(2)), x), x, x**S(2)*exp(x**S(2))/S(2) - exp(x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-exp(S(2)*x) + S(1))*exp(x), x), x, sqrt(-exp(S(2)*x) + S(1))*exp(x)/S(2) + asin(exp(x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/sqrt(exp(S(2)*x) + exp(x) + S(1)), x), x, asinh(sqrt(S(3))*(S(2)*exp(x) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(-4)), x), x, -atanh(exp(x)/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(-x**S(2) + S(2)), x), x, -exp(-x**S(2) + S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-x**E + exp(x), x), x, -x**(E + S(1))/(E + S(1)) + exp(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(S(2)*x) + S(-1))/(exp(S(2)*x) + S(3)), x), x, -x/S(3) + S(2)*log(exp(S(2)*x) + S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/sqrt(-exp(S(2)*x) + S(1)), x), x, asin(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(exp(S(4)*x) + S(1)), x), x, atan(exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(2)*x) - S(3)*exp(x)), x), x, -x/S(9) + log(-exp(x) + S(3))/S(9) + exp(-x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + S(-2))*exp(x)/(exp(x) + S(1)), x), x, exp(x) - S(3)*log(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(-1)), x), x, -atanh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(1)), x), x, atan(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + exp(-x))/(exp(x) - exp(-x)), x), x, log(-exp(x) + exp(-x)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((exp(x) + exp(-x))/(exp(x) - exp(-x)), x), x, -x + log(-exp(S(2)*x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) - exp(-x))/(exp(x) + exp(-x)), x), x, log(exp(x) + exp(-x)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((exp(x) - exp(-x))/(exp(x) + exp(-x)), x), x, -x + log(exp(S(2)*x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(S(2)*x) + exp(-S(2)*x))/(exp(S(2)*x) - exp(-S(2)*x)), x), x, -x + log(-exp(S(4)*x) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/sqrt(exp(S(2)*x) + S(1)), x), x, asinh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(sqrt(x + S(4)))/sqrt(x + S(4)), x), x, S(2)*exp(sqrt(x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(exp(S(2)*x**S(2)) + S(-1)), x), x, atan(sqrt(exp(S(2)*x**S(2)) + S(-1)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(S(2)*x) + S(9))*exp(x), x), x, sqrt(exp(S(2)*x) + S(9))*exp(x)/S(2) + S(9)*asinh(exp(x)/S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(exp(S(2)*x) + S(1))*exp(x), x), x, sqrt(exp(S(2)*x) + S(1))*exp(x)/S(2) + asinh(exp(x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x**S(2))/(exp(S(2)*x**S(2)) + S(1)), x), x, atan(exp(x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(x**(S(3)/2)), x), x, S(2)*x**(S(3)/2)*exp(x**(S(3)/2))/S(3) - S(2)*exp(x**(S(3)/2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/sqrt(exp(S(2)*x) + S(-3)), x), x, atanh(exp(x)/sqrt(exp(S(2)*x) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(-exp(S(2)*x) + S(16)), x), x, atanh(exp(x)/S(4))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(5)*x)/(exp(S(10)*x) + S(1)), x), x, atan(exp(S(5)*x))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(4)*x)/sqrt(exp(S(8)*x) + S(16)), x), x, asinh(exp(S(4)*x)/S(4))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(S(4)*x**S(3))*cos(S(7)*x**S(3)), x), x, S(7)*exp(S(4)*x**S(3))*sin(S(7)*x**S(3))/S(195) + S(4)*exp(S(4)*x**S(3))*cos(S(7)*x**S(3))/S(195), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x**S(2) + S(1)), x), x, exp(x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(x**S(3) + S(1)), x), x, exp(x**S(3) + S(1))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(sqrt(x))/sqrt(x), x), x, S(2)*exp(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x**(S(1)/3))/x**(S(2)/3), x), x, S(3)*exp(x**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + S(2)*x**S(3) + S(-8))*exp(S(3)*x), x), x, x**S(5)*exp(S(3)*x)/S(3) - S(5)*x**S(4)*exp(S(3)*x)/S(9) + S(38)*x**S(3)*exp(S(3)*x)/S(27) - S(38)*x**S(2)*exp(S(3)*x)/S(27) + S(76)*x*exp(S(3)*x)/S(81) - S(724)*exp(S(3)*x)/S(243), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + exp(x))**S(2), x), x, x**S(3)/S(3) + S(2)*x*exp(x) + exp(S(2)*x)/S(2) - S(2)*exp(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(S(3)*x) + exp(S(2)*x) + exp(x))*exp(-S(4)*x), x), x, -exp(-x) - exp(-S(2)*x)/S(2) - exp(-S(3)*x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(2)*exp(x) + S(1)), x), x, -S(1)/(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-x)*cos(S(3)*x), x), x, S(3)*exp(-x)*sin(S(3)*x)/S(10) - exp(-x)*cos(S(3)*x)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(exp(S(2)*x) + S(3)*exp(x) + S(2)), x), x, -log(exp(x) + S(1)) + S(2)*log(exp(x) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(exp(x) + S(1)), x), x, exp(x) - log(exp(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(3)*x)*cos(S(5)*x), x), x, S(5)*exp(S(3)*x)*sin(S(5)*x)/S(34) + S(3)*exp(S(3)*x)*cos(S(5)*x)/S(34), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)*sech(exp(x)), x), x, atan(sinh(exp(x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-x)/(S(2)*exp(x) + S(1)), x), x, -S(2)*x + S(2)*log(S(2)*exp(x) + S(1)) - exp(-x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)*cos(S(3)*x + S(4)), x), x, S(3)*exp(x)*sin(S(3)*x + S(4))/S(10) + exp(x)*cos(S(3)*x + S(4))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(exp(x) + exp(-x)), x), x, x*exp(x) - x*exp(-x) - exp(x) - exp(-x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) + S(3)*exp(x) + S(2)), x), x, -S(2)*atanh(S(2)*exp(x) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(exp(x) + S(1))**(S(1)/3), x), x, S(3)*(exp(x) + S(1))**(S(5)/3)/S(5) - S(3)*(exp(x) + S(1))**(S(2)/3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(2)*x)/(exp(x) + S(1))**(S(1)/4), x), x, S(4)*(exp(x) + S(1))**(S(7)/4)/S(7) - S(4)*(exp(x) + S(1))**(S(3)/4)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*exp(S(2)*x) - exp(x))/sqrt(S(3)*exp(S(2)*x) - S(6)*exp(x) + S(-1)), x), x, S(2)*sqrt(S(3)*exp(S(2)*x) - S(6)*exp(x) + S(-1))/S(3) - sqrt(S(3))*atanh(sqrt(S(3))*(-exp(x) + S(1))/sqrt(S(3)*exp(S(2)*x) - S(6)*exp(x) + S(-1)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(5)*x)*exp(x), x), x, x**S(2)*exp(x) - S(7)*x*exp(x) + S(7)*exp(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - x)*exp(S(3)*x), x), x, x**S(2)*exp(S(3)*x)/S(3) - S(5)*x*exp(S(3)*x)/S(9) + S(5)*exp(S(3)*x)/S(27), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*x)*(log(x) + S(1))*exp(x**x), x), x, (x**x + S(-1))*exp(x**x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(S(7)*x) + exp(S(5)*x))/(exp(x) + exp(-x)), x), x, exp(S(6)*x)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(-2) - S(1)/x)*(-log(x) + S(1)), x), x, -x**(-S(1)/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(x))**S(2), x), x, a**S(2)*x + S(2)*a*b*exp(x) + b**S(2)*exp(S(2)*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(x))**S(3), x), x, a**S(3)*x + S(3)*a**S(2)*b*exp(x) + S(3)*a*b**S(2)*exp(S(2)*x)/S(2) + b**S(3)*exp(S(3)*x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*exp(x))**S(4), x), x, a**S(4)*x + S(4)*a**S(3)*b*exp(x) + S(3)*a**S(2)*b**S(2)*exp(S(2)*x) + S(4)*a*b**S(3)*exp(S(3)*x)/S(3) + b**S(4)*exp(S(4)*x)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*exp(c + d*x)), x), x, -S(2)*atanh(sqrt(a + b*exp(c + d*x))/sqrt(a))/(sqrt(a)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-a + b*exp(c + d*x)), x), x, S(2)*atan(sqrt(-a + b*exp(c + d*x))/sqrt(a))/(sqrt(a)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*exp(c + d*x)), x), x, -S(2)*sqrt(a)*atanh(sqrt(a + b*exp(c + d*x))/sqrt(a))/d + S(2)*sqrt(a + b*exp(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a + b*exp(c + d*x)), x), x, -S(2)*sqrt(a)*atan(sqrt(-a + b*exp(c + d*x))/sqrt(a))/d + S(2)*sqrt(-a + b*exp(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(6)*x)*sin(S(3)*x), x), x, S(2)*exp(S(6)*x)*sin(S(3)*x)/S(15) - exp(S(6)*x)*cos(S(3)*x)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(3)*x)/(exp(S(2)*x) + S(1)), x), x, exp(x) - atan(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(3)*x)/(exp(S(2)*x) + S(-1)), x), x, exp(x) - atanh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(-x)/sqrt(exp(S(2)*x) + S(1)), x), x, -sqrt(exp(S(2)*x) + S(1))*exp(-x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(exp(S(2)*x) - S(8)*exp(x) + S(-1)), x), x, sqrt(S(17))*atanh(sqrt(S(17))*(-exp(x) + S(4))/S(17))/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(S(7)*x), x), x, x**S(3)*exp(S(7)*x)/S(7) - S(3)*x**S(2)*exp(S(7)*x)/S(49) + S(6)*x*exp(S(7)*x)/S(343) - S(6)*exp(S(7)*x)/S(2401), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(-S(2)*x + S(8)), x), x, -x**S(3)*exp(-S(2)*x + S(8))/S(2) - S(3)*x**S(2)*exp(-S(2)*x + S(8))/S(4) - S(3)*x*exp(-S(2)*x + S(8))/S(4) - S(3)*exp(-S(2)*x + S(8))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-exp(S(2)*x) + S(9))*exp(x), x), x, sqrt(-exp(S(2)*x) + S(9))*exp(x)/S(2) + S(9)*asin(exp(x)/S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-exp(S(2)*x) + S(9))*exp(S(6)*x), x), x, -(-exp(S(2)*x) + S(9))**(S(7)/2)/S(7) + S(18)*(-exp(S(2)*x) + S(9))**(S(5)/2)/S(5) - S(27)*(-exp(S(2)*x) + S(9))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(6)*x)/(-exp(x) + S(9))**(S(5)/2), x), x, S(2)*(-exp(x) + S(9))**(S(7)/2)/S(7) - S(18)*(-exp(x) + S(9))**(S(5)/2) + S(540)*(-exp(x) + S(9))**(S(3)/2) - S(14580)*sqrt(-exp(x) + S(9)) - S(65610)/sqrt(-exp(x) + S(9)) + S(39366)/(-exp(x) + S(9))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(-S(7)*exp(x**S(4)) + S(2))**S(5), x), x, S(8)*x**S(4) - S(16807)*exp(S(5)*x**S(4))/S(20) + S(12005)*exp(S(4)*x**S(4))/S(8) - S(3430)*exp(S(3)*x**S(4))/S(3) + S(490)*exp(S(2)*x**S(4)) - S(140)*exp(x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-exp(S(2)*x**S(2)) + S(1))*exp(x**S(2)), x), x, sqrt(-exp(S(2)*x**S(2)) + S(1))*exp(x**S(2))/S(4) + asin(exp(x**S(2)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(-exp(S(4)*x**S(3)) + S(1))**S(2)*exp(x**S(3)), x), x, exp(S(9)*x**S(3))/S(27) - S(2)*exp(S(5)*x**S(3))/S(15) + exp(x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x + exp(x)), x), x, exp(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x + exp(x) + exp(exp(x))), x), x, exp(exp(exp(x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + exp(-x))**S(2), x), x, S(2)*x + exp(S(2)*x)/S(2) - exp(-S(2)*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(x) + exp(-x)), x), x, atan(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + exp(-x))**(S(-2)), x), x, -S(1)/(S(2)*(exp(S(2)*x) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(x) - exp(-x)), x), x, -atanh(exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) - exp(-x))**(S(-2)), x), x, S(1)/(S(2)*(-exp(S(2)*x) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) - exp(-x))**S(2)*exp(x), x), x, exp(S(3)*x)/S(3) - S(2)*exp(x) - exp(-x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) - exp(-x))**S(3)*exp(x), x), x, S(3)*x + exp(S(4)*x)/S(4) - S(3)*exp(S(2)*x)/S(2) + exp(-S(2)*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)**x + S(1))/(S(2)**x + S(1)), x), x, S(2)**x/log(S(2)) + x - S(2)*log(S(2)**x + S(1))/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)**x + S(1))/(S(1) + S(2)**(-x)), x), x, -S(2)**x/log(S(2)) + S(2)**(S(2)*x + S(-1))/log(S(2)) + S(2)*log(S(2)**x + S(1))/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-S(2)*a*exp((a + x)**S(2))/x + exp((a + x)**S(2))/x**S(2), x), x, sqrt(pi)*erfi(a + x) - exp((a + x)**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(8) + x**S(6) + x**S(4))*exp(-x**S(2)), x), x, -x**S(7)*exp(-x**S(2))/S(2) - S(9)*x**S(5)*exp(-x**S(2))/S(4) - S(49)*x**S(3)*exp(-x**S(2))/S(8) - S(147)*x*exp(-x**S(2))/S(16) + S(147)*sqrt(pi)*erf(x)/S(32), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(exp(S(3)*x) - exp(x)), x), x, -atanh(exp(x)) + exp(-x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x + S(-5))*exp(x)/(x + S(-1))**S(2), x), x, exp(x) - S(3)*exp(x)/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*exp(x**S(2))/(x**S(2) + S(1))**S(2), x), x, exp(x**S(2))/(S(2)*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(S(3)*x)/sqrt(S(16)*exp(S(2)*x) + S(25)), x), x, sqrt(S(16)*exp(S(2)*x) + S(25))*exp(x)/S(32) - S(25)*asinh(S(4)*exp(x)/S(5))/S(128), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + S(1))/sqrt(x + exp(x)), x), x, S(2)*sqrt(x + exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) + S(1))/(x + exp(x)), x), x, log(x + exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x**S(2))/x**S(2), x), x, sqrt(pi)*erfi(x) - exp(x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(1))*exp(x**S(2))/x**S(2), x), x, S(2)*x*exp(x**S(2)) - exp(x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*sqrt(f**x), x), x, S(16)*b**S(2)*sqrt(f**x)/log(f)**S(3) - S(8)*b*(a + b*x)*sqrt(f**x)/log(f)**S(2) + S(2)*(a + b*x)**S(2)*sqrt(f**x)/log(f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(3)**(x**S(2) + S(1))*x, x), x, S(3)**(x**S(2) + S(1))/(S(2)*log(S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(sqrt(x))/sqrt(x), x), x, S(2)**(sqrt(x) + S(1))/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**(S(1)/x)/x**S(2), x), x, -S(2)**(S(1)/x)/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**x + S(2)**(-x), x), x, S(2)**x/log(S(2)) - S(2)**(-x)/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*exp(-S(4)*x), x), x, -x**S(2)*exp(-S(4)*x)/S(4) + S(5)*x*exp(-S(4)*x)/S(8) - S(11)*exp(-S(4)*x)/S(32), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(k**(x/S(2)) + x**(sqrt(k)), x), x, S(2)*k**(x/S(2))/log(k) + x**(sqrt(k) + S(1))/(sqrt(k) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(10)**(sqrt(x))/sqrt(x), x), x, S(2)**(sqrt(x) + S(1))*S(5)**(sqrt(x))/log(S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/sqrt(x + exp(x)) + S(1)/sqrt(x + exp(x)), x), x, S(2)*sqrt(x + exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(exp(x) + S(1))/sqrt(x + exp(x)) + S(2)*sqrt(x + exp(x)), x), x, S(2)*x*sqrt(x + exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x)/sqrt(x + exp(x)) + x/sqrt(x + exp(x)) + S(2)*sqrt(x + exp(x)), x), x, S(2)*x*sqrt(x + exp(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(exp(x) + S(1))/sqrt(x + exp(x)), x), x, S(2)*x*sqrt(x + exp(x)) - S(2)*Integral(sqrt(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x)/sqrt(x + exp(x)) + x/sqrt(x + exp(x)), x), x, S(2)*x*sqrt(x + exp(x)) - S(2)*Integral(sqrt(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp(x)/sqrt(x + exp(x)), x), x, S(2)*x*sqrt(x + exp(x)) + S(2)*sqrt(x + exp(x)) - Integral(S(1)/sqrt(x + exp(x)), x) - S(3)*Integral(sqrt(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(3)*x**S(2) + S(5)*exp(x))/(S(5)*sqrt(x**S(3) + S(5)*exp(x))) + S(4)*x*sqrt(x**S(3) + S(5)*exp(x))/S(5), x), x, S(2)*x**S(2)*sqrt(x**S(3) + S(5)*exp(x))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*exp(x)/sqrt(x**S(3) + S(5)*exp(x)), x), x, S(2)*x**S(2)*sqrt(x**S(3) + S(5)*exp(x))/S(5) - S(4)*Integral(x*sqrt(x**S(3) + S(5)*exp(x)), x)/S(5) - S(3)*Integral(x**S(4)/sqrt(x**S(3) + S(5)*exp(x)), x)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-exp(x) + S(-1))/(x + exp(x))**(S(1)/3), x), x, -S(3)*(x + exp(x))**(S(2)/3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x + exp(x))**(S(1)/3) - (x + exp(x))**(S(2)/3) - S(1)/(x + exp(x))**(S(1)/3), x), x, -S(3)*(x + exp(x))**(S(2)/3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x + exp(x))**(S(1)/3), x), x, -S(3)*(x + exp(x))**(S(2)/3)/S(2) + Integral((x + exp(x))**(S(-1)/3), x) + Integral((x + exp(x))**(S(2)/3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x + (S(2)*x + S(3))*exp(x))/(x + exp(x))**(S(1)/3), x), x, S(3)*x*(x + exp(x))**(S(2)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)*x*exp(x)/(x + exp(x))**(S(1)/3) + S(2)*x/(x + exp(x))**(S(1)/3) + S(3)*(x + exp(x))**(S(2)/3), x), x, S(3)*x*(x + exp(x))**(S(2)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((exp(x) - exp(-x))*(exp(x) + exp(-x))**S(2)*exp(x), x), x, -x + exp(S(4)*x)/S(4) + exp(S(2)*x)/S(2) + exp(-S(2)*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x + exp(x)), x), x, Integral(x/(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(x + exp(x)), x), x, Integral(x**S(2)/sqrt(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(x + exp(x)), x), x, Integral(exp(x)/(x + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)/(x**S(2) + exp(x)), x), x, Integral(exp(x)/(x**S(2) + exp(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f(x)/(x + f(x)), x), x, x - Integral(x/(x + f(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f(x)/(x**S(2) + f(x)), x), x, x - Integral(x**S(2)/(x**S(2) + f(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f(x)/(x + f(x))**S(2), x), x, -Integral(x/(x + f(x))**S(2), x) + Integral(S(1)/(x + f(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f(x)/(x**S(2) + f(x))**S(2), x), x, -Integral(x**S(2)/(x**S(2) + f(x))**S(2), x) + Integral(S(1)/(x**S(2) + f(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((F**(c + d*x)*a)**m*(F**(e + f*x)*b)**n, x), x, (F**(c + d*x)*a)**m*(F**(e + f*x)*b)**n/((d*m + f*n)*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x**n + c + d*x**n), x), x, -x*(x**n*(-b - d))**(-S(1)/n)*Gamma(S(1)/n, x**n*(-b - d))*exp(a + c)/n, expand=True, _diff=True, _numerical=True) # (difference in simplify `exp(a*log(f) + c*log(g))` converts to `f**a*g**c` in mathematica) # failing assert rubi_test(rubi_integrate(f**(a + b*x**n)*g**(c + d*x**n), x), x, -f**a*g**c*x*(-x**n*(b*log(f) + d*log(g)))**(-S(1)/n)*Gamma(S(1)/n, -x**n*(b*log(f) + d*log(g)))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*exp(x**n), x), x, -x**(m + S(1))*(-x**n)**(-(m + S(1))/n)*Gamma((m + S(1))/n, -x**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**(x**n)*x**m, x), x, -x**(m + S(1))*(-x**n*log(f))**(-(m + S(1))/n)*Gamma((m + S(1))/n, -x**n*log(f))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**m*exp((a + b*x)**n), x), x, -(-(a + b*x)**n)**(-(m + S(1))/n)*(a + b*x)**(m + S(1))*Gamma((m + S(1))/n, -(a + b*x)**n)/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(f**((a + b*x)**n)*(a + b*x)**m, x), x, -(-(a + b*x)**n*log(f))**(-(m + S(1))/n)*(a + b*x)**(m + S(1))*Gamma((m + S(1))/n, -(a + b*x)**n*log(f))/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*exp((a + b*x)**S(3)), x), x, a*(a + b*x)*Gamma(S(1)/3, -(a + b*x)**S(3))/(S(3)*b**S(2)*(-(a + b*x)**S(3))**(S(1)/3)) - (a + b*x)**S(2)*Gamma(S(2)/3, -(a + b*x)**S(3))/(S(3)*b**S(2)*(-(a + b*x)**S(3))**(S(2)/3)), expand=True, _diff=True, _numerical=True)
5d83311a02870211790095b07227495019aa148f4e4071177c2c204fee0e3264
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot,cosh, sinh, tanh, coth, csch, csch, sech from sympy import acsch , acsc, asinh,asin,acos,acosh,atan,atanh from sympy.integrals.rubi.utility_function import (EllipticE, EllipticF, Int, ArcCsch, ArcCsc, Gamma, Factorial, PolyGamma , LogGamma , Subst , hypergeom, rubi_test, AppellF1, EllipticPi, Log, Sqrt, ArcTan, ArcTanh, ArcSin, ArcSinh, ArcCosh, ArcTanh, ArcCos, Hypergeometric2F1,) from sympy import pi from sympy import S, hyper, I, simplify, exp_polar, symbols, exp, Ei,erf, erfi, li, Integral, polylog, hyper as HypergeometricPFQ from sympy import EulerGamma, expint, Chi, Shi, Ci, Si, E from sympy.testing.pytest import SKIP a, b, c, d, e, f, m, n, x, u , k, p, r, s, t, i, j= symbols('a b c d e f m n x u k p r s t i j') A, B, C, D, a, b, c, d, e, f, g, h, y, z, m, n, p, q, u, v, w, F = symbols('A B C D a b c d e f g h y z m n p q u v w F', ) def test_1(): assert rubi_test(rubi_integrate((e + f*x)**(p + S(-1))/log(d*(e + f*x)**p), x), x, li(d*(e + f*x)**p)/(d*f*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e*g + f*g*x)**(p + S(-1))/log(d*(e + f*x)**p), x), x, (e + f*x)**(-p + S(1))*(e*g + f*g*x)**(p + S(-1))*li(d*(e + f*x)**p)/(d*f*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**m, x), x, b*f*p*q*(g + h*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), f*(g + h*x)/(-e*h + f*g))/(h*(m + S(1))*(m + S(2))*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(m + S(1))/(h*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(4), x), x, -b*p*q*(g + h*x)**S(5)/(S(25)*h) - b*p*q*(g + h*x)**S(4)*(-e*h + f*g)/(S(20)*f*h) - b*p*q*(g + h*x)**S(3)*(-e*h + f*g)**S(2)/(S(15)*f**S(2)*h) - b*p*q*(g + h*x)**S(2)*(-e*h + f*g)**S(3)/(S(10)*f**S(3)*h) - b*p*q*x*(-e*h + f*g)**S(4)/(S(5)*f**S(4)) - b*p*q*(-e*h + f*g)**S(5)*log(e + f*x)/(S(5)*f**S(5)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(5)/(S(5)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(3), x), x, -b*p*q*(g + h*x)**S(4)/(S(16)*h) - b*p*q*(g + h*x)**S(3)*(-e*h + f*g)/(S(12)*f*h) - b*p*q*(g + h*x)**S(2)*(-e*h + f*g)**S(2)/(S(8)*f**S(2)*h) - b*p*q*x*(-e*h + f*g)**S(3)/(S(4)*f**S(3)) - b*p*q*(-e*h + f*g)**S(4)*log(e + f*x)/(S(4)*f**S(4)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(4)/(S(4)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2), x), x, -b*p*q*(g + h*x)**S(3)/(S(9)*h) - b*p*q*(g + h*x)**S(2)*(-e*h + f*g)/(S(6)*f*h) - b*p*q*x*(-e*h + f*g)**S(2)/(S(3)*f**S(2)) - b*p*q*(-e*h + f*g)**S(3)*log(e + f*x)/(S(3)*f**S(3)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(3)/(S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x), x), x, -b*p*q*(g + h*x)**S(2)/(S(4)*h) - b*p*q*x*(-e*h + f*g)/(S(2)*f) - b*p*q*(-e*h + f*g)**S(2)*log(e + f*x)/(S(2)*f**S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2)/(S(2)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*log(c*(d*(e + f*x)**p)**q), x), x, a*x - b*p*q*x + b*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x), x), x, b*p*q*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(2), x), x, b*f*p*q*log(e + f*x)/(h*(-e*h + f*g)) - b*f*p*q*log(g + h*x)/(h*(-e*h + f*g)) + (-a - b*log(c*(d*(e + f*x)**p)**q))/(h*(g + h*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(3), x), x, b*f**S(2)*p*q*log(e + f*x)/(S(2)*h*(-e*h + f*g)**S(2)) - b*f**S(2)*p*q*log(g + h*x)/(S(2)*h*(-e*h + f*g)**S(2)) + b*f*p*q/(S(2)*h*(g + h*x)*(-e*h + f*g)) + (-a/S(2) - b*log(c*(d*(e + f*x)**p)**q)/S(2))/(h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(4), x), x, b*f**S(3)*p*q*log(e + f*x)/(S(3)*h*(-e*h + f*g)**S(3)) - b*f**S(3)*p*q*log(g + h*x)/(S(3)*h*(-e*h + f*g)**S(3)) + b*f**S(2)*p*q/(S(3)*h*(g + h*x)*(-e*h + f*g)**S(2)) + b*f*p*q/(S(6)*h*(g + h*x)**S(2)*(-e*h + f*g)) + (-a/S(3) - b*log(c*(d*(e + f*x)**p)**q)/S(3))/(h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(5), x), x, b*f**S(4)*p*q*log(e + f*x)/(S(4)*h*(-e*h + f*g)**S(4)) - b*f**S(4)*p*q*log(g + h*x)/(S(4)*h*(-e*h + f*g)**S(4)) + b*f**S(3)*p*q/(S(4)*h*(g + h*x)*(-e*h + f*g)**S(3)) + b*f**S(2)*p*q/(S(8)*h*(g + h*x)**S(2)*(-e*h + f*g)**S(2)) + b*f*p*q/(S(12)*h*(g + h*x)**S(3)*(-e*h + f*g)) + (-a/S(4) - b*log(c*(d*(e + f*x)**p)**q)/S(4))/(h*(g + h*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**m, x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(3), x), x, -a*b*p*q*x*(-e*h + f*g)**S(3)/(S(2)*f**S(3)) + b**S(2)*p**S(2)*q**S(2)*(g + h*x)**S(4)/(S(32)*h) + S(7)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**S(3)*(-e*h + f*g)/(S(72)*f*h) + S(13)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**S(2)*(-e*h + f*g)**S(2)/(S(48)*f**S(2)*h) + S(25)*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)**S(3)/(S(24)*f**S(3)) - b**S(2)*p*q*(e + f*x)*(-e*h + f*g)**S(3)*log(c*(d*(e + f*x)**p)**q)/(S(2)*f**S(4)) + S(13)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**S(4)*log(e + f*x)/(S(24)*f**S(4)*h) - b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(4)/(S(8)*h) - b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(3)*(-e*h + f*g)/(S(6)*f*h) - b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2)*(-e*h + f*g)**S(2)/(S(4)*f**S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(4)/(S(4)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-e*h + f*g)**S(4)/(S(4)*f**S(4)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(2), x), x, -S(2)*a*b*p*q*x*(-e*h + f*g)**S(2)/(S(3)*f**S(2)) + S(2)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**S(3)/(S(27)*h) + S(5)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**S(2)*(-e*h + f*g)/(S(18)*f*h) + S(11)*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)**S(2)/(S(9)*f**S(2)) - S(2)*b**S(2)*p*q*(e + f*x)*(-e*h + f*g)**S(2)*log(c*(d*(e + f*x)**p)**q)/(S(3)*f**S(3)) + S(5)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**S(3)*log(e + f*x)/(S(9)*f**S(3)*h) - S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(3)/(S(9)*h) - b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2)*(-e*h + f*g)/(S(3)*f*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(3)/(S(3)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-e*h + f*g)**S(3)/(S(3)*f**S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x), x), x, -S(2)*a*b*p*q*x*(-e*h + f*g)/f + b**S(2)*e*h*p**S(2)*q**S(2)*x/(S(2)*f) + b**S(2)*h*p**S(2)*q**S(2)*x**S(2)/S(4) + S(2)*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)/f - S(2)*b**S(2)*p*q*(e + f*x)*(-e*h + f*g)*log(c*(d*(e + f*x)**p)**q)/f**S(2) - b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(2)*f**S(2)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)/(S(2)*f**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*h + f*g)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), x, -S(2)*a*b*p*q*x + S(2)*b**S(2)*p**S(2)*q**S(2)*x - S(2)*b**S(2)*p*q*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/f + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(g + h*x), x), x, -S(2)*b**S(2)*p**S(2)*q**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(g + h*x)**S(2), x), x, -S(2)*b**S(2)*f*p**S(2)*q**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) - S(2)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(g + h*x)**S(3), x), x, -b**S(2)*f**S(2)*p**S(2)*q**S(2)*log(e + f*x)/(h*(-e*h + f*g)**S(2)) + b**S(2)*f**S(2)*p**S(2)*q**S(2)*log(g + h*x)/(h*(-e*h + f*g)**S(2)) - b**S(2)*f**S(2)*p**S(2)*q**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) - b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) + b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))/(h*(g + h*x)*(-e*h + f*g)) + f**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*h*(-e*h + f*g)**S(2)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(g + h*x)**S(4), x), x, -b**S(2)*f**S(3)*p**S(2)*q**S(2)*log(e + f*x)/(h*(-e*h + f*g)**S(3)) + b**S(2)*f**S(3)*p**S(2)*q**S(2)*log(g + h*x)/(h*(-e*h + f*g)**S(3)) - S(2)*b**S(2)*f**S(3)*p**S(2)*q**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(S(3)*h*(-e*h + f*g)**S(3)) - b**S(2)*f**S(2)*p**S(2)*q**S(2)/(S(3)*h*(g + h*x)*(-e*h + f*g)**S(2)) - S(2)*b*f**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(S(3)*h*(-e*h + f*g)**S(3)) + S(2)*b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))/(S(3)*h*(g + h*x)*(-e*h + f*g)**S(2)) + b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))/(S(3)*h*(g + h*x)**S(2)*(-e*h + f*g)) + f**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(3)*h*(-e*h + f*g)**S(3)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(3)*h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**m, x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**S(3), x), x, S(6)*a*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)**S(3)/f**S(3) - S(9)*b**S(3)*e*h*p**S(3)*q**S(3)*x*(-e*h + f*g)**S(2)/(S(4)*f**S(3)) - S(9)*b**S(3)*h*p**S(3)*q**S(3)*x**S(2)*(-e*h + f*g)**S(2)/(S(8)*f**S(2)) - S(6)*b**S(3)*p**S(3)*q**S(3)*x*(-e*h + f*g)**S(3)/f**S(3) - S(3)*b**S(3)*h**S(3)*p**S(3)*q**S(3)*(e + f*x)**S(4)/(S(128)*f**S(4)) - S(2)*b**S(3)*h**S(2)*p**S(3)*q**S(3)*(e + f*x)**S(3)*(-e*h + f*g)/(S(9)*f**S(4)) + S(6)*b**S(3)*p**S(2)*q**S(2)*(e + f*x)*(-e*h + f*g)**S(3)*log(c*(d*(e + f*x)**p)**q)/f**S(4) + S(3)*b**S(2)*h**S(3)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(4)/(S(32)*f**S(4)) + S(2)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)*(-e*h + f*g)/(S(3)*f**S(4)) + S(9)*b**S(2)*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(4)*f**S(4)) - S(3)*b*h**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(4)/(S(16)*f**S(4)) - b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(3)*(-e*h + f*g)/f**S(4) - S(9)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(4)*f**S(4)) - S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*h + f*g)**S(3)/f**S(4) + h**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(4)/(S(4)*f**S(4)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(3)*(-e*h + f*g)/f**S(4) + S(3)*h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(2)*f**S(4)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*h + f*g)**S(3)/f**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**S(2), x), x, S(6)*a*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)**S(2)/f**S(2) - S(3)*b**S(3)*e*h*p**S(3)*q**S(3)*x*(-e*h + f*g)/(S(2)*f**S(2)) - S(3)*b**S(3)*h*p**S(3)*q**S(3)*x**S(2)*(-e*h + f*g)/(S(4)*f) - S(6)*b**S(3)*p**S(3)*q**S(3)*x*(-e*h + f*g)**S(2)/f**S(2) - S(2)*b**S(3)*h**S(2)*p**S(3)*q**S(3)*(e + f*x)**S(3)/(S(27)*f**S(3)) + S(6)*b**S(3)*p**S(2)*q**S(2)*(e + f*x)*(-e*h + f*g)**S(2)*log(c*(d*(e + f*x)**p)**q)/f**S(3) + S(2)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)/(S(9)*f**S(3)) + S(3)*b**S(2)*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)/(S(2)*f**S(3)) - b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(3)/(S(3)*f**S(3)) - S(3)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)*(-e*h + f*g)/(S(2)*f**S(3)) - S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*h + f*g)**S(2)/f**S(3) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(3)/(S(3)*f**S(3)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)*(-e*h + f*g)/f**S(3) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*h + f*g)**S(2)/f**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x), x), x, S(6)*a*b**S(2)*p**S(2)*q**S(2)*x*(-e*h + f*g)/f - S(3)*b**S(3)*e*h*p**S(3)*q**S(3)*x/(S(4)*f) - S(3)*b**S(3)*h*p**S(3)*q**S(3)*x**S(2)/S(8) - S(6)*b**S(3)*p**S(3)*q**S(3)*x*(-e*h + f*g)/f + S(6)*b**S(3)*p**S(2)*q**S(2)*(e + f*x)*(-e*h + f*g)*log(c*(d*(e + f*x)**p)**q)/f**S(2) + S(3)*b**S(2)*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(4)*f**S(2)) - S(3)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)/(S(4)*f**S(2)) - S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*h + f*g)/f**S(2) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)/(S(2)*f**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*h + f*g)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), x, S(6)*a*b**S(2)*p**S(2)*q**S(2)*x - S(6)*b**S(3)*p**S(3)*q**S(3)*x + S(6)*b**S(3)*p**S(2)*q**S(2)*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/f - S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/f + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x), x), x, S(6)*b**S(3)*p**S(3)*q**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x)**S(2), x), x, S(6)*b**S(3)*f*p**S(3)*q**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) - S(6)*b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) - S(3)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x)**S(3), x), x, S(3)*b**S(3)*f**S(2)*p**S(3)*q**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) + S(3)*b**S(3)*f**S(2)*p**S(3)*q**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) + S(3)*b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) - S(3)*b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(2)) - S(3)*b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(S(2)*h*(-e*h + f*g)**S(2)) - S(3)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/(S(2)*(g + h*x)*(-e*h + f*g)**S(2)) + f**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(2)*h*(-e*h + f*g)**S(2)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(2)*h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x)**S(4), x), x, b**S(3)*f**S(3)*p**S(3)*q**S(3)*log(e + f*x)/(h*(-e*h + f*g)**S(3)) - b**S(3)*f**S(3)*p**S(3)*q**S(3)*log(g + h*x)/(h*(-e*h + f*g)**S(3)) + S(3)*b**S(3)*f**S(3)*p**S(3)*q**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(3)) + S(2)*b**S(3)*f**S(3)*p**S(3)*q**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(3)) + S(3)*b**S(2)*f**S(3)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(3)) - S(2)*b**S(2)*f**S(3)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(3)) - b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))/(h*(g + h*x)*(-e*h + f*g)**S(2)) - b*f**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)**S(3)) - b*f**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*h*(-e*h + f*g)**S(3)) - b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/((g + h*x)*(-e*h + f*g)**S(3)) + b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*h*(g + h*x)**S(2)*(-e*h + f*g)) + f**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(3)*h*(-e*h + f*g)**S(3)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(3)*h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x)**S(5), x), x, S(3)*b**S(3)*f**S(4)*p**S(3)*q**S(3)*log(e + f*x)/(S(2)*h*(-e*h + f*g)**S(4)) - S(3)*b**S(3)*f**S(4)*p**S(3)*q**S(3)*log(g + h*x)/(S(2)*h*(-e*h + f*g)**S(4)) + S(11)*b**S(3)*f**S(4)*p**S(3)*q**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(S(4)*h*(-e*h + f*g)**S(4)) + S(3)*b**S(3)*f**S(4)*p**S(3)*q**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(S(2)*h*(-e*h + f*g)**S(4)) + b**S(3)*f**S(3)*p**S(3)*q**S(3)/(S(4)*h*(g + h*x)*(-e*h + f*g)**S(3)) + S(11)*b**S(2)*f**S(4)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(S(4)*h*(-e*h + f*g)**S(4)) - S(3)*b**S(2)*f**S(4)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(S(2)*h*(-e*h + f*g)**S(4)) - S(5)*b**S(2)*f**S(3)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))/(S(4)*h*(g + h*x)*(-e*h + f*g)**S(3)) - b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))/(S(4)*h*(g + h*x)**S(2)*(-e*h + f*g)**S(2)) - S(3)*b*f**S(4)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(S(4)*h*(-e*h + f*g)**S(4)) - S(5)*b*f**S(4)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(8)*h*(-e*h + f*g)**S(4)) - S(3)*b*f**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/(S(4)*(g + h*x)*(-e*h + f*g)**S(4)) + S(3)*b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(8)*h*(g + h*x)**S(2)*(-e*h + f*g)**S(2)) + b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(4)*h*(g + h*x)**S(3)*(-e*h + f*g)) + f**S(4)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(4)*h*(-e*h + f*g)**S(4)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(4)*h*(g + h*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(4), x), x, -S(24)*a*b**S(3)*p**S(3)*q**S(3)*x + S(24)*b**S(4)*p**S(4)*q**S(4)*x - S(24)*b**S(4)*p**S(3)*q**S(3)*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/f + S(12)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/f - S(4)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/f + (a + b*log(c*(d*(e + f*x)**p)**q))**S(4)*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(4)/(g + h*x), x), x, -S(24)*b**S(4)*p**S(4)*q**S(4)*polylog(S(5), -h*(e + f*x)/(-e*h + f*g))/h + S(24)*b**S(3)*p**S(3)*q**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h - S(12)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h + S(4)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))**S(4)*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(4)/(g + h*x)**S(2), x), x, -S(24)*b**S(4)*f*p**S(4)*q**S(4)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) + S(24)*b**S(3)*f*p**S(3)*q**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) - S(12)*b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(h*(-e*h + f*g)) - S(4)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/(h*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(4)*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x), x), x, -x + (a + b*x)*log(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x)**S(2), x), x, S(2)*x + (a + b*x)*log(a + b*x)**S(2)/b - (S(2)*a + S(2)*b*x)*log(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x)**S(3), x), x, -S(6)*x + (a + b*x)*log(a + b*x)**S(3)/b - (S(3)*a + S(3)*b*x)*log(a + b*x)**S(2)/b + (S(6)*a + S(6)*b*x)*log(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x + c*x), x), x, -x + (a + x*(b + c))*log(a + x*(b + c))/(b + c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x + c*x)**S(2), x), x, S(2)*x + (a + x*(b + c))*log(a + x*(b + c))**S(2)/(b + c) - (S(2)*a + S(2)*x*(b + c))*log(a + x*(b + c))/(b + c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x + c*x)**S(3), x), x, -S(6)*x + (a + x*(b + c))*log(a + x*(b + c))**S(3)/(b + c) - (S(3)*a + S(3)*x*(b + c))*log(a + x*(b + c))**S(2)/(b + c) + (S(6)*a + S(6)*x*(b + c))*log(a + x*(b + c))/(b + c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-g*(d + e*x)/(-d*g + e*f))/(f + g*x), x), x, -polylog(S(2), e*(f + g*x)/(-d*g + e*f))/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(b*x + S(1))/x, x), x, -polylog(S(2), -b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x)**n)**S(2), x), x, -S(5)*a**S(3)*n**S(2)*log(a + b*x)/(S(9)*b**S(3)) + a**S(3)*log(c*(a + b*x)**n)**S(2)/(S(3)*b**S(3)) + S(11)*a**S(2)*n**S(2)*x/(S(9)*b**S(2)) - S(2)*a**S(2)*n*(a + b*x)*log(c*(a + b*x)**n)/(S(3)*b**S(3)) - S(5)*a*n**S(2)*x**S(2)/(S(18)*b) + a*n*x**S(2)*log(c*(a + b*x)**n)/(S(3)*b) + S(2)*n**S(2)*x**S(3)/S(27) - S(2)*n*x**S(3)*log(c*(a + b*x)**n)/S(9) + x**S(3)*log(c*(a + b*x)**n)**S(2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(2)/x**S(4), x), x, -log(c*(a + b*x)**n)**S(2)/(S(3)*x**S(3)) - b*n*log(c*(a + b*x)**n)/(S(3)*a*x**S(2)) - b**S(2)*n**S(2)/(S(3)*a**S(2)*x) + S(2)*b**S(2)*n*log(c*(a + b*x)**n)/(S(3)*a**S(2)*x) - b**S(3)*n**S(2)*log(x)/a**S(3) + b**S(3)*n**S(2)*log(a + b*x)/a**S(3) + S(2)*b**S(3)*n**S(2)*polylog(S(2), (a + b*x)/a)/(S(3)*a**S(3)) + S(2)*b**S(3)*n*log(c*(a + b*x)**n)*log(-b*x/a)/(S(3)*a**S(3)) - b**S(3)*log(c*(a + b*x)**n)**S(2)/(S(3)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x)**n)**S(3), x), x, S(19)*a**S(3)*n**S(3)*log(a + b*x)/(S(18)*b**S(3)) - S(5)*a**S(3)*n*log(c*(a + b*x)**n)**S(2)/(S(6)*b**S(3)) + a**S(3)*log(c*(a + b*x)**n)**S(3)/(S(3)*b**S(3)) - S(85)*a**S(2)*n**S(3)*x/(S(18)*b**S(2)) + S(11)*a**S(2)*n**S(2)*(a + b*x)*log(c*(a + b*x)**n)/(S(3)*b**S(3)) - a**S(2)*n*(a + b*x)*log(c*(a + b*x)**n)**S(2)/b**S(3) + S(19)*a*n**S(3)*x**S(2)/(S(36)*b) - S(5)*a*n**S(2)*x**S(2)*log(c*(a + b*x)**n)/(S(6)*b) + a*n*x**S(2)*log(c*(a + b*x)**n)**S(2)/(S(2)*b) - S(2)*n**S(3)*x**S(3)/S(27) + S(2)*n**S(2)*x**S(3)*log(c*(a + b*x)**n)/S(9) - n*x**S(3)*log(c*(a + b*x)**n)**S(2)/S(3) + x**S(3)*log(c*(a + b*x)**n)**S(3)/S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x)**n)**S(3), x), x, -S(9)*a**S(2)*n**S(3)*x/(S(2)*b**S(2)) + S(6)*a**S(2)*n**S(2)*(a + b*x)*log(c*(a + b*x)**n)/b**S(3) - S(3)*a**S(2)*n*(a + b*x)*log(c*(a + b*x)**n)**S(2)/b**S(3) + a**S(2)*(a + b*x)*log(c*(a + b*x)**n)**S(3)/b**S(3) + S(3)*a*n**S(3)*x**S(2)/(S(4)*b) - S(3)*a*n**S(2)*(a + b*x)**S(2)*log(c*(a + b*x)**n)/(S(2)*b**S(3)) + S(3)*a*n*(a + b*x)**S(2)*log(c*(a + b*x)**n)**S(2)/(S(2)*b**S(3)) - a*(a + b*x)**S(2)*log(c*(a + b*x)**n)**S(3)/b**S(3) - S(2)*n**S(3)*(a + b*x)**S(3)/(S(27)*b**S(3)) + S(2)*n**S(2)*(a + b*x)**S(3)*log(c*(a + b*x)**n)/(S(9)*b**S(3)) - n*(a + b*x)**S(3)*log(c*(a + b*x)**n)**S(2)/(S(3)*b**S(3)) + (a + b*x)**S(3)*log(c*(a + b*x)**n)**S(3)/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, Integral((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(3)/(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*Ei((S(4)*a + S(4)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(4)*p*q) + S(3)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(4)*p*q) + S(3)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(4)*p*q) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(4)*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(3)*p*q) + S(2)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(3)*p*q) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(3)*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(2)*p*q) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f**S(2)*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b*f*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), x, Integral((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(3)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), x, -(e + f*x)*(g + h*x)**S(3)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(4)*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*Ei((S(4)*a + S(4)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(4)*p**S(2)*q**S(2)) + S(9)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(4)*p**S(2)*q**S(2)) + S(6)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(4)*p**S(2)*q**S(2)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(4)*p**S(2)*q**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), x, -(e + f*x)*(g + h*x)**S(2)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(3)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(3)*p**S(2)*q**S(2)) + S(4)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(3)*p**S(2)*q**S(2)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(3)*p**S(2)*q**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(2), x), x, -(e + f*x)*(g + h*x)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(2)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(-2)), x), x, (-e - f*x)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(2)*f*p**S(2)*q**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(2)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), x, Integral((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), expand=True, _diff=True, _numerical=True) # long time in rubi_test assert rubi_test(rubi_integrate((g + h*x)**S(3)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), x, -(e/S(2) + f*x/S(2))*(g + h*x)**S(3)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)) - (S(2)*e + S(2)*f*x)*(g + h*x)**S(3)/(b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(g + h*x)**S(2)*(-S(3)*e*h/S(2) + S(3)*f*g/S(2))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(8)*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*Ei((S(4)*a + S(4)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f**S(4)*p**S(3)*q**S(3)) + S(27)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(S(2)*b**S(3)*f**S(4)*p**S(3)*q**S(3)) + S(6)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f**S(4)*p**S(3)*q**S(3)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(S(2)*b**S(3)*f**S(4)*p**S(3)*q**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), x, -(e/S(2) + f*x/S(2))*(g + h*x)**S(2)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)) - (S(3)*e/S(2) + S(3)*f*x/S(2))*(g + h*x)**S(2)/(b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(g + h*x)*(-e*h + f*g)/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(9)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*Ei((S(3)*a + S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(S(2)*b**S(3)*f**S(3)*p**S(3)*q**S(3)) + S(4)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f**S(3)*p**S(3)*q**S(3)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(S(2)*b**S(3)*f**S(3)*p**S(3)*q**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/(a + b*log(c*(d*(e + f*x)**p)**q))**S(3), x), x, -(e/S(2) + f*x/S(2))*(g + h*x)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)) - (e + f*x)*(g + h*x)/(b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(-e*h/S(2) + f*g/S(2))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + S(2)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*Ei((S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f**S(2)*p**S(3)*q**S(3)) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h/S(2) + f*g/S(2))*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f**S(2)*p**S(3)*q**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(-3)), x), x, (-e/S(2) - f*x/S(2))/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)) + (-e/S(2) - f*x/S(2))/(b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e/S(2) + f*x/S(2))*exp(-a/(b*p*q))*Ei((a + b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))/(b**S(3)*f*p**S(3)*q**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**S(2)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(g + h*x)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**m, x), x, Integral(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(4), x), x, -sqrt(S(5))*sqrt(pi)*sqrt(b)*h**S(4)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(5)/(p*q))*(e + f*x)**S(5)*exp(-S(5)*a/(b*p*q))*erfi(sqrt(S(5))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(50)*f**S(5)) - sqrt(pi)*sqrt(b)*h**S(3)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*(-e*h + f*g)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f**S(5)) - sqrt(S(3))*sqrt(pi)*sqrt(b)*h**S(2)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)**S(2)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*f**S(5)) - sqrt(S(2))*sqrt(pi)*sqrt(b)*h*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(3)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*f**S(5)) - sqrt(pi)*sqrt(b)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(4)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*f**S(5)) + h**S(4)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(5)/(S(5)*f**S(5)) + h**S(3)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(4)*(-e*h + f*g)/f**S(5) + S(2)*h**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)*(-e*h + f*g)**S(2)/f**S(5) + S(2)*h*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)**S(3)/f**S(5) + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(4)/f**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(3), x), x, -sqrt(pi)*sqrt(b)*h**S(3)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(16)*f**S(4)) - sqrt(S(3))*sqrt(pi)*sqrt(b)*h**S(2)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(6)*f**S(4)) - S(3)*sqrt(S(2))*sqrt(pi)*sqrt(b)*h*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f**S(4)) - sqrt(pi)*sqrt(b)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*f**S(4)) + h**S(3)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(4)/(S(4)*f**S(4)) + h**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)*(-e*h + f*g)/f**S(4) + S(3)*h*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(2)*f**S(4)) + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(3)/f**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**S(2), x), x, -sqrt(S(3))*sqrt(pi)*sqrt(b)*h**S(2)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(18)*f**S(3)) - sqrt(S(2))*sqrt(pi)*sqrt(b)*h*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f**S(3)) - sqrt(pi)*sqrt(b)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*f**S(3)) + h**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)/(S(3)*f**S(3)) + h*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)/f**S(3) + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(2)/f**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x), x), x, -sqrt(S(2))*sqrt(pi)*sqrt(b)*h*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f**S(2)) - sqrt(pi)*sqrt(b)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h/S(2) + f*g/S(2))*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/f**S(2) + h*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(2)*f**S(2)) + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, sqrt(pi)*sqrt(b)*sqrt(p)*sqrt(q)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(-e/S(2) - f*x/S(2))*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/f + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x), x), x, Integral(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(2), x), x, -b*f*p*q*Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x)/(S(2)*(-e*h + f*g)) + sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(3), x), x, b*f*p*q*Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(g + h*x)**S(2)), x)/(S(4)*h) - sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(S(2)*h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(4), x), x, b*f*p*q*Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(g + h*x)**S(3)), x)/(S(6)*h) - sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(S(3)*h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**S(5), x), x, b*f*p*q*Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(g + h*x)**S(4)), x)/(S(8)*h) - sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(S(4)*h*(g + h*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)**m, x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)**S(3), x), x, S(3)*sqrt(pi)*b**(S(3)/2)*h**S(3)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(128)*f**S(4)) + sqrt(S(3))*sqrt(pi)*b**(S(3)/2)*h**S(2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(12)*f**S(4)) + S(9)*sqrt(S(2))*sqrt(pi)*b**(S(3)/2)*h*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(32)*f**S(4)) + S(3)*sqrt(pi)*b**(S(3)/2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f**S(4)) - S(3)*b*h**S(3)*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(4)/(S(32)*f**S(4)) - b*h**S(2)*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)*(-e*h + f*g)/(S(2)*f**S(4)) - S(9)*b*h*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(8)*f**S(4)) - S(3)*b*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(3)/(S(2)*f**S(4)) + h**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(4)/(S(4)*f**S(4)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(3)*(-e*h + f*g)/f**S(4) + S(3)*h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(2)*f**S(4)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)**S(3)/f**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)**S(2), x), x, sqrt(S(3))*sqrt(pi)*b**(S(3)/2)*h**S(2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(36)*f**S(3)) + S(3)*sqrt(S(2))*sqrt(pi)*b**(S(3)/2)*h*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(16)*f**S(3)) + S(3)*sqrt(pi)*b**(S(3)/2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f**S(3)) - b*h**S(2)*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)/(S(6)*f**S(3)) - S(3)*b*h*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)/(S(4)*f**S(3)) - S(3)*b*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(2)/(S(2)*f**S(3)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(3)/(S(3)*f**S(3)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)*(-e*h + f*g)/f**S(3) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)**S(2)/f**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x), x), x, S(3)*sqrt(S(2))*sqrt(pi)*b**(S(3)/2)*h*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(32)*f**S(2)) + S(3)*sqrt(pi)*b**(S(3)/2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f**S(2)) - S(3)*b*h*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(8)*f**S(2)) - S(3)*b*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)/(S(2)*f**S(2)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)/(S(2)*f**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), x, S(3)*sqrt(pi)*b**(S(3)/2)*p**(S(3)/2)*q**(S(3)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(4)*f) - S(3)*b*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)/(S(2)*f) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x), x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x)**S(2), x), x, -S(3)*b*f*p*q*Integral(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x), x)/(S(2)*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x)**S(3), x), x, S(3)*b*f*p*q*Integral(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/((e + f*x)*(g + h*x)**S(2)), x)/(S(4)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(S(2)*h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x)**S(4), x), x, b*f*p*q*Integral(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/((e + f*x)*(g + h*x)**S(3)), x)/(S(2)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(S(3)*h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)**m, x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)**S(3), x), x, -S(15)*sqrt(pi)*b**(S(5)/2)*h**S(3)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(1024)*f**S(4)) - S(5)*sqrt(S(3))*sqrt(pi)*b**(S(5)/2)*h**S(2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(72)*f**S(4)) - S(45)*sqrt(S(2))*sqrt(pi)*b**(S(5)/2)*h*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(128)*f**S(4)) - S(15)*sqrt(pi)*b**(S(5)/2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f**S(4)) + S(15)*b**S(2)*h**S(3)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(4)/(S(256)*f**S(4)) + S(5)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)*(-e*h + f*g)/(S(12)*f**S(4)) + S(45)*b**S(2)*h*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(32)*f**S(4)) + S(15)*b**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(3)/(S(4)*f**S(4)) - S(5)*b*h**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(4)/(S(32)*f**S(4)) - S(5)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(3)*(-e*h + f*g)/(S(6)*f**S(4)) - S(15)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(8)*f**S(4)) - S(5)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)**S(3)/(S(2)*f**S(4)) + h**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(4)/(S(4)*f**S(4)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(3)*(-e*h + f*g)/f**S(4) + S(3)*h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(2)*(-e*h + f*g)**S(2)/(S(2)*f**S(4)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)*(-e*h + f*g)**S(3)/f**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)**S(2), x), x, -S(5)*sqrt(S(3))*sqrt(pi)*b**(S(5)/2)*h**S(2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(216)*f**S(3)) - S(15)*sqrt(S(2))*sqrt(pi)*b**(S(5)/2)*h*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(64)*f**S(3)) - S(15)*sqrt(pi)*b**(S(5)/2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f**S(3)) + S(5)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)/(S(36)*f**S(3)) + S(15)*b**S(2)*h*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*h + f*g)/(S(16)*f**S(3)) + S(15)*b**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)**S(2)/(S(4)*f**S(3)) - S(5)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(3)/(S(18)*f**S(3)) - S(5)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)*(-e*h + f*g)/(S(4)*f**S(3)) - S(5)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)**S(2)/(S(2)*f**S(3)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(3)/(S(3)*f**S(3)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(2)*(-e*h + f*g)/f**S(3) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)*(-e*h + f*g)**S(2)/f**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x), x), x, -S(15)*sqrt(S(2))*sqrt(pi)*b**(S(5)/2)*h*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(128)*f**S(2)) - S(15)*sqrt(pi)*b**(S(5)/2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f**S(2)) + S(15)*b**S(2)*h*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(32)*f**S(2)) + S(15)*b**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*(-e*h + f*g)/(S(4)*f**S(2)) - S(5)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)**S(2)/(S(8)*f**S(2)) - S(5)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)*(-e*h + f*g)/(S(2)*f**S(2)) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)**S(2)/(S(2)*f**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)*(-e*h + f*g)/f**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), x, -S(15)*sqrt(pi)*b**(S(5)/2)*p**(S(5)/2)*q**(S(5)/2)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(8)*f) + S(15)*b**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)/(S(4)*f) - S(5)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(e + f*x)/(S(2)*f) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x), x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x)**S(2), x), x, -S(5)*b*f*p*q*Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/(g + h*x), x)/(S(2)*(-e*h + f*g)) + (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(e + f*x)/((g + h*x)*(-e*h + f*g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x)**S(3), x), x, S(5)*b*f*p*q*Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/((e + f*x)*(g + h*x)**S(2)), x)/(S(4)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(S(2)*h*(g + h*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x)**S(4), x), x, S(5)*b*f*p*q*Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/((e + f*x)*(g + h*x)**S(3)), x)/(S(6)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(S(3)*h*(g + h*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(g + h*x)**S(5), x), x, S(5)*b*f*p*q*Integral((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)/((e + f*x)*(g + h*x)**S(4)), x)/(S(8)*h) - (a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)/(S(4)*h*(g + h*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, Integral((g + h*x)**m/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(3)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, sqrt(pi)*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*sqrt(b)*f**S(4)*sqrt(p)*sqrt(q)) + sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f**S(4)*sqrt(p)*sqrt(q)) + S(3)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*sqrt(b)*f**S(4)*sqrt(p)*sqrt(q)) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f**S(4)*sqrt(p)*sqrt(q)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*sqrt(b)*f**S(3)*sqrt(p)*sqrt(q)) + sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f**S(3)*sqrt(p)*sqrt(q)) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f**S(3)*sqrt(p)*sqrt(q)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(2)*sqrt(b)*f**S(2)*sqrt(p)*sqrt(q)) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f**S(2)*sqrt(p)*sqrt(q)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(sqrt(b)*f*sqrt(p)*sqrt(q)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), x, Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), x, Integral((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(3)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), x, -(S(2)*e + S(2)*f*x)*(g + h*x)**S(3)/(b*f*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(4)*sqrt(pi)*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(4)*p**(S(3)/2)*q**(S(3)/2)) + S(6)*sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(4)*p**(S(3)/2)*q**(S(3)/2)) + S(6)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(4)*p**(S(3)/2)*q**(S(3)/2)) + S(2)*sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(4)*p**(S(3)/2)*q**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), x, -(S(2)*e + S(2)*f*x)*(g + h*x)**S(2)/(b*f*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(2)*sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(3)*p**(S(3)/2)*q**(S(3)/2)) + S(4)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(3)*p**(S(3)/2)*q**(S(3)/2)) + S(2)*sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(3)*p**(S(3)/2)*q**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2), x), x, -(S(2)*e + S(2)*f*x)*(g + h*x)/(b*f*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(2)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(2)*p**(S(3)/2)*q**(S(3)/2)) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-S(2)*e*h + S(2)*f*g)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f**S(2)*p**(S(3)/2)*q**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(-3)/2), x), x, -(S(2)*e + S(2)*f*x)/(b*f*p*q*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(S(2)*e + S(2)*f*x)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(3)/2)*f*p**(S(3)/2)*q**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), x, Integral((g + h*x)**m/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), expand=True, _diff=True, _numerical=True) ''' long time in rubi test assert rubi_test(rubi_integrate((g + h*x)**S(3)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), x, (-S(2)*e/S(3) - S(2)*f*x/S(3))*(g + h*x)**S(3)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)) - (S(16)*e/S(3) + S(16)*f*x/S(3))*(g + h*x)**S(3)/(b**S(2)*f*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(g + h*x)**S(2)*(-S(4)*e*h + S(4)*f*g)/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(32)*sqrt(pi)*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*(e + f*x)**S(4)*exp(-S(4)*a/(b*p*q))*erfi(S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*b**(S(5)/2)*f**S(4)*p**(S(5)/2)*q**(S(5)/2)) + S(12)*sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*(-e*h + f*g)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(5)/2)*f**S(4)*p**(S(5)/2)*q**(S(5)/2)) + S(8)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(5)/2)*f**S(4)*p**(S(5)/2)*q**(S(5)/2)) + S(4)*sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(3)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*b**(S(5)/2)*f**S(4)*p**(S(5)/2)*q**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)**S(2)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), x, (-S(2)*e/S(3) - S(2)*f*x/S(3))*(g + h*x)**S(2)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)) - (S(4)*e + S(4)*f*x)*(g + h*x)**S(2)/(b**S(2)*f*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(g + h*x)*(-S(8)*e*h/S(3) + S(8)*f*g/S(3))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(4)*sqrt(S(3))*sqrt(pi)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*(e + f*x)**S(3)*exp(-S(3)*a/(b*p*q))*erfi(sqrt(S(3))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(5)/2)*f**S(3)*p**(S(5)/2)*q**(S(5)/2)) + S(16)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*(-e*h + f*g)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*b**(S(5)/2)*f**S(3)*p**(S(5)/2)*q**(S(5)/2)) + S(4)*sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-e*h + f*g)**S(2)*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*b**(S(5)/2)*f**S(3)*p**(S(5)/2)*q**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g + h*x)/(a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2), x), x, (-S(2)*e/S(3) - S(2)*f*x/S(3))*(g + h*x)/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)) - (S(8)*e/S(3) + S(8)*f*x/S(3))*(g + h*x)/(b**S(2)*f*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + (e + f*x)*(-S(4)*e*h/S(3) + S(4)*f*g/S(3))/(b**S(2)*f**S(2)*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + S(8)*sqrt(S(2))*sqrt(pi)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*(e + f*x)**S(2)*exp(-S(2)*a/(b*p*q))*erfi(sqrt(S(2))*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(S(3)*b**(S(5)/2)*f**S(2)*p**(S(5)/2)*q**(S(5)/2)) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(e + f*x)*(-S(4)*e*h/S(3) + S(4)*f*g/S(3))*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(5)/2)*f**S(2)*p**(S(5)/2)*q**(S(5)/2)), expand=True, _diff=True, _numerical=True) ''' assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**(S(-5)/2), x), x, (-S(2)*e/S(3) - S(2)*f*x/S(3))/(b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**(S(3)/2)) - (S(4)*e/S(3) + S(4)*f*x/S(3))/(b**S(2)*f*p**S(2)*q**S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))) + sqrt(pi)*(c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*(S(4)*e/S(3) + S(4)*f*x/S(3))*exp(-a/(b*p*q))*erfi(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(b)*sqrt(p)*sqrt(q)))/(b**(S(5)/2)*f*p**(S(5)/2)*q**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**(S(5)/2)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2), x), x, -S(4)*b*p*q*(g + h*x)**(S(5)/2)/(S(25)*h) - S(4)*b*p*q*(g + h*x)**(S(3)/2)*(-e*h + f*g)/(S(15)*f*h) - S(4)*b*p*q*sqrt(g + h*x)*(-e*h + f*g)**S(2)/(S(5)*f**S(2)*h) + S(4)*b*p*q*(-e*h + f*g)**(S(5)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(5)*f**(S(5)/2)*h) + S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(5)/2)/(S(5)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x), x), x, -S(4)*b*p*q*(g + h*x)**(S(3)/2)/(S(9)*h) - S(4)*b*p*q*sqrt(g + h*x)*(-e*h + f*g)/(S(3)*f*h) + S(4)*b*p*q*(-e*h + f*g)**(S(3)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(3)*f**(S(3)/2)*h) + S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)/(S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/sqrt(g + h*x), x), x, -S(4)*b*p*q*sqrt(g + h*x)/h + S(4)*b*p*q*sqrt(-e*h + f*g)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(sqrt(f)*h) + (S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**(S(3)/2), x), x, -S(4)*b*sqrt(f)*p*q*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(h*sqrt(-e*h + f*g)) - (S(2)*a + S(2)*b*log(c*(d*(e + f*x)**p)**q))/(h*sqrt(g + h*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**(S(5)/2), x), x, -S(4)*b*f**(S(3)/2)*p*q*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(3)*h*(-e*h + f*g)**(S(3)/2)) + S(4)*b*f*p*q/(S(3)*h*sqrt(g + h*x)*(-e*h + f*g)) - (S(2)*a/S(3) + S(2)*b*log(c*(d*(e + f*x)**p)**q)/S(3))/(h*(g + h*x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**(S(7)/2), x), x, -S(4)*b*f**(S(5)/2)*p*q*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(5)*h*(-e*h + f*g)**(S(5)/2)) + S(4)*b*f**S(2)*p*q/(S(5)*h*sqrt(g + h*x)*(-e*h + f*g)**S(2)) + S(4)*b*f*p*q/(S(15)*h*(g + h*x)**(S(3)/2)*(-e*h + f*g)) - (S(2)*a/S(5) + S(2)*b*log(c*(d*(e + f*x)**p)**q)/S(5))/(h*(g + h*x)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**(S(9)/2), x), x, -S(4)*b*f**(S(7)/2)*p*q*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(7)*h*(-e*h + f*g)**(S(7)/2)) + S(4)*b*f**S(3)*p*q/(S(7)*h*sqrt(g + h*x)*(-e*h + f*g)**S(3)) + S(4)*b*f**S(2)*p*q/(S(21)*h*(g + h*x)**(S(3)/2)*(-e*h + f*g)**S(2)) + S(4)*b*f*p*q/(S(35)*h*(g + h*x)**(S(5)/2)*(-e*h + f*g)) - (S(2)*a/S(7) + S(2)*b*log(c*(d*(e + f*x)**p)**q)/S(7))/(h*(g + h*x)**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**(S(3)/2), x), x, S(16)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**(S(5)/2)/(S(125)*h) + S(128)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**(S(3)/2)*(-e*h + f*g)/(S(225)*f*h) + S(368)*b**S(2)*p**S(2)*q**S(2)*sqrt(g + h*x)*(-e*h + f*g)**S(2)/(S(75)*f**S(2)*h) + S(16)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(5)/2)*log(S(2)/(-sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g) + S(1)))*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(5)*f**(S(5)/2)*h) - S(8)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(5)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))**S(2)/(S(5)*f**(S(5)/2)*h) - S(368)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(5)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(75)*f**(S(5)/2)*h) + S(8)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(5)/2)*polylog(S(2), (-sqrt(f)*sqrt(g + h*x) - sqrt(-e*h + f*g))/(-sqrt(f)*sqrt(g + h*x) + sqrt(-e*h + f*g)))/(S(5)*f**(S(5)/2)*h) - S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(5)/2)/(S(25)*h) - S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)*(-e*h + f*g)/(S(15)*f*h) - S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)*(-e*h + f*g)**S(2)/(S(5)*f**S(2)*h) + S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(-e*h + f*g)**(S(5)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(5)*f**(S(5)/2)*h) + S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**(S(5)/2)/(S(5)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*sqrt(g + h*x), x), x, S(16)*b**S(2)*p**S(2)*q**S(2)*(g + h*x)**(S(3)/2)/(S(27)*h) + S(64)*b**S(2)*p**S(2)*q**S(2)*sqrt(g + h*x)*(-e*h + f*g)/(S(9)*f*h) + S(16)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(3)/2)*log(S(2)/(-sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g) + S(1)))*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(3)*f**(S(3)/2)*h) - S(8)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(3)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))**S(2)/(S(3)*f**(S(3)/2)*h) - S(64)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(3)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(9)*f**(S(3)/2)*h) + S(8)*b**S(2)*p**S(2)*q**S(2)*(-e*h + f*g)**(S(3)/2)*polylog(S(2), (-sqrt(f)*sqrt(g + h*x) - sqrt(-e*h + f*g))/(-sqrt(f)*sqrt(g + h*x) + sqrt(-e*h + f*g)))/(S(3)*f**(S(3)/2)*h) - S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)/(S(9)*h) - S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)*(-e*h + f*g)/(S(3)*f*h) + S(8)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(-e*h + f*g)**(S(3)/2)*atanh(sqrt(f)*sqrt(g + h*x)/sqrt(-e*h + f*g))/(S(3)*f**(S(3)/2)*h) + S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)**(S(3)/2)/(S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x), x), x, -b*f*p*q*Integral((g + h*x)**(S(3)/2)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)), x)/(S(3)*h) + S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)/(S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/sqrt(g + h*x), x), x, -b*f*p*q*Integral(sqrt(g + h*x)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)), x)/h + S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x)**(S(3)/2), x), x, b*f*p*q*Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)*sqrt(g + h*x)), x)/h - S(2)*sqrt(a + b*log(c*(d*(e + f*x)**p)**q))/(h*sqrt(g + h*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(g + h*x)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), x, Integral(sqrt(g + h*x)/sqrt(a + b*log(c*(d*(e + f*x)**p)**q)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)), x), x, Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*sqrt(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)), x), x, Integral(S(1)/(sqrt(a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)**(S(3)/2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n*(g + h*x)**m, x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**n*(g + h*x)**m, x), expand=True, _diff=True, _numerical=True) '''long time assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n*(g + h*x)**S(3), x), x, S(3)*S(2)**(-n + S(-1))*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(2)*(-e*h + f*g)**S(2)*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(2)*a/(b*p*q))/f**S(4) + S(4)**(-n + S(-1))*h**S(3)*(c*(d*(e + f*x)**p)**q)**(-S(4)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(4)*Gamma(n + S(1), (-S(4)*a - S(4)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(4)*a/(b*p*q))/f**S(4) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)*(-e*h + f*g)**S(3)*Gamma(n + S(1), (-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-a/(b*p*q))/f**S(4) + S(3)**(-n)*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(3)*(-e*h + f*g)*Gamma(n + S(1), (-S(3)*a - S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(3)*a/(b*p*q))/f**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n*(g + h*x)**S(2), x), x, S(3)**(-n + S(-1))*h**S(2)*(c*(d*(e + f*x)**p)**q)**(-S(3)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(3)*Gamma(n + S(1), (-S(3)*a - S(3)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(3)*a/(b*p*q))/f**S(3) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)*(-e*h + f*g)**S(2)*Gamma(n + S(1), (-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-a/(b*p*q))/f**S(3) + S(2)**(-n)*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(2)*(-e*h + f*g)*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(2)*a/(b*p*q))/f**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n*(g + h*x), x), x, S(2)**(-n + S(-1))*h*(c*(d*(e + f*x)**p)**q)**(-S(2)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)**S(2)*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-S(2)*a/(b*p*q))/f**S(2) + (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)*(-e*h + f*g)*Gamma(n + S(1), (-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-a/(b*p*q))/f**S(2), expand=True, _diff=True, _numerical=True) ''' assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n, x), x, (c*(d*(e + f*x)**p)**q)**(-S(1)/(p*q))*((-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))**(-n)*(a + b*log(c*(d*(e + f*x)**p)**q))**n*(e + f*x)*Gamma(n + S(1), (-a - b*log(c*(d*(e + f*x)**p)**q))/(b*p*q))*exp(-a/(b*p*q))/f, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**n/(g + h*x), x), x, Integral((a + b*log(c*(d*(e + f*x)**p)**q))**n/(g + h*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))*(i + j*x)**S(4)/(d*e + d*f*x), x), x, -S(4)*b*j*x*(-e*j + f*i)**S(3)/(d*f**S(4)) - b*j**S(4)*(e + f*x)**S(4)/(S(16)*d*f**S(5)) - S(4)*b*j**S(3)*(e + f*x)**S(3)*(-e*j + f*i)/(S(9)*d*f**S(5)) - S(3)*b*j**S(2)*(e + f*x)**S(2)*(-e*j + f*i)**S(2)/(S(2)*d*f**S(5)) + j**S(4)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(4)/(S(4)*d*f**S(5)) + S(4)*j**S(3)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(3)*(-e*j + f*i)/(S(3)*d*f**S(5)) + S(3)*j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)*(-e*j + f*i)**S(2)/(d*f**S(5)) + S(4)*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)**S(3)/(d*f**S(5)) + (a + b*log(c*(e + f*x)))**S(2)*(-e*j + f*i)**S(4)/(S(2)*b*d*f**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))*(i + j*x)**S(3)/(d*e + d*f*x), x), x, -S(3)*b*j*x*(-e*j + f*i)**S(2)/(d*f**S(3)) - b*j**S(3)*(e + f*x)**S(3)/(S(9)*d*f**S(4)) - S(3)*b*j**S(2)*(e + f*x)**S(2)*(-e*j + f*i)/(S(4)*d*f**S(4)) + j**S(3)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(3)/(S(3)*d*f**S(4)) + S(3)*j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)*(-e*j + f*i)/(S(2)*d*f**S(4)) + S(3)*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)**S(2)/(d*f**S(4)) + (a + b*log(c*(e + f*x)))**S(2)*(-e*j + f*i)**S(3)/(S(2)*b*d*f**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))*(i + j*x)**S(2)/(d*e + d*f*x), x), x, -S(2)*b*j*x*(-e*j + f*i)/(d*f**S(2)) - b*j**S(2)*(e + f*x)**S(2)/(S(4)*d*f**S(3)) + j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)/(S(2)*d*f**S(3)) + S(2)*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)/(d*f**S(3)) + (a + b*log(c*(e + f*x)))**S(2)*(-e*j + f*i)**S(2)/(S(2)*b*d*f**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))*(i + j*x)/(d*e + d*f*x), x), x, -b*j*x/(d*f) + j*(a + b*log(c*(e + f*x)))*(e + f*x)/(d*f**S(2)) + (a + b*log(c*(e + f*x)))**S(2)*(-e*j/S(2) + f*i/S(2))/(b*d*f**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))/(d*e + d*f*x), x), x, (a + b*log(c*(e + f*x)))**S(2)/(S(2)*b*d*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))/((i + j*x)*(d*e + d*f*x)), x), x, -b*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)) - (a + b*log(c*(e + f*x)))*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)) + (a + b*log(c*(e + f*x)))**S(2)/(S(2)*b*d*(-e*j + f*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))/((i + j*x)**S(2)*(d*e + d*f*x)), x), x, -b*f*log(e + f*x)/(d*(-e*j + f*i)**S(2)) + b*f*log(i + j*x)/(d*(-e*j + f*i)**S(2)) - b*f*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) - f*(a + b*log(c*(e + f*x)))*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) + (a + b*log(c*(e + f*x)))/(d*(i + j*x)*(-e*j + f*i)) + f*(a + b*log(c*(e + f*x)))**S(2)/(S(2)*b*d*(-e*j + f*i)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))/((i + j*x)**S(3)*(d*e + d*f*x)), x), x, -S(3)*b*f**S(2)*log(e + f*x)/(S(2)*d*(-e*j + f*i)**S(3)) + S(3)*b*f**S(2)*log(i + j*x)/(S(2)*d*(-e*j + f*i)**S(3)) - b*f**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) - b*f/(S(2)*d*(i + j*x)*(-e*j + f*i)**S(2)) - f**S(2)*(a + b*log(c*(e + f*x)))*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) + f*(a + b*log(c*(e + f*x)))/(d*(i + j*x)*(-e*j + f*i)**S(2)) + (a/S(2) + b*log(c*(e + f*x))/S(2))/(d*(i + j*x)**S(2)*(-e*j + f*i)) + f**S(2)*(a + b*log(c*(e + f*x)))**S(2)/(S(2)*b*d*(-e*j + f*i)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)**S(4)/(d*e + d*f*x), x), x, S(8)*b**S(2)*j*x*(-e*j + f*i)**S(3)/(d*f**S(4)) + b**S(2)*j**S(4)*(e + f*x)**S(4)/(S(32)*d*f**S(5)) + S(8)*b**S(2)*j**S(3)*(e + f*x)**S(3)*(-e*j + f*i)/(S(27)*d*f**S(5)) + S(3)*b**S(2)*j**S(2)*(e + f*x)**S(2)*(-e*j + f*i)**S(2)/(S(2)*d*f**S(5)) - b*j**S(4)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(4)/(S(8)*d*f**S(5)) - S(8)*b*j**S(3)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(3)*(-e*j + f*i)/(S(9)*d*f**S(5)) - S(3)*b*j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)*(-e*j + f*i)**S(2)/(d*f**S(5)) - S(8)*b*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)**S(3)/(d*f**S(5)) + j**S(4)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(4)/(S(4)*d*f**S(5)) + S(4)*j**S(3)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(3)*(-e*j + f*i)/(S(3)*d*f**S(5)) + S(3)*j**S(2)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(2)*(-e*j + f*i)**S(2)/(d*f**S(5)) + S(4)*j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)*(-e*j + f*i)**S(3)/(d*f**S(5)) + (a + b*log(c*(e + f*x)))**S(3)*(-e*j + f*i)**S(4)/(S(3)*b*d*f**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)**S(3)/(d*e + d*f*x), x), x, S(6)*b**S(2)*j*x*(-e*j + f*i)**S(2)/(d*f**S(3)) + S(2)*b**S(2)*j**S(3)*(e + f*x)**S(3)/(S(27)*d*f**S(4)) + S(3)*b**S(2)*j**S(2)*(e + f*x)**S(2)*(-e*j + f*i)/(S(4)*d*f**S(4)) - S(2)*b*j**S(3)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(3)/(S(9)*d*f**S(4)) - S(3)*b*j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)*(-e*j + f*i)/(S(2)*d*f**S(4)) - S(6)*b*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)**S(2)/(d*f**S(4)) + j**S(3)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(3)/(S(3)*d*f**S(4)) + S(3)*j**S(2)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(2)*(-e*j + f*i)/(S(2)*d*f**S(4)) + S(3)*j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)*(-e*j + f*i)**S(2)/(d*f**S(4)) + (a + b*log(c*(e + f*x)))**S(3)*(-e*j + f*i)**S(3)/(S(3)*b*d*f**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)**S(2)/(d*e + d*f*x), x), x, S(4)*b**S(2)*j*x*(-e*j + f*i)/(d*f**S(2)) + b**S(2)*j**S(2)*(e + f*x)**S(2)/(S(4)*d*f**S(3)) - b*j**S(2)*(a + b*log(c*(e + f*x)))*(e + f*x)**S(2)/(S(2)*d*f**S(3)) - S(4)*b*j*(a + b*log(c*(e + f*x)))*(e + f*x)*(-e*j + f*i)/(d*f**S(3)) + j**S(2)*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)**S(2)/(S(2)*d*f**S(3)) + S(2)*j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)*(-e*j + f*i)/(d*f**S(3)) + (a + b*log(c*(e + f*x)))**S(3)*(-e*j + f*i)**S(2)/(S(3)*b*d*f**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)/(d*e + d*f*x), x), x, S(2)*b**S(2)*j*x/(d*f) - S(2)*b*j*(a + b*log(c*(e + f*x)))*(e + f*x)/(d*f**S(2)) + j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)/(d*f**S(2)) + (a + b*log(c*(e + f*x)))**S(3)*(-e*j/S(3) + f*i/S(3))/(b*d*f**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)/(d*e + d*f*x), x), x, (a + b*log(c*(e + f*x)))**S(3)/(S(3)*b*d*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)/((i + j*x)*(d*e + d*f*x)), x), x, S(2)*b**S(2)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)) - S(2)*b*(a + b*log(c*(e + f*x)))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)) - (a + b*log(c*(e + f*x)))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)) + (a + b*log(c*(e + f*x)))**S(3)/(S(3)*b*d*(-e*j + f*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)/((i + j*x)**S(2)*(d*e + d*f*x)), x), x, S(2)*b**S(2)*f*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) + S(2)*b**S(2)*f*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) + S(2)*b*f*(a + b*log(c*(e + f*x)))*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) - S(2)*b*f*(a + b*log(c*(e + f*x)))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) - f*(a + b*log(c*(e + f*x)))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(2)) - j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)/(d*(i + j*x)*(-e*j + f*i)**S(2)) + f*(a + b*log(c*(e + f*x)))**S(3)/(S(3)*b*d*(-e*j + f*i)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)/((i + j*x)**S(3)*(d*e + d*f*x)), x), x, b**S(2)*f**S(2)*log(e + f*x)/(d*(-e*j + f*i)**S(3)) - b**S(2)*f**S(2)*log(i + j*x)/(d*(-e*j + f*i)**S(3)) + S(3)*b**S(2)*f**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) + S(2)*b**S(2)*f**S(2)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) + S(3)*b*f**S(2)*(a + b*log(c*(e + f*x)))*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) - S(2)*b*f**S(2)*(a + b*log(c*(e + f*x)))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) - b*f*(a + b*log(c*(e + f*x)))/(d*(i + j*x)*(-e*j + f*i)**S(2)) - f**S(2)*(a + b*log(c*(e + f*x)))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(d*(-e*j + f*i)**S(3)) - f**S(2)*(a + b*log(c*(e + f*x)))**S(2)/(S(2)*d*(-e*j + f*i)**S(3)) - f*j*(a + b*log(c*(e + f*x)))**S(2)*(e + f*x)/(d*(i + j*x)*(-e*j + f*i)**S(3)) + (a + b*log(c*(e + f*x)))**S(2)/(S(2)*d*(i + j*x)**S(2)*(-e*j + f*i)) + f**S(2)*(a + b*log(c*(e + f*x)))**S(3)/(S(3)*b*d*(-e*j + f*i)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)**S(4)/((a + b*log(c*(e + f*x)))*(d*e + d*f*x)), x), x, (-e*j + f*i)**S(4)*log(a + b*log(c*(e + f*x)))/(b*d*f**S(5)) + S(4)*j*(-e*j + f*i)**S(3)*exp(-a/b)*Ei((a + b*log(c*(e + f*x)))/b)/(b*c*d*f**S(5)) + S(6)*j**S(2)*(-e*j + f*i)**S(2)*exp(-S(2)*a/b)*Ei((S(2)*a + S(2)*b*log(c*(e + f*x)))/b)/(b*c**S(2)*d*f**S(5)) + S(4)*j**S(3)*(-e*j + f*i)*exp(-S(3)*a/b)*Ei((S(3)*a + S(3)*b*log(c*(e + f*x)))/b)/(b*c**S(3)*d*f**S(5)) + j**S(4)*exp(-S(4)*a/b)*Ei((S(4)*a + S(4)*b*log(c*(e + f*x)))/b)/(b*c**S(4)*d*f**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)**S(3)/((a + b*log(c*(e + f*x)))*(d*e + d*f*x)), x), x, (-e*j + f*i)**S(3)*log(a + b*log(c*(e + f*x)))/(b*d*f**S(4)) + S(3)*j*(-e*j + f*i)**S(2)*exp(-a/b)*Ei((a + b*log(c*(e + f*x)))/b)/(b*c*d*f**S(4)) + S(3)*j**S(2)*(-e*j + f*i)*exp(-S(2)*a/b)*Ei((S(2)*a + S(2)*b*log(c*(e + f*x)))/b)/(b*c**S(2)*d*f**S(4)) + j**S(3)*exp(-S(3)*a/b)*Ei((S(3)*a + S(3)*b*log(c*(e + f*x)))/b)/(b*c**S(3)*d*f**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)**S(2)/((a + b*log(c*(e + f*x)))*(d*e + d*f*x)), x), x, (-e*j + f*i)**S(2)*log(a + b*log(c*(e + f*x)))/(b*d*f**S(3)) + S(2)*j*(-e*j + f*i)*exp(-a/b)*Ei((a + b*log(c*(e + f*x)))/b)/(b*c*d*f**S(3)) + j**S(2)*exp(-S(2)*a/b)*Ei((S(2)*a + S(2)*b*log(c*(e + f*x)))/b)/(b*c**S(2)*d*f**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)/((a + b*log(c*(e + f*x)))*(d*e + d*f*x)), x), x, (-e*j + f*i)*log(a + b*log(c*(e + f*x)))/(b*d*f**S(2)) + j*exp(-a/b)*Ei((a + b*log(c*(e + f*x)))/b)/(b*c*d*f**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(e + f*x)))*(d*e + d*f*x)), x), x, log(a + b*log(c*(e + f*x)))/(b*d*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(e + f*x)))*(i + j*x)*(d*e + d*f*x)), x), x, Integral(S(1)/((a + b*log(c*(e + f*x)))*(i + j*x)*(d*e + d*f*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(e + f*x)))*(i + j*x)**S(2)*(d*e + d*f*x)), x), x, Integral(S(1)/((a + b*log(c*(e + f*x)))*(i + j*x)**S(2)*(d*e + d*f*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e*x)**n))*(f + g*x)**(S(5)/2)/(d + e*x), x), x, -S(4)*b*n*(f + g*x)**(S(5)/2)/(S(25)*e) - S(32)*b*n*(f + g*x)**(S(3)/2)*(-d*g + e*f)/(S(45)*e**S(2)) - S(92)*b*n*sqrt(f + g*x)*(-d*g + e*f)**S(2)/(S(15)*e**S(3)) - S(4)*b*n*(-d*g + e*f)**(S(5)/2)*log(S(2)/(-sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f) + S(1)))*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(7)/2) + S(2)*b*n*(-d*g + e*f)**(S(5)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))**S(2)/e**(S(7)/2) + S(92)*b*n*(-d*g + e*f)**(S(5)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/(S(15)*e**(S(7)/2)) - S(2)*b*n*(-d*g + e*f)**(S(5)/2)*polylog(S(2), (-sqrt(e)*sqrt(f + g*x) - sqrt(-d*g + e*f))/(-sqrt(e)*sqrt(f + g*x) + sqrt(-d*g + e*f)))/e**(S(7)/2) + S(2)*(a + b*log(c*(d + e*x)**n))*(f + g*x)**(S(5)/2)/(S(5)*e) + (a + b*log(c*(d + e*x)**n))*(f + g*x)**(S(3)/2)*(-S(2)*d*g/S(3) + S(2)*e*f/S(3))/e**S(2) + S(2)*(a + b*log(c*(d + e*x)**n))*sqrt(f + g*x)*(-d*g + e*f)**S(2)/e**S(3) - S(2)*(a + b*log(c*(d + e*x)**n))*(-d*g + e*f)**(S(5)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(7)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e*x)**n))*(f + g*x)**(S(3)/2)/(d + e*x), x), x, -S(4)*b*n*(f + g*x)**(S(3)/2)/(S(9)*e) - S(16)*b*n*sqrt(f + g*x)*(-d*g + e*f)/(S(3)*e**S(2)) - S(4)*b*n*(-d*g + e*f)**(S(3)/2)*log(S(2)/(-sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f) + S(1)))*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(5)/2) + S(2)*b*n*(-d*g + e*f)**(S(3)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))**S(2)/e**(S(5)/2) + S(16)*b*n*(-d*g + e*f)**(S(3)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/(S(3)*e**(S(5)/2)) - S(2)*b*n*(-d*g + e*f)**(S(3)/2)*polylog(S(2), (-sqrt(e)*sqrt(f + g*x) - sqrt(-d*g + e*f))/(-sqrt(e)*sqrt(f + g*x) + sqrt(-d*g + e*f)))/e**(S(5)/2) + S(2)*(a + b*log(c*(d + e*x)**n))*(f + g*x)**(S(3)/2)/(S(3)*e) + (a + b*log(c*(d + e*x)**n))*sqrt(f + g*x)*(-S(2)*d*g + S(2)*e*f)/e**S(2) - S(2)*(a + b*log(c*(d + e*x)**n))*(-d*g + e*f)**(S(3)/2)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e*x)**n))*sqrt(f + g*x)/(d + e*x), x), x, -S(4)*b*n*sqrt(f + g*x)/e - S(4)*b*n*sqrt(-d*g + e*f)*log(S(2)/(-sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f) + S(1)))*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(3)/2) + S(2)*b*n*sqrt(-d*g + e*f)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))**S(2)/e**(S(3)/2) + S(4)*b*n*sqrt(-d*g + e*f)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(3)/2) - S(2)*b*n*sqrt(-d*g + e*f)*polylog(S(2), (-sqrt(e)*sqrt(f + g*x) - sqrt(-d*g + e*f))/(-sqrt(e)*sqrt(f + g*x) + sqrt(-d*g + e*f)))/e**(S(3)/2) + (S(2)*a + S(2)*b*log(c*(d + e*x)**n))*sqrt(f + g*x)/e - S(2)*(a + b*log(c*(d + e*x)**n))*sqrt(-d*g + e*f)*atanh(sqrt(e)*sqrt(f + g*x)/sqrt(-d*g + e*f))/e**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x)*log(a + b*x)/(a + b*x), x), x, S(2)*sqrt(d + e*x)*log(a + b*x)/b - S(4)*sqrt(d + e*x)/b - S(2)*sqrt(-a*e + b*d)*log(a + b*x)*atanh(sqrt(b)*sqrt(d + e*x)/sqrt(-a*e + b*d))/b**(S(3)/2) - S(4)*sqrt(-a*e + b*d)*log(S(2)/(-sqrt(b)*sqrt(d + e*x)/sqrt(-a*e + b*d) + S(1)))*atanh(sqrt(b)*sqrt(d + e*x)/sqrt(-a*e + b*d))/b**(S(3)/2) + S(2)*sqrt(-a*e + b*d)*atanh(sqrt(b)*sqrt(d + e*x)/sqrt(-a*e + b*d))**S(2)/b**(S(3)/2) + S(4)*sqrt(-a*e + b*d)*atanh(sqrt(b)*sqrt(d + e*x)/sqrt(-a*e + b*d))/b**(S(3)/2) - S(2)*sqrt(-a*e + b*d)*polylog(S(2), (-sqrt(b)*sqrt(d + e*x) - sqrt(-a*e + b*d))/(-sqrt(b)*sqrt(d + e*x) + sqrt(-a*e + b*d)))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)**m/(d*e + d*f*x), x), x, Integral((a + b*log(c*(e + f*x)))**S(2)*(i + j*x)**m/(d*e + d*f*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))*(i + j*x)**m/(d*e + d*f*x), x), x, Integral((a + b*log(c*(e + f*x)))*(i + j*x)**m/(d*e + d*f*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n*(i + j*x)**m/(d*e + d*f*x), x), x, Integral((a + b*log(c*(e + f*x)))**n*(i + j*x)**m/(d*e + d*f*x), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n*(i + j*x)**S(4)/(d*e + d*f*x), x), x, S(4)*S(3)**(-n + S(-1))*j**S(3)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)*Gamma(n + S(1), (-S(3)*a - S(3)*b*log(c*(e + f*x)))/b)*exp(-S(3)*a/b)/(c**S(3)*d*f**S(5)) + S(4)**(-n + S(-1))*j**S(4)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*Gamma(n + S(1), (-S(4)*a - S(4)*b*log(c*(e + f*x)))/b)*exp(-S(4)*a/b)/(c**S(4)*d*f**S(5)) + S(4)*j*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)**S(3)*Gamma(n + S(1), (-a - b*log(c*(e + f*x)))/b)*exp(-a/b)/(c*d*f**S(5)) + (a + b*log(c*(e + f*x)))**(n + S(1))*(-e*j + f*i)**S(4)/(b*d*f**S(5)*(n + S(1))) + S(3)*S(2)**(-n)*j**S(2)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)**S(2)*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(e + f*x)))/b)*exp(-S(2)*a/b)/(c**S(2)*d*f**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n*(i + j*x)**S(3)/(d*e + d*f*x), x), x, S(3)*S(2)**(-n + S(-1))*j**S(2)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(e + f*x)))/b)*exp(-S(2)*a/b)/(c**S(2)*d*f**S(4)) + S(3)**(-n + S(-1))*j**S(3)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*Gamma(n + S(1), (-S(3)*a - S(3)*b*log(c*(e + f*x)))/b)*exp(-S(3)*a/b)/(c**S(3)*d*f**S(4)) + S(3)*j*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)**S(2)*Gamma(n + S(1), (-a - b*log(c*(e + f*x)))/b)*exp(-a/b)/(c*d*f**S(4)) + (a + b*log(c*(e + f*x)))**(n + S(1))*(-e*j + f*i)**S(3)/(b*d*f**S(4)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n*(i + j*x)**S(2)/(d*e + d*f*x), x), x, S(2)**(-n + S(-1))*j**S(2)*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*Gamma(n + S(1), (-S(2)*a - S(2)*b*log(c*(e + f*x)))/b)*exp(-S(2)*a/b)/(c**S(2)*d*f**S(3)) + S(2)*j*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*(-e*j + f*i)*Gamma(n + S(1), (-a - b*log(c*(e + f*x)))/b)*exp(-a/b)/(c*d*f**S(3)) + (a + b*log(c*(e + f*x)))**(n + S(1))*(-e*j + f*i)**S(2)/(b*d*f**S(3)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n*(i + j*x)/(d*e + d*f*x), x), x, j*((-a - b*log(c*(e + f*x)))/b)**(-n)*(a + b*log(c*(e + f*x)))**n*Gamma(n + S(1), (-a - b*log(c*(e + f*x)))/b)*exp(-a/b)/(c*d*f**S(2)) + (a + b*log(c*(e + f*x)))**(n + S(1))*(-e*j + f*i)/(b*d*f**S(2)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n/(d*e + d*f*x), x), x, (a + b*log(c*(e + f*x)))**(n + S(1))/(b*d*f*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n/((i + j*x)*(d*e + d*f*x)), x), x, Integral((a + b*log(c*(e + f*x)))**n/((i + j*x)*(d*e + d*f*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n/((i + j*x)**S(2)*(d*e + d*f*x)), x), x, Integral((a + b*log(c*(e + f*x)))**n/((i + j*x)**S(2)*(d*e + d*f*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(e + f*x)))**n/((i + j*x)**S(3)*(d*e + d*f*x)), x), x, Integral((a + b*log(c*(e + f*x)))**n/((i + j*x)**S(3)*(d*e + d*f*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(3)/(g + h*x), x), x, a*j*x*(-g*j + h*i)**S(2)/h**S(3) - b*p*q*(i + j*x)**S(3)/(S(9)*h) - b*p*q*(i + j*x)**S(2)*(-g*j + h*i)/(S(4)*h**S(2)) - b*j*p*q*x*(-g*j + h*i)**S(2)/h**S(3) + b*p*q*(-g*j + h*i)**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(4) - b*p*q*(i + j*x)**S(2)*(-e*j + f*i)/(S(6)*f*h) - b*j*p*q*x*(-e*j + f*i)*(-g*j + h*i)/(S(2)*f*h**S(2)) + b*j*(e + f*x)*(-g*j + h*i)**S(2)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(3)) - b*j*p*q*x*(-e*j + f*i)**S(2)/(S(3)*f**S(2)*h) - b*p*q*(-e*j + f*i)**S(2)*(-g*j + h*i)*log(e + f*x)/(S(2)*f**S(2)*h**S(2)) - b*p*q*(-e*j + f*i)**S(3)*log(e + f*x)/(S(3)*f**S(3)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(3)/(S(3)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(2)*(-g*j/S(2) + h*i/S(2))/h**S(2) + (a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(3)*log(f*(g + h*x)/(-e*h + f*g))/h**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(2)/(g + h*x), x), x, a*j*x*(-g*j + h*i)/h**S(2) - b*p*q*(i + j*x)**S(2)/(S(4)*h) - b*j*p*q*x*(-g*j + h*i)/h**S(2) + b*p*q*(-g*j + h*i)**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(3) - b*j*p*q*x*(-e*j + f*i)/(S(2)*f*h) + b*j*(e + f*x)*(-g*j + h*i)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(2)) - b*p*q*(-e*j + f*i)**S(2)*log(e + f*x)/(S(2)*f**S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(2)/(S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(2)*log(f*(g + h*x)/(-e*h + f*g))/h**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)/(g + h*x), x), x, a*j*x/h - b*j*p*q*x/h + b*p*q*(-g*j + h*i)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(2) + b*j*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/(f*h) + (a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)*log(f*(g + h*x)/(-e*h + f*g))/h**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x), x), x, b*p*q*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/((g + h*x)*(i + j*x)), x), x, b*p*q*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) - b*p*q*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) + (a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i) - (a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/((g + h*x)*(i + j*x)**S(2)), x), x, -b*f*p*q*log(e + f*x)/((-e*j + f*i)*(-g*j + h*i)) + b*f*p*q*log(i + j*x)/((-e*j + f*i)*(-g*j + h*i)) + b*h*p*q*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - b*h*p*q*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + h*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - h*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + (a + b*log(c*(d*(e + f*x)**p)**q))/((i + j*x)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/((g + h*x)*(i + j*x)**S(3)), x), x, -b*f**S(2)*p*q*log(e + f*x)/(S(2)*(-e*j + f*i)**S(2)*(-g*j + h*i)) + b*f**S(2)*p*q*log(i + j*x)/(S(2)*(-e*j + f*i)**S(2)*(-g*j + h*i)) - b*f*h*p*q*log(e + f*x)/((-e*j + f*i)*(-g*j + h*i)**S(2)) + b*f*h*p*q*log(i + j*x)/((-e*j + f*i)*(-g*j + h*i)**S(2)) - b*f*p*q/(S(2)*(i + j*x)*(-e*j + f*i)*(-g*j + h*i)) + b*h**S(2)*p*q*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - b*h**S(2)*p*q*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) + h*(a + b*log(c*(d*(e + f*x)**p)**q))/((i + j*x)*(-g*j + h*i)**S(2)) + (a/S(2) + b*log(c*(d*(e + f*x)**p)**q)/S(2))/((i + j*x)**S(2)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(i + j*x)**S(3)/(g + h*x), x), x, -S(2)*a*b*j*p*q*x*(-g*j + h*i)**S(2)/h**S(3) - S(2)*a*b*j*p*q*x*(-e*j + f*i)*(-g*j + h*i)/(f*h**S(2)) - S(2)*a*b*j*p*q*x*(-e*j + f*i)**S(2)/(S(3)*f**S(2)*h) + b**S(2)*e*j**S(2)*p**S(2)*q**S(2)*x*(-g*j + h*i)/(S(2)*f*h**S(2)) + S(2)*b**S(2)*p**S(2)*q**S(2)*(i + j*x)**S(3)/(S(27)*h) + b**S(2)*j**S(2)*p**S(2)*q**S(2)*x**S(2)*(-g*j + h*i)/(S(4)*h**S(2)) + S(2)*b**S(2)*j*p**S(2)*q**S(2)*x*(-g*j + h*i)**S(2)/h**S(3) - S(2)*b**S(2)*p**S(2)*q**S(2)*(-g*j + h*i)**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(4) + S(5)*b**S(2)*p**S(2)*q**S(2)*(i + j*x)**S(2)*(-e*j + f*i)/(S(18)*f*h) + S(2)*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)*(-g*j + h*i)/(f*h**S(2)) - S(2)*b**S(2)*j*p*q*(e + f*x)*(-g*j + h*i)**S(2)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(3)) + S(11)*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)**S(2)/(S(9)*f**S(2)*h) - S(2)*b**S(2)*j*p*q*(e + f*x)*(-e*j + f*i)*(-g*j + h*i)*log(c*(d*(e + f*x)**p)**q)/(f**S(2)*h**S(2)) - S(2)*b**S(2)*j*p*q*(e + f*x)*(-e*j + f*i)**S(2)*log(c*(d*(e + f*x)**p)**q)/(S(3)*f**S(3)*h) + S(5)*b**S(2)*p**S(2)*q**S(2)*(-e*j + f*i)**S(3)*log(e + f*x)/(S(9)*f**S(3)*h) - S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(3)/(S(9)*h) + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(4) - b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(i + j*x)**S(2)*(-e*j + f*i)/(S(3)*f*h) - b*j**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-g*j + h*i)/(S(2)*f**S(2)*h**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(i + j*x)**S(3)/(S(3)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)**S(3)*log(f*(g + h*x)/(-e*h + f*g))/h**S(4) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-g*j + h*i)**S(2)/(f*h**S(3)) + j**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)*(-g*j + h*i)/(S(2)*f**S(2)*h**S(2)) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*j + f*i)*(-g*j + h*i)/(f**S(2)*h**S(2)) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-e*j + f*i)**S(3)/(S(3)*f**S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(i + j*x)**S(2)/(g + h*x), x), x, -S(2)*a*b*j*p*q*x*(-g*j + h*i)/h**S(2) - S(2)*a*b*j*p*q*x*(-e*j + f*i)/(f*h) + b**S(2)*e*j**S(2)*p**S(2)*q**S(2)*x/(S(2)*f*h) + b**S(2)*j**S(2)*p**S(2)*q**S(2)*x**S(2)/(S(4)*h) + S(2)*b**S(2)*j*p**S(2)*q**S(2)*x*(-g*j + h*i)/h**S(2) - S(2)*b**S(2)*p**S(2)*q**S(2)*(-g*j + h*i)**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(3) + S(2)*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)/(f*h) - S(2)*b**S(2)*j*p*q*(e + f*x)*(-g*j + h*i)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(2)) - S(2)*b**S(2)*j*p*q*(e + f*x)*(-e*j + f*i)*log(c*(d*(e + f*x)**p)**q)/(f**S(2)*h) + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(3) - b*j**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(2)*f**S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)**S(2)*log(f*(g + h*x)/(-e*h + f*g))/h**S(3) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-g*j + h*i)/(f*h**S(2)) + j**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)/(S(2)*f**S(2)*h) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*j + f*i)/(f**S(2)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(i + j*x)/(g + h*x), x), x, -S(2)*a*b*j*p*q*x/h + S(2)*b**S(2)*j*p**S(2)*q**S(2)*x/h - S(2)*b**S(2)*p**S(2)*q**S(2)*(-g*j + h*i)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(2) - S(2)*b**S(2)*j*p*q*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/(f*h) + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(2) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)*log(f*(g + h*x)/(-e*h + f*g))/h**S(2) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/(f*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(g + h*x), x), x, -S(2)*b**S(2)*p**S(2)*q**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/((g + h*x)*(i + j*x)), x), x, -S(2)*b**S(2)*p**S(2)*q**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) + S(2)*b**S(2)*p**S(2)*q**S(2)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) + S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) - S(2)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/((g + h*x)*(i + j*x)**S(2)), x), x, S(2)*b**S(2)*f*p**S(2)*q**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)) - S(2)*b**S(2)*h*p**S(2)*q**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) + S(2)*b**S(2)*h*p**S(2)*q**S(2)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + S(2)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)) + S(2)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - S(2)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) - j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/((i + j*x)*(-e*j + f*i)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/((g + h*x)*(i + j*x)**S(3)), x), x, b**S(2)*f**S(2)*p**S(2)*q**S(2)*log(e + f*x)/((-e*j + f*i)**S(2)*(-g*j + h*i)) - b**S(2)*f**S(2)*p**S(2)*q**S(2)*log(i + j*x)/((-e*j + f*i)**S(2)*(-g*j + h*i)) + b**S(2)*f**S(2)*p**S(2)*q**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) + S(2)*b**S(2)*f*h*p**S(2)*q**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)**S(2)) - S(2)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) + S(2)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) + b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) + S(2)*b*f*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)**S(2)) - b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))/((i + j*x)*(-e*j + f*i)*(-g*j + h*i)) + S(2)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - S(2)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) - f**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*(-e*j + f*i)**S(2)*(-g*j + h*i)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) - h*j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/((i + j*x)*(-e*j + f*i)*(-g*j + h*i)**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(2)/(S(2)*(i + j*x)**S(2)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(i + j*x)**S(3)/(g + h*x), x), x, S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x*(-g*j + h*i)**S(2)/h**S(3) + S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)*(-g*j + h*i)/(f*h**S(2)) + S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)**S(2)/(f**S(2)*h) - S(3)*b**S(3)*e*j**S(2)*p**S(3)*q**S(3)*x*(-g*j + h*i)/(S(4)*f*h**S(2)) - S(3)*b**S(3)*e*j**S(2)*p**S(3)*q**S(3)*x*(-e*j + f*i)/(S(2)*f**S(2)*h) - S(3)*b**S(3)*j**S(2)*p**S(3)*q**S(3)*x**S(2)*(-g*j + h*i)/(S(8)*h**S(2)) - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x*(-g*j + h*i)**S(2)/h**S(3) + S(6)*b**S(3)*p**S(3)*q**S(3)*(-g*j + h*i)**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h**S(4) - S(3)*b**S(3)*j**S(2)*p**S(3)*q**S(3)*x**S(2)*(-e*j + f*i)/(S(4)*f*h) - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x*(-e*j + f*i)*(-g*j + h*i)/(f*h**S(2)) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*(-g*j + h*i)**S(2)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(3)) - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x*(-e*j + f*i)**S(2)/(f**S(2)*h) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*(-e*j + f*i)*(-g*j + h*i)*log(c*(d*(e + f*x)**p)**q)/(f**S(2)*h**S(2)) - S(2)*b**S(3)*j**S(3)*p**S(3)*q**S(3)*(e + f*x)**S(3)/(S(27)*f**S(3)*h) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*(-e*j + f*i)**S(2)*log(c*(d*(e + f*x)**p)**q)/(f**S(3)*h) - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(3)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(4) + S(3)*b**S(2)*j**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-g*j + h*i)/(S(4)*f**S(2)*h**S(2)) + S(2)*b**S(2)*j**S(3)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(3)/(S(9)*f**S(3)*h) + S(3)*b**S(2)*j**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)*(-e*j + f*i)/(S(2)*f**S(3)*h) + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)**S(3)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(4) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-g*j + h*i)**S(2)/(f*h**S(3)) - S(3)*b*j**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)*(-g*j + h*i)/(S(4)*f**S(2)*h**S(2)) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*j + f*i)*(-g*j + h*i)/(f**S(2)*h**S(2)) - b*j**S(3)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(3)/(S(3)*f**S(3)*h) - S(3)*b*j**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)*(-e*j + f*i)/(S(2)*f**S(3)*h) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*j + f*i)**S(2)/(f**S(3)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(-g*j + h*i)**S(3)*log(f*(g + h*x)/(-e*h + f*g))/h**S(4) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-g*j + h*i)**S(2)/(f*h**S(3)) + j**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)*(-g*j + h*i)/(S(2)*f**S(2)*h**S(2)) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*j + f*i)*(-g*j + h*i)/(f**S(2)*h**S(2)) + j**S(3)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(3)/(S(3)*f**S(3)*h) + j**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)*(-e*j + f*i)/(f**S(3)*h) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*j + f*i)**S(2)/(f**S(3)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(i + j*x)**S(2)/(g + h*x), x), x, S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x*(-g*j + h*i)/h**S(2) + S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x*(-e*j + f*i)/(f*h) - S(3)*b**S(3)*e*j**S(2)*p**S(3)*q**S(3)*x/(S(4)*f*h) - S(3)*b**S(3)*j**S(2)*p**S(3)*q**S(3)*x**S(2)/(S(8)*h) - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x*(-g*j + h*i)/h**S(2) + S(6)*b**S(3)*p**S(3)*q**S(3)*(-g*j + h*i)**S(2)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h**S(3) - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x*(-e*j + f*i)/(f*h) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*(-g*j + h*i)*log(c*(d*(e + f*x)**p)**q)/(f*h**S(2)) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*(-e*j + f*i)*log(c*(d*(e + f*x)**p)**q)/(f**S(2)*h) - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)**S(2)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(3) + S(3)*b**S(2)*j**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(e + f*x)**S(2)/(S(4)*f**S(2)*h) + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(3) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-g*j + h*i)/(f*h**S(2)) - S(3)*b*j**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)**S(2)/(S(4)*f**S(2)*h) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)*(-e*j + f*i)/(f**S(2)*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(-g*j + h*i)**S(2)*log(f*(g + h*x)/(-e*h + f*g))/h**S(3) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-g*j + h*i)/(f*h**S(2)) + j**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)**S(2)/(S(2)*f**S(2)*h) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)*(-e*j + f*i)/(f**S(2)*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(i + j*x)/(g + h*x), x), x, S(6)*a*b**S(2)*j*p**S(2)*q**S(2)*x/h - S(6)*b**S(3)*j*p**S(3)*q**S(3)*x/h + S(6)*b**S(3)*p**S(3)*q**S(3)*(-g*j + h*i)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h**S(2) + S(6)*b**S(3)*j*p**S(2)*q**S(2)*(e + f*x)*log(c*(d*(e + f*x)**p)**q)/(f*h) - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*(-g*j + h*i)*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h**S(2) + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(-g*j + h*i)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h**S(2) - S(3)*b*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/(f*h) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(-g*j + h*i)*log(f*(g + h*x)/(-e*h + f*g))/h**S(2) + j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/(f*h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(g + h*x), x), x, S(6)*b**S(3)*p**S(3)*q**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/h - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/h + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/h + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/((g + h*x)*(i + j*x)), x), x, S(6)*b**S(3)*p**S(3)*q**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) - S(6)*b**S(3)*p**S(3)*q**S(3)*polylog(S(4), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) - S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) + S(6)*b**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) + S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i) - S(3)*b*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i) - (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/((g + h*x)*(i + j*x)**S(2)), x), x, -S(6)*b**S(3)*f*p**S(3)*q**S(3)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)) + S(6)*b**S(3)*h*p**S(3)*q**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - S(6)*b**S(3)*h*p**S(3)*q**S(3)*polylog(S(4), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + S(6)*b**S(2)*f*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)) - S(6)*b**S(2)*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) + S(6)*b**S(2)*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + S(3)*b*f*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)) + S(3)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - S(3)*b*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) + h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(2) - h*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(2) - j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/((i + j*x)*(-e*j + f*i)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/((g + h*x)*(i + j*x)**S(3)), x), x, -S(3)*b**S(3)*f**S(2)*p**S(3)*q**S(3)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) - S(3)*b**S(3)*f**S(2)*p**S(3)*q**S(3)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) - S(6)*b**S(3)*f*h*p**S(3)*q**S(3)*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)**S(2)) + S(6)*b**S(3)*h**S(2)*p**S(3)*q**S(3)*polylog(S(4), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - S(6)*b**S(3)*h**S(2)*p**S(3)*q**S(3)*polylog(S(4), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) - S(3)*b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) + S(3)*b**S(2)*f**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)**S(2)*(-g*j + h*i)) + S(6)*b**S(2)*f*h*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)**S(2)) - S(6)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) + S(6)*b**S(2)*h**S(2)*p**S(2)*q**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))*polylog(S(3), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) + S(3)*b*f**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/(S(2)*(-e*j + f*i)**S(2)*(-g*j + h*i)) + S(3)*b*f*h*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*log(f*(i + j*x)/(-e*j + f*i))/((-e*j + f*i)*(-g*j + h*i)**S(2)) + S(3)*b*f*j*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(e + f*x)/(S(2)*(i + j*x)*(-e*j + f*i)**S(2)*(-g*j + h*i)) + S(3)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -h*(e + f*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - S(3)*b*h**S(2)*p*q*(a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*polylog(S(2), -j*(e + f*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) - f**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(2)*(-e*j + f*i)**S(2)*(-g*j + h*i)) + h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(g + h*x)/(-e*h + f*g))/(-g*j + h*i)**S(3) - h**S(2)*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*log(f*(i + j*x)/(-e*j + f*i))/(-g*j + h*i)**S(3) - h*j*(a + b*log(c*(d*(e + f*x)**p)**q))**S(3)*(e + f*x)/((i + j*x)*(-e*j + f*i)*(-g*j + h*i)**S(2)) + (a + b*log(c*(d*(e + f*x)**p)**q))**S(3)/(S(2)*(i + j*x)**S(2)*(-g*j + h*i)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), x, Integral((i + j*x)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)*(i + j*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)*(i + j*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)*(i + j*x)**S(2)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))*(g + h*x)*(i + j*x)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((i + j*x)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), x, Integral((i + j*x)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)*(i + j*x)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)*(i + j*x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)*(i + j*x)**S(2)), x), x, Integral(S(1)/((a + b*log(c*(d*(e + f*x)**p)**q))**S(2)*(g + h*x)*(i + j*x)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(g + h*x**S(2)), x), x, -b*p*q*polylog(S(2), sqrt(h)*(-e - f*x)/(-e*sqrt(h) + f*sqrt(-g)))/(S(2)*sqrt(h)*sqrt(-g)) + b*p*q*polylog(S(2), sqrt(h)*(e + f*x)/(e*sqrt(h) + f*sqrt(-g)))/(S(2)*sqrt(h)*sqrt(-g)) - (a/S(2) + b*log(c*(d*(e + f*x)**p)**q)/S(2))*log(f*(sqrt(h)*x + sqrt(-g))/(-e*sqrt(h) + f*sqrt(-g)))/(sqrt(h)*sqrt(-g)) + (a/S(2) + b*log(c*(d*(e + f*x)**p)**q)/S(2))*log(f*(-sqrt(h)*x + sqrt(-g))/(e*sqrt(h) + f*sqrt(-g)))/(sqrt(h)*sqrt(-g)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/sqrt(h*x**S(2) + S(2)), x), x, -b*p*q*log(sqrt(S(2))*f*exp(asinh(sqrt(S(2))*sqrt(h)*x/S(2)))/(e*sqrt(h) - sqrt(e**S(2)*h + S(2)*f**S(2))) + S(1))*asinh(sqrt(S(2))*sqrt(h)*x/S(2))/sqrt(h) - b*p*q*log(sqrt(S(2))*f*exp(asinh(sqrt(S(2))*sqrt(h)*x/S(2)))/(e*sqrt(h) + sqrt(e**S(2)*h + S(2)*f**S(2))) + S(1))*asinh(sqrt(S(2))*sqrt(h)*x/S(2))/sqrt(h) + b*p*q*asinh(sqrt(S(2))*sqrt(h)*x/S(2))**S(2)/(S(2)*sqrt(h)) - b*p*q*polylog(S(2), -sqrt(S(2))*f*exp(asinh(sqrt(S(2))*sqrt(h)*x/S(2)))/(e*sqrt(h) - sqrt(e**S(2)*h + S(2)*f**S(2))))/sqrt(h) - b*p*q*polylog(S(2), -sqrt(S(2))*f*exp(asinh(sqrt(S(2))*sqrt(h)*x/S(2)))/(e*sqrt(h) + sqrt(e**S(2)*h + S(2)*f**S(2))))/sqrt(h) + (a + b*log(c*(d*(e + f*x)**p)**q))*asinh(sqrt(S(2))*sqrt(h)*x/S(2))/sqrt(h), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/sqrt(g + h*x**S(2)), x), x, -b*sqrt(g)*p*q*sqrt(S(1) + h*x**S(2)/g)*log(f*sqrt(g)*exp(asinh(sqrt(h)*x/sqrt(g)))/(e*sqrt(h) - sqrt(e**S(2)*h + f**S(2)*g)) + S(1))*asinh(sqrt(h)*x/sqrt(g))/(sqrt(h)*sqrt(g + h*x**S(2))) - b*sqrt(g)*p*q*sqrt(S(1) + h*x**S(2)/g)*log(f*sqrt(g)*exp(asinh(sqrt(h)*x/sqrt(g)))/(e*sqrt(h) + sqrt(e**S(2)*h + f**S(2)*g)) + S(1))*asinh(sqrt(h)*x/sqrt(g))/(sqrt(h)*sqrt(g + h*x**S(2))) + b*sqrt(g)*p*q*sqrt(S(1) + h*x**S(2)/g)*asinh(sqrt(h)*x/sqrt(g))**S(2)/(S(2)*sqrt(h)*sqrt(g + h*x**S(2))) - b*sqrt(g)*p*q*sqrt(S(1) + h*x**S(2)/g)*polylog(S(2), -f*sqrt(g)*exp(asinh(sqrt(h)*x/sqrt(g)))/(e*sqrt(h) - sqrt(e**S(2)*h + f**S(2)*g)))/(sqrt(h)*sqrt(g + h*x**S(2))) - b*sqrt(g)*p*q*sqrt(S(1) + h*x**S(2)/g)*polylog(S(2), -f*sqrt(g)*exp(asinh(sqrt(h)*x/sqrt(g)))/(e*sqrt(h) + sqrt(e**S(2)*h + f**S(2)*g)))/(sqrt(h)*sqrt(g + h*x**S(2))) + sqrt(g)*sqrt(S(1) + h*x**S(2)/g)*(a + b*log(c*(d*(e + f*x)**p)**q))*asinh(sqrt(h)*x/sqrt(g))/(sqrt(h)*sqrt(g + h*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(-h*x + S(2))*sqrt(h*x + S(2))), x), x, -b*p*q*log(S(2)*f*exp(I*asin(h*x/S(2)))/(I*e*h - sqrt(-e**S(2)*h**S(2) + S(4)*f**S(2))) + S(1))*asin(h*x/S(2))/h - b*p*q*log(S(2)*f*exp(I*asin(h*x/S(2)))/(I*e*h + sqrt(-e**S(2)*h**S(2) + S(4)*f**S(2))) + S(1))*asin(h*x/S(2))/h + I*b*p*q*asin(h*x/S(2))**S(2)/(S(2)*h) + I*b*p*q*polylog(S(2), -S(2)*f*exp(I*asin(h*x/S(2)))/(I*e*h - sqrt(-e**S(2)*h**S(2) + S(4)*f**S(2))))/h + I*b*p*q*polylog(S(2), -S(2)*f*exp(I*asin(h*x/S(2)))/(I*e*h + sqrt(-e**S(2)*h**S(2) + S(4)*f**S(2))))/h + (a + b*log(c*(d*(e + f*x)**p)**q))*asin(h*x/S(2))/h, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d*(e + f*x)**p)**q))/(sqrt(g - h*x)*sqrt(g + h*x)), x), x, -b*g*p*q*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*log(f*g*exp(I*asin(h*x/g))/(I*e*h - sqrt(-e**S(2)*h**S(2) + f**S(2)*g**S(2))) + S(1))*asin(h*x/g)/(h*sqrt(g - h*x)*sqrt(g + h*x)) - b*g*p*q*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*log(f*g*exp(I*asin(h*x/g))/(I*e*h + sqrt(-e**S(2)*h**S(2) + f**S(2)*g**S(2))) + S(1))*asin(h*x/g)/(h*sqrt(g - h*x)*sqrt(g + h*x)) + I*b*g*p*q*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*asin(h*x/g)**S(2)/(S(2)*h*sqrt(g - h*x)*sqrt(g + h*x)) + I*b*g*p*q*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*polylog(S(2), -f*g*exp(I*asin(h*x/g))/(I*e*h - sqrt(-e**S(2)*h**S(2) + f**S(2)*g**S(2))))/(h*sqrt(g - h*x)*sqrt(g + h*x)) + I*b*g*p*q*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*polylog(S(2), -f*g*exp(I*asin(h*x/g))/(I*e*h + sqrt(-e**S(2)*h**S(2) + f**S(2)*g**S(2))))/(h*sqrt(g - h*x)*sqrt(g + h*x)) + g*sqrt(S(1) - h**S(2)*x**S(2)/g**S(2))*(a + b*log(c*(d*(e + f*x)**p)**q))*asin(h*x/g)/(h*sqrt(g - h*x)*sqrt(g + h*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(2)*e/(e + f*x))/(e**S(2) - f**S(2)*x**S(2)), x), x, polylog(S(2), (-e + f*x)/(e + f*x))/(S(2)*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(S(2)*e/(e + f*x)))/(e**S(2) - f**S(2)*x**S(2)), x), x, a*atanh(f*x/e)/(e*f) + b*polylog(S(2), (-e + f*x)/(e + f*x))/(S(2)*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e/(e + f*x))/(e**S(2) - f**S(2)*x**S(2)), x), x, -log(S(2))*atanh(f*x/e)/(e*f) + polylog(S(2), (-e + f*x)/(e + f*x))/(S(2)*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(e/(e + f*x)))/(e**S(2) - f**S(2)*x**S(2)), x), x, b*polylog(S(2), (-e + f*x)/(e + f*x))/(S(2)*e*f) + (a - b*log(S(2)))*atanh(f*x/e)/(e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x)/(c + d/x**S(2)), x), x, -sqrt(d)*log(b*(sqrt(d) - x*sqrt(-c))/(a*sqrt(-c) + b*sqrt(d)))*log(a + b*x)/(S(2)*(-c)**(S(3)/2)) + sqrt(d)*log(-b*(sqrt(d) + x*sqrt(-c))/(a*sqrt(-c) - b*sqrt(d)))*log(a + b*x)/(S(2)*(-c)**(S(3)/2)) + sqrt(d)*polylog(S(2), sqrt(-c)*(a + b*x)/(a*sqrt(-c) - b*sqrt(d)))/(S(2)*(-c)**(S(3)/2)) - sqrt(d)*polylog(S(2), sqrt(-c)*(a + b*x)/(a*sqrt(-c) + b*sqrt(d)))/(S(2)*(-c)**(S(3)/2)) - x/c + (a + b*x)*log(a + b*x)/(b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(3)/(d + e*x**S(2)), x), x, -S(3)*n**S(3)*polylog(S(4), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) + S(3)*n**S(3)*polylog(S(4), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) + S(3)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) - S(3)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) - S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) + S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) - log(c*(a + b*x)**n)**S(3)*log(b*(sqrt(e)*x + sqrt(-d))/(-a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) + log(c*(a + b*x)**n)**S(3)*log(b*(-sqrt(e)*x + sqrt(-d))/(a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(2)/(d + e*x**S(2)), x), x, n**S(2)*polylog(S(3), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) - n**S(2)*polylog(S(3), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) - n*log(c*(a + b*x)**n)*polylog(S(2), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) + n*log(c*(a + b*x)**n)*polylog(S(2), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(sqrt(e)*sqrt(-d)) - log(c*(a + b*x)**n)**S(2)*log(b*(sqrt(e)*x + sqrt(-d))/(-a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) + log(c*(a + b*x)**n)**S(2)*log(b*(-sqrt(e)*x + sqrt(-d))/(a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)/(d + e*x**S(2)), x), x, -n*polylog(S(2), sqrt(e)*(-a - b*x)/(-a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) + n*polylog(S(2), sqrt(e)*(a + b*x)/(a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) - log(c*(a + b*x)**n)*log(b*(sqrt(e)*x + sqrt(-d))/(-a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)) + log(c*(a + b*x)**n)*log(b*(-sqrt(e)*x + sqrt(-d))/(a*sqrt(e) + b*sqrt(-d)))/(S(2)*sqrt(e)*sqrt(-d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*log(c*(a + b*x)**n)), x), x, Integral(S(1)/((d + e*x**S(2))*log(c*(a + b*x)**n)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*log(c + d*x)/(a + b*x**S(2)), x), x, a**S(2)*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*b**S(3)) + a**S(2)*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*b**S(3)) + a**S(2)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*b**S(3)) + a**S(2)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*b**S(3)) + a*c**S(2)*log(c + d*x)/(S(2)*b**S(2)*d**S(2)) - a*c*x/(S(2)*b**S(2)*d) - a*x**S(2)*log(c + d*x)/(S(2)*b**S(2)) + a*x**S(2)/(S(4)*b**S(2)) - c**S(4)*log(c + d*x)/(S(4)*b*d**S(4)) + c**S(3)*x/(S(4)*b*d**S(3)) - c**S(2)*x**S(2)/(S(8)*b*d**S(2)) + c*x**S(3)/(S(12)*b*d) + x**S(4)*log(c + d*x)/(S(4)*b) - x**S(4)/(S(16)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c + d*x)/(a + b*x**S(2)), x), x, a*x/b**S(2) - a*(c + d*x)*log(c + d*x)/(b**S(2)*d) + c**S(3)*log(c + d*x)/(S(3)*b*d**S(3)) - c**S(2)*x/(S(3)*b*d**S(2)) + c*x**S(2)/(S(6)*b*d) + x**S(3)*log(c + d*x)/(S(3)*b) - x**S(3)/(S(9)*b) - (-a)**(S(3)/2)*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*b**(S(5)/2)) + (-a)**(S(3)/2)*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*b**(S(5)/2)) - (-a)**(S(3)/2)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*b**(S(5)/2)) + (-a)**(S(3)/2)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c + d*x)/(a + b*x**S(2)), x), x, -a*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*b**S(2)) - a*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*b**S(2)) - a*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*b**S(2)) - a*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*b**S(2)) - c**S(2)*log(c + d*x)/(S(2)*b*d**S(2)) + c*x/(S(2)*b*d) + x**S(2)*log(c + d*x)/(S(2)*b) - x**S(2)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c + d*x)/(a + b*x**S(2)), x), x, -x/b + (c + d*x)*log(c + d*x)/(b*d) - sqrt(-a)*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*b**(S(3)/2)) + sqrt(-a)*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*b**(S(3)/2)) - sqrt(-a)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*b**(S(3)/2)) + sqrt(-a)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c + d*x)/(a + b*x**S(2)), x), x, log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*b) + log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*b) + polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*b) + polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(a + b*x**S(2)), x), x, -log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*sqrt(b)*sqrt(-a)) + log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*sqrt(b)*sqrt(-a)) - polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*sqrt(b)*sqrt(-a)) + polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*sqrt(b)*sqrt(-a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x*(a + b*x**S(2))), x), x, log(-d*x/c)*log(c + d*x)/a - log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*a) - log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*a) + polylog(S(2), (c + d*x)/c)/a - polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*a) - polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(2)*(a + b*x**S(2))), x), x, -sqrt(b)*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*(-a)**(S(3)/2)) + sqrt(b)*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*(-a)**(S(3)/2)) - sqrt(b)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*(-a)**(S(3)/2)) + sqrt(b)*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*(-a)**(S(3)/2)) - log(c + d*x)/(a*x) + d*log(x)/(a*c) - d*log(c + d*x)/(a*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(3)*(a + b*x**S(2))), x), x, -log(c + d*x)/(S(2)*a*x**S(2)) - d/(S(2)*a*c*x) - d**S(2)*log(x)/(S(2)*a*c**S(2)) + d**S(2)*log(c + d*x)/(S(2)*a*c**S(2)) - b*log(-d*x/c)*log(c + d*x)/a**S(2) + b*log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/(S(2)*a**S(2)) + b*log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/(S(2)*a**S(2)) - b*polylog(S(2), (c + d*x)/c)/a**S(2) + b*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/(S(2)*a**S(2)) + b*polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*log(c + d*x)/(a + b*x**S(3)), x), x, -a*log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**S(2)) - a*log(-d*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**S(2)) - a*log((S(-1))**(S(1)/3)*d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**S(2)) - a*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**S(2)) - a*polylog(S(2), b**(S(1)/3)*(c + d*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**S(2)) - a*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**S(2)) + c**S(3)*log(c + d*x)/(S(3)*b*d**S(3)) - c**S(2)*x/(S(3)*b*d**S(2)) + c*x**S(2)/(S(6)*b*d) + x**S(3)*log(c + d*x)/(S(3)*b) - x**S(3)/(S(9)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c + d*x)/(a + b*x**S(3)), x), x, a**(S(2)/3)*log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(5)/3)) - (S(-1))**(S(1)/3)*a**(S(2)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(5)/3)) + (S(-1))**(S(2)/3)*a**(S(2)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(5)/3)) + a**(S(2)/3)*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**(S(5)/3)) - (S(-1))**(S(1)/3)*a**(S(2)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*b**(S(5)/3)) + (S(-1))**(S(2)/3)*a**(S(2)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*b**(S(5)/3)) - c**S(2)*log(c + d*x)/(S(2)*b*d**S(2)) + c*x/(S(2)*b*d) + x**S(2)*log(c + d*x)/(S(2)*b) - x**S(2)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c + d*x)/(a + b*x**S(3)), x), x, -a**(S(1)/3)*log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(4)/3)) - (S(-1))**(S(2)/3)*a**(S(1)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(4)/3)) + (S(-1))**(S(1)/3)*a**(S(1)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b**(S(4)/3)) - a**(S(1)/3)*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**(S(4)/3)) - (S(-1))**(S(2)/3)*a**(S(1)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*b**(S(4)/3)) + (S(-1))**(S(1)/3)*a**(S(1)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*b**(S(4)/3)) - x/b + (c + d*x)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c + d*x)/(a + b*x**S(3)), x), x, log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b) + log(-d*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b) + log((S(-1))**(S(1)/3)*d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*b) + polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b) + polylog(S(2), b**(S(1)/3)*(c + d*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b) + polylog(S(2), b**(S(1)/3)*(c + d*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c + d*x)/(a + b*x**S(3)), x), x, -log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(1)/3)*b**(S(2)/3)) + (S(-1))**(S(1)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(1)/3)*b**(S(2)/3)) - (S(-1))**(S(2)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(1)/3)*b**(S(2)/3)) - polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a**(S(1)/3)*b**(S(2)/3)) + (S(-1))**(S(1)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(1)/3)*b**(S(2)/3)) - (S(-1))**(S(2)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(1)/3)*b**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(a + b*x**S(3)), x), x, log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(2)/3)*b**(S(1)/3)) + (S(-1))**(S(2)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(2)/3)*b**(S(1)/3)) - (S(-1))**(S(1)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(2)/3)*b**(S(1)/3)) + polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a**(S(2)/3)*b**(S(1)/3)) + (S(-1))**(S(2)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(2)/3)*b**(S(1)/3)) - (S(-1))**(S(1)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(2)/3)*b**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x*(a + b*x**S(3))), x), x, log(-d*x/c)*log(c + d*x)/a - log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a) - log(-d*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a) - log((S(-1))**(S(1)/3)*d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a) + polylog(S(2), (c + d*x)/c)/a - polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a) - polylog(S(2), b**(S(1)/3)*(c + d*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a) - polylog(S(2), b**(S(1)/3)*(c + d*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(2)*(a + b*x**S(3))), x), x, -log(c + d*x)/(a*x) + d*log(x)/(a*c) - d*log(c + d*x)/(a*c) + b**(S(1)/3)*log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(4)/3)) - (S(-1))**(S(1)/3)*b**(S(1)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(4)/3)) + (S(-1))**(S(2)/3)*b**(S(1)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(4)/3)) + b**(S(1)/3)*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a**(S(4)/3)) - (S(-1))**(S(1)/3)*b**(S(1)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(4)/3)) + (S(-1))**(S(2)/3)*b**(S(1)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(3)*(a + b*x**S(3))), x), x, -log(c + d*x)/(S(2)*a*x**S(2)) - d/(S(2)*a*c*x) - d**S(2)*log(x)/(S(2)*a*c**S(2)) + d**S(2)*log(c + d*x)/(S(2)*a*c**S(2)) - b**(S(2)/3)*log(-d*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(5)/3)) - (S(-1))**(S(2)/3)*b**(S(2)/3)*log(d*(a**(S(1)/3) - (S(-1))**(S(1)/3)*b**(S(1)/3)*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(5)/3)) + (S(-1))**(S(1)/3)*b**(S(2)/3)*log(-d*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))*log(c + d*x)/(S(3)*a**(S(5)/3)) - b**(S(2)/3)*polylog(S(2), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*a**(S(5)/3)) - (S(-1))**(S(2)/3)*b**(S(2)/3)*polylog(S(2), (S(-1))**(S(1)/3)*b**(S(1)/3)*(c + d*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(5)/3)) + (S(-1))**(S(1)/3)*b**(S(2)/3)*polylog(S(2), (S(-1))**(S(2)/3)*b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + (S(-1))**(S(2)/3)*b**(S(1)/3)*c))/(S(3)*a**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c + d*x)/(a + b*x**S(4)), x), x, -x/b + (c + d*x)*log(c + d*x)/(b*d) - (-a)**(S(1)/4)*log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(5)/4)) + (-a)**(S(1)/4)*log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(5)/4)) - (-a)**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b**(S(5)/4)) + (-a)**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b**(S(5)/4)) - sqrt(-sqrt(-a))*log(-d*(b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(5)/4)) + sqrt(-sqrt(-a))*log(d*(-b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(5)/4)) - sqrt(-sqrt(-a))*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))/(S(4)*b**(S(5)/4)) + sqrt(-sqrt(-a))*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))/(S(4)*b**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c + d*x)/(a + b*x**S(4)), x), x, log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b) + log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b) + log(-d*(b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b) + log(d*(-b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*b) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c + d*x)/(a + b*x**S(4)), x), x, -log(-d*(b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(3)/4)*sqrt(-sqrt(-a))) + log(d*(-b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(3)/4)*sqrt(-sqrt(-a))) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))/(S(4)*b**(S(3)/4)*sqrt(-sqrt(-a))) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))/(S(4)*b**(S(3)/4)*sqrt(-sqrt(-a))) - log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(3)/4)*(-a)**(S(1)/4)) + log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(3)/4)*(-a)**(S(1)/4)) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(-a)**(S(1)/4)) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(-a)**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c + d*x)/(a + b*x**S(4)), x), x, log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*sqrt(b)*sqrt(-a)) + log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*sqrt(b)*sqrt(-a)) - log(-d*(b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*sqrt(b)*sqrt(-a)) - log(d*(-b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*sqrt(b)*sqrt(-a)) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*sqrt(b)*sqrt(-a)) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*sqrt(b)*sqrt(-a)) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*sqrt(b)*sqrt(-a)) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*sqrt(b)*sqrt(-a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(a + b*x**S(4)), x), x, -log(-d*(b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(1)/4)*(-sqrt(-a))**(S(3)/2)) + log(d*(-b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*b**(S(1)/4)*(-sqrt(-a))**(S(3)/2)) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))/(S(4)*b**(S(1)/4)*(-sqrt(-a))**(S(3)/2)) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))/(S(4)*b**(S(1)/4)*(-sqrt(-a))**(S(3)/2)) - log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(1)/4)*(-a)**(S(3)/4)) + log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*b**(S(1)/4)*(-a)**(S(3)/4)) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b**(S(1)/4)*(-a)**(S(3)/4)) + polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b**(S(1)/4)*(-a)**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x*(a + b*x**S(4))), x), x, log(-d*x/c)*log(c + d*x)/a - log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*a) - log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*a) - log(-d*(b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*a) - log(d*(-b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*a) + polylog(S(2), (c + d*x)/c)/a - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*a) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*a) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*a) - polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(2)*(a + b*x**S(4))), x), x, -b**(S(1)/4)*log(-d*(b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*(-sqrt(-a))**(S(5)/2)) + b**(S(1)/4)*log(d*(-b**(S(1)/4)*x + sqrt(-sqrt(-a)))/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))*log(c + d*x)/(S(4)*(-sqrt(-a))**(S(5)/2)) - b**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*sqrt(-sqrt(-a))))/(S(4)*(-sqrt(-a))**(S(5)/2)) + b**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*sqrt(-sqrt(-a))))/(S(4)*(-sqrt(-a))**(S(5)/2)) - b**(S(1)/4)*log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(5)/4)) + b**(S(1)/4)*log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(5)/4)) - b**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(5)/4)) + b**(S(1)/4)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(5)/4)) - log(c + d*x)/(a*x) + d*log(x)/(a*c) - d*log(c + d*x)/(a*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c + d*x)/(x**S(3)*(a + b*x**S(4))), x), x, sqrt(b)*log(-d*(b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(3)/2)) + sqrt(b)*log(d*(-b**(S(1)/4)*x + (-a)**(S(1)/4))/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(3)/2)) - sqrt(b)*log(-d*(b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(3)/2)) - sqrt(b)*log(d*(-b**(S(1)/4)*x + I*(-a)**(S(1)/4))/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))*log(c + d*x)/(S(4)*(-a)**(S(3)/2)) + sqrt(b)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(3)/2)) + sqrt(b)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(3)/2)) - sqrt(b)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(3)/2)) - sqrt(b)*polylog(S(2), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*(-a)**(S(3)/2)) - log(c + d*x)/(S(2)*a*x**S(2)) - d/(S(2)*a*c*x) - d**S(2)*log(x)/(S(2)*a*c**S(2)) + d**S(2)*log(c + d*x)/(S(2)*a*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(3)/(d*x + e*x**S(2)), x), x, S(6)*n**S(3)*polylog(S(4), (a + b*x)/a)/d - S(6)*n**S(3)*polylog(S(4), -e*(a + b*x)/(-a*e + b*d))/d - S(6)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), (a + b*x)/a)/d + S(6)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), -e*(a + b*x)/(-a*e + b*d))/d + S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), (a + b*x)/a)/d - S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d + log(c*(a + b*x)**n)**S(3)*log(-b*x/a)/d - log(c*(a + b*x)**n)**S(3)*log(b*(d + e*x)/(-a*e + b*d))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(2)/(d*x + e*x**S(2)), x), x, -S(2)*n**S(2)*polylog(S(3), (a + b*x)/a)/d + S(2)*n**S(2)*polylog(S(3), -e*(a + b*x)/(-a*e + b*d))/d + S(2)*n*log(c*(a + b*x)**n)*polylog(S(2), (a + b*x)/a)/d - S(2)*n*log(c*(a + b*x)**n)*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d + log(c*(a + b*x)**n)**S(2)*log(-b*x/a)/d - log(c*(a + b*x)**n)**S(2)*log(b*(d + e*x)/(-a*e + b*d))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)/(d*x + e*x**S(2)), x), x, n*polylog(S(2), (a + b*x)/a)/d - n*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d + log(c*(a + b*x)**n)*log(-b*x/a)/d - log(c*(a + b*x)**n)*log(b*(d + e*x)/(-a*e + b*d))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x + e*x**S(2))*log(c*(a + b*x)**n)), x), x, Integral(S(1)/(x*(d + e*x)*log(c*(a + b*x)**n)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(3)/(d + e*x + f*x**S(2)), x), x, S(6)*n**S(3)*polylog(S(4), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - S(6)*n**S(3)*polylog(S(4), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - S(6)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + S(6)*n**S(2)*log(c*(a + b*x)**n)*polylog(S(3), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - S(3)*n*log(c*(a + b*x)**n)**S(2)*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + log(c*(a + b*x)**n)**S(3)*log(-b*(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - log(c*(a + b*x)**n)**S(3)*log(-b*(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)**S(2)/(d + e*x + f*x**S(2)), x), x, -S(2)*n**S(2)*polylog(S(3), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + S(2)*n**S(2)*polylog(S(3), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + S(2)*n*log(c*(a + b*x)**n)*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - S(2)*n*log(c*(a + b*x)**n)*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + log(c*(a + b*x)**n)**S(2)*log(-b*(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - log(c*(a + b*x)**n)**S(2)*log(-b*(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**n)/(d + e*x + f*x**S(2)), x), x, n*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - n*polylog(S(2), S(2)*f*(a + b*x)/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + log(c*(a + b*x)**n)*log(-b*(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e - sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - log(c*(a + b*x)**n)*log(-b*(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(S(2)*a*f - b*(e + sqrt(-S(4)*d*f + e**S(2)))))/sqrt(-S(4)*d*f + e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x + f*x**S(2))*log(c*(a + b*x)**n)), x), x, Integral(S(1)/((d + e*x + f*x**S(2))*log(c*(a + b*x)**n)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(x)/(a + b*x + c*x**S(2)), x), x, -b*x*log(x)/c**S(2) + b*x/c**S(2) + x**S(2)*log(x)/(S(2)*c) - x**S(2)/(S(4)*c) + (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(3)) + (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(3)) + (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(3)) + (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(x)/(a + b*x + c*x**S(2)), x), x, x*log(x)/c - x/c - (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(2)) - (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(2)) - (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(2)) - (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(x)/(a + b*x + c*x**S(2)), x), x, (-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c) + (-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c) + (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c) + (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(a + b*x + c*x**S(2)), x), x, log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/sqrt(-S(4)*a*c + b**S(2)) - log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/sqrt(-S(4)*a*c + b**S(2)) + polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/sqrt(-S(4)*a*c + b**S(2)) - polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x*(a + b*x + c*x**S(2))), x), x, -(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a) - (-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a) - (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a) - (b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a) + log(x)**S(2)/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x**S(2)*(a + b*x + c*x**S(2))), x), x, -log(x)/(a*x) - S(1)/(a*x) - b*log(x)**S(2)/(S(2)*a**S(2)) + (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)) + (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)) + (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)) + (b + (S(2)*a*c - b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x**S(3)*(a + b*x + c*x**S(2))), x), x, -log(x)/(S(2)*a*x**S(2)) - S(1)/(S(4)*a*x**S(2)) + b*log(x)/(a**S(2)*x) + b/(a**S(2)*x) + (-a*c/S(2) + b**S(2)/S(2))*log(x)**S(2)/a**S(3) - (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(3)) - (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(3)) - (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(3)) - (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e/(f + g*x))**p))**S(4), x), x, -S(24)*b**S(4)*e*p**S(4)*polylog(S(4), (d + e/(f + g*x))/d)/(d*g) + S(24)*b**S(3)*e*p**S(3)*(a + b*log(c*(d + e/(f + g*x))**p))*polylog(S(3), (d + e/(f + g*x))/d)/(d*g) - S(12)*b**S(2)*e*p**S(2)*(a + b*log(c*(d + e/(f + g*x))**p))**S(2)*polylog(S(2), (d + e/(f + g*x))/d)/(d*g) - S(4)*b*e*p*(a + b*log(c*(d + e/(f + g*x))**p))**S(3)*log(-e/(d*(f + g*x)))/(d*g) + (a + b*log(c*(d + e/(f + g*x))**p))**S(4)*(d*(f + g*x) + e)/(d*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e/(f + g*x))**p))**S(3), x), x, S(6)*b**S(3)*e*p**S(3)*polylog(S(3), (d + e/(f + g*x))/d)/(d*g) - S(6)*b**S(2)*e*p**S(2)*(a + b*log(c*(d + e/(f + g*x))**p))*polylog(S(2), (d + e/(f + g*x))/d)/(d*g) - S(3)*b*e*p*(a + b*log(c*(d + e/(f + g*x))**p))**S(2)*log(-e/(d*(f + g*x)))/(d*g) + (a + b*log(c*(d + e/(f + g*x))**p))**S(3)*(d*(f + g*x) + e)/(d*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e/(f + g*x))**p))**S(2), x), x, -S(2)*b**S(2)*e*p**S(2)*polylog(S(2), (d + e/(f + g*x))/d)/(d*g) - S(2)*b*e*p*(a + b*log(c*(d + e/(f + g*x))**p))*log(-e/(d*(f + g*x)))/(d*g) + (a + b*log(c*(d + e/(f + g*x))**p))**S(2)*(d*(f + g*x) + e)/(d*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*log(c*(d + e/(f + g*x))**p), x), x, a*x + b*(f + g*x)*log(c*(d + e/(f + g*x))**p)/g + b*e*p*log(d*(f + g*x) + e)/(d*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*log(c*(d + e/(f + g*x))**p)), x), x, Integral(S(1)/(a + b*log(c*(d + e/x)**p)), (x, f + g*x))/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*(d + e/(f + g*x))**p))**(S(-2)), x), x, Integral((a + b*log(c*(d + e/x)**p))**(S(-2)), (x, f + g*x))/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(e*(f + g*x)**p)**q), x), x, -p*q*x + (f + g*x)*log(c*(e*(f + g*x)**p)**q)/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e*(f + g*x)**p)**q), x), x, -p*q*x + p*q*(f + g*x)*hyper((S(1), S(1)/p), (S(1) + S(1)/p,), -e*(f + g*x)**p/d)/g + (f + g*x)*log(c*(d + e*(f + g*x)**p)**q)/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e*(f + g*x)**S(3))**q), x), x, d**(S(1)/3)*q*log(d**(S(1)/3) + e**(S(1)/3)*(f + g*x))/(e**(S(1)/3)*g) - d**(S(1)/3)*q*log(d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*(f + g*x) + e**(S(2)/3)*(f + g*x)**S(2))/(S(2)*e**(S(1)/3)*g) - sqrt(S(3))*d**(S(1)/3)*q*atan(sqrt(S(3))*(d**(S(1)/3) - S(2)*e**(S(1)/3)*(f + g*x))/(S(3)*d**(S(1)/3)))/(e**(S(1)/3)*g) - S(3)*q*x + (f + g*x)*log(c*(d + e*(f + g*x)**S(3))**q)/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e*(f + g*x)**S(2))**q), x), x, S(2)*sqrt(d)*q*atan(sqrt(e)*(f + g*x)/sqrt(d))/(sqrt(e)*g) - S(2)*q*x + (f + g*x)*log(c*(d + e*(f + g*x)**S(2))**q)/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e*(f + g*x))**q), x), x, -q*x + (d + e*f + e*g*x)*log(c*(d + e*f + e*g*x)**q)/(e*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e/(f + g*x))**q), x), x, (f + g*x)*log(c*(d + e/(f + g*x))**q)/g + e*q*log(d*(f + g*x) + e)/(d*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e/(f + g*x)**S(2))**q), x), x, (f + g*x)*log(c*(d + e/(f + g*x)**S(2))**q)/g + S(2)*sqrt(e)*q*atan(sqrt(d)*(f + g*x)/sqrt(e))/(sqrt(d)*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(d + e/(f + g*x)**S(3))**q), x), x, (f + g*x)*log(c*(d + e/(f + g*x)**S(3))**q)/g + e**(S(1)/3)*q*log(d**(S(1)/3)*(f + g*x) + e**(S(1)/3))/(d**(S(1)/3)*g) - e**(S(1)/3)*q*log(d**(S(2)/3)*(f + g*x)**S(2) - d**(S(1)/3)*e**(S(1)/3)*(f + g*x) + e**(S(2)/3))/(S(2)*d**(S(1)/3)*g) - sqrt(S(3))*e**(S(1)/3)*q*atan(sqrt(S(3))*(-S(2)*d**(S(1)/3)*(f + g*x) + e**(S(1)/3))/(S(3)*e**(S(1)/3)))/(d**(S(1)/3)*g), expand=True, _diff=True, _numerical=True) def test_2(): assert rubi_test(rubi_integrate(x**m*log(a*x**n), x), x, -n*x**(m + S(1))/(m + S(1))**S(2) + x**(m + S(1))*log(a*x**n)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(a*x**n), x), x, x**n*log(a*x**n)/n - x**n/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x**n), x), x, -n*x**S(4)/S(16) + x**S(4)*log(a*x**n)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x**n), x), x, -n*x**S(3)/S(9) + x**S(3)*log(a*x**n)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**n), x), x, -n*x**S(2)/S(4) + x**S(2)*log(a*x**n)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n), x), x, -n*x + x*log(a*x**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)/x, x), x, log(a*x**n)**S(2)/(S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)/x**S(2), x), x, -n/x - log(a*x**n)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)/x**S(3), x), x, -n/(S(4)*x**S(2)) - log(a*x**n)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*x**n)**S(2), x), x, S(2)*n**S(2)*x**(m + S(1))/(m + S(1))**S(3) - S(2)*n*x**(m + S(1))*log(a*x**n)/(m + S(1))**S(2) + x**(m + S(1))*log(a*x**n)**S(2)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(a*x**n)**S(2), x), x, x**n*log(a*x**n)**S(2)/n - S(2)*x**n*log(a*x**n)/n + S(2)*x**n/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x**n)**S(2), x), x, n**S(2)*x**S(4)/S(32) - n*x**S(4)*log(a*x**n)/S(8) + x**S(4)*log(a*x**n)**S(2)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x**n)**S(2), x), x, S(2)*n**S(2)*x**S(3)/S(27) - S(2)*n*x**S(3)*log(a*x**n)/S(9) + x**S(3)*log(a*x**n)**S(2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**n)**S(2), x), x, n**S(2)*x**S(2)/S(4) - n*x**S(2)*log(a*x**n)/S(2) + x**S(2)*log(a*x**n)**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(2), x), x, S(2)*n**S(2)*x - S(2)*n*x*log(a*x**n) + x*log(a*x**n)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(2)/x, x), x, log(a*x**n)**S(3)/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(2)/x**S(2), x), x, -S(2)*n**S(2)/x - S(2)*n*log(a*x**n)/x - log(a*x**n)**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(2)/x**S(3), x), x, -n**S(2)/(S(4)*x**S(2)) - n*log(a*x**n)/(S(2)*x**S(2)) - log(a*x**n)**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*x**n)**S(3), x), x, -S(6)*n**S(3)*x**(m + S(1))/(m + S(1))**S(4) + S(6)*n**S(2)*x**(m + S(1))*log(a*x**n)/(m + S(1))**S(3) - S(3)*n*x**(m + S(1))*log(a*x**n)**S(2)/(m + S(1))**S(2) + x**(m + S(1))*log(a*x**n)**S(3)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(a*x**n)**S(3), x), x, x**n*log(a*x**n)**S(3)/n - S(3)*x**n*log(a*x**n)**S(2)/n + S(6)*x**n*log(a*x**n)/n - S(6)*x**n/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x**n)**S(3), x), x, -S(3)*n**S(3)*x**S(4)/S(128) + S(3)*n**S(2)*x**S(4)*log(a*x**n)/S(32) - S(3)*n*x**S(4)*log(a*x**n)**S(2)/S(16) + x**S(4)*log(a*x**n)**S(3)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x**n)**S(3), x), x, -S(2)*n**S(3)*x**S(3)/S(27) + S(2)*n**S(2)*x**S(3)*log(a*x**n)/S(9) - n*x**S(3)*log(a*x**n)**S(2)/S(3) + x**S(3)*log(a*x**n)**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**n)**S(3), x), x, -S(3)*n**S(3)*x**S(2)/S(8) + S(3)*n**S(2)*x**S(2)*log(a*x**n)/S(4) - S(3)*n*x**S(2)*log(a*x**n)**S(2)/S(4) + x**S(2)*log(a*x**n)**S(3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(3), x), x, -S(6)*n**S(3)*x + S(6)*n**S(2)*x*log(a*x**n) - S(3)*n*x*log(a*x**n)**S(2) + x*log(a*x**n)**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(3)/x, x), x, log(a*x**n)**S(4)/(S(4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(3)/x**S(2), x), x, -S(6)*n**S(3)/x - S(6)*n**S(2)*log(a*x**n)/x - S(3)*n*log(a*x**n)**S(2)/x - log(a*x**n)**S(3)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**S(3)/x**S(3), x), x, -S(3)*n**S(3)/(S(8)*x**S(2)) - S(3)*n**S(2)*log(a*x**n)/(S(4)*x**S(2)) - S(3)*n*log(a*x**n)**S(2)/(S(4)*x**S(2)) - log(a*x**n)**S(3)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*log(a*x), x), x, S(2)*x**(S(7)/2)*log(a*x)/S(7) - S(4)*x**(S(7)/2)/S(49), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*log(a*x), x), x, S(2)*x**(S(5)/2)*log(a*x)/S(5) - S(4)*x**(S(5)/2)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*log(a*x), x), x, S(2)*x**(S(3)/2)*log(a*x)/S(3) - S(4)*x**(S(3)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)/sqrt(x), x), x, S(2)*sqrt(x)*log(a*x) - S(4)*sqrt(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)/x**(S(3)/2), x), x, -S(2)*log(a*x)/sqrt(x) - S(4)/sqrt(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)/x**(S(5)/2), x), x, -S(2)*log(a*x)/(S(3)*x**(S(3)/2)) - S(4)/(S(9)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x**n), x), x, x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*Ei((m + S(1))*log(a*x**n)/n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/log(a*x**n), x), x, li(a*x**n)/(a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x**n), x), x, x**S(4)*(a*x**n)**(-S(4)/n)*Ei(S(4)*log(a*x**n)/n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x**n), x), x, x**S(3)*(a*x**n)**(-S(3)/n)*Ei(S(3)*log(a*x**n)/n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x**n), x), x, x**S(2)*(a*x**n)**(-S(2)/n)*Ei(S(2)*log(a*x**n)/n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/log(a*x**n), x), x, x*(a*x**n)**(-S(1)/n)*Ei(log(a*x**n)/n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x**n)), x), x, log(log(a*x**n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x**n)), x), x, (a*x**n)**(S(1)/n)*Ei(-log(a*x**n)/n)/(n*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x**n)), x), x, (a*x**n)**(S(2)/n)*Ei(-S(2)*log(a*x**n)/n)/(n*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x**n)**S(2), x), x, -x**(m + S(1))/(n*log(a*x**n)) + x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*(m + S(1))*Ei((m + S(1))*log(a*x**n)/n)/n**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/log(a*x**n)**S(2), x), x, -x**n/(n*log(a*x**n)) + li(a*x**n)/(a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x**n)**S(2), x), x, -x**S(4)/(n*log(a*x**n)) + S(4)*x**S(4)*(a*x**n)**(-S(4)/n)*Ei(S(4)*log(a*x**n)/n)/n**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x**n)**S(2), x), x, -x**S(3)/(n*log(a*x**n)) + S(3)*x**S(3)*(a*x**n)**(-S(3)/n)*Ei(S(3)*log(a*x**n)/n)/n**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x**n)**S(2), x), x, -x**S(2)/(n*log(a*x**n)) + S(2)*x**S(2)*(a*x**n)**(-S(2)/n)*Ei(S(2)*log(a*x**n)/n)/n**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(-2)), x), x, -x/(n*log(a*x**n)) + x*(a*x**n)**(-S(1)/n)*Ei(log(a*x**n)/n)/n**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x**n)**S(2)), x), x, -S(1)/(n*log(a*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x**n)**S(2)), x), x, -S(1)/(n*x*log(a*x**n)) - (a*x**n)**(S(1)/n)*Ei(-log(a*x**n)/n)/(n**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x**n)**S(2)), x), x, -S(1)/(n*x**S(2)*log(a*x**n)) - S(2)*(a*x**n)**(S(2)/n)*Ei(-S(2)*log(a*x**n)/n)/(n**S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x**n)**S(3), x), x, -x**(m + S(1))/(S(2)*n*log(a*x**n)**S(2)) - x**(m + S(1))*(m/S(2) + S(1)/2)/(n**S(2)*log(a*x**n)) + x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*(m + S(1))**S(2)*Ei((m + S(1))*log(a*x**n)/n)/(S(2)*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/log(a*x**n)**S(3), x), x, -x**n/(S(2)*n*log(a*x**n)) - x**n/(S(2)*n*log(a*x**n)**S(2)) + li(a*x**n)/(S(2)*a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x**n)**S(3), x), x, -x**S(4)/(S(2)*n*log(a*x**n)**S(2)) - S(2)*x**S(4)/(n**S(2)*log(a*x**n)) + S(8)*x**S(4)*(a*x**n)**(-S(4)/n)*Ei(S(4)*log(a*x**n)/n)/n**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x**n)**S(3), x), x, -x**S(3)/(S(2)*n*log(a*x**n)**S(2)) - S(3)*x**S(3)/(S(2)*n**S(2)*log(a*x**n)) + S(9)*x**S(3)*(a*x**n)**(-S(3)/n)*Ei(S(3)*log(a*x**n)/n)/(S(2)*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x**n)**S(3), x), x, -x**S(2)/(S(2)*n*log(a*x**n)**S(2)) - x**S(2)/(n**S(2)*log(a*x**n)) + S(2)*x**S(2)*(a*x**n)**(-S(2)/n)*Ei(S(2)*log(a*x**n)/n)/n**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(-3)), x), x, -x/(S(2)*n*log(a*x**n)**S(2)) - x/(S(2)*n**S(2)*log(a*x**n)) + x*(a*x**n)**(-S(1)/n)*Ei(log(a*x**n)/n)/(S(2)*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x**n)**S(3)), x), x, -S(1)/(S(2)*n*log(a*x**n)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x**n)**S(3)), x), x, -S(1)/(S(2)*n*x*log(a*x**n)**S(2)) + S(1)/(S(2)*n**S(2)*x*log(a*x**n)) + (a*x**n)**(S(1)/n)*Ei(-log(a*x**n)/n)/(S(2)*n**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x**n)**S(3)), x), x, -S(1)/(S(2)*n*x**S(2)*log(a*x**n)**S(2)) + S(1)/(n**S(2)*x**S(2)*log(a*x**n)) + S(2)*(a*x**n)**(S(2)/n)*Ei(-S(2)*log(a*x**n)/n)/(n**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x), x), x, x**(m + S(1))*(a*x)**(-m + S(-1))*Ei((m + S(1))*log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x), x), x, Ei(S(4)*log(a*x))/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x), x), x, Ei(S(3)*log(a*x))/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x), x), x, Ei(S(2)*log(a*x))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/log(a*x), x), x, li(a*x)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x)), x), x, log(log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x)), x), x, a*Ei(-log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x)), x), x, a**S(2)*Ei(-S(2)*log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x)**S(2), x), x, x**(m + S(1))*(a*x)**(-m + S(-1))*(m + S(1))*Ei((m + S(1))*log(a*x)) - x**(m + S(1))/log(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x)**S(2), x), x, -x**S(4)/log(a*x) + S(4)*Ei(S(4)*log(a*x))/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x)**S(2), x), x, -x**S(3)/log(a*x) + S(3)*Ei(S(3)*log(a*x))/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x)**S(2), x), x, -x**S(2)/log(a*x) + S(2)*Ei(S(2)*log(a*x))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**(S(-2)), x), x, -x/log(a*x) + li(a*x)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x)**S(2)), x), x, -S(1)/log(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x)**S(2)), x), x, -a*Ei(-log(a*x)) - S(1)/(x*log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x)**S(2)), x), x, -S(2)*a**S(2)*Ei(-S(2)*log(a*x)) - S(1)/(x**S(2)*log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x)**S(3), x), x, x**(m + S(1))*(a*x)**(-m + S(-1))*(m + S(1))**S(2)*Ei((m + S(1))*log(a*x))/S(2) - x**(m + S(1))*(m/S(2) + S(1)/2)/log(a*x) - x**(m + S(1))/(S(2)*log(a*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x)**S(3), x), x, -S(2)*x**S(4)/log(a*x) - x**S(4)/(S(2)*log(a*x)**S(2)) + S(8)*Ei(S(4)*log(a*x))/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x)**S(3), x), x, -S(3)*x**S(3)/(S(2)*log(a*x)) - x**S(3)/(S(2)*log(a*x)**S(2)) + S(9)*Ei(S(3)*log(a*x))/(S(2)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x)**S(3), x), x, -x**S(2)/log(a*x) - x**S(2)/(S(2)*log(a*x)**S(2)) + S(2)*Ei(S(2)*log(a*x))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**(S(-3)), x), x, -x/(S(2)*log(a*x)) - x/(S(2)*log(a*x)**S(2)) + li(a*x)/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x)**S(3)), x), x, -S(1)/(S(2)*log(a*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x)**S(3)), x), x, a*Ei(-log(a*x))/S(2) + S(1)/(S(2)*x*log(a*x)) - S(1)/(S(2)*x*log(a*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x)**S(3)), x), x, S(2)*a**S(2)*Ei(-S(2)*log(a*x)) + S(1)/(x**S(2)*log(a*x)) - S(1)/(S(2)*x**S(2)*log(a*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(log(a*x**n)), x), x, -sqrt(pi)*sqrt(n)*x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*erfi(sqrt(m + S(1))*sqrt(log(a*x**n))/sqrt(n))/(S(2)*(m + S(1))**(S(3)/2)) + x**(m + S(1))*sqrt(log(a*x**n))/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(log(a*x**n)), x), x, -sqrt(pi)*sqrt(n)*x**S(4)*(a*x**n)**(-S(4)/n)*erfi(S(2)*sqrt(log(a*x**n))/sqrt(n))/S(16) + x**S(4)*sqrt(log(a*x**n))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(log(a*x**n)), x), x, -sqrt(S(3))*sqrt(pi)*sqrt(n)*x**S(3)*(a*x**n)**(-S(3)/n)*erfi(sqrt(S(3))*sqrt(log(a*x**n))/sqrt(n))/S(18) + x**S(3)*sqrt(log(a*x**n))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(log(a*x**n)), x), x, -sqrt(S(2))*sqrt(pi)*sqrt(n)*x**S(2)*(a*x**n)**(-S(2)/n)*erfi(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/S(8) + x**S(2)*sqrt(log(a*x**n))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(a*x**n)), x), x, -sqrt(pi)*sqrt(n)*x*(a*x**n)**(-S(1)/n)*erfi(sqrt(log(a*x**n))/sqrt(n))/S(2) + x*sqrt(log(a*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(a*x**n))/x, x), x, S(2)*log(a*x**n)**(S(3)/2)/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(a*x**n))/x**S(2), x), x, sqrt(pi)*sqrt(n)*(a*x**n)**(S(1)/n)*erf(sqrt(log(a*x**n))/sqrt(n))/(S(2)*x) - sqrt(log(a*x**n))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(a*x**n))/x**S(3), x), x, sqrt(S(2))*sqrt(pi)*sqrt(n)*(a*x**n)**(S(2)/n)*erf(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(8)*x**S(2)) - sqrt(log(a*x**n))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*x**n)**(S(3)/2), x), x, S(3)*sqrt(pi)*n**(S(3)/2)*x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*erfi(sqrt(m + S(1))*sqrt(log(a*x**n))/sqrt(n))/(S(4)*(m + S(1))**(S(5)/2)) - S(3)*n*x**(m + S(1))*sqrt(log(a*x**n))/(S(2)*(m + S(1))**S(2)) + x**(m + S(1))*log(a*x**n)**(S(3)/2)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x**n)**(S(3)/2), x), x, S(3)*sqrt(pi)*n**(S(3)/2)*x**S(4)*(a*x**n)**(-S(4)/n)*erfi(S(2)*sqrt(log(a*x**n))/sqrt(n))/S(128) - S(3)*n*x**S(4)*sqrt(log(a*x**n))/S(32) + x**S(4)*log(a*x**n)**(S(3)/2)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x**n)**(S(3)/2), x), x, sqrt(S(3))*sqrt(pi)*n**(S(3)/2)*x**S(3)*(a*x**n)**(-S(3)/n)*erfi(sqrt(S(3))*sqrt(log(a*x**n))/sqrt(n))/S(36) - n*x**S(3)*sqrt(log(a*x**n))/S(6) + x**S(3)*log(a*x**n)**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**n)**(S(3)/2), x), x, S(3)*sqrt(S(2))*sqrt(pi)*n**(S(3)/2)*x**S(2)*(a*x**n)**(-S(2)/n)*erfi(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/S(32) - S(3)*n*x**S(2)*sqrt(log(a*x**n))/S(8) + x**S(2)*log(a*x**n)**(S(3)/2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(3)/2), x), x, S(3)*sqrt(pi)*n**(S(3)/2)*x*(a*x**n)**(-S(1)/n)*erfi(sqrt(log(a*x**n))/sqrt(n))/S(4) - S(3)*n*x*sqrt(log(a*x**n))/S(2) + x*log(a*x**n)**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(3)/2)/x, x), x, S(2)*log(a*x**n)**(S(5)/2)/(S(5)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(3)/2)/x**S(2), x), x, S(3)*sqrt(pi)*n**(S(3)/2)*(a*x**n)**(S(1)/n)*erf(sqrt(log(a*x**n))/sqrt(n))/(S(4)*x) - S(3)*n*sqrt(log(a*x**n))/(S(2)*x) - log(a*x**n)**(S(3)/2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(3)/2)/x**S(3), x), x, S(3)*sqrt(S(2))*sqrt(pi)*n**(S(3)/2)*(a*x**n)**(S(2)/n)*erf(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(32)*x**S(2)) - S(3)*n*sqrt(log(a*x**n))/(S(8)*x**S(2)) - log(a*x**n)**(S(3)/2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/sqrt(log(a*x**n)), x), x, sqrt(pi)*x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*erfi(sqrt(m + S(1))*sqrt(log(a*x**n))/sqrt(n))/(sqrt(n)*sqrt(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(log(a*x**n)), x), x, sqrt(pi)*x**S(4)*(a*x**n)**(-S(4)/n)*erfi(S(2)*sqrt(log(a*x**n))/sqrt(n))/(S(2)*sqrt(n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(log(a*x**n)), x), x, sqrt(S(3))*sqrt(pi)*x**S(3)*(a*x**n)**(-S(3)/n)*erfi(sqrt(S(3))*sqrt(log(a*x**n))/sqrt(n))/(S(3)*sqrt(n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(log(a*x**n)), x), x, sqrt(S(2))*sqrt(pi)*x**S(2)*(a*x**n)**(-S(2)/n)*erfi(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(2)*sqrt(n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(log(a*x**n)), x), x, sqrt(pi)*x*(a*x**n)**(-S(1)/n)*erfi(sqrt(log(a*x**n))/sqrt(n))/sqrt(n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(log(a*x**n))), x), x, S(2)*sqrt(log(a*x**n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(log(a*x**n))), x), x, sqrt(pi)*(a*x**n)**(S(1)/n)*erf(sqrt(log(a*x**n))/sqrt(n))/(sqrt(n)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(log(a*x**n))), x), x, sqrt(S(2))*sqrt(pi)*(a*x**n)**(S(2)/n)*erf(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(2)*sqrt(n)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x**n)**(S(3)/2), x), x, -S(2)*x**(m + S(1))/(n*sqrt(log(a*x**n))) + S(2)*sqrt(pi)*x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*sqrt(m + S(1))*erfi(sqrt(m + S(1))*sqrt(log(a*x**n))/sqrt(n))/n**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x**n)**(S(3)/2), x), x, -S(2)*x**S(4)/(n*sqrt(log(a*x**n))) + S(4)*sqrt(pi)*x**S(4)*(a*x**n)**(-S(4)/n)*erfi(S(2)*sqrt(log(a*x**n))/sqrt(n))/n**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x**n)**(S(3)/2), x), x, -S(2)*x**S(3)/(n*sqrt(log(a*x**n))) + S(2)*sqrt(S(3))*sqrt(pi)*x**S(3)*(a*x**n)**(-S(3)/n)*erfi(sqrt(S(3))*sqrt(log(a*x**n))/sqrt(n))/n**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x**n)**(S(3)/2), x), x, -S(2)*x**S(2)/(n*sqrt(log(a*x**n))) + S(2)*sqrt(S(2))*sqrt(pi)*x**S(2)*(a*x**n)**(-S(2)/n)*erfi(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/n**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(-3)/2), x), x, -S(2)*x/(n*sqrt(log(a*x**n))) + S(2)*sqrt(pi)*x*(a*x**n)**(-S(1)/n)*erfi(sqrt(log(a*x**n))/sqrt(n))/n**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x**n)**(S(3)/2)), x), x, -S(2)/(n*sqrt(log(a*x**n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x**n)**(S(3)/2)), x), x, -S(2)/(n*x*sqrt(log(a*x**n))) - S(2)*sqrt(pi)*(a*x**n)**(S(1)/n)*erf(sqrt(log(a*x**n))/sqrt(n))/(n**(S(3)/2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x**n)**(S(3)/2)), x), x, -S(2)/(n*x**S(2)*sqrt(log(a*x**n))) - S(2)*sqrt(S(2))*sqrt(pi)*(a*x**n)**(S(2)/n)*erf(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(n**(S(3)/2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(a*x**n)**(S(5)/2), x), x, -S(2)*x**(m + S(1))/(S(3)*n*log(a*x**n)**(S(3)/2)) - x**(m + S(1))*(S(4)*m/S(3) + S(4)/3)/(n**S(2)*sqrt(log(a*x**n))) + S(4)*sqrt(pi)*x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*(m + S(1))**(S(3)/2)*erfi(sqrt(m + S(1))*sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(a*x**n)**(S(5)/2), x), x, -S(2)*x**S(4)/(S(3)*n*log(a*x**n)**(S(3)/2)) - S(16)*x**S(4)/(S(3)*n**S(2)*sqrt(log(a*x**n))) + S(32)*sqrt(pi)*x**S(4)*(a*x**n)**(-S(4)/n)*erfi(S(2)*sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(a*x**n)**(S(5)/2), x), x, -S(2)*x**S(3)/(S(3)*n*log(a*x**n)**(S(3)/2)) - S(4)*x**S(3)/(n**S(2)*sqrt(log(a*x**n))) + S(4)*sqrt(S(3))*sqrt(pi)*x**S(3)*(a*x**n)**(-S(3)/n)*erfi(sqrt(S(3))*sqrt(log(a*x**n))/sqrt(n))/n**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(a*x**n)**(S(5)/2), x), x, -S(2)*x**S(2)/(S(3)*n*log(a*x**n)**(S(3)/2)) - S(8)*x**S(2)/(S(3)*n**S(2)*sqrt(log(a*x**n))) + S(8)*sqrt(S(2))*sqrt(pi)*x**S(2)*(a*x**n)**(-S(2)/n)*erfi(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**(S(-5)/2), x), x, -S(2)*x/(S(3)*n*log(a*x**n)**(S(3)/2)) - S(4)*x/(S(3)*n**S(2)*sqrt(log(a*x**n))) + S(4)*sqrt(pi)*x*(a*x**n)**(-S(1)/n)*erfi(sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(a*x**n)**(S(5)/2)), x), x, -S(2)/(S(3)*n*log(a*x**n)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(a*x**n)**(S(5)/2)), x), x, -S(2)/(S(3)*n*x*log(a*x**n)**(S(3)/2)) + S(4)/(S(3)*n**S(2)*x*sqrt(log(a*x**n))) + S(4)*sqrt(pi)*(a*x**n)**(S(1)/n)*erf(sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(a*x**n)**(S(5)/2)), x), x, -S(2)/(S(3)*n*x**S(2)*log(a*x**n)**(S(3)/2)) + S(8)/(S(3)*n**S(2)*x**S(2)*sqrt(log(a*x**n))) + S(8)*sqrt(S(2))*sqrt(pi)*(a*x**n)**(S(2)/n)*erf(sqrt(S(2))*sqrt(log(a*x**n))/sqrt(n))/(S(3)*n**(S(5)/2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*x)**p, x), x, x**(m + S(1))*(a*x)**(-m + S(-1))*((-m + S(-1))*log(a*x))**(-p)*Gamma(p + S(1), (-m + S(-1))*log(a*x))*log(a*x)**p/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x)**p, x), x, S(4)**(-p + S(-1))*(-log(a*x))**(-p)*Gamma(p + S(1), -S(4)*log(a*x))*log(a*x)**p/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x)**p, x), x, S(3)**(-p + S(-1))*(-log(a*x))**(-p)*Gamma(p + S(1), -S(3)*log(a*x))*log(a*x)**p/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x)**p, x), x, S(2)**(-p + S(-1))*(-log(a*x))**(-p)*Gamma(p + S(1), -S(2)*log(a*x))*log(a*x)**p/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**p, x), x, (-log(a*x))**(-p)*Gamma(p + S(1), -log(a*x))*log(a*x)**p/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**p/x, x), x, log(a*x)**(p + S(1))/(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**p/x**S(2), x), x, -a*Gamma(p + S(1), log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)**p/x**S(3), x), x, -S(2)**(-p + S(-1))*a**S(2)*Gamma(p + S(1), S(2)*log(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*x**n)**p, x), x, x**(m + S(1))*(a*x**n)**(-(m + S(1))/n)*((-m + S(-1))*log(a*x**n)/n)**(-p)*Gamma(p + S(1), (-m + S(-1))*log(a*x**n)/n)*log(a*x**n)**p/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(a*x**n)**p, x), x, (-log(a*x**n))**(-p)*Gamma(p + S(1), -log(a*x**n))*log(a*x**n)**p/(a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a*x**n)**p, x), x, S(4)**(-p + S(-1))*x**S(4)*(a*x**n)**(-S(4)/n)*(-log(a*x**n)/n)**(-p)*Gamma(p + S(1), -S(4)*log(a*x**n)/n)*log(a*x**n)**p, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a*x**n)**p, x), x, S(3)**(-p + S(-1))*x**S(3)*(a*x**n)**(-S(3)/n)*(-log(a*x**n)/n)**(-p)*Gamma(p + S(1), -S(3)*log(a*x**n)/n)*log(a*x**n)**p, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**n)**p, x), x, S(2)**(-p + S(-1))*x**S(2)*(a*x**n)**(-S(2)/n)*(-log(a*x**n)/n)**(-p)*Gamma(p + S(1), -S(2)*log(a*x**n)/n)*log(a*x**n)**p, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**p, x), x, x*(a*x**n)**(-S(1)/n)*(-log(a*x**n)/n)**(-p)*Gamma(p + S(1), -log(a*x**n)/n)*log(a*x**n)**p, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**p/x, x), x, log(a*x**n)**(p + S(1))/(n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**p/x**S(2), x), x, -(a*x**n)**(S(1)/n)*(log(a*x**n)/n)**(-p)*Gamma(p + S(1), log(a*x**n)/n)*log(a*x**n)**p/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)**p/x**S(3), x), x, -S(2)**(-p + S(-1))*(a*x**n)**(S(2)/n)*(log(a*x**n)/n)**(-p)*Gamma(p + S(1), S(2)*log(a*x**n)/n)*log(a*x**n)**p/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(b*x**n)**p), x), x, -n*p*x**(m + S(1))/(m + S(1))**S(2) + x**(m + S(1))*log(c*(b*x**n)**p)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(b*x**n)**p), x), x, -n*p*x**S(3)/S(9) + x**S(3)*log(c*(b*x**n)**p)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(b*x**n)**p), x), x, -n*p*x**S(2)/S(4) + x**S(2)*log(c*(b*x**n)**p)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p), x), x, -n*p*x + x*log(c*(b*x**n)**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)/x, x), x, log(c*(b*x**n)**p)**S(2)/(S(2)*n*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)/x**S(2), x), x, -n*p/x - log(c*(b*x**n)**p)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)/x**S(3), x), x, -n*p/(S(4)*x**S(2)) - log(c*(b*x**n)**p)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)/x**S(4), x), x, -n*p/(S(9)*x**S(3)) - log(c*(b*x**n)**p)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(b*x**n)**p)**S(2), x), x, S(2)*n**S(2)*p**S(2)*x**(m + S(1))/(m + S(1))**S(3) - S(2)*n*p*x**(m + S(1))*log(c*(b*x**n)**p)/(m + S(1))**S(2) + x**(m + S(1))*log(c*(b*x**n)**p)**S(2)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(b*x**n)**p)**S(2), x), x, S(2)*n**S(2)*p**S(2)*x**S(3)/S(27) - S(2)*n*p*x**S(3)*log(c*(b*x**n)**p)/S(9) + x**S(3)*log(c*(b*x**n)**p)**S(2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(b*x**n)**p)**S(2), x), x, n**S(2)*p**S(2)*x**S(2)/S(4) - n*p*x**S(2)*log(c*(b*x**n)**p)/S(2) + x**S(2)*log(c*(b*x**n)**p)**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)**S(2), x), x, S(2)*n**S(2)*p**S(2)*x - S(2)*n*p*x*log(c*(b*x**n)**p) + x*log(c*(b*x**n)**p)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)**S(2)/x, x), x, log(c*(b*x**n)**p)**S(3)/(S(3)*n*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)**S(2)/x**S(2), x), x, -S(2)*n**S(2)*p**S(2)/x - S(2)*n*p*log(c*(b*x**n)**p)/x - log(c*(b*x**n)**p)**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)**S(2)/x**S(3), x), x, -n**S(2)*p**S(2)/(S(4)*x**S(2)) - n*p*log(c*(b*x**n)**p)/(S(2)*x**S(2)) - log(c*(b*x**n)**p)**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(b*x**n)**p)**S(2)/x**S(4), x), x, -S(2)*n**S(2)*p**S(2)/(S(27)*x**S(3)) - S(2)*n*p*log(c*(b*x**n)**p)/(S(9)*x**S(3)) - log(c*(b*x**n)**p)**S(2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(c*(b*x**n)**p), x), x, x**(m + S(1))*(c*(b*x**n)**p)**(-(m + S(1))/(n*p))*Ei((m + S(1))*log(c*(b*x**n)**p)/(n*p))/(n*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(c*(b*x**n)**p)**S(2), x), x, -x**(m + S(1))/(n*p*log(c*(b*x**n)**p)) + x**(m + S(1))*(c*(b*x**n)**p)**(-(m + S(1))/(n*p))*(m + S(1))*Ei((m + S(1))*log(c*(b*x**n)**p)/(n*p))/(n**S(2)*p**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(b*x**n)**p)**q, x), x, x**(m + S(1))*(c*(b*x**n)**p)**(-(m + S(1))/(n*p))*((-m + S(-1))*log(c*(b*x**n)**p)/(n*p))**(-q)*Gamma(q + S(1), (-m + S(-1))*log(c*(b*x**n)**p)/(n*p))*log(c*(b*x**n)**p)**q/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**m*log(c*x), x), x, (a + b*x)**(m + S(1))*log(c*x)/(b*(m + S(1))) + (a + b*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), S(1) + b*x/a)/(a*b*(m**S(2) + S(3)*m + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*log(c*x), x), x, -a**S(4)*log(x)/(S(4)*b) - a**S(3)*x - S(3)*a**S(2)*b*x**S(2)/S(4) - a*b**S(2)*x**S(3)/S(3) - b**S(3)*x**S(4)/S(16) + (a + b*x)**S(4)*log(c*x)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(c*x), x), x, -a**S(3)*log(x)/(S(3)*b) - a**S(2)*x - a*b*x**S(2)/S(2) - b**S(2)*x**S(3)/S(9) + (a + b*x)**S(3)*log(c*x)/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(c*x), x), x, -a*x - b*x**S(2)/S(4) + x*(S(2)*a + b*x)*log(c*x)/S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x)*log(c*x), x), x, -a**S(2)*log(x)/(S(2)*b) - a*x - b*x**S(2)/S(4) + (a + b*x)**S(2)*log(c*x)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x)/(a + b*x), x), x, log((a + b*x)/a)*log(c*x)/b + polylog(S(2), -b*x/a)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x)/(a + b*x)**S(2), x), x, -log(c*x)/(b*(a + b*x)) + log(x)/(a*b) - log(a + b*x)/(a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x)/(a + b*x)**S(3), x), x, -log(c*x)/(S(2)*b*(a + b*x)**S(2)) + S(1)/(S(2)*a*b*(a + b*x)) + log(x)/(S(2)*a**S(2)*b) - log(a + b*x)/(S(2)*a**S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x)/(a + b*x)**S(4), x), x, -log(c*x)/(S(3)*b*(a + b*x)**S(3)) + S(1)/(S(6)*a*b*(a + b*x)**S(2)) + S(1)/(S(3)*a**S(2)*b*(a + b*x)) + log(x)/(S(3)*a**S(3)*b) - log(a + b*x)/(S(3)*a**S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**m*log(c*x**n), x), x, (a + b*x)**(m + S(1))*log(c*x**n)/(b*(m + S(1))) + n*(a + b*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), S(1) + b*x/a)/(a*b*(m**S(2) + S(3)*m + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*log(c*x**n), x), x, -a**S(4)*n*log(x)/(S(4)*b) - a**S(3)*n*x - S(3)*a**S(2)*b*n*x**S(2)/S(4) - a*b**S(2)*n*x**S(3)/S(3) - b**S(3)*n*x**S(4)/S(16) + (a + b*x)**S(4)*log(c*x**n)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(c*x**n), x), x, -a**S(3)*n*log(x)/(S(3)*b) - a**S(2)*n*x - a*b*n*x**S(2)/S(2) - b**S(2)*n*x**S(3)/S(9) + (a + b*x)**S(3)*log(c*x**n)/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(c*x**n), x), x, -a**S(2)*n*log(x)/(S(2)*b) - a*n*x - b*n*x**S(2)/S(4) + (a + b*x)**S(2)*log(c*x**n)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(a + b*x), x), x, n*polylog(S(2), -b*x/a)/b + log((a + b*x)/a)*log(c*x**n)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(a + b*x)**S(2), x), x, -log(c*x**n)/(b*(a + b*x)) + n*log(x)/(a*b) - n*log(a + b*x)/(a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(a + b*x)**S(3), x), x, -log(c*x**n)/(S(2)*b*(a + b*x)**S(2)) + n/(S(2)*a*b*(a + b*x)) + n*log(x)/(S(2)*a**S(2)*b) - n*log(a + b*x)/(S(2)*a**S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(a + b*x)**S(4), x), x, -log(c*x**n)/(S(3)*b*(a + b*x)**S(3)) + n/(S(6)*a*b*(a + b*x)**S(2)) + n/(S(3)*a**S(2)*b*(a + b*x)) + n*log(x)/(S(3)*a**S(3)*b) - n*log(a + b*x)/(S(3)*a**S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(S(4)*x + S(2))**S(2), x), x, n*log(x)/S(8) - n*log(S(2)*x + S(1))/S(8) - log(c*x**n)/(S(8)*(S(2)*x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)/(-a*x + S(1)), x), x, polylog(S(2), -a*x + S(1))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x/a)/(a - x), x), x, polylog(S(2), (a - x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a*x**S(2))/(-a*x**S(2) + S(1)), x), x, polylog(S(2), -a*x**S(2) + S(1))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(x**S(2)/a)/(a - x**S(2)), x), x, polylog(S(2), (a - x**S(2))/a)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(a*x**n)/(-a*x**n + S(1)), x), x, polylog(S(2), -a*x**n + S(1))/(a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(x**n/a)/(a - x**n), x), x, polylog(S(2), (a - x**n)/a)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a/x)/(a*x - x**S(2)), x), x, polylog(S(2), -a/x + S(1))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a/x**S(2))/(a*x - x**S(3)), x), x, polylog(S(2), (-a + x**S(2))/x**S(2))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**(-n + S(1)))/(a*x - x**n), x), x, -polylog(S(2), -a*x**(-n + S(1)) + S(1))/(a*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-a*x**(-m)*(-c + S(1))/b + c)/(x*(a + b*x**m)), x), x, polylog(S(2), x**(-m)*(a + b*x**m)*(-c + S(1))/b)/(a*m), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**(-m)*(a*c - a + b*c*x**m)/b)/(x*(a + b*x**m)), x), x, polylog(S(2), x**(-m)*(a + b*x**m)*(-c + S(1))/b)/(a*m), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + x**(-m)*(a*c*d - d)/(c*e)))/(x*(d + e*x**m)), x), x, polylog(S(2), x**(-m)*(d + e*x**m)*(-a*c + S(1))/e)/(d*m), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**(-m)*(a*c*d + a*c*e*x**m - d)/e)/(x*(d + e*x**m)), x), x, polylog(S(2), x**(-m)*(d + e*x**m)*(-a*c + S(1))/e)/(d*m), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(2)*a/(a + b*x))/(a**S(2) - b**S(2)*x**S(2)), x), x, polylog(S(2), (-a + b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(2)*a/(a + b*x))/((a - b*x)*(a + b*x)), x), x, polylog(S(2), (-a + b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a*(-c + S(1)) + b*x*(c + S(1)))/(a + b*x))/(a**S(2) - b**S(2)*x**S(2)), x), x, polylog(S(2), c*(a - b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a*(-c + S(1)) + b*x*(c + S(1)))/(a + b*x))/((a - b*x)*(a + b*x)), x), x, polylog(S(2), c*(a - b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-c*(a - b*x)/(a + b*x) + S(1))/(a**S(2) - b**S(2)*x**S(2)), x), x, polylog(S(2), c*(a - b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-c*(a - b*x)/(a + b*x) + S(1))/((a - b*x)*(a + b*x)), x), x, polylog(S(2), c*(a - b*x)/(a + b*x))/(S(2)*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))/(d + e*x**S(2)), x), x, -I*b*n*polylog(S(2), -I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) + I*b*n*polylog(S(2), I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) + (a + b*log(c*x**n))*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))/(d + e*x + f*x**S(2)), x), x, b*n*polylog(S(2), -S(2)*f*x/(e - sqrt(-S(4)*d*f + e**S(2))))/sqrt(-S(4)*d*f + e**S(2)) - b*n*polylog(S(2), -S(2)*f*x/(e + sqrt(-S(4)*d*f + e**S(2))))/sqrt(-S(4)*d*f + e**S(2)) + (a + b*log(c*x**n))*log((e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(e - sqrt(-S(4)*d*f + e**S(2))))/sqrt(-S(4)*d*f + e**S(2)) - (a + b*log(c*x**n))*log((e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(e + sqrt(-S(4)*d*f + e**S(2))))/sqrt(-S(4)*d*f + e**S(2)), expand=True, _diff=True, _numerical=True) # same result as in mathematica but fails assert rubi_test(rubi_integrate((d + e*x)**m*log(c*x)/x, x), x, (d + e*x)**m*(d/(e*x) + S(1))**(-m)*log(c*x)*hyper((-m, -m), (-m + S(1),), -d/(e*x))/m - (d + e*x)**m*(d/(e*x) + S(1))**(-m)*hyper((-m, -m, -m), (-m + S(1), -m + S(1)), -d/(e*x))/m**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))**S(3), x), x, S(6)*a*b**S(2)*n**S(2)*x - S(6)*b**S(3)*n**S(3)*x + S(6)*b**S(3)*n**S(2)*x*log(c*x**n) - S(3)*b*n*x*(a + b*log(c*x**n))**S(2) + x*(a + b*log(c*x**n))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))**S(2), x), x, -S(2)*a*b*n*x + S(2)*b**S(2)*n**S(2)*x - S(2)*b**S(2)*n*x*log(c*x**n) + x*(a + b*log(c*x**n))**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*log(c*x**n), x), x, a*x - b*n*x + b*x*log(c*x**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*log(c*x**n)), x), x, x*(c*x**n)**(-S(1)/n)*exp(-a/(b*n))*Ei((a + b*log(c*x**n))/(b*n))/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))**(S(-2)), x), x, -x/(b*n*(a + b*log(c*x**n))) + x*(c*x**n)**(-S(1)/n)*exp(-a/(b*n))*Ei((a + b*log(c*x**n))/(b*n))/(b**S(2)*n**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))**(S(-3)), x), x, -x/(S(2)*b*n*(a + b*log(c*x**n))**S(2)) - x/(S(2)*b**S(2)*n**S(2)*(a + b*log(c*x**n))) + x*(c*x**n)**(-S(1)/n)*exp(-a/(b*n))*Ei((a + b*log(c*x**n))/(b*n))/(S(2)*b**S(3)*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(c*x**n))**m, x), x, x*(c*x**n)**(-S(1)/n)*((-a - b*log(c*x**n))/(b*n))**(-m)*(a + b*log(c*x**n))**m*Gamma(m + S(1), (-a - b*log(c*x**n))/(b*n))*exp(-a/(b*n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a + b*log(c*x**n)), x), x, x**(m + S(1))*(c*x**n)**(-(m + S(1))/n)*exp(-a*(m + S(1))/(b*n))*Ei((a + b*log(c*x**n))*(m + S(1))/(b*n))/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a + b*log(c*x**n))**S(2), x), x, -x**(m + S(1))/(b*n*(a + b*log(c*x**n))) + x**(m + S(1))*(c*x**n)**(-(m + S(1))/n)*(m + S(1))*exp(-a*(m + S(1))/(b*n))*Ei((a + b*log(c*x**n))*(m + S(1))/(b*n))/(b**S(2)*n**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*log(c*x**n))**p, x), x, x**(m + S(1))*(c*x**n)**(-(m + S(1))/n)*((a + b*log(c*x**n))*(-m + S(-1))/(b*n))**(-p)*(a + b*log(c*x**n))**p*Gamma(p + S(1), (a + b*log(c*x**n))*(-m + S(-1))/(b*n))*exp(-a*(m + S(1))/(b*n))/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*log(-b*x**n/a)/(a + b*x**n), x), x, -polylog(S(2), (a + b*x**n)/a)/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b*x**S(2))**p), x), x, x**(m + S(1))*log(c*(a + b*x**S(2))**p)/(m + S(1)) - S(2)*b*p*x**(m + S(3))*hyper((S(1), m/S(2) + S(3)/2), (m/S(2) + S(5)/2,), -b*x**S(2)/a)/(a*(m**S(2) + S(4)*m + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c*(a + b*x**S(2))**p), x), x, S(2)*a**(S(5)/2)*p*atan(sqrt(b)*x/sqrt(a))/(S(5)*b**(S(5)/2)) - S(2)*a**S(2)*p*x/(S(5)*b**S(2)) + S(2)*a*p*x**S(3)/(S(15)*b) - S(2)*p*x**S(5)/S(25) + x**S(5)*log(c*(a + b*x**S(2))**p)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(2))**p), x), x, -a**S(2)*p*log(a + b*x**S(2))/(S(4)*b**S(2)) + a*p*x**S(2)/(S(4)*b) - p*x**S(4)/S(8) + x**S(4)*log(c*(a + b*x**S(2))**p)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**S(2))**p), x), x, -S(2)*a**(S(3)/2)*p*atan(sqrt(b)*x/sqrt(a))/(S(3)*b**(S(3)/2)) + S(2)*a*p*x/(S(3)*b) - S(2)*p*x**S(3)/S(9) + x**S(3)*log(c*(a + b*x**S(2))**p)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(2))**p), x), x, -p*x**S(2)/S(2) + (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**p)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p), x), x, S(2)*sqrt(a)*p*atan(sqrt(b)*x/sqrt(a))/sqrt(b) - S(2)*p*x + x*log(c*(a + b*x**S(2))**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x, x), x, p*polylog(S(2), (a + b*x**S(2))/a)/S(2) + log(c*(a + b*x**S(2))**p)*log(-b*x**S(2)/a)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(2), x), x, -log(c*(a + b*x**S(2))**p)/x + S(2)*sqrt(b)*p*atan(sqrt(b)*x/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(3), x), x, b*p*log(x)/a - (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**p)/(a*x**S(2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(3), x), x, -log(c*(a + b*x**S(2))**p)/(S(2)*x**S(2)) + b*p*log(x)/a - b*p*log(a + b*x**S(2))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(4), x), x, -log(c*(a + b*x**S(2))**p)/(S(3)*x**S(3)) - S(2)*b*p/(S(3)*a*x) - S(2)*b**(S(3)/2)*p*atan(sqrt(b)*x/sqrt(a))/(S(3)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(5), x), x, -log(c*(a + b*x**S(2))**p)/(S(4)*x**S(4)) - b*p/(S(4)*a*x**S(2)) - b**S(2)*p*log(x)/(S(2)*a**S(2)) + b**S(2)*p*log(a + b*x**S(2))/(S(4)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(6), x), x, -log(c*(a + b*x**S(2))**p)/(S(5)*x**S(5)) - S(2)*b*p/(S(15)*a*x**S(3)) + S(2)*b**S(2)*p/(S(5)*a**S(2)*x) + S(2)*b**(S(5)/2)*p*atan(sqrt(b)*x/sqrt(a))/(S(5)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/x**S(7), x), x, -log(c*(a + b*x**S(2))**p)/(S(6)*x**S(6)) - b*p/(S(12)*a*x**S(4)) + b**S(2)*p/(S(6)*a**S(2)*x**S(2)) + b**S(3)*p*log(x)/(S(3)*a**S(3)) - b**S(3)*p*log(a + b*x**S(2))/(S(6)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b*x**S(3))**p), x), x, x**(m + S(1))*log(c*(a + b*x**S(3))**p)/(m + S(1)) - S(3)*b*p*x**(m + S(4))*hyper((S(1), m/S(3) + S(4)/3), (m/S(3) + S(7)/3,), -b*x**S(3)/a)/(a*(m**S(2) + S(5)*m + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*log(c*(a + b*x**S(3))**p), x), x, -a**S(2)*p*log(a + b*x**S(3))/(S(6)*b**S(2)) + a*p*x**S(3)/(S(6)*b) - p*x**S(6)/S(12) + x**S(6)*log(c*(a + b*x**S(3))**p)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c*(a + b*x**S(3))**p), x), x, a**(S(5)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(5)*b**(S(5)/3)) - a**(S(5)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(10)*b**(S(5)/3)) + sqrt(S(3))*a**(S(5)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(5)*b**(S(5)/3)) + S(3)*a*p*x**S(2)/(S(10)*b) - S(3)*p*x**S(5)/S(25) + x**S(5)*log(c*(a + b*x**S(3))**p)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(3))**p), x), x, -a**(S(4)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(4)*b**(S(4)/3)) + a**(S(4)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(8)*b**(S(4)/3)) + sqrt(S(3))*a**(S(4)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(4)*b**(S(4)/3)) + S(3)*a*p*x/(S(4)*b) - S(3)*p*x**S(4)/S(16) + x**S(4)*log(c*(a + b*x**S(3))**p)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**S(3))**p), x), x, -p*x**S(3)/S(3) + (a/S(3) + b*x**S(3)/S(3))*log(c*(a + b*x**S(3))**p)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(3))**p), x), x, -a**(S(2)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*b**(S(2)/3)) + a**(S(2)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*b**(S(2)/3)) - sqrt(S(3))*a**(S(2)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*b**(S(2)/3)) - S(3)*p*x**S(2)/S(4) + x**S(2)*log(c*(a + b*x**S(3))**p)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p), x), x, a**(S(1)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/b**(S(1)/3) - a**(S(1)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(1)/3)) - sqrt(S(3))*a**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/b**(S(1)/3) - S(3)*p*x + x*log(c*(a + b*x**S(3))**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x, x), x, p*polylog(S(2), (a + b*x**S(3))/a)/S(3) + log(c*(a + b*x**S(3))**p)*log(-b*x**S(3)/a)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(2), x), x, -log(c*(a + b*x**S(3))**p)/x - b**(S(1)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/a**(S(1)/3) + b**(S(1)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*a**(S(1)/3)) - sqrt(S(3))*b**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/a**(S(1)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(3), x), x, -log(c*(a + b*x**S(3))**p)/(S(2)*x**S(2)) + b**(S(2)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*a**(S(2)/3)) - b**(S(2)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*a**(S(2)/3)) - sqrt(S(3))*b**(S(2)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*a**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(4), x), x, -log(c*(a + b*x**S(3))**p)/(S(3)*x**S(3)) + b*p*log(x)/a - b*p*log(a + b*x**S(3))/(S(3)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(5), x), x, -log(c*(a + b*x**S(3))**p)/(S(4)*x**S(4)) - S(3)*b*p/(S(4)*a*x) + b**(S(4)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(4)*a**(S(4)/3)) - b**(S(4)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(8)*a**(S(4)/3)) + sqrt(S(3))*b**(S(4)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(4)*a**(S(4)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(6), x), x, -log(c*(a + b*x**S(3))**p)/(S(5)*x**S(5)) - S(3)*b*p/(S(10)*a*x**S(2)) - b**(S(5)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(5)*a**(S(5)/3)) + b**(S(5)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(10)*a**(S(5)/3)) + sqrt(S(3))*b**(S(5)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(5)*a**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/x**S(7), x), x, -log(c*(a + b*x**S(3))**p)/(S(6)*x**S(6)) - b*p/(S(6)*a*x**S(3)) - b**S(2)*p*log(x)/(S(2)*a**S(2)) + b**S(2)*p*log(a + b*x**S(3))/(S(6)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b*sqrt(x))**p), x), x, x**(m + S(1))*log(c*(a + b*sqrt(x))**p)/(m + S(1)) - b*p*x**(m + S(3)/2)*hyper((S(1), S(2)*m + S(3)), (S(2)*m + S(4),), -b*sqrt(x)/a)/(a*(S(2)*m**S(2) + S(5)*m + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*sqrt(x))**p), x), x, -a**S(8)*p*log(a + b*sqrt(x))/(S(4)*b**S(8)) + a**S(7)*p*sqrt(x)/(S(4)*b**S(7)) - a**S(6)*p*x/(S(8)*b**S(6)) + a**S(5)*p*x**(S(3)/2)/(S(12)*b**S(5)) - a**S(4)*p*x**S(2)/(S(16)*b**S(4)) + a**S(3)*p*x**(S(5)/2)/(S(20)*b**S(3)) - a**S(2)*p*x**S(3)/(S(24)*b**S(2)) + a*p*x**(S(7)/2)/(S(28)*b) - p*x**S(4)/S(32) + x**S(4)*log(c*(a + b*sqrt(x))**p)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*sqrt(x))**p), x), x, -a**S(6)*p*log(a + b*sqrt(x))/(S(3)*b**S(6)) + a**S(5)*p*sqrt(x)/(S(3)*b**S(5)) - a**S(4)*p*x/(S(6)*b**S(4)) + a**S(3)*p*x**(S(3)/2)/(S(9)*b**S(3)) - a**S(2)*p*x**S(2)/(S(12)*b**S(2)) + a*p*x**(S(5)/2)/(S(15)*b) - p*x**S(3)/S(18) + x**S(3)*log(c*(a + b*sqrt(x))**p)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*sqrt(x))**p), x), x, -a**S(4)*p*log(a + b*sqrt(x))/(S(2)*b**S(4)) + a**S(3)*p*sqrt(x)/(S(2)*b**S(3)) - a**S(2)*p*x/(S(4)*b**S(2)) + a*p*x**(S(3)/2)/(S(6)*b) - p*x**S(2)/S(8) + x**S(2)*log(c*(a + b*sqrt(x))**p)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*sqrt(x))**p), x), x, -a**S(2)*p*log(a + b*sqrt(x))/b**S(2) + a*p*sqrt(x)/b - p*x/S(2) + x*log(c*(a + b*sqrt(x))**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*sqrt(x))**p)/x, x), x, S(2)*p*polylog(S(2), (a + b*sqrt(x))/a) + S(2)*log(c*(a + b*sqrt(x))**p)*log(-b*sqrt(x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*sqrt(x))**p)/x**S(2), x), x, -log(c*(a + b*sqrt(x))**p)/x - b*p/(a*sqrt(x)) - b**S(2)*p*log(x)/(S(2)*a**S(2)) + b**S(2)*p*log(a + b*sqrt(x))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*sqrt(x))**p)/x**S(3), x), x, -log(c*(a + b*sqrt(x))**p)/(S(2)*x**S(2)) - b*p/(S(6)*a*x**(S(3)/2)) + b**S(2)*p/(S(4)*a**S(2)*x) - b**S(3)*p/(S(2)*a**S(3)*sqrt(x)) - b**S(4)*p*log(x)/(S(4)*a**S(4)) + b**S(4)*p*log(a + b*sqrt(x))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*sqrt(x))**p)/x**S(4), x), x, -log(c*(a + b*sqrt(x))**p)/(S(3)*x**S(3)) - b*p/(S(15)*a*x**(S(5)/2)) + b**S(2)*p/(S(12)*a**S(2)*x**S(2)) - b**S(3)*p/(S(9)*a**S(3)*x**(S(3)/2)) + b**S(4)*p/(S(6)*a**S(4)*x) - b**S(5)*p/(S(3)*a**S(5)*sqrt(x)) - b**S(6)*p*log(x)/(S(6)*a**S(6)) + b**S(6)*p*log(a + b*sqrt(x))/(S(3)*a**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*sqrt(x))/sqrt(x), x), x, -S(2)*sqrt(x) + S(2)*(a + b*sqrt(x))*log(a + b*sqrt(x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b/x)**p), x), x, p*x**(m + S(1))*hyper((S(1), m + S(1)), (m + S(2),), -a*x/b)/(m + S(1))**S(2) + x**(m + S(1))*log(c*(a + b/x)**p)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c*(a + b/x)**p), x), x, x**S(5)*log(c*(a + b/x)**p)/S(5) + b*p*x**S(4)/(S(20)*a) - b**S(2)*p*x**S(3)/(S(15)*a**S(2)) + b**S(3)*p*x**S(2)/(S(10)*a**S(3)) - b**S(4)*p*x/(S(5)*a**S(4)) + b**S(5)*p*log(a*x + b)/(S(5)*a**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b/x)**p), x), x, x**S(4)*log(c*(a + b/x)**p)/S(4) + b*p*x**S(3)/(S(12)*a) - b**S(2)*p*x**S(2)/(S(8)*a**S(2)) + b**S(3)*p*x/(S(4)*a**S(3)) - b**S(4)*p*log(a*x + b)/(S(4)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b/x)**p), x), x, x**S(3)*log(c*(a + b/x)**p)/S(3) + b*p*x**S(2)/(S(6)*a) - b**S(2)*p*x/(S(3)*a**S(2)) + b**S(3)*p*log(a*x + b)/(S(3)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b/x)**p), x), x, x**S(2)*log(c*(a + b/x)**p)/S(2) + b*p*x/(S(2)*a) - b**S(2)*p*log(a*x + b)/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p), x), x, x*log(c*(a + b/x)**p) + b*p*log(a*x + b)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/x, x), x, -p*polylog(S(2), (a + b/x)/a) - log(c*(a + b/x)**p)*log(-b/(a*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/x**S(2), x), x, p/x - (a + b/x)*log(c*(a + b/x)**p)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/x**S(3), x), x, -a**S(2)*p*log(x)/(S(2)*b**S(2)) + a**S(2)*p*log(a*x + b)/(S(2)*b**S(2)) - a*p/(S(2)*b*x) + p/(S(4)*x**S(2)) - log(c*(a + b/x)**p)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/x**S(4), x), x, a**S(3)*p*log(x)/(S(3)*b**S(3)) - a**S(3)*p*log(a*x + b)/(S(3)*b**S(3)) + a**S(2)*p/(S(3)*b**S(2)*x) - a*p/(S(6)*b*x**S(2)) + p/(S(9)*x**S(3)) - log(c*(a + b/x)**p)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/x**S(5), x), x, -a**S(4)*p*log(x)/(S(4)*b**S(4)) + a**S(4)*p*log(a*x + b)/(S(4)*b**S(4)) - a**S(3)*p/(S(4)*b**S(3)*x) + a**S(2)*p/(S(8)*b**S(2)*x**S(2)) - a*p/(S(12)*b*x**S(3)) + p/(S(16)*x**S(4)) - log(c*(a + b/x)**p)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(b/x + S(1))/x, x), x, polylog(S(2), -b/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b/x**S(2))**p), x), x, S(2)*p*x**(m + S(1))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -a*x**S(2)/b)/(m + S(1))**S(2) + x**(m + S(1))*log(c*(a + b/x**S(2))**p)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c*(a + b/x**S(2))**p), x), x, x**S(5)*log(c*(a + b/x**S(2))**p)/S(5) + S(2)*b*p*x**S(3)/(S(15)*a) - S(2)*b**S(2)*p*x/(S(5)*a**S(2)) + S(2)*b**(S(5)/2)*p*atan(sqrt(a)*x/sqrt(b))/(S(5)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b/x**S(2))**p), x), x, x**S(4)*log(c*(a + b/x**S(2))**p)/S(4) + b*p*x**S(2)/(S(4)*a) - b**S(2)*p*log(a*x**S(2) + b)/(S(4)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b/x**S(2))**p), x), x, x**S(3)*log(c*(a + b/x**S(2))**p)/S(3) + S(2)*b*p*x/(S(3)*a) - S(2)*b**(S(3)/2)*p*atan(sqrt(a)*x/sqrt(b))/(S(3)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b/x**S(2))**p), x), x, x**S(2)*log(c*(a + b/x**S(2))**p)/S(2) + b*p*log(a*x**S(2) + b)/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p), x), x, x*log(c*(a + b/x**S(2))**p) + S(2)*sqrt(b)*p*atan(sqrt(a)*x/sqrt(b))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/x, x), x, -p*polylog(S(2), (a + b/x**S(2))/a)/S(2) - log(c*(a + b/x**S(2))**p)*log(-b/(a*x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/x**S(2), x), x, S(2)*sqrt(a)*p*atan(sqrt(a)*x/sqrt(b))/sqrt(b) + S(2)*p/x - log(c*(a + b/x**S(2))**p)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/x**S(3), x), x, p/(S(2)*x**S(2)) - (a/S(2) + b/(S(2)*x**S(2)))*log(c*(a + b/x**S(2))**p)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/x**S(4), x), x, -S(2)*a**(S(3)/2)*p*atan(sqrt(a)*x/sqrt(b))/(S(3)*b**(S(3)/2)) - S(2)*a*p/(S(3)*b*x) + S(2)*p/(S(9)*x**S(3)) - log(c*(a + b/x**S(2))**p)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(c*(a + b*x**n)**p), x), x, x**(m + S(1))*log(c*(a + b*x**n)**p)/(m + S(1)) - b*n*p*x**(m + n + S(1))*hyper((S(1), (m + n + S(1))/n), ((m + S(2)*n + S(1))/n,), -b*x**n/a)/(a*(m + S(1))*(m + n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**n)**p), x), x, x**S(3)*log(c*(a + b*x**n)**p)/S(3) - b*n*p*x**(n + S(3))*hyper((S(1), (n + S(3))/n), (S(2) + S(3)/n,), -b*x**n/a)/(S(3)*a*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**n)**p), x), x, x**S(2)*log(c*(a + b*x**n)**p)/S(2) - b*n*p*x**(n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -b*x**n/a)/(S(2)*a*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**n)**p), x), x, x*log(c*(a + b*x**n)**p) - b*n*p*x**(n + S(1))*hyper((S(1), S(1) + S(1)/n), (S(2) + S(1)/n,), -b*x**n/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**n)**p)/x, x), x, p*polylog(S(2), (a + b*x**n)/a)/n + log(c*(a + b*x**n)**p)*log(-b*x**n/a)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**n)**p)/x**S(2), x), x, -log(c*(a + b*x**n)**p)/x - b*n*p*x**(n + S(-1))*hyper((S(1), (n + S(-1))/n), (S(2) - S(1)/n,), -b*x**n/a)/(a*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**n)**p)/x**S(3), x), x, -log(c*(a + b*x**n)**p)/(S(2)*x**S(2)) - b*n*p*x**(n + S(-2))*hyper((S(1), (n + S(-2))/n), (S(2) - S(2)/n,), -b*x**n/a)/(S(2)*a*(-n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**n)**p)/x**S(4), x), x, -log(c*(a + b*x**n)**p)/(S(3)*x**S(3)) - b*n*p*x**(n + S(-3))*hyper((S(1), (n + S(-3))/n), (S(2) - S(3)/n,), -b*x**n/a)/(S(3)*a*(-n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**m*log(c*(a + b*x)**p), x), x, b*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), b*(d + e*x)/(-a*e + b*d))/(e*(m + S(1))*(m + S(2))*(-a*e + b*d)) + (d + e*x)**(m + S(1))*log(c*(a + b*x)**p)/(e*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*log(c*(a + b*x)**p), x), x, -p*(d + e*x)**S(4)/(S(16)*e) + (d + e*x)**S(4)*log(c*(a + b*x)**p)/(S(4)*e) - p*(d + e*x)**S(3)*(-a*e/S(12) + b*d/S(12))/(b*e) - p*(d + e*x)**S(2)*(-a*e + b*d)**S(2)/(S(8)*b**S(2)*e) - p*x*(-a*e + b*d)**S(3)/(S(4)*b**S(3)) - p*(-a*e + b*d)**S(4)*log(a + b*x)/(S(4)*b**S(4)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)*log(c*(a + b*x)**p), x), x, -p*(d + e*x)**S(3)/(S(9)*e) + (d + e*x)**S(3)*log(c*(a + b*x)**p)/(S(3)*e) - p*(d + e*x)**S(2)*(-a*e/S(6) + b*d/S(6))/(b*e) - p*x*(-a*e + b*d)**S(2)/(S(3)*b**S(2)) - p*(-a*e + b*d)**S(3)*log(a + b*x)/(S(3)*b**S(3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*log(c*(a + b*x)**p), x), x, -p*(d + e*x)**S(2)/(S(4)*e) + (d + e*x)**S(2)*log(c*(a + b*x)**p)/(S(2)*e) + p*x*(a*e/S(2) - b*d/S(2))/b - p*(-a*e + b*d)**S(2)*log(a + b*x)/(S(2)*b**S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p), x), x, -p*x + (a + b*x)*log(c*(a + b*x)**p)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(d + e*x), x), x, p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/e + log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(d + e*x)**S(2), x), x, b*p*log(a + b*x)/(e*(-a*e + b*d)) - b*p*log(d + e*x)/(e*(-a*e + b*d)) - log(c*(a + b*x)**p)/(e*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(d + e*x)**S(3), x), x, b**S(2)*p*log(a + b*x)/(S(2)*e*(-a*e + b*d)**S(2)) - b**S(2)*p*log(d + e*x)/(S(2)*e*(-a*e + b*d)**S(2)) + b*p/(S(2)*e*(d + e*x)*(-a*e + b*d)) - log(c*(a + b*x)**p)/(S(2)*e*(d + e*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(d + e*x)**S(4), x), x, b**S(3)*p*log(a + b*x)/(S(3)*e*(-a*e + b*d)**S(3)) - b**S(3)*p*log(d + e*x)/(S(3)*e*(-a*e + b*d)**S(3)) + b**S(2)*p/(S(3)*e*(d + e*x)*(-a*e + b*d)**S(2)) + b*p/(S(6)*e*(d + e*x)**S(2)*(-a*e + b*d)) - log(c*(a + b*x)**p)/(S(3)*e*(d + e*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**m*log(c*(a + b*x**S(2))**p), x), x, sqrt(b)*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/(e*(m + S(1))*(m + S(2))*(sqrt(b)*d + e*sqrt(-a))) + sqrt(b)*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/(e*(m + S(1))*(m + S(2))*(sqrt(b)*d - e*sqrt(-a))) + (d + e*x)**(m + S(1))*log(c*(a + b*x**S(2))**p)/(e*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*log(c*(a + b*x**S(2))**p), x), x, S(2)*sqrt(a)*d*p*(-a*e**S(2) + b*d**S(2))*atan(sqrt(b)*x/sqrt(a))/b**(S(3)/2) - S(2)*d*e**S(2)*p*x**S(3)/S(3) - e**S(3)*p*x**S(4)/S(8) + (d + e*x)**S(4)*log(c*(a + b*x**S(2))**p)/(S(4)*e) - S(2)*d*p*x*(-a*e**S(2) + b*d**S(2))/b - e*p*x**S(2)*(-a*e**S(2) + S(6)*b*d**S(2))/(S(4)*b) - p*(a**S(2)*e**S(4)/S(4) - S(3)*a*b*d**S(2)*e**S(2)/S(2) + b**S(2)*d**S(4)/S(4))*log(a + b*x**S(2))/(b**S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)*log(c*(a + b*x**S(2))**p), x), x, sqrt(a)*p*(-S(2)*a*e**S(2)/S(3) + S(2)*b*d**S(2))*atan(sqrt(b)*x/sqrt(a))/b**(S(3)/2) - d*e*p*x**S(2) - S(2)*e**S(2)*p*x**S(3)/S(9) + (d + e*x)**S(3)*log(c*(a + b*x**S(2))**p)/(S(3)*e) - d*p*(-S(3)*a*e**S(2) + b*d**S(2))*log(a + b*x**S(2))/(S(3)*b*e) + p*x*(S(2)*a*e**S(2)/S(3) - S(2)*b*d**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*log(c*(a + b*x**S(2))**p), x), x, S(2)*sqrt(a)*d*p*atan(sqrt(b)*x/sqrt(a))/sqrt(b) - S(2)*d*p*x - e*p*x**S(2)/S(2) + (d + e*x)**S(2)*log(c*(a + b*x**S(2))**p)/(S(2)*e) - p*(-a*e**S(2)/S(2) + b*d**S(2)/S(2))*log(a + b*x**S(2))/(b*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p), x), x, S(2)*sqrt(a)*p*atan(sqrt(b)*x/sqrt(a))/sqrt(b) - S(2)*p*x + x*log(c*(a + b*x**S(2))**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(d + e*x), x), x, -p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/e - p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/e - p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/e - p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/e + log(c*(a + b*x**S(2))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(d + e*x)**S(2), x), x, S(2)*sqrt(a)*sqrt(b)*p*atan(sqrt(b)*x/sqrt(a))/(a*e**S(2) + b*d**S(2)) + b*d*p*log(a + b*x**S(2))/(e*(a*e**S(2) + b*d**S(2))) - S(2)*b*d*p*log(d + e*x)/(e*(a*e**S(2) + b*d**S(2))) - log(c*(a + b*x**S(2))**p)/(e*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(d + e*x)**S(3), x), x, S(2)*sqrt(a)*b**(S(3)/2)*d*p*atan(sqrt(b)*x/sqrt(a))/(a*e**S(2) + b*d**S(2))**S(2) + b*d*p/(e*(d + e*x)*(a*e**S(2) + b*d**S(2))) + b*p*(-a*e**S(2) + b*d**S(2))*log(a + b*x**S(2))/(S(2)*e*(a*e**S(2) + b*d**S(2))**S(2)) - b*p*(-a*e**S(2) + b*d**S(2))*log(d + e*x)/(e*(a*e**S(2) + b*d**S(2))**S(2)) - log(c*(a + b*x**S(2))**p)/(S(2)*e*(d + e*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**m*log(c*(a + b*x**S(3))**p), x), x, b**(S(1)/3)*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/(e*(m + S(1))*(m + S(2))*(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d)) + b**(S(1)/3)*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/(e*(m + S(1))*(m + S(2))*((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d)) + b**(S(1)/3)*p*(d + e*x)**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/(e*(m + S(1))*(m + S(2))*(-a**(S(1)/3)*e + b**(S(1)/3)*d)) + (d + e*x)**(m + S(1))*log(c*(a + b*x**S(3))**p)/(e*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*log(c*(a + b*x**S(3))**p), x), x, a**(S(1)/3)*p*(-S(6)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e - a*e**S(3) + S(4)*b*d**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(4)*b**(S(4)/3)) - a**(S(1)/3)*p*(-S(6)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e - a*e**S(3) + S(4)*b*d**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(8)*b**(S(4)/3)) - sqrt(S(3))*a**(S(1)/3)*p*(S(6)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e - a*e**S(3) + S(4)*b*d**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(4)*b**(S(4)/3)) - S(9)*d**S(2)*e*p*x**S(2)/S(4) - d*e**S(2)*p*x**S(3) - S(3)*e**S(3)*p*x**S(4)/S(16) + (d + e*x)**S(4)*log(c*(a + b*x**S(3))**p)/(S(4)*e) - d*p*(-S(4)*a*e**S(3) + b*d**S(3))*log(a + b*x**S(3))/(S(4)*b*e) + p*x*(S(3)*a*e**S(3)/S(4) - S(3)*b*d**S(3))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)*log(c*(a + b*x**S(3))**p), x), x, a**(S(1)/3)*d*p*(-a**(S(1)/3)*e + b**(S(1)/3)*d)*log(a**(S(1)/3) + b**(S(1)/3)*x)/b**(S(2)/3) - a**(S(1)/3)*d*p*(-a**(S(1)/3)*e + b**(S(1)/3)*d)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(2)/3)) - sqrt(S(3))*a**(S(1)/3)*d*p*(a**(S(1)/3)*e + b**(S(1)/3)*d)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/b**(S(2)/3) - S(3)*d**S(2)*p*x - S(3)*d*e*p*x**S(2)/S(2) - e**S(2)*p*x**S(3)/S(3) + (d + e*x)**S(3)*log(c*(a + b*x**S(3))**p)/(S(3)*e) - p*(-a*e**S(3)/S(3) + b*d**S(3)/S(3))*log(a + b*x**S(3))/(b*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*log(c*(a + b*x**S(3))**p), x), x, a**(S(1)/3)*p*(-a**(S(1)/3)*e + S(2)*b**(S(1)/3)*d)*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*b**(S(2)/3)) - a**(S(1)/3)*p*(-a**(S(1)/3)*e + S(2)*b**(S(1)/3)*d)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*b**(S(2)/3)) - sqrt(S(3))*a**(S(1)/3)*p*(a**(S(1)/3)*e + S(2)*b**(S(1)/3)*d)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*b**(S(2)/3)) - d**S(2)*p*log(a + b*x**S(3))/(S(2)*e) - S(3)*d*p*x - S(3)*e*p*x**S(2)/S(4) + (d + e*x)**S(2)*log(c*(a + b*x**S(3))**p)/(S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p), x), x, a**(S(1)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/b**(S(1)/3) - a**(S(1)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(1)/3)) - sqrt(S(3))*a**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/b**(S(1)/3) - S(3)*p*x + x*log(c*(a + b*x**S(3))**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(d + e*x), x), x, -p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e + log(c*(a + b*x**S(3))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(d + e*x)**S(2), x), x, a**(S(1)/3)*b**(S(1)/3)*p*(a**(S(1)/3)*e + b**(S(1)/3)*d)*log(a**(S(1)/3) + b**(S(1)/3)*x)/(-a*e**S(3) + b*d**S(3)) - a**(S(1)/3)*b**(S(1)/3)*p*(a**(S(1)/3)*e + b**(S(1)/3)*d)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*(-a*e**S(3) + b*d**S(3))) - sqrt(S(3))*a**(S(1)/3)*b**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(a**(S(2)/3)*e**S(2) + a**(S(1)/3)*b**(S(1)/3)*d*e + b**(S(2)/3)*d**S(2)) + b*d**S(2)*p*log(a + b*x**S(3))/(e*(-a*e**S(3) + b*d**S(3))) - S(3)*b*d**S(2)*p*log(d + e*x)/(e*(-a*e**S(3) + b*d**S(3))) - log(c*(a + b*x**S(3))**p)/(e*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(d + e*x)**S(3), x), x, -sqrt(S(3))*a**(S(1)/3)*b**(S(2)/3)*p*(-S(3)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e + a*e**S(3) + S(2)*b*d**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*(-a*e**S(3) + b*d**S(3))**S(2)) + a**(S(1)/3)*b**(S(2)/3)*p*(S(3)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e + a*e**S(3) + S(2)*b*d**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*(-a*e**S(3) + b*d**S(3))**S(2)) - a**(S(1)/3)*b**(S(2)/3)*p*(S(3)*a**(S(1)/3)*b**(S(2)/3)*d**S(2)*e + a*e**S(3) + S(2)*b*d**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*(-a*e**S(3) + b*d**S(3))**S(2)) + S(3)*b*d**S(2)*p/(S(2)*e*(d + e*x)*(-a*e**S(3) + b*d**S(3))) + b*d*p*(S(2)*a*e**S(3) + b*d**S(3))*log(a + b*x**S(3))/(S(2)*e*(-a*e**S(3) + b*d**S(3))**S(2)) - S(3)*b*d*p*(S(2)*a*e**S(3) + b*d**S(3))*log(d + e*x)/(S(2)*e*(-a*e**S(3) + b*d**S(3))**S(2)) - log(c*(a + b*x**S(3))**p)/(S(2)*e*(d + e*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b/x)/(c + d*x), x), x, log(-d*x/c)*log(c + d*x)/d - log(-d*(a*x + b)/(a*c - b*d))*log(c + d*x)/d + log(a + b/x)*log(c + d*x)/d + polylog(S(2), (c + d*x)/c)/d - polylog(S(2), a*(c + d*x)/(a*c - b*d))/d, expand=True, _diff=True, _numerical=True) # recursion sympy and mathematica assert rubi_test(rubi_integrate(log(a + b*x**n)/(c + d*x), x), x, -b*n*Integral(x**(n + S(-1))*log(c + d*x)/(a + b*x**n), x)/d + log(a + b*x**n)*log(c + d*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x)/(c + d*x), x), x, log(a*x)*log((c + d*x)/c)/d + polylog(S(2), -d*x/c)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a/x)/(c + d*x), x), x, log(a/x)*log((c + d*x)/c)/d - polylog(S(2), -d*x/c)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*x**n)/(c + d*x), x), x, n*polylog(S(2), -d*x/c)/d + log(a*x**n)*log((c + d*x)/c)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**n)/(a + b*x), x), x, n*polylog(S(2), -b*x/a)/b + log(x**n)*log((a + b*x)/a)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x)**p)/(d + e*x), x), x, a**S(3)*p*log(a + b*x)/(S(3)*b**S(3)*e) + a**S(2)*d*p*log(a + b*x)/(S(2)*b**S(2)*e**S(2)) - a**S(2)*p*x/(S(3)*b**S(2)*e) - a*d*p*x/(S(2)*b*e**S(2)) + a*p*x**S(2)/(S(6)*b*e) - d**S(3)*p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/e**S(4) - d**S(3)*log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/e**S(4) - d**S(2)*p*x/e**S(3) + d*p*x**S(2)/(S(4)*e**S(2)) - d*x**S(2)*log(c*(a + b*x)**p)/(S(2)*e**S(2)) - p*x**S(3)/(S(9)*e) + x**S(3)*log(c*(a + b*x)**p)/(S(3)*e) + d**S(2)*(a + b*x)*log(c*(a + b*x)**p)/(b*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x)**p)/(d + e*x), x), x, -a**S(2)*p*log(a + b*x)/(S(2)*b**S(2)*e) + a*p*x/(S(2)*b*e) + d**S(2)*p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/e**S(3) + d**S(2)*log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/e**S(3) + d*p*x/e**S(2) - p*x**S(2)/(S(4)*e) + x**S(2)*log(c*(a + b*x)**p)/(S(2)*e) - d*(a + b*x)*log(c*(a + b*x)**p)/(b*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x)**p)/(d + e*x), x), x, -d*p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/e**S(2) - d*log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/e**S(2) - p*x/e + (a + b*x)*log(c*(a + b*x)**p)/(b*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(d + e*x), x), x, p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/e + log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(x*(d + e*x)), x), x, p*polylog(S(2), (a + b*x)/a)/d - p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d + log(c*(a + b*x)**p)*log(-b*x/a)/d - log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(x**S(2)*(d + e*x)), x), x, -log(c*(a + b*x)**p)/(d*x) - e*p*polylog(S(2), (a + b*x)/a)/d**S(2) + e*p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d**S(2) - e*log(c*(a + b*x)**p)*log(-b*x/a)/d**S(2) + e*log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/d**S(2) + b*p*log(x)/(a*d) - b*p*log(a + b*x)/(a*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x)**p)/(x**S(3)*(d + e*x)), x), x, -log(c*(a + b*x)**p)/(S(2)*d*x**S(2)) + e*log(c*(a + b*x)**p)/(d**S(2)*x) + e**S(2)*p*polylog(S(2), (a + b*x)/a)/d**S(3) - e**S(2)*p*polylog(S(2), -e*(a + b*x)/(-a*e + b*d))/d**S(3) + e**S(2)*log(c*(a + b*x)**p)*log(-b*x/a)/d**S(3) - e**S(2)*log(c*(a + b*x)**p)*log(b*(d + e*x)/(-a*e + b*d))/d**S(3) - b*p/(S(2)*a*d*x) - b*e*p*log(x)/(a*d**S(2)) + b*e*p*log(a + b*x)/(a*d**S(2)) - b**S(2)*p*log(x)/(S(2)*a**S(2)*d) + b**S(2)*p*log(a + b*x)/(S(2)*a**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(2))**p)/(d + e*x), x), x, -S(2)*a**(S(3)/2)*p*atan(sqrt(b)*x/sqrt(a))/(S(3)*b**(S(3)/2)*e) + S(2)*sqrt(a)*d**S(2)*p*atan(sqrt(b)*x/sqrt(a))/(sqrt(b)*e**S(3)) + S(2)*a*p*x/(S(3)*b*e) + d**S(3)*p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/e**S(4) + d**S(3)*p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/e**S(4) + d**S(3)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/e**S(4) + d**S(3)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/e**S(4) - d**S(3)*log(c*(a + b*x**S(2))**p)*log(d + e*x)/e**S(4) - S(2)*d**S(2)*p*x/e**S(3) + d**S(2)*x*log(c*(a + b*x**S(2))**p)/e**S(3) + d*p*x**S(2)/(S(2)*e**S(2)) - S(2)*p*x**S(3)/(S(9)*e) + x**S(3)*log(c*(a + b*x**S(2))**p)/(S(3)*e) - d*(a + b*x**S(2))*log(c*(a + b*x**S(2))**p)/(S(2)*b*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**S(2))**p)/(d + e*x), x), x, -S(2)*sqrt(a)*d*p*atan(sqrt(b)*x/sqrt(a))/(sqrt(b)*e**S(2)) - d**S(2)*p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/e**S(3) - d**S(2)*p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/e**S(3) - d**S(2)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/e**S(3) - d**S(2)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/e**S(3) + d**S(2)*log(c*(a + b*x**S(2))**p)*log(d + e*x)/e**S(3) + S(2)*d*p*x/e**S(2) - d*x*log(c*(a + b*x**S(2))**p)/e**S(2) - p*x**S(2)/(S(2)*e) + (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**p)/(b*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(2))**p)/(d + e*x), x), x, S(2)*sqrt(a)*p*atan(sqrt(b)*x/sqrt(a))/(sqrt(b)*e) + d*p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/e**S(2) + d*p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/e**S(2) + d*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/e**S(2) + d*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/e**S(2) - d*log(c*(a + b*x**S(2))**p)*log(d + e*x)/e**S(2) - S(2)*p*x/e + x*log(c*(a + b*x**S(2))**p)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(d + e*x), x), x, -p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/e - p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/e - p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/e - p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/e + log(c*(a + b*x**S(2))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(x*(d + e*x)), x), x, p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/d + p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/d + p*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*d) + p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/d + p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/d + log(c*(a + b*x**S(2))**p)*log(-b*x**S(2)/a)/(S(2)*d) - log(c*(a + b*x**S(2))**p)*log(d + e*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(x**S(2)*(d + e*x)), x), x, -log(c*(a + b*x**S(2))**p)/(d*x) - e*p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/d**S(2) - e*p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/d**S(2) - e*p*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*d**S(2)) - e*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/d**S(2) - e*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/d**S(2) - e*log(c*(a + b*x**S(2))**p)*log(-b*x**S(2)/a)/(S(2)*d**S(2)) + e*log(c*(a + b*x**S(2))**p)*log(d + e*x)/d**S(2) + S(2)*sqrt(b)*p*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**p)/(x**S(3)*(d + e*x)), x), x, -log(c*(a + b*x**S(2))**p)/(S(2)*d*x**S(2)) + e*log(c*(a + b*x**S(2))**p)/(d**S(2)*x) + e**S(2)*p*log(-e*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*d - e*sqrt(-a)))*log(d + e*x)/d**S(3) + e**S(2)*p*log(e*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*d + e*sqrt(-a)))*log(d + e*x)/d**S(3) + e**S(2)*p*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*d**S(3)) + e**S(2)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d - e*sqrt(-a)))/d**S(3) + e**S(2)*p*polylog(S(2), sqrt(b)*(d + e*x)/(sqrt(b)*d + e*sqrt(-a)))/d**S(3) + e**S(2)*log(c*(a + b*x**S(2))**p)*log(-b*x**S(2)/a)/(S(2)*d**S(3)) - e**S(2)*log(c*(a + b*x**S(2))**p)*log(d + e*x)/d**S(3) + b*p*log(x)/(a*d) - b*p*log(a + b*x**S(2))/(S(2)*a*d) - S(2)*sqrt(b)*e*p*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(3))**p)/(d + e*x), x), x, a**(S(2)/3)*d*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*b**(S(2)/3)*e**S(2)) - a**(S(2)/3)*d*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*b**(S(2)/3)*e**S(2)) + sqrt(S(3))*a**(S(2)/3)*d*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*b**(S(2)/3)*e**S(2)) + a**(S(1)/3)*d**S(2)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(b**(S(1)/3)*e**S(3)) - a**(S(1)/3)*d**S(2)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(1)/3)*e**S(3)) - sqrt(S(3))*a**(S(1)/3)*d**S(2)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(b**(S(1)/3)*e**S(3)) + d**S(3)*p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(4) + d**S(3)*p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(4) + d**S(3)*p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(4) + d**S(3)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(4) + d**S(3)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(4) + d**S(3)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(4) - d**S(3)*log(c*(a + b*x**S(3))**p)*log(d + e*x)/e**S(4) - S(3)*d**S(2)*p*x/e**S(3) + d**S(2)*x*log(c*(a + b*x**S(3))**p)/e**S(3) + S(3)*d*p*x**S(2)/(S(4)*e**S(2)) - d*x**S(2)*log(c*(a + b*x**S(3))**p)/(S(2)*e**S(2)) - p*x**S(3)/(S(3)*e) + (a/S(3) + b*x**S(3)/S(3))*log(c*(a + b*x**S(3))**p)/(b*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**S(3))**p)/(d + e*x), x), x, -a**(S(2)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*b**(S(2)/3)*e) + a**(S(2)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*b**(S(2)/3)*e) - sqrt(S(3))*a**(S(2)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*b**(S(2)/3)*e) - a**(S(1)/3)*d*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(b**(S(1)/3)*e**S(2)) + a**(S(1)/3)*d*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(1)/3)*e**S(2)) + sqrt(S(3))*a**(S(1)/3)*d*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(b**(S(1)/3)*e**S(2)) - d**S(2)*p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(3) - d**S(2)*p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(3) - d**S(2)*p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(3) - d**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(3) - d**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(3) - d**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(3) + d**S(2)*log(c*(a + b*x**S(3))**p)*log(d + e*x)/e**S(3) + S(3)*d*p*x/e**S(2) - d*x*log(c*(a + b*x**S(3))**p)/e**S(2) - S(3)*p*x**S(2)/(S(4)*e) + x**S(2)*log(c*(a + b*x**S(3))**p)/(S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(3))**p)/(d + e*x), x), x, a**(S(1)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(b**(S(1)/3)*e) - a**(S(1)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*b**(S(1)/3)*e) - sqrt(S(3))*a**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(b**(S(1)/3)*e) + d*p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(2) + d*p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(2) + d*p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e**S(2) + d*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(2) + d*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(2) + d*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e**S(2) - d*log(c*(a + b*x**S(3))**p)*log(d + e*x)/e**S(2) - S(3)*p*x/e + x*log(c*(a + b*x**S(3))**p)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(d + e*x), x), x, -p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e - p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/e + log(c*(a + b*x**S(3))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(x*(d + e*x)), x), x, p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d + p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d + p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d + p*polylog(S(2), (a + b*x**S(3))/a)/(S(3)*d) + p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/d + p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d + p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d + log(c*(a + b*x**S(3))**p)*log(-b*x**S(3)/a)/(S(3)*d) - log(c*(a + b*x**S(3))**p)*log(d + e*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(x**S(2)*(d + e*x)), x), x, -log(c*(a + b*x**S(3))**p)/(d*x) - e*p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(2) - e*p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(2) - e*p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(2) - e*p*polylog(S(2), (a + b*x**S(3))/a)/(S(3)*d**S(2)) - e*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(2) - e*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(2) - e*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(2) - e*log(c*(a + b*x**S(3))**p)*log(-b*x**S(3)/a)/(S(3)*d**S(2)) + e*log(c*(a + b*x**S(3))**p)*log(d + e*x)/d**S(2) - b**(S(1)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(a**(S(1)/3)*d) + b**(S(1)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*a**(S(1)/3)*d) - sqrt(S(3))*b**(S(1)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(a**(S(1)/3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(3))**p)/(x**S(3)*(d + e*x)), x), x, -log(c*(a + b*x**S(3))**p)/(S(2)*d*x**S(2)) + e*log(c*(a + b*x**S(3))**p)/(d**S(2)*x) + e**S(2)*p*log(-e*(a**(S(1)/3) + b**(S(1)/3)*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(3) + e**S(2)*p*log(-e*((S(-1))**(S(2)/3)*a**(S(1)/3) + b**(S(1)/3)*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(3) + e**S(2)*p*log((S(-1))**(S(1)/3)*e*(a**(S(1)/3) + (S(-1))**(S(2)/3)*b**(S(1)/3)*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))*log(d + e*x)/d**S(3) + e**S(2)*p*polylog(S(2), (a + b*x**S(3))/a)/(S(3)*d**S(3)) + e**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(3) + e**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(3) + e**S(2)*p*polylog(S(2), b**(S(1)/3)*(d + e*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*e + b**(S(1)/3)*d))/d**S(3) + e**S(2)*log(c*(a + b*x**S(3))**p)*log(-b*x**S(3)/a)/(S(3)*d**S(3)) - e**S(2)*log(c*(a + b*x**S(3))**p)*log(d + e*x)/d**S(3) + b**(S(1)/3)*e*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(a**(S(1)/3)*d**S(2)) - b**(S(1)/3)*e*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(2)*a**(S(1)/3)*d**S(2)) + sqrt(S(3))*b**(S(1)/3)*e*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(a**(S(1)/3)*d**S(2)) + b**(S(2)/3)*p*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(2)*a**(S(2)/3)*d) - b**(S(2)/3)*p*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(4)*a**(S(2)/3)*d) - sqrt(S(3))*b**(S(2)/3)*p*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(2)*a**(S(2)/3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b/x)**p)/(d + e*x), x), x, -d**S(3)*p*log(-e*x/d)*log(d + e*x)/e**S(4) + d**S(3)*p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/e**S(4) - d**S(3)*p*polylog(S(2), (d + e*x)/d)/e**S(4) + d**S(3)*p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/e**S(4) - d**S(3)*log(c*(a + b/x)**p)*log(d + e*x)/e**S(4) + d**S(2)*x*log(c*(a + b/x)**p)/e**S(3) - d*x**S(2)*log(c*(a + b/x)**p)/(S(2)*e**S(2)) + x**S(3)*log(c*(a + b/x)**p)/(S(3)*e) + b*d**S(2)*p*log(a*x + b)/(a*e**S(3)) - b*d*p*x/(S(2)*a*e**S(2)) + b*p*x**S(2)/(S(6)*a*e) + b**S(2)*d*p*log(a*x + b)/(S(2)*a**S(2)*e**S(2)) - b**S(2)*p*x/(S(3)*a**S(2)*e) + b**S(3)*p*log(a*x + b)/(S(3)*a**S(3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b/x)**p)/(d + e*x), x), x, d**S(2)*p*log(-e*x/d)*log(d + e*x)/e**S(3) - d**S(2)*p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/e**S(3) + d**S(2)*p*polylog(S(2), (d + e*x)/d)/e**S(3) - d**S(2)*p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/e**S(3) + d**S(2)*log(c*(a + b/x)**p)*log(d + e*x)/e**S(3) - d*x*log(c*(a + b/x)**p)/e**S(2) + x**S(2)*log(c*(a + b/x)**p)/(S(2)*e) - b*d*p*log(a*x + b)/(a*e**S(2)) + b*p*x/(S(2)*a*e) - b**S(2)*p*log(a*x + b)/(S(2)*a**S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b/x)**p)/(d + e*x), x), x, -d*p*log(-e*x/d)*log(d + e*x)/e**S(2) + d*p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/e**S(2) - d*p*polylog(S(2), (d + e*x)/d)/e**S(2) + d*p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/e**S(2) - d*log(c*(a + b/x)**p)*log(d + e*x)/e**S(2) + x*log(c*(a + b/x)**p)/e + b*p*log(a*x + b)/(a*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/(d + e*x), x), x, p*log(-e*x/d)*log(d + e*x)/e - p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/e + p*polylog(S(2), (d + e*x)/d)/e - p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/e + log(c*(a + b/x)**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/(x*(d + e*x)), x), x, -p*log(-e*x/d)*log(d + e*x)/d + p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/d - p*polylog(S(2), (a + b/x)/a)/d - p*polylog(S(2), (d + e*x)/d)/d + p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/d - log(c*(a + b/x)**p)*log(-b/(a*x))/d - log(c*(a + b/x)**p)*log(d + e*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/(x**S(2)*(d + e*x)), x), x, p/(d*x) + e*p*log(-e*x/d)*log(d + e*x)/d**S(2) - e*p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/d**S(2) + e*p*polylog(S(2), (a + b/x)/a)/d**S(2) + e*p*polylog(S(2), (d + e*x)/d)/d**S(2) - e*p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/d**S(2) + e*log(c*(a + b/x)**p)*log(-b/(a*x))/d**S(2) + e*log(c*(a + b/x)**p)*log(d + e*x)/d**S(2) - (a + b/x)*log(c*(a + b/x)**p)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x)**p)/(x**S(3)*(d + e*x)), x), x, -a**S(2)*p*log(x)/(S(2)*b**S(2)*d) + a**S(2)*p*log(a*x + b)/(S(2)*b**S(2)*d) - a*p/(S(2)*b*d*x) + p/(S(4)*d*x**S(2)) - log(c*(a + b/x)**p)/(S(2)*d*x**S(2)) - e*p/(d**S(2)*x) - e**S(2)*p*log(-e*x/d)*log(d + e*x)/d**S(3) + e**S(2)*p*log(-e*(a*x + b)/(a*d - b*e))*log(d + e*x)/d**S(3) - e**S(2)*p*polylog(S(2), (a + b/x)/a)/d**S(3) - e**S(2)*p*polylog(S(2), (d + e*x)/d)/d**S(3) + e**S(2)*p*polylog(S(2), a*(d + e*x)/(a*d - b*e))/d**S(3) - e**S(2)*log(c*(a + b/x)**p)*log(-b/(a*x))/d**S(3) - e**S(2)*log(c*(a + b/x)**p)*log(d + e*x)/d**S(3) + e*(a + b/x)*log(c*(a + b/x)**p)/(b*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b/x**S(2))**p)/(d + e*x), x), x, -S(2)*d**S(3)*p*log(-e*x/d)*log(d + e*x)/e**S(4) + d**S(3)*p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(4) + d**S(3)*p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(4) - S(2)*d**S(3)*p*polylog(S(2), (d + e*x)/d)/e**S(4) + d**S(3)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/e**S(4) + d**S(3)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/e**S(4) - d**S(3)*log(c*(a + b/x**S(2))**p)*log(d + e*x)/e**S(4) + d**S(2)*x*log(c*(a + b/x**S(2))**p)/e**S(3) - d*x**S(2)*log(c*(a + b/x**S(2))**p)/(S(2)*e**S(2)) + x**S(3)*log(c*(a + b/x**S(2))**p)/(S(3)*e) - b*d*p*log(a*x**S(2) + b)/(S(2)*a*e**S(2)) + S(2)*b*p*x/(S(3)*a*e) + S(2)*sqrt(b)*d**S(2)*p*atan(sqrt(a)*x/sqrt(b))/(sqrt(a)*e**S(3)) - S(2)*b**(S(3)/2)*p*atan(sqrt(a)*x/sqrt(b))/(S(3)*a**(S(3)/2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b/x**S(2))**p)/(d + e*x), x), x, S(2)*d**S(2)*p*log(-e*x/d)*log(d + e*x)/e**S(3) - d**S(2)*p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(3) - d**S(2)*p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(3) + S(2)*d**S(2)*p*polylog(S(2), (d + e*x)/d)/e**S(3) - d**S(2)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/e**S(3) - d**S(2)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/e**S(3) + d**S(2)*log(c*(a + b/x**S(2))**p)*log(d + e*x)/e**S(3) - d*x*log(c*(a + b/x**S(2))**p)/e**S(2) + x**S(2)*log(c*(a + b/x**S(2))**p)/(S(2)*e) + b*p*log(a*x**S(2) + b)/(S(2)*a*e) - S(2)*sqrt(b)*d*p*atan(sqrt(a)*x/sqrt(b))/(sqrt(a)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b/x**S(2))**p)/(d + e*x), x), x, -S(2)*d*p*log(-e*x/d)*log(d + e*x)/e**S(2) + d*p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(2) + d*p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e**S(2) - S(2)*d*p*polylog(S(2), (d + e*x)/d)/e**S(2) + d*p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/e**S(2) + d*p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/e**S(2) - d*log(c*(a + b/x**S(2))**p)*log(d + e*x)/e**S(2) + x*log(c*(a + b/x**S(2))**p)/e + S(2)*sqrt(b)*p*atan(sqrt(a)*x/sqrt(b))/(sqrt(a)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/(d + e*x), x), x, S(2)*p*log(-e*x/d)*log(d + e*x)/e - p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e - p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/e + S(2)*p*polylog(S(2), (d + e*x)/d)/e - p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/e - p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/e + log(c*(a + b/x**S(2))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/(x*(d + e*x)), x), x, -S(2)*p*log(-e*x/d)*log(d + e*x)/d + p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d + p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d - p*polylog(S(2), (a + b/x**S(2))/a)/(S(2)*d) - S(2)*p*polylog(S(2), (d + e*x)/d)/d + p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/d + p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/d - log(c*(a + b/x**S(2))**p)*log(-b/(a*x**S(2)))/(S(2)*d) - log(c*(a + b/x**S(2))**p)*log(d + e*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/(x**S(2)*(d + e*x)), x), x, S(2)*sqrt(a)*p*atan(sqrt(a)*x/sqrt(b))/(sqrt(b)*d) + S(2)*p/(d*x) - log(c*(a + b/x**S(2))**p)/(d*x) + S(2)*e*p*log(-e*x/d)*log(d + e*x)/d**S(2) - e*p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d**S(2) - e*p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d**S(2) + e*p*polylog(S(2), (a + b/x**S(2))/a)/(S(2)*d**S(2)) + S(2)*e*p*polylog(S(2), (d + e*x)/d)/d**S(2) - e*p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/d**S(2) - e*p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/d**S(2) + e*log(c*(a + b/x**S(2))**p)*log(-b/(a*x**S(2)))/(S(2)*d**S(2)) + e*log(c*(a + b/x**S(2))**p)*log(d + e*x)/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(2))**p)/(x**S(3)*(d + e*x)), x), x, -S(2)*sqrt(a)*e*p*atan(sqrt(a)*x/sqrt(b))/(sqrt(b)*d**S(2)) + p/(S(2)*d*x**S(2)) - S(2)*e*p/(d**S(2)*x) + e*log(c*(a + b/x**S(2))**p)/(d**S(2)*x) - S(2)*e**S(2)*p*log(-e*x/d)*log(d + e*x)/d**S(3) + e**S(2)*p*log(e*(sqrt(b) - x*sqrt(-a))/(sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d**S(3) + e**S(2)*p*log(-e*(sqrt(b) + x*sqrt(-a))/(-sqrt(b)*e + d*sqrt(-a)))*log(d + e*x)/d**S(3) - e**S(2)*p*polylog(S(2), (a + b/x**S(2))/a)/(S(2)*d**S(3)) - S(2)*e**S(2)*p*polylog(S(2), (d + e*x)/d)/d**S(3) + e**S(2)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(-sqrt(b)*e + d*sqrt(-a)))/d**S(3) + e**S(2)*p*polylog(S(2), sqrt(-a)*(d + e*x)/(sqrt(b)*e + d*sqrt(-a)))/d**S(3) - e**S(2)*log(c*(a + b/x**S(2))**p)*log(-b/(a*x**S(2)))/(S(2)*d**S(3)) - e**S(2)*log(c*(a + b/x**S(2))**p)*log(d + e*x)/d**S(3) - (a/S(2) + b/(S(2)*x**S(2)))*log(c*(a + b/x**S(2))**p)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b/x**S(3))**p)/(d + e*x), x), x, -S(3)*d**S(3)*p*log(-e*x/d)*log(d + e*x)/e**S(4) + d**S(3)*p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/e**S(4) + d**S(3)*p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(4) + d**S(3)*p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(4) - S(3)*d**S(3)*p*polylog(S(2), (d + e*x)/d)/e**S(4) + d**S(3)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/e**S(4) + d**S(3)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/e**S(4) + d**S(3)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/e**S(4) - d**S(3)*log(c*(a + b/x**S(3))**p)*log(d + e*x)/e**S(4) + d**S(2)*x*log(c*(a + b/x**S(3))**p)/e**S(3) - d*x**S(2)*log(c*(a + b/x**S(3))**p)/(S(2)*e**S(2)) + x**S(3)*log(c*(a + b/x**S(3))**p)/(S(3)*e) + b*p*log(a*x**S(3) + b)/(S(3)*a*e) + b**(S(1)/3)*d**S(2)*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*e**S(3)) - b**(S(1)/3)*d**S(2)*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(2)*a**(S(1)/3)*e**S(3)) - sqrt(S(3))*b**(S(1)/3)*d**S(2)*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(a**(S(1)/3)*e**S(3)) + b**(S(2)/3)*d*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(S(2)*a**(S(2)/3)*e**S(2)) - b**(S(2)/3)*d*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(4)*a**(S(2)/3)*e**S(2)) + sqrt(S(3))*b**(S(2)/3)*d*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(2)*a**(S(2)/3)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b/x**S(3))**p)/(d + e*x), x), x, S(3)*d**S(2)*p*log(-e*x/d)*log(d + e*x)/e**S(3) - d**S(2)*p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/e**S(3) - d**S(2)*p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(3) - d**S(2)*p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(3) + S(3)*d**S(2)*p*polylog(S(2), (d + e*x)/d)/e**S(3) - d**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/e**S(3) - d**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/e**S(3) - d**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/e**S(3) + d**S(2)*log(c*(a + b/x**S(3))**p)*log(d + e*x)/e**S(3) - d*x*log(c*(a + b/x**S(3))**p)/e**S(2) + x**S(2)*log(c*(a + b/x**S(3))**p)/(S(2)*e) - b**(S(1)/3)*d*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*e**S(2)) + b**(S(1)/3)*d*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(2)*a**(S(1)/3)*e**S(2)) + sqrt(S(3))*b**(S(1)/3)*d*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(a**(S(1)/3)*e**S(2)) - b**(S(2)/3)*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(S(2)*a**(S(2)/3)*e) + b**(S(2)/3)*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(4)*a**(S(2)/3)*e) - sqrt(S(3))*b**(S(2)/3)*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(2)*a**(S(2)/3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b/x**S(3))**p)/(d + e*x), x), x, -S(3)*d*p*log(-e*x/d)*log(d + e*x)/e**S(2) + d*p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/e**S(2) + d*p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(2) + d*p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/e**S(2) - S(3)*d*p*polylog(S(2), (d + e*x)/d)/e**S(2) + d*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/e**S(2) + d*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/e**S(2) + d*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/e**S(2) - d*log(c*(a + b/x**S(3))**p)*log(d + e*x)/e**S(2) + x*log(c*(a + b/x**S(3))**p)/e + b**(S(1)/3)*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*e) - b**(S(1)/3)*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(2)*a**(S(1)/3)*e) - sqrt(S(3))*b**(S(1)/3)*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(a**(S(1)/3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(3))**p)/(d + e*x), x), x, S(3)*p*log(-e*x/d)*log(d + e*x)/e - p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/e - p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/e - p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/e + S(3)*p*polylog(S(2), (d + e*x)/d)/e - p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/e - p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/e - p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/e + log(c*(a + b/x**S(3))**p)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(3))**p)/(x*(d + e*x)), x), x, -S(3)*p*log(-e*x/d)*log(d + e*x)/d + p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/d + p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/d + p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/d - p*polylog(S(2), (a + b/x**S(3))/a)/(S(3)*d) - S(3)*p*polylog(S(2), (d + e*x)/d)/d + p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/d + p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/d + p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/d - log(c*(a + b/x**S(3))**p)*log(-b/(a*x**S(3)))/(S(3)*d) - log(c*(a + b/x**S(3))**p)*log(d + e*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(3))**p)/(x**S(2)*(d + e*x)), x), x, -a**(S(1)/3)*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(b**(S(1)/3)*d) + a**(S(1)/3)*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(2)*b**(S(1)/3)*d) - sqrt(S(3))*a**(S(1)/3)*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(b**(S(1)/3)*d) + S(3)*p/(d*x) - log(c*(a + b/x**S(3))**p)/(d*x) + S(3)*e*p*log(-e*x/d)*log(d + e*x)/d**S(2) - e*p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/d**S(2) - e*p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/d**S(2) - e*p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/d**S(2) + e*p*polylog(S(2), (a + b/x**S(3))/a)/(S(3)*d**S(2)) + S(3)*e*p*polylog(S(2), (d + e*x)/d)/d**S(2) - e*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/d**S(2) - e*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/d**S(2) - e*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/d**S(2) + e*log(c*(a + b/x**S(3))**p)*log(-b/(a*x**S(3)))/(S(3)*d**S(2)) + e*log(c*(a + b/x**S(3))**p)*log(d + e*x)/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b/x**S(3))**p)/(x**S(3)*(d + e*x)), x), x, a**(S(2)/3)*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(S(2)*b**(S(2)/3)*d) - a**(S(2)/3)*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(4)*b**(S(2)/3)*d) - sqrt(S(3))*a**(S(2)/3)*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(2)*b**(S(2)/3)*d) + a**(S(1)/3)*e*p*log(a**(S(1)/3)*x + b**(S(1)/3))/(b**(S(1)/3)*d**S(2)) - a**(S(1)/3)*e*p*log(a**(S(2)/3)*x**S(2) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3))/(S(2)*b**(S(1)/3)*d**S(2)) + sqrt(S(3))*a**(S(1)/3)*e*p*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*x + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(b**(S(1)/3)*d**S(2)) + S(3)*p/(S(4)*d*x**S(2)) - log(c*(a + b/x**S(3))**p)/(S(2)*d*x**S(2)) - S(3)*e*p/(d**S(2)*x) + e*log(c*(a + b/x**S(3))**p)/(d**S(2)*x) - S(3)*e**S(2)*p*log(-e*x/d)*log(d + e*x)/d**S(3) + e**S(2)*p*log(-e*(a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d - b**(S(1)/3)*e))*log(d + e*x)/d**S(3) + e**S(2)*p*log(-e*(a**(S(1)/3)*x + (S(-1))**(S(2)/3)*b**(S(1)/3))/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))*log(d + e*x)/d**S(3) + e**S(2)*p*log((S(-1))**(S(1)/3)*e*((S(-1))**(S(2)/3)*a**(S(1)/3)*x + b**(S(1)/3))/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))*log(d + e*x)/d**S(3) - e**S(2)*p*polylog(S(2), (a + b/x**S(3))/a)/(S(3)*d**S(3)) - S(3)*e**S(2)*p*polylog(S(2), (d + e*x)/d)/d**S(3) + e**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - b**(S(1)/3)*e))/d**S(3) + e**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/d**S(3) + e**S(2)*p*polylog(S(2), a**(S(1)/3)*(d + e*x)/(a**(S(1)/3)*d - (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/d**S(3) - e**S(2)*log(c*(a + b/x**S(3))**p)*log(-b/(a*x**S(3)))/(S(3)*d**S(3)) - e**S(2)*log(c*(a + b/x**S(3))**p)*log(d + e*x)/d**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d + e*x**S(2))/(-x**S(2) + S(1)), x), x, log((-sqrt(e)*x + sqrt(-d))/(-sqrt(e) + sqrt(-d)))*log(-x + S(1))/S(2) - log((sqrt(e)*x + sqrt(-d))/(-sqrt(e) + sqrt(-d)))*log(x + S(1))/S(2) - log((-sqrt(e)*x + sqrt(-d))/(sqrt(e) + sqrt(-d)))*log(x + S(1))/S(2) + log((sqrt(e)*x + sqrt(-d))/(sqrt(e) + sqrt(-d)))*log(-x + S(1))/S(2) + log(d + e*x**S(2))*atanh(x) - polylog(S(2), sqrt(e)*(-x + S(-1))/(-sqrt(e) + sqrt(-d)))/S(2) + polylog(S(2), sqrt(e)*(x + S(-1))/(-sqrt(e) + sqrt(-d)))/S(2) + polylog(S(2), sqrt(e)*(-x + S(1))/(sqrt(e) + sqrt(-d)))/S(2) - polylog(S(2), sqrt(e)*(x + S(1))/(sqrt(e) + sqrt(-d)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d + e*x**S(2))/(a + b*x**S(2)), x), x, I*log(sqrt(b)*(-sqrt(e)*x + sqrt(-d))/(-I*sqrt(a)*sqrt(e) + sqrt(b)*sqrt(-d)))*log(S(1) + I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) - I*log(sqrt(b)*(-sqrt(e)*x + sqrt(-d))/(I*sqrt(a)*sqrt(e) + sqrt(b)*sqrt(-d)))*log(S(1) - I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) - I*log(sqrt(b)*(sqrt(e)*x + sqrt(-d))/(-I*sqrt(a)*sqrt(e) + sqrt(b)*sqrt(-d)))*log(S(1) - I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) + I*log(sqrt(b)*(sqrt(e)*x + sqrt(-d))/(I*sqrt(a)*sqrt(e) + sqrt(b)*sqrt(-d)))*log(S(1) + I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) + log(d + e*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)) + I*polylog(S(2), sqrt(e)*(-sqrt(a) - I*sqrt(b)*x)/(-sqrt(a)*sqrt(e) + I*sqrt(b)*sqrt(-d)))/(S(2)*sqrt(a)*sqrt(b)) - I*polylog(S(2), sqrt(e)*(-sqrt(a) + I*sqrt(b)*x)/(-sqrt(a)*sqrt(e) + I*sqrt(b)*sqrt(-d)))/(S(2)*sqrt(a)*sqrt(b)) - I*polylog(S(2), sqrt(e)*(sqrt(a) - I*sqrt(b)*x)/(sqrt(a)*sqrt(e) + I*sqrt(b)*sqrt(-d)))/(S(2)*sqrt(a)*sqrt(b)) + I*polylog(S(2), sqrt(e)*(sqrt(a) + I*sqrt(b)*x)/(sqrt(a)*sqrt(e) + I*sqrt(b)*sqrt(-d)))/(S(2)*sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-x**S(2) + S(1))/(-x**S(2) + S(2)), x), x, sqrt(S(2))*log(-x**S(2) + S(1))*atanh(sqrt(S(2))*x/S(2))/S(2) - sqrt(S(2))*log(-S(2)*sqrt(S(2)) + S(3))*atanh(x)/S(2) + sqrt(S(2))*polylog(S(2), sqrt(S(2))*(-x + S(-1))/(-sqrt(S(2)) + S(2)))/S(4) - sqrt(S(2))*polylog(S(2), sqrt(S(2))*(x + S(-1))/(-sqrt(S(2)) + S(2)))/S(4) + sqrt(S(2))*polylog(S(2), sqrt(S(2))*(-x + S(1))/(sqrt(S(2)) + S(2)))/S(4) - sqrt(S(2))*polylog(S(2), sqrt(S(2))*(x + S(1))/(sqrt(S(2)) + S(2)))/S(4), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(log(-x**S(2) + S(1))/(-x**S(2) + S(2)), x), x, -sqrt(S(2))*log(-x + S(1))*atanh(sqrt(S(2))/S(2))/S(2) + sqrt(S(2))*log(x + S(1))*atanh(sqrt(S(2))/S(2))/S(2) + sqrt(S(2))*log(-x**S(2) + S(1))*atanh(sqrt(S(2))*x/S(2))/S(2) + sqrt(S(2))*polylog(S(2), sqrt(S(2))*(-x + S(-1))/(-sqrt(S(2)) + S(2)))/S(4) - sqrt(S(2))*polylog(S(2), sqrt(S(2))*(x + S(-1))/(-sqrt(S(2)) + S(2)))/S(4) + sqrt(S(2))*polylog(S(2), sqrt(S(2))*(-x + S(1))/(sqrt(S(2)) + S(2)))/S(4) - sqrt(S(2))*polylog(S(2), sqrt(S(2))*(x + S(1))/(sqrt(S(2)) + S(2)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(2))*log(d + e*x**S(2))/x**S(2), x), x, -a*log(d + e*x**S(2))/x + c*x*log(d + e*x**S(2)) - S(2)*c*x + (S(2)*a*e + S(2)*c*d)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + c*x**S(2))*log(d + e*x**S(2))/x**S(2), x), x, -a*log(d + e*x**S(2))/x + S(2)*a*sqrt(e)*atan(sqrt(e)*x/sqrt(d))/sqrt(d) + S(2)*c*sqrt(d)*atan(sqrt(e)*x/sqrt(d))/sqrt(e) + c*x*log(d + e*x**S(2)) - S(2)*c*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*log(c*(a + b*x**S(2))**n)**S(2), x), x, -S(5)*a**S(3)*n**S(2)*log(a + b*x**S(2))/(S(18)*b**S(3)) + a**S(3)*log(c*(a + b*x**S(2))**n)**S(2)/(S(6)*b**S(3)) + S(11)*a**S(2)*n**S(2)*x**S(2)/(S(18)*b**S(2)) - a**S(2)*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/(S(3)*b**S(3)) - S(5)*a*n**S(2)*x**S(4)/(S(36)*b) + a*n*x**S(4)*log(c*(a + b*x**S(2))**n)/(S(6)*b) + n**S(2)*x**S(6)/S(27) - n*x**S(6)*log(c*(a + b*x**S(2))**n)/S(9) + x**S(6)*log(c*(a + b*x**S(2))**n)**S(2)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(2))**n)**S(2), x), x, -S(3)*a*n**S(2)*x**S(2)/(S(4)*b) + a*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/b**S(2) - a*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(2)*b**S(2)) + n**S(2)*x**S(4)/S(8) - n*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)/(S(4)*b**S(2)) + (a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(2))**n)**S(2), x), x, n**S(2)*x**S(2) - n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/b + (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**n)**S(2)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x, x), x, -n**S(2)*polylog(S(3), (a + b*x**S(2))/a) + n*log(c*(a + b*x**S(2))**n)*polylog(S(2), (a + b*x**S(2))/a) + log(c*(a + b*x**S(2))**n)**S(2)*log(-b*x**S(2)/a)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(3), x), x, b*n**S(2)*polylog(S(2), (a + b*x**S(2))/a)/a + b*n*log(c*(a + b*x**S(2))**n)*log(-b*x**S(2)/a)/a - (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(5), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*x**S(4)) - b*n*log(c*(a + b*x**S(2))**n)/(S(2)*a*x**S(2)) + b**S(2)*n**S(2)*log(x)/a**S(2) - b**S(2)*n**S(2)*log(a + b*x**S(2))/(S(2)*a**S(2)) - b**S(2)*n**S(2)*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*a**S(2)) - b**S(2)*n*log(c*(a + b*x**S(2))**n)*log(-b*x**S(2)/a)/(S(2)*a**S(2)) + b**S(2)*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(7), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/(S(6)*x**S(6)) - b*n*log(c*(a + b*x**S(2))**n)/(S(6)*a*x**S(4)) - b**S(2)*n**S(2)/(S(6)*a**S(2)*x**S(2)) + b**S(2)*n*log(c*(a + b*x**S(2))**n)/(S(3)*a**S(2)*x**S(2)) - b**S(3)*n**S(2)*log(x)/a**S(3) + b**S(3)*n**S(2)*log(a + b*x**S(2))/(S(2)*a**S(3)) + b**S(3)*n**S(2)*polylog(S(2), (a + b*x**S(2))/a)/(S(3)*a**S(3)) + b**S(3)*n*log(c*(a + b*x**S(2))**n)*log(-b*x**S(2)/a)/(S(3)*a**S(3)) - b**S(3)*log(c*(a + b*x**S(2))**n)**S(2)/(S(6)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(c*(a + b*x**S(2))**n)**S(2), x), x, S(8)*a**(S(5)/2)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(S(5)*b**(S(5)/2)) + S(4)*I*a**(S(5)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/(S(5)*b**(S(5)/2)) - S(184)*a**(S(5)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/(S(75)*b**(S(5)/2)) + S(4)*I*a**(S(5)/2)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(S(5)*b**(S(5)/2)) + S(4)*a**(S(5)/2)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(S(5)*b**(S(5)/2)) + S(184)*a**S(2)*n**S(2)*x/(S(75)*b**S(2)) - S(4)*a**S(2)*n*x*log(c*(a + b*x**S(2))**n)/(S(5)*b**S(2)) - S(64)*a*n**S(2)*x**S(3)/(S(225)*b) + S(4)*a*n*x**S(3)*log(c*(a + b*x**S(2))**n)/(S(15)*b) + S(8)*n**S(2)*x**S(5)/S(125) - S(4)*n*x**S(5)*log(c*(a + b*x**S(2))**n)/S(25) + x**S(5)*log(c*(a + b*x**S(2))**n)**S(2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(c*(a + b*x**S(2))**n)**S(2), x), x, -S(8)*a**(S(3)/2)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(S(3)*b**(S(3)/2)) - S(4)*I*a**(S(3)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/(S(3)*b**(S(3)/2)) + S(32)*a**(S(3)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/(S(9)*b**(S(3)/2)) - S(4)*I*a**(S(3)/2)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(S(3)*b**(S(3)/2)) - S(4)*a**(S(3)/2)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(S(3)*b**(S(3)/2)) - S(32)*a*n**S(2)*x/(S(9)*b) + S(4)*a*n*x*log(c*(a + b*x**S(2))**n)/(S(3)*b) + S(8)*n**S(2)*x**S(3)/S(27) - S(4)*n*x**S(3)*log(c*(a + b*x**S(2))**n)/S(9) + x**S(3)*log(c*(a + b*x**S(2))**n)**S(2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2), x), x, S(8)*sqrt(a)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/sqrt(b) + S(4)*I*sqrt(a)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/sqrt(b) - S(8)*sqrt(a)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/sqrt(b) + S(4)*I*sqrt(a)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/sqrt(b) + S(4)*sqrt(a)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/sqrt(b) + S(8)*n**S(2)*x - S(4)*n*x*log(c*(a + b*x**S(2))**n) + x*log(c*(a + b*x**S(2))**n)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(2), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/x + S(8)*sqrt(b)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/sqrt(a) + S(4)*I*sqrt(b)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/sqrt(a) + S(4)*I*sqrt(b)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/sqrt(a) + S(4)*sqrt(b)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(4), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/(S(3)*x**S(3)) - S(4)*b*n*log(c*(a + b*x**S(2))**n)/(S(3)*a*x) - S(8)*b**(S(3)/2)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(S(3)*a**(S(3)/2)) - S(4)*I*b**(S(3)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/(S(3)*a**(S(3)/2)) + S(8)*b**(S(3)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/(S(3)*a**(S(3)/2)) - S(4)*I*b**(S(3)/2)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(S(3)*a**(S(3)/2)) - S(4)*b**(S(3)/2)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(S(3)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(6), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/(S(5)*x**S(5)) - S(4)*b*n*log(c*(a + b*x**S(2))**n)/(S(15)*a*x**S(3)) - S(8)*b**S(2)*n**S(2)/(S(15)*a**S(2)*x) + S(4)*b**S(2)*n*log(c*(a + b*x**S(2))**n)/(S(5)*a**S(2)*x) + S(8)*b**(S(5)/2)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(S(5)*a**(S(5)/2)) + S(4)*I*b**(S(5)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/(S(5)*a**(S(5)/2)) - S(32)*b**(S(5)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/(S(15)*a**(S(5)/2)) + S(4)*I*b**(S(5)/2)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(S(5)*a**(S(5)/2)) + S(4)*b**(S(5)/2)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(S(5)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(2)/x**S(8), x), x, -log(c*(a + b*x**S(2))**n)**S(2)/(S(7)*x**S(7)) - S(4)*b*n*log(c*(a + b*x**S(2))**n)/(S(35)*a*x**S(5)) - S(8)*b**S(2)*n**S(2)/(S(105)*a**S(2)*x**S(3)) + S(4)*b**S(2)*n*log(c*(a + b*x**S(2))**n)/(S(21)*a**S(2)*x**S(3)) + S(64)*b**S(3)*n**S(2)/(S(105)*a**S(3)*x) - S(4)*b**S(3)*n*log(c*(a + b*x**S(2))**n)/(S(7)*a**S(3)*x) - S(8)*b**(S(7)/2)*n**S(2)*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(S(7)*a**(S(7)/2)) - S(4)*I*b**(S(7)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))**S(2)/(S(7)*a**(S(7)/2)) + S(184)*b**(S(7)/2)*n**S(2)*atan(sqrt(b)*x/sqrt(a))/(S(105)*a**(S(7)/2)) - S(4)*I*b**(S(7)/2)*n**S(2)*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(S(7)*a**(S(7)/2)) - S(4)*b**(S(7)/2)*n*log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(S(7)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*log(c*(a + b*x**S(2))**n)**S(3), x), x, -S(9)*a**S(2)*n**S(3)*x**S(2)/(S(4)*b**S(2)) + S(3)*a**S(2)*n**S(2)*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/b**S(3) - S(3)*a**S(2)*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(2)*b**S(3)) + a**S(2)*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(3)/(S(2)*b**S(3)) + S(3)*a*n**S(3)*x**S(4)/(S(8)*b) - S(3)*a*n**S(2)*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)/(S(4)*b**S(3)) + S(3)*a*n*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*b**S(3)) - a*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)**S(3)/(S(2)*b**S(3)) - n**S(3)*(a + b*x**S(2))**S(3)/(S(27)*b**S(3)) + n**S(2)*(a + b*x**S(2))**S(3)*log(c*(a + b*x**S(2))**n)/(S(9)*b**S(3)) - n*(a + b*x**S(2))**S(3)*log(c*(a + b*x**S(2))**n)**S(2)/(S(6)*b**S(3)) + (a + b*x**S(2))**S(3)*log(c*(a + b*x**S(2))**n)**S(3)/(S(6)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(c*(a + b*x**S(2))**n)**S(3), x), x, S(21)*a*n**S(3)*x**S(2)/(S(8)*b) - S(3)*a*n**S(2)*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/b**S(2) + S(3)*a*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(2)*b**S(2)) - a*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(3)/(S(2)*b**S(2)) - S(3)*n**S(3)*x**S(4)/S(16) + S(3)*n**S(2)*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)/(S(8)*b**S(2)) - S(3)*n*(a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)**S(2)/(S(8)*b**S(2)) + (a + b*x**S(2))**S(2)*log(c*(a + b*x**S(2))**n)**S(3)/(S(4)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c*(a + b*x**S(2))**n)**S(3), x), x, -S(3)*n**S(3)*x**S(2) + S(3)*n**S(2)*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)/b - S(3)*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(2)*b) + (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**n)**S(3)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(3)/x, x), x, S(3)*n**S(3)*polylog(S(4), (a + b*x**S(2))/a) - S(3)*n**S(2)*log(c*(a + b*x**S(2))**n)*polylog(S(3), (a + b*x**S(2))/a) + S(3)*n*log(c*(a + b*x**S(2))**n)**S(2)*polylog(S(2), (a + b*x**S(2))/a)/S(2) + log(c*(a + b*x**S(2))**n)**S(3)*log(-b*x**S(2)/a)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(3)/x**S(3), x), x, -S(3)*b*n**S(3)*polylog(S(3), (a + b*x**S(2))/a)/a + S(3)*b*n**S(2)*log(c*(a + b*x**S(2))**n)*polylog(S(2), (a + b*x**S(2))/a)/a + S(3)*b*n*log(c*(a + b*x**S(2))**n)**S(2)*log(-b*x**S(2)/a)/(S(2)*a) - (a/S(2) + b*x**S(2)/S(2))*log(c*(a + b*x**S(2))**n)**S(3)/(a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(3)/x**S(5), x), x, -log(c*(a + b*x**S(2))**n)**S(3)/(S(4)*x**S(4)) + S(3)*b**S(2)*n**S(3)*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*a**S(2)) + S(3)*b**S(2)*n**S(3)*polylog(S(3), (a + b*x**S(2))/a)/(S(2)*a**S(2)) + S(3)*b**S(2)*n**S(2)*log(c*(a + b*x**S(2))**n)*log(-b*x**S(2)/a)/(S(2)*a**S(2)) - S(3)*b**S(2)*n**S(2)*log(c*(a + b*x**S(2))**n)*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*a**S(2)) - S(3)*b**S(2)*n*log(c*(a + b*x**S(2))**n)**S(2)*log(-b*x**S(2)/a)/(S(4)*a**S(2)) + b**S(2)*log(c*(a + b*x**S(2))**n)**S(3)/(S(4)*a**S(2)) - S(3)*b*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*a**S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)**S(3)/x**S(7), x), x, -log(c*(a + b*x**S(2))**n)**S(3)/(S(6)*x**S(6)) - b*n*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*a*x**S(4)) - b**S(2)*n**S(2)*log(c*(a + b*x**S(2))**n)/(S(2)*a**S(2)*x**S(2)) + b**S(3)*n**S(3)*log(x)/a**S(3) - b**S(3)*n**S(3)*log(a + b*x**S(2))/(S(2)*a**S(3)) - S(3)*b**S(3)*n**S(3)*polylog(S(2), (a + b*x**S(2))/a)/(S(2)*a**S(3)) - b**S(3)*n**S(3)*polylog(S(3), (a + b*x**S(2))/a)/a**S(3) - S(3)*b**S(3)*n**S(2)*log(c*(a + b*x**S(2))**n)*log(-b*x**S(2)/a)/(S(2)*a**S(3)) + b**S(3)*n**S(2)*log(c*(a + b*x**S(2))**n)*polylog(S(2), (a + b*x**S(2))/a)/a**S(3) + b**S(3)*n*log(c*(a + b*x**S(2))**n)**S(2)*log(-b*x**S(2)/a)/(S(2)*a**S(3)) + b**S(3)*n*log(c*(a + b*x**S(2))**n)**S(2)/(S(4)*a**S(3)) - b**S(3)*log(c*(a + b*x**S(2))**n)**S(3)/(S(6)*a**S(3)) + b**S(2)*n*(a + b*x**S(2))*log(c*(a + b*x**S(2))**n)**S(2)/(S(2)*a**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2))**n), x), x, -a*(c*(a + b*x**S(2))**n)**(-S(1)/n)*(a + b*x**S(2))*Ei(log(c*(a + b*x**S(2))**n)/n)/(S(2)*b**S(2)*n) + (c*(a + b*x**S(2))**n)**(-S(2)/n)*(a + b*x**S(2))**S(2)*Ei(S(2)*log(c*(a + b*x**S(2))**n)/n)/(S(2)*b**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2))**n), x), x, (c*(a + b*x**S(2))**n)**(-S(1)/n)*(a/S(2) + b*x**S(2)/S(2))*Ei(log(c*(a + b*x**S(2))**n)/n)/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2))**n)), x), x, Integral(S(1)/(x*log(c*(a + b*x)**n)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2))**n)), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x)**n)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2))**n)**S(2), x), x, -a*(c*(a + b*x**S(2))**n)**(-S(1)/n)*(a + b*x**S(2))*Ei(log(c*(a + b*x**S(2))**n)/n)/(S(2)*b**S(2)*n**S(2)) - x**S(2)*(a + b*x**S(2))/(S(2)*b*n*log(c*(a + b*x**S(2))**n)) + (c*(a + b*x**S(2))**n)**(-S(2)/n)*(a + b*x**S(2))**S(2)*Ei(S(2)*log(c*(a + b*x**S(2))**n)/n)/(b**S(2)*n**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2))**n)**S(2), x), x, (-a/S(2) - b*x**S(2)/S(2))/(b*n*log(c*(a + b*x**S(2))**n)) + (c*(a + b*x**S(2))**n)**(-S(1)/n)*(a/S(2) + b*x**S(2)/S(2))*Ei(log(c*(a + b*x**S(2))**n)/n)/(b*n**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2))**n)**S(2)), x), x, Integral(S(1)/(x*log(c*(a + b*x)**n)**S(2)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2))**n)**S(2)), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x)**n)**S(2)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2))**n)**S(3), x), x, -a*(a + b*x**S(2))/(S(4)*b**S(2)*n**S(2)*log(c*(a + b*x**S(2))**n)) - a*(c*(a + b*x**S(2))**n)**(-S(1)/n)*(a + b*x**S(2))*Ei(log(c*(a + b*x**S(2))**n)/n)/(S(4)*b**S(2)*n**S(3)) - x**S(2)*(a + b*x**S(2))/(S(4)*b*n*log(c*(a + b*x**S(2))**n)**S(2)) - x**S(2)*(a + b*x**S(2))/(S(2)*b*n**S(2)*log(c*(a + b*x**S(2))**n)) + (c*(a + b*x**S(2))**n)**(-S(2)/n)*(a + b*x**S(2))**S(2)*Ei(S(2)*log(c*(a + b*x**S(2))**n)/n)/(b**S(2)*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2))**n)**S(3), x), x, (-a/S(4) - b*x**S(2)/S(4))/(b*n*log(c*(a + b*x**S(2))**n)**S(2)) + (-a/S(4) - b*x**S(2)/S(4))/(b*n**S(2)*log(c*(a + b*x**S(2))**n)) + (c*(a + b*x**S(2))**n)**(-S(1)/n)*(a/S(4) + b*x**S(2)/S(4))*Ei(log(c*(a + b*x**S(2))**n)/n)/(b*n**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2))**n)**S(3)), x), x, Integral(S(1)/(x*log(c*(a + b*x)**n)**S(3)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2))**n)**S(3)), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x)**n)**S(3)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(c*(a + b*x**S(2))), x), x, Integral(x**m/log(c*(a + b*x**S(2))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2))), x), x, -a*li(a*c + b*c*x**S(2))/(S(2)*b**S(2)*c) + Ei(S(2)*log(a*c + b*c*x**S(2)))/(S(2)*b**S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(c*(a + b*x**S(2))), x), x, Integral(x**S(2)/log(c*(a + b*x**S(2))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2))), x), x, li(c*(a + b*x**S(2)))/(S(2)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/log(c*(a + b*x**S(2))), x), x, Integral(S(1)/log(c*(a + b*x**S(2))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2)))), x), x, Integral(S(1)/(x*log(a*c + b*c*x)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2)))), x), x, Integral(S(1)/(x**S(2)*log(a*c + b*c*x)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(c*(a + b*x**S(2)))**S(2), x), x, Integral(x**m/log(c*(a + b*x**S(2)))**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2)))**S(2), x), x, -a*li(a*c + b*c*x**S(2))/(S(2)*b**S(2)*c) - x**S(2)*(a + b*x**S(2))/(S(2)*b*log(a*c + b*c*x**S(2))) + Ei(S(2)*log(a*c + b*c*x**S(2)))/(b**S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(c*(a + b*x**S(2)))**S(2), x), x, Integral(x**S(2)/log(c*(a + b*x**S(2)))**S(2), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2)))**S(2), x), x, (-a/S(2) - b*x**S(2)/S(2))/(b*log(c*(a + b*x**S(2)))) + li(c*(a + b*x**S(2)))/(S(2)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2)))**(S(-2)), x), x, Integral(log(c*(a + b*x**S(2)))**(S(-2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2)))**S(2)), x), x, Integral(S(1)/(x*log(a*c + b*c*x)**S(2)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))**S(2)), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2)))**S(2)), x), x, Integral(S(1)/(x**S(2)*log(a*c + b*c*x)**S(2)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/log(c*(a + b*x**S(2)))**S(3), x), x, Integral(x**m/log(c*(a + b*x**S(2)))**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/log(c*(a + b*x**S(2)))**S(3), x), x, -a*(a + b*x**S(2))/(S(4)*b**S(2)*log(a*c + b*c*x**S(2))) - a*li(a*c + b*c*x**S(2))/(S(4)*b**S(2)*c) - x**S(2)*(a + b*x**S(2))/(S(2)*b*log(a*c + b*c*x**S(2))) - x**S(2)*(a + b*x**S(2))/(S(4)*b*log(a*c + b*c*x**S(2))**S(2)) + Ei(S(2)*log(a*c + b*c*x**S(2)))/(b**S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/log(c*(a + b*x**S(2)))**S(3), x), x, Integral(x**S(2)/log(c*(a + b*x**S(2)))**S(3), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/log(c*(a + b*x**S(2)))**S(3), x), x, (-a/S(4) - b*x**S(2)/S(4))/(b*log(c*(a + b*x**S(2)))) + (-a/S(4) - b*x**S(2)/S(4))/(b*log(c*(a + b*x**S(2)))**S(2)) + li(c*(a + b*x**S(2)))/(S(4)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2)))**(S(-3)), x), x, Integral(log(c*(a + b*x**S(2)))**(S(-3)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(c*(a + b*x**S(2)))**S(3)), x), x, Integral(S(1)/(x*log(a*c + b*c*x)**S(3)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))**S(3)), x), x, Integral(S(1)/(x**S(2)*log(c*(a + b*x**S(2)))**S(3)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*log(c*(a + b*x**S(2)))**S(3)), x), x, Integral(S(1)/(x**S(2)*log(a*c + b*c*x)**S(3)), (x, x**S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(b*x**m + S(1))/x, x), x, -polylog(S(2), -b*x**m)/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(b*x**m + S(2))/x, x), x, log(S(2))*log(x) - polylog(S(2), -b*x**m/S(2))/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(2)*b*x**m + S(6))/x, x), x, log(S(6))*log(x) - polylog(S(2), -b*x**m/S(3))/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**m))/x, x), x, log(c*(a + b*x**m))*log(-b*x**m/a)/m + polylog(S(2), (a + b*x**m)/a)/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**m)**n)/x, x), x, n*polylog(S(2), (a + b*x**m)/a)/m + log(c*(a + b*x**m)**n)*log(-b*x**m/a)/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**m)**n)**S(2)/x, x), x, -S(2)*n**S(2)*polylog(S(3), (a + b*x**m)/a)/m + S(2)*n*log(c*(a + b*x**m)**n)*polylog(S(2), (a + b*x**m)/a)/m + log(c*(a + b*x**m)**n)**S(2)*log(-b*x**m/a)/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**m)**n)**S(3)/x, x), x, S(6)*n**S(3)*polylog(S(4), (a + b*x**m)/a)/m - S(6)*n**S(2)*log(c*(a + b*x**m)**n)*polylog(S(3), (a + b*x**m)/a)/m + S(3)*n*log(c*(a + b*x**m)**n)**S(2)*polylog(S(2), (a + b*x**m)/a)/m + log(c*(a + b*x**m)**n)**S(3)*log(-b*x**m/a)/m, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(d*(b*x + c*x**S(2))**n), x), x, n*x**(m + S(1))*hyper((S(1), m + S(1)), (m + S(2),), -c*x/b)/(m + S(1))**S(2) - S(2)*n*x**(m + S(1))/(m + S(1))**S(2) + x**(m + S(1))*log(d*(b*x + c*x**S(2))**n)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(d*(b*x + c*x**S(2))**n), x), x, b**S(5)*n*log(b + c*x)/(S(5)*c**S(5)) - b**S(4)*n*x/(S(5)*c**S(4)) + b**S(3)*n*x**S(2)/(S(10)*c**S(3)) - b**S(2)*n*x**S(3)/(S(15)*c**S(2)) + b*n*x**S(4)/(S(20)*c) - S(2)*n*x**S(5)/S(25) + x**S(5)*log(d*(b*x + c*x**S(2))**n)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(d*(b*x + c*x**S(2))**n), x), x, -b**S(4)*n*log(b + c*x)/(S(4)*c**S(4)) + b**S(3)*n*x/(S(4)*c**S(3)) - b**S(2)*n*x**S(2)/(S(8)*c**S(2)) + b*n*x**S(3)/(S(12)*c) - n*x**S(4)/S(8) + x**S(4)*log(d*(b*x + c*x**S(2))**n)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(d*(b*x + c*x**S(2))**n), x), x, b**S(3)*n*log(b + c*x)/(S(3)*c**S(3)) - b**S(2)*n*x/(S(3)*c**S(2)) + b*n*x**S(2)/(S(6)*c) - S(2)*n*x**S(3)/S(9) + x**S(3)*log(d*(b*x + c*x**S(2))**n)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(d*(b*x + c*x**S(2))**n), x), x, -b**S(2)*n*log(b + c*x)/(S(2)*c**S(2)) + b*n*x/(S(2)*c) - n*x**S(2)/S(2) + x**S(2)*log(d*(b*x + c*x**S(2))**n)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n), x), x, b*n*log(b + c*x)/c - S(2)*n*x + x*log(d*(b*x + c*x**S(2))**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)/x, x), x, -n*log(x)**S(2)/S(2) - n*log(x)*log((b + c*x)/b) - n*polylog(S(2), -c*x/b) + log(x)*log(d*(b*x + c*x**S(2))**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)/x**S(2), x), x, -n/x - log(d*(b*x + c*x**S(2))**n)/x + c*n*log(x)/b - c*n*log(b + c*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)/x**S(3), x), x, -n/(S(4)*x**S(2)) - log(d*(b*x + c*x**S(2))**n)/(S(2)*x**S(2)) - c*n/(S(2)*b*x) - c**S(2)*n*log(x)/(S(2)*b**S(2)) + c**S(2)*n*log(b + c*x)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)/x**S(4), x), x, -n/(S(9)*x**S(3)) - log(d*(b*x + c*x**S(2))**n)/(S(3)*x**S(3)) - c*n/(S(6)*b*x**S(2)) + c**S(2)*n/(S(3)*b**S(2)*x) + c**S(3)*n*log(x)/(S(3)*b**S(3)) - c**S(3)*n*log(b + c*x)/(S(3)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)/x**S(5), x), x, -n/(S(16)*x**S(4)) - log(d*(b*x + c*x**S(2))**n)/(S(4)*x**S(4)) - c*n/(S(12)*b*x**S(3)) + c**S(2)*n/(S(8)*b**S(2)*x**S(2)) - c**S(3)*n/(S(4)*b**S(3)*x) - c**S(4)*n*log(x)/(S(4)*b**S(4)) + c**S(4)*n*log(b + c*x)/(S(4)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(d*(a + b*x + c*x**S(2))**n), x), x, -S(2)*c*n*x**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(m + S(2))) - S(2)*c*n*x**(m + S(2))*hyper((S(1), m + S(2)), (m + S(3),), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2))))/((b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(m + S(2))) + x**(m + S(1))*log(d*(a + b*x + c*x**S(2))**n)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*x**S(4)/(S(20)*c) + b*n*x**S(2)*(-S(3)*a*c + b**S(2))/(S(10)*c**S(3)) + b*n*(S(5)*a**S(2)*c**S(2) - S(5)*a*b**S(2)*c + b**S(4))*log(a + b*x + c*x**S(2))/(S(10)*c**S(5)) - S(2)*n*x**S(5)/S(25) + x**S(5)*log(d*(a + b*x + c*x**S(2))**n)/S(5) - n*x**S(3)*(-S(2)*a*c/S(15) + b**S(2)/S(15))/c**S(2) + n*x*(-S(2)*a**S(2)*c**S(2)/S(5) + S(4)*a*b**S(2)*c/S(5) - b**S(4)/S(5))/c**S(4) + n*sqrt(-S(4)*a*c + b**S(2))*(a**S(2)*c**S(2)/S(5) - S(3)*a*b**S(2)*c/S(5) + b**S(4)/S(5))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*x**S(3)/(S(12)*c) + b*n*x*(-S(3)*a*c + b**S(2))/(S(4)*c**S(3)) - b*n*sqrt(-S(4)*a*c + b**S(2))*(-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*c**S(4)) - n*x**S(4)/S(8) + x**S(4)*log(d*(a + b*x + c*x**S(2))**n)/S(4) - n*x**S(2)*(-a*c/S(4) + b**S(2)/S(8))/c**S(2) - n*(a**S(2)*c**S(2)/S(4) - a*b**S(2)*c/S(2) + b**S(4)/S(8))*log(a + b*x + c*x**S(2))/c**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*x**S(2)/(S(6)*c) + b*n*(-S(3)*a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(6)*c**S(3)) - S(2)*n*x**S(3)/S(9) + x**S(3)*log(d*(a + b*x + c*x**S(2))**n)/S(3) + n*x*(S(2)*a*c/S(3) - b**S(2)/S(3))/c**S(2) + n*sqrt(-S(4)*a*c + b**S(2))*(-a*c/S(3) + b**S(2)/S(3))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*x/(S(2)*c) - b*n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)) - n*x**S(2)/S(2) + x**S(2)*log(d*(a + b*x + c*x**S(2))**n)/S(2) - n*(-a*c/S(2) + b**S(2)/S(4))*log(a + b*x + c*x**S(2))/c**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*log(a + b*x + c*x**S(2))/(S(2)*c) - S(2)*n*x + x*log(d*(a + b*x + c*x**S(2))**n) + n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/x, x), x, -n*log(x)*log((b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(b - sqrt(-S(4)*a*c + b**S(2)))) - n*log(x)*log((b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(b + sqrt(-S(4)*a*c + b**S(2)))) - n*polylog(S(2), -S(2)*c*x/(b - sqrt(-S(4)*a*c + b**S(2)))) - n*polylog(S(2), -S(2)*c*x/(b + sqrt(-S(4)*a*c + b**S(2)))) + log(x)*log(d*(a + b*x + c*x**S(2))**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/x**S(2), x), x, -log(d*(a + b*x + c*x**S(2))**n)/x + b*n*log(x)/a - b*n*log(a + b*x + c*x**S(2))/(S(2)*a) + n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/x**S(3), x), x, -log(d*(a + b*x + c*x**S(2))**n)/(S(2)*x**S(2)) - b*n/(S(2)*a*x) - b*n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)) - n*(-a*c + b**S(2)/S(2))*log(x)/a**S(2) + n*(-a*c/S(2) + b**S(2)/S(4))*log(a + b*x + c*x**S(2))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/x**S(4), x), x, -log(d*(a + b*x + c*x**S(2))**n)/(S(3)*x**S(3)) - b*n/(S(6)*a*x**S(2)) + n*(-S(2)*a*c/S(3) + b**S(2)/S(3))/(a**S(2)*x) + b*n*(-S(3)*a*c + b**S(2))*log(x)/(S(3)*a**S(3)) - b*n*(-S(3)*a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(6)*a**S(3)) + n*sqrt(-S(4)*a*c + b**S(2))*(-a*c/S(3) + b**S(2)/S(3))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/x**S(5), x), x, -log(d*(a + b*x + c*x**S(2))**n)/(S(4)*x**S(4)) - b*n/(S(12)*a*x**S(3)) + n*(-a*c/S(4) + b**S(2)/S(8))/(a**S(2)*x**S(2)) - b*n*(-S(3)*a*c + b**S(2))/(S(4)*a**S(3)*x) - b*n*sqrt(-S(4)*a*c + b**S(2))*(-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*a**S(4)) + n*(a**S(2)*c**S(2)/S(4) - a*b**S(2)*c/S(2) + b**S(4)/S(8))*log(a + b*x + c*x**S(2))/a**S(4) - n*(a**S(2)*c**S(2)/S(2) - a*b**S(2)*c + b**S(4)/S(4))*log(x)/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**S(2) + x + S(1)), x), x, x*log(x**S(2) + x + S(1)) - S(2)*x + log(x**S(2) + x + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3)), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate((d + e*x)**S(4)*log(d*(a + b*x + c*x**S(2))**n), x), x, -S(2)*e**S(4)*n*x**S(5)/S(25) + (d + e*x)**S(5)*log(d*(a + b*x + c*x**S(2))**n)/(S(5)*e) - e**S(3)*n*x**S(4)*(-b*e + S(10)*c*d)/(S(20)*c) - e**S(2)*n*x**S(3)*(b**S(2)*e**S(2) + S(20)*c**S(2)*d**S(2) - c*e*(S(2)*a*e + S(5)*b*d))/(S(15)*c**S(2)) - e*n*x**S(2)*(-b**S(3)*e**S(3) + b*c*e**S(2)*(S(3)*a*e + S(5)*b*d) + S(20)*c**S(3)*d**S(3) - S(10)*c**S(2)*d*e*(a*e + b*d))/(S(10)*c**S(3)) + n*x*(-b**S(4)*e**S(4)/S(5) + b**S(2)*c*e**S(3)*(S(4)*a*e + S(5)*b*d)/S(5) - S(2)*c**S(4)*d**S(4) + S(2)*c**S(3)*d**S(2)*e*(S(2)*a*e + b*d) - c**S(2)*e**S(2)*(S(2)*a**S(2)*e**S(2) + S(15)*a*b*d*e + S(10)*b**S(2)*d**S(2))/S(5))/c**S(4) + n*sqrt(-S(4)*a*c + b**S(2))*(b**S(4)*e**S(4)/S(5) - b**S(2)*c*e**S(3)*(S(3)*a*e + S(5)*b*d)/S(5) + c**S(4)*d**S(4) - S(2)*c**S(3)*d**S(2)*e*(a*e + b*d) + c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(10)*a*b*d*e + S(10)*b**S(2)*d**S(2))/S(5))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(5) - n*(-b*e/S(10) + c*d/S(5))*(b**S(4)*e**S(4) - b**S(2)*c*e**S(3)*(S(5)*a*e + S(3)*b*d) + c**S(4)*d**S(4) - S(2)*c**S(3)*d**S(2)*e*(S(5)*a*e + b*d) + c**S(2)*e**S(2)*(S(5)*a**S(2)*e**S(2) + S(10)*a*b*d*e + S(4)*b**S(2)*d**S(2)))*log(a + b*x + c*x**S(2))/(c**S(5)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*log(d*(a + b*x + c*x**S(2))**n), x), x, -e**S(3)*n*x**S(4)/S(8) + (d + e*x)**S(4)*log(d*(a + b*x + c*x**S(2))**n)/(S(4)*e) - e**S(2)*n*x**S(3)*(-b*e + S(8)*c*d)/(S(12)*c) - e*n*x**S(2)*(b**S(2)*e**S(2) + S(12)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + S(2)*b*d))/(S(8)*c**S(2)) + n*x*(b**S(3)*e**S(3)/S(4) - b*c*e**S(2)*(S(3)*a*e + S(4)*b*d)/S(4) - S(2)*c**S(3)*d**S(3) + c**S(2)*d*e*(S(4)*a*e + S(3)*b*d)/S(2))/c**S(3) + n*sqrt(-S(4)*a*c + b**S(2))*(-b*e/S(4) + c*d/S(2))*(b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(4) - n*(b**S(4)*e**S(4)/S(8) - b**S(2)*c*e**S(3)*(a*e + b*d)/S(2) + c**S(4)*d**S(4)/S(4) - c**S(3)*d**S(2)*e*(S(3)*a*e + b*d)/S(2) + c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(6)*a*b*d*e + S(3)*b**S(2)*d**S(2))/S(4))*log(a + b*x + c*x**S(2))/(c**S(4)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)*log(d*(a + b*x + c*x**S(2))**n), x), x, -S(2)*e**S(2)*n*x**S(3)/S(9) + (d + e*x)**S(3)*log(d*(a + b*x + c*x**S(2))**n)/(S(3)*e) - e*n*x**S(2)*(-b*e + S(6)*c*d)/(S(6)*c) + n*x*(-b**S(2)*e**S(2)/S(3) - S(2)*c**S(2)*d**S(2) + c*e*(S(2)*a*e + S(3)*b*d)/S(3))/c**S(2) + n*sqrt(-S(4)*a*c + b**S(2))*(b**S(2)*e**S(2)/S(3) + c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d)/S(3))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(3) - n*(-b*e/S(6) + c*d/S(3))*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))*log(a + b*x + c*x**S(2))/(c**S(3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*log(d*(a + b*x + c*x**S(2))**n), x), x, -e*n*x**S(2)/S(2) + n*x*(b*e/(S(2)*c) - S(2)*d) + (d + e*x)**S(2)*log(d*(a + b*x + c*x**S(2))**n)/(S(2)*e) + n*sqrt(-S(4)*a*c + b**S(2))*(-b*e/S(2) + c*d)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c**S(2) - n*(b**S(2)*e**S(2)/S(4) + c**S(2)*d**S(2)/S(2) - c*e*(a*e + b*d)/S(2))*log(a + b*x + c*x**S(2))/(c**S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n), x), x, b*n*log(a + b*x + c*x**S(2))/(S(2)*c) - S(2)*n*x + x*log(d*(a + b*x + c*x**S(2))**n) + n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(d + e*x), x), x, -n*log(-e*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))*log(d + e*x)/e - n*log(-e*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))*log(d + e*x)/e - n*polylog(S(2), S(2)*c*(d + e*x)/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/e - n*polylog(S(2), S(2)*c*(d + e*x)/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/e + log(d*(a + b*x + c*x**S(2))**n)*log(d + e*x)/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(d + e*x)**S(2), x), x, n*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*e**S(2) - b*d*e + c*d**S(2)) + n*(-b*e/S(2) + c*d)*log(a + b*x + c*x**S(2))/(e*(a*e**S(2) - b*d*e + c*d**S(2))) + n*(b*e - S(2)*c*d)*log(d + e*x)/(e*(a*e**S(2) - b*d*e + c*d**S(2))) - log(d*(a + b*x + c*x**S(2))**n)/(e*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(d + e*x)**S(3), x), x, n*sqrt(-S(4)*a*c + b**S(2))*(-b*e/S(2) + c*d)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*e**S(2) - b*d*e + c*d**S(2))**S(2) + n*(b**S(2)*e**S(2)/S(4) + c**S(2)*d**S(2)/S(2) - c*e*(a*e + b*d)/S(2))*log(a + b*x + c*x**S(2))/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - n*(b**S(2)*e**S(2)/S(2) + c**S(2)*d**S(2) - c*e*(a*e + b*d))*log(d + e*x)/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + n*(-b*e/S(2) + c*d)/(e*(d + e*x)*(a*e**S(2) - b*d*e + c*d**S(2))) - log(d*(a + b*x + c*x**S(2))**n)/(S(2)*e*(d + e*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(d + e*x)**S(4), x), x, n*sqrt(-S(4)*a*c + b**S(2))*(b**S(2)*e**S(2)/S(3) + c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d)/S(3))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*e**S(2) - b*d*e + c*d**S(2))**S(3) - n*(-b*e/S(3) + S(2)*c*d/S(3))*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))*log(d + e*x)/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + n*(-b*e/S(6) + c*d/S(3))*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))*log(a + b*x + c*x**S(2))/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + n*(b**S(2)*e**S(2)/S(3) + S(2)*c**S(2)*d**S(2)/S(3) - S(2)*c*e*(a*e + b*d)/S(3))/(e*(d + e*x)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + n*(-b*e/S(6) + c*d/S(3))/(e*(d + e*x)**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) - log(d*(a + b*x + c*x**S(2))**n)/(S(3)*e*(d + e*x)**S(3)), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(d + e*x)**S(5), x), x, n*sqrt(-S(4)*a*c + b**S(2))*(-b*e/S(4) + c*d/S(2))*(b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*e**S(2) - b*d*e + c*d**S(2))**S(4) + n*(b**S(4)*e**S(4)/S(8) - b**S(2)*c*e**S(3)*(a*e + b*d)/S(2) + c**S(4)*d**S(4)/S(4) - c**S(3)*d**S(2)*e*(S(3)*a*e + b*d)/S(2) + c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(6)*a*b*d*e + S(3)*b**S(2)*d**S(2))/S(4))*log(a + b*x + c*x**S(2))/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(4)) - n*(b**S(4)*e**S(4)/S(4) - b**S(2)*c*e**S(3)*(a*e + b*d) + c**S(4)*d**S(4)/S(2) - c**S(3)*d**S(2)*e*(S(3)*a*e + b*d) + c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(6)*a*b*d*e + S(3)*b**S(2)*d**S(2))/S(2))*log(d + e*x)/(e*(a*e**S(2) - b*d*e + c*d**S(2))**S(4)) + n*(-b*e/S(4) + c*d/S(2))*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))/(e*(d + e*x)*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + n*(b**S(2)*e**S(2)/S(8) + c**S(2)*d**S(2)/S(4) - c*e*(a*e + b*d)/S(4))/(e*(d + e*x)**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + n*(-b*e/S(12) + c*d/S(6))/(e*(d + e*x)**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) - log(d*(a + b*x + c*x**S(2))**n)/(S(4)*e*(d + e*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + c*x**S(2))**n)/(a*e + c*e*x**S(2)), x), x, S(2)*n*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(c)*x))*atan(sqrt(c)*x/sqrt(a))/(sqrt(a)*sqrt(c)*e) + I*n*atan(sqrt(c)*x/sqrt(a))**S(2)/(sqrt(a)*sqrt(c)*e) + I*n*polylog(S(2), (-sqrt(a) + I*sqrt(c)*x)/(sqrt(a) + I*sqrt(c)*x))/(sqrt(a)*sqrt(c)*e) + log(d*(a + c*x**S(2))**n)*atan(sqrt(c)*x/sqrt(a))/(sqrt(a)*sqrt(c)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)/(a*e + b*e*x + c*e*x**S(2)), x), x, -S(4)*n*log(S(2)/(-b/sqrt(-S(4)*a*c + b**S(2)) - S(2)*c*x/sqrt(-S(4)*a*c + b**S(2)) + S(1)))*atanh(b/sqrt(-S(4)*a*c + b**S(2)) + S(2)*c*x/sqrt(-S(4)*a*c + b**S(2)))/(e*sqrt(-S(4)*a*c + b**S(2))) + S(2)*n*atanh(b/sqrt(-S(4)*a*c + b**S(2)) + S(2)*c*x/sqrt(-S(4)*a*c + b**S(2)))**S(2)/(e*sqrt(-S(4)*a*c + b**S(2))) - S(2)*n*polylog(S(2), (-b/sqrt(-S(4)*a*c + b**S(2)) - S(2)*c*x/sqrt(-S(4)*a*c + b**S(2)) + S(-1))/(-b/sqrt(-S(4)*a*c + b**S(2)) - S(2)*c*x/sqrt(-S(4)*a*c + b**S(2)) + S(1)))/(e*sqrt(-S(4)*a*c + b**S(2))) - S(2)*log(d*(a + b*x + c*x**S(2))**n)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(g*(a + b*x + c*x**S(2))**n)/(d + e*x**S(2)), x), x, n*log(sqrt(e)*(-b - S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-d) - sqrt(e)*(b - sqrt(-S(4)*a*c + b**S(2)))))*log(sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)) - n*log(sqrt(e)*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-d) + sqrt(e)*(b - sqrt(-S(4)*a*c + b**S(2)))))*log(-sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)) + n*log(sqrt(e)*(-b - S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-d) - sqrt(e)*(b + sqrt(-S(4)*a*c + b**S(2)))))*log(sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)) - n*log(sqrt(e)*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-d) + sqrt(e)*(b + sqrt(-S(4)*a*c + b**S(2)))))*log(-sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)) + n*polylog(S(2), S(2)*c*(sqrt(e)*x + sqrt(-d))/(S(2)*c*sqrt(-d) - sqrt(e)*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(e)*sqrt(-d)) - n*polylog(S(2), S(2)*c*(-sqrt(e)*x + sqrt(-d))/(S(2)*c*sqrt(-d) + sqrt(e)*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(e)*sqrt(-d)) + n*polylog(S(2), S(2)*c*(sqrt(e)*x + sqrt(-d))/(S(2)*c*sqrt(-d) - sqrt(e)*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(e)*sqrt(-d)) - n*polylog(S(2), S(2)*c*(-sqrt(e)*x + sqrt(-d))/(S(2)*c*sqrt(-d) + sqrt(e)*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(e)*sqrt(-d)) + log(g*(a + b*x + c*x**S(2))**n)*log(-sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)) - log(g*(a + b*x + c*x**S(2))**n)*log(sqrt(e)*x + sqrt(-d))/(S(2)*sqrt(e)*sqrt(-d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(g*(a + b*x + c*x**S(2))**n)/(d + e*x + f*x**S(2)), x), x, -n*log(f*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(-c*(e - sqrt(-S(4)*d*f + e**S(2))) + f*(b + sqrt(-S(4)*a*c + b**S(2)))))*log(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) + n*log(f*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(-c*(e + sqrt(-S(4)*d*f + e**S(2))) + f*(b - sqrt(-S(4)*a*c + b**S(2)))))*log(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) + n*log(f*(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/(-c*(e + sqrt(-S(4)*d*f + e**S(2))) + f*(b + sqrt(-S(4)*a*c + b**S(2)))))*log(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) - n*log(-f*(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/(-b*f + c*e - c*sqrt(-S(4)*d*f + e**S(2)) + f*sqrt(-S(4)*a*c + b**S(2))))*log(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) - n*polylog(S(2), -c*(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(-c*(e - sqrt(-S(4)*d*f + e**S(2))) + f*(b - sqrt(-S(4)*a*c + b**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) - n*polylog(S(2), -c*(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/(-c*(e - sqrt(-S(4)*d*f + e**S(2))) + f*(b + sqrt(-S(4)*a*c + b**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + n*polylog(S(2), -c*(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(-c*(e + sqrt(-S(4)*d*f + e**S(2))) + f*(b - sqrt(-S(4)*a*c + b**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + n*polylog(S(2), -c*(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/(-c*(e + sqrt(-S(4)*d*f + e**S(2))) + f*(b + sqrt(-S(4)*a*c + b**S(2)))))/sqrt(-S(4)*d*f + e**S(2)) + log(g*(a + b*x + c*x**S(2))**n)*log(e + S(2)*f*x - sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) - log(g*(a + b*x + c*x**S(2))**n)*log(e + S(2)*f*x + sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(b*x + c*x**S(2))**n)**S(2), x), x, -S(2)*b*n**S(2)*log(-c*x/b)*log(b + c*x)/c - b*n**S(2)*log(b + c*x)**S(2)/c - S(4)*b*n**S(2)*log(b + c*x)/c - S(2)*b*n**S(2)*polylog(S(2), (b + c*x)/b)/c + S(2)*b*n*log(d*(b*x + c*x**S(2))**n)*log(b + c*x)/c + S(8)*n**S(2)*x - S(4)*n*x*log(d*(b*x + c*x**S(2))**n) + x*log(d*(b*x + c*x**S(2))**n)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x + c*x**S(2))**n)**S(2), x), x, -S(2)*b*n**S(2)*log(a + b*x + c*x**S(2))/c + S(8)*n**S(2)*x - S(4)*n*x*log(d*(a + b*x + c*x**S(2))**n) + x*log(d*(a + b*x + c*x**S(2))**n)**S(2) - n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*log((b/S(2) + c*x + sqrt(-S(4)*a*c + b**S(2))/S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/c - n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*log(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))**S(2)/(S(2)*c) - n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), (-b/S(2) - c*x + sqrt(-S(4)*a*c + b**S(2))/S(2))/sqrt(-S(4)*a*c + b**S(2)))/c - n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*log((-b/S(2) - c*x + sqrt(-S(4)*a*c + b**S(2))/S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/c - n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*log(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))**S(2)/(S(2)*c) - n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*polylog(S(2), (b/S(2) + c*x + sqrt(-S(4)*a*c + b**S(2))/S(2))/sqrt(-S(4)*a*c + b**S(2)))/c - S(4)*n**S(2)*sqrt(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/c + n*(b - sqrt(-S(4)*a*c + b**S(2)))*log(d*(a + b*x + c*x**S(2))**n)*log(b + S(2)*c*x - sqrt(-S(4)*a*c + b**S(2)))/c + n*(b + sqrt(-S(4)*a*c + b**S(2)))*log(d*(a + b*x + c*x**S(2))**n)*log(b + S(2)*c*x + sqrt(-S(4)*a*c + b**S(2)))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(x**S(2) + x + S(1))/(x**S(2) + S(3)*x + S(2)), x), x, x*log(x**S(2) + x + S(1)) - S(2)*x - log((-S(2)*x + S(-1) - sqrt(S(3))*I)/(S(1) - sqrt(S(3))*I))*log(S(2)*x + S(2)) - log((-S(2)*x + S(-1) + sqrt(S(3))*I)/(S(1) + sqrt(S(3))*I))*log(S(2)*x + S(2)) + S(4)*log((-S(2)*x + S(-1) - sqrt(S(3))*I)/(S(3) - sqrt(S(3))*I))*log(S(2)*x + S(4)) + S(4)*log((-S(2)*x + S(-1) + sqrt(S(3))*I)/(S(3) + sqrt(S(3))*I))*log(S(2)*x + S(4)) + log(S(2)*x + S(2))*log(x**S(2) + x + S(1)) - S(4)*log(S(2)*x + S(4))*log(x**S(2) + x + S(1)) + log(x**S(2) + x + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3)) - polylog(S(2), (S(2)*x + S(2))/(S(1) - sqrt(S(3))*I)) - polylog(S(2), (S(2)*x + S(2))/(S(1) + sqrt(S(3))*I)) + S(4)*polylog(S(2), (S(2)*x + S(4))/(S(3) - sqrt(S(3))*I)) + S(4)*polylog(S(2), (S(2)*x + S(4))/(S(3) + sqrt(S(3))*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**S(2) + x + S(1))**S(2), x), x, x*log(x**S(2) + x + S(1))**S(2) - S(4)*x*log(x**S(2) + x + S(1)) + S(8)*x - (S(1) + sqrt(S(3))*I)*log(sqrt(S(3))*I*(S(2)*x + S(1) - sqrt(S(3))*I)/S(6))*log(S(2)*x + S(1) + sqrt(S(3))*I) - (S(1) - sqrt(S(3))*I)*log(-sqrt(S(3))*I*(S(2)*x + S(1) + sqrt(S(3))*I)/S(6))*log(S(2)*x + S(1) - sqrt(S(3))*I) - (S(1) - sqrt(S(3))*I)*log(S(2)*x + S(1) - sqrt(S(3))*I)**S(2)/S(2) + (S(1) - sqrt(S(3))*I)*log(S(2)*x + S(1) - sqrt(S(3))*I)*log(x**S(2) + x + S(1)) - (S(1) + sqrt(S(3))*I)*log(S(2)*x + S(1) + sqrt(S(3))*I)**S(2)/S(2) + (S(1) + sqrt(S(3))*I)*log(S(2)*x + S(1) + sqrt(S(3))*I)*log(x**S(2) + x + S(1)) - S(2)*log(x**S(2) + x + S(1)) - S(4)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3)) - (S(1) - sqrt(S(3))*I)*polylog(S(2), sqrt(S(3))*I*(S(2)*x + S(1) - sqrt(S(3))*I)/S(6)) - (S(1) + sqrt(S(3))*I)*polylog(S(2), -sqrt(S(3))*I*(S(2)*x + S(1) + sqrt(S(3))*I)/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**S(2) + x + S(-1))**S(2)/x**S(3), x), x, S(3)*log(x)*log((S(2)*x + S(1) + sqrt(S(5)))/(S(1) + sqrt(S(5)))) - S(3)*log(x)*log(x**S(2) + x + S(-1)) + log(x) - (sqrt(S(5)) + S(3))*log(sqrt(S(5))*(x + S(1)/2 + sqrt(S(5))/S(2))/S(5))*log(S(2)*x - sqrt(S(5)) + S(1))/S(2) - (-sqrt(S(5)) + S(3))*log(S(2)*x + S(1) + sqrt(S(5)))**S(2)/S(4) + (-sqrt(S(5)) + S(3))*log(S(2)*x + S(1) + sqrt(S(5)))*log(x**S(2) + x + S(-1))/S(2) - (-sqrt(S(5)) + S(1))*log(S(2)*x + S(1) + sqrt(S(5)))/S(2) - (sqrt(S(5)) + S(3))*log(S(2)*x - sqrt(S(5)) + S(1))**S(2)/S(4) + (sqrt(S(5)) + S(3))*log(S(2)*x - sqrt(S(5)) + S(1))*log(x**S(2) + x + S(-1))/S(2) - (S(1) + sqrt(S(5)))*log(S(2)*x - sqrt(S(5)) + S(1))/S(2) + S(3)*log(S(-1)/2 + sqrt(S(5))/S(2))*log(S(2)*x - sqrt(S(5)) + S(1)) - (-sqrt(S(5)) + S(3))*log(S(2)*sqrt(S(5)))*log(S(2)*x - sqrt(S(5)) + S(1))/S(2) - (sqrt(S(5)) + S(3))*polylog(S(2), sqrt(S(5))*(-x + S(-1)/2 + sqrt(S(5))/S(2))/S(5))/S(2) + (-sqrt(S(5)) + S(3))*polylog(S(2), sqrt(S(5))*(-x + S(-1)/2 + sqrt(S(5))/S(2))/S(5))/S(2) + S(3)*polylog(S(2), -S(2)*x/(S(1) + sqrt(S(5)))) - S(3)*polylog(S(2), (S(2)*x - sqrt(S(5)) + S(1))/(-sqrt(S(5)) + S(1))) + log(x**S(2) + x + S(-1))/x - log(x**S(2) + x + S(-1))**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, x**S(4)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/S(4) - x**S(4)/S(32) + x**S(3)/S(192) - x**S(2)/S(1024) - x*(x**S(2) - x)**(S(3)/2)/S(32) + x/S(4096) + (-S(149)*x/S(1024) + S(149)/2048)*sqrt(x**S(2) - x) - (x**S(2) - x)**(S(3)/2)/S(12) - S(683)*sqrt(x**S(2) - x)/S(4096) - log(S(8)*x + S(1))/S(32768) - S(1537)*atanh(x/sqrt(x**S(2) - x))/S(16384) + atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x))/S(32768), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, x**S(3)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/S(3) - x**S(3)/S(18) + x**S(2)/S(96) - x/S(384) + (-S(5)*x/S(32) + S(5)/64)*sqrt(x**S(2) - x) - (x**S(2) - x)**(S(3)/2)/S(18) - S(85)*sqrt(x**S(2) - x)/S(384) + log(S(8)*x + S(1))/S(3072) - S(223)*atanh(x/sqrt(x**S(2) - x))/S(1536) - atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x))/S(3072), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, x**S(2)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/S(2) - x**S(2)/S(8) + x/S(32) + (-x/S(8) + S(1)/16)*sqrt(x**S(2) - x) - S(11)*sqrt(x**S(2) - x)/S(32) - log(S(8)*x + S(1))/S(256) - S(33)*atanh(x/sqrt(x**S(2) - x))/S(128) + atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x))/S(256), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, x*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1)) - x/S(2) - sqrt(x**S(2) - x)/S(2) + log(S(8)*x + S(1))/S(16) - S(7)*atanh(x/sqrt(x**S(2) - x))/S(8) - atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/x, x), x, Integral(log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/x**S(2), x), x, S(4)*log(x) - S(4)*log(S(8)*x + S(1)) + S(4)*atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x)) + S(4)*sqrt(x**S(2) - x)/x - log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/x**S(3), x), x, -S(16)*log(x) + S(16)*log(S(8)*x + S(1)) - S(16)*atanh((-S(5)*x/S(3) + S(1)/6)/sqrt(x**S(2) - x)) - S(10)*sqrt(x**S(2) - x)/x - S(2)/x - log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/(S(2)*x**S(2)) - S(2)*(x**S(2) - x)**(S(3)/2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, S(2)*x**(S(5)/2)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/S(5) - S(2)*x**(S(5)/2)/S(25) + x**(S(3)/2)/S(60) - sqrt(x)/S(160) + sqrt(S(2))*atan(S(2)*sqrt(S(2))*sqrt(x))/S(640) - S(2)*(x**S(2) - x)**(S(3)/2)/(S(25)*sqrt(x)) - S(127)*sqrt(x**S(2) - x)/(S(480)*sqrt(x)) - sqrt(S(2))*sqrt(x**S(2) - x)*atan(S(2)*sqrt(S(2))*sqrt(x + S(-1))/S(3))/(S(640)*sqrt(x)*sqrt(x + S(-1))) - (-S(2)*x/S(15) + S(2)/15)*sqrt(x**S(2) - x)/(sqrt(x)*(sqrt(x) + S(1))) - (-S(2)*x/S(15) + S(2)/15)*sqrt(x**S(2) - x)/(sqrt(x)*(-sqrt(x) + S(1))) - S(71)*(x**S(2) - x)**(S(3)/2)/(S(300)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) # failing due to apart assert rubi_test(rubi_integrate(sqrt(x)*log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1)), x), x, S(2)*x**(S(3)/2)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/S(3) - S(2)*x**(S(3)/2)/S(9) + sqrt(x)/S(12) - sqrt(S(2))*atan(S(2)*sqrt(S(2))*sqrt(x))/S(48) - S(17)*sqrt(x**S(2) - x)/(S(36)*sqrt(x)) + sqrt(S(2))*sqrt(x**S(2) - x)*atan(S(2)*sqrt(S(2))*sqrt(x + S(-1))/S(3))/(S(48)*sqrt(x)*sqrt(x + S(-1))) - (-S(2)*x/S(9) + S(2)/9)*sqrt(x**S(2) - x)/(sqrt(x)*(sqrt(x) + S(1))) - (-S(2)*x/S(9) + S(2)/9)*sqrt(x**S(2) - x)/(sqrt(x)*(-sqrt(x) + S(1))) - S(2)*(x**S(2) - x)**(S(3)/2)/(S(9)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/sqrt(x), x), x, S(2)*sqrt(x)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1)) - S(2)*sqrt(x) + sqrt(S(2))*atan(S(2)*sqrt(S(2))*sqrt(x))/S(2) - S(2)*sqrt(x**S(2) - x)/(S(3)*sqrt(x)) - sqrt(S(2))*sqrt(x**S(2) - x)*atan(S(2)*sqrt(S(2))*sqrt(x + S(-1))/S(3))/(S(2)*sqrt(x)*sqrt(x + S(-1))) - (-S(2)*x/S(3) + S(2)/3)*sqrt(x**S(2) - x)/(sqrt(x)*(sqrt(x) + S(1))) - (-S(2)*x/S(3) + S(2)/3)*sqrt(x**S(2) - x)/(sqrt(x)*(-sqrt(x) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/x**(S(3)/2), x), x, S(4)*sqrt(S(2))*atan(S(2)*sqrt(S(2))*sqrt(x)) - S(8)*atan(sqrt(x)/sqrt(x**S(2) - x)) - S(4)*sqrt(x**S(2) - x)/(S(3)*sqrt(x)) - S(2)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/sqrt(x) - S(4)*sqrt(S(2))*sqrt(x**S(2) - x)*atan(S(2)*sqrt(S(2))*sqrt(x + S(-1))/S(3))/(sqrt(x)*sqrt(x + S(-1))) + (-S(2)*x/S(3) + S(2)/3)*sqrt(x**S(2) - x)/(sqrt(x)*(sqrt(x) + S(1))) + (-S(2)*x/S(3) + S(2)/3)*sqrt(x**S(2) - x)/(sqrt(x)*(-sqrt(x) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(4)*x + S(4)*sqrt(x*(x + S(-1))) + S(-1))/x**(S(5)/2), x), x, -S(32)*sqrt(S(2))*atan(S(2)*sqrt(S(2))*sqrt(x))/S(3) + S(44)*atan(sqrt(x)/sqrt(x**S(2) - x))/S(3) - S(4)*sqrt(x**S(2) - x)/(S(9)*sqrt(x)) - S(16)/(S(3)*sqrt(x)) + S(32)*sqrt(S(2))*sqrt(x**S(2) - x)*atan(S(2)*sqrt(S(2))*sqrt(x + S(-1))/S(3))/(S(3)*sqrt(x)*sqrt(x + S(-1))) + (-S(2)*x/S(9) + S(2)/9)*sqrt(x**S(2) - x)/(sqrt(x)*(sqrt(x) + S(1))) + (-S(2)*x/S(9) + S(2)/9)*sqrt(x**S(2) - x)/(sqrt(x)*(-sqrt(x) + S(1))) + S(4)*sqrt(x**S(2) - x)/(S(3)*x**(S(3)/2)) - S(2)*log(S(4)*x + S(4)*sqrt(x**S(2) - x) + S(-1))/(S(3)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + x)/x)/x, x), x, polylog(S(2), -a/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + x**S(2))/x**S(2))/x, x), x, polylog(S(2), -a/x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**(-n)*(a + x**n))/x, x), x, polylog(S(2), -a*x**(-n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + b*x)/x)/x, x), x, -log(-a/(b*x))*log(a/x + b) - polylog(S(2), (a/x + b)/b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + b*x**S(2))/x**S(2))/x, x), x, -log(-a/(b*x**S(2)))*log(a/x**S(2) + b)/S(2) - polylog(S(2), (a/x**S(2) + b)/b)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**(-n)*(a + b*x**n))/x, x), x, -log(-a*x**(-n)/b)*log(a*x**(-n) + b)/n - polylog(S(2), (a*x**(-n) + b)/b)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + b*x)/x)/(c + d*x), x), x, log((a + b*x)/x)*log(c + d*x)/d + log(-d*x/c)*log(c + d*x)/d - log(-d*(a + b*x)/(-a*d + b*c))*log(c + d*x)/d + polylog(S(2), (c + d*x)/c)/d - polylog(S(2), b*(c + d*x)/(-a*d + b*c))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((a + b*x**S(2))/x**S(2))/(c + d*x), x), x, S(2)*log(-d*x/c)*log(c + d*x)/d - log(-d*(sqrt(b)*x + sqrt(-a))/(sqrt(b)*c - d*sqrt(-a)))*log(c + d*x)/d - log(d*(-sqrt(b)*x + sqrt(-a))/(sqrt(b)*c + d*sqrt(-a)))*log(c + d*x)/d + log(c + d*x)*log(a/x**S(2) + b)/d + S(2)*polylog(S(2), (c + d*x)/c)/d - polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c - d*sqrt(-a)))/d - polylog(S(2), sqrt(b)*(c + d*x)/(sqrt(b)*c + d*sqrt(-a)))/d, expand=True, _diff=True, _numerical=True) # recursion sympy and mathematica assert rubi_test(rubi_integrate(log(x**(-n)*(a + b*x**n))/(c + d*x), x), x, a*n*Integral(log(c + d*x)/(x*(a + b*x**n)), x)/d + log(c + d*x)*log(a*x**(-n) + b)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(4), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(4)/b + n**S(4)*(-S(24)*a*d + S(24)*b*c)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(b*d) - n**S(3)*(-S(24)*a*d + S(24)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(2)*(-S(12)*a*d + S(12)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(4)*a*d + S(4)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(3)/b - n**S(3)*(-S(6)*a*d + S(6)*b*c)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(2)*(-S(6)*a*d + S(6)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(3)*a*d + S(3)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/b + n**S(2)*(-S(2)*a*d + S(2)*b*c)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(2)*a*d + S(2)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)/b - n*(-a*d + b*c)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/log(e*((a + b*x)/(c + d*x))**n), x), x, Integral(S(1)/log(e*((a + b*x)/(c + d*x))**n), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**(S(-2)), x), x, Integral(log(e*((a + b*x)/(c + d*x))**n)**(S(-2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3)/x, x), x, S(6)*n**S(3)*polylog(S(4), c*(a + b*x)/(a*(c + d*x))) - S(6)*n**S(3)*polylog(S(4), d*(a + b*x)/(b*(c + d*x))) - S(6)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), c*(a + b*x)/(a*(c + d*x))) + S(6)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), d*(a + b*x)/(b*(c + d*x))) + S(3)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), c*(a + b*x)/(a*(c + d*x))) - S(3)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x))) - log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((-a*d + b*c)/(b*(c + d*x))) + log(e*((a + b*x)/(c + d*x))**n)**S(3)*log(x*(a*d - b*c)/(a*(c + d*x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)/x, x), x, -S(2)*n**S(2)*polylog(S(3), c*(a + b*x)/(a*(c + d*x))) + S(2)*n**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x))) + S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), c*(a + b*x)/(a*(c + d*x))) - S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x))) - log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x))) + log(e*((a + b*x)/(c + d*x))**n)**S(2)*log(x*(a*d - b*c)/(a*(c + d*x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/x, x), x, -n*log(x)*log((a + b*x)/a) + n*log(x)*log((c + d*x)/c) - n*polylog(S(2), -b*x/a) + n*polylog(S(2), -d*x/c) + log(x)*log(e*((a + b*x)/(c + d*x))**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(e*((a + b*x)/(c + d*x))**n)), x), x, Integral(S(1)/(x*log(e*((a + b*x)/(c + d*x))**n)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(e*((a + b*x)/(c + d*x))**n)**S(2)), x), x, Integral(S(1)/(x*log(e*((a + b*x)/(c + d*x))**n)**S(2)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*log(e*(a + b*x)/(c + d*x)), x), x, -x*(-a*d + b*c)**S(3)/(S(4)*d**S(3)) + (a + b*x)**S(4)*log(e*(a + b*x)/(c + d*x))/(S(4)*b) - (a + b*x)**S(3)*(-a*d/S(12) + b*c/S(12))/(b*d) + (a + b*x)**S(2)*(-a*d + b*c)**S(2)/(S(8)*b*d**S(2)) + (-a*d + b*c)**S(4)*log(c + d*x)/(S(4)*b*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x)), x), x, x*(-a*d + b*c)**S(2)/(S(3)*d**S(2)) + (a + b*x)**S(3)*log(e*(a + b*x)/(c + d*x))/(S(3)*b) - (a + b*x)**S(2)*(-a*d/S(6) + b*c/S(6))/(b*d) - (-a*d + b*c)**S(3)*log(c + d*x)/(S(3)*b*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(e*(a + b*x)/(c + d*x)), x), x, x*(a*d/S(2) - b*c/S(2))/d + (a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(2)*b) + (-a*d + b*c)**S(2)*log(c + d*x)/(S(2)*b*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x)), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))/b - (-a*d + b*c)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))/(a + b*x), x), x, -log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))/b + polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))/(a + b*x)**S(2), x), x, -(c + d*x)*log(e*(a + b*x)/(c + d*x))/((a + b*x)*(-a*d + b*c)) - S(1)/(b*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))/(a + b*x)**S(3), x), x, d**S(2)*log(a + b*x)/(S(2)*b*(-a*d + b*c)**S(2)) - d**S(2)*log(c + d*x)/(S(2)*b*(-a*d + b*c)**S(2)) + d/(S(2)*b*(a + b*x)*(-a*d + b*c)) - log(e*(a + b*x)/(c + d*x))/(S(2)*b*(a + b*x)**S(2)) - S(1)/(S(4)*b*(a + b*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, -S(5)*x*(-a*d + b*c)**S(3)/(S(12)*d**S(3)) + (a + b*x)**S(4)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(4)*b) - (a + b*x)**S(3)*(-a*d/S(6) + b*c/S(6))*log(e*(a + b*x)/(c + d*x))/(b*d) + (a + b*x)**S(2)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(4)*b*d**S(2)) + (a + b*x)**S(2)*(-a*d + b*c)**S(2)/(S(12)*b*d**S(2)) - (a + b*x)*(-a*d + b*c)**S(3)*log(e*(a + b*x)/(c + d*x))/(S(2)*b*d**S(3)) - (-a*d + b*c)**S(4)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(S(2)*b*d**S(4)) + S(11)*(-a*d + b*c)**S(4)*log(c + d*x)/(S(12)*b*d**S(4)) - (-a*d + b*c)**S(4)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(S(2)*b*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, x*(-a*d + b*c)**S(2)/(S(3)*d**S(2)) + (a + b*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(3)*b) - (a + b*x)**S(2)*(-a*d/S(3) + b*c/S(3))*log(e*(a + b*x)/(c + d*x))/(b*d) + S(2)*(a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(3)*b*d**S(2)) + S(2)*(-a*d + b*c)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(S(3)*b*d**S(3)) - (-a*d + b*c)**S(3)*log(c + d*x)/(b*d**S(3)) + S(2)*(-a*d + b*c)**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(S(3)*b*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, (a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*b) + (a + b*x)*(a*d - b*c)*log(e*(a + b*x)/(c + d*x))/(b*d) - (-a*d + b*c)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b*d**S(2)) + (-a*d + b*c)**S(2)*log(c + d*x)/(b*d**S(2)) - (-a*d + b*c)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/b + (-S(2)*a*d + S(2)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b*d) + (-S(2)*a*d + S(2)*b*c)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(a + b*x), x), x, -log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/b + S(2)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/b + S(2)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(a + b*x)**S(2), x), x, -(c + d*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((a + b*x)*(-a*d + b*c)) - (S(2)*c + S(2)*d*x)*log(e*(a + b*x)/(c + d*x))/((a + b*x)*(-a*d + b*c)) - S(2)/(b*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(a + b*x)**S(3), x), x, -b*(c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) - b*(c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(2)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) - b*(c + d*x)**S(2)/(S(4)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) + d*(c + d*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((a + b*x)*(-a*d + b*c)**S(2)) + S(2)*d*(c + d*x)*log(e*(a + b*x)/(c + d*x))/((a + b*x)*(-a*d + b*c)**S(2)) + S(2)*d/(b*(a + b*x)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3), x), x, (a + b*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(3)*b) - (a + b*x)**S(2)*(-a*d/S(2) + b*c/S(2))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d) + (a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d**S(2)) + (a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/(b*d**S(2)) + (-a*d + b*c)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d**S(3)) + S(3)*(-a*d + b*c)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b*d**S(3)) + S(2)*(-a*d + b*c)**S(3)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(3)) - (-a*d + b*c)**S(3)*log(c + d*x)/(b*d**S(3)) + S(3)*(-a*d + b*c)**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(3)) - S(2)*(-a*d + b*c)**S(3)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(e*(a + b*x)/(c + d*x))**S(3), x), x, (a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(2)*b) - (a + b*x)*(-S(3)*a*d/S(2) + S(3)*b*c/S(2))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d) - S(3)*(-a*d + b*c)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*b*d**S(2)) - S(3)*(-a*d + b*c)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b*d**S(2)) - S(3)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(2)) - S(3)*(-a*d + b*c)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(2)) + S(3)*(-a*d + b*c)**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(3)/b + (-S(6)*a*d + S(6)*b*c)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) - (-S(6)*a*d + S(6)*b*c)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(3)*a*d + S(3)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(a + b*x), x), x, -log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))**S(3)/b + S(3)*log(e*(a + b*x)/(c + d*x))**S(2)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/b + S(6)*log(e*(a + b*x)/(c + d*x))*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/b + S(6)*polylog(S(4), b*(c + d*x)/(d*(a + b*x)))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(a + b*x)**S(2), x), x, -(c + d*x)*log(e*(a + b*x)/(c + d*x))**S(3)/((a + b*x)*(-a*d + b*c)) - (S(3)*c + S(3)*d*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((a + b*x)*(-a*d + b*c)) - (S(6)*c + S(6)*d*x)*log(e*(a + b*x)/(c + d*x))/((a + b*x)*(-a*d + b*c)) - S(6)/(b*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(a + b*x)**S(3), x), x, -b*(c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(2)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) - S(3)*b*(c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(4)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) - S(3)*b*(c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(4)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) - S(3)*b*(c + d*x)**S(2)/(S(8)*(a + b*x)**S(2)*(-a*d + b*c)**S(2)) + d*(c + d*x)*log(e*(a + b*x)/(c + d*x))**S(3)/((a + b*x)*(-a*d + b*c)**S(2)) + S(3)*d*(c + d*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((a + b*x)*(-a*d + b*c)**S(2)) + S(6)*d*(c + d*x)*log(e*(a + b*x)/(c + d*x))/((a + b*x)*(-a*d + b*c)**S(2)) + S(6)*d/(b*(a + b*x)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n), x), x, (c + d*x)**S(4)*log(e*((a + b*x)/(c + d*x))**n)/(S(4)*d) - n*(c + d*x)**S(3)*(-a*d/S(12) + b*c/S(12))/(b*d) - n*(c + d*x)**S(2)*(-a*d + b*c)**S(2)/(S(8)*b**S(2)*d) - n*x*(-a*d + b*c)**S(3)/(S(4)*b**S(3)) - n*(-a*d + b*c)**S(4)*log(a + b*x)/(S(4)*b**S(4)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n), x), x, (c + d*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)/(S(3)*d) - n*(c + d*x)**S(2)*(-a*d/S(6) + b*c/S(6))/(b*d) - n*x*(-a*d + b*c)**S(2)/(S(3)*b**S(2)) - n*(-a*d + b*c)**S(3)*log(a + b*x)/(S(3)*b**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)*log(e*((a + b*x)/(c + d*x))**n), x), x, (c + d*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)/(S(2)*d) + n*x*(a*d/S(2) - b*c/S(2))/b - n*(-a*d + b*c)**S(2)*log(a + b*x)/(S(2)*b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)/b - n*(-a*d + b*c)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(c + d*x), x), x, -n*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/d - log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(c + d*x)**S(2), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)/((c + d*x)*(-a*d + b*c)) + n/(d*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(c + d*x)**S(3), x), x, b**S(2)*n*log(a + b*x)/(S(2)*d*(-a*d + b*c)**S(2)) - b**S(2)*n*log(c + d*x)/(S(2)*d*(-a*d + b*c)**S(2)) + b*n/(S(2)*d*(c + d*x)*(-a*d + b*c)) + n/(S(4)*d*(c + d*x)**S(2)) - log(e*((a + b*x)/(c + d*x))**n)/(S(2)*d*(c + d*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(c + d*x)**S(4), x), x, b**S(3)*n*log(a + b*x)/(S(3)*d*(-a*d + b*c)**S(3)) - b**S(3)*n*log(c + d*x)/(S(3)*d*(-a*d + b*c)**S(3)) + b**S(2)*n/(S(3)*d*(c + d*x)*(-a*d + b*c)**S(2)) + b*n/(S(6)*d*(c + d*x)**S(2)*(-a*d + b*c)) + n/(S(9)*d*(c + d*x)**S(3)) - log(e*((a + b*x)/(c + d*x))**n)/(S(3)*d*(c + d*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, (c + d*x)**S(4)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(4)*d) - (c + d*x)**S(3)*(-a*d/S(6) + b*c/S(6))*log(e*(a + b*x)/(c + d*x))/(b*d) - (c + d*x)**S(2)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(4)*b**S(2)*d) + (c + d*x)**S(2)*(-a*d + b*c)**S(2)/(S(12)*b**S(2)*d) + S(5)*x*(-a*d + b*c)**S(3)/(S(12)*b**S(3)) - (a + b*x)*(-a*d + b*c)**S(3)*log(e*(a + b*x)/(c + d*x))/(S(2)*b**S(4)) + (-a*d + b*c)**S(4)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))/(S(2)*b**S(4)*d) + S(5)*(-a*d + b*c)**S(4)*log(a + b*x)/(S(12)*b**S(4)*d) + (-a*d + b*c)**S(4)*log(c + d*x)/(S(2)*b**S(4)*d) - (-a*d + b*c)**S(4)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(S(2)*b**S(4)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, (c + d*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(3)*d) - (c + d*x)**S(2)*(-a*d/S(3) + b*c/S(3))*log(e*(a + b*x)/(c + d*x))/(b*d) + x*(-a*d + b*c)**S(2)/(S(3)*b**S(2)) - S(2)*(a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(3)*b**S(3)) + S(2)*(-a*d + b*c)**S(3)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))/(S(3)*b**S(3)*d) + (-a*d + b*c)**S(3)*log(a + b*x)/(S(3)*b**S(3)*d) + S(2)*(-a*d + b*c)**S(3)*log(c + d*x)/(S(3)*b**S(3)*d) - S(2)*(-a*d + b*c)**S(3)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(S(3)*b**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)*log(e*(a + b*x)/(c + d*x))**S(2), x), x, (c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*d) + (a + b*x)*(a*d - b*c)*log(e*(a + b*x)/(c + d*x))/b**S(2) + (-a*d + b*c)**S(2)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))/(b**S(2)*d) + (-a*d + b*c)**S(2)*log(c + d*x)/(b**S(2)*d) - (-a*d + b*c)**S(2)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/b + (-S(2)*a*d + S(2)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b*d) + (-S(2)*a*d + S(2)*b*c)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(c + d*x), x), x, -log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/d - S(2)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/d + S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(c + d*x)**S(2), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((c + d*x)*(-a*d + b*c)) - (S(2)*a + S(2)*b*x)*log(e*(a + b*x)/(c + d*x))/((c + d*x)*(-a*d + b*c)) - S(2)/(d*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(2)/(c + d*x)**S(3), x), x, b*(a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((c + d*x)*(-a*d + b*c)**S(2)) - S(2)*b*(a + b*x)*log(e*(a + b*x)/(c + d*x))/((c + d*x)*(-a*d + b*c)**S(2)) - S(2)*b/(d*(c + d*x)*(-a*d + b*c)) - d*(a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)) + d*(a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(2)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)) - d*(a + b*x)**S(2)/(S(4)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3), x), x, (c + d*x)**S(3)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(3)*d) - (c + d*x)**S(2)*(-a*d/S(2) + b*c/S(2))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d) - (a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/b**S(3) + (a + b*x)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))/b**S(3) - S(2)*(-a*d + b*c)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b**S(3)*d) + (-a*d + b*c)**S(3)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(b**S(3)*d) - (-a*d + b*c)**S(3)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))/(b**S(3)*d) - S(2)*(-a*d + b*c)**S(3)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*d) - (-a*d + b*c)**S(3)*log(c + d*x)/(b**S(3)*d) - S(2)*(-a*d + b*c)**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b**S(3)*d) + (-a*d + b*c)**S(3)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*d) - S(2)*(-a*d + b*c)**S(3)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)*log(e*(a + b*x)/(c + d*x))**S(3), x), x, (c + d*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(2)*d) - (a + b*x)*(-S(3)*a*d/S(2) + S(3)*b*c/S(2))*log(e*(a + b*x)/(c + d*x))**S(2)/b**S(2) - S(3)*(-a*d + b*c)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))/(b**S(2)*d) + S(3)*(-a*d + b*c)**S(2)*log((a*d - b*c)/(d*(a + b*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(S(2)*b**S(2)*d) - S(3)*(-a*d + b*c)**S(2)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*d) - S(3)*(-a*d + b*c)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b**S(2)*d) - S(3)*(-a*d + b*c)**S(2)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(3)/b + (-S(6)*a*d + S(6)*b*c)*log(e*(a + b*x)/(c + d*x))*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) - (-S(6)*a*d + S(6)*b*c)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(3)*a*d + S(3)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(c + d*x), x), x, -log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(3)/d - S(3)*log(e*(a + b*x)/(c + d*x))**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/d + S(6)*log(e*(a + b*x)/(c + d*x))*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/d - S(6)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(c + d*x)**S(2), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(3)/((c + d*x)*(-a*d + b*c)) - (S(3)*a + S(3)*b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((c + d*x)*(-a*d + b*c)) + (S(6)*a + S(6)*b*x)*log(e*(a + b*x)/(c + d*x))/((c + d*x)*(-a*d + b*c)) + S(6)/(d*(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(3)/(c + d*x)**S(3), x), x, b*(a + b*x)*log(e*(a + b*x)/(c + d*x))**S(3)/((c + d*x)*(-a*d + b*c)**S(2)) - S(3)*b*(a + b*x)*log(e*(a + b*x)/(c + d*x))**S(2)/((c + d*x)*(-a*d + b*c)**S(2)) + S(6)*b*(a + b*x)*log(e*(a + b*x)/(c + d*x))/((c + d*x)*(-a*d + b*c)**S(2)) + S(6)*b/(d*(c + d*x)*(-a*d + b*c)) - d*(a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(3)/(S(2)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)) + S(3)*d*(a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))**S(2)/(S(4)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)) - S(3)*d*(a + b*x)**S(2)*log(e*(a + b*x)/(c + d*x))/(S(4)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)) + S(3)*d*(a + b*x)**S(2)/(S(8)*(c + d*x)**S(2)*(-a*d + b*c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(4), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(4)/b - (-S(24)*a*d + S(24)*b*c)*log(e*(a + b*x)/(c + d*x))*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(24)*a*d + S(24)*b*c)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(12)*a*d + S(12)*b*c)*log(e*(a + b*x)/(c + d*x))**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(4)*a*d + S(4)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(3)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(a + b*x)/(c + d*x))**S(5), x), x, (a + b*x)*log(e*(a + b*x)/(c + d*x))**S(5)/b + (-S(120)*a*d + S(120)*b*c)*log(e*(a + b*x)/(c + d*x))*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(b*d) - (-S(120)*a*d + S(120)*b*c)*polylog(S(5), d*(a + b*x)/(b*(c + d*x)))/(b*d) - (-S(60)*a*d + S(60)*b*c)*log(e*(a + b*x)/(c + d*x))**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(20)*a*d + S(20)*b*c)*log(e*(a + b*x)/(c + d*x))**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + (-S(5)*a*d + S(5)*b*c)*log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(4)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d*(a + b*x)/(b*(c + d*x)))/(c*f + d*f*x), x), x, polylog(S(2), (-a*d + b*c)/(b*(c + d*x)))/(d*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(1) + S(1)/(a + b*x))/(a + b*x), x), x, polylog(S(2), -S(1)/(a + b*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(1) - S(1)/(a + b*x))/(a + b*x), x), x, polylog(S(2), S(1)/(a + b*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n), x), x, (f + g*x)**S(4)*log(e*((a + b*x)/(c + d*x))**n)/(S(4)*g) + n*(-c*g + d*f)**S(4)*log(c + d*x)/(S(4)*d**S(4)*g) - g**S(3)*n*x**S(3)*(-a*d/S(12) + b*c/S(12))/(b*d) - g**S(2)*n*x**S(2)*(-a*d/S(8) + b*c/S(8))*(-a*d*g - b*c*g + S(4)*b*d*f)/(b**S(2)*d**S(2)) + g*n*x*(a*d/S(4) - b*c/S(4))*(a**S(2)*d**S(2)*g**S(2) - a*b*d*g*(-c*g + S(4)*d*f) + b**S(2)*(c**S(2)*g**S(2) - S(4)*c*d*f*g + S(6)*d**S(2)*f**S(2)))/(b**S(3)*d**S(3)) - n*(-a*g + b*f)**S(4)*log(a + b*x)/(S(4)*b**S(4)*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n), x), x, (f + g*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)/(S(3)*g) + n*(-c*g + d*f)**S(3)*log(c + d*x)/(S(3)*d**S(3)*g) - g**S(2)*n*x**S(2)*(-a*d/S(6) + b*c/S(6))/(b*d) + g*n*x*(a*d/S(3) - b*c/S(3))*(-a*d*g - b*c*g + S(3)*b*d*f)/(b**S(2)*d**S(2)) - n*(-a*g + b*f)**S(3)*log(a + b*x)/(S(3)*b**S(3)*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)*log(e*((a + b*x)/(c + d*x))**n), x), x, (f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)/(S(2)*g) + n*(-c*g + d*f)**S(2)*log(c + d*x)/(S(2)*d**S(2)*g) + g*n*x*(a*d/S(2) - b*c/S(2))/(b*d) - n*(-a*g + b*f)**S(2)*log(a + b*x)/(S(2)*b**S(2)*g), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)/b - n*(-a*d + b*c)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x), x), x, -n*log(-g*(a + b*x)/(-a*g + b*f))*log(f + g*x)/g + n*log(-g*(c + d*x)/(-c*g + d*f))*log(f + g*x)/g - n*polylog(S(2), b*(f + g*x)/(-a*g + b*f))/g + n*polylog(S(2), d*(f + g*x)/(-c*g + d*f))/g + log(e*((a + b*x)/(c + d*x))**n)*log(f + g*x)/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x)**S(2), x), x, -n*(-a*d + b*c)*log(c + d*x)/((-a*g + b*f)*(-c*g + d*f)) + n*(-a*d + b*c)*log(f + g*x)/((-a*g + b*f)*(-c*g + d*f)) + (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)/((f + g*x)*(-a*g + b*f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x)**S(3), x), x, b**S(2)*n*log(a + b*x)/(S(2)*g*(-a*g + b*f)**S(2)) - d**S(2)*n*log(c + d*x)/(S(2)*g*(-c*g + d*f)**S(2)) + n*(-a*d/S(2) + b*c/S(2))*(-a*d*g - b*c*g + S(2)*b*d*f)*log(f + g*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n*(a*d/S(2) - b*c/S(2))/((f + g*x)*(-a*g + b*f)*(-c*g + d*f)) - log(e*((a + b*x)/(c + d*x))**n)/(S(2)*g*(f + g*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x)**S(4), x), x, b**S(3)*n*log(a + b*x)/(S(3)*g*(-a*g + b*f)**S(3)) - d**S(3)*n*log(c + d*x)/(S(3)*g*(-c*g + d*f)**S(3)) + n*(-a*d/S(3) + b*c/S(3))*(a**S(2)*d**S(2)*g**S(2) - a*b*d*g*(-c*g + S(3)*d*f) + b**S(2)*(c**S(2)*g**S(2) - S(3)*c*d*f*g + S(3)*d**S(2)*f**S(2)))*log(f + g*x)/((-a*g + b*f)**S(3)*(-c*g + d*f)**S(3)) - n*(-a*d/S(3) + b*c/S(3))*(-a*d*g - b*c*g + S(2)*b*d*f)/((f + g*x)*(-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n*(a*d/S(6) - b*c/S(6))/((f + g*x)**S(2)*(-a*g + b*f)*(-c*g + d*f)) - log(e*((a + b*x)/(c + d*x))**n)/(S(3)*g*(f + g*x)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)**S(2), x), x, -a**S(3)*g**S(3)*n**S(2)*(-a*d + b*c)*log(a + b*x)/(S(6)*b**S(4)*d) + a**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(4)*b*d*f)*log(a + b*x)/(S(4)*b**S(4)*d**S(2)) + (f + g*x)**S(4)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(S(4)*g) - n**S(2)*(-c*g + d*f)**S(4)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(S(2)*d**S(4)*g) - n*(-c*g + d*f)**S(4)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(S(2)*d**S(4)*g) + c**S(3)*g**S(3)*n**S(2)*(-a*d + b*c)*log(c + d*x)/(S(6)*b*d**S(4)) - g**S(3)*n*x**S(3)*(-a*d/S(6) + b*c/S(6))*log(e*((a + b*x)/(c + d*x))**n)/(b*d) - c**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(4)*b*d*f)*log(c + d*x)/(S(4)*b**S(2)*d**S(4)) + g**S(3)*n**S(2)*x**S(2)*(-a*d + b*c)**S(2)/(S(12)*b**S(2)*d**S(2)) - g**S(2)*n*x**S(2)*(-a*d/S(4) + b*c/S(4))*(-a*d*g - b*c*g + S(4)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)/(b**S(2)*d**S(2)) - g**S(3)*n**S(2)*x*(-a*d + b*c)**S(2)*(a*d + b*c)/(S(6)*b**S(3)*d**S(3)) + g**S(2)*n**S(2)*x*(-a*d + b*c)**S(2)*(-a*d*g - b*c*g + S(4)*b*d*f)/(S(4)*b**S(3)*d**S(3)) - n**S(2)*(-a*g + b*f)**S(4)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(S(2)*b**S(4)*g) + n*(-a*g + b*f)**S(4)*log(e*((a + b*x)/(c + d*x))**n)*log((a*d - b*c)/(d*(a + b*x)))/(S(2)*b**S(4)*g) - g*n*(a + b*x)*(-a*d/S(2) + b*c/S(2))*(a**S(2)*d**S(2)*g**S(2) - a*b*d*g*(-c*g + S(4)*d*f) + b**S(2)*(c**S(2)*g**S(2) - S(4)*c*d*f*g + S(6)*d**S(2)*f**S(2)))*log(e*((a + b*x)/(c + d*x))**n)/(b**S(4)*d**S(3)) + g*n**S(2)*(-a*d + b*c)**S(2)*(a**S(2)*d**S(2)*g**S(2) - a*b*d*g*(-c*g + S(4)*d*f) + b**S(2)*(c**S(2)*g**S(2) - S(4)*c*d*f*g + S(6)*d**S(2)*f**S(2)))*log(c + d*x)/(S(2)*b**S(4)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(2), x), x, a**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*log(a + b*x)/(S(3)*b**S(3)*d) + (f + g*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(S(3)*g) - S(2)*n**S(2)*(-c*g + d*f)**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(S(3)*d**S(3)*g) - S(2)*n*(-c*g + d*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(S(3)*d**S(3)*g) - c**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*log(c + d*x)/(S(3)*b*d**S(3)) - g**S(2)*n*x**S(2)*(-a*d/S(3) + b*c/S(3))*log(e*((a + b*x)/(c + d*x))**n)/(b*d) + g**S(2)*n**S(2)*x*(-a*d + b*c)**S(2)/(S(3)*b**S(2)*d**S(2)) - S(2)*n**S(2)*(-a*g + b*f)**S(3)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(S(3)*b**S(3)*g) + S(2)*n*(-a*g + b*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)*log((a*d - b*c)/(d*(a + b*x)))/(S(3)*b**S(3)*g) - g*n*(a + b*x)*(-S(2)*a*d/S(3) + S(2)*b*c/S(3))*(-a*d*g - b*c*g + S(3)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)/(b**S(3)*d**S(2)) + S(2)*g*n**S(2)*(-a*d + b*c)**S(2)*(-a*d*g - b*c*g + S(3)*b*d*f)*log(c + d*x)/(S(3)*b**S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)*log(e*((a + b*x)/(c + d*x))**n)**S(2), x), x, (f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(S(2)*g) - n**S(2)*(-c*g + d*f)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(d**S(2)*g) - n*(-c*g + d*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(d**S(2)*g) - n**S(2)*(-a*g + b*f)**S(2)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*g) + n*(-a*g + b*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*log((a*d - b*c)/(d*(a + b*x)))/(b**S(2)*g) + g*n*(a + b*x)*(a*d - b*c)*log(e*((a + b*x)/(c + d*x))**n)/(b**S(2)*d) + g*n**S(2)*(-a*d + b*c)**S(2)*log(c + d*x)/(b**S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/b + n**S(2)*(-S(2)*a*d + S(2)*b*c)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(2)*a*d + S(2)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) # taking long time in rubi_test assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)/(f + g*x), x), x, -S(2)*n**S(2)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/g + S(2)*n**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/g + S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/g - S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/g - log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/g + log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)/(f + g*x)**S(2), x), x, n**S(2)*(-S(2)*a*d + S(2)*b*c)*polylog(S(2), (a + b*x)*(-c*g + d*f)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)*(-c*g + d*f)) + n*(-S(2)*a*d + S(2)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)*(-c*g + d*f)) + (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/((f + g*x)*(-a*g + b*f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)/(f + g*x)**S(3), x), x, b**S(2)*n**S(2)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(g*(-a*g + b*f)**S(2)) - b**S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*log((a*d - b*c)/(d*(a + b*x)))/(g*(-a*g + b*f)**S(2)) + d**S(2)*n**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(g*(-c*g + d*f)**S(2)) + d**S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(g*(-c*g + d*f)**S(2)) - g*n**S(2)*(-a*d + b*c)**S(2)*log(c + d*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + g*n**S(2)*(-a*d + b*c)**S(2)*log(f + g*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + g*n*(a + b*x)*(-a*d + b*c)*log(e*((a + b*x)/(c + d*x))**n)/((f + g*x)*(-a*g + b*f)**S(2)*(-c*g + d*f)) - n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*log(-g*(a + b*x)/(-a*g + b*f))*log(f + g*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*log(-g*(c + d*x)/(-c*g + d*f))*log(f + g*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) - n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*polylog(S(2), b*(f + g*x)/(-a*g + b*f))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n**S(2)*(-a*d + b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*polylog(S(2), d*(f + g*x)/(-c*g + d*f))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n*(-a*d + b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)*log(f + g*x)/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) - log(e*((a + b*x)/(c + d*x))**n)**S(2)/(S(2)*g*(f + g*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(3), x), x, a**S(2)*g**S(2)*n**S(3)*(-a*d + b*c)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*d) - a**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*log(e*((a + b*x)/(c + d*x))**n)*log((a*d - b*c)/(d*(a + b*x)))/(b**S(3)*d) + (f + g*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)**S(3)/(S(3)*g) + S(2)*n**S(3)*(-c*g + d*f)**S(3)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(d**S(3)*g) - S(2)*n**S(2)*(-c*g + d*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(d**S(3)*g) - n*(-c*g + d*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/(d**S(3)*g) + c**S(2)*g**S(2)*n**S(3)*(-a*d + b*c)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d**S(3)) + c**S(2)*g**S(2)*n**S(2)*(-a*d + b*c)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d**S(3)) - g**S(2)*n*x**S(2)*(-a*d/S(2) + b*c/S(2))*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(b*d) - S(2)*n**S(3)*(-a*g + b*f)**S(3)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*g) - S(2)*n**S(2)*(-a*g + b*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(3)*g) + n*(-a*g + b*f)**S(3)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((a*d - b*c)/(d*(a + b*x)))/(b**S(3)*g) + g**S(2)*n**S(2)*(a + b*x)*(-a*d + b*c)**S(2)*log(e*((a + b*x)/(c + d*x))**n)/(b**S(3)*d**S(2)) - g*n*(a + b*x)*(-a*d + b*c)*(-a*d*g - b*c*g + S(3)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(b**S(3)*d**S(2)) - g**S(2)*n**S(3)*(-a*d + b*c)**S(3)*log(c + d*x)/(b**S(3)*d**S(3)) - S(2)*g*n**S(3)*(-a*d + b*c)**S(2)*(-a*d*g - b*c*g + S(3)*b*d*f)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b**S(3)*d**S(3)) - S(2)*g*n**S(2)*(-a*d + b*c)**S(2)*(-a*d*g - b*c*g + S(3)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(b**S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f + g*x)*log(e*((a + b*x)/(c + d*x))**n)**S(3), x), x, (f + g*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(3)/(S(2)*g) + S(3)*n**S(3)*(-c*g + d*f)**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(d**S(2)*g) - S(3)*n**S(2)*(-c*g + d*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(d**S(2)*g) - S(3)*n*(-c*g + d*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/(S(2)*d**S(2)*g) - S(3)*n**S(3)*(-a*g + b*f)**S(2)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*g) - S(3)*n**S(2)*(-a*g + b*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(b**S(2)*g) + S(3)*n*(-a*g + b*f)**S(2)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((a*d - b*c)/(d*(a + b*x)))/(S(2)*b**S(2)*g) + g*n*(a + b*x)*(S(3)*a*d/S(2) - S(3)*b*c/S(2))*log(e*((a + b*x)/(c + d*x))**n)**S(2)/(b**S(2)*d) - S(3)*g*n**S(3)*(-a*d + b*c)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b**S(2)*d**S(2)) - S(3)*g*n**S(2)*(-a*d + b*c)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*log((-a*d + b*c)/(b*(c + d*x)))/(b**S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(3)/b - n**S(3)*(-S(6)*a*d + S(6)*b*c)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(2)*(-S(6)*a*d + S(6)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(3)*a*d + S(3)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) # takes long time in test assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3)/(f + g*x), x), x, -S(6)*n**S(3)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/g + S(6)*n**S(3)*polylog(S(4), (a + b*x)*(-c*g + d*f)/((c + d*x)*(-a*g + b*f)))/g - S(6)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/g + S(6)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/g + S(3)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/g - S(3)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/g - log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))/g + log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/g, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3)/(f + g*x)**S(2), x), x, -n**S(3)*(-S(6)*a*d + S(6)*b*c)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)*(-c*g + d*f)) + n**S(2)*(-S(6)*a*d + S(6)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)*(-c*g + d*f)) + n*(-S(3)*a*d + S(3)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)*(-c*g + d*f)) + (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(3)/((f + g*x)*(-a*g + b*f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3)/(f + g*x)**S(3), x), x, S(3)*b**S(2)*n**S(3)*polylog(S(3), b*(c + d*x)/(d*(a + b*x)))/(g*(-a*g + b*f)**S(2)) + S(3)*b**S(2)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), b*(c + d*x)/(d*(a + b*x)))/(g*(-a*g + b*f)**S(2)) - S(3)*b**S(2)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((a*d - b*c)/(d*(a + b*x)))/(S(2)*g*(-a*g + b*f)**S(2)) - S(3)*d**S(2)*n**S(3)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(g*(-c*g + d*f)**S(2)) + S(3)*d**S(2)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(g*(-c*g + d*f)**S(2)) + S(3)*d**S(2)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/(S(2)*g*(-c*g + d*f)**S(2)) + S(3)*g*n**S(3)*(-a*d + b*c)**S(2)*polylog(S(2), (a + b*x)*(-c*g + d*f)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + S(3)*g*n**S(2)*(-a*d + b*c)**S(2)*log(e*((a + b*x)/(c + d*x))**n)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + g*n*(a + b*x)*(-S(3)*a*d/S(2) + S(3)*b*c/S(2))*log(e*((a + b*x)/(c + d*x))**n)**S(2)/((f + g*x)*(-a*g + b*f)**S(2)*(-c*g + d*f)) - n**S(3)*(-S(3)*a*d + S(3)*b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n**S(3)*(-S(3)*a*d + S(3)*b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n**S(2)*(-S(3)*a*d + S(3)*b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) - n**S(2)*(-S(3)*a*d + S(3)*b*c)*(-a*d*g - b*c*g + S(2)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) - n*(-S(3)*a*d/S(2) + S(3)*b*c/S(2))*(-a*d*g - b*c*g + S(2)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) + n*(-S(3)*a*d/S(2) + S(3)*b*c/S(2))*(-a*d*g - b*c*g + S(2)*b*d*f)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/((-a*g + b*f)**S(2)*(-c*g + d*f)**S(2)) - log(e*((a + b*x)/(c + d*x))**n)**S(3)/(S(2)*g*(f + g*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(4), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(4)/b + n**S(4)*(-S(24)*a*d + S(24)*b*c)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(b*d) - n**S(3)*(-S(24)*a*d + S(24)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(2)*(-S(12)*a*d + S(12)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(4)*a*d + S(4)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(5), x), x, (a + b*x)*log(e*((a + b*x)/(c + d*x))**n)**S(5)/b - n**S(5)*(-S(120)*a*d + S(120)*b*c)*polylog(S(5), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(4)*(-S(120)*a*d + S(120)*b*c)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(b*d) - n**S(3)*(-S(60)*a*d + S(60)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n**S(2)*(-S(20)*a*d + S(20)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(3)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(b*d) + n*(-S(5)*a*d + S(5)*b*c)*log(e*((a + b*x)/(c + d*x))**n)**S(4)*log((-a*d + b*c)/(b*(c + d*x)))/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**m*(c + d*x)**(-m + S(-2))/log(e*((a + b*x)/(c + d*x))**n), x), x, (e*((a + b*x)/(c + d*x))**n)**(-(m + S(1))/n)*(a + b*x)**(m + S(1))*(c + d*x)**(-m + S(-1))*Ei((m + S(1))*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(3)/((c + d*x)**S(5)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(-S(4)/n)*(a + b*x)**S(4)*Ei(S(4)*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(c + d*x)**S(4)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/((c + d*x)**S(4)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(-S(3)/n)*(a + b*x)**S(3)*Ei(S(3)*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(c + d*x)**S(3)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/((c + d*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(-S(2)/n)*(a + b*x)**S(2)*Ei(S(2)*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(c + d*x)**S(2)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((c + d*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(-S(1)/n)*(a + b*x)*Ei(log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(c + d*x)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x)*(c + d*x)*log(e*((a + b*x)/(c + d*x))**n)), x), x, log(log(e*((a + b*x)/(c + d*x))**n))/(n*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x)**S(2)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(S(1)/n)*(c + d*x)*Ei(-log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(a + b*x)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)/((a + b*x)**S(3)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(S(2)/n)*(c + d*x)**S(2)*Ei(-S(2)*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(a + b*x)**S(2)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**S(2)/((a + b*x)**S(4)*log(e*((a + b*x)/(c + d*x))**n)), x), x, (e*((a + b*x)/(c + d*x))**n)**(S(3)/n)*(c + d*x)**S(3)*Ei(-S(3)*log(e*((a + b*x)/(c + d*x))**n)/n)/(n*(a + b*x)**S(3)*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**p/((a + b*x)*(c + d*x)), x), x, log(e*((a + b*x)/(c + d*x))**n)**(p + S(1))/(n*(p + S(1))*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**p/(a*c + b*d*x**S(2) + x*(a*d + b*c)), x), x, log(e*((a + b*x)/(c + d*x))**n)**(p + S(1))/(n*(p + S(1))*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x/(a + b*x))/(a + b*x), x), x, -log(a/(a + b*x))*log(c*x/(a + b*x))/b - polylog(S(2), b*x/(a + b*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x/(a + b*x))**S(2)/(x*(a + b*x)), x), x, log(c*x/(a + b*x))**S(3)/(S(3)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a/(a + b*x))*log(c*x/(a + b*x))**S(2)/(x*(a + b*x)), x), x, -log(c*x/(a + b*x))**S(2)*polylog(S(2), b*x/(a + b*x))/a + S(2)*log(c*x/(a + b*x))*polylog(S(3), b*x/(a + b*x))/a - S(2)*polylog(S(4), b*x/(a + b*x))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/((c + d*x)*(f + g*x)), x), x, -n*polylog(S(2), (a + b*x)*(-c*g + d*f)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) - log(e*((a + b*x)/(c + d*x))**n)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f), expand=True, _diff=True, _numerical=True) # long time in test assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)/((c + d*x)*(f + g*x)), x), x, S(2)*n**S(2)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) - S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) - log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f), expand=True, _diff=True, _numerical=True) # || assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(3)/((c + d*x)*(f + g*x)), x), x, -S(6)*n**S(3)*polylog(S(4), (a + b*x)*(-c*g + d*f)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) + S(6)*n**S(2)*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) - S(3)*n*log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), (a*(-c*g + d*f) - b*c*g*x + b*d*f*x)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f) - log(e*((a + b*x)/(c + d*x))**n)**S(3)*log((f + g*x)*(-a*d + b*c)/((c + d*x)*(-a*g + b*f)))/(-c*g + d*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((-a*d + b*c)/(b*(c + d*x)))*log(e*(a + b*x)/(c + d*x))**S(2)/((c + d*x)*(a*g + b*g*x)), x), x, -log(e*(a + b*x)/(c + d*x))**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)) + S(2)*log(e*(a + b*x)/(c + d*x))*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)) - S(2)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)**S(2)*log((-a*d + b*c)/(b*(c + d*x)))/((c + d*x)*(a*g + b*g*x)), x), x, -S(2)*n**S(2)*polylog(S(4), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)) + S(2)*n*log(e*((a + b*x)/(c + d*x))**n)*polylog(S(3), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)) - log(e*((a + b*x)/(c + d*x))**n)**S(2)*polylog(S(2), d*(a + b*x)/(b*(c + d*x)))/(g*(-a*d + b*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)/x), x), x, b*log(x)/a + (a*x + b)*log(c*(a*x + b)/x)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)/x)**S(2), x), x, -S(2)*b*log(-b/(a*x))*log(c*(a*x + b)/x)/a - S(2)*b*polylog(S(2), S(1) + b/(a*x))/a + (a*x + b)*log(c*(a*x + b)/x)**S(2)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)/x)**S(3), x), x, -S(3)*b*log(-b/(a*x))*log(c*(a*x + b)/x)**S(2)/a - S(6)*b*log(c*(a*x + b)/x)*polylog(S(2), (a*x + b)/(a*x))/a + S(6)*b*polylog(S(3), (a*x + b)/(a*x))/a + (a*x + b)*log(c*(a*x + b)/x)**S(3)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)**S(2)/x**S(2)), x), x, x*log(c*(a*x + b)**S(2)/x**S(2)) + S(2)*b*log(a*x + b)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)**S(2)/x**S(2))**S(2), x), x, x*log(c*(a*x + b)**S(2)/x**S(2))**S(2) - S(4)*b*log(b/(a*x + b))*log(c*(a*x + b)**S(2)/x**S(2))/a + S(8)*b*polylog(S(2), a*x/(a*x + b))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a*x + b)**S(2)/x**S(2))**S(3), x), x, x*log(c*(a*x + b)**S(2)/x**S(2))**S(3) - S(6)*b*log(b/(a*x + b))*log(c*(a*x + b)**S(2)/x**S(2))**S(2)/a + S(24)*b*log(c*(a*x + b)**S(2)/x**S(2))*polylog(S(2), a*x/(a*x + b))/a + S(48)*b*polylog(S(3), a*x/(a*x + b))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**S(2)/(a*x + b)**S(2)), x), x, x*log(c*x**S(2)/(a*x + b)**S(2)) - S(2)*b*log(a*x + b)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**S(2)/(a*x + b)**S(2))**S(2), x), x, x*log(c*x**S(2)/(a*x + b)**S(2))**S(2) + S(4)*b*log(b/(a*x + b))*log(c*x**S(2)/(a*x + b)**S(2))/a + S(8)*b*polylog(S(2), a*x/(a*x + b))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**S(2)/(a*x + b)**S(2))**S(3), x), x, x*log(c*x**S(2)/(a*x + b)**S(2))**S(3) + S(6)*b*log(b/(a*x + b))*log(c*x**S(2)/(a*x + b)**S(2))**S(2)/a + S(24)*b*log(c*x**S(2)/(a*x + b)**S(2))*polylog(S(2), a*x/(a*x + b))/a - S(48)*b*polylog(S(3), a*x/(a*x + b))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b/x)/(d + e*x**S(2)), x), x, -I*log(sqrt(e)*(-a*x - b)/(I*a*sqrt(d) - b*sqrt(e)))*log(S(1) - I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) + I*log(sqrt(e)*(a*x + b)/(I*a*sqrt(d) + b*sqrt(e)))*log(S(1) + I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) + log(a + b/x)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*sqrt(e)) - I*polylog(S(2), a*(sqrt(d) - I*sqrt(e)*x)/(a*sqrt(d) + I*b*sqrt(e)))/(S(2)*sqrt(d)*sqrt(e)) + I*polylog(S(2), a*(sqrt(d) + I*sqrt(e)*x)/(a*sqrt(d) - I*b*sqrt(e)))/(S(2)*sqrt(d)*sqrt(e)) + I*polylog(S(2), -I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) - I*polylog(S(2), I*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x**S(2)), x), x, -I*n*log(sqrt(g)*(-a - b*x)/(-a*sqrt(g) + I*b*sqrt(f)))*log(S(1) - I*sqrt(g)*x/sqrt(f))/(S(2)*sqrt(f)*sqrt(g)) + I*n*log(sqrt(g)*(a + b*x)/(a*sqrt(g) + I*b*sqrt(f)))*log(S(1) + I*sqrt(g)*x/sqrt(f))/(S(2)*sqrt(f)*sqrt(g)) + I*n*log(sqrt(g)*(-c - d*x)/(-c*sqrt(g) + I*d*sqrt(f)))*log(S(1) - I*sqrt(g)*x/sqrt(f))/(S(2)*sqrt(f)*sqrt(g)) - I*n*log(sqrt(g)*(c + d*x)/(c*sqrt(g) + I*d*sqrt(f)))*log(S(1) + I*sqrt(g)*x/sqrt(f))/(S(2)*sqrt(f)*sqrt(g)) - I*n*polylog(S(2), b*(sqrt(f) - I*sqrt(g)*x)/(I*a*sqrt(g) + b*sqrt(f)))/(S(2)*sqrt(f)*sqrt(g)) + I*n*polylog(S(2), b*(sqrt(f) + I*sqrt(g)*x)/(-I*a*sqrt(g) + b*sqrt(f)))/(S(2)*sqrt(f)*sqrt(g)) + I*n*polylog(S(2), d*(sqrt(f) - I*sqrt(g)*x)/(I*c*sqrt(g) + d*sqrt(f)))/(S(2)*sqrt(f)*sqrt(g)) - I*n*polylog(S(2), d*(sqrt(f) + I*sqrt(g)*x)/(-I*c*sqrt(g) + d*sqrt(f)))/(S(2)*sqrt(f)*sqrt(g)) + log(e*((a + b*x)/(c + d*x))**n)*atan(sqrt(g)*x/sqrt(f))/(sqrt(f)*sqrt(g)), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate(log(e*((a + b*x)/(c + d*x))**n)/(f + g*x + h*x**S(2)), x), x, n*log((S(2)*a*h - b*g + b*(g + S(2)*h*x))/(S(2)*a*h - b*(g + sqrt(-S(4)*f*h + g**S(2)))))*log(g/sqrt(-S(4)*f*h + g**S(2)) + S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/sqrt(-S(4)*f*h + g**S(2)) - n*log((S(2)*c*h - d*g + d*(g + S(2)*h*x))/(S(2)*c*h - d*(g + sqrt(-S(4)*f*h + g**S(2)))))*log(g/sqrt(-S(4)*f*h + g**S(2)) + S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/sqrt(-S(4)*f*h + g**S(2)) - n*log((-S(2)*a*h + b*g - b*(g + S(2)*h*x))/(-S(2)*a*h + b*g - b*sqrt(-S(4)*f*h + g**S(2))))*log(-g/sqrt(-S(4)*f*h + g**S(2)) - S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/sqrt(-S(4)*f*h + g**S(2)) + n*log((-S(2)*c*h + d*g - d*(g + S(2)*h*x))/(-S(2)*c*h + d*g - d*sqrt(-S(4)*f*h + g**S(2))))*log(-g/sqrt(-S(4)*f*h + g**S(2)) - S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/sqrt(-S(4)*f*h + g**S(2)) - n*polylog(S(2), b*sqrt(-S(4)*f*h + g**S(2))*(-g/sqrt(-S(4)*f*h + g**S(2)) - S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/(S(2)*a*h - b*(g - sqrt(-S(4)*f*h + g**S(2)))))/sqrt(-S(4)*f*h + g**S(2)) + n*polylog(S(2), -b*sqrt(-S(4)*f*h + g**S(2))*(g/sqrt(-S(4)*f*h + g**S(2)) + S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/(S(2)*a*h - b*(g + sqrt(-S(4)*f*h + g**S(2)))))/sqrt(-S(4)*f*h + g**S(2)) + n*polylog(S(2), d*sqrt(-S(4)*f*h + g**S(2))*(-g/sqrt(-S(4)*f*h + g**S(2)) - S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/(S(2)*c*h - d*(g - sqrt(-S(4)*f*h + g**S(2)))))/sqrt(-S(4)*f*h + g**S(2)) - n*polylog(S(2), -d*sqrt(-S(4)*f*h + g**S(2))*(g/sqrt(-S(4)*f*h + g**S(2)) + S(2)*h*x/sqrt(-S(4)*f*h + g**S(2)) + S(1))/(S(2)*c*h - d*(g + sqrt(-S(4)*f*h + g**S(2)))))/sqrt(-S(4)*f*h + g**S(2)) - S(2)*log(e*((a + b*x)/(c + d*x))**n)*atanh((g + S(2)*h*x)/sqrt(-S(4)*f*h + g**S(2)))/sqrt(-S(4)*f*h + g**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**n/(-c**S(2)*x**S(2) + S(1)), x), x, -(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**(n + S(1))/(b*c*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(3)/(-c**S(2)*x**S(2) + S(1)), x), x, -(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(4)/(S(4)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(2)/(-c**S(2)*x**S(2) + S(1)), x), x, -(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(3)/(S(3)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))/(-c**S(2)*x**S(2) + S(1)), x), x, -(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(2)/(S(2)*b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))*(-c**S(2)*x**S(2) + S(1))), x), x, -log(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))/(b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(2)*(-c**S(2)*x**S(2) + S(1))), x), x, S(1)/(b*c*(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(3)*(-c**S(2)*x**S(2) + S(1))), x), x, S(1)/(S(2)*b*c*(a + b*log(sqrt(-c*x + S(1))/sqrt(c*x + S(1))))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/(-a**S(2)*x**S(2) + S(1)), x), x, -log(sqrt(-a*x + S(1))/sqrt(a*x + S(1)))**S(2)/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(a + b*exp(x)), x), x, -x**S(4)*log(S(1) + b*exp(x)/a)/S(4) + x**S(4)*log(a + b*exp(x))/S(4) - x**S(3)*polylog(S(2), -b*exp(x)/a) + S(3)*x**S(2)*polylog(S(3), -b*exp(x)/a) - S(6)*x*polylog(S(4), -b*exp(x)/a) + S(6)*polylog(S(5), -b*exp(x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(a + b*exp(x)), x), x, -x**S(3)*log(S(1) + b*exp(x)/a)/S(3) + x**S(3)*log(a + b*exp(x))/S(3) - x**S(2)*polylog(S(2), -b*exp(x)/a) + S(2)*x*polylog(S(3), -b*exp(x)/a) - S(2)*polylog(S(4), -b*exp(x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(a + b*exp(x)), x), x, -x**S(2)*log(S(1) + b*exp(x)/a)/S(2) + x**S(2)*log(a + b*exp(x))/S(2) - x*polylog(S(2), -b*exp(x)/a) + polylog(S(3), -b*exp(x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*exp(x)), x), x, -x*log(S(1) + b*exp(x)/a) + x*log(a + b*exp(x)) - polylog(S(2), -b*exp(x)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*exp(x))/x, x), x, Integral(log(a + b*exp(x))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(e*(f**(c*(a + b*x)))**n + S(1)), x), x, -x**S(3)*polylog(S(2), -e*(f**(c*(a + b*x)))**n)/(b*c*n*log(f)) + S(3)*x**S(2)*polylog(S(3), -e*(f**(c*(a + b*x)))**n)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)) - S(6)*x*polylog(S(4), -e*(f**(c*(a + b*x)))**n)/(b**S(3)*c**S(3)*n**S(3)*log(f)**S(3)) + S(6)*polylog(S(5), -e*(f**(c*(a + b*x)))**n)/(b**S(4)*c**S(4)*n**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(e*(f**(c*(a + b*x)))**n + S(1)), x), x, -x**S(2)*polylog(S(2), -e*(f**(c*(a + b*x)))**n)/(b*c*n*log(f)) + S(2)*x*polylog(S(3), -e*(f**(c*(a + b*x)))**n)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)) - S(2)*polylog(S(4), -e*(f**(c*(a + b*x)))**n)/(b**S(3)*c**S(3)*n**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(e*(f**(c*(a + b*x)))**n + S(1)), x), x, -x*polylog(S(2), -e*(f**(c*(a + b*x)))**n)/(b*c*n*log(f)) + polylog(S(3), -e*(f**(c*(a + b*x)))**n)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(f**(c*(a + b*x)))**n + S(1)), x), x, -polylog(S(2), -e*(f**(c*(a + b*x)))**n)/(b*c*n*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(e*(f**(c*(a + b*x)))**n + S(1))/x, x), x, Integral(log(e*(f**(c*(a + b*x)))**n + S(1))/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log(d + e*(f**(c*(a + b*x)))**n), x), x, -x**S(4)*log(S(1) + e*(f**(c*(a + b*x)))**n/d)/S(4) + x**S(4)*log(d + e*(f**(c*(a + b*x)))**n)/S(4) - x**S(3)*polylog(S(2), -e*(f**(c*(a + b*x)))**n/d)/(b*c*n*log(f)) + S(3)*x**S(2)*polylog(S(3), -e*(f**(c*(a + b*x)))**n/d)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)) - S(6)*x*polylog(S(4), -e*(f**(c*(a + b*x)))**n/d)/(b**S(3)*c**S(3)*n**S(3)*log(f)**S(3)) + S(6)*polylog(S(5), -e*(f**(c*(a + b*x)))**n/d)/(b**S(4)*c**S(4)*n**S(4)*log(f)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*log(d + e*(f**(c*(a + b*x)))**n), x), x, -x**S(3)*log(S(1) + e*(f**(c*(a + b*x)))**n/d)/S(3) + x**S(3)*log(d + e*(f**(c*(a + b*x)))**n)/S(3) - x**S(2)*polylog(S(2), -e*(f**(c*(a + b*x)))**n/d)/(b*c*n*log(f)) + S(2)*x*polylog(S(3), -e*(f**(c*(a + b*x)))**n/d)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)) - S(2)*polylog(S(4), -e*(f**(c*(a + b*x)))**n/d)/(b**S(3)*c**S(3)*n**S(3)*log(f)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(d + e*(f**(c*(a + b*x)))**n), x), x, -x**S(2)*log(S(1) + e*(f**(c*(a + b*x)))**n/d)/S(2) + x**S(2)*log(d + e*(f**(c*(a + b*x)))**n)/S(2) - x*polylog(S(2), -e*(f**(c*(a + b*x)))**n/d)/(b*c*n*log(f)) + polylog(S(3), -e*(f**(c*(a + b*x)))**n/d)/(b**S(2)*c**S(2)*n**S(2)*log(f)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d + e*(f**(c*(a + b*x)))**n), x), x, -x*log(S(1) + e*(f**(c*(a + b*x)))**n/d) + x*log(d + e*(f**(c*(a + b*x)))**n) - polylog(S(2), -e*(f**(c*(a + b*x)))**n/d)/(b*c*n*log(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(d + e*(f**(c*(a + b*x)))**n)/x, x), x, Integral(log(d + e*(f**(c*(a + b*x)))**n)/x, x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(b*(F**(e*(c + d*x)))**n + pi), x), x, x*log(pi) - polylog(S(2), -b*(F**(e*(c + d*x)))**n/pi)/(d*e*n*log(F)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sin(a + b*x), x), x, -log(x)*cos(a + b*x)/b - sin(a)*Si(b*x)/b + cos(a)*Ci(b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sin(a + b*x)**S(2), x), x, x*log(x)/S(2) - x/S(2) - log(x)*sin(a + b*x)*cos(a + b*x)/(S(2)*b) + sin(S(2)*a)*Ci(S(2)*b*x)/(S(4)*b) + cos(S(2)*a)*Si(S(2)*b*x)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sin(a + b*x)**S(3), x), x, log(x)*cos(a + b*x)**S(3)/(S(3)*b) - log(x)*cos(a + b*x)/b - S(3)*sin(a)*Si(b*x)/(S(4)*b) + sin(S(3)*a)*Si(S(3)*b*x)/(S(12)*b) + S(3)*cos(a)*Ci(b*x)/(S(4)*b) - cos(S(3)*a)*Ci(S(3)*b*x)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cos(a + b*x), x), x, log(x)*sin(a + b*x)/b - sin(a)*Ci(b*x)/b - cos(a)*Si(b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cos(a + b*x)**S(2), x), x, x*log(x)/S(2) - x/S(2) + log(x)*sin(a + b*x)*cos(a + b*x)/(S(2)*b) - sin(S(2)*a)*Ci(S(2)*b*x)/(S(4)*b) - cos(S(2)*a)*Si(S(2)*b*x)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cos(a + b*x)**S(3), x), x, -log(x)*sin(a + b*x)**S(3)/(S(3)*b) + log(x)*sin(a + b*x)/b - S(3)*sin(a)*Ci(b*x)/(S(4)*b) - sin(S(3)*a)*Ci(S(3)*b*x)/(S(12)*b) - S(3)*cos(a)*Si(b*x)/(S(4)*b) - cos(S(3)*a)*Si(S(3)*b*x)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cos(x) + sin(x)/x, x), x, log(x)*sin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sin(x)), x), x, I*x**S(2)/S(2) + x*log(a*sin(x)) - x*log(-exp(S(2)*I*x) + S(1)) + I*polylog(S(2), exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sin(x)**S(2)), x), x, I*x**S(2) + x*log(a*sin(x)**S(2)) - S(2)*x*log(-exp(S(2)*I*x) + S(1)) + I*polylog(S(2), exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sin(x)**n), x), x, I*n*x**S(2)/S(2) - n*x*log(-exp(S(2)*I*x) + S(1)) + I*n*polylog(S(2), exp(S(2)*I*x))/S(2) + x*log(a*sin(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cos(x)), x), x, I*x**S(2)/S(2) + x*log(a*cos(x)) - x*log(exp(S(2)*I*x) + S(1)) + I*polylog(S(2), -exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cos(x)**S(2)), x), x, I*x**S(2) + x*log(a*cos(x)**S(2)) - S(2)*x*log(exp(S(2)*I*x) + S(1)) + I*polylog(S(2), -exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cos(x)**n), x), x, I*n*x**S(2)/S(2) - n*x*log(exp(S(2)*I*x) + S(1)) + I*n*polylog(S(2), -exp(S(2)*I*x))/S(2) + x*log(a*cos(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tan(x)), x), x, x*log(a*tan(x)) + S(2)*x*atanh(exp(S(2)*I*x)) - I*polylog(S(2), -exp(S(2)*I*x))/S(2) + I*polylog(S(2), exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tan(x)**S(2)), x), x, x*log(a*tan(x)**S(2)) + S(4)*x*atanh(exp(S(2)*I*x)) - I*polylog(S(2), -exp(S(2)*I*x)) + I*polylog(S(2), exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tan(x)**n), x), x, S(2)*n*x*atanh(exp(S(2)*I*x)) - I*n*polylog(S(2), -exp(S(2)*I*x))/S(2) + I*n*polylog(S(2), exp(S(2)*I*x))/S(2) + x*log(a*tan(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cot(x)), x), x, x*log(a*cot(x)) - S(2)*x*atanh(exp(S(2)*I*x)) + I*polylog(S(2), -exp(S(2)*I*x))/S(2) - I*polylog(S(2), exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cot(x)**S(2)), x), x, x*log(a*cot(x)**S(2)) - S(4)*x*atanh(exp(S(2)*I*x)) + I*polylog(S(2), -exp(S(2)*I*x)) - I*polylog(S(2), exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cot(x)**n), x), x, -S(2)*n*x*atanh(exp(S(2)*I*x)) + I*n*polylog(S(2), -exp(S(2)*I*x))/S(2) - I*n*polylog(S(2), exp(S(2)*I*x))/S(2) + x*log(a*cot(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sec(x)), x), x, -I*x**S(2)/S(2) + x*log(a*sec(x)) + x*log(exp(S(2)*I*x) + S(1)) - I*polylog(S(2), -exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sec(x)**S(2)), x), x, -I*x**S(2) + x*log(a*sec(x)**S(2)) + S(2)*x*log(exp(S(2)*I*x) + S(1)) - I*polylog(S(2), -exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sec(x)**n), x), x, -I*n*x**S(2)/S(2) + n*x*log(exp(S(2)*I*x) + S(1)) - I*n*polylog(S(2), -exp(S(2)*I*x))/S(2) + x*log(a*sec(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csc(x)), x), x, -I*x**S(2)/S(2) + x*log(a*csc(x)) + x*log(-exp(S(2)*I*x) + S(1)) - I*polylog(S(2), exp(S(2)*I*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csc(x)**S(2)), x), x, -I*x**S(2) + x*log(a*csc(x)**S(2)) + S(2)*x*log(-exp(S(2)*I*x) + S(1)) - I*polylog(S(2), exp(S(2)*I*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csc(x)**n), x), x, -I*n*x**S(2)/S(2) + n*x*log(-exp(S(2)*I*x) + S(1)) - I*n*polylog(S(2), exp(S(2)*I*x))/S(2) + x*log(a*csc(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-cos(S(2)*x)/S(2) + S(1)/2)*cos(x), x), x, log(-cos(S(2)*x)/S(2) + S(1)/2)*sin(x) - S(2)*sin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(cot(x)/log(E*sin(x)), x), x, log(log(E*sin(x))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(cot(x)/log(E*sin(x)), x), x, log(log(sin(x)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(cot(x)/log(exp(sin(x))), x), x, log(log(exp(sin(x))))/(-log(exp(sin(x))) + sin(x)) - log(sin(x))/(-log(exp(sin(x))) + sin(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(cos(x))*sec(x)**S(2), x), x, -x + log(cos(x))*tan(x) + tan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*cot(x), x), x, log(sin(x))**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*sin(x)**S(2)*cos(x), x), x, log(sin(x))*sin(x)**S(3)/S(3) - sin(x)**S(3)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(a/S(2) + b*x/S(2))*cos(a/S(2) + b*x/S(2)))*cos(a + b*x), x), x, log(sin(a/S(2) + b*x/S(2))*cos(a/S(2) + b*x/S(2)))*sin(a + b*x)/b - sin(a + b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(tan(x)/log(cos(x)), x), x, -log(log(cos(x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(cos(x))*tan(x), x), x, -log(cos(x))**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(cos(x))*sin(x), x), x, -log(cos(x))*cos(x) + cos(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(cos(x))*cos(x), x), x, log(cos(x))*sin(x) - sin(x) + atanh(sin(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*cos(x), x), x, log(sin(x))*sin(x) - sin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*sin(x)**S(2), x), x, I*x**S(2)/S(4) - x*log(-exp(S(2)*I*x) + S(1))/S(2) + x*log(sin(x))/S(2) + x/S(4) - log(sin(x))*sin(x)*cos(x)/S(2) + sin(x)*cos(x)/S(4) + I*polylog(S(2), exp(S(2)*I*x))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*sin(x)**S(3), x), x, log(sin(x))*cos(x)**S(3)/S(3) - log(sin(x))*cos(x) - cos(x)**S(3)/S(9) + S(2)*cos(x)/S(3) - S(2)*atanh(cos(x))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(sqrt(x))), x), x, I*x**(S(3)/2)/S(3) + I*sqrt(x)*polylog(S(2), exp(S(2)*I*sqrt(x))) - x*log(-exp(S(2)*I*sqrt(x)) + S(1)) + x*log(sin(sqrt(x))) - polylog(S(3), exp(S(2)*I*sqrt(x)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sin(x))*csc(x)**S(2), x), x, -x - log(sin(x))*cot(x) - cot(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sinh(a + b*x), x), x, log(x)*cosh(a + b*x)/b - sinh(a)*Shi(b*x)/b - cosh(a)*Chi(b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sinh(a + b*x)**S(2), x), x, -x*log(x)/S(2) + x/S(2) + log(x)*sinh(a + b*x)*cosh(a + b*x)/(S(2)*b) - sinh(S(2)*a)*Chi(S(2)*b*x)/(S(4)*b) - cosh(S(2)*a)*Shi(S(2)*b*x)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sinh(a + b*x)**S(3), x), x, log(x)*cosh(a + b*x)**S(3)/(S(3)*b) - log(x)*cosh(a + b*x)/b + S(3)*sinh(a)*Shi(b*x)/(S(4)*b) - sinh(S(3)*a)*Shi(S(3)*b*x)/(S(12)*b) + S(3)*cosh(a)*Chi(b*x)/(S(4)*b) - cosh(S(3)*a)*Chi(S(3)*b*x)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cosh(a + b*x), x), x, log(x)*sinh(a + b*x)/b - sinh(a)*Chi(b*x)/b - cosh(a)*Shi(b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cosh(a + b*x)**S(2), x), x, x*log(x)/S(2) - x/S(2) + log(x)*sinh(a + b*x)*cosh(a + b*x)/(S(2)*b) - sinh(S(2)*a)*Chi(S(2)*b*x)/(S(4)*b) - cosh(S(2)*a)*Shi(S(2)*b*x)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*cosh(a + b*x)**S(3), x), x, log(x)*sinh(a + b*x)**S(3)/(S(3)*b) + log(x)*sinh(a + b*x)/b - S(3)*sinh(a)*Chi(b*x)/(S(4)*b) - sinh(S(3)*a)*Chi(S(3)*b*x)/(S(12)*b) - S(3)*cosh(a)*Shi(b*x)/(S(4)*b) - cosh(S(3)*a)*Shi(S(3)*b*x)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sinh(x)), x), x, x**S(2)/S(2) + x*log(a*sinh(x)) - x*log(-exp(S(2)*x) + S(1)) - polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sinh(x)**S(2)), x), x, x**S(2) + x*log(a*sinh(x)**S(2)) - S(2)*x*log(-exp(S(2)*x) + S(1)) - polylog(S(2), exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sinh(x)**n), x), x, n*x**S(2)/S(2) - n*x*log(-exp(S(2)*x) + S(1)) - n*polylog(S(2), exp(S(2)*x))/S(2) + x*log(a*sinh(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cosh(x)), x), x, x**S(2)/S(2) + x*log(a*cosh(x)) - x*log(exp(S(2)*x) + S(1)) - polylog(S(2), -exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cosh(x)**S(2)), x), x, x**S(2) + x*log(a*cosh(x)**S(2)) - S(2)*x*log(exp(S(2)*x) + S(1)) - polylog(S(2), -exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*cosh(x)**n), x), x, n*x**S(2)/S(2) - n*x*log(exp(S(2)*x) + S(1)) - n*polylog(S(2), -exp(S(2)*x))/S(2) + x*log(a*cosh(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(tanh(x)), x), x, x*log(tanh(x)) + S(2)*x*atanh(exp(S(2)*x)) + polylog(S(2), -exp(S(2)*x))/S(2) - polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tanh(x)), x), x, x*log(a*tanh(x)) + S(2)*x*atanh(exp(S(2)*x)) + polylog(S(2), -exp(S(2)*x))/S(2) - polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tanh(x)**S(2)), x), x, x*log(a*tanh(x)**S(2)) + S(4)*x*atanh(exp(S(2)*x)) + polylog(S(2), -exp(S(2)*x)) - polylog(S(2), exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*tanh(x)**n), x), x, S(2)*n*x*atanh(exp(S(2)*x)) + n*polylog(S(2), -exp(S(2)*x))/S(2) - n*polylog(S(2), exp(S(2)*x))/S(2) + x*log(a*tanh(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(coth(x)), x), x, x*log(coth(x)) - S(2)*x*atanh(exp(S(2)*x)) - polylog(S(2), -exp(S(2)*x))/S(2) + polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*coth(x)), x), x, x*log(a*coth(x)) - S(2)*x*atanh(exp(S(2)*x)) - polylog(S(2), -exp(S(2)*x))/S(2) + polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*coth(x)**S(2)), x), x, x*log(a*coth(x)**S(2)) - S(4)*x*atanh(exp(S(2)*x)) - polylog(S(2), -exp(S(2)*x)) + polylog(S(2), exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*coth(x)**n), x), x, -S(2)*n*x*atanh(exp(S(2)*x)) - n*polylog(S(2), -exp(S(2)*x))/S(2) + n*polylog(S(2), exp(S(2)*x))/S(2) + x*log(a*coth(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sech(x)), x), x, -x**S(2)/S(2) + x*log(a*sech(x)) + x*log(exp(S(2)*x) + S(1)) + polylog(S(2), -exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sech(x)**S(2)), x), x, -x**S(2) + x*log(a*sech(x)**S(2)) + S(2)*x*log(exp(S(2)*x) + S(1)) + polylog(S(2), -exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*sech(x)**n), x), x, -n*x**S(2)/S(2) + n*x*log(exp(S(2)*x) + S(1)) + n*polylog(S(2), -exp(S(2)*x))/S(2) + x*log(a*sech(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csch(x)), x), x, -x**S(2)/S(2) + x*log(a*csch(x)) + x*log(-exp(S(2)*x) + S(1)) + polylog(S(2), exp(S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csch(x)**S(2)), x), x, -x**S(2) + x*log(a*csch(x)**S(2)) + S(2)*x*log(-exp(S(2)*x) + S(1)) + polylog(S(2), exp(S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*csch(x)**n), x), x, -n*x**S(2)/S(2) + n*x*log(-exp(S(2)*x) + S(1)) + n*polylog(S(2), exp(S(2)*x))/S(2) + x*log(a*csch(x)**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(cosh(x)**S(2))*sinh(x), x), x, log(cosh(x)**S(2))*cosh(x) - S(2)*cosh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/sqrt(x), x), x, S(2)*sqrt(x)*log(x) - S(4)*sqrt(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(-S(3)*x**S(2) + S(2)), x), x, -x**S(2)/S(2) - (-x**S(2)/S(2) + S(1)/3)*log(-S(3)*x**S(2) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(-log(x)**S(2) + S(1))), x), x, asin(log(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(16)*x**S(3)*log(x)**S(2), x), x, S(4)*x**S(4)*log(x)**S(2) - S(2)*x**S(4)*log(x) + x**S(4)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sqrt(a + b*x)), x), x, -x/S(2) + (a + b*x)*log(sqrt(a + b*x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(sqrt(x + S(2))), x), x, x**S(2)*log(sqrt(x + S(2)))/S(2) - x**S(2)/S(8) + x/S(2) - log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log((S(3)*x + S(1))**(S(1)/3)), x), x, x**S(2)*log((S(3)*x + S(1))**(S(1)/3))/S(2) - x**S(2)/S(12) + x/S(18) - log(S(3)*x + S(1))/S(54), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(x**S(3) + x), x), x, x**S(2)*log(x**S(3) + x)/S(2) - S(3)*x**S(2)/S(4) + log(x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x + sqrt(x**S(2) + S(1))), x), x, x*log(x + sqrt(x**S(2) + S(1))) - sqrt(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x + sqrt(x**S(2) + S(-1))), x), x, x*log(x + sqrt(x**S(2) + S(-1))) - sqrt(x**S(2) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x - sqrt(x**S(2) + S(-1))), x), x, x*log(x - sqrt(x**S(2) + S(-1))) + sqrt(x**S(2) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sqrt(x) + sqrt(x + S(1))), x), x, -sqrt(x)*sqrt(x + S(1))/S(2) + x*log(sqrt(x) + sqrt(x + S(1))) + asinh(sqrt(x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(1)/3)*log(x), x), x, S(3)*x**(S(4)/3)*log(x)/S(4) - S(9)*x**(S(4)/3)/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**log(x), x), x, x**(log(S(2)) + S(1))/(log(S(2)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-log(x) + S(1))/x**S(2), x), x, log(x)/x, expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-log(x) + S(1))/x**S(2), x), x, (log(x) + S(-1))/x + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x + sqrt(x + S(1)) + S(1)), x), x, x*log(x + sqrt(x + S(1)) + S(1)) - x + sqrt(x + S(1)) + log(x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**S(3) + x), x), x, x*log(x**S(3) + x) - S(3)*x + S(2)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**log(S(7)*x + S(-8)), x), x, (S(7)*x + S(-8))**(log(S(2)) + S(1))/(S(7)*(log(S(2)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((S(5)*x + S(-11))/(S(76)*x + S(5))), x), x, (x + S(-11)/5)*log((S(5)*x + S(-11))/(S(76)*x + S(5))) - S(861)*log(S(76)*x + S(5))/S(380), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((x + S(1))/(x + S(-1)))/x**S(2), x), x, S(2)*log(x) - S(2)*log(-x + S(1)) - (x + S(1))*log((-x + S(-1))/(-x + S(1)))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(1)/(x + S(13))), x), x, x + (x + S(13))*log(S(1)/(x + S(13))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log((x + S(1))/x**S(2)), x), x, x**S(2)*log((x + S(1))/x**S(2))/S(2) + x**S(2)/S(4) + x/S(2) - log(x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*log((S(5)*x + S(7))/x**S(2)), x), x, x**S(4)*log((S(5)*x + S(7))/x**S(2))/S(4) + x**S(4)/S(16) + S(7)*x**S(3)/S(60) - S(49)*x**S(2)/S(200) + S(343)*x/S(500) - S(2401)*log(S(5)*x + S(7))/S(2500), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*log(a + b*x), x), x, -a*x/S(2) - b*x**S(2)/S(4) + (a + b*x)**S(2)*log(a + b*x)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)*log(a + b*x), x), x, (a + b*x)**S(3)*log(a + b*x)/(S(3)*b) - (a + b*x)**S(3)/(S(9)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x)/(a + b*x), x), x, log(a + b*x)**S(2)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x)/(a + b*x)**S(2), x), x, -log(a + b*x)/(b*(a + b*x)) - S(1)/(b*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*log(a + b*x), x), x, (a + b*x)**(n + S(1))*log(a + b*x)/(b*(n + S(1))) - (a + b*x)**(n + S(1))/(b*(n + S(1))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*log(b*x)**p), x), x, x*log(a*log(b*x)**p) - p*li(b*x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*log(b*x**n)**p), x), x, -p*x*(b*x**n)**(-S(1)/n)*Ei(log(b*x**n)/n) + x*log(a*log(b*x**n)**p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*log(b*x)**p)/x, x), x, -(p - log(a*log(b*x)**p))*log(b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a*log(b*x**n)**p)/x, x), x, -(p - log(a*log(b*x**n)**p))*log(b*x**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*log(b*x)**p), x), x, -p*x**(m + S(1))*(b*x)**(-m + S(-1))*Ei((m + S(1))*log(b*x))/(m + S(1)) + x**(m + S(1))*log(a*log(b*x)**p)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*log(a*log(b*x**n)**p), x), x, -p*x**(m + S(1))*(b*x**n)**(-(m + S(1))/n)*Ei((m + S(1))*log(b*x**n)/n)/(m + S(1)) + x**(m + S(1))*log(a*log(b*x**n)**p)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/sqrt(a + b*log(x)), x), x, -sqrt(pi)*a*exp(-a/b)*erfi(sqrt(a + b*log(x))/sqrt(b))/b**(S(3)/2) + x*sqrt(a + b*log(x))/b - sqrt(pi)*exp(-a/b)*erfi(sqrt(a + b*log(x))/sqrt(b))/(S(2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/sqrt(a - b*log(x)), x), x, -sqrt(pi)*a*exp(a/b)*erf(sqrt(a - b*log(x))/sqrt(b))/b**(S(3)/2) - x*sqrt(a - b*log(x))/b + sqrt(pi)*exp(a/b)*erf(sqrt(a - b*log(x))/sqrt(b))/(S(2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*log(x))/sqrt(a + b*log(x)), x), x, B*x*sqrt(a + b*log(x))/b - sqrt(pi)*B*exp(-a/b)*erfi(sqrt(a + b*log(x))/sqrt(b))/(S(2)*sqrt(b)) + sqrt(pi)*(A*b - B*a)*exp(-a/b)*erfi(sqrt(a + b*log(x))/sqrt(b))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*log(x))/sqrt(a - b*log(x)), x), x, -B*x*sqrt(a - b*log(x))/b + sqrt(pi)*B*exp(a/b)*erf(sqrt(a - b*log(x))/sqrt(b))/(S(2)*sqrt(b)) + sqrt(pi)*(-A*b - B*a)*exp(a/b)*erf(sqrt(a - b*log(x))/sqrt(b))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(x)/sqrt(x**S(2) + S(-1)), x), x, sqrt(x**S(2) + S(-1))*log(x) - sqrt(x**S(2) + S(-1)) + atan(sqrt(x**S(2) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(x**S(2) + S(4))*log(x), x), x, (x**S(2) + S(4))**(S(3)/2)*log(x)/S(3) - (x**S(2) + S(4))**(S(3)/2)/S(9) - S(4)*sqrt(x**S(2) + S(4))/S(3) + S(8)*atanh(sqrt(x**S(2) + S(4))/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x*log(c*x**n)), x), x, log(a + b*log(c*x**n))/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x*log(c*x**n)**S(2)), x), x, atan(sqrt(b)*log(c*x**n)/sqrt(a))/(sqrt(a)*sqrt(b)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x*log(c*x**n)**S(3)), x), x, log(a**(S(1)/3) + b**(S(1)/3)*log(c*x**n))/(S(3)*a**(S(2)/3)*b**(S(1)/3)*n) - log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*log(c*x**n) + b**(S(2)/3)*log(c*x**n)**S(2))/(S(6)*a**(S(2)/3)*b**(S(1)/3)*n) - sqrt(S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*log(c*x**n))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(1)/3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x*log(c*x**n)**S(4)), x), x, -sqrt(S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*log(c*x**n) + sqrt(a) + sqrt(b)*log(c*x**n)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*n) + sqrt(S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*log(c*x**n) + sqrt(a) + sqrt(b)*log(c*x**n)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*n) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*log(c*x**n)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*n) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*log(c*x**n)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x/log(c*x**n)), x), x, log(x)/a - b*log(a*log(c*x**n) + b)/(a**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x/log(c*x**n)**S(2)), x), x, log(x)/a - sqrt(b)*atan(sqrt(a)*log(c*x**n)/sqrt(b))/(a**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x/log(c*x**n)**S(3)), x), x, log(x)/a - b**(S(1)/3)*log(a**(S(1)/3)*log(c*x**n) + b**(S(1)/3))/(S(3)*a**(S(4)/3)*n) + b**(S(1)/3)*log(a**(S(2)/3)*log(c*x**n)**S(2) - a**(S(1)/3)*b**(S(1)/3)*log(c*x**n) + b**(S(2)/3))/(S(6)*a**(S(4)/3)*n) + sqrt(S(3))*b**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*a**(S(1)/3)*log(c*x**n) + b**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(3)*a**(S(4)/3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x/log(c*x**n)**S(4)), x), x, log(x)/a + sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*log(c*x**n) + sqrt(a)*log(c*x**n)**S(2) + sqrt(b))/(S(8)*a**(S(5)/4)*n) - sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*log(c*x**n) + sqrt(a)*log(c*x**n)**S(2) + sqrt(b))/(S(8)*a**(S(5)/4)*n) - sqrt(S(2))*b**(S(1)/4)*atan(sqrt(S(2))*a**(S(1)/4)*log(c*x**n)/b**(S(1)/4) + S(-1))/(S(4)*a**(S(5)/4)*n) - sqrt(S(2))*b**(S(1)/4)*atan(sqrt(S(2))*a**(S(1)/4)*log(c*x**n)/b**(S(1)/4) + S(1))/(S(4)*a**(S(5)/4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(S(4)*x*log(x)**S(2) + x), x), x, log(S(4)*log(x)**S(2) + S(1))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(S(7)*x)**S(2) + x*log(S(7)*x) + x), x), x, S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*log(S(7)*x) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(S(3)*x) + S(-1))/(x*(log(S(3)*x)**S(2) - log(S(3)*x) + S(1))), x), x, log(log(S(3)*x)**S(2) - log(S(3)*x) + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*log(S(3)*x) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(S(3)*x)**S(2) + S(-1))/(x*log(S(3)*x)**S(3) + x), x), x, log(log(S(3)*x)**S(2) - log(S(3)*x) + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*log(S(3)*x) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(S(3)*x)**S(2) + S(-1))/(x*log(S(3)*x)**S(2) + x*log(S(3)*x) + x), x), x, log(x) - log(log(S(3)*x)**S(2) + log(S(3)*x) + S(1))/S(2) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*log(S(3)*x) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(log(x) + S(3))), x), x, log(log(x) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(x) + S(1))/x, x), x, S(2)*(log(x) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(x) + S(1))**S(5)/x, x), x, (log(x) + S(1))**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(log(x))), x), x, S(2)*sqrt(log(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(log(x)**S(2) + S(1))), x), x, atan(log(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(log(x)**S(2) + S(-3))), x), x, atanh(log(x)/sqrt(log(x)**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(-S(9)*log(x)**S(2) + S(4))), x), x, asin(S(3)*log(x)/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(log(x)**S(2) + S(4))), x), x, asinh(log(x)/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(S(3)*log(S(6)*x)**S(3) + S(2))), x), x, S(2)**(S(1)/3)*S(3)**(S(2)/3)*log(S(3)**(S(1)/3)*log(S(6)*x) + S(2)**(S(1)/3))/S(18) - S(2)**(S(1)/3)*S(3)**(S(2)/3)*log(S(3)**(S(2)/3)*log(S(6)*x)**S(2) - S(6)**(S(1)/3)*log(S(6)*x) + S(2)**(S(2)/3))/S(36) - S(2)**(S(1)/3)*S(3)**(S(1)/6)*atan(sqrt(S(3))*(-S(2)**(S(2)/3)*S(3)**(S(1)/3)*log(S(6)*x) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(log(S(6)*x))/(x*log(S(6)*x)), x), x, log(log(S(6)*x))**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)**log(x)/x, x), x, S(2)**log(x)/log(S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sin(log(x))**S(2)/x, x), x, log(x)/S(2) - sin(log(x))*cos(log(x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-log(x) + S(7))/(x*(log(x) + S(3))), x), x, -log(x) + S(10)*log(log(x) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-log(x) + S(2))*(log(x) + S(3))**S(2)/x, x), x, -log(x)**S(4)/S(4) - S(4)*log(x)**S(3)/S(3) + S(3)*log(x)**S(2)/S(2) + S(18)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(x)**S(2) + S(1))*log(x)**S(2)/x, x), x, sqrt(log(x)**S(2) + S(1))*log(x)**S(3)/S(4) + sqrt(log(x)**S(2) + S(1))*log(x)/S(8) - asinh(log(x))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(x) + S(1))/(x*(S(2)*log(x) + S(3))**S(2)), x), x, log(S(2)*log(x) + S(3))/S(4) + S(1)/(S(4)*(S(2)*log(x) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x*sqrt(log(x) + S(1))), x), x, S(2)*(log(x) + S(1))**(S(3)/2)/S(3) - S(2)*sqrt(log(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x*sqrt(S(4)*log(x) + S(-1))), x), x, (S(4)*log(x) + S(-1))**(S(3)/2)/S(24) + sqrt(S(4)*log(x) + S(-1))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(x) + S(1))/(x*log(x)), x), x, S(2)*sqrt(log(x) + S(1)) - S(2)*atanh(sqrt(log(x) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(x)**S(2) - S(4)*log(x) + S(1))/(x*(log(x) + S(-1))**S(4)), x), x, (log(x) + S(-1))**(S(-2)) + S(1)/(-log(x) + S(1)) - S(2)/(S(3)*(-log(x) + S(1))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(S(1)/x)**S(2)/x**S(5), x), x, -log(S(1)/x)**S(2)/(S(4)*x**S(4)) + log(S(1)/x)/(S(8)*x**S(4)) - S(1)/(S(32)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(a*x**n)**S(2))**p/x, x), x, (log(a*x**n)**S(2))**p*log(a*x**n)/(n*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((log(a*x**n)**m)**p/x, x), x, (log(a*x**n)**m)**p*log(a*x**n)/(n*(m*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(log(a*x**n)**S(2))/x, x), x, sqrt(log(a*x**n)**S(2))*log(a*x**n)/(S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*log(a*x**n)**m)**p/x, x), x, (b*log(a*x**n)**m)**p*log(a*x**n)/(n*(m*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-log(a*x**S(2))), x), x, -sqrt(S(2))*sqrt(pi)*x*erf(sqrt(S(2))*sqrt(-log(a*x**S(2)))/S(2))/(S(2)*sqrt(a*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-log(a/x**S(2))), x), x, sqrt(S(2))*sqrt(pi)*x*sqrt(a/x**S(2))*erfi(sqrt(S(2))*sqrt(-log(a/x**S(2)))/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-log(a*x**n)), x), x, -sqrt(pi)*x*(a*x**n)**(-S(1)/n)*erf(sqrt(-log(a*x**n))/sqrt(n))/sqrt(n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sqrt(x) - x + S(1))/x, x), x, -S(2)*log(sqrt(x))*log((-S(2)*sqrt(x) - sqrt(S(5)) + S(1))/(-sqrt(S(5)) + S(1))) + S(2)*log(sqrt(x))*log(sqrt(x) - x + S(1)) - S(2)*log(S(1)/2 + sqrt(S(5))/S(2))*log(-S(2)*sqrt(x) + S(1) + sqrt(S(5))) - S(2)*polylog(S(2), S(2)*sqrt(x)/(-sqrt(S(5)) + S(1))) + S(2)*polylog(S(2), (-S(2)*sqrt(x) + S(1) + sqrt(S(5)))/(S(1) + sqrt(S(5)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(c + d*x)/(a + b*x), x), x, -a*log(-d*(a + b*x)/(-a*d + b*c))*log(c + d*x)/b**S(2) - a*polylog(S(2), b*(c + d*x)/(-a*d + b*c))/b**S(2) - x/b + (c + d*x)*log(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x + S(-1)), x), x, -polylog(S(2), -x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*log(-a - b*x + S(1))/(a + b*x), x), x, a*polylog(S(2), a + b*x)/b**S(2) - x/b - (-a - b*x + S(1))*log(-a - b*x + S(1))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*log(x)/(x*(b + c*x)), x), x, log(x)**S(2)/S(2) + log(x)*log((b + c*x)/b) + polylog(S(2), -c*x/b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)*sin(x*log(x)) + sin(x*log(x)), x), x, -cos(x*log(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((-(x + S(-1))**S(2) + S(1))/((x + S(-1))**S(2) + S(1)))/x**S(2), x), x, log(x)/S(2) + log(-x + S(2))/S(2) - log(x**S(2) - S(2)*x + S(2))/S(2) - atan(x + S(-1)) - log((-(-x + S(1))**S(2) + S(1))/((x + S(-1))**S(2) + S(1)))/x - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(sqrt(x) + x), x), x, sqrt(x) + x*log(sqrt(x) + x) - x - log(sqrt(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-x/(x + S(1))), x), x, x*log(-x/(x + S(1))) - log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((x + S(-1))/(x + S(1))), x), x, (x + S(-1))*log((x + S(-1))/(x + S(1))) - S(2)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log((-x**S(2) + S(1))/(x**S(2) + S(1)))/(x + S(1))**S(2), x), x, log(-x**S(2) + S(1))/S(2) - log(x**S(2) + S(1))/S(2) - atan(x) - log((-x**S(2) + S(1))/(x**S(2) + S(1)))/(x + S(1)) - S(1)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(-x**S(2) + S(1)), x), x, log(x)*atanh(x) + polylog(S(2), -x)/S(2) - polylog(S(2), x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x)/(x**S(2) + S(1)), x), x, log(x)*atan(x) - I*polylog(S(2), -I*x)/S(2) + I*polylog(S(2), I*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(x**S(2) + S(1))**n)/(x**S(2) + S(1)), x), x, S(2)*n*log(S(2)*I/(-x + I))*atan(x) + I*n*atan(x)**S(2) + I*n*polylog(S(2), (-x - I)/(-x + I)) + log(c*(x**S(2) + S(1))**n)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(x**S(2)/(x**S(2) + S(1)))/(x**S(2) + S(1)), x), x, -S(2)*log(S(2)*x/(x + I))*atan(x) + log(x**S(2)/(x**S(2) + S(1)))*atan(x) + I*atan(x)**S(2) + I*polylog(S(2), (-x + I)/(x + I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**n)/(a + b*x**S(2)), x), x, -I*n*polylog(S(2), -I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) + I*n*polylog(S(2), I*sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)) + log(c*x**n)*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*(a + b*x**S(2))**n)/(a + b*x**S(2)), x), x, S(2)*n*log(S(2)*I*sqrt(a)/(I*sqrt(a) - sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)) + I*n*atan(sqrt(b)*x/sqrt(a))**S(2)/(sqrt(a)*sqrt(b)) + I*n*polylog(S(2), (-sqrt(a) + I*sqrt(b)*x)/(sqrt(a) + I*sqrt(b)*x))/(sqrt(a)*sqrt(b)) + log(c*(a + b*x**S(2))**n)*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(c*x**S(2)/(a + b*x**S(2)))/(a + b*x**S(2)), x), x, -S(2)*log(S(2)*sqrt(b)*x/(I*sqrt(a) + sqrt(b)*x))*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)) + log(c*x**S(2)/(a + b*x**S(2)))*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)) + I*atan(sqrt(b)*x/sqrt(a))**S(2)/(sqrt(a)*sqrt(b)) + I*polylog(S(2), (sqrt(a) + I*sqrt(b)*x)/(sqrt(a) - I*sqrt(b)*x))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(I*sqrt(-a*x + S(1))/sqrt(a*x + S(1)) + S(1))/(-a**S(2)*x**S(2) + S(1)), x), x, polylog(S(2), -I*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(-I*sqrt(-a*x + S(1))/sqrt(a*x + S(1)) + S(1))/(-a**S(2)*x**S(2) + S(1)), x), x, polylog(S(2), I*sqrt(-a*x + S(1))/sqrt(a*x + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(exp(a + b*x)), x), x, log(exp(a + b*x))**S(2)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(exp(a + b*x**n)), x), x, -b*n*x**(n + S(1))/(n + S(1)) + x*log(exp(a + b*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(x)*log(a + b*exp(x)), x), x, -exp(x) + (a + b*exp(x))*log(a + b*exp(x))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*log(exp(x))), x), x, -log(x)/(x - log(exp(x))) + log(log(exp(x)))/(x - log(exp(x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(exp(a + b*x)*log(x), x), x, -exp(a)*Ei(b*x)/b + exp(a + b*x)*log(x)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x + log(x)), x), x, Integral(x**S(2)/(x + log(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x + log(x)), x), x, Integral(x/(x + log(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x + log(x)), x), x, Integral(S(1)/(x + log(x)), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x + log(x))), x), x, Integral(S(1)/(x*(x + log(x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x + log(x))), x), x, Integral(S(1)/(x**S(2)*(x + log(x))), x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-log(x) + S(1))/(x*(x + log(x))), x), x, log(S(1) + log(x)/x), expand=True, _diff=True, _numerical=True) ''' apart # apart assert rubi_test(rubi_integrate((x + S(1))/((x + log(x))*log(x)), x), x, -log(x + log(x)) + log(log(x)) + li(x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x + S(1))/((x + log(x))*log(x)), x), x, -log(x + log(x)) + log(log(x)) + Ei(log(x)), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(log(sqrt((x + S(1))/x) + S(2)), x), x, x*log(sqrt((x + S(1))/x) + S(2)) - log(-sqrt((x + S(1))/x) + S(1))/S(6) + log(sqrt((x + S(1))/x) + S(1))/S(2) - log(sqrt((x + S(1))/x) + S(2))/S(3), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(log(sqrt((x + S(1))/x) + S(1)), x), x, x*log(sqrt((x + S(1))/x) + S(1)) + atanh(sqrt((x + S(1))/x))/S(2) - S(1)/(S(2)*(sqrt((x + S(1))/x) + S(1))), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(log(sqrt((x + S(1))/x)), x), x, (x + S(1))*log(sqrt((x + S(1))/x)) + log(x)/S(2), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(log(sqrt((x + S(1))/x) + S(-1)), x), x, x*log(sqrt((x + S(1))/x) + S(-1)) - atanh(sqrt(S(1) + S(1)/x))/S(2) - S(1)/(S(2)*(-sqrt(S(1) + S(1)/x) + S(1))), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(log(sqrt((x + S(1))/x) + S(-2)), x), x, x*log(sqrt((x + S(1))/x) + S(-2)) + log(-sqrt(S(1) + S(1)/x) + S(1))/S(2) - log(-sqrt(S(1) + S(1)/x) + S(2))/S(3) - log(sqrt(S(1) + S(1)/x) + S(1))/S(6), expand=True, _diff=True, _numerical=True) ''' assert rubi_test(rubi_integrate(x**(a*x)*log(x) + x**(a*x), x), x, x**(a*x)/a, expand=True, _diff=True, _numerical=True) # fails in mathematica too assert rubi_test(rubi_integrate((log(x)**m)**p, x), x, (-log(x))**(-m*p)*(log(x)**m)**p*Gamma(m*p + S(1), -log(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(log(a + b*x + c*sqrt(d + e*x))/(f + g*x**S(2)), x), x, -log((a*e - b*d + b*(d + e*x) + c*e*sqrt(d + e*x))/e)*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log((a*e - b*d + b*(d + e*x) + c*e*sqrt(d + e*x))/e)*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) - log((a*e - b*d + b*(d + e*x) + c*e*sqrt(d + e*x))/e)*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log((a*e - b*d + b*(d + e*x) + c*e*sqrt(d + e*x))/e)*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log(-g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) - g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log(g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) + g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log(-g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) - g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + log(g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) + g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) - log(-g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) - g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) - log(g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) + g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) - log(-g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) - g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) - log(g**(S(1)/4)*(S(2)*b*sqrt(d + e*x) + c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) + g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))*log(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*sqrt(g)*sqrt(-f)) + polylog(S(2), S(2)*b*(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) - g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) + polylog(S(2), S(2)*b*(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) + g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) + polylog(S(2), S(2)*b*(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) - g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) + polylog(S(2), S(2)*b*(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) - e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) - e*sqrt(-f)) + g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) - polylog(S(2), S(2)*b*(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) - g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) - polylog(S(2), S(2)*b*(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) + g**(S(1)/4)*(c*e - sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) - polylog(S(2), S(2)*b*(g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) - g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)) - polylog(S(2), S(2)*b*(-g**(S(1)/4)*sqrt(d + e*x) + sqrt(d*sqrt(g) + e*sqrt(-f)))/(S(2)*b*sqrt(d*sqrt(g) + e*sqrt(-f)) + g**(S(1)/4)*(c*e + sqrt(-S(4)*a*b*e + S(4)*b**S(2)*d + c**S(2)*e**S(2)))))/(S(2)*sqrt(g)*sqrt(-f)), expand=True, _diff=True, _numerical=True)
5d20be2b5839c0f666ff516892587eaa38fd282a307f24081deb19f31d3ce50c
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot from sympy.functions.elementary.hyperbolic import atanh, asinh, acosh from sympy.functions.elementary.hyperbolic import atanh as arctanh from sympy.functions.elementary.hyperbolic import asinh as arcsinh from sympy.functions.elementary.hyperbolic import acosh as arccosh from sympy.functions.elementary.trigonometric import atan, asin, acos from sympy.functions.elementary.trigonometric import atan as arctan from sympy.functions.elementary.trigonometric import asin as arcsin from sympy.functions.elementary.trigonometric import acos as arccos from sympy.integrals.rubi.utility_function import (EllipticE, EllipticF, hypergeom, rubi_test, AppellF1, EllipticPi, Log, Sqrt, ArcTan, ArcTanh, ArcSin, Hypergeometric2F1) from sympy import pi as Pi, elliptic_e, elliptic_f, elliptic_pi, Mod from sympy import S, hyper, I, simplify, exp_polar, symbols, sqrt from sympy.testing.pytest import SKIP a, b, c, d, e, f, m, n, x, u , k, p, j, l , i= symbols('a b c d e f m n x u k p j l i1') A, B, C, a, b, c, d, e, f, g, h, y, z, m, n, p, q, u, v, w, F = symbols('A B C a b c d e f g h y z m n p q u v w F', real=True, imaginary=False) def test_1(): assert rubi_test(rubi_integrate(x**m*(b*x**S(2) + c*x**S(4)), x), x, b*x**(m + S(3))/(m + S(3)) + c*x**(m + S(5))/(m + S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b*x**S(2) + c*x**S(4)), x), x, b*x**S(5)/S(5) + c*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b*x**S(2) + c*x**S(4)), x), x, b*x**S(4)/S(4) + c*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(b*x**S(2) + c*x**S(4), x), x, b*x**S(3)/S(3) + c*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x, x), x, b*x**S(2)/S(2) + c*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(2), x), x, b*x + c*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(3), x), x, b*log(x) + c*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(4), x), x, -b/x + c*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(5), x), x, -b/(S(2)*x**S(2)) + c*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(6), x), x, -b/(S(3)*x**S(3)) - c/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(7), x), x, -b/(S(4)*x**S(4)) - c/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**S(8), x), x, -b/(S(5)*x**S(5)) - c/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(b*x**S(2) + c*x**S(4))**S(2), x), x, b**S(2)*x**(m + S(5))/(m + S(5)) + S(2)*b*c*x**(m + S(7))/(m + S(7)) + c**S(2)*x**(m + S(9))/(m + S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2), x), x, b**S(2)*x**S(5)/S(5) + S(2)*b*c*x**S(7)/S(7) + c**S(2)*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x, x), x, b**S(2)*x**S(4)/S(4) + b*c*x**S(6)/S(3) + c**S(2)*x**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(2), x), x, b**S(2)*x**S(3)/S(3) + S(2)*b*c*x**S(5)/S(5) + c**S(2)*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(3), x), x, (b + c*x**S(2))**S(3)/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(4), x), x, b**S(2)*x + S(2)*b*c*x**S(3)/S(3) + c**S(2)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(5), x), x, b**S(2)*log(x) + b*c*x**S(2) + c**S(2)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(6), x), x, -b**S(2)/x + S(2)*b*c*x + c**S(2)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(7), x), x, -b**S(2)/(S(2)*x**S(2)) + S(2)*b*c*log(x) + c**S(2)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(8), x), x, -b**S(2)/(S(3)*x**S(3)) - S(2)*b*c/x + c**S(2)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(9), x), x, -b**S(2)/(S(4)*x**S(4)) - b*c/x**S(2) + c**S(2)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(10), x), x, -b**S(2)/(S(5)*x**S(5)) - S(2)*b*c/(S(3)*x**S(3)) - c**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(11), x), x, -(b + c*x**S(2))**S(3)/(S(6)*b*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**S(12), x), x, -b**S(2)/(S(7)*x**S(7)) - S(2)*b*c/(S(5)*x**S(5)) - c**S(2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(b*x**S(2) + c*x**S(4))**S(3), x), x, b**S(3)*x**(m + S(7))/(m + S(7)) + S(3)*b**S(2)*c*x**(m + S(9))/(m + S(9)) + S(3)*b*c**S(2)*x**(m + S(11))/(m + S(11)) + c**S(3)*x**(m + S(13))/(m + S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(2), x), x, b**S(3)*x**S(5)/S(5) + S(3)*b**S(2)*c*x**S(7)/S(7) + b*c**S(2)*x**S(9)/S(3) + c**S(3)*x**S(11)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(3), x), x, -b*(b + c*x**S(2))**S(4)/(S(8)*c**S(2)) + (b + c*x**S(2))**S(5)/(S(10)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(4), x), x, b**S(3)*x**S(3)/S(3) + S(3)*b**S(2)*c*x**S(5)/S(5) + S(3)*b*c**S(2)*x**S(7)/S(7) + c**S(3)*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(5), x), x, (b + c*x**S(2))**S(4)/(S(8)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(6), x), x, b**S(3)*x + b**S(2)*c*x**S(3) + S(3)*b*c**S(2)*x**S(5)/S(5) + c**S(3)*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(7), x), x, b**S(3)*log(x) + S(3)*b**S(2)*c*x**S(2)/S(2) + S(3)*b*c**S(2)*x**S(4)/S(4) + c**S(3)*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(8), x), x, -b**S(3)/x + S(3)*b**S(2)*c*x + b*c**S(2)*x**S(3) + c**S(3)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(9), x), x, -b**S(3)/(S(2)*x**S(2)) + S(3)*b**S(2)*c*log(x) + S(3)*b*c**S(2)*x**S(2)/S(2) + c**S(3)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(10), x), x, -b**S(3)/(S(3)*x**S(3)) - S(3)*b**S(2)*c/x + S(3)*b*c**S(2)*x + c**S(3)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(11), x), x, -b**S(3)/(S(4)*x**S(4)) - S(3)*b**S(2)*c/(S(2)*x**S(2)) + S(3)*b*c**S(2)*log(x) + c**S(3)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(12), x), x, -b**S(3)/(S(5)*x**S(5)) - b**S(2)*c/x**S(3) - S(3)*b*c**S(2)/x + c**S(3)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(13), x), x, -b**S(3)/(S(6)*x**S(6)) - S(3)*b**S(2)*c/(S(4)*x**S(4)) - S(3)*b*c**S(2)/(S(2)*x**S(2)) + c**S(3)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(14), x), x, -b**S(3)/(S(7)*x**S(7)) - S(3)*b**S(2)*c/(S(5)*x**S(5)) - b*c**S(2)/x**S(3) - c**S(3)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(15), x), x, -(b + c*x**S(2))**S(4)/(S(8)*b*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(16), x), x, -b**S(3)/(S(9)*x**S(9)) - S(3)*b**S(2)*c/(S(7)*x**S(7)) - S(3)*b*c**S(2)/(S(5)*x**S(5)) - c**S(3)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**S(17), x), x, -b**S(3)/(S(10)*x**S(10)) - S(3)*b**S(2)*c/(S(8)*x**S(8)) - b*c**S(2)/(S(2)*x**S(6)) - c**S(3)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(b*x**S(2) + c*x**S(4)), x), x, b**(S(7)/2)*atan(sqrt(c)*x/sqrt(b))/c**(S(9)/2) - b**S(3)*x/c**S(4) + b**S(2)*x**S(3)/(S(3)*c**S(3)) - b*x**S(5)/(S(5)*c**S(2)) + x**S(7)/(S(7)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(b*x**S(2) + c*x**S(4)), x), x, -b**S(3)*log(b + c*x**S(2))/(S(2)*c**S(4)) + b**S(2)*x**S(2)/(S(2)*c**S(3)) - b*x**S(4)/(S(4)*c**S(2)) + x**S(6)/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(b*x**S(2) + c*x**S(4)), x), x, -b**(S(5)/2)*atan(sqrt(c)*x/sqrt(b))/c**(S(7)/2) + b**S(2)*x/c**S(3) - b*x**S(3)/(S(3)*c**S(2)) + x**S(5)/(S(5)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(b*x**S(2) + c*x**S(4)), x), x, b**S(2)*log(b + c*x**S(2))/(S(2)*c**S(3)) - b*x**S(2)/(S(2)*c**S(2)) + x**S(4)/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(b*x**S(2) + c*x**S(4)), x), x, b**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/c**(S(5)/2) - b*x/c**S(2) + x**S(3)/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(b*x**S(2) + c*x**S(4)), x), x, -b*log(b + c*x**S(2))/(S(2)*c**S(2)) + x**S(2)/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(b*x**S(2) + c*x**S(4)), x), x, -sqrt(b)*atan(sqrt(c)*x/sqrt(b))/c**(S(3)/2) + x/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(b*x**S(2) + c*x**S(4)), x), x, log(b + c*x**S(2))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(b*x**S(2) + c*x**S(4)), x), x, atan(sqrt(c)*x/sqrt(b))/(sqrt(b)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(b*x**S(2) + c*x**S(4)), x), x, log(x)/b - log(b + c*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(b*x**S(2) + c*x**S(4)), x), x, -S(1)/(b*x) - sqrt(c)*atan(sqrt(c)*x/sqrt(b))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(2)*b*x**S(2)) - c*log(x)/b**S(2) + c*log(b + c*x**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(3)*b*x**S(3)) + c/(b**S(2)*x) + c**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/b**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(4)*b*x**S(4)) + c/(S(2)*b**S(2)*x**S(2)) + c**S(2)*log(x)/b**S(3) - c**S(2)*log(b + c*x**S(2))/(S(2)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(5)*b*x**S(5)) + c/(S(3)*b**S(2)*x**S(3)) - c**S(2)/(b**S(3)*x) - c**(S(5)/2)*atan(sqrt(c)*x/sqrt(b))/b**(S(7)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(6)*b*x**S(6)) + c/(S(4)*b**S(2)*x**S(4)) - c**S(2)/(S(2)*b**S(3)*x**S(2)) - c**S(3)*log(x)/b**S(4) + c**S(3)*log(b + c*x**S(2))/(S(2)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -S(7)*b**(S(5)/2)*atan(sqrt(c)*x/sqrt(b))/(S(2)*c**(S(9)/2)) + S(7)*b**S(2)*x/(S(2)*c**S(4)) - S(7)*b*x**S(3)/(S(6)*c**S(3)) - x**S(7)/(S(2)*c*(b + c*x**S(2))) + S(7)*x**S(5)/(S(10)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(b*x**S(2) + c*x**S(4))**S(2), x), x, b**S(3)/(S(2)*c**S(4)*(b + c*x**S(2))) + S(3)*b**S(2)*log(b + c*x**S(2))/(S(2)*c**S(4)) - b*x**S(2)/c**S(3) + x**S(4)/(S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(5)*b**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/(S(2)*c**(S(7)/2)) - S(5)*b*x/(S(2)*c**S(3)) - x**S(5)/(S(2)*c*(b + c*x**S(2))) + S(5)*x**S(3)/(S(6)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -b**S(2)/(S(2)*c**S(3)*(b + c*x**S(2))) - b*log(b + c*x**S(2))/c**S(3) + x**S(2)/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -S(3)*sqrt(b)*atan(sqrt(c)*x/sqrt(b))/(S(2)*c**(S(5)/2)) - x**S(3)/(S(2)*c*(b + c*x**S(2))) + S(3)*x/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(b*x**S(2) + c*x**S(4))**S(2), x), x, b/(S(2)*c**S(2)*(b + c*x**S(2))) + log(b + c*x**S(2))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -x/(S(2)*c*(b + c*x**S(2))) + atan(sqrt(c)*x/sqrt(b))/(S(2)*sqrt(b)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -S(1)/(S(2)*c*(b + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(b*x**S(2) + c*x**S(4))**S(2), x), x, x/(S(2)*b*(b + c*x**S(2))) + atan(sqrt(c)*x/sqrt(b))/(S(2)*b**(S(3)/2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(1)/(S(2)*b*(b + c*x**S(2))) + log(x)/b**S(2) - log(b + c*x**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(1)/(S(2)*b*x*(b + c*x**S(2))) - S(3)/(S(2)*b**S(2)*x) - S(3)*sqrt(c)*atan(sqrt(c)*x/sqrt(b))/(S(2)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(b*x**S(2) + c*x**S(4))**S(2), x), x, -c/(S(2)*b**S(2)*(b + c*x**S(2))) - S(1)/(S(2)*b**S(2)*x**S(2)) - S(2)*c*log(x)/b**S(3) + c*log(b + c*x**S(2))/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(-2)), x), x, S(1)/(S(2)*b*x**S(3)*(b + c*x**S(2))) - S(5)/(S(6)*b**S(2)*x**S(3)) + S(5)*c/(S(2)*b**S(3)*x) + S(5)*c**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/(S(2)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(b*x**S(2) + c*x**S(4))**S(2)), x), x, -S(1)/(S(4)*b**S(2)*x**S(4)) + c**S(2)/(S(2)*b**S(3)*(b + c*x**S(2))) + c/(b**S(3)*x**S(2)) + S(3)*c**S(2)*log(x)/b**S(4) - S(3)*c**S(2)*log(b + c*x**S(2))/(S(2)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(b*x**S(2) + c*x**S(4))**S(2)), x), x, S(1)/(S(2)*b*x**S(5)*(b + c*x**S(2))) - S(7)/(S(10)*b**S(2)*x**S(5)) + S(7)*c/(S(6)*b**S(3)*x**S(3)) - S(7)*c**S(2)/(S(2)*b**S(4)*x) - S(7)*c**(S(5)/2)*atan(sqrt(c)*x/sqrt(b))/(S(2)*b**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(35)*b**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/(S(8)*c**(S(9)/2)) - S(35)*b*x/(S(8)*c**S(4)) - x**S(7)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(7)*x**S(5)/(S(8)*c**S(2)*(b + c*x**S(2))) + S(35)*x**S(3)/(S(24)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(13)/(b*x**S(2) + c*x**S(4))**S(3), x), x, b**S(3)/(S(4)*c**S(4)*(b + c*x**S(2))**S(2)) - S(3)*b**S(2)/(S(2)*c**S(4)*(b + c*x**S(2))) - S(3)*b*log(b + c*x**S(2))/(S(2)*c**S(4)) + x**S(2)/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -S(15)*sqrt(b)*atan(sqrt(c)*x/sqrt(b))/(S(8)*c**(S(7)/2)) - x**S(5)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(5)*x**S(3)/(S(8)*c**S(2)*(b + c*x**S(2))) + S(15)*x/(S(8)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -b**S(2)/(S(4)*c**S(3)*(b + c*x**S(2))**S(2)) + b/(c**S(3)*(b + c*x**S(2))) + log(b + c*x**S(2))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(3)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(3)*x/(S(8)*c**S(2)*(b + c*x**S(2))) + S(3)*atan(sqrt(c)*x/sqrt(b))/(S(8)*sqrt(b)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(b*x**S(2) + c*x**S(4))**S(3), x), x, x**S(4)/(S(4)*b*(b + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -x/(S(4)*c*(b + c*x**S(2))**S(2)) + x/(S(8)*b*c*(b + c*x**S(2))) + atan(sqrt(c)*x/sqrt(b))/(S(8)*b**(S(3)/2)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -S(1)/(S(4)*c*(b + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(b*x**S(2) + c*x**S(4))**S(3), x), x, x/(S(4)*b*(b + c*x**S(2))**S(2)) + S(3)*x/(S(8)*b**S(2)*(b + c*x**S(2))) + S(3)*atan(sqrt(c)*x/sqrt(b))/(S(8)*b**(S(5)/2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*(b + c*x**S(2))**S(2)) + S(1)/(S(2)*b**S(2)*(b + c*x**S(2))) + log(x)/b**S(3) - log(b + c*x**S(2))/(S(2)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x*(b + c*x**S(2))**S(2)) + S(5)/(S(8)*b**S(2)*x*(b + c*x**S(2))) - S(15)/(S(8)*b**S(3)*x) - S(15)*sqrt(c)*atan(sqrt(c)*x/sqrt(b))/(S(8)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -c/(S(4)*b**S(2)*(b + c*x**S(2))**S(2)) - c/(b**S(3)*(b + c*x**S(2))) - S(1)/(S(2)*b**S(3)*x**S(2)) - S(3)*c*log(x)/b**S(4) + S(3)*c*log(b + c*x**S(2))/(S(2)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x**S(3)*(b + c*x**S(2))**S(2)) + S(7)/(S(8)*b**S(2)*x**S(3)*(b + c*x**S(2))) - S(35)/(S(24)*b**S(3)*x**S(3)) + S(35)*c/(S(8)*b**S(4)*x) + S(35)*c**(S(3)/2)*atan(sqrt(c)*x/sqrt(b))/(S(8)*b**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(b*x**S(2) + c*x**S(4))**S(3), x), x, c**S(2)/(S(4)*b**S(3)*(b + c*x**S(2))**S(2)) - S(1)/(S(4)*b**S(3)*x**S(4)) + S(3)*c**S(2)/(S(2)*b**S(4)*(b + c*x**S(2))) + S(3)*c/(S(2)*b**S(4)*x**S(2)) + S(6)*c**S(2)*log(x)/b**S(5) - S(3)*c**S(2)*log(b + c*x**S(2))/b**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(-3)), x), x, S(1)/(S(4)*b*x**S(5)*(b + c*x**S(2))**S(2)) + S(9)/(S(8)*b**S(2)*x**S(5)*(b + c*x**S(2))) - S(63)/(S(40)*b**S(3)*x**S(5)) + S(21)*c/(S(8)*b**S(4)*x**S(3)) - S(63)*c**S(2)/(S(8)*b**S(5)*x) - S(63)*c**(S(5)/2)*atan(sqrt(c)*x/sqrt(b))/(S(8)*b**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(b*x**S(2) + c*x**S(4))**S(3)), x), x, -S(1)/(S(6)*b**S(3)*x**S(6)) - c**S(3)/(S(4)*b**S(4)*(b + c*x**S(2))**S(2)) + S(3)*c/(S(4)*b**S(4)*x**S(4)) - S(2)*c**S(3)/(b**S(5)*(b + c*x**S(2))) - S(3)*c**S(2)/(b**S(5)*x**S(2)) - S(10)*c**S(3)*log(x)/b**S(6) + S(5)*c**S(3)*log(b + c*x**S(2))/b**S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(5)*b**S(4)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(128)*c**(S(7)/2)) + S(5)*b**S(2)*(b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(128)*c**S(3)) - S(5)*b*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(48)*c**S(2)) + x**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(8)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(b*x**S(2) + c*x**S(4)), x), x, b**S(3)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(16)*c**(S(5)/2)) - b*(b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*c**S(2)) + (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(b*x**S(2) + c*x**S(4)), x), x, -b**S(2)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*c**(S(3)/2)) + (b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x, x), x, b*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*sqrt(c)) + sqrt(b*x**S(2) + c*x**S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(3), x), x, sqrt(c)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4))) - sqrt(b*x**S(2) + c*x**S(4))/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(5), x), x, -(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*b*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(7), x), x, -(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(5)*b*x**S(8)) + S(2)*c*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(15)*b**S(2)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(9), x), x, -(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*b*x**S(10)) + S(4)*c*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(35)*b**S(2)*x**S(8)) - S(8)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(105)*b**S(3)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(11), x), x, -(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(9)*b*x**S(12)) + S(2)*c*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(21)*b**S(2)*x**S(10)) - S(8)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(105)*b**S(3)*x**S(8)) + S(16)*c**S(3)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(315)*b**S(4)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(13), x), x, -(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(11)*b*x**S(14)) + S(8)*c*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(99)*b**S(2)*x**S(12)) - S(16)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(231)*b**S(3)*x**S(10)) + S(64)*c**S(3)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(1155)*b**S(4)*x**S(8)) - S(128)*c**S(4)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3465)*b**S(5)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(b*x**S(2) + c*x**S(4)), x), x, S(8)*b**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(105)*c**S(3)*x**S(3)) - S(4)*b*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(35)*c**S(2)*x) + x*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(2)*b*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(15)*c**S(2)*x**S(3)) + (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(5)*c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4)), x), x, (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*c*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(2), x), x, -sqrt(b)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4))) + sqrt(b*x**S(2) + c*x**S(4))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(4), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(2)*x**S(3)) - c*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(6), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(4)*x**S(5)) - c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*b*x**S(3)) + c**S(2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**S(8), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(6)*x**S(7)) - c*sqrt(b*x**S(2) + c*x**S(4))/(S(24)*b*x**S(5)) + c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*b**S(2)*x**S(3)) - c**S(3)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(16)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(3)*b**S(5)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(256)*c**(S(7)/2)) + S(3)*b**S(3)*(b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(256)*c**S(3)) - b*(b + S(2)*c*x**S(2))*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(32)*c**S(2)) + (b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(10)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(3)*b**S(4)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(128)*c**(S(5)/2)) - S(3)*b**S(2)*(b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(128)*c**S(2)) + (b + S(2)*c*x**S(2))*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(16)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x, x), x, -b**S(3)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(16)*c**(S(3)/2)) + b*(b + S(2)*c*x**S(2))*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*c) + (b*x**S(2) + c*x**S(4))**(S(3)/2)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(3), x), x, S(3)*b**S(2)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*sqrt(c)) + S(3)*b*sqrt(b*x**S(2) + c*x**S(4))/S(8) + (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(5), x), x, S(3)*b*sqrt(c)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/S(2) + S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/S(2) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(7), x), x, c**(S(3)/2)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4))) - c*sqrt(b*x**S(2) + c*x**S(4))/x**S(2) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(9), x), x, -(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(5)*b*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(11), x), x, -(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(7)*b*x**S(12)) + S(2)*c*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(35)*b**S(2)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(13), x), x, -(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(9)*b*x**S(14)) + S(4)*c*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(63)*b**S(2)*x**S(12)) - S(8)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(315)*b**S(3)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(15), x), x, -(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(11)*b*x**S(16)) + S(2)*c*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(33)*b**S(2)*x**S(14)) - S(8)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(231)*b**S(3)*x**S(12)) + S(16)*c**S(3)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(1155)*b**S(4)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(17), x), x, -(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(13)*b*x**S(18)) + S(8)*c*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(143)*b**S(2)*x**S(16)) - S(16)*c**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(429)*b**S(3)*x**S(14)) + S(64)*c**S(3)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(3003)*b**S(4)*x**S(12)) - S(128)*c**S(4)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(15015)*b**S(5)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(128)*b**S(4)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(15015)*c**S(5)*x**S(5)) - S(64)*b**S(3)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(3003)*c**S(4)*x**S(3)) + S(16)*b**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(429)*c**S(3)*x) - S(8)*b*x*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(143)*c**S(2)) + x**S(3)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(13)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(16)*b**S(3)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(1155)*c**S(4)*x**S(5)) + S(8)*b**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(231)*c**S(3)*x**S(3)) - S(2)*b*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(33)*c**S(2)*x) + x*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(11)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(8)*b**S(2)*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(315)*c**S(3)*x**S(5)) - S(4)*b*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(63)*c**S(2)*x**S(3)) + (b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(9)*c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(2)*b*(b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(35)*c**S(2)*x**S(5)) + (b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(7)*c*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(2), x), x, (b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(5)*c*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(4), x), x, -b**(S(3)/2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4))) + b*sqrt(b*x**S(2) + c*x**S(4))/x + (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(6), x), x, -S(3)*sqrt(b)*c*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/S(2) + S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(2)*x) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(2)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(8), x), x, -S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*x**S(3)) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(4)*x**S(7)) - S(3)*c**S(2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(10), x), x, -c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*x**S(5)) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*x**S(9)) - c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*b*x**S(3)) + c**S(3)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(16)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(12), x), x, -c*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*x**S(7)) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(8)*x**S(11)) - c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(64)*b*x**S(5)) + S(3)*c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(128)*b**S(2)*x**S(3)) - S(3)*c**S(4)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(128)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(14), x), x, -S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(80)*x**S(9)) - (b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(10)*x**S(13)) - c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(160)*b*x**S(7)) + c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(128)*b**S(2)*x**S(5)) - S(3)*c**S(4)*sqrt(b*x**S(2) + c*x**S(4))/(S(256)*b**S(3)*x**S(3)) + S(3)*c**S(5)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(256)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(5)*b**S(3)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(16)*c**(S(7)/2)) + S(5)*b**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(16)*c**S(3)) - S(5)*b*x**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(24)*c**S(2)) + x**S(4)*sqrt(b*x**S(2) + c*x**S(4))/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/sqrt(b*x**S(2) + c*x**S(4)), x), x, S(3)*b**S(2)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*c**(S(5)/2)) - S(3)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*c**S(2)) + x**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -b*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*c**(S(3)/2)) + sqrt(b*x**S(2) + c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(b*x**S(2) + c*x**S(4)), x), x, atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/sqrt(c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b*x**S(4)) + S(2)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b**S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b*x**S(6)) + S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b**S(2)*x**S(4)) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(7)*b*x**S(8)) + S(6)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(2)*x**S(6)) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(3)*x**S(4)) + S(16)*c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(2)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c**S(2)*x) + x*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, sqrt(b*x**S(2) + c*x**S(4))/(c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(2)*b*x**S(3)) + c*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(4)*b*x**S(5)) + S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*b**S(2)*x**S(3)) - S(3)*c**S(2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(15)*b**S(2)*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*c**(S(7)/2)) - S(15)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*c**S(3)) - x**S(6)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(5)*x**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(3)*b*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*c**(S(5)/2)) - x**S(4)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -x**S(2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/c**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, x**S(2)/(b*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(b + S(2)*c*x**S(2))/(b**S(2)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**S(2)*sqrt(b*x**S(2) + c*x**S(4))) - S(4)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b**S(2)*x**S(4)) + S(8)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**S(4)*sqrt(b*x**S(2) + c*x**S(4))) - S(6)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(2)*x**S(6)) + S(8)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(3)*x**S(4)) - S(16)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**S(6)*sqrt(b*x**S(2) + c*x**S(4))) - S(8)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*b**S(2)*x**S(8)) + S(48)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(3)*x**S(6)) - S(64)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(4)*x**S(4)) + S(128)*c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(35)*b**S(5)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -x**S(3)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*sqrt(b*x**S(2) + c*x**S(4))/(c**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -x/(c*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, x/(b*sqrt(b*x**S(2) + c*x**S(4))) - atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(-3)/2), x), x, S(1)/(b*x*sqrt(b*x**S(2) + c*x**S(4))) - S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(2)*b**S(2)*x**S(3)) + S(3)*c*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**S(3)*sqrt(b*x**S(2) + c*x**S(4))) - S(5)*sqrt(b*x**S(2) + c*x**S(4))/(S(4)*b**S(2)*x**S(5)) + S(15)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*b**S(3)*x**S(3)) - S(15)*c**S(2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(-S(4)*x**S(4) + S(3)*x**S(2)), x), x, -sqrt(-S(4)*x**S(4) + S(3)*x**S(2))/S(8) + S(3)*asin(S(8)*x**S(2)/S(3) + S(-1))/S(32), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(-S(4)*x**S(4) - S(3)*x**S(2)), x), x, -sqrt(-S(4)*x**S(4) - S(3)*x**S(2))/S(8) - S(3)*asin(S(8)*x**S(2)/S(3) + S(1))/S(32), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(S(4)*x**S(4) + S(3)*x**S(2)), x), x, sqrt(S(4)*x**S(4) + S(3)*x**S(2))/S(8) - S(3)*atanh(S(2)*x**S(2)/sqrt(S(4)*x**S(4) + S(3)*x**S(2)))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(S(4)*x**S(4) - S(3)*x**S(2)), x), x, sqrt(S(4)*x**S(4) - S(3)*x**S(2))/S(8) + S(3)*atanh(S(2)*x**S(2)/sqrt(S(4)*x**S(4) - S(3)*x**S(2)))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a*x**S(2) + b*x**S(4)), x), x, -a*atanh(sqrt(b)*x**S(2)/sqrt(a*x**S(2) + b*x**S(4)))/(S(2)*b**(S(3)/2)) + sqrt(a*x**S(2) + b*x**S(4))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a*x**S(2) - b*x**S(4)), x), x, a*atan(sqrt(b)*x**S(2)/sqrt(a*x**S(2) - b*x**S(4)))/(S(2)*b**(S(3)/2)) - sqrt(a*x**S(2) - b*x**S(4))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)*(b*x**S(2) + c*x**S(4)), x), x, S(2)*b*x**(S(13)/2)/S(13) + S(2)*c*x**(S(17)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(b*x**S(2) + c*x**S(4)), x), x, S(2)*b*x**(S(11)/2)/S(11) + S(2)*c*x**(S(15)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(b*x**S(2) + c*x**S(4)), x), x, S(2)*b*x**(S(9)/2)/S(9) + S(2)*c*x**(S(13)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(b*x**S(2) + c*x**S(4)), x), x, S(2)*b*x**(S(7)/2)/S(7) + S(2)*c*x**(S(11)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/sqrt(x), x), x, S(2)*b*x**(S(5)/2)/S(5) + S(2)*c*x**(S(9)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**(S(3)/2), x), x, S(2)*b*x**(S(3)/2)/S(3) + S(2)*c*x**(S(7)/2)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**(S(5)/2), x), x, S(2)*b*sqrt(x) + S(2)*c*x**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))/x**(S(7)/2), x), x, -S(2)*b/sqrt(x) + S(2)*c*x**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)*(b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*b**S(2)*x**(S(17)/2)/S(17) + S(4)*b*c*x**(S(21)/2)/S(21) + S(2)*c**S(2)*x**(S(25)/2)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*b**S(2)*x**(S(15)/2)/S(15) + S(4)*b*c*x**(S(19)/2)/S(19) + S(2)*c**S(2)*x**(S(23)/2)/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*b**S(2)*x**(S(13)/2)/S(13) + S(4)*b*c*x**(S(17)/2)/S(17) + S(2)*c**S(2)*x**(S(21)/2)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*b**S(2)*x**(S(11)/2)/S(11) + S(4)*b*c*x**(S(15)/2)/S(15) + S(2)*c**S(2)*x**(S(19)/2)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/sqrt(x), x), x, S(2)*b**S(2)*x**(S(9)/2)/S(9) + S(4)*b*c*x**(S(13)/2)/S(13) + S(2)*c**S(2)*x**(S(17)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**(S(3)/2), x), x, S(2)*b**S(2)*x**(S(7)/2)/S(7) + S(4)*b*c*x**(S(11)/2)/S(11) + S(2)*c**S(2)*x**(S(15)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**(S(5)/2), x), x, S(2)*b**S(2)*x**(S(5)/2)/S(5) + S(4)*b*c*x**(S(9)/2)/S(9) + S(2)*c**S(2)*x**(S(13)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(2)/x**(S(7)/2), x), x, S(2)*b**S(2)*x**(S(3)/2)/S(3) + S(4)*b*c*x**(S(7)/2)/S(7) + S(2)*c**S(2)*x**(S(11)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)*(b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*b**S(3)*x**(S(21)/2)/S(21) + S(6)*b**S(2)*c*x**(S(25)/2)/S(25) + S(6)*b*c**S(2)*x**(S(29)/2)/S(29) + S(2)*c**S(3)*x**(S(33)/2)/S(33), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*b**S(3)*x**(S(19)/2)/S(19) + S(6)*b**S(2)*c*x**(S(23)/2)/S(23) + S(2)*b*c**S(2)*x**(S(27)/2)/S(9) + S(2)*c**S(3)*x**(S(31)/2)/S(31), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*b**S(3)*x**(S(17)/2)/S(17) + S(2)*b**S(2)*c*x**(S(21)/2)/S(7) + S(6)*b*c**S(2)*x**(S(25)/2)/S(25) + S(2)*c**S(3)*x**(S(29)/2)/S(29), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*b**S(3)*x**(S(15)/2)/S(15) + S(6)*b**S(2)*c*x**(S(19)/2)/S(19) + S(6)*b*c**S(2)*x**(S(23)/2)/S(23) + S(2)*c**S(3)*x**(S(27)/2)/S(27), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/sqrt(x), x), x, S(2)*b**S(3)*x**(S(13)/2)/S(13) + S(6)*b**S(2)*c*x**(S(17)/2)/S(17) + S(2)*b*c**S(2)*x**(S(21)/2)/S(7) + S(2)*c**S(3)*x**(S(25)/2)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**(S(3)/2), x), x, S(2)*b**S(3)*x**(S(11)/2)/S(11) + S(2)*b**S(2)*c*x**(S(15)/2)/S(5) + S(6)*b*c**S(2)*x**(S(19)/2)/S(19) + S(2)*c**S(3)*x**(S(23)/2)/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**(S(5)/2), x), x, S(2)*b**S(3)*x**(S(9)/2)/S(9) + S(6)*b**S(2)*c*x**(S(13)/2)/S(13) + S(6)*b*c**S(2)*x**(S(17)/2)/S(17) + S(2)*c**S(3)*x**(S(21)/2)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**S(3)/x**(S(7)/2), x), x, S(2)*b**S(3)*x**(S(7)/2)/S(7) + S(6)*b**S(2)*c*x**(S(11)/2)/S(11) + S(2)*b*c**S(2)*x**(S(15)/2)/S(5) + S(2)*c**S(3)*x**(S(19)/2)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*b**(S(7)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(11)/4)) - sqrt(S(2))*b**(S(7)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(11)/4)) - sqrt(S(2))*b**(S(7)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(11)/4)) + sqrt(S(2))*b**(S(7)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(11)/4)) - S(2)*b*x**(S(3)/2)/(S(3)*c**S(2)) + S(2)*x**(S(7)/2)/(S(7)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*b**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(9)/4)) + sqrt(S(2))*b**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(9)/4)) - sqrt(S(2))*b**(S(5)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(9)/4)) + sqrt(S(2))*b**(S(5)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(9)/4)) - S(2)*b*sqrt(x)/c**S(2) + S(2)*x**(S(5)/2)/(S(5)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*b**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(7)/4)) + sqrt(S(2))*b**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(7)/4)) + sqrt(S(2))*b**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(7)/4)) - sqrt(S(2))*b**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(7)/4)) + S(2)*x**(S(3)/2)/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(5)/4)) - sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*c**(S(5)/4)) + sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(5)/4)) - sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*c**(S(5)/4)) + S(2)*sqrt(x)/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(1)/4)*c**(S(3)/4)) - sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(1)/4)*c**(S(3)/4)) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(1)/4)*c**(S(3)/4)) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(1)/4)*c**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(3)/4)*c**(S(1)/4)) + sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(3)/4)*c**(S(1)/4)) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(3)/4)*c**(S(1)/4)) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(3)/4)*c**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(b*x**S(2) + c*x**S(4)), x), x, -S(2)/(b*sqrt(x)) - sqrt(S(2))*c**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(5)/4)) + sqrt(S(2))*c**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(5)/4)) + sqrt(S(2))*c**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(5)/4)) - sqrt(S(2))*c**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(b*x**S(2) + c*x**S(4))), x), x, -S(2)/(S(3)*b*x**(S(3)/2)) + sqrt(S(2))*c**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(7)/4)) - sqrt(S(2))*c**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(7)/4)) + sqrt(S(2))*c**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(7)/4)) - sqrt(S(2))*c**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))), x), x, -S(2)/(S(5)*b*x**(S(5)/2)) + S(2)*c/(b**S(2)*sqrt(x)) + sqrt(S(2))*c**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(9)/4)) - sqrt(S(2))*c**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(9)/4)) - sqrt(S(2))*c**(S(5)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(9)/4)) + sqrt(S(2))*c**(S(5)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(9)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(5)/2)*(b*x**S(2) + c*x**S(4))), x), x, -S(2)/(S(7)*b*x**(S(7)/2)) + S(2)*c/(S(3)*b**S(2)*x**(S(3)/2)) - sqrt(S(2))*c**(S(7)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(11)/4)) + sqrt(S(2))*c**(S(7)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(11)/4)) - sqrt(S(2))*c**(S(7)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(11)/4)) + sqrt(S(2))*c**(S(7)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(11)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(7)/2)*(b*x**S(2) + c*x**S(4))), x), x, -S(2)/(S(9)*b*x**(S(9)/2)) + S(2)*c/(S(5)*b**S(2)*x**(S(5)/2)) - S(2)*c**S(2)/(b**S(3)*sqrt(x)) - sqrt(S(2))*c**(S(9)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(13)/4)) + sqrt(S(2))*c**(S(9)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(4)*b**(S(13)/4)) + sqrt(S(2))*c**(S(9)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(13)/4)) - sqrt(S(2))*c**(S(9)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(2)*b**(S(13)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(19)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -S(9)*sqrt(S(2))*b**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(13)/4)) + S(9)*sqrt(S(2))*b**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(13)/4)) - S(9)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(13)/4)) + S(9)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(13)/4)) - S(9)*b*sqrt(x)/(S(2)*c**S(3)) - x**(S(9)/2)/(S(2)*c*(b + c*x**S(2))) + S(9)*x**(S(5)/2)/(S(10)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(17)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -S(7)*sqrt(S(2))*b**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(11)/4)) + S(7)*sqrt(S(2))*b**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(11)/4)) + S(7)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(11)/4)) - S(7)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(11)/4)) - x**(S(7)/2)/(S(2)*c*(b + c*x**S(2))) + S(7)*x**(S(3)/2)/(S(6)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(15)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(5)*sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(9)/4)) - S(5)*sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*c**(S(9)/4)) + S(5)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(9)/4)) - S(5)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*c**(S(9)/4)) - x**(S(5)/2)/(S(2)*c*(b + c*x**S(2))) + S(5)*sqrt(x)/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -x**(S(3)/2)/(S(2)*c*(b + c*x**S(2))) + S(3)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(1)/4)*c**(S(7)/4)) - S(3)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(1)/4)*c**(S(7)/4)) - S(3)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(1)/4)*c**(S(7)/4)) + S(3)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(1)/4)*c**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, -sqrt(x)/(S(2)*c*(b + c*x**S(2))) - sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(3)/4)*c**(S(5)/4)) + sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(3)/4)*c**(S(5)/4)) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(3)/4)*c**(S(5)/4)) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(3)/4)*c**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, x**(S(3)/2)/(S(2)*b*(b + c*x**S(2))) + sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(5)/4)*c**(S(3)/4)) - sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(5)/4)*c**(S(3)/4)) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(5)/4)*c**(S(3)/4)) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(5)/4)*c**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, sqrt(x)/(S(2)*b*(b + c*x**S(2))) - S(3)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(7)/4)*c**(S(1)/4)) + S(3)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(7)/4)*c**(S(1)/4)) - S(3)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(7)/4)*c**(S(1)/4)) + S(3)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(7)/4)*c**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(1)/(S(2)*b*sqrt(x)*(b + c*x**S(2))) - S(5)/(S(2)*b**S(2)*sqrt(x)) - S(5)*sqrt(S(2))*c**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(9)/4)) + S(5)*sqrt(S(2))*c**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(9)/4)) + S(5)*sqrt(S(2))*c**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(9)/4)) - S(5)*sqrt(S(2))*c**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(9)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(1)/(S(2)*b*x**(S(3)/2)*(b + c*x**S(2))) - S(7)/(S(6)*b**S(2)*x**(S(3)/2)) + S(7)*sqrt(S(2))*c**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(11)/4)) - S(7)*sqrt(S(2))*c**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(11)/4)) + S(7)*sqrt(S(2))*c**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(11)/4)) - S(7)*sqrt(S(2))*c**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(11)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(b*x**S(2) + c*x**S(4))**S(2), x), x, S(1)/(S(2)*b*x**(S(5)/2)*(b + c*x**S(2))) - S(9)/(S(10)*b**S(2)*x**(S(5)/2)) + S(9)*c/(S(2)*b**S(3)*sqrt(x)) + S(9)*sqrt(S(2))*c**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(13)/4)) - S(9)*sqrt(S(2))*c**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(13)/4)) - S(9)*sqrt(S(2))*c**(S(5)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(13)/4)) + S(9)*sqrt(S(2))*c**(S(5)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(13)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(b*x**S(2) + c*x**S(4))**S(2)), x), x, S(1)/(S(2)*b*x**(S(7)/2)*(b + c*x**S(2))) - S(11)/(S(14)*b**S(2)*x**(S(7)/2)) + S(11)*c/(S(6)*b**S(3)*x**(S(3)/2)) - S(11)*sqrt(S(2))*c**(S(7)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(15)/4)) + S(11)*sqrt(S(2))*c**(S(7)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(15)/4)) - S(11)*sqrt(S(2))*c**(S(7)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(15)/4)) + S(11)*sqrt(S(2))*c**(S(7)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(15)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**S(2)), x), x, S(1)/(S(2)*b*x**(S(9)/2)*(b + c*x**S(2))) - S(13)/(S(18)*b**S(2)*x**(S(9)/2)) + S(13)*c/(S(10)*b**S(3)*x**(S(5)/2)) - S(13)*c**S(2)/(S(2)*b**S(4)*sqrt(x)) - S(13)*sqrt(S(2))*c**(S(9)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(17)/4)) + S(13)*sqrt(S(2))*c**(S(9)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(16)*b**(S(17)/4)) + S(13)*sqrt(S(2))*c**(S(9)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(17)/4)) - S(13)*sqrt(S(2))*c**(S(9)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(8)*b**(S(17)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(23)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(45)*sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*c**(S(13)/4)) - S(45)*sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*c**(S(13)/4)) + S(45)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*c**(S(13)/4)) - S(45)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*c**(S(13)/4)) - x**(S(9)/2)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(9)*x**(S(5)/2)/(S(16)*c**S(2)*(b + c*x**S(2))) + S(45)*sqrt(x)/(S(16)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(21)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -x**(S(7)/2)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(7)*x**(S(3)/2)/(S(16)*c**S(2)*(b + c*x**S(2))) + S(21)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(1)/4)*c**(S(11)/4)) - S(21)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(1)/4)*c**(S(11)/4)) - S(21)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(1)/4)*c**(S(11)/4)) + S(21)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(1)/4)*c**(S(11)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(19)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -x**(S(5)/2)/(S(4)*c*(b + c*x**S(2))**S(2)) - S(5)*sqrt(x)/(S(16)*c**S(2)*(b + c*x**S(2))) - S(5)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(3)/4)*c**(S(9)/4)) + S(5)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(3)/4)*c**(S(9)/4)) - S(5)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(3)/4)*c**(S(9)/4)) + S(5)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(3)/4)*c**(S(9)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(17)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -x**(S(3)/2)/(S(4)*c*(b + c*x**S(2))**S(2)) + S(3)*x**(S(3)/2)/(S(16)*b*c*(b + c*x**S(2))) + S(3)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(5)/4)*c**(S(7)/4)) - S(3)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(5)/4)*c**(S(7)/4)) - S(3)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(5)/4)*c**(S(7)/4)) + S(3)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(5)/4)*c**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(15)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, -sqrt(x)/(S(4)*c*(b + c*x**S(2))**S(2)) + sqrt(x)/(S(16)*b*c*(b + c*x**S(2))) - S(3)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(7)/4)*c**(S(5)/4)) + S(3)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(7)/4)*c**(S(5)/4)) - S(3)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(7)/4)*c**(S(5)/4)) + S(3)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(7)/4)*c**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, x**(S(3)/2)/(S(4)*b*(b + c*x**S(2))**S(2)) + S(5)*x**(S(3)/2)/(S(16)*b**S(2)*(b + c*x**S(2))) + S(5)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(9)/4)*c**(S(3)/4)) - S(5)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(9)/4)*c**(S(3)/4)) - S(5)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(9)/4)*c**(S(3)/4)) + S(5)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(9)/4)*c**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, sqrt(x)/(S(4)*b*(b + c*x**S(2))**S(2)) + S(7)*sqrt(x)/(S(16)*b**S(2)*(b + c*x**S(2))) - S(21)*sqrt(S(2))*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(11)/4)*c**(S(1)/4)) + S(21)*sqrt(S(2))*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(11)/4)*c**(S(1)/4)) - S(21)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(11)/4)*c**(S(1)/4)) + S(21)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(11)/4)*c**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*sqrt(x)*(b + c*x**S(2))**S(2)) + S(9)/(S(16)*b**S(2)*sqrt(x)*(b + c*x**S(2))) - S(45)/(S(16)*b**S(3)*sqrt(x)) - S(45)*sqrt(S(2))*c**(S(1)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(13)/4)) + S(45)*sqrt(S(2))*c**(S(1)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(13)/4)) + S(45)*sqrt(S(2))*c**(S(1)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(13)/4)) - S(45)*sqrt(S(2))*c**(S(1)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(13)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x**(S(3)/2)*(b + c*x**S(2))**S(2)) + S(11)/(S(16)*b**S(2)*x**(S(3)/2)*(b + c*x**S(2))) - S(77)/(S(48)*b**S(3)*x**(S(3)/2)) + S(77)*sqrt(S(2))*c**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(15)/4)) - S(77)*sqrt(S(2))*c**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(15)/4)) + S(77)*sqrt(S(2))*c**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(15)/4)) - S(77)*sqrt(S(2))*c**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(15)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x**(S(5)/2)*(b + c*x**S(2))**S(2)) + S(13)/(S(16)*b**S(2)*x**(S(5)/2)*(b + c*x**S(2))) - S(117)/(S(80)*b**S(3)*x**(S(5)/2)) + S(117)*c/(S(16)*b**S(4)*sqrt(x)) + S(117)*sqrt(S(2))*c**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(17)/4)) - S(117)*sqrt(S(2))*c**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(17)/4)) - S(117)*sqrt(S(2))*c**(S(5)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(17)/4)) + S(117)*sqrt(S(2))*c**(S(5)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(17)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x**(S(7)/2)*(b + c*x**S(2))**S(2)) + S(15)/(S(16)*b**S(2)*x**(S(7)/2)*(b + c*x**S(2))) - S(165)/(S(112)*b**S(3)*x**(S(7)/2)) + S(55)*c/(S(16)*b**S(4)*x**(S(3)/2)) - S(165)*sqrt(S(2))*c**(S(7)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(19)/4)) + S(165)*sqrt(S(2))*c**(S(7)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(19)/4)) - S(165)*sqrt(S(2))*c**(S(7)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(19)/4)) + S(165)*sqrt(S(2))*c**(S(7)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(19)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(b*x**S(2) + c*x**S(4))**S(3), x), x, S(1)/(S(4)*b*x**(S(9)/2)*(b + c*x**S(2))**S(2)) + S(17)/(S(16)*b**S(2)*x**(S(9)/2)*(b + c*x**S(2))) - S(221)/(S(144)*b**S(3)*x**(S(9)/2)) + S(221)*c/(S(80)*b**S(4)*x**(S(5)/2)) - S(221)*c**S(2)/(S(16)*b**S(5)*sqrt(x)) - S(221)*sqrt(S(2))*c**(S(9)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(21)/4)) + S(221)*sqrt(S(2))*c**(S(9)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(21)/4)) + S(221)*sqrt(S(2))*c**(S(9)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(21)/4)) - S(221)*sqrt(S(2))*c**(S(9)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(21)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(b*x**S(2) + c*x**S(4))**S(3)), x), x, S(1)/(S(4)*b*x**(S(11)/2)*(b + c*x**S(2))**S(2)) + S(19)/(S(16)*b**S(2)*x**(S(11)/2)*(b + c*x**S(2))) - S(285)/(S(176)*b**S(3)*x**(S(11)/2)) + S(285)*c/(S(112)*b**S(4)*x**(S(7)/2)) - S(95)*c**S(2)/(S(16)*b**S(5)*x**(S(3)/2)) + S(285)*sqrt(S(2))*c**(S(11)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(23)/4)) - S(285)*sqrt(S(2))*c**(S(11)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*sqrt(x) + sqrt(b) + sqrt(c)*x)/(S(128)*b**(S(23)/4)) + S(285)*sqrt(S(2))*c**(S(11)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(23)/4)) - S(285)*sqrt(S(2))*c**(S(11)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*sqrt(x)/b**(S(1)/4))/(S(64)*b**(S(23)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(28)*b**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(195)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(14)*b**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(195)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(28)*b**S(3)*x**(S(3)/2)*(b + c*x**S(2))/(S(195)*c**(S(5)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(28)*b**S(2)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(585)*c**S(2)) + S(4)*b*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(117)*c) + S(2)*x**(S(9)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4)), x), x, S(10)*b**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(231)*c**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(20)*b**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(231)*c**S(2)*sqrt(x)) + S(4)*b*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*c) + S(2)*x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4)), x), x, S(4)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(2)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(4)*b**S(2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*c**(S(3)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(45)*c) + S(2)*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(2)*b**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(21)*c**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(21)*c*sqrt(x)) + S(2)*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/sqrt(x), x), x, -S(4)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*sqrt(c)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(3)/2), x), x, S(2)*b**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(3)*c**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(5)/2), x), x, -S(4)*b**(S(1)/4)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/sqrt(b*x**S(2) + c*x**S(4)) + S(2)*b**(S(1)/4)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/sqrt(b*x**S(2) + c*x**S(4)) + S(4)*sqrt(c)*x**(S(3)/2)*(b + c*x**S(2))/((sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(2)*sqrt(b*x**S(2) + c*x**S(4))/x**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(7)/2), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*x**(S(5)/2)) + S(2)*c**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(3)*b**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(9)/2), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*x**(S(7)/2)) + S(4)*c**(S(3)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*b*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b*x**(S(3)/2)) - S(4)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(11)/2), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*x**(S(9)/2)) - S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(21)*b*x**(S(5)/2)) - S(2)*c**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(21)*b**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(13)/2), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(9)*x**(S(11)/2)) - S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(45)*b*x**(S(7)/2)) - S(4)*c**(S(5)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*b**S(2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b**S(2)*x**(S(3)/2)) + S(4)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(2)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + c*x**S(4))/x**(S(15)/2), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(11)*x**(S(13)/2)) - S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*b*x**(S(9)/2)) + S(20)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(231)*b**S(2)*x**(S(5)/2)) + S(10)*c**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(231)*b**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(56)*b**(S(17)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(1105)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(28)*b**(S(17)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(1105)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(56)*b**S(4)*x**(S(3)/2)*(b + c*x**S(2))/(S(1105)*c**(S(5)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(56)*b**S(3)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(3315)*c**S(2)) + S(8)*b**S(2)*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(663)*c) + S(12)*b*x**(S(9)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(221) + S(2)*x**(S(5)/2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(4)*b**(S(15)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(231)*c**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(8)*b**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(231)*c**S(2)*sqrt(x)) + S(8)*b**S(2)*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(385)*c) + S(4)*b*x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(55) + S(2)*x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/sqrt(x), x), x, S(8)*b**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(65)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(4)*b**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(65)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(8)*b**S(3)*x**(S(3)/2)*(b + c*x**S(2))/(S(65)*c**(S(3)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(8)*b**S(2)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(195)*c) + S(4)*b*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(39) + S(2)*sqrt(x)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(3)/2), x), x, -S(4)*b**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(77)*c**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(8)*b**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*c*sqrt(x)) + S(12)*b*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/S(77) + S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(11)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(5)/2), x), x, -S(8)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(8)*b**S(2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*sqrt(c)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/S(15) + S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(9)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(7)/2), x), x, S(4)*b**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(7)*c**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*sqrt(x)) + S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*x**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(9)/2), x), x, -S(24)*b**(S(5)/4)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*sqrt(b*x**S(2) + c*x**S(4))) + S(12)*b**(S(5)/4)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*sqrt(b*x**S(2) + c*x**S(4))) + S(24)*b*sqrt(c)*x**(S(3)/2)*(b + c*x**S(2))/((S(5)*sqrt(b) + S(5)*sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(12)*c*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/S(5) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(7)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(11)/2), x), x, S(4)*b**(S(3)/4)*c**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(3)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*sqrt(x)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*x**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(13)/2), x), x, -S(24)*b**(S(1)/4)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*sqrt(b*x**S(2) + c*x**S(4))) + S(12)*b**(S(1)/4)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*sqrt(b*x**S(2) + c*x**S(4))) + S(24)*c**(S(3)/2)*x**(S(3)/2)*(b + c*x**S(2))/((S(5)*sqrt(b) + S(5)*sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(12)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*x**(S(3)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(5)*x**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(15)/2), x), x, -S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*x**(S(5)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*x**(S(13)/2)) + S(4)*c**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(7)*b**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(17)/2), x), x, -S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*x**(S(7)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(9)*x**(S(15)/2)) + S(8)*c**(S(5)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*b*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b*x**(S(3)/2)) - S(8)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(4)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(19)/2), x), x, -S(12)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*x**(S(9)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(11)*x**(S(17)/2)) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*b*x**(S(5)/2)) - S(4)*c**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(77)*b**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(21)/2), x), x, -S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(39)*x**(S(11)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(13)*x**(S(19)/2)) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(195)*b*x**(S(7)/2)) - S(8)*c**(S(7)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(65)*b**S(2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(8)*c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(65)*b**S(2)*x**(S(3)/2)) + S(8)*c**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(65)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(4)*c**(S(13)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(65)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + c*x**S(4))**(S(3)/2)/x**(S(23)/2), x), x, -S(4)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(55)*x**(S(13)/2)) - S(2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(15)*x**(S(21)/2)) - S(8)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(385)*b*x**(S(9)/2)) + S(8)*c**S(3)*sqrt(b*x**S(2) + c*x**S(4))/(S(231)*b**S(2)*x**(S(5)/2)) + S(4)*c**(S(15)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(231)*b**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(15)*b**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(77)*c**(S(13)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(30)*b**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*c**S(3)*sqrt(x)) - S(18)*b*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*c**S(2)) + S(2)*x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(11)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(14)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(7)*b**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(14)*b**S(2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*c**(S(5)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(14)*b*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(45)*c**S(2)) + S(2)*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(9)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, S(5)*b**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(21)*c**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(10)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(21)*c**S(2)*sqrt(x)) + S(2)*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, S(6)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(3)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(6)*b*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*c**(S(3)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -b**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(3)*c**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(2)*b**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + b**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(2)*x**(S(3)/2)*(b + c*x**S(2))/(sqrt(c)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/sqrt(b*x**S(2) + c*x**S(4)), x), x, x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(b**(S(1)/4)*c**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))), x), x, S(2)*sqrt(c)*x**(S(3)/2)*(b + c*x**S(2))/(b*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(2)*sqrt(b*x**S(2) + c*x**S(4))/(b*x**(S(3)/2)) - S(2)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(b**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b*x**(S(5)/2)) - c**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(3)*b**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b*x**(S(7)/2)) - S(6)*c**(S(3)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*b**S(2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(6)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(2)*x**(S(3)/2)) + S(6)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(3)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*b*x**(S(9)/2)) + S(10)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(21)*b**S(2)*x**(S(5)/2)) + S(5)*c**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(21)*b**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(9)/2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(9)*b*x**(S(11)/2)) + S(14)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(45)*b**S(2)*x**(S(7)/2)) + S(14)*c**(S(5)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*b**S(3)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(14)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b**S(3)*x**(S(3)/2)) - S(14)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(7)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(11)/2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(11)*b*x**(S(13)/2)) + S(18)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*b**S(2)*x**(S(9)/2)) - S(30)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(77)*b**S(3)*x**(S(5)/2)) - S(15)*c**(S(11)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(77)*b**(S(13)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(17)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(15)*b**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(14)*c**(S(13)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(15)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*c**S(3)*sqrt(x)) - x**(S(11)/2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(9)*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(15)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(21)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(21)*b**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(10)*c**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(21)*b*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*c**(S(5)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - x**(S(9)/2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(7)*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(5)*b**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(6)*c**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))) - x**(S(7)/2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(5)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c**S(2)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(3)*b**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(3)*b**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(2)*c**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) - x**(S(5)/2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + S(3)*x**(S(3)/2)*(b + c*x**S(2))/(c**(S(3)/2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -x**(S(3)/2)/(c*sqrt(b*x**S(2) + c*x**S(4))) + x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(2)*b**(S(1)/4)*c**(S(5)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, x**(S(5)/2)/(b*sqrt(b*x**S(2) + c*x**S(4))) - x**(S(3)/2)*(b + c*x**S(2))/(b*sqrt(c)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(b**(S(3)/4)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))) - x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(2)*b**(S(3)/4)*c**(S(3)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, x**(S(3)/2)/(b*sqrt(b*x**S(2) + c*x**S(4))) + x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(2)*b**(S(5)/4)*c**(S(1)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, sqrt(x)/(b*sqrt(b*x**S(2) + c*x**S(4))) + S(3)*sqrt(c)*x**(S(3)/2)*(b + c*x**S(2))/(b**S(2)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(3)*sqrt(b*x**S(2) + c*x**S(4))/(b**S(2)*x**(S(3)/2)) - S(3)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(3)*c**(S(1)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(2)*b**(S(7)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(1)/(b*sqrt(x)*sqrt(b*x**S(2) + c*x**S(4))) - S(5)*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b**S(2)*x**(S(5)/2)) - S(5)*c**(S(3)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(6)*b**(S(9)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**(S(3)/2)*sqrt(b*x**S(2) + c*x**S(4))) - S(7)*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(2)*x**(S(7)/2)) - S(21)*c**(S(3)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(5)*b**S(3)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) + S(21)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(5)*b**S(3)*x**(S(3)/2)) + S(21)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(5)*b**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))) - S(21)*c**(S(5)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(10)*b**(S(11)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**(S(5)/2)*sqrt(b*x**S(2) + c*x**S(4))) - S(9)*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*b**S(2)*x**(S(9)/2)) + S(15)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(7)*b**S(3)*x**(S(5)/2)) + S(15)*c**(S(7)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(14)*b**(S(13)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(5)/2)*(b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(1)/(b*x**(S(7)/2)*sqrt(b*x**S(2) + c*x**S(4))) - S(11)*sqrt(b*x**S(2) + c*x**S(4))/(S(9)*b**S(2)*x**(S(11)/2)) + S(77)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(45)*b**S(3)*x**(S(7)/2)) + S(77)*c**(S(5)/2)*x**(S(3)/2)*(b + c*x**S(2))/(S(15)*b**S(4)*(sqrt(b) + sqrt(c)*x)*sqrt(b*x**S(2) + c*x**S(4))) - S(77)*c**S(2)*sqrt(b*x**S(2) + c*x**S(4))/(S(15)*b**S(4)*x**(S(3)/2)) - S(77)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_e(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(15)*b**(S(15)/4)*sqrt(b*x**S(2) + c*x**S(4))) + S(77)*c**(S(9)/4)*x*sqrt((b + c*x**S(2))/(sqrt(b) + sqrt(c)*x)**S(2))*(sqrt(b) + sqrt(c)*x)*elliptic_f(S(2)*atan(c**(S(1)/4)*sqrt(x)/b**(S(1)/4)), S(1)/2)/(S(30)*b**(S(15)/4)*sqrt(b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(2)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(2)*a*b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + b**S(2)*(d*x)**(m + S(5))/(d**S(5)*(m + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(2)*x**S(4)/S(4) + a*b*x**S(6)/S(3) + b**S(2)*x**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(2)*x**S(3)/S(3) + S(2)*a*b*x**S(5)/S(5) + b**S(2)*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(2)*x**S(2)/S(2) + a*b*x**S(4)/S(2) + b**S(2)*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4), x), x, a**S(2)*x + S(2)*a*b*x**S(3)/S(3) + b**S(2)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x, x), x, a**S(2)*log(x) + a*b*x**S(2) + b**S(2)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(2), x), x, -a**S(2)/x + S(2)*a*b*x + b**S(2)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(3), x), x, -a**S(2)/(S(2)*x**S(2)) + S(2)*a*b*log(x) + b**S(2)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(4), x), x, -a**S(2)/(S(3)*x**S(3)) - S(2)*a*b/x + b**S(2)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(5), x), x, -a**S(2)/(S(4)*x**S(4)) - a*b/x**S(2) + b**S(2)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(6), x), x, -a**S(2)/(S(5)*x**S(5)) - S(2)*a*b/(S(3)*x**S(3)) - b**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(7), x), x, -a**S(2)/(S(6)*x**S(6)) - a*b/(S(2)*x**S(4)) - b**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(8), x), x, -a**S(2)/(S(7)*x**S(7)) - S(2)*a*b/(S(5)*x**S(5)) - b**S(2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(4)*a**S(3)*b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + S(6)*a**S(2)*b**S(2)*(d*x)**(m + S(5))/(d**S(5)*(m + S(5))) + S(4)*a*b**S(3)*(d*x)**(m + S(7))/(d**S(7)*(m + S(7))) + b**S(4)*(d*x)**(m + S(9))/(d**S(9)*(m + S(9))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*x**S(7)/S(7) + S(4)*a**S(3)*b*x**S(9)/S(9) + S(6)*a**S(2)*b**S(2)*x**S(11)/S(11) + S(4)*a*b**S(3)*x**S(13)/S(13) + b**S(4)*x**S(15)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*x**S(6)/S(6) + a**S(3)*b*x**S(8)/S(2) + S(3)*a**S(2)*b**S(2)*x**S(10)/S(5) + a*b**S(3)*x**S(12)/S(3) + b**S(4)*x**S(14)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*x**S(5)/S(5) + S(4)*a**S(3)*b*x**S(7)/S(7) + S(2)*a**S(2)*b**S(2)*x**S(9)/S(3) + S(4)*a*b**S(3)*x**S(11)/S(11) + b**S(4)*x**S(13)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -a*(a + b*x**S(2))**S(5)/(S(10)*b**S(2)) + (a + b*x**S(2))**S(6)/(S(12)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*x**S(3)/S(3) + S(4)*a**S(3)*b*x**S(5)/S(5) + S(6)*a**S(2)*b**S(2)*x**S(7)/S(7) + S(4)*a*b**S(3)*x**S(9)/S(9) + b**S(4)*x**S(11)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, (a + b*x**S(2))**S(5)/(S(10)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(4)*x + S(4)*a**S(3)*b*x**S(3)/S(3) + S(6)*a**S(2)*b**S(2)*x**S(5)/S(5) + S(4)*a*b**S(3)*x**S(7)/S(7) + b**S(4)*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x, x), x, a**S(4)*log(x) + S(2)*a**S(3)*b*x**S(2) + S(3)*a**S(2)*b**S(2)*x**S(4)/S(2) + S(2)*a*b**S(3)*x**S(6)/S(3) + b**S(4)*x**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(2), x), x, -a**S(4)/x + S(4)*a**S(3)*b*x + S(2)*a**S(2)*b**S(2)*x**S(3) + S(4)*a*b**S(3)*x**S(5)/S(5) + b**S(4)*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(3), x), x, -a**S(4)/(S(2)*x**S(2)) + S(4)*a**S(3)*b*log(x) + S(3)*a**S(2)*b**S(2)*x**S(2) + a*b**S(3)*x**S(4) + b**S(4)*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(4), x), x, -a**S(4)/(S(3)*x**S(3)) - S(4)*a**S(3)*b/x + S(6)*a**S(2)*b**S(2)*x + S(4)*a*b**S(3)*x**S(3)/S(3) + b**S(4)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(5), x), x, -a**S(4)/(S(4)*x**S(4)) - S(2)*a**S(3)*b/x**S(2) + S(6)*a**S(2)*b**S(2)*log(x) + S(2)*a*b**S(3)*x**S(2) + b**S(4)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(6), x), x, -a**S(4)/(S(5)*x**S(5)) - S(4)*a**S(3)*b/(S(3)*x**S(3)) - S(6)*a**S(2)*b**S(2)/x + S(4)*a*b**S(3)*x + b**S(4)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(7), x), x, -a**S(4)/(S(6)*x**S(6)) - a**S(3)*b/x**S(4) - S(3)*a**S(2)*b**S(2)/x**S(2) + S(4)*a*b**S(3)*log(x) + b**S(4)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(8), x), x, -a**S(4)/(S(7)*x**S(7)) - S(4)*a**S(3)*b/(S(5)*x**S(5)) - S(2)*a**S(2)*b**S(2)/x**S(3) - S(4)*a*b**S(3)/x + b**S(4)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(9), x), x, -a**S(4)/(S(8)*x**S(8)) - S(2)*a**S(3)*b/(S(3)*x**S(6)) - S(3)*a**S(2)*b**S(2)/(S(2)*x**S(4)) - S(2)*a*b**S(3)/x**S(2) + b**S(4)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(10), x), x, -a**S(4)/(S(9)*x**S(9)) - S(4)*a**S(3)*b/(S(7)*x**S(7)) - S(6)*a**S(2)*b**S(2)/(S(5)*x**S(5)) - S(4)*a*b**S(3)/(S(3)*x**S(3)) - b**S(4)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(11), x), x, -(a + b*x**S(2))**S(5)/(S(10)*a*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(12), x), x, -a**S(4)/(S(11)*x**S(11)) - S(4)*a**S(3)*b/(S(9)*x**S(9)) - S(6)*a**S(2)*b**S(2)/(S(7)*x**S(7)) - S(4)*a*b**S(3)/(S(5)*x**S(5)) - b**S(4)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(13), x), x, -(a + b*x**S(2))**S(5)/(S(12)*a*x**S(12)) + b*(a + b*x**S(2))**S(5)/(S(60)*a**S(2)*x**S(10)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(13), x), x, -a**S(4)/(S(12)*x**S(12)) - S(2)*a**S(3)*b/(S(5)*x**S(10)) - S(3)*a**S(2)*b**S(2)/(S(4)*x**S(8)) - S(2)*a*b**S(3)/(S(3)*x**S(6)) - b**S(4)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(14), x), x, -a**S(4)/(S(13)*x**S(13)) - S(4)*a**S(3)*b/(S(11)*x**S(11)) - S(2)*a**S(2)*b**S(2)/(S(3)*x**S(9)) - S(4)*a*b**S(3)/(S(7)*x**S(7)) - b**S(4)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(15), x), x, -a**S(4)/(S(14)*x**S(14)) - a**S(3)*b/(S(3)*x**S(12)) - S(3)*a**S(2)*b**S(2)/(S(5)*x**S(10)) - a*b**S(3)/(S(2)*x**S(8)) - b**S(4)/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/x**S(16), x), x, -a**S(4)/(S(15)*x**S(15)) - S(4)*a**S(3)*b/(S(13)*x**S(13)) - S(6)*a**S(2)*b**S(2)/(S(11)*x**S(11)) - S(4)*a*b**S(3)/(S(9)*x**S(9)) - b**S(4)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(6)*a**S(5)*b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + S(15)*a**S(4)*b**S(2)*(d*x)**(m + S(5))/(d**S(5)*(m + S(5))) + S(20)*a**S(3)*b**S(3)*(d*x)**(m + S(7))/(d**S(7)*(m + S(7))) + S(15)*a**S(2)*b**S(4)*(d*x)**(m + S(9))/(d**S(9)*(m + S(9))) + S(6)*a*b**S(5)*(d*x)**(m + S(11))/(d**S(11)*(m + S(11))) + b**S(6)*(d*x)**(m + S(13))/(d**S(13)*(m + S(13))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x**S(9)/S(9) + S(6)*a**S(5)*b*x**S(11)/S(11) + S(15)*a**S(4)*b**S(2)*x**S(13)/S(13) + S(4)*a**S(3)*b**S(3)*x**S(15)/S(3) + S(15)*a**S(2)*b**S(4)*x**S(17)/S(17) + S(6)*a*b**S(5)*x**S(19)/S(19) + b**S(6)*x**S(21)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x**S(8)/S(8) + S(3)*a**S(5)*b*x**S(10)/S(5) + S(5)*a**S(4)*b**S(2)*x**S(12)/S(4) + S(10)*a**S(3)*b**S(3)*x**S(14)/S(7) + S(15)*a**S(2)*b**S(4)*x**S(16)/S(16) + a*b**S(5)*x**S(18)/S(3) + b**S(6)*x**S(20)/S(20), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x**S(7)/S(7) + S(2)*a**S(5)*b*x**S(9)/S(3) + S(15)*a**S(4)*b**S(2)*x**S(11)/S(11) + S(20)*a**S(3)*b**S(3)*x**S(13)/S(13) + a**S(2)*b**S(4)*x**S(15) + S(6)*a*b**S(5)*x**S(17)/S(17) + b**S(6)*x**S(19)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(2)*(a + b*x**S(2))**S(7)/(S(14)*b**S(3)) - a*(a + b*x**S(2))**S(8)/(S(8)*b**S(3)) + (a + b*x**S(2))**S(9)/(S(18)*b**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x**S(5)/S(5) + S(6)*a**S(5)*b*x**S(7)/S(7) + S(5)*a**S(4)*b**S(2)*x**S(9)/S(3) + S(20)*a**S(3)*b**S(3)*x**S(11)/S(11) + S(15)*a**S(2)*b**S(4)*x**S(13)/S(13) + S(2)*a*b**S(5)*x**S(15)/S(5) + b**S(6)*x**S(17)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -a*(a + b*x**S(2))**S(7)/(S(14)*b**S(2)) + (a + b*x**S(2))**S(8)/(S(16)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x**S(3)/S(3) + S(6)*a**S(5)*b*x**S(5)/S(5) + S(15)*a**S(4)*b**S(2)*x**S(7)/S(7) + S(20)*a**S(3)*b**S(3)*x**S(9)/S(9) + S(15)*a**S(2)*b**S(4)*x**S(11)/S(11) + S(6)*a*b**S(5)*x**S(13)/S(13) + b**S(6)*x**S(15)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, (a + b*x**S(2))**S(7)/(S(14)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(6)*x + S(2)*a**S(5)*b*x**S(3) + S(3)*a**S(4)*b**S(2)*x**S(5) + S(20)*a**S(3)*b**S(3)*x**S(7)/S(7) + S(5)*a**S(2)*b**S(4)*x**S(9)/S(3) + S(6)*a*b**S(5)*x**S(11)/S(11) + b**S(6)*x**S(13)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x, x), x, a**S(6)*log(x) + S(3)*a**S(5)*b*x**S(2) + S(15)*a**S(4)*b**S(2)*x**S(4)/S(4) + S(10)*a**S(3)*b**S(3)*x**S(6)/S(3) + S(15)*a**S(2)*b**S(4)*x**S(8)/S(8) + S(3)*a*b**S(5)*x**S(10)/S(5) + b**S(6)*x**S(12)/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(2), x), x, -a**S(6)/x + S(6)*a**S(5)*b*x + S(5)*a**S(4)*b**S(2)*x**S(3) + S(4)*a**S(3)*b**S(3)*x**S(5) + S(15)*a**S(2)*b**S(4)*x**S(7)/S(7) + S(2)*a*b**S(5)*x**S(9)/S(3) + b**S(6)*x**S(11)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(3), x), x, -a**S(6)/(S(2)*x**S(2)) + S(6)*a**S(5)*b*log(x) + S(15)*a**S(4)*b**S(2)*x**S(2)/S(2) + S(5)*a**S(3)*b**S(3)*x**S(4) + S(5)*a**S(2)*b**S(4)*x**S(6)/S(2) + S(3)*a*b**S(5)*x**S(8)/S(4) + b**S(6)*x**S(10)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(4), x), x, -a**S(6)/(S(3)*x**S(3)) - S(6)*a**S(5)*b/x + S(15)*a**S(4)*b**S(2)*x + S(20)*a**S(3)*b**S(3)*x**S(3)/S(3) + S(3)*a**S(2)*b**S(4)*x**S(5) + S(6)*a*b**S(5)*x**S(7)/S(7) + b**S(6)*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(5), x), x, -a**S(6)/(S(4)*x**S(4)) - S(3)*a**S(5)*b/x**S(2) + S(15)*a**S(4)*b**S(2)*log(x) + S(10)*a**S(3)*b**S(3)*x**S(2) + S(15)*a**S(2)*b**S(4)*x**S(4)/S(4) + a*b**S(5)*x**S(6) + b**S(6)*x**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(6), x), x, -a**S(6)/(S(5)*x**S(5)) - S(2)*a**S(5)*b/x**S(3) - S(15)*a**S(4)*b**S(2)/x + S(20)*a**S(3)*b**S(3)*x + S(5)*a**S(2)*b**S(4)*x**S(3) + S(6)*a*b**S(5)*x**S(5)/S(5) + b**S(6)*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(7), x), x, -a**S(6)/(S(6)*x**S(6)) - S(3)*a**S(5)*b/(S(2)*x**S(4)) - S(15)*a**S(4)*b**S(2)/(S(2)*x**S(2)) + S(20)*a**S(3)*b**S(3)*log(x) + S(15)*a**S(2)*b**S(4)*x**S(2)/S(2) + S(3)*a*b**S(5)*x**S(4)/S(2) + b**S(6)*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(8), x), x, -a**S(6)/(S(7)*x**S(7)) - S(6)*a**S(5)*b/(S(5)*x**S(5)) - S(5)*a**S(4)*b**S(2)/x**S(3) - S(20)*a**S(3)*b**S(3)/x + S(15)*a**S(2)*b**S(4)*x + S(2)*a*b**S(5)*x**S(3) + b**S(6)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(9), x), x, -a**S(6)/(S(8)*x**S(8)) - a**S(5)*b/x**S(6) - S(15)*a**S(4)*b**S(2)/(S(4)*x**S(4)) - S(10)*a**S(3)*b**S(3)/x**S(2) + S(15)*a**S(2)*b**S(4)*log(x) + S(3)*a*b**S(5)*x**S(2) + b**S(6)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(10), x), x, -a**S(6)/(S(9)*x**S(9)) - S(6)*a**S(5)*b/(S(7)*x**S(7)) - S(3)*a**S(4)*b**S(2)/x**S(5) - S(20)*a**S(3)*b**S(3)/(S(3)*x**S(3)) - S(15)*a**S(2)*b**S(4)/x + S(6)*a*b**S(5)*x + b**S(6)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(11), x), x, -a**S(6)/(S(10)*x**S(10)) - S(3)*a**S(5)*b/(S(4)*x**S(8)) - S(5)*a**S(4)*b**S(2)/(S(2)*x**S(6)) - S(5)*a**S(3)*b**S(3)/x**S(4) - S(15)*a**S(2)*b**S(4)/(S(2)*x**S(2)) + S(6)*a*b**S(5)*log(x) + b**S(6)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(12), x), x, -a**S(6)/(S(11)*x**S(11)) - S(2)*a**S(5)*b/(S(3)*x**S(9)) - S(15)*a**S(4)*b**S(2)/(S(7)*x**S(7)) - S(4)*a**S(3)*b**S(3)/x**S(5) - S(5)*a**S(2)*b**S(4)/x**S(3) - S(6)*a*b**S(5)/x + b**S(6)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(13), x), x, -a**S(6)/(S(12)*x**S(12)) - S(3)*a**S(5)*b/(S(5)*x**S(10)) - S(15)*a**S(4)*b**S(2)/(S(8)*x**S(8)) - S(10)*a**S(3)*b**S(3)/(S(3)*x**S(6)) - S(15)*a**S(2)*b**S(4)/(S(4)*x**S(4)) - S(3)*a*b**S(5)/x**S(2) + b**S(6)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(14), x), x, -a**S(6)/(S(13)*x**S(13)) - S(6)*a**S(5)*b/(S(11)*x**S(11)) - S(5)*a**S(4)*b**S(2)/(S(3)*x**S(9)) - S(20)*a**S(3)*b**S(3)/(S(7)*x**S(7)) - S(3)*a**S(2)*b**S(4)/x**S(5) - S(2)*a*b**S(5)/x**S(3) - b**S(6)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(15), x), x, -(a + b*x**S(2))**S(7)/(S(14)*a*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(16), x), x, -a**S(6)/(S(15)*x**S(15)) - S(6)*a**S(5)*b/(S(13)*x**S(13)) - S(15)*a**S(4)*b**S(2)/(S(11)*x**S(11)) - S(20)*a**S(3)*b**S(3)/(S(9)*x**S(9)) - S(15)*a**S(2)*b**S(4)/(S(7)*x**S(7)) - S(6)*a*b**S(5)/(S(5)*x**S(5)) - b**S(6)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(17), x), x, -(a + b*x**S(2))**S(7)/(S(16)*a*x**S(16)) + b*(a + b*x**S(2))**S(7)/(S(112)*a**S(2)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(18), x), x, -a**S(6)/(S(17)*x**S(17)) - S(2)*a**S(5)*b/(S(5)*x**S(15)) - S(15)*a**S(4)*b**S(2)/(S(13)*x**S(13)) - S(20)*a**S(3)*b**S(3)/(S(11)*x**S(11)) - S(5)*a**S(2)*b**S(4)/(S(3)*x**S(9)) - S(6)*a*b**S(5)/(S(7)*x**S(7)) - b**S(6)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(19), x), x, -(a + b*x**S(2))**S(7)/(S(18)*a*x**S(18)) + b*(a + b*x**S(2))**S(7)/(S(72)*a**S(2)*x**S(16)) - b**S(2)*(a + b*x**S(2))**S(7)/(S(504)*a**S(3)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(20), x), x, -a**S(6)/(S(19)*x**S(19)) - S(6)*a**S(5)*b/(S(17)*x**S(17)) - a**S(4)*b**S(2)/x**S(15) - S(20)*a**S(3)*b**S(3)/(S(13)*x**S(13)) - S(15)*a**S(2)*b**S(4)/(S(11)*x**S(11)) - S(2)*a*b**S(5)/(S(3)*x**S(9)) - b**S(6)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(21), x), x, -a**S(6)/(S(20)*x**S(20)) - a**S(5)*b/(S(3)*x**S(18)) - S(15)*a**S(4)*b**S(2)/(S(16)*x**S(16)) - S(10)*a**S(3)*b**S(3)/(S(7)*x**S(14)) - S(5)*a**S(2)*b**S(4)/(S(4)*x**S(12)) - S(3)*a*b**S(5)/(S(5)*x**S(10)) - b**S(6)/(S(8)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/x**S(22), x), x, -a**S(6)/(S(21)*x**S(21)) - S(6)*a**S(5)*b/(S(19)*x**S(19)) - S(15)*a**S(4)*b**S(2)/(S(17)*x**S(17)) - S(4)*a**S(3)*b**S(3)/(S(3)*x**S(15)) - S(15)*a**S(2)*b**S(4)/(S(13)*x**S(13)) - S(6)*a*b**S(5)/(S(11)*x**S(11)) - b**S(6)/(S(9)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (d*x)**(m + S(1))*hyper((S(2), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a**S(2)*d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(5)/(S(2)*b**S(6)*(a + b*x**S(2))) + S(5)*a**S(4)*log(a + b*x**S(2))/(S(2)*b**S(6)) - S(2)*a**S(3)*x**S(2)/b**S(5) + S(3)*a**S(2)*x**S(4)/(S(4)*b**S(4)) - a*x**S(6)/(S(3)*b**S(3)) + x**S(8)/(S(8)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -a**S(4)/(S(2)*b**S(5)*(a + b*x**S(2))) - S(2)*a**S(3)*log(a + b*x**S(2))/b**S(5) + S(3)*a**S(2)*x**S(2)/(S(2)*b**S(4)) - a*x**S(4)/(S(2)*b**S(3)) + x**S(6)/(S(6)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**S(3)/(S(2)*b**S(4)*(a + b*x**S(2))) + S(3)*a**S(2)*log(a + b*x**S(2))/(S(2)*b**S(4)) - a*x**S(2)/b**S(3) + x**S(4)/(S(4)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -a**S(2)/(S(2)*b**S(3)*(a + b*x**S(2))) - a*log(a + b*x**S(2))/b**S(3) + x**S(2)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a/(S(2)*b**S(2)*(a + b*x**S(2))) + log(a + b*x**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -S(1)/(S(2)*b*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*(a + b*x**S(2))) + log(x)/a**S(2) - log(a + b*x**S(2))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -b/(S(2)*a**S(2)*(a + b*x**S(2))) - S(1)/(S(2)*a**S(2)*x**S(2)) - S(2)*b*log(x)/a**S(3) + b*log(a + b*x**S(2))/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -S(1)/(S(4)*a**S(2)*x**S(4)) + b**S(2)/(S(2)*a**S(3)*(a + b*x**S(2))) + b/(a**S(3)*x**S(2)) + S(3)*b**S(2)*log(x)/a**S(4) - S(3)*b**S(2)*log(a + b*x**S(2))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(9)*a**(S(7)/2)*atan(sqrt(b)*x/sqrt(a))/(S(2)*b**(S(11)/2)) - S(9)*a**S(3)*x/(S(2)*b**S(5)) + S(3)*a**S(2)*x**S(3)/(S(2)*b**S(4)) - S(9)*a*x**S(5)/(S(10)*b**S(3)) - x**S(9)/(S(2)*b*(a + b*x**S(2))) + S(9)*x**S(7)/(S(14)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -S(7)*a**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(2)*b**(S(9)/2)) + S(7)*a**S(2)*x/(S(2)*b**S(4)) - S(7)*a*x**S(3)/(S(6)*b**S(3)) - x**S(7)/(S(2)*b*(a + b*x**S(2))) + S(7)*x**S(5)/(S(10)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(5)*a**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(2)*b**(S(7)/2)) - S(5)*a*x/(S(2)*b**S(3)) - x**S(5)/(S(2)*b*(a + b*x**S(2))) + S(5)*x**S(3)/(S(6)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -S(3)*sqrt(a)*atan(sqrt(b)*x/sqrt(a))/(S(2)*b**(S(5)/2)) - x**S(3)/(S(2)*b*(a + b*x**S(2))) + S(3)*x/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -x/(S(2)*b*(a + b*x**S(2))) + atan(sqrt(b)*x/sqrt(a))/(S(2)*sqrt(a)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, x/(S(2)*a*(a + b*x**S(2))) + atan(sqrt(b)*x/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*x*(a + b*x**S(2))) - S(3)/(S(2)*a**S(2)*x) - S(3)*sqrt(b)*atan(sqrt(b)*x/sqrt(a))/(S(2)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*x**S(3)*(a + b*x**S(2))) - S(5)/(S(6)*a**S(2)*x**S(3)) + S(5)*b/(S(2)*a**S(3)*x) + S(5)*b**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(2)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*x**S(5)*(a + b*x**S(2))) - S(7)/(S(10)*a**S(2)*x**S(5)) + S(7)*b/(S(6)*a**S(3)*x**S(3)) - S(7)*b**S(2)/(S(2)*a**S(4)*x) - S(7)*b**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(2)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, (d*x)**(m + S(1))*hyper((S(4), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a**S(4)*d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(5)/(S(6)*b**S(6)*(a + b*x**S(2))**S(3)) - S(5)*a**S(4)/(S(4)*b**S(6)*(a + b*x**S(2))**S(2)) + S(5)*a**S(3)/(b**S(6)*(a + b*x**S(2))) + S(5)*a**S(2)*log(a + b*x**S(2))/b**S(6) - S(2)*a*x**S(2)/b**S(5) + x**S(4)/(S(4)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -a**S(4)/(S(6)*b**S(5)*(a + b*x**S(2))**S(3)) + a**S(3)/(b**S(5)*(a + b*x**S(2))**S(2)) - S(3)*a**S(2)/(b**S(5)*(a + b*x**S(2))) - S(2)*a*log(a + b*x**S(2))/b**S(5) + x**S(2)/(S(2)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a**S(3)/(S(6)*b**S(4)*(a + b*x**S(2))**S(3)) - S(3)*a**S(2)/(S(4)*b**S(4)*(a + b*x**S(2))**S(2)) + S(3)*a/(S(2)*b**S(4)*(a + b*x**S(2))) + log(a + b*x**S(2))/(S(2)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, x**S(6)/(S(6)*a*(a + b*x**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, a/(S(6)*b**S(2)*(a + b*x**S(2))**S(3)) - S(1)/(S(4)*b**S(2)*(a + b*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -S(1)/(S(6)*b*(a + b*x**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*(a + b*x**S(2))**S(3)) + S(1)/(S(4)*a**S(2)*(a + b*x**S(2))**S(2)) + S(1)/(S(2)*a**S(3)*(a + b*x**S(2))) + log(x)/a**S(4) - log(a + b*x**S(2))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, -b/(S(6)*a**S(2)*(a + b*x**S(2))**S(3)) - b/(S(2)*a**S(3)*(a + b*x**S(2))**S(2)) - S(3)*b/(S(2)*a**S(4)*(a + b*x**S(2))) - S(1)/(S(2)*a**S(4)*x**S(2)) - S(4)*b*log(x)/a**S(5) + S(2)*b*log(a + b*x**S(2))/a**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, b**S(2)/(S(6)*a**S(3)*(a + b*x**S(2))**S(3)) + S(3)*b**S(2)/(S(4)*a**S(4)*(a + b*x**S(2))**S(2)) - S(1)/(S(4)*a**S(4)*x**S(4)) + S(3)*b**S(2)/(a**S(5)*(a + b*x**S(2))) + S(2)*b/(a**S(5)*x**S(2)) + S(10)*b**S(2)*log(x)/a**S(6) - S(5)*b**S(2)*log(a + b*x**S(2))/a**S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -S(231)*a**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(16)*b**(S(13)/2)) + S(231)*a**S(2)*x/(S(16)*b**S(6)) - S(77)*a*x**S(3)/(S(16)*b**S(5)) - x**S(11)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(11)*x**S(9)/(S(24)*b**S(2)*(a + b*x**S(2))**S(2)) - S(33)*x**S(7)/(S(16)*b**S(3)*(a + b*x**S(2))) + S(231)*x**S(5)/(S(80)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, S(105)*a**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(16)*b**(S(11)/2)) - S(105)*a*x/(S(16)*b**S(5)) - x**S(9)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(3)*x**S(7)/(S(8)*b**S(2)*(a + b*x**S(2))**S(2)) - S(21)*x**S(5)/(S(16)*b**S(3)*(a + b*x**S(2))) + S(35)*x**S(3)/(S(16)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -S(35)*sqrt(a)*atan(sqrt(b)*x/sqrt(a))/(S(16)*b**(S(9)/2)) - x**S(7)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(7)*x**S(5)/(S(24)*b**S(2)*(a + b*x**S(2))**S(2)) - S(35)*x**S(3)/(S(48)*b**S(3)*(a + b*x**S(2))) + S(35)*x/(S(16)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -x**S(5)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(5)*x**S(3)/(S(24)*b**S(2)*(a + b*x**S(2))**S(2)) - S(5)*x/(S(16)*b**S(3)*(a + b*x**S(2))) + S(5)*atan(sqrt(b)*x/sqrt(a))/(S(16)*sqrt(a)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -x**S(3)/(S(6)*b*(a + b*x**S(2))**S(3)) - x/(S(8)*b**S(2)*(a + b*x**S(2))**S(2)) + x/(S(16)*a*b**S(2)*(a + b*x**S(2))) + atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(3)/2)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -x/(S(6)*b*(a + b*x**S(2))**S(3)) + x/(S(24)*a*b*(a + b*x**S(2))**S(2)) + x/(S(16)*a**S(2)*b*(a + b*x**S(2))) + atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(5)/2)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(-2)), x), x, x/(S(6)*a*(a + b*x**S(2))**S(3)) + S(5)*x/(S(24)*a**S(2)*(a + b*x**S(2))**S(2)) + S(5)*x/(S(16)*a**S(3)*(a + b*x**S(2))) + S(5)*atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(7)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*x*(a + b*x**S(2))**S(3)) + S(7)/(S(24)*a**S(2)*x*(a + b*x**S(2))**S(2)) + S(35)/(S(48)*a**S(3)*x*(a + b*x**S(2))) - S(35)/(S(16)*a**S(4)*x) - S(35)*sqrt(b)*atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*x**S(3)*(a + b*x**S(2))**S(3)) + S(3)/(S(8)*a**S(2)*x**S(3)*(a + b*x**S(2))**S(2)) + S(21)/(S(16)*a**S(3)*x**S(3)*(a + b*x**S(2))) - S(35)/(S(16)*a**S(4)*x**S(3)) + S(105)*b/(S(16)*a**S(5)*x) + S(105)*b**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*x**S(5)*(a + b*x**S(2))**S(3)) + S(11)/(S(24)*a**S(2)*x**S(5)*(a + b*x**S(2))**S(2)) + S(33)/(S(16)*a**S(3)*x**S(5)*(a + b*x**S(2))) - S(231)/(S(80)*a**S(4)*x**S(5)) + S(77)*b/(S(16)*a**S(5)*x**S(3)) - S(231)*b**S(2)/(S(16)*a**S(6)*x) - S(231)*b**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(16)*a**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, (d*x)**(m + S(1))*hyper((S(6), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a**S(6)*d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(15)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(7)/(S(10)*b**S(8)*(a + b*x**S(2))**S(5)) - S(7)*a**S(6)/(S(8)*b**S(8)*(a + b*x**S(2))**S(4)) + S(7)*a**S(5)/(S(2)*b**S(8)*(a + b*x**S(2))**S(3)) - S(35)*a**S(4)/(S(4)*b**S(8)*(a + b*x**S(2))**S(2)) + S(35)*a**S(3)/(S(2)*b**S(8)*(a + b*x**S(2))) + S(21)*a**S(2)*log(a + b*x**S(2))/(S(2)*b**S(8)) - S(3)*a*x**S(2)/b**S(7) + x**S(4)/(S(4)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(13)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -a**S(6)/(S(10)*b**S(7)*(a + b*x**S(2))**S(5)) + S(3)*a**S(5)/(S(4)*b**S(7)*(a + b*x**S(2))**S(4)) - S(5)*a**S(4)/(S(2)*b**S(7)*(a + b*x**S(2))**S(3)) + S(5)*a**S(3)/(b**S(7)*(a + b*x**S(2))**S(2)) - S(15)*a**S(2)/(S(2)*b**S(7)*(a + b*x**S(2))) - S(3)*a*log(a + b*x**S(2))/b**S(7) + x**S(2)/(S(2)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a**S(5)/(S(10)*b**S(6)*(a + b*x**S(2))**S(5)) - S(5)*a**S(4)/(S(8)*b**S(6)*(a + b*x**S(2))**S(4)) + S(5)*a**S(3)/(S(3)*b**S(6)*(a + b*x**S(2))**S(3)) - S(5)*a**S(2)/(S(2)*b**S(6)*(a + b*x**S(2))**S(2)) + S(5)*a/(S(2)*b**S(6)*(a + b*x**S(2))) + log(a + b*x**S(2))/(S(2)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, x**S(10)/(S(10)*a*(a + b*x**S(2))**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, x**S(8)/(S(10)*a*(a + b*x**S(2))**S(5)) + x**S(8)/(S(40)*a**S(2)*(a + b*x**S(2))**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -a**S(2)/(S(10)*b**S(3)*(a + b*x**S(2))**S(5)) + a/(S(4)*b**S(3)*(a + b*x**S(2))**S(4)) - S(1)/(S(6)*b**S(3)*(a + b*x**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, a/(S(10)*b**S(2)*(a + b*x**S(2))**S(5)) - S(1)/(S(8)*b**S(2)*(a + b*x**S(2))**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -S(1)/(S(10)*b*(a + b*x**S(2))**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*(a + b*x**S(2))**S(5)) + S(1)/(S(8)*a**S(2)*(a + b*x**S(2))**S(4)) + S(1)/(S(6)*a**S(3)*(a + b*x**S(2))**S(3)) + S(1)/(S(4)*a**S(4)*(a + b*x**S(2))**S(2)) + S(1)/(S(2)*a**S(5)*(a + b*x**S(2))) + log(x)/a**S(6) - log(a + b*x**S(2))/(S(2)*a**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, -b/(S(10)*a**S(2)*(a + b*x**S(2))**S(5)) - b/(S(4)*a**S(3)*(a + b*x**S(2))**S(4)) - b/(S(2)*a**S(4)*(a + b*x**S(2))**S(3)) - b/(a**S(5)*(a + b*x**S(2))**S(2)) - S(5)*b/(S(2)*a**S(6)*(a + b*x**S(2))) - S(1)/(S(2)*a**S(6)*x**S(2)) - S(6)*b*log(x)/a**S(7) + S(3)*b*log(a + b*x**S(2))/a**S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, b**S(2)/(S(10)*a**S(3)*(a + b*x**S(2))**S(5)) + S(3)*b**S(2)/(S(8)*a**S(4)*(a + b*x**S(2))**S(4)) + b**S(2)/(a**S(5)*(a + b*x**S(2))**S(3)) + S(5)*b**S(2)/(S(2)*a**S(6)*(a + b*x**S(2))**S(2)) - S(1)/(S(4)*a**S(6)*x**S(4)) + S(15)*b**S(2)/(S(2)*a**S(7)*(a + b*x**S(2))) + S(3)*b/(a**S(7)*x**S(2)) + S(21)*b**S(2)*log(x)/a**S(8) - S(21)*b**S(2)*log(a + b*x**S(2))/(S(2)*a**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(16)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -S(9009)*a**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(256)*b**(S(17)/2)) + S(9009)*a**S(2)*x/(S(256)*b**S(8)) - S(3003)*a*x**S(3)/(S(256)*b**S(7)) - x**S(15)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(3)*x**S(13)/(S(16)*b**S(2)*(a + b*x**S(2))**S(4)) - S(13)*x**S(11)/(S(32)*b**S(3)*(a + b*x**S(2))**S(3)) - S(143)*x**S(9)/(S(128)*b**S(4)*(a + b*x**S(2))**S(2)) - S(1287)*x**S(7)/(S(256)*b**S(5)*(a + b*x**S(2))) + S(9009)*x**S(5)/(S(1280)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, S(3003)*a**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(256)*b**(S(15)/2)) - S(3003)*a*x/(S(256)*b**S(7)) - x**S(13)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(13)*x**S(11)/(S(80)*b**S(2)*(a + b*x**S(2))**S(4)) - S(143)*x**S(9)/(S(480)*b**S(3)*(a + b*x**S(2))**S(3)) - S(429)*x**S(7)/(S(640)*b**S(4)*(a + b*x**S(2))**S(2)) - S(3003)*x**S(5)/(S(1280)*b**S(5)*(a + b*x**S(2))) + S(1001)*x**S(3)/(S(256)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -S(693)*sqrt(a)*atan(sqrt(b)*x/sqrt(a))/(S(256)*b**(S(13)/2)) - x**S(11)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(11)*x**S(9)/(S(80)*b**S(2)*(a + b*x**S(2))**S(4)) - S(33)*x**S(7)/(S(160)*b**S(3)*(a + b*x**S(2))**S(3)) - S(231)*x**S(5)/(S(640)*b**S(4)*(a + b*x**S(2))**S(2)) - S(231)*x**S(3)/(S(256)*b**S(5)*(a + b*x**S(2))) + S(693)*x/(S(256)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -x**S(9)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(9)*x**S(7)/(S(80)*b**S(2)*(a + b*x**S(2))**S(4)) - S(21)*x**S(5)/(S(160)*b**S(3)*(a + b*x**S(2))**S(3)) - S(21)*x**S(3)/(S(128)*b**S(4)*(a + b*x**S(2))**S(2)) - S(63)*x/(S(256)*b**S(5)*(a + b*x**S(2))) + S(63)*atan(sqrt(b)*x/sqrt(a))/(S(256)*sqrt(a)*b**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -x**S(7)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(7)*x**S(5)/(S(80)*b**S(2)*(a + b*x**S(2))**S(4)) - S(7)*x**S(3)/(S(96)*b**S(3)*(a + b*x**S(2))**S(3)) - S(7)*x/(S(128)*b**S(4)*(a + b*x**S(2))**S(2)) + S(7)*x/(S(256)*a*b**S(4)*(a + b*x**S(2))) + S(7)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(3)/2)*b**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -x**S(5)/(S(10)*b*(a + b*x**S(2))**S(5)) - x**S(3)/(S(16)*b**S(2)*(a + b*x**S(2))**S(4)) - x/(S(32)*b**S(3)*(a + b*x**S(2))**S(3)) + x/(S(128)*a*b**S(3)*(a + b*x**S(2))**S(2)) + S(3)*x/(S(256)*a**S(2)*b**S(3)*(a + b*x**S(2))) + S(3)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(5)/2)*b**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -x**S(3)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(3)*x/(S(80)*b**S(2)*(a + b*x**S(2))**S(4)) + x/(S(160)*a*b**S(2)*(a + b*x**S(2))**S(3)) + x/(S(128)*a**S(2)*b**S(2)*(a + b*x**S(2))**S(2)) + S(3)*x/(S(256)*a**S(3)*b**S(2)*(a + b*x**S(2))) + S(3)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(7)/2)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -x/(S(10)*b*(a + b*x**S(2))**S(5)) + x/(S(80)*a*b*(a + b*x**S(2))**S(4)) + S(7)*x/(S(480)*a**S(2)*b*(a + b*x**S(2))**S(3)) + S(7)*x/(S(384)*a**S(3)*b*(a + b*x**S(2))**S(2)) + S(7)*x/(S(256)*a**S(4)*b*(a + b*x**S(2))) + S(7)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(9)/2)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(-3)), x), x, x/(S(10)*a*(a + b*x**S(2))**S(5)) + S(9)*x/(S(80)*a**S(2)*(a + b*x**S(2))**S(4)) + S(21)*x/(S(160)*a**S(3)*(a + b*x**S(2))**S(3)) + S(21)*x/(S(128)*a**S(4)*(a + b*x**S(2))**S(2)) + S(63)*x/(S(256)*a**S(5)*(a + b*x**S(2))) + S(63)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(11)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*x*(a + b*x**S(2))**S(5)) + S(11)/(S(80)*a**S(2)*x*(a + b*x**S(2))**S(4)) + S(33)/(S(160)*a**S(3)*x*(a + b*x**S(2))**S(3)) + S(231)/(S(640)*a**S(4)*x*(a + b*x**S(2))**S(2)) + S(231)/(S(256)*a**S(5)*x*(a + b*x**S(2))) - S(693)/(S(256)*a**S(6)*x) - S(693)*sqrt(b)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*x**S(3)*(a + b*x**S(2))**S(5)) + S(13)/(S(80)*a**S(2)*x**S(3)*(a + b*x**S(2))**S(4)) + S(143)/(S(480)*a**S(3)*x**S(3)*(a + b*x**S(2))**S(3)) + S(429)/(S(640)*a**S(4)*x**S(3)*(a + b*x**S(2))**S(2)) + S(3003)/(S(1280)*a**S(5)*x**S(3)*(a + b*x**S(2))) - S(1001)/(S(256)*a**S(6)*x**S(3)) + S(3003)*b/(S(256)*a**S(7)*x) + S(3003)*b**(S(3)/2)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(15)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*x**S(5)*(a + b*x**S(2))**S(5)) + S(3)/(S(16)*a**S(2)*x**S(5)*(a + b*x**S(2))**S(4)) + S(13)/(S(32)*a**S(3)*x**S(5)*(a + b*x**S(2))**S(3)) + S(143)/(S(128)*a**S(4)*x**S(5)*(a + b*x**S(2))**S(2)) + S(1287)/(S(256)*a**S(5)*x**S(5)*(a + b*x**S(2))) - S(9009)/(S(1280)*a**S(6)*x**S(5)) + S(3003)*b/(S(256)*a**S(7)*x**S(3)) - S(9009)*b**S(2)/(S(256)*a**S(8)*x) - S(9009)*b**(S(5)/2)*atan(sqrt(b)*x/sqrt(a))/(S(256)*a**(S(17)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, x/(S(2)*x**S(2) + S(2)) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, -S(1)/(S(2)*x**S(2) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, -x/(S(2)*x**S(2) + S(2)) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, log(x**S(2) + S(1))/S(2) + S(1)/(S(2)*x**S(2) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(4) - S(18)*x**S(2) + S(81)), x), x, S(1)/(-S(2)*x**S(2) + S(18)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(4) - S(8)*x**S(2) + S(16)), x), x, log(-x**S(2) + S(4))/S(2) + S(2)/(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a*(d*x)**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*(a + b*x**S(2))*(m**S(2) + S(4)*m + S(3))) + (d*x)**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*(m + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a*x**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(24)*a + S(24)*b*x**S(2)) + x**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*a + S(35)*b*x**S(2)) + x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(12)*a + S(12)*b*x**S(2)) + x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*a + S(15)*b*x**S(2)) + x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*a + S(3)*b*x**S(2)) + x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x, x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(2), x), x, -S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(x*(a + b*x**S(2))) + sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(3), x), x, -a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*x**S(2)*(a + b*x**S(2))) + b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(4), x), x, S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*x**S(3)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(5), x), x, -(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*a*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(6), x), x, S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*x**S(5)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(7), x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(12)*x**S(6)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(8), x), x, S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*x**S(7)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(9), x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(24)*x**S(8)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(10), x), x, S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x**S(9)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(11), x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(40)*x**S(10)*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(8)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a**S(3)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(560)*a + S(560)*b*x**S(2)) + a**S(2)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(112) + S(3)*a*x**S(10)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(112) + x**S(10)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*a**S(3)*x**S(9)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6435)*a + S(6435)*b*x**S(2)) + S(8)*a**S(2)*x**S(9)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(715) + S(2)*a*x**S(9)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(65) + x**S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a**S(3)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(280)*a + S(280)*b*x**S(2)) + a**S(2)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(70) + a*x**S(8)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(28) + x**S(8)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*a**S(3)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3003)*a + S(3003)*b*x**S(2)) + S(8)*a**S(2)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(429) + S(6)*a*x**S(7)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(143) + x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a**S(2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(24)*b**S(3)) - a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(30)*b**S(3)) + x**S(4)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*a**S(3)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1155)*a + S(1155)*b*x**S(2)) + S(8)*a**S(2)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(231) + S(2)*a*x**S(5)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(33) + x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*b**S(2)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(10)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*a**S(3)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(315)*a + S(315)*b*x**S(2)) + S(8)*a**S(2)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(105) + S(2)*a*x**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(21) + x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*a + S(35)*b*x**S(2)) + S(8)*a**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(35) + S(6)*a*x*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(35) + x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x, x), x, a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) + a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(4) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(2), x), x, -S(16)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x*(a + b*x**S(2))) + S(8)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(5)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(3), x), x, S(3)*a**S(2)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(3)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) - S(3)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(2)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(4), x), x, S(16)*a*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*a + S(3)*b*x**S(2)) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(3) + S(8)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(3) - S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(5), x), x, S(3)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(3)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(4)) + S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) - (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(6), x), x, -S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x*(a + b*x**S(2))) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x**S(5)) + S(8)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*x) - S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(7), x), x, -a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*x**S(2)*(a + b*x**S(2))) + a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(6)) + b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) - S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(12)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(8), x), x, S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*x**S(3)*(a + b*x**S(2))) + S(6)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*x**S(7)) - S(24)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*x**S(3)) - S(11)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(35)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(9), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*a*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(10), x), x, S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(315)*x**S(5)*(a + b*x**S(2))) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(21)*x**S(9)) - S(8)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x**S(5)) - S(13)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(63)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(11), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*a*x**S(10)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(40)*a**S(2)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(12), x), x, S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1155)*x**S(7)*(a + b*x**S(2))) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(33)*x**S(11)) - S(8)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(165)*x**S(7)) - S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(33)*x**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(13), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(12)*a*x**S(12)) + b*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(24)*a**S(2)*x**S(10)) - b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(120)*a**S(3)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(14), x), x, S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3003)*x**S(9)*(a + b*x**S(2))) + S(6)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(143)*x**S(13)) - S(24)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1001)*x**S(9)) - S(17)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(143)*x**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(15), x), x, a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(280)*x**S(10)*(a + b*x**S(2))) + a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(28)*x**S(14)) - b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(56)*x**S(10)) - S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(28)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(16), x), x, S(16)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6435)*x**S(11)*(a + b*x**S(2))) + S(2)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(65)*x**S(15)) - S(8)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(585)*x**S(11)) - S(19)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(195)*x**S(15)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/x**S(17), x), x, a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(560)*x**S(12)*(a + b*x**S(2))) + S(3)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(112)*x**S(16)) - S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(280)*x**S(12)) - S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(56)*x**S(16)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(13)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a**S(5)*x**S(14)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(11088)*a + S(11088)*b*x**S(2)) + a**S(4)*x**S(14)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(1584) + a**S(3)*x**S(14)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(396) + a**S(2)*x**S(14)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(132) + S(5)*a*x**S(14)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(264) + x**S(14)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(24), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(13)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2028117)*a + S(2028117)*b*x**S(2)) + S(128)*a**S(4)*x**S(13)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(156009) + S(160)*a**S(3)*x**S(13)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(52003) + S(80)*a**S(2)*x**S(13)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(9177) + S(10)*a*x**S(13)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(483) + x**S(13)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a**S(5)*x**S(12)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5544)*a + S(5544)*b*x**S(2)) + a**S(4)*x**S(12)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(924) + a**S(3)*x**S(12)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(264) + a**S(2)*x**S(12)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(99) + a*x**S(12)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(44) + x**S(12)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(22), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(11)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(969969)*a + S(969969)*b*x**S(2)) + S(128)*a**S(4)*x**S(11)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(88179) + S(32)*a**S(3)*x**S(11)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(6783) + S(80)*a**S(2)*x**S(11)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(6783) + S(10)*a*x**S(11)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(399) + x**S(11)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a**S(4)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(360)*b**S(5)) - a**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(420)*b**S(5)) + a**S(2)*x**S(4)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(120)*b**S(3)) - a*x**S(6)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(45)*b**S(2)) + x**S(8)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(20)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(9)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(415701)*a + S(415701)*b*x**S(2)) + S(128)*a**S(4)*x**S(9)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(46189) + S(32)*a**S(3)*x**S(9)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(4199) + S(16)*a**S(2)*x**S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(969) + S(10)*a*x**S(9)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(323) + x**S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, -a**S(3)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(144)*b**S(4)) + a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(168)*b**S(4)) - a*x**S(4)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(48)*b**S(2)) + x**S(6)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(18)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(153153)*a + S(153153)*b*x**S(2)) + S(128)*a**S(4)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(21879) + S(32)*a**S(3)*x**S(7)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2431) + S(16)*a**S(2)*x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(663) + S(2)*a*x**S(7)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(51) + x**S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a**S(2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(48)*b**S(3)) - a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(56)*b**S(3)) + x**S(4)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(16)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(45045)*a + S(45045)*b*x**S(2)) + S(128)*a**S(4)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(9009) + S(32)*a**S(3)*x**S(5)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(1287) + S(16)*a**S(2)*x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(429) + S(2)*a*x**S(5)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(39) + x**S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, -a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(12)*b**S(2)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(14)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(9009)*a + S(9009)*b*x**S(2)) + S(128)*a**S(4)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(3003) + S(160)*a**S(3)*x**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(3003) + S(80)*a**S(2)*x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(1287) + S(10)*a*x**S(3)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(143) + x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, (a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(256)*a**S(5)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(693)*a + S(693)*b*x**S(2)) + S(128)*a**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(693) + S(32)*a**S(3)*x*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(231) + S(80)*a**S(2)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(693) + S(10)*a*x*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(99) + x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x, x), x, a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) + a**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(4) + a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(6) + a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(8) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(2), x), x, -S(256)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x*(a + b*x**S(2))) + S(128)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x) + S(32)*a**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x) + S(16)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(63)*x) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(63)*x) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(9)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(3), x), x, S(5)*a**S(4)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(5)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) + S(5)*a**S(2)*b*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(4) + S(5)*a*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(6) - S(5)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*x**S(2)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(8)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(4), x), x, S(256)*a**S(3)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(21)*a + S(21)*b*x**S(2)) + S(128)*a**S(2)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(21) + S(32)*a*b**S(2)*x*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(7) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(3)*x**S(3)) + S(80)*b**S(2)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(21) - S(11)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(5), x), x, S(10)*a**S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(5)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)) + S(5)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) + S(5)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(4)*x**S(4)) + S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/S(3) - S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(2)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(6), x), x, -S(256)*a**S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*x*(a + b*x**S(2))) + S(128)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*x) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*x) + S(2)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(3)*x**S(5)) + S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(15)*x) - S(13)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(15)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(7), x), x, S(10)*a**S(2)*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(5)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)) - S(5)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*x**S(2)) + S(5)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(12)*x**S(6)) + S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(6)*x**S(2)) - S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(12)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(8), x), x, S(256)*a*b**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(21)*a + S(21)*b*x**S(2)) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7)*x**S(3)) + S(2)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(7)*x**S(7)) + S(128)*b**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(21) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(3)*x**S(3)) - S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(9), x), x, S(5)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) + S(5)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(4)) + S(5)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(24)*x**S(8)) + S(5)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/S(2) - S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(3)*x**S(4)) - (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(3)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(10), x), x, -S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x**S(5)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(63)*x**S(9)) + S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(63)*x) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(21)*x**S(5)) - S(17)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(63)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(11), x), x, -a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*x**S(2)*(a + b*x**S(2))) + a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*x**S(6)) + a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(8)*x**S(10)) + b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*log(x)/(a + b*x**S(2)) - S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(12)*x**S(6)) - S(9)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(40)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(12), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(693)*x**S(3)*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(231)*x**S(7)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(99)*x**S(11)) - S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(231)*x**S(3)) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(63)*x**S(7)) - S(19)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(99)*x**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(13), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(12)*a*x**S(12)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(14), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(9009)*x**S(5)*(a + b*x**S(2))) + S(160)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3003)*x**S(9)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(143)*x**S(13)) - S(640)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(9009)*x**S(5)) - S(80)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(693)*x**S(9)) - S(21)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(143)*x**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(15), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(12)*a*x**S(14)) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(84)*a**S(2)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(16), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(45045)*x**S(7)*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1287)*x**S(11)) + S(2)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(39)*x**S(15)) - S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6435)*x**S(7)) - S(80)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(1287)*x**S(11)) - S(23)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(195)*x**S(15)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(17), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(16)*a*x**S(16)) + b*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(48)*a**S(2)*x**S(14)) - b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(336)*a**S(3)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(18), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(153153)*x**S(9)*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2431)*x**S(13)) + S(2)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(51)*x**S(17)) - S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(17017)*x**S(9)) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(429)*x**S(13)) - S(5)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(51)*x**S(17)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(19), x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(18)*a*x**S(18)) + b*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(48)*a**S(2)*x**S(16)) - b**S(2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(144)*a**S(3)*x**S(14)) + b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(7)/2)/(S(1008)*a**S(4)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(20), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(415701)*x**S(11)*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4199)*x**S(15)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(323)*x**S(19)) - S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(37791)*x**S(11)) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(663)*x**S(15)) - S(27)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(323)*x**S(19)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(21), x), x, a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2520)*x**S(12)*(a + b*x**S(2))) + a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(168)*x**S(16)) + a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(36)*x**S(20)) - b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(420)*x**S(12)) - S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(252)*x**S(16)) - S(7)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(90)*x**S(20)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(22), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(969969)*x**S(13)*(a + b*x**S(2))) + S(32)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6783)*x**S(17)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(399)*x**S(21)) - S(128)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(74613)*x**S(13)) - S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(969)*x**S(17)) - S(29)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(399)*x**S(21)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(23), x), x, a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5544)*x**S(14)*(a + b*x**S(2))) + a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(264)*x**S(18)) + a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(44)*x**S(22)) - b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(792)*x**S(14)) - b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(72)*x**S(18)) - S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(44)*x**S(22)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(24), x), x, S(256)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2028117)*x**S(15)*(a + b*x**S(2))) + S(160)*a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(52003)*x**S(19)) + S(10)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(483)*x**S(23)) - S(640)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(676039)*x**S(15)) - S(80)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(6783)*x**S(19)) - S(31)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(483)*x**S(23)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/x**S(25), x), x, a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(11088)*x**S(16)*(a + b*x**S(2))) + a*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(396)*x**S(20)) + S(5)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(264)*x**S(24)) - b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1386)*x**S(16)) - b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(99)*x**S(20)) - S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(33)*x**S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (d*x)**(m + S(1))*(a + b*x**S(2))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a*d*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, a**(S(3)/2)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(b**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - a*x*(a + b*x**S(2))/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + x**S(3)*(a + b*x**S(2))/(S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -a*(a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -sqrt(a)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(b**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + x*(a + b*x**S(2))/(b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, (a + b*x**S(2))*log(x)/(a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -(a + b*x**S(2))/(a*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(b)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(a**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -b*(a + b*x**S(2))*log(x)/(a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + b*(a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*a**S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -(a + b*x**S(2))/(S(3)*a*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + b*(a + b*x**S(2))/(a**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + b**(S(3)/2)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(a**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (d*x)**(m + S(1))*(a + b*x**S(2))*hyper((S(3), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a**S(3)*d*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a*x*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(5)*x/(S(8)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(3)*a + S(3)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(8)*sqrt(a)*b**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, x**S(4)*(a + b*x**S(2))/(S(4)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, x**S(3)*(a + b*x**S(2))/(S(4)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - x/(S(8)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(3)/2)*b**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -(a + b*x**S(2))/(S(4)*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(-3)/2), x), x, x*(a + b*x**S(2))/(S(4)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(3)*x/(S(8)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(3)*a + S(3)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(1)/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*log(x)/(a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)/(S(8)*a**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(15)*a + S(15)*b*x**S(2))/(S(8)*a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(15)*sqrt(b)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(3)/(S(4)*a**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*b*(a + b*x**S(2))*log(x)/(a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3)*b*(a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*a**S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(7)/(S(8)*a**S(2)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(35)*a + S(35)*b*x**S(2))/(S(24)*a**S(3)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*b*(a + b*x**S(2))/(S(8)*a**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*b**(S(3)/2)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(9)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, (d*x)**(m + S(1))*(a + b*x**S(2))*hyper((S(5), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a**S(5)*d*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*x**S(3)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(11)*x**S(3)/(S(48)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)*x**S(3)*(a + b*x**S(2))/(S(64)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(5)*x/(S(128)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(5)*a + S(5)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(3)/2)*b**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, x**S(6)*(a + b*x**S(2))/(S(8)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + x**S(6)/(S(24)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*x*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(3)*x/(S(16)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + x*(a + b*x**S(2))/(S(64)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(3)*x/(S(128)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(3)*a + S(3)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(5)/2)*b**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(1)/(S(6)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, x**S(3)*(a + b*x**S(2))/(S(8)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(5)*x/(S(48)*a*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)*x*(a + b*x**S(2))/(S(192)*a**S(2)*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)*x/(S(128)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(5)*a + S(5)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(7)/2)*b**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, -(a + b*x**S(2))/(S(8)*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(-5)/2), x), x, x*(a + b*x**S(2))/(S(8)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(7)*x/(S(48)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(35)*x*(a + b*x**S(2))/(S(192)*a**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(35)*x/(S(128)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (S(35)*a + S(35)*b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(9)/2)*sqrt(b)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(1)/(S(6)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (a + b*x**S(2))/(S(4)*a**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(1)/(S(2)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*log(x)/(a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(3)/(S(16)*a**S(2)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(21)*a + S(21)*b*x**S(2))/(S(64)*a**S(3)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(105)/(S(128)*a**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(315)*a + S(315)*b*x**S(2))/(S(128)*a**S(5)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(315)*sqrt(b)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(11)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(5)/(S(24)*a**S(2)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(5)*a + S(5)*b*x**S(2))/(S(12)*a**S(3)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)/(S(4)*a**S(4)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*b*(a + b*x**S(2))*log(x)/(a**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(5)*b*(a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*a**S(6)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(11)/(S(48)*a**S(2)*x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(33)*a + S(33)*b*x**S(2))/(S(64)*a**S(3)*x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(231)/(S(128)*a**S(4)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(385)*a + S(385)*b*x**S(2))/(S(128)*a**S(5)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(1155)*b*(a + b*x**S(2))/(S(128)*a**S(6)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(1155)*b**(S(3)/2)*(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a))/(S(128)*a**(S(13)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a**S(2)*(d*x)**(S(7)/2)/(S(7)*d) + S(4)*a*b*(d*x)**(S(11)/2)/(S(11)*d**S(3)) + S(2)*b**S(2)*(d*x)**(S(15)/2)/(S(15)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a**S(2)*(d*x)**(S(5)/2)/(S(5)*d) + S(4)*a*b*(d*x)**(S(9)/2)/(S(9)*d**S(3)) + S(2)*b**S(2)*(d*x)**(S(13)/2)/(S(13)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(2)*a**S(2)*(d*x)**(S(3)/2)/(S(3)*d) + S(4)*a*b*(d*x)**(S(7)/2)/(S(7)*d**S(3)) + S(2)*b**S(2)*(d*x)**(S(11)/2)/(S(11)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/sqrt(d*x), x), x, S(2)*a**S(2)*sqrt(d*x)/d + S(4)*a*b*(d*x)**(S(5)/2)/(S(5)*d**S(3)) + S(2)*b**S(2)*(d*x)**(S(9)/2)/(S(9)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(3)/2), x), x, -S(2)*a**S(2)/(d*sqrt(d*x)) + S(4)*a*b*(d*x)**(S(3)/2)/(S(3)*d**S(3)) + S(2)*b**S(2)*(d*x)**(S(7)/2)/(S(7)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(5)/2), x), x, -S(2)*a**S(2)/(S(3)*d*(d*x)**(S(3)/2)) + S(4)*a*b*sqrt(d*x)/d**S(3) + S(2)*b**S(2)*(d*x)**(S(5)/2)/(S(5)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(7)/2), x), x, -S(2)*a**S(2)/(S(5)*d*(d*x)**(S(5)/2)) - S(4)*a*b/(d**S(3)*sqrt(d*x)) + S(2)*b**S(2)*(d*x)**(S(3)/2)/(S(3)*d**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, S(2)*a**S(4)*(d*x)**(S(7)/2)/(S(7)*d) + S(8)*a**S(3)*b*(d*x)**(S(11)/2)/(S(11)*d**S(3)) + S(4)*a**S(2)*b**S(2)*(d*x)**(S(15)/2)/(S(5)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(19)/2)/(S(19)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(23)/2)/(S(23)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, S(2)*a**S(4)*(d*x)**(S(5)/2)/(S(5)*d) + S(8)*a**S(3)*b*(d*x)**(S(9)/2)/(S(9)*d**S(3)) + S(12)*a**S(2)*b**S(2)*(d*x)**(S(13)/2)/(S(13)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(17)/2)/(S(17)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(21)/2)/(S(21)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, S(2)*a**S(4)*(d*x)**(S(3)/2)/(S(3)*d) + S(8)*a**S(3)*b*(d*x)**(S(7)/2)/(S(7)*d**S(3)) + S(12)*a**S(2)*b**S(2)*(d*x)**(S(11)/2)/(S(11)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(15)/2)/(S(15)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(19)/2)/(S(19)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/sqrt(d*x), x), x, S(2)*a**S(4)*sqrt(d*x)/d + S(8)*a**S(3)*b*(d*x)**(S(5)/2)/(S(5)*d**S(3)) + S(4)*a**S(2)*b**S(2)*(d*x)**(S(9)/2)/(S(3)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(13)/2)/(S(13)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(17)/2)/(S(17)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/(d*x)**(S(3)/2), x), x, -S(2)*a**S(4)/(d*sqrt(d*x)) + S(8)*a**S(3)*b*(d*x)**(S(3)/2)/(S(3)*d**S(3)) + S(12)*a**S(2)*b**S(2)*(d*x)**(S(7)/2)/(S(7)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(11)/2)/(S(11)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(15)/2)/(S(15)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/(d*x)**(S(5)/2), x), x, -S(2)*a**S(4)/(S(3)*d*(d*x)**(S(3)/2)) + S(8)*a**S(3)*b*sqrt(d*x)/d**S(3) + S(12)*a**S(2)*b**S(2)*(d*x)**(S(5)/2)/(S(5)*d**S(5)) + S(8)*a*b**S(3)*(d*x)**(S(9)/2)/(S(9)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(13)/2)/(S(13)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)/(d*x)**(S(7)/2), x), x, -S(2)*a**S(4)/(S(5)*d*(d*x)**(S(5)/2)) - S(8)*a**S(3)*b/(d**S(3)*sqrt(d*x)) + S(4)*a**S(2)*b**S(2)*(d*x)**(S(3)/2)/d**S(5) + S(8)*a*b**S(3)*(d*x)**(S(7)/2)/(S(7)*d**S(7)) + S(2)*b**S(4)*(d*x)**(S(11)/2)/(S(11)*d**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, S(2)*a**S(6)*(d*x)**(S(7)/2)/(S(7)*d) + S(12)*a**S(5)*b*(d*x)**(S(11)/2)/(S(11)*d**S(3)) + S(2)*a**S(4)*b**S(2)*(d*x)**(S(15)/2)/d**S(5) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(19)/2)/(S(19)*d**S(7)) + S(30)*a**S(2)*b**S(4)*(d*x)**(S(23)/2)/(S(23)*d**S(9)) + S(4)*a*b**S(5)*(d*x)**(S(27)/2)/(S(9)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(31)/2)/(S(31)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, S(2)*a**S(6)*(d*x)**(S(5)/2)/(S(5)*d) + S(4)*a**S(5)*b*(d*x)**(S(9)/2)/(S(3)*d**S(3)) + S(30)*a**S(4)*b**S(2)*(d*x)**(S(13)/2)/(S(13)*d**S(5)) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(17)/2)/(S(17)*d**S(7)) + S(10)*a**S(2)*b**S(4)*(d*x)**(S(21)/2)/(S(7)*d**S(9)) + S(12)*a*b**S(5)*(d*x)**(S(25)/2)/(S(25)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(29)/2)/(S(29)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, S(2)*a**S(6)*(d*x)**(S(3)/2)/(S(3)*d) + S(12)*a**S(5)*b*(d*x)**(S(7)/2)/(S(7)*d**S(3)) + S(30)*a**S(4)*b**S(2)*(d*x)**(S(11)/2)/(S(11)*d**S(5)) + S(8)*a**S(3)*b**S(3)*(d*x)**(S(15)/2)/(S(3)*d**S(7)) + S(30)*a**S(2)*b**S(4)*(d*x)**(S(19)/2)/(S(19)*d**S(9)) + S(12)*a*b**S(5)*(d*x)**(S(23)/2)/(S(23)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(27)/2)/(S(27)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/sqrt(d*x), x), x, S(2)*a**S(6)*sqrt(d*x)/d + S(12)*a**S(5)*b*(d*x)**(S(5)/2)/(S(5)*d**S(3)) + S(10)*a**S(4)*b**S(2)*(d*x)**(S(9)/2)/(S(3)*d**S(5)) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(13)/2)/(S(13)*d**S(7)) + S(30)*a**S(2)*b**S(4)*(d*x)**(S(17)/2)/(S(17)*d**S(9)) + S(4)*a*b**S(5)*(d*x)**(S(21)/2)/(S(7)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(25)/2)/(S(25)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/(d*x)**(S(3)/2), x), x, -S(2)*a**S(6)/(d*sqrt(d*x)) + S(4)*a**S(5)*b*(d*x)**(S(3)/2)/d**S(3) + S(30)*a**S(4)*b**S(2)*(d*x)**(S(7)/2)/(S(7)*d**S(5)) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(11)/2)/(S(11)*d**S(7)) + S(2)*a**S(2)*b**S(4)*(d*x)**(S(15)/2)/d**S(9) + S(12)*a*b**S(5)*(d*x)**(S(19)/2)/(S(19)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(23)/2)/(S(23)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/(d*x)**(S(5)/2), x), x, -S(2)*a**S(6)/(S(3)*d*(d*x)**(S(3)/2)) + S(12)*a**S(5)*b*sqrt(d*x)/d**S(3) + S(6)*a**S(4)*b**S(2)*(d*x)**(S(5)/2)/d**S(5) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(9)/2)/(S(9)*d**S(7)) + S(30)*a**S(2)*b**S(4)*(d*x)**(S(13)/2)/(S(13)*d**S(9)) + S(12)*a*b**S(5)*(d*x)**(S(17)/2)/(S(17)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(21)/2)/(S(21)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)/(d*x)**(S(7)/2), x), x, -S(2)*a**S(6)/(S(5)*d*(d*x)**(S(5)/2)) - S(12)*a**S(5)*b/(d**S(3)*sqrt(d*x)) + S(10)*a**S(4)*b**S(2)*(d*x)**(S(3)/2)/d**S(5) + S(40)*a**S(3)*b**S(3)*(d*x)**(S(7)/2)/(S(7)*d**S(7)) + S(30)*a**S(2)*b**S(4)*(d*x)**(S(11)/2)/(S(11)*d**S(9)) + S(4)*a*b**S(5)*(d*x)**(S(15)/2)/(S(5)*d**S(11)) + S(2)*b**S(6)*(d*x)**(S(19)/2)/(S(19)*d**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(11)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -S(9)*sqrt(S(2))*a**(S(5)/4)*d**(S(11)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(13)/4)) + S(9)*sqrt(S(2))*a**(S(5)/4)*d**(S(11)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(13)/4)) - S(9)*sqrt(S(2))*a**(S(5)/4)*d**(S(11)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(13)/4)) + S(9)*sqrt(S(2))*a**(S(5)/4)*d**(S(11)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(13)/4)) - S(9)*a*d**S(5)*sqrt(d*x)/(S(2)*b**S(3)) - d*(d*x)**(S(9)/2)/(S(2)*b*(a + b*x**S(2))) + S(9)*d**S(3)*(d*x)**(S(5)/2)/(S(10)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(9)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -S(7)*sqrt(S(2))*a**(S(3)/4)*d**(S(9)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(11)/4)) + S(7)*sqrt(S(2))*a**(S(3)/4)*d**(S(9)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(11)/4)) + S(7)*sqrt(S(2))*a**(S(3)/4)*d**(S(9)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(11)/4)) - S(7)*sqrt(S(2))*a**(S(3)/4)*d**(S(9)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(11)/4)) - d*(d*x)**(S(7)/2)/(S(2)*b*(a + b*x**S(2))) + S(7)*d**S(3)*(d*x)**(S(3)/2)/(S(6)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(5)*sqrt(S(2))*a**(S(1)/4)*d**(S(7)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(9)/4)) - S(5)*sqrt(S(2))*a**(S(1)/4)*d**(S(7)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*b**(S(9)/4)) + S(5)*sqrt(S(2))*a**(S(1)/4)*d**(S(7)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(9)/4)) - S(5)*sqrt(S(2))*a**(S(1)/4)*d**(S(7)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*b**(S(9)/4)) - d*(d*x)**(S(5)/2)/(S(2)*b*(a + b*x**S(2))) + S(5)*d**S(3)*sqrt(d*x)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -d*(d*x)**(S(3)/2)/(S(2)*b*(a + b*x**S(2))) + S(3)*sqrt(S(2))*d**(S(5)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(1)/4)*b**(S(7)/4)) - S(3)*sqrt(S(2))*d**(S(5)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(1)/4)*b**(S(7)/4)) - S(3)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(1)/4)*b**(S(7)/4)) + S(3)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(1)/4)*b**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -d*sqrt(d*x)/(S(2)*b*(a + b*x**S(2))) - sqrt(S(2))*d**(S(3)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(3)/4)*b**(S(5)/4)) + sqrt(S(2))*d**(S(3)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(3)/4)*b**(S(5)/4)) - sqrt(S(2))*d**(S(3)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(3)/4)*b**(S(5)/4)) + sqrt(S(2))*d**(S(3)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(3)/4)*b**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (d*x)**(S(3)/2)/(S(2)*a*d*(a + b*x**S(2))) + sqrt(S(2))*sqrt(d)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(5)/4)*b**(S(3)/4)) - sqrt(S(2))*sqrt(d)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(5)/4)*b**(S(3)/4)) - sqrt(S(2))*sqrt(d)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(5)/4)*b**(S(3)/4)) + sqrt(S(2))*sqrt(d)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(5)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, sqrt(d*x)/(S(2)*a*d*(a + b*x**S(2))) - S(3)*sqrt(S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(7)/4)*b**(S(1)/4)*sqrt(d)) + S(3)*sqrt(S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(7)/4)*b**(S(1)/4)*sqrt(d)) - S(3)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(7)/4)*b**(S(1)/4)*sqrt(d)) + S(3)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(7)/4)*b**(S(1)/4)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*d*sqrt(d*x)*(a + b*x**S(2))) - S(5)/(S(2)*a**S(2)*d*sqrt(d*x)) - S(5)*sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(9)/4)*d**(S(3)/2)) + S(5)*sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(9)/4)*d**(S(3)/2)) + S(5)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(9)/4)*d**(S(3)/2)) - S(5)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(9)/4)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) - S(7)/(S(6)*a**S(2)*d*(d*x)**(S(3)/2)) + S(7)*sqrt(S(2))*b**(S(3)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(11)/4)*d**(S(5)/2)) - S(7)*sqrt(S(2))*b**(S(3)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(11)/4)*d**(S(5)/2)) + S(7)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(11)/4)*d**(S(5)/2)) - S(7)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(11)/4)*d**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, S(1)/(S(2)*a*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(9)/(S(10)*a**S(2)*d*(d*x)**(S(5)/2)) + S(9)*b/(S(2)*a**S(3)*d**S(3)*sqrt(d*x)) + S(9)*sqrt(S(2))*b**(S(5)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(13)/4)*d**(S(7)/2)) - S(9)*sqrt(S(2))*b**(S(5)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(16)*a**(S(13)/4)*d**(S(7)/2)) - S(9)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(13)/4)*d**(S(7)/2)) + S(9)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(8)*a**(S(13)/4)*d**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(19)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -S(663)*sqrt(S(2))*a**(S(5)/4)*d**(S(19)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(21)/4)) + S(663)*sqrt(S(2))*a**(S(5)/4)*d**(S(19)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(21)/4)) - S(663)*sqrt(S(2))*a**(S(5)/4)*d**(S(19)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(21)/4)) + S(663)*sqrt(S(2))*a**(S(5)/4)*d**(S(19)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(21)/4)) - S(663)*a*d**S(9)*sqrt(d*x)/(S(64)*b**S(5)) - d*(d*x)**(S(17)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(17)*d**S(3)*(d*x)**(S(13)/2)/(S(48)*b**S(2)*(a + b*x**S(2))**S(2)) - S(221)*d**S(5)*(d*x)**(S(9)/2)/(S(192)*b**S(3)*(a + b*x**S(2))) + S(663)*d**S(7)*(d*x)**(S(5)/2)/(S(320)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(17)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -S(385)*sqrt(S(2))*a**(S(3)/4)*d**(S(17)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(19)/4)) + S(385)*sqrt(S(2))*a**(S(3)/4)*d**(S(17)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(19)/4)) + S(385)*sqrt(S(2))*a**(S(3)/4)*d**(S(17)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(19)/4)) - S(385)*sqrt(S(2))*a**(S(3)/4)*d**(S(17)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(19)/4)) - d*(d*x)**(S(15)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(5)*d**S(3)*(d*x)**(S(11)/2)/(S(16)*b**S(2)*(a + b*x**S(2))**S(2)) - S(55)*d**S(5)*(d*x)**(S(7)/2)/(S(64)*b**S(3)*(a + b*x**S(2))) + S(385)*d**S(7)*(d*x)**(S(3)/2)/(S(192)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(15)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, S(195)*sqrt(S(2))*a**(S(1)/4)*d**(S(15)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(17)/4)) - S(195)*sqrt(S(2))*a**(S(1)/4)*d**(S(15)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*b**(S(17)/4)) + S(195)*sqrt(S(2))*a**(S(1)/4)*d**(S(15)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(17)/4)) - S(195)*sqrt(S(2))*a**(S(1)/4)*d**(S(15)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*b**(S(17)/4)) - d*(d*x)**(S(13)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(13)*d**S(3)*(d*x)**(S(9)/2)/(S(48)*b**S(2)*(a + b*x**S(2))**S(2)) - S(39)*d**S(5)*(d*x)**(S(5)/2)/(S(64)*b**S(3)*(a + b*x**S(2))) + S(195)*d**S(7)*sqrt(d*x)/(S(64)*b**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(13)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*(d*x)**(S(11)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(11)*d**S(3)*(d*x)**(S(7)/2)/(S(48)*b**S(2)*(a + b*x**S(2))**S(2)) - S(77)*d**S(5)*(d*x)**(S(3)/2)/(S(192)*b**S(3)*(a + b*x**S(2))) + S(77)*sqrt(S(2))*d**(S(13)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(1)/4)*b**(S(15)/4)) - S(77)*sqrt(S(2))*d**(S(13)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(1)/4)*b**(S(15)/4)) - S(77)*sqrt(S(2))*d**(S(13)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(1)/4)*b**(S(15)/4)) + S(77)*sqrt(S(2))*d**(S(13)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(1)/4)*b**(S(15)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(11)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*(d*x)**(S(9)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(3)*d**S(3)*(d*x)**(S(5)/2)/(S(16)*b**S(2)*(a + b*x**S(2))**S(2)) - S(15)*d**S(5)*sqrt(d*x)/(S(64)*b**S(3)*(a + b*x**S(2))) - S(15)*sqrt(S(2))*d**(S(11)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(3)/4)*b**(S(13)/4)) + S(15)*sqrt(S(2))*d**(S(11)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(3)/4)*b**(S(13)/4)) - S(15)*sqrt(S(2))*d**(S(11)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(3)/4)*b**(S(13)/4)) + S(15)*sqrt(S(2))*d**(S(11)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(3)/4)*b**(S(13)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(9)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*(d*x)**(S(7)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(7)*d**S(3)*(d*x)**(S(3)/2)/(S(48)*b**S(2)*(a + b*x**S(2))**S(2)) + S(7)*d**S(3)*(d*x)**(S(3)/2)/(S(64)*a*b**S(2)*(a + b*x**S(2))) + S(7)*sqrt(S(2))*d**(S(9)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(5)/4)*b**(S(11)/4)) - S(7)*sqrt(S(2))*d**(S(9)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(5)/4)*b**(S(11)/4)) - S(7)*sqrt(S(2))*d**(S(9)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(5)/4)*b**(S(11)/4)) + S(7)*sqrt(S(2))*d**(S(9)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(5)/4)*b**(S(11)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*(d*x)**(S(5)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) - S(5)*d**S(3)*sqrt(d*x)/(S(48)*b**S(2)*(a + b*x**S(2))**S(2)) + S(5)*d**S(3)*sqrt(d*x)/(S(192)*a*b**S(2)*(a + b*x**S(2))) - S(5)*sqrt(S(2))*d**(S(7)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(7)/4)*b**(S(9)/4)) + S(5)*sqrt(S(2))*d**(S(7)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(7)/4)*b**(S(9)/4)) - S(5)*sqrt(S(2))*d**(S(7)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(7)/4)*b**(S(9)/4)) + S(5)*sqrt(S(2))*d**(S(7)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(7)/4)*b**(S(9)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*(d*x)**(S(3)/2)/(S(6)*b*(a + b*x**S(2))**S(3)) + d*(d*x)**(S(3)/2)/(S(16)*a*b*(a + b*x**S(2))**S(2)) + S(5)*d*(d*x)**(S(3)/2)/(S(64)*a**S(2)*b*(a + b*x**S(2))) + S(5)*sqrt(S(2))*d**(S(5)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(9)/4)*b**(S(7)/4)) - S(5)*sqrt(S(2))*d**(S(5)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(9)/4)*b**(S(7)/4)) - S(5)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(9)/4)*b**(S(7)/4)) + S(5)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(9)/4)*b**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, -d*sqrt(d*x)/(S(6)*b*(a + b*x**S(2))**S(3)) + d*sqrt(d*x)/(S(48)*a*b*(a + b*x**S(2))**S(2)) + S(7)*d*sqrt(d*x)/(S(192)*a**S(2)*b*(a + b*x**S(2))) - S(7)*sqrt(S(2))*d**(S(3)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(11)/4)*b**(S(5)/4)) + S(7)*sqrt(S(2))*d**(S(3)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(11)/4)*b**(S(5)/4)) - S(7)*sqrt(S(2))*d**(S(3)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(11)/4)*b**(S(5)/4)) + S(7)*sqrt(S(2))*d**(S(3)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(11)/4)*b**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2), x), x, (d*x)**(S(3)/2)/(S(6)*a*d*(a + b*x**S(2))**S(3)) + S(3)*(d*x)**(S(3)/2)/(S(16)*a**S(2)*d*(a + b*x**S(2))**S(2)) + S(15)*(d*x)**(S(3)/2)/(S(64)*a**S(3)*d*(a + b*x**S(2))) + S(15)*sqrt(S(2))*sqrt(d)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(13)/4)*b**(S(3)/4)) - S(15)*sqrt(S(2))*sqrt(d)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(13)/4)*b**(S(3)/4)) - S(15)*sqrt(S(2))*sqrt(d)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(13)/4)*b**(S(3)/4)) + S(15)*sqrt(S(2))*sqrt(d)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(13)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, sqrt(d*x)/(S(6)*a*d*(a + b*x**S(2))**S(3)) + S(11)*sqrt(d*x)/(S(48)*a**S(2)*d*(a + b*x**S(2))**S(2)) + S(77)*sqrt(d*x)/(S(192)*a**S(3)*d*(a + b*x**S(2))) - S(77)*sqrt(S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(15)/4)*b**(S(1)/4)*sqrt(d)) + S(77)*sqrt(S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(15)/4)*b**(S(1)/4)*sqrt(d)) - S(77)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(15)/4)*b**(S(1)/4)*sqrt(d)) + S(77)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(15)/4)*b**(S(1)/4)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*d*sqrt(d*x)*(a + b*x**S(2))**S(3)) + S(13)/(S(48)*a**S(2)*d*sqrt(d*x)*(a + b*x**S(2))**S(2)) + S(39)/(S(64)*a**S(3)*d*sqrt(d*x)*(a + b*x**S(2))) - S(195)/(S(64)*a**S(4)*d*sqrt(d*x)) - S(195)*sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(17)/4)*d**(S(3)/2)) + S(195)*sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(17)/4)*d**(S(3)/2)) + S(195)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(17)/4)*d**(S(3)/2)) - S(195)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(17)/4)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(3)) + S(5)/(S(16)*a**S(2)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(2)) + S(55)/(S(64)*a**S(3)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) - S(385)/(S(192)*a**S(4)*d*(d*x)**(S(3)/2)) + S(385)*sqrt(S(2))*b**(S(3)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(19)/4)*d**(S(5)/2)) - S(385)*sqrt(S(2))*b**(S(3)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(19)/4)*d**(S(5)/2)) + S(385)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(19)/4)*d**(S(5)/2)) - S(385)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(19)/4)*d**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(2)), x), x, S(1)/(S(6)*a*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(3)) + S(17)/(S(48)*a**S(2)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(2)) + S(221)/(S(192)*a**S(3)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(663)/(S(320)*a**S(4)*d*(d*x)**(S(5)/2)) + S(663)*b/(S(64)*a**S(5)*d**S(3)*sqrt(d*x)) + S(663)*sqrt(S(2))*b**(S(5)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(21)/4)*d**(S(7)/2)) - S(663)*sqrt(S(2))*b**(S(5)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(512)*a**(S(21)/4)*d**(S(7)/2)) - S(663)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(21)/4)*d**(S(7)/2)) + S(663)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(256)*a**(S(21)/4)*d**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(27)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -S(69615)*sqrt(S(2))*a**(S(5)/4)*d**(S(27)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(29)/4)) + S(69615)*sqrt(S(2))*a**(S(5)/4)*d**(S(27)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(29)/4)) - S(69615)*sqrt(S(2))*a**(S(5)/4)*d**(S(27)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(29)/4)) + S(69615)*sqrt(S(2))*a**(S(5)/4)*d**(S(27)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(29)/4)) - S(69615)*a*d**S(13)*sqrt(d*x)/(S(4096)*b**S(7)) - d*(d*x)**(S(25)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(5)*d**S(3)*(d*x)**(S(21)/2)/(S(32)*b**S(2)*(a + b*x**S(2))**S(4)) - S(35)*d**S(5)*(d*x)**(S(17)/2)/(S(128)*b**S(3)*(a + b*x**S(2))**S(3)) - S(595)*d**S(7)*(d*x)**(S(13)/2)/(S(1024)*b**S(4)*(a + b*x**S(2))**S(2)) - S(7735)*d**S(9)*(d*x)**(S(9)/2)/(S(4096)*b**S(5)*(a + b*x**S(2))) + S(13923)*d**S(11)*(d*x)**(S(5)/2)/(S(4096)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(25)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -S(33649)*sqrt(S(2))*a**(S(3)/4)*d**(S(25)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(27)/4)) + S(33649)*sqrt(S(2))*a**(S(3)/4)*d**(S(25)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(27)/4)) + S(33649)*sqrt(S(2))*a**(S(3)/4)*d**(S(25)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(27)/4)) - S(33649)*sqrt(S(2))*a**(S(3)/4)*d**(S(25)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(27)/4)) - d*(d*x)**(S(23)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(23)*d**S(3)*(d*x)**(S(19)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(437)*d**S(5)*(d*x)**(S(15)/2)/(S(1920)*b**S(3)*(a + b*x**S(2))**S(3)) - S(437)*d**S(7)*(d*x)**(S(11)/2)/(S(1024)*b**S(4)*(a + b*x**S(2))**S(2)) - S(4807)*d**S(9)*(d*x)**(S(7)/2)/(S(4096)*b**S(5)*(a + b*x**S(2))) + S(33649)*d**S(11)*(d*x)**(S(3)/2)/(S(12288)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(23)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, S(13923)*sqrt(S(2))*a**(S(1)/4)*d**(S(23)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(25)/4)) - S(13923)*sqrt(S(2))*a**(S(1)/4)*d**(S(23)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*b**(S(25)/4)) + S(13923)*sqrt(S(2))*a**(S(1)/4)*d**(S(23)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(25)/4)) - S(13923)*sqrt(S(2))*a**(S(1)/4)*d**(S(23)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*b**(S(25)/4)) - d*(d*x)**(S(21)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(21)*d**S(3)*(d*x)**(S(17)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(119)*d**S(5)*(d*x)**(S(13)/2)/(S(640)*b**S(3)*(a + b*x**S(2))**S(3)) - S(1547)*d**S(7)*(d*x)**(S(9)/2)/(S(5120)*b**S(4)*(a + b*x**S(2))**S(2)) - S(13923)*d**S(9)*(d*x)**(S(5)/2)/(S(20480)*b**S(5)*(a + b*x**S(2))) + S(13923)*d**S(11)*sqrt(d*x)/(S(4096)*b**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(21)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(19)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(19)*d**S(3)*(d*x)**(S(15)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(19)*d**S(5)*(d*x)**(S(11)/2)/(S(128)*b**S(3)*(a + b*x**S(2))**S(3)) - S(209)*d**S(7)*(d*x)**(S(7)/2)/(S(1024)*b**S(4)*(a + b*x**S(2))**S(2)) - S(1463)*d**S(9)*(d*x)**(S(3)/2)/(S(4096)*b**S(5)*(a + b*x**S(2))) + S(4389)*sqrt(S(2))*d**(S(21)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(1)/4)*b**(S(23)/4)) - S(4389)*sqrt(S(2))*d**(S(21)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(1)/4)*b**(S(23)/4)) - S(4389)*sqrt(S(2))*d**(S(21)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(1)/4)*b**(S(23)/4)) + S(4389)*sqrt(S(2))*d**(S(21)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(1)/4)*b**(S(23)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(19)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(17)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(17)*d**S(3)*(d*x)**(S(13)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(221)*d**S(5)*(d*x)**(S(9)/2)/(S(1920)*b**S(3)*(a + b*x**S(2))**S(3)) - S(663)*d**S(7)*(d*x)**(S(5)/2)/(S(5120)*b**S(4)*(a + b*x**S(2))**S(2)) - S(663)*d**S(9)*sqrt(d*x)/(S(4096)*b**S(5)*(a + b*x**S(2))) - S(663)*sqrt(S(2))*d**(S(19)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(3)/4)*b**(S(21)/4)) + S(663)*sqrt(S(2))*d**(S(19)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(3)/4)*b**(S(21)/4)) - S(663)*sqrt(S(2))*d**(S(19)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(3)/4)*b**(S(21)/4)) + S(663)*sqrt(S(2))*d**(S(19)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(3)/4)*b**(S(21)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(17)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(15)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(3)*d**S(3)*(d*x)**(S(11)/2)/(S(32)*b**S(2)*(a + b*x**S(2))**S(4)) - S(11)*d**S(5)*(d*x)**(S(7)/2)/(S(128)*b**S(3)*(a + b*x**S(2))**S(3)) - S(77)*d**S(7)*(d*x)**(S(3)/2)/(S(1024)*b**S(4)*(a + b*x**S(2))**S(2)) + S(231)*d**S(7)*(d*x)**(S(3)/2)/(S(4096)*a*b**S(4)*(a + b*x**S(2))) + S(231)*sqrt(S(2))*d**(S(17)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(5)/4)*b**(S(19)/4)) - S(231)*sqrt(S(2))*d**(S(17)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(5)/4)*b**(S(19)/4)) - S(231)*sqrt(S(2))*d**(S(17)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(5)/4)*b**(S(19)/4)) + S(231)*sqrt(S(2))*d**(S(17)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(5)/4)*b**(S(19)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(15)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(13)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(13)*d**S(3)*(d*x)**(S(9)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(39)*d**S(5)*(d*x)**(S(5)/2)/(S(640)*b**S(3)*(a + b*x**S(2))**S(3)) - S(39)*d**S(7)*sqrt(d*x)/(S(1024)*b**S(4)*(a + b*x**S(2))**S(2)) + S(39)*d**S(7)*sqrt(d*x)/(S(4096)*a*b**S(4)*(a + b*x**S(2))) - S(117)*sqrt(S(2))*d**(S(15)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(7)/4)*b**(S(17)/4)) + S(117)*sqrt(S(2))*d**(S(15)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(7)/4)*b**(S(17)/4)) - S(117)*sqrt(S(2))*d**(S(15)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(7)/4)*b**(S(17)/4)) + S(117)*sqrt(S(2))*d**(S(15)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(7)/4)*b**(S(17)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(13)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(11)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(11)*d**S(3)*(d*x)**(S(7)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(77)*d**S(5)*(d*x)**(S(3)/2)/(S(1920)*b**S(3)*(a + b*x**S(2))**S(3)) + S(77)*d**S(5)*(d*x)**(S(3)/2)/(S(5120)*a*b**S(3)*(a + b*x**S(2))**S(2)) + S(77)*d**S(5)*(d*x)**(S(3)/2)/(S(4096)*a**S(2)*b**S(3)*(a + b*x**S(2))) + S(77)*sqrt(S(2))*d**(S(13)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(9)/4)*b**(S(15)/4)) - S(77)*sqrt(S(2))*d**(S(13)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(9)/4)*b**(S(15)/4)) - S(77)*sqrt(S(2))*d**(S(13)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(9)/4)*b**(S(15)/4)) + S(77)*sqrt(S(2))*d**(S(13)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(9)/4)*b**(S(15)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(11)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(9)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(9)*d**S(3)*(d*x)**(S(5)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) - S(3)*d**S(5)*sqrt(d*x)/(S(128)*b**S(3)*(a + b*x**S(2))**S(3)) + S(3)*d**S(5)*sqrt(d*x)/(S(1024)*a*b**S(3)*(a + b*x**S(2))**S(2)) + S(21)*d**S(5)*sqrt(d*x)/(S(4096)*a**S(2)*b**S(3)*(a + b*x**S(2))) - S(63)*sqrt(S(2))*d**(S(11)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(11)/4)*b**(S(13)/4)) + S(63)*sqrt(S(2))*d**(S(11)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(11)/4)*b**(S(13)/4)) - S(63)*sqrt(S(2))*d**(S(11)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(11)/4)*b**(S(13)/4)) + S(63)*sqrt(S(2))*d**(S(11)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(11)/4)*b**(S(13)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(9)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(7)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - S(7)*d**S(3)*(d*x)**(S(3)/2)/(S(160)*b**S(2)*(a + b*x**S(2))**S(4)) + S(7)*d**S(3)*(d*x)**(S(3)/2)/(S(640)*a*b**S(2)*(a + b*x**S(2))**S(3)) + S(63)*d**S(3)*(d*x)**(S(3)/2)/(S(5120)*a**S(2)*b**S(2)*(a + b*x**S(2))**S(2)) + S(63)*d**S(3)*(d*x)**(S(3)/2)/(S(4096)*a**S(3)*b**S(2)*(a + b*x**S(2))) + S(63)*sqrt(S(2))*d**(S(9)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(13)/4)*b**(S(11)/4)) - S(63)*sqrt(S(2))*d**(S(9)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(13)/4)*b**(S(11)/4)) - S(63)*sqrt(S(2))*d**(S(9)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(13)/4)*b**(S(11)/4)) + S(63)*sqrt(S(2))*d**(S(9)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(13)/4)*b**(S(11)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(5)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) - d**S(3)*sqrt(d*x)/(S(32)*b**S(2)*(a + b*x**S(2))**S(4)) + d**S(3)*sqrt(d*x)/(S(384)*a*b**S(2)*(a + b*x**S(2))**S(3)) + S(11)*d**S(3)*sqrt(d*x)/(S(3072)*a**S(2)*b**S(2)*(a + b*x**S(2))**S(2)) + S(77)*d**S(3)*sqrt(d*x)/(S(12288)*a**S(3)*b**S(2)*(a + b*x**S(2))) - S(77)*sqrt(S(2))*d**(S(7)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(15)/4)*b**(S(9)/4)) + S(77)*sqrt(S(2))*d**(S(7)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(15)/4)*b**(S(9)/4)) - S(77)*sqrt(S(2))*d**(S(7)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(15)/4)*b**(S(9)/4)) + S(77)*sqrt(S(2))*d**(S(7)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(15)/4)*b**(S(9)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*(d*x)**(S(3)/2)/(S(10)*b*(a + b*x**S(2))**S(5)) + S(3)*d*(d*x)**(S(3)/2)/(S(160)*a*b*(a + b*x**S(2))**S(4)) + S(13)*d*(d*x)**(S(3)/2)/(S(640)*a**S(2)*b*(a + b*x**S(2))**S(3)) + S(117)*d*(d*x)**(S(3)/2)/(S(5120)*a**S(3)*b*(a + b*x**S(2))**S(2)) + S(117)*d*(d*x)**(S(3)/2)/(S(4096)*a**S(4)*b*(a + b*x**S(2))) + S(117)*sqrt(S(2))*d**(S(5)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(17)/4)*b**(S(7)/4)) - S(117)*sqrt(S(2))*d**(S(5)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(17)/4)*b**(S(7)/4)) - S(117)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(17)/4)*b**(S(7)/4)) + S(117)*sqrt(S(2))*d**(S(5)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(17)/4)*b**(S(7)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, -d*sqrt(d*x)/(S(10)*b*(a + b*x**S(2))**S(5)) + d*sqrt(d*x)/(S(160)*a*b*(a + b*x**S(2))**S(4)) + d*sqrt(d*x)/(S(128)*a**S(2)*b*(a + b*x**S(2))**S(3)) + S(11)*d*sqrt(d*x)/(S(1024)*a**S(3)*b*(a + b*x**S(2))**S(2)) + S(77)*d*sqrt(d*x)/(S(4096)*a**S(4)*b*(a + b*x**S(2))) - S(231)*sqrt(S(2))*d**(S(3)/2)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(19)/4)*b**(S(5)/4)) + S(231)*sqrt(S(2))*d**(S(3)/2)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(19)/4)*b**(S(5)/4)) - S(231)*sqrt(S(2))*d**(S(3)/2)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(19)/4)*b**(S(5)/4)) + S(231)*sqrt(S(2))*d**(S(3)/2)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(19)/4)*b**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3), x), x, (d*x)**(S(3)/2)/(S(10)*a*d*(a + b*x**S(2))**S(5)) + S(17)*(d*x)**(S(3)/2)/(S(160)*a**S(2)*d*(a + b*x**S(2))**S(4)) + S(221)*(d*x)**(S(3)/2)/(S(1920)*a**S(3)*d*(a + b*x**S(2))**S(3)) + S(663)*(d*x)**(S(3)/2)/(S(5120)*a**S(4)*d*(a + b*x**S(2))**S(2)) + S(663)*(d*x)**(S(3)/2)/(S(4096)*a**S(5)*d*(a + b*x**S(2))) + S(663)*sqrt(S(2))*sqrt(d)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(21)/4)*b**(S(3)/4)) - S(663)*sqrt(S(2))*sqrt(d)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(21)/4)*b**(S(3)/4)) - S(663)*sqrt(S(2))*sqrt(d)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(21)/4)*b**(S(3)/4)) + S(663)*sqrt(S(2))*sqrt(d)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(21)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, sqrt(d*x)/(S(10)*a*d*(a + b*x**S(2))**S(5)) + S(19)*sqrt(d*x)/(S(160)*a**S(2)*d*(a + b*x**S(2))**S(4)) + S(19)*sqrt(d*x)/(S(128)*a**S(3)*d*(a + b*x**S(2))**S(3)) + S(209)*sqrt(d*x)/(S(1024)*a**S(4)*d*(a + b*x**S(2))**S(2)) + S(1463)*sqrt(d*x)/(S(4096)*a**S(5)*d*(a + b*x**S(2))) - S(4389)*sqrt(S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(23)/4)*b**(S(1)/4)*sqrt(d)) + S(4389)*sqrt(S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(23)/4)*b**(S(1)/4)*sqrt(d)) - S(4389)*sqrt(S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(23)/4)*b**(S(1)/4)*sqrt(d)) + S(4389)*sqrt(S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(23)/4)*b**(S(1)/4)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*d*sqrt(d*x)*(a + b*x**S(2))**S(5)) + S(21)/(S(160)*a**S(2)*d*sqrt(d*x)*(a + b*x**S(2))**S(4)) + S(119)/(S(640)*a**S(3)*d*sqrt(d*x)*(a + b*x**S(2))**S(3)) + S(1547)/(S(5120)*a**S(4)*d*sqrt(d*x)*(a + b*x**S(2))**S(2)) + S(13923)/(S(20480)*a**S(5)*d*sqrt(d*x)*(a + b*x**S(2))) - S(13923)/(S(4096)*a**S(6)*d*sqrt(d*x)) - S(13923)*sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(25)/4)*d**(S(3)/2)) + S(13923)*sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(25)/4)*d**(S(3)/2)) + S(13923)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(25)/4)*d**(S(3)/2)) - S(13923)*sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(25)/4)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(5)) + S(23)/(S(160)*a**S(2)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(4)) + S(437)/(S(1920)*a**S(3)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(3)) + S(437)/(S(1024)*a**S(4)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))**S(2)) + S(4807)/(S(4096)*a**S(5)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) - S(33649)/(S(12288)*a**S(6)*d*(d*x)**(S(3)/2)) + S(33649)*sqrt(S(2))*b**(S(3)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(27)/4)*d**(S(5)/2)) - S(33649)*sqrt(S(2))*b**(S(3)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(27)/4)*d**(S(5)/2)) + S(33649)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(27)/4)*d**(S(5)/2)) - S(33649)*sqrt(S(2))*b**(S(3)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(27)/4)*d**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**S(3)), x), x, S(1)/(S(10)*a*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(5)) + S(5)/(S(32)*a**S(2)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(4)) + S(35)/(S(128)*a**S(3)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(3)) + S(595)/(S(1024)*a**S(4)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))**S(2)) + S(7735)/(S(4096)*a**S(5)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(13923)/(S(4096)*a**S(6)*d*(d*x)**(S(5)/2)) + S(69615)*b/(S(4096)*a**S(7)*d**S(3)*sqrt(d*x)) + S(69615)*sqrt(S(2))*b**(S(5)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(29)/4)*d**(S(7)/2)) - S(69615)*sqrt(S(2))*b**(S(5)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(32768)*a**(S(29)/4)*d**(S(7)/2)) - S(69615)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(29)/4)*d**(S(7)/2)) + S(69615)*sqrt(S(2))*b**(S(5)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(16384)*a**(S(29)/4)*d**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(8)*a*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(77)*d*(a + b*x**S(2))) + S(2)*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(11)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(8)*a*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(45)*d*(a + b*x**S(2))) + S(2)*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(9)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, S(8)*a*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(21)*d*(a + b*x**S(2))) + S(2)*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/sqrt(d*x), x), x, S(8)*a*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*d*(a + b*x**S(2))) + S(2)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(3)/2), x), x, -S(8)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*d*sqrt(d*x)*(a + b*x**S(2))) + S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*d*sqrt(d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(5)/2), x), x, -S(8)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) + S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*(d*x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*x)**(S(7)/2), x), x, S(8)*a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(d*(d*x)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(256)*a**S(3)*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7315)*d*(a + b*x**S(2))) + S(64)*a**S(2)*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1045)*d) + S(8)*a*(d*x)**(S(7)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(95)*d) + S(2)*(d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(19)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(256)*a**S(3)*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3315)*d*(a + b*x**S(2))) + S(64)*a**S(2)*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(663)*d) + S(24)*a*(d*x)**(S(5)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(221)*d) + S(2)*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(17)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(256)*a**S(3)*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1155)*d*(a + b*x**S(2))) + S(64)*a**S(2)*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(385)*d) + S(8)*a*(d*x)**(S(3)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(55)*d) + S(2)*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(15)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/sqrt(d*x), x), x, S(256)*a**S(3)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(195)*d*(a + b*x**S(2))) + S(64)*a**S(2)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(195)*d) + S(8)*a*sqrt(d*x)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(39)*d) + S(2)*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(13)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(d*x)**(S(3)/2), x), x, -S(256)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(77)*d*sqrt(d*x)*(a + b*x**S(2))) + S(64)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(77)*d*sqrt(d*x)) + S(24)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(77)*d*sqrt(d*x)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(11)*d*sqrt(d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(d*x)**(S(5)/2), x), x, -S(256)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(45)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) + S(64)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*d*(d*x)**(S(3)/2)) + S(8)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*d*(d*x)**(S(3)/2)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(9)*d*(d*x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(d*x)**(S(7)/2), x), x, S(256)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(35)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(64)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7)*d*(d*x)**(S(5)/2)) + S(8)*a*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7)*d*(d*x)**(S(5)/2)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(7)*d*(d*x)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(16384)*a**S(5)*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(908523)*d*(a + b*x**S(2))) + S(4096)*a**S(4)*(d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(129789)*d) + S(512)*a**S(3)*(d*x)**(S(7)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(11799)*d) + S(640)*a**S(2)*(d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(11799)*d) + S(40)*a*(d*x)**(S(7)/2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(621)*d) + S(2)*(d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(27)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(16384)*a**S(5)*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(348075)*d*(a + b*x**S(2))) + S(4096)*a**S(4)*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(69615)*d) + S(512)*a**S(3)*(d*x)**(S(5)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(7735)*d) + S(128)*a**S(2)*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(1785)*d) + S(8)*a*(d*x)**(S(5)/2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(105)*d) + S(2)*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(25)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(16384)*a**S(5)*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(100947)*d*(a + b*x**S(2))) + S(4096)*a**S(4)*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(33649)*d) + S(512)*a**S(3)*(d*x)**(S(3)/2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4807)*d) + S(128)*a**S(2)*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(1311)*d) + S(40)*a*(d*x)**(S(3)/2)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(437)*d) + S(2)*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(23)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/sqrt(d*x), x), x, S(16384)*a**S(5)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(13923)*d*(a + b*x**S(2))) + S(4096)*a**S(4)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(13923)*d) + S(2560)*a**S(3)*sqrt(d*x)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(13923)*d) + S(640)*a**S(2)*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(4641)*d) + S(40)*a*sqrt(d*x)*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(357)*d) + S(2)*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(21)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(d*x)**(S(3)/2), x), x, -S(16384)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4389)*d*sqrt(d*x)*(a + b*x**S(2))) + S(4096)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4389)*d*sqrt(d*x)) + S(512)*a**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1463)*d*sqrt(d*x)) + S(128)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(627)*d*sqrt(d*x)) + S(8)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(57)*d*sqrt(d*x)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(19)*d*sqrt(d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(d*x)**(S(5)/2), x), x, -S(16384)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1989)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))) + S(4096)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(663)*d*(d*x)**(S(3)/2)) + S(512)*a**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(663)*d*(d*x)**(S(3)/2)) + S(640)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(1989)*d*(d*x)**(S(3)/2)) + S(40)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(221)*d*(d*x)**(S(3)/2)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(17)*d*(d*x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(d*x)**(S(7)/2), x), x, S(16384)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(1155)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))) - S(4096)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(231)*d*(d*x)**(S(5)/2)) + S(512)*a**S(3)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(231)*d*(d*x)**(S(5)/2)) + S(128)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(231)*d*(d*x)**(S(5)/2)) + S(8)*a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)/(S(33)*d*(d*x)**(S(5)/2)) + S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)/(S(15)*d*(d*x)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -sqrt(S(2))*a**(S(5)/4)*d**(S(7)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*a**(S(5)/4)*d**(S(7)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*a**(S(5)/4)*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*a**(S(5)/4)*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(2)*a*d**S(3)*sqrt(d*x)*(a + b*x**S(2))/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(2)*d*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(5)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -sqrt(S(2))*a**(S(3)/4)*d**(S(5)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*a**(S(3)/4)*d**(S(5)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*a**(S(3)/4)*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*a**(S(3)/4)*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(2)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, sqrt(S(2))*a**(S(1)/4)*d**(S(3)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*a**(S(1)/4)*d**(S(3)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*a**(S(1)/4)*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*a**(S(1)/4)*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(2)*d*sqrt(d*x)*(a + b*x**S(2))/(b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(1)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(1)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(1)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(1)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -sqrt(S(2))*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(3)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(3)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(3)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(3)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, (-S(2)*a - S(2)*b*x**S(2))/(a*d*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(5)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(5)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(5)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(5)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, (-S(2)*a - S(2)*b*x**S(2))/(S(3)*a*d*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(7)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(7)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(7)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(7)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, (-S(2)*a - S(2)*b*x**S(2))/(S(5)*a*d*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(2)*b*(a + b*x**S(2))/(a**S(2)*d**S(3)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(9)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(4)*a**(S(9)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(9)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(2)*a**(S(9)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(15)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -S(117)*sqrt(S(2))*a**(S(5)/4)*d**(S(15)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*sqrt(S(2))*a**(S(5)/4)*d**(S(15)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(117)*sqrt(S(2))*a**(S(5)/4)*d**(S(15)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*sqrt(S(2))*a**(S(5)/4)*d**(S(15)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(9)/2)*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(117)*a*d**S(7)*sqrt(d*x)*(a + b*x**S(2))/(S(16)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(17)*d**S(3)*(d*x)**(S(9)/2)/(S(16)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*d**S(5)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(80)*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(13)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -S(77)*sqrt(S(2))*a**(S(3)/4)*d**(S(13)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*a**(S(3)/4)*d**(S(13)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*a**(S(3)/4)*d**(S(13)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*a**(S(3)/4)*d**(S(13)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(7)/2)*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(15)*d**S(3)*(d*x)**(S(7)/2)/(S(16)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*d**S(5)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(48)*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(11)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, S(45)*sqrt(S(2))*a**(S(1)/4)*d**(S(11)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*a**(S(1)/4)*d**(S(11)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*a**(S(1)/4)*d**(S(11)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*a**(S(1)/4)*d**(S(11)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(13)*d**S(3)*(d*x)**(S(5)/2)/(S(16)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*d**S(5)*sqrt(d*x)*(a + b*x**S(2))/(S(16)*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(9)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a*d**S(3)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(11)*d**S(3)*(d*x)**(S(3)/2)/(S(16)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(21)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(1)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(21)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(1)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(21)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(1)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(21)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(1)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, a*d**S(3)*sqrt(d*x)*(a + b*x**S(2))/(S(4)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(9)*d**S(3)*sqrt(d*x)/(S(16)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(3)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(5)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(3)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(3)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(5)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(3)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (d*x)**(S(7)/2)*(a + b*x**S(2))/(S(4)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - d*(d*x)**(S(3)/2)/(S(16)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(5)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(5)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(5)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(5)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (d*x)**(S(5)/2)*(a + b*x**S(2))/(S(4)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(3)*d*sqrt(d*x)/(S(16)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(7)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(7)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(7)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(7)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (d*x)**(S(3)/2)*(a + b*x**S(2))/(S(4)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)*(d*x)**(S(3)/2)/(S(16)*a**S(2)*d*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(5)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(9)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(9)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(5)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(9)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(5)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(9)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, sqrt(d*x)*(a + b*x**S(2))/(S(4)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(7)*sqrt(d*x)/(S(16)*a**S(2)*d*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*(S(21)*a + S(21)*b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(11)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(S(21)*a + S(21)*b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(11)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*(S(21)*a + S(21)*b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(11)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(S(21)*a + S(21)*b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(11)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*d*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(9)/(S(16)*a**S(2)*d*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(45)*a + S(45)*b*x**S(2))/(S(16)*a**S(3)*d*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(13)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(13)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(13)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(13)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*d*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(11)/(S(16)*a**S(2)*d*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(77)*a + S(77)*b*x**S(2))/(S(48)*a**S(3)*d*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(15)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(15)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(15)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(15)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (a + b*x**S(2))/(S(4)*a*d*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(13)/(S(16)*a**S(2)*d*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(117)*a + S(117)*b*x**S(2))/(S(80)*a**S(3)*d*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*b*(a + b*x**S(2))/(S(16)*a**S(4)*d**S(3)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(17)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(117)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(128)*a**(S(17)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(117)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(17)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(117)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(64)*a**(S(17)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(23)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, -S(13923)*sqrt(S(2))*a**(S(5)/4)*d**(S(23)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(25)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*sqrt(S(2))*a**(S(5)/4)*d**(S(23)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(25)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(13923)*sqrt(S(2))*a**(S(5)/4)*d**(S(23)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(25)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*sqrt(S(2))*a**(S(5)/4)*d**(S(23)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(25)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(17)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(119)*a*d**S(7)*(d*x)**(S(9)/2)*(a + b*x**S(2))/(S(256)*b**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(13923)*a*d**S(11)*sqrt(d*x)*(a + b*x**S(2))/(S(1024)*b**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(11)*d**S(3)*(d*x)**(S(17)/2)/(S(32)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(2023)*d**S(7)*(d*x)**(S(9)/2)/(S(1024)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*d**S(9)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(5120)*b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(21)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, -S(7315)*sqrt(S(2))*a**(S(3)/4)*d**(S(21)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(23)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(7315)*sqrt(S(2))*a**(S(3)/4)*d**(S(21)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(23)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(7315)*sqrt(S(2))*a**(S(3)/4)*d**(S(21)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(23)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(7315)*sqrt(S(2))*a**(S(3)/4)*d**(S(21)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(23)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(15)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(95)*a*d**S(7)*(d*x)**(S(7)/2)*(a + b*x**S(2))/(S(256)*b**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(31)*d**S(3)*(d*x)**(S(15)/2)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(1425)*d**S(7)*(d*x)**(S(7)/2)/(S(1024)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(7315)*d**S(9)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(3072)*b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(19)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, S(3315)*sqrt(S(2))*a**(S(1)/4)*d**(S(19)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(21)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3315)*sqrt(S(2))*a**(S(1)/4)*d**(S(19)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*b**(S(21)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3315)*sqrt(S(2))*a**(S(1)/4)*d**(S(19)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(21)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3315)*sqrt(S(2))*a**(S(1)/4)*d**(S(19)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*b**(S(21)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + a*d**S(3)*(d*x)**(S(13)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(221)*a*d**S(7)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(768)*b**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(29)*d**S(3)*(d*x)**(S(13)/2)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(2873)*d**S(7)*(d*x)**(S(5)/2)/(S(3072)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3315)*d**S(9)*sqrt(d*x)*(a + b*x**S(2))/(S(1024)*b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(17)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*(d*x)**(S(11)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(55)*a*d**S(7)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(256)*b**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(9)*d**S(3)*(d*x)**(S(11)/2)/(S(32)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(605)*d**S(7)*(d*x)**(S(3)/2)/(S(1024)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(1155)*sqrt(S(2))*d**(S(17)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(1)/4)*b**(S(19)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(1155)*sqrt(S(2))*d**(S(17)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(1)/4)*b**(S(19)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(1155)*sqrt(S(2))*d**(S(17)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(1)/4)*b**(S(19)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(1155)*sqrt(S(2))*d**(S(17)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(1)/4)*b**(S(19)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(15)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*(d*x)**(S(9)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(39)*a*d**S(7)*sqrt(d*x)*(a + b*x**S(2))/(S(256)*b**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(25)*d**S(3)*(d*x)**(S(9)/2)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(351)*d**S(7)*sqrt(d*x)/(S(1024)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(195)*sqrt(S(2))*d**(S(15)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(3)/4)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(195)*sqrt(S(2))*d**(S(15)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(3)/4)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(195)*sqrt(S(2))*d**(S(15)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(3)/4)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(195)*sqrt(S(2))*d**(S(15)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(3)/4)*b**(S(17)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(13)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*(d*x)**(S(7)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(23)*d**S(3)*(d*x)**(S(7)/2)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(77)*d**S(3)*(d*x)**(S(7)/2)*(a + b*x**S(2))/(S(768)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(77)*d**S(5)*(d*x)**(S(3)/2)/(S(3072)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*d**(S(13)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(5)/4)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*d**(S(13)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(5)/4)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*d**(S(13)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(5)/4)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*d**(S(13)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(5)/4)*b**(S(15)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(11)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(7)*d**S(3)*(d*x)**(S(5)/2)/(S(32)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(15)*d**S(3)*(d*x)**(S(5)/2)*(a + b*x**S(2))/(S(256)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) - S(45)*d**S(5)*sqrt(d*x)/(S(1024)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*d**(S(11)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(7)/4)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*d**(S(11)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(7)/4)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*d**(S(11)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(7)/4)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*d**(S(11)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(7)/4)*b**(S(13)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(9)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(19)*d**S(3)*(d*x)**(S(3)/2)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(7)*d**S(3)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(256)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(35)*d**S(3)*(d*x)**(S(3)/2)/(S(1024)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(9)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(35)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(9)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(35)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(9)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*sqrt(S(2))*d**(S(9)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(9)/4)*b**(S(11)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(7)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, a*d**S(3)*sqrt(d*x)*(a + b*x**S(2))/(S(8)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(17)*d**S(3)*sqrt(d*x)/(S(96)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(5)*d**S(3)*sqrt(d*x)*(a + b*x**S(2))/(S(768)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(35)*d**S(3)*sqrt(d*x)/(S(3072)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(35)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(11)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(11)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(35)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(11)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(35)*sqrt(S(2))*d**(S(7)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(11)/4)*b**(S(9)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(5)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, (d*x)**(S(7)/2)*(a + b*x**S(2))/(S(8)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(3)*d*(d*x)**(S(3)/2)/(S(32)*a*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(9)*d*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(256)*a**S(2)*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(45)*d*(d*x)**(S(3)/2)/(S(1024)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(13)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(13)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(45)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(13)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(45)*sqrt(S(2))*d**(S(5)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(13)/4)*b**(S(7)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, (d*x)**(S(5)/2)*(a + b*x**S(2))/(S(8)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) - S(11)*d*sqrt(d*x)/(S(96)*a*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(11)*d*sqrt(d*x)*(a + b*x**S(2))/(S(768)*a**S(2)*b*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(77)*d*sqrt(d*x)/(S(3072)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(15)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(15)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(77)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(15)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(77)*sqrt(S(2))*d**(S(3)/2)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(15)/4)*b**(S(5)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2), x), x, (d*x)**(S(3)/2)*(a + b*x**S(2))/(S(8)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(13)*(d*x)**(S(3)/2)/(S(96)*a**S(2)*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(39)*(d*x)**(S(3)/2)*(a + b*x**S(2))/(S(256)*a**S(3)*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(195)*(d*x)**(S(3)/2)/(S(1024)*a**S(4)*d*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(195)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(17)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(195)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(17)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(195)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(17)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(195)*sqrt(S(2))*sqrt(d)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(17)/4)*b**(S(3)/4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, sqrt(d*x)*(a + b*x**S(2))/(S(8)*a*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(5)*sqrt(d*x)/(S(32)*a**S(2)*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(55)*sqrt(d*x)*(a + b*x**S(2))/(S(256)*a**S(3)*d*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(385)*sqrt(d*x)/(S(1024)*a**S(4)*d*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*(S(1155)*a + S(1155)*b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(19)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(S(1155)*a + S(1155)*b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(19)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - sqrt(S(2))*(S(1155)*a + S(1155)*b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(19)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + sqrt(S(2))*(S(1155)*a + S(1155)*b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(19)/4)*b**(S(1)/4)*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*d*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(17)/(S(96)*a**S(2)*d*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(221)*a + S(221)*b*x**S(2))/(S(768)*a**S(3)*d*sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(663)/(S(1024)*a**S(4)*d*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(3315)*a + S(3315)*b*x**S(2))/(S(1024)*a**S(5)*d*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3315)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(21)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3315)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(21)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(3315)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(21)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(3315)*sqrt(S(2))*b**(S(1)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(21)/4)*d**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*d*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(19)/(S(96)*a**S(2)*d*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(95)*a + S(95)*b*x**S(2))/(S(256)*a**S(3)*d*(d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(1045)/(S(1024)*a**S(4)*d*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(7315)*a + S(7315)*b*x**S(2))/(S(3072)*a**S(5)*d*(d*x)**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(7315)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(23)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(7315)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(23)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(7315)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(23)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(7315)*sqrt(S(2))*b**(S(3)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(23)/4)*d**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(7)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)), x), x, (a + b*x**S(2))/(S(8)*a*d*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(5)/2)) + S(7)/(S(32)*a**S(2)*d*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + (S(119)*a + S(119)*b*x**S(2))/(S(256)*a**S(3)*d*(d*x)**(S(5)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)) + S(1547)/(S(1024)*a**S(4)*d*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (S(13923)*a + S(13923)*b*x**S(2))/(S(5120)*a**S(5)*d*(d*x)**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*b*(a + b*x**S(2))/(S(1024)*a**S(6)*d**S(3)*sqrt(d*x)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(25)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(13923)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*sqrt(d*x) + sqrt(a)*sqrt(d) + sqrt(b)*sqrt(d)*x)/(S(8192)*a**(S(25)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - S(13923)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(25)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + S(13923)*sqrt(S(2))*b**(S(5)/4)*(a + b*x**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*sqrt(d*x)/(a**(S(1)/4)*sqrt(d)))/(S(4096)*a**(S(25)/4)*d**(S(7)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(4)/3)), x), x, S(3)/(S(10)*a*x*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(1)/3)) + S(39)/(S(40)*a**S(2)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(1)/3)) - (S(91)*a + S(91)*b*x**S(2))/(S(40)*a**S(3)*x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(1)/3)) + S(91)*S(3)**(S(3)/4)*sqrt((a**(S(2)/3)*b**(S(2)/3) + a**(S(1)/3)*b**(S(1)/3)*(a*b + b**S(2)*x**S(2))**(S(1)/3) + (a*b + b**S(2)*x**S(2))**(S(2)/3))/(a**(S(1)/3)*b**(S(1)/3)*(-sqrt(S(3)) + S(1)) - (a*b + b**S(2)*x**S(2))**(S(1)/3))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(a**(S(1)/3)*b**(S(1)/3) - (a*b + b**S(2)*x**S(2))**(S(1)/3))*(a*b + b**S(2)*x**S(2))**(S(2)/3)*elliptic_f(asin((a**(S(1)/3)*b**(S(1)/3)*(S(1) + sqrt(S(3))) - (a*b + b**S(2)*x**S(2))**(S(1)/3))/(a**(S(1)/3)*b**(S(1)/3)*(-sqrt(S(3)) + S(1)) - (a*b + b**S(2)*x**S(2))**(S(1)/3))), S(-7) + S(4)*sqrt(S(3)))/(S(120)*a**S(3)*b*x*sqrt(-a**(S(1)/3)*b**(S(1)/3)*(a**(S(1)/3)*b**(S(1)/3) - (a*b + b**S(2)*x**S(2))**(S(1)/3))/(a**(S(1)/3)*b**(S(1)/3)*(-sqrt(S(3)) + S(1)) - (a*b + b**S(2)*x**S(2))**(S(1)/3))**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, (d*x)**(m + S(1))*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(1), m/S(2) + S(2)*p + S(3)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a*d*(m + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, (d*x)**(m + S(1))*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((m/S(2) + S(1)/2, -S(2)*p), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, -a*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/(S(2)*b**S(2)*(S(2)*p + S(1))) + (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(p + S(1))/(S(4)*b**S(2)*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, (a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/(S(2)*b*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/x, x), x, -(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(1), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**S(2)/a)/(S(2)*a*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/x**S(3), x), x, b*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(2), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**S(2)/a)/(S(2)*a**S(2)*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, x**S(5)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(5)/2, -S(2)*p), (S(7)/2,), -b*x**S(2)/a)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, x**S(3)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(3)/2, -S(2)*p), (S(5)/2,), -b*x**S(2)/a)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, x*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(1)/2, -S(2)*p), (S(3)/2,), -b*x**S(2)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/x**S(2), x), x, -(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(-1)/2, -S(2)*p), (S(1)/2,), -b*x**S(2)/a)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/x**S(4), x), x, -(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(-3)/2, -S(2)*p), (S(-1)/2,), -b*x**S(2)/a)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, S(2)*(d*x)**(S(5)/2)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(5)/4, -S(2)*p), (S(9)/4,), -b*x**S(2)/a)/(S(5)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, S(2)*(d*x)**(S(3)/2)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(3)/4, -S(2)*p), (S(7)/4,), -b*x**S(2)/a)/(S(3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/sqrt(d*x), x), x, S(2)*sqrt(d*x)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(1)/4, -S(2)*p), (S(5)/4,), -b*x**S(2)/a)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/(d*x)**(S(3)/2), x), x, -S(2)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(-1)/4, -S(2)*p), (S(3)/4,), -b*x**S(2)/a)/(d*sqrt(d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p/(d*x)**(S(5)/2), x), x, -S(2)*(S(1) + b*x**S(2)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p*hyper((S(-3)/4, -S(2)*p), (S(1)/4,), -b*x**S(2)/a)/(S(3)*d*(d*x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*x**S(3)/S(3) + b*x**S(5)/S(5) + c*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4)), x), x, a*x**S(2)/S(2) + b*x**S(4)/S(4) + c*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*x**S(2) + c*x**S(4), x), x, a*x + b*x**S(3)/S(3) + c*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x, x), x, a*log(x) + b*x**S(2)/S(2) + c*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(2), x), x, -a/x + b*x + c*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(3), x), x, -a/(S(2)*x**S(2)) + b*log(x) + c*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(4), x), x, -a/(S(3)*x**S(3)) - b/x + c*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(5), x), x, -a/(S(4)*x**S(4)) - b/(S(2)*x**S(2)) + c*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(6), x), x, -a/(S(5)*x**S(5)) - b/(S(3)*x**S(3)) - c/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(7), x), x, -a/(S(6)*x**S(6)) - b/(S(4)*x**S(4)) - c/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**S(8), x), x, -a/(S(7)*x**S(7)) - b/(S(5)*x**S(5)) - c/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*x**S(3)/S(3) + S(2)*a*b*x**S(5)/S(5) + S(2)*b*c*x**S(9)/S(9) + c**S(2)*x**S(11)/S(11) + x**S(7)*(S(2)*a*c/S(7) + b**S(2)/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*x**S(2)/S(2) + a*b*x**S(4)/S(2) + b*c*x**S(8)/S(4) + c**S(2)*x**S(10)/S(10) + x**S(6)*(a*c/S(3) + b**S(2)/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*x + S(2)*a*b*x**S(3)/S(3) + S(2)*b*c*x**S(7)/S(7) + c**S(2)*x**S(9)/S(9) + x**S(5)*(S(2)*a*c/S(5) + b**S(2)/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x, x), x, a**S(2)*log(x) + a*b*x**S(2) + b*c*x**S(6)/S(3) + c**S(2)*x**S(8)/S(8) + x**S(4)*(a*c/S(2) + b**S(2)/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(2), x), x, -a**S(2)/x + S(2)*a*b*x + S(2)*b*c*x**S(5)/S(5) + c**S(2)*x**S(7)/S(7) + x**S(3)*(S(2)*a*c/S(3) + b**S(2)/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(3), x), x, -a**S(2)/(S(2)*x**S(2)) + S(2)*a*b*log(x) + b*c*x**S(4)/S(2) + c**S(2)*x**S(6)/S(6) + x**S(2)*(a*c + b**S(2)/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(4), x), x, -a**S(2)/(S(3)*x**S(3)) - S(2)*a*b/x + S(2)*b*c*x**S(3)/S(3) + c**S(2)*x**S(5)/S(5) + x*(S(2)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(5), x), x, -a**S(2)/(S(4)*x**S(4)) - a*b/x**S(2) + b*c*x**S(2) + c**S(2)*x**S(4)/S(4) + (S(2)*a*c + b**S(2))*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(6), x), x, -a**S(2)/(S(5)*x**S(5)) - S(2)*a*b/(S(3)*x**S(3)) + S(2)*b*c*x + c**S(2)*x**S(3)/S(3) - (S(2)*a*c + b**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(7), x), x, -a**S(2)/(S(6)*x**S(6)) - a*b/(S(2)*x**S(4)) + S(2)*b*c*log(x) + c**S(2)*x**S(2)/S(2) - (S(2)*a*c + b**S(2))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(8), x), x, -a**S(2)/(S(7)*x**S(7)) - S(2)*a*b/(S(5)*x**S(5)) - S(2)*b*c/x + c**S(2)*x - (S(2)*a*c + b**S(2))/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(9), x), x, -a**S(2)/(S(8)*x**S(8)) - a*b/(S(3)*x**S(6)) - b*c/x**S(2) + c**S(2)*log(x) - (S(2)*a*c + b**S(2))/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(10), x), x, -a**S(2)/(S(9)*x**S(9)) - S(2)*a*b/(S(7)*x**S(7)) - S(2)*b*c/(S(3)*x**S(3)) - c**S(2)/x - (S(2)*a*c + b**S(2))/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(11), x), x, -a**S(2)/(S(10)*x**S(10)) - a*b/(S(4)*x**S(8)) - b*c/(S(2)*x**S(4)) - c**S(2)/(S(2)*x**S(2)) - (S(2)*a*c + b**S(2))/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(12), x), x, -a**S(2)/(S(11)*x**S(11)) - S(2)*a*b/(S(9)*x**S(9)) - S(2)*b*c/(S(5)*x**S(5)) - c**S(2)/(S(3)*x**S(3)) - (S(2)*a*c + b**S(2))/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**S(13), x), x, -a**S(2)/(S(12)*x**S(12)) - a*b/(S(5)*x**S(10)) - b*c/(S(3)*x**S(6)) - c**S(2)/(S(4)*x**S(4)) - (S(2)*a*c + b**S(2))/(S(8)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, a**S(3)*x**S(3)/S(3) + S(3)*a**S(2)*b*x**S(5)/S(5) + S(3)*a*x**S(7)*(a*c + b**S(2))/S(7) + S(3)*b*c**S(2)*x**S(13)/S(13) + b*x**S(9)*(S(6)*a*c + b**S(2))/S(9) + c**S(3)*x**S(15)/S(15) + S(3)*c*x**S(11)*(a*c + b**S(2))/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, a**S(3)*x**S(2)/S(2) + S(3)*a**S(2)*b*x**S(4)/S(4) + a*x**S(6)*(a*c + b**S(2))/S(2) + b*c**S(2)*x**S(12)/S(4) + b*x**S(8)*(S(6)*a*c + b**S(2))/S(8) + c**S(3)*x**S(14)/S(14) + S(3)*c*x**S(10)*(a*c + b**S(2))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3), x), x, a**S(3)*x + a**S(2)*b*x**S(3) + S(3)*a*x**S(5)*(a*c + b**S(2))/S(5) + S(3)*b*c**S(2)*x**S(11)/S(11) + b*x**S(7)*(S(6)*a*c + b**S(2))/S(7) + c**S(3)*x**S(13)/S(13) + c*x**S(9)*(a*c + b**S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x, x), x, a**S(3)*log(x) + S(3)*a**S(2)*b*x**S(2)/S(2) + S(3)*a*x**S(4)*(a*c + b**S(2))/S(4) + S(3)*b*c**S(2)*x**S(10)/S(10) + b*x**S(6)*(S(6)*a*c + b**S(2))/S(6) + c**S(3)*x**S(12)/S(12) + S(3)*c*x**S(8)*(a*c + b**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**S(2), x), x, -a**S(3)/x + S(3)*a**S(2)*b*x + a*x**S(3)*(a*c + b**S(2)) + b*c**S(2)*x**S(9)/S(3) + b*x**S(5)*(S(6)*a*c + b**S(2))/S(5) + c**S(3)*x**S(11)/S(11) + S(3)*c*x**S(7)*(a*c + b**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**S(3), x), x, -a**S(3)/(S(2)*x**S(2)) + S(3)*a**S(2)*b*log(x) + S(3)*a*x**S(2)*(a*c + b**S(2))/S(2) + S(3)*b*c**S(2)*x**S(8)/S(8) + b*x**S(4)*(S(6)*a*c + b**S(2))/S(4) + c**S(3)*x**S(10)/S(10) + c*x**S(6)*(a*c + b**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**S(4), x), x, -a**S(3)/(S(3)*x**S(3)) - S(3)*a**S(2)*b/x + S(3)*a*x*(a*c + b**S(2)) + S(3)*b*c**S(2)*x**S(7)/S(7) + b*x**S(3)*(S(6)*a*c + b**S(2))/S(3) + c**S(3)*x**S(9)/S(9) + S(3)*c*x**S(5)*(a*c + b**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(2) + c*x**S(4)), x), x, -b*x**S(2)/(S(2)*c**S(2)) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))) + x**S(4)/(S(4)*c) + (-a*c + b**S(2))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(2) + c*x**S(4)), x), x, -b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + x**S(2)/(S(2)*c) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(2) + c*x**S(4)), x), x, b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x**S(2) + c*x**S(4))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(2) + c*x**S(4)), x), x, -atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(2) + c*x**S(4))), x), x, b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x**S(2) + c*x**S(4))/(S(4)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(2)*a*x**S(2)) - b*log(x)/a**S(2) + b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(4)*a*x**S(4)) + b/(S(2)*a**S(2)*x**S(2)) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*sqrt(-S(4)*a*c + b**S(2))) + (-a*c + b**S(2))*log(x)/a**S(3) - (-a*c + b**S(2))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(2) + c*x**S(4)), x), x, -b*x/c**S(2) + x**S(3)/(S(3)*c) + sqrt(S(2))*(-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(2) + c*x**S(4)), x), x, x/c - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(3)*a*x**S(3)) + b/(a**S(2)*x) + sqrt(S(2))*sqrt(c)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*sqrt(c)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*x**S(2)/(S(2)*c*(-S(4)*a*c + b**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**S(4)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*a*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x**S(2)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + (S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*c*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - (b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(x)/a**S(2) - log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(3)*a*c + b**S(2))/(a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) - S(2)*b*log(x)/a**S(3) + b*log(a + b*x**S(2) + c*x**S(4))/(S(2)*a**S(3)) - (S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*x**S(3)/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**S(5)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + x*(-S(10)*a*c + S(3)*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(-S(13)*a*b*c + S(3)*b**S(3) + (S(20)*a**S(2)*c**S(2) - S(19)*a*b**S(2)*c + S(3)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(-S(13)*a*b*c + S(3)*b**S(3) - (S(20)*a**S(2)*c**S(2) - S(19)*a*b**S(2)*c + S(3)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*x/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**S(3)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(-S(6)*a*c + b**S(2) + b*(-S(8)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(-S(6)*a*c + b**S(2) - b*(-S(8)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, x*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(b - (S(4)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -sqrt(S(2))*sqrt(c)*(S(2)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(2)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - x*(b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(-2)), x), x, -sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) - (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) + (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -b*x**S(2)*(-S(7)*a*c + b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x**S(8)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x**S(4)*(a*(-S(16)*a*c + b**S(2)) + b*x**S(2)*(-S(10)*a*c + b**S(2)))/(S(4)*c*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(6)*a**S(2)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - S(3)*a*x**S(2)*(S(2)*a + b*x**S(2))/(S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + x**S(6)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(3)*a*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + S(3)*b*x**S(2)*(S(2)*a + b*x**S(2))/(S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - x**S(6)*(b + S(2)*c*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**S(2)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (S(3)*a*b + x**S(2)*(S(2)*a*c + b**S(2)))/(S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(3)*b*c*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - S(3)*b*(b + S(2)*c*x**S(2))/(S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + (S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(6)*c**S(2)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + S(3)*c*(b + S(2)*c*x**S(2))/(S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (b + S(2)*c*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (S(16)*a**S(2)*c**S(2) - S(15)*a*b**S(2)*c + S(2)*b**S(4) + S(2)*b*c*x**S(2)*(-S(7)*a*c + b**S(2)))/(S(4)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + log(x)/a**S(3) - log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (S(20)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4) + S(3)*b*c*x**S(2)*(-S(6)*a*c + b**S(2)))/(S(4)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (S(30)*a**S(2)*c**S(2) - S(21)*a*b**S(2)*c + S(3)*b**S(4))/(S(2)*a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*b*log(x)/a**S(4) + S(3)*b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(4)) - (-S(60)*a**S(3)*c**S(3) + S(90)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(3)*b**S(6))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(3)*b*x*(-S(8)*a*c + b**S(2))/(S(8)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) + x**S(7)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x**S(5)*(S(12)*a*b - x**S(2)*(-S(28)*a*c + b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + x**S(3)*(-S(28)*a*c + b**S(2))/(S(8)*c*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(S(84)*a**S(2)*c**S(2) - S(27)*a*b**S(2)*c + S(3)*b**S(4) + S(3)*(S(44)*a**S(2)*b*c**S(2) - S(11)*a*b**S(3)*c + b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(S(84)*a**S(2)*c**S(2) - S(27)*a*b**S(2)*c + S(3)*b**S(4) - S(3)*b*(S(44)*a**S(2)*c**S(2) - S(11)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**S(5)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x**S(3)*(S(12)*a*b + x**S(2)*(S(20)*a*c + b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - x*(S(20)*a*c + b**S(2))/(S(8)*c*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(-S(16)*a*b*c + b**S(3) + (-S(40)*a**S(2)*c**S(2) - S(18)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(-S(16)*a*b*c + b**S(3) - (-S(40)*a**S(2)*c**S(2) - S(18)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**S(3)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(3)*x*(S(4)*a*b + x**S(2)*(S(4)*a*c + b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(S(12)*a*c + S(3)*b**S(2) + S(3)*b*(S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(S(12)*a*c + S(3)*b**S(2) - S(3)*b*(S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(3)*sqrt(S(2))*sqrt(c)*(S(4)*a*c + S(3)*b**S(2) + S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(8)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*sqrt(S(2))*sqrt(c)*(S(4)*a*c + S(3)*b**S(2) - S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(8)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - x*(-S(4)*a*c + S(7)*b**S(2) + S(12)*b*c*x**S(2))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x*(b + S(2)*c*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + sqrt(S(2))*sqrt(c)*(S(20)*a*c + b**S(2) - b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(S(20)*a*c + b**S(2) + b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + x*(b*(S(8)*a*c + b**S(2)) + c*x**S(2)*(S(20)*a*c + b**S(2)))/(S(8)*a*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(-3)), x), x, x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(3)*sqrt(S(2))*sqrt(c)*(-S(8)*a*b*c + b**S(3) - (S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + S(3)*sqrt(S(2))*sqrt(c)*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4) + b*(-S(8)*a*c + b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(3)*b*c*x**S(2)*(-S(8)*a*c + b**S(2)) + (-S(7)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2)))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (S(36)*a**S(2)*c**S(2) - S(35)*a*b**S(2)*c + S(5)*b**S(4) + b*c*x**S(2)*(-S(32)*a*c + S(5)*b**S(2)))/(S(8)*a**S(2)*x*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - S(3)*sqrt(S(2))*sqrt(c)*((-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)) - (S(124)*a**S(2)*b*c**S(2) - S(47)*a*b**S(3)*c + S(5)*b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*sqrt(S(2))*sqrt(c)*(b*(S(124)*a**S(2)*c**S(2) - S(47)*a*b**S(2)*c + S(5)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)) + (-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - (-S(36)*a*c + S(15)*b**S(2))*(-S(5)*a*c + b**S(2))/(S(8)*a**S(3)*x*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a - b*x**S(2) + c*x**S(4)), x), x, b*log(a - b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + x**S(2)/(S(2)*c) + (-S(2)*a*c + b**S(2))*atanh((b - S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a - b*x**S(2) + c*x**S(4)), x), x, b*atanh((b - S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + log(a - b*x**S(2) + c*x**S(4))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a - b*x**S(2) + c*x**S(4)), x), x, atanh((b - S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a - b*x**S(2) + c*x**S(4))), x), x, b*atanh((b - S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a - b*x**S(2) + c*x**S(4))/(S(4)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a - b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(2)*a*x**S(2)) + b*log(x)/a**S(2) - b*log(a - b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) + (-S(2)*a*c + b**S(2))*atanh((b - S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a - b*x**S(2) + c*x**S(4)), x), x, x/c - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a - b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a - b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(c)*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a - b*x**S(2) + c*x**S(4))), x), x, sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, x**S(2)/(S(2)*a) - log(a*x**S(4) + S(2)*a*x**S(2) + a + b)/(S(2)*a) + (a - b)*atan(sqrt(a)*(x**S(2) + S(1))/sqrt(b))/(S(2)*a**(S(3)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, log(a*x**S(4) + S(2)*a*x**S(2) + a + b)/(S(4)*a) - atan(sqrt(a)*(x**S(2) + S(1))/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, atan(sqrt(a)*(x**S(2) + S(1))/sqrt(b))/(S(2)*sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x**S(4) + S(2)*a*x**S(2) + a + b)), x), x, -sqrt(a)*atan(sqrt(a)*(x**S(2) + S(1))/sqrt(b))/(S(2)*sqrt(b)*(a + b)) - log(a*x**S(4) + S(2)*a*x**S(2) + a + b)/(S(4)*a + S(4)*b) + log(x)/(a + b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a*x**S(4) + S(2)*a*x**S(2) + a + b)), x), x, sqrt(a)*(a - b)*atan(sqrt(a)*(x**S(2) + S(1))/sqrt(b))/(S(2)*sqrt(b)*(a + b)**S(2)) - S(2)*a*log(x)/(a + b)**S(2) + a*log(a*x**S(4) + S(2)*a*x**S(2) + a + b)/(S(2)*(a + b)**S(2)) - S(1)/(x**S(2)*(S(2)*a + S(2)*b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, (S(2)*sqrt(-a) + (a - b)/sqrt(b))*atan(x*(-a)**(S(1)/4)/sqrt(-sqrt(b) + sqrt(-a)))/(S(2)*(-a)**(S(5)/4)*sqrt(-sqrt(b) + sqrt(-a))) - (a - S(2)*sqrt(b)*sqrt(-a) - b)*atan(x*(-a)**(S(1)/4)/sqrt(sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(-a)**(S(5)/4)*sqrt(sqrt(b) + sqrt(-a))) + x/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, sqrt(-sqrt(b) + sqrt(-a))*atan(x*(-a)**(S(1)/4)/sqrt(-sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(-a)**(S(3)/4)) - sqrt(sqrt(b) + sqrt(-a))*atan(x*(-a)**(S(1)/4)/sqrt(sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(-a)**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x**S(4) + S(2)*a*x**S(2) + a + b), x), x, atan(x*(-a)**(S(1)/4)/sqrt(sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(-a)**(S(1)/4)*sqrt(sqrt(b) + sqrt(-a))) - atan(x*(-a)**(S(1)/4)/sqrt(-sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(-a)**(S(1)/4)*sqrt(-sqrt(b) + sqrt(-a))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*x**S(4) + S(2)*a*x**S(2) + a + b)), x), x, -S(1)/(x*(a + b)) + (-a)**(S(1)/4)*(-sqrt(b) + sqrt(-a))*atan(x*(-a)**(S(1)/4)/sqrt(sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(a + b)*sqrt(sqrt(b) + sqrt(-a))) - (-a)**(S(1)/4)*(sqrt(b) + sqrt(-a))*atan(x*(-a)**(S(1)/4)/sqrt(-sqrt(b) + sqrt(-a)))/(S(2)*sqrt(b)*(a + b)*sqrt(-sqrt(b) + sqrt(-a))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(2) + S(2)*a*x**S(2) + b + x**S(4)), x), x, -atan(x/sqrt(a + sqrt(-b)))/(S(2)*sqrt(-b)*sqrt(a + sqrt(-b))) + atan(x/sqrt(a - sqrt(-b)))/(S(2)*sqrt(-b)*sqrt(a - sqrt(-b))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(2) + S(2)*a*x**S(2) + x**S(4) + S(-1)), x), x, -atan(x/sqrt(a + S(1)))/(S(2)*sqrt(a + S(1))) - atanh(x/sqrt(-a + S(1)))/(S(2)*sqrt(-a + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(2) + S(2)*a*x**S(2) + x**S(4) + S(1)), x), x, -sqrt(S(2))*atan((-sqrt(S(2))*x + sqrt(-a + sqrt(a**S(2) + S(1))))/sqrt(a + sqrt(a**S(2) + S(1))))/(S(4)*sqrt(a + sqrt(a**S(2) + S(1)))*sqrt(a**S(2) + S(1))) + sqrt(S(2))*atan((sqrt(S(2))*x + sqrt(-a + sqrt(a**S(2) + S(1))))/sqrt(a + sqrt(a**S(2) + S(1))))/(S(4)*sqrt(a + sqrt(a**S(2) + S(1)))*sqrt(a**S(2) + S(1))) - sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x*sqrt(-a + sqrt(a**S(2) + S(1))) + sqrt(a**S(2) + S(1)))/(S(8)*sqrt(-a + sqrt(a**S(2) + S(1)))*sqrt(a**S(2) + S(1))) + sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x*sqrt(-a + sqrt(a**S(2) + S(1))) + sqrt(a**S(2) + S(1)))/(S(8)*sqrt(-a + sqrt(a**S(2) + S(1)))*sqrt(a**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -atanh(x/S(2))/S(6) + atanh(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) + S(4)*x**S(2) + S(3)), x), x, atan(x)/S(2) - sqrt(S(3))*atan(sqrt(S(3))*x/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) + S(5)*x**S(2) + S(9)), x), x, -log(x**S(2) - x + S(3))/S(12) + log(x**S(2) + x + S(3))/S(12) - sqrt(S(11))*atan(sqrt(S(11))*(-S(2)*x + S(1))/S(11))/S(66) + sqrt(S(11))*atan(sqrt(S(11))*(S(2)*x + S(1))/S(11))/S(66), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) - x**S(2) + S(1)), x), x, -sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(12) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(2) + atan(S(2)*x + sqrt(S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) + S(2)*x**S(2) + S(2)), x), x, -log(x**S(2) - x*sqrt(S(-2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(8)*sqrt(S(-1) + sqrt(S(2)))) + log(x**S(2) + x*sqrt(S(-2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(8)*sqrt(S(-1) + sqrt(S(2)))) - sqrt(S(-1) + sqrt(S(2)))*atan((-S(2)*x + sqrt(S(-2) + S(2)*sqrt(S(2))))/sqrt(S(2) + S(2)*sqrt(S(2))))/S(4) + sqrt(S(-1) + sqrt(S(2)))*atan((S(2)*x + sqrt(S(-2) + S(2)*sqrt(S(2))))/sqrt(S(2) + S(2)*sqrt(S(2))))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(4) + x**S(2) + S(1)), x), x, sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(4) + S(2)*x**S(2) + S(10)), x), x, atan(x**S(2)/S(3) + S(1)/3)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(4) + S(9)*x**S(2) + S(20)), x), x, -S(2)*atan(x/S(2)) + sqrt(S(5))*atan(sqrt(S(5))*x/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(4) - x**S(2) + S(1)), x), x, sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(2) + atan(S(2)*x + sqrt(S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(4) - S(2)*x**S(2) + S(2)), x), x, log(x**S(2) - x*sqrt(S(2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(2) + S(2)*sqrt(S(2)))) - log(x**S(2) + x*sqrt(S(2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(2) + S(2)*sqrt(S(2)))) - sqrt(S(1)/2 + sqrt(S(2))/S(2))*atan((-S(2)*x + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2))))/S(2) + sqrt(S(1)/2 + sqrt(S(2))/S(2))*atan((S(2)*x + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2))))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -b*(b + S(2)*c*x**S(2))*(-S(12)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*c**S(4)) + b*(-S(12)*a*c + S(7)*b**S(2))*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*c**(S(9)/2)) + x**S(4)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(10)*c) + (a + b*x**S(2) + c*x**S(4))**(S(3)/2)*(-S(32)*a*c + S(35)*b**S(2) - S(42)*b*c*x**S(2))/(S(480)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -S(5)*b*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(48)*c**S(2)) + x**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(8)*c) + (b + S(2)*c*x**S(2))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(128)*c**S(3)) - (-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -b*(b + S(2)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(16)*c**S(2)) + b*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(5)/2)) + (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, (b + S(2)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*c) - (-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x, x), x, -sqrt(a)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(2) + b*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)) + sqrt(a + b*x**S(2) + c*x**S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(3), x), x, sqrt(c)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(2) - sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*x**S(2)) - b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(5), x), x, -(S(2)*a + b*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*a*x**S(4)) + (-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(7), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*a*x**S(6)) + b*(S(2)*a + b*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(16)*a**S(2)*x**S(4)) - b*(-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(9), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(8)*a*x**S(8)) + S(5)*b*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(48)*a**S(2)*x**S(6)) - (S(2)*a + b*x**S(2))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(128)*a**S(3)*x**S(4)) + (-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(11), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(10)*a*x**S(10)) + S(7)*b*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(80)*a**S(2)*x**S(8)) - (-S(32)*a*c + S(35)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(480)*a**S(3)*x**S(6)) + b*(S(2)*a + b*x**S(2))*(-S(12)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*a**S(4)*x**S(4)) - b*(-S(12)*a*c + S(7)*b**S(2))*(-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(29)*a*c + S(8)*b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(105)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c)*(-S(5)*a*c + S(2)*b**S(2)) - S(29)*a*b*c + S(8)*b**S(3))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(210)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + b*x*(-S(29)*a*c + S(8)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(105)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))) + x**S(3)*(b + S(5)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*c) - x*(-S(10)*a*c + S(4)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(105)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + x*(b + S(3)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*c) - x*(-S(6)*a*c + S(2)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + b*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))) + x*sqrt(a + b*x**S(2) + c*x**S(4))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(2), x), x, -S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/sqrt(a + b*x**S(2) + c*x**S(4)) + S(2)*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2)) - sqrt(a + b*x**S(2) + c*x**S(4))/x + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(4), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*x**S(3)) + b*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a*(sqrt(a) + sqrt(c)*x**S(2))) - b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a*x) - b*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/x**S(6), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*x**S(5)) - b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*a*x**S(3)) - S(2)*sqrt(c)*x*(-S(3)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))) + (-S(6)*a*c + S(2)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*a**S(2)*x) + S(2)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -b*(b + S(2)*c*x**S(2))*(-S(4)*a*c + S(3)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(256)*c**S(4)) + S(3)*b*(b + S(2)*c*x**S(2))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2048)*c**S(5)) - S(3)*b*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4096)*c**(S(11)/2)) + x**S(4)*(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(14)*c) + (a + b*x**S(2) + c*x**S(4))**(S(5)/2)*(-S(16)*a*c + S(21)*b**S(2) - S(30)*b*c*x**S(2))/(S(560)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(7)*b*(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(120)*c**S(2)) + x**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(12)*c) + (b + S(2)*c*x**S(2))*(-S(4)*a*c + S(7)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(384)*c**S(3)) - (b + S(2)*c*x**S(2))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(1024)*c**S(4)) + (-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(7)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2048)*c**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -b*(b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(32)*c**S(2)) + S(3)*b*(b + S(2)*c*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*c**S(3)) - S(3)*b*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*c**(S(7)/2)) + (a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(10)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, (b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(16)*c) - (b + S(2)*c*x**S(2))*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(128)*c**S(2)) + S(3)*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x, x), x, -a**(S(3)/2)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(2) - b*(-S(12)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)) + (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/S(6) + sqrt(a + b*x**S(2) + c*x**S(4))*(S(8)*a*c + b**S(2) + S(2)*b*c*x**S(2))/(S(16)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(3), x), x, -S(3)*sqrt(a)*b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(4) + (S(9)*b/S(8) + S(3)*c*x**S(2)/S(4))*sqrt(a + b*x**S(2) + c*x**S(4)) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(2)*x**S(2)) + (S(12)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(5), x), x, S(3)*b*sqrt(c)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(4) - (S(3)*b - S(6)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*x**S(2)) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(4)*x**S(4)) - (S(12)*a*c + S(3)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(7), x), x, c**(S(3)/2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(2) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*x**S(6)) - (S(2)*a*b + x**S(2)*(S(8)*a*c + b**S(2)))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(16)*a*x**S(4)) + b*(-S(12)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(9), x), x, -(S(2)*a + b*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(16)*a*x**S(8)) + (S(2)*a + b*x**S(2))*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(128)*a**S(2)*x**S(4)) - S(3)*(-S(4)*a*c + b**S(2))**S(2)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(11), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(10)*a*x**S(10)) + b*(S(2)*a + b*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(32)*a**S(2)*x**S(8)) - S(3)*b*(S(2)*a + b*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*a**S(3)*x**S(4)) + S(3)*b*(-S(4)*a*c + b**S(2))**S(2)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(13), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(12)*a*x**S(12)) + S(7)*b*(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(120)*a**S(2)*x**S(10)) - (S(2)*a + b*x**S(2))*(-S(4)*a*c + S(7)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(384)*a**S(3)*x**S(8)) + (S(2)*a + b*x**S(2))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(1024)*a**S(4)*x**S(4)) - (-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(7)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2048)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(8)*a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(9)*a*c + S(2)*b**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(1155)*c**(S(15)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c)*(S(60)*a**S(2)*c**S(2) - S(51)*a*b**S(2)*c + S(8)*b**S(4)) + S(8)*b*(-S(9)*a*c + S(2)*b**S(2))*(-S(3)*a*c + b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2310)*c**(S(15)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - S(8)*b*x*(-S(9)*a*c + S(2)*b**S(2))*(-S(3)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(1155)*c**(S(7)/2)*(sqrt(a) + sqrt(c)*x**S(2))) + x**S(3)*(b + S(3)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(33)*c) - x**S(3)*(b*(a*c + S(2)*b**S(2)) + S(10)*c*x**S(2)*(-S(3)*a*c + b**S(2)))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(385)*c**S(2)) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(60)*a**S(2)*c**S(2) - S(51)*a*b**S(2)*c + S(8)*b**S(4))/(S(1155)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(315)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(4)*sqrt(a)*b*sqrt(c)*(-S(6)*a*c + b**S(2)) + S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(630)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + x*(S(3)*b + S(7)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(63)*c) - x*(b*(-S(9)*a*c + S(4)*b**S(2)) + S(6)*c*x**S(2)*(-S(7)*a*c + S(2)*b**S(2)))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(315)*c**S(2)) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))/(S(315)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(8)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(35)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c)*(-S(20)*a*c + b**S(2)) + S(2)*b*(-S(8)*a*c + b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(70)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - S(2)*b*x*(-S(8)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))) + x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/S(7) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(10)*a*c + b**S(2) + S(3)*b*c*x**S(2))/(S(35)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(2), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(12)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(5)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(8)*sqrt(a)*b*sqrt(c) + S(12)*a*c + b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(10)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + x*(S(7)*b + S(6)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/S(5) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x + x*(S(12)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(4), x), x, -S(8)*a**(S(1)/4)*b*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*sqrt(a + b*x**S(2) + c*x**S(4))) + S(8)*b*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*sqrt(a) + S(3)*sqrt(c)*x**S(2)) - (S(3)*b - S(2)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*x) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(3)*x**S(3)) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(8)*sqrt(a)*b*sqrt(c) + S(4)*a*c + S(3)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(6), x), x, -(b - S(6)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*x**S(3)) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(5)*x**S(5)) + sqrt(c)*x*(S(12)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*a*(sqrt(a) + sqrt(c)*x**S(2))) - (S(12)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*a*x) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(12)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(5)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(8)*sqrt(a)*b*sqrt(c) + S(12)*a*c + b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(10)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(8), x), x, -(S(3)*b + S(30)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*x**S(5)) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*x**S(7)) - (-S(20)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*a*x**S(3)) - S(2)*b*sqrt(c)*x*(-S(8)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))) + S(2)*b*(-S(8)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(35)*a**S(2)*x) + S(2)*b*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(8)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(35)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c)*(-S(20)*a*c + b**S(2)) + S(2)*b*(-S(8)*a*c + b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(70)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(4) - S(2)*x**S(2) + S(3)), x), x, x*sqrt(-x**S(4) - S(2)*x**S(2) + S(3))/S(3) - S(2)*sqrt(S(3))*elliptic_e(asin(x), S(-1)/3)/S(3) + S(4)*sqrt(S(3))*elliptic_f(asin(x), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -b*(-S(12)*a*c + S(5)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(7)/2)) + x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(6)*c) + sqrt(a + b*x**S(2) + c*x**S(4))*(-S(16)*a*c + S(15)*b**S(2) - S(10)*b*c*x**S(2))/(S(48)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -S(3)*b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*c**S(2)) + x**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(4)*c) + (-S(4)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -b*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*c**(S(3)/2)) + sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*a*x**S(2)) + b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(4)*a*x**S(4)) + S(3)*b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*a**S(2)*x**S(2)) - (-S(4)*a*c + S(3)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(6)*a*x**S(6)) + S(5)*b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(24)*a**S(2)*x**S(4)) - (-S(16)*a*c + S(15)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(48)*a**S(3)*x**S(2)) + b*(-S(12)*a*c + S(5)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c) + S(2)*b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - S(2)*b*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))) + x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))) - sqrt(a + b*x**S(2) + c*x**S(4))/(a*x) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a*x**S(3)) - S(2)*b*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))) + S(2)*b*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a**S(2)*x) + S(2)*b*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c) + S(2)*b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -b*(S(12)*a*c + S(5)*b**S(2))*atan((b - S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(32)*c**(S(7)/2)) - x**S(4)*sqrt(a + b*x**S(2) - c*x**S(4))/(S(6)*c) - sqrt(a + b*x**S(2) - c*x**S(4))*(S(16)*a*c + S(15)*b**S(2) + S(10)*b*c*x**S(2))/(S(48)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -S(3)*b*sqrt(a + b*x**S(2) - c*x**S(4))/(S(8)*c**S(2)) - x**S(2)*sqrt(a + b*x**S(2) - c*x**S(4))/(S(4)*c) - (S(4)*a*c + S(3)*b**S(2))*atan((b - S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(16)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -b*atan((b - S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(4)*c**(S(3)/2)) - sqrt(a + b*x**S(2) - c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -atan((b - S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, -atan((S(2)*a - b*x**S(2))/(S(2)*sqrt(a)*sqrt(-a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, sqrt(-a + b*x**S(2) + c*x**S(4))/(S(2)*a*x**S(2)) - b*atan((S(2)*a - b*x**S(2))/(S(2)*sqrt(a)*sqrt(-a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, sqrt(-a + b*x**S(2) + c*x**S(4))/(S(4)*a*x**S(4)) + S(3)*b*sqrt(-a + b*x**S(2) + c*x**S(4))/(S(8)*a**S(2)*x**S(2)) - (S(4)*a*c + S(3)*b**S(2))*atan((S(2)*a - b*x**S(2))/(S(2)*sqrt(a)*sqrt(-a + b*x**S(2) + c*x**S(4))))/(S(16)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, sqrt(-a + b*x**S(2) + c*x**S(4))/(S(6)*a*x**S(6)) + S(5)*b*sqrt(-a + b*x**S(2) + c*x**S(4))/(S(24)*a**S(2)*x**S(4)) + (S(16)*a*c + S(15)*b**S(2))*sqrt(-a + b*x**S(2) + c*x**S(4))/(S(48)*a**S(3)*x**S(2)) - b*(S(12)*a*c + S(5)*b**S(2))*atan((S(2)*a - b*x**S(2))/(S(2)*sqrt(a)*sqrt(-a + b*x**S(2) + c*x**S(4))))/(S(32)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -sqrt(S(2))*b*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*c**(S(5)/2)*sqrt(a + b*x**S(2) - c*x**S(4))) - x*sqrt(a + b*x**S(2) - c*x**S(4))/(S(3)*c) + sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*(a*c + b**S(2) - b*sqrt(S(4)*a*c + b**S(2)))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*c**(S(5)/2)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -sqrt(S(2))*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(a + b*x**S(2) - c*x**S(4))) + sqrt(S(2))*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*x**S(2) - c*x**S(4))), x), x, -sqrt(a + b*x**S(2) - c*x**S(4))/(a*x) + sqrt(S(2))*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))) - sqrt(S(2))*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*x**S(2) - c*x**S(4))), x), x, -sqrt(a + b*x**S(2) - c*x**S(4))/(S(3)*a*x**S(3)) + S(2)*b*sqrt(a + b*x**S(2) - c*x**S(4))/(S(3)*a**S(2)*x) - sqrt(S(2))*b*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*a**S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))) + sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*(a*c + b**S(2) - b*sqrt(S(4)*a*c + b**S(2)))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*a**S(2)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -b*x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) + x**S(6)*(S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - (b*(-S(52)*a*c + S(15)*b**S(2)) - S(2)*c*x**S(2)*(-S(12)*a*c + S(5)*b**S(2)))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*c**S(3)*(-S(4)*a*c + b**S(2))) + (-S(12)*a*c + S(15)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(3)*b*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*c**(S(5)/2)) + x**S(4)*(S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt(a + b*x**S(2) + c*x**S(4))*(-S(8)*a*c + S(3)*b**S(2) - S(2)*b*c*x**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -b*sqrt(a + b*x**S(2) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) + x**S(2)*(S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, (S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(b + S(2)*c*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*x**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - (-S(8)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) + S(3)*b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*x**S(4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - (-S(12)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)*x**S(4)*(-S(4)*a*c + b**S(2))) + b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))) - (-S(12)*a*c + S(15)*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(2)*a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*c**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - b*x*sqrt(a + b*x**S(2) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) + x**S(3)*(S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + x*(-S(6)*a*c + S(2)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, a**(S(1)/4)*b*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*(-S(4)*sqrt(a)*sqrt(c) + S(2)*b)*sqrt(a + b*x**S(2) + c*x**S(4))) - b*x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) + x*(S(2)*a + b*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/((sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) - x*(b + S(2)*c*x**S(2))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(1)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(-3)/2), x), x, -b*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) + x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + b*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*x*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*sqrt(c)*x*(-S(3)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) - (-S(6)*a*c + S(2)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(a**S(2)*x*(-S(4)*a*c + b**S(2))) - S(2)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, elliptic_f(asin(sqrt(S(2))*x/S(2)), S(-6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(4)*x**S(2) + S(2)), x), x, sqrt(S(1)/3 + sqrt(S(10))/S(6))*elliptic_f(asin(x*sqrt(S(-1) + sqrt(S(10))/S(2))), S(-7)/3 - S(2)*sqrt(S(10))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(3)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(sqrt(S(6))*x/sqrt(S(3) + sqrt(S(33)))), S(-7)/4 - sqrt(S(33))/S(4))/sqrt(S(-3) + sqrt(S(33))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(2)*x**S(2) + S(2)), x), x, elliptic_f(asin(sqrt(S(3))*x/sqrt(S(1) + sqrt(S(7)))), S(-4)/3 - sqrt(S(7))/S(3))/sqrt(S(-1) + sqrt(S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(x), S(-3)/2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(2)), x), x, S(6)**(S(3)/4)*elliptic_f(asin(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), S(-1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - x**S(2) + S(2)), x), x, sqrt(S(3))*elliptic_f(asin(sqrt(S(6))*x/S(2)), S(-2)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(2)*x**S(2) + S(2)), x), x, elliptic_f(asin(sqrt(S(3))*x/sqrt(S(-1) + sqrt(S(7)))), S(-4)/3 + sqrt(S(7))/S(3))/sqrt(S(1) + sqrt(S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(3)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(sqrt(S(6))*x/sqrt(S(-3) + sqrt(S(33)))), S(-7)/4 + sqrt(S(33))/S(4))/sqrt(S(3) + sqrt(S(33))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(4)*x**S(2) + S(2)), x), x, sqrt(S(-1)/3 + sqrt(S(10))/S(6))*elliptic_f(asin(x*sqrt(S(1) + sqrt(S(10))/S(2))), S(-7)/3 + S(2)*sqrt(S(10))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(5)*x**S(2) + S(2)), x), x, sqrt(S(6))*elliptic_f(asin(sqrt(S(3))*x), S(-1)/6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(7)*x**S(2) + S(3)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*x/sqrt(S(7) + sqrt(S(73)))), S(-61)/12 - S(7)*sqrt(S(73))/S(12))/sqrt(S(-7) + sqrt(S(73))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(6)*x**S(2) + S(3)), x), x, sqrt(S(1)/2 + sqrt(S(15))/S(6))*elliptic_f(asin(x*sqrt(S(-1) + sqrt(S(15))/S(3))), S(-4) - sqrt(S(15))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(5)*x**S(2) + S(3)), x), x, elliptic_f(asin(sqrt(S(3))*x/S(3)), S(-6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(4)*x**S(2) + S(3)), x), x, elliptic_f(asin(sqrt(S(2))*x/sqrt(S(2) + sqrt(S(10)))), S(-7)/3 - S(2)*sqrt(S(10))/S(3))/sqrt(S(-2) + sqrt(S(10))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(3)*x**S(2) + S(3)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*x/sqrt(S(3) + sqrt(S(33)))), S(-7)/4 - sqrt(S(33))/S(4))/sqrt(S(-3) + sqrt(S(33))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(2)*x**S(2) + S(3)), x), x, elliptic_f(asin(sqrt(S(2))*x/sqrt(S(1) + sqrt(S(7)))), S(-4)/3 - sqrt(S(7))/S(3))/sqrt(S(-1) + sqrt(S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + x**S(2) + S(3)), x), x, sqrt(S(2))*elliptic_f(asin(sqrt(S(6))*x/S(3)), S(-3)/2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(3)), x), x, S(6)**(S(3)/4)*elliptic_f(asin(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(-1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - x**S(2) + S(3)), x), x, sqrt(S(3))*elliptic_f(asin(x), S(-2)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(2)*x**S(2) + S(3)), x), x, elliptic_f(asin(sqrt(S(2))*x/sqrt(S(-1) + sqrt(S(7)))), S(-4)/3 + sqrt(S(7))/S(3))/sqrt(S(1) + sqrt(S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(3)*x**S(2) + S(3)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*x/sqrt(S(-3) + sqrt(S(33)))), S(-7)/4 + sqrt(S(33))/S(4))/sqrt(S(3) + sqrt(S(33))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(4)*x**S(2) + S(3)), x), x, elliptic_f(asin(sqrt(S(2))*x/sqrt(S(-2) + sqrt(S(10)))), S(-7)/3 + S(2)*sqrt(S(10))/S(3))/sqrt(S(2) + sqrt(S(10))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(5)*x**S(2) + S(3)), x), x, sqrt(S(6))*elliptic_f(asin(sqrt(S(2))*x), S(-1)/6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(6)*x**S(2) + S(3)), x), x, sqrt(S(-1)/2 + sqrt(S(15))/S(6))*elliptic_f(asin(x*sqrt(S(1) + sqrt(S(15))/S(3))), S(-4) + sqrt(S(15))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(7)*x**S(2) + S(3)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*x/sqrt(S(-7) + sqrt(S(73)))), S(-61)/12 + S(7)*sqrt(S(73))/S(12))/sqrt(S(7) + sqrt(S(73))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(-2)), x), x, sqrt(S(7))*sqrt(x**S(2) + S(2))*sqrt(S(3)*x**S(2) + S(-1))*elliptic_f(asin(sqrt(S(14))*x/(S(2)*sqrt(S(3)*x**S(2) + S(-1)))), S(6)/7)/(S(7)*sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(4)*x**S(2) + S(-2)), x), x, S(10)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(10)) + S(2)) + S(2))/(-x**S(2)*(S(2) + sqrt(S(10))) + S(2)))*sqrt(x**S(2)*(S(2) + sqrt(S(10))) + S(-2))*elliptic_f(asin(S(2)**(S(3)/4)*S(5)**(S(1)/4)*x/sqrt(x**S(2)*(S(2) + sqrt(S(10))) + S(-2))), sqrt(S(10))/S(10) + S(1)/2)/(S(20)*sqrt(S(3)*x**S(4) + S(4)*x**S(2) + S(-2))*sqrt(S(1)/(-x**S(2)*(S(2) + sqrt(S(10))) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(3)*x**S(2) + S(-2)), x), x, sqrt(S(2))*S(33)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(33)) + S(3)) + S(4))/(-x**S(2)*(S(3) + sqrt(S(33))) + S(4)))*sqrt(x**S(2)*(S(3) + sqrt(S(33))) + S(-4))*elliptic_f(asin(sqrt(S(2))*S(33)**(S(1)/4)*x/sqrt(x**S(2)*(S(3) + sqrt(S(33))) + S(-4))), sqrt(S(33))/S(22) + S(1)/2)/(S(132)*sqrt(S(3)*x**S(4) + S(3)*x**S(2) + S(-2))*sqrt(S(1)/(-x**S(2)*(S(3) + sqrt(S(33))) + S(4)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(2)*x**S(2) + S(-2)), x), x, S(7)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(7)) + S(1)) + S(2))/(-x**S(2)*(S(1) + sqrt(S(7))) + S(2)))*sqrt(x**S(2)*(S(1) + sqrt(S(7))) + S(-2))*elliptic_f(asin(sqrt(S(2))*S(7)**(S(1)/4)*x/sqrt(x**S(2)*(S(1) + sqrt(S(7))) + S(-2))), sqrt(S(7))/S(14) + S(1)/2)/(S(14)*sqrt(S(3)*x**S(4) + S(2)*x**S(2) + S(-2))*sqrt(S(1)/(-x**S(2)*(S(1) + sqrt(S(7))) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + x**S(2) + S(-2)), x), x, sqrt(S(5))*sqrt(x**S(2) + S(1))*sqrt(S(3)*x**S(2) + S(-2))*elliptic_f(asin(sqrt(S(5))*x/sqrt(S(3)*x**S(2) + S(-2))), S(3)/5)/(S(5)*sqrt(S(3)*x**S(4) + x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((sqrt(S(6))*x**S(2) + S(2))/(-sqrt(S(6))*x**S(2) + S(2)))*sqrt(sqrt(S(6))*x**S(2) + S(-2))*elliptic_f(asin(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/sqrt(sqrt(S(6))*x**S(2) + S(-2))), S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + S(-2))*sqrt(S(1)/(-sqrt(S(6))*x**S(2) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - x**S(2) + S(-2)), x), x, sqrt(S(5))*sqrt(x**S(2) + S(-1))*sqrt(S(3)*x**S(2) + S(2))*elliptic_f(asin(sqrt(S(10))*x/(S(2)*sqrt(x**S(2) + S(-1)))), S(2)/5)/(S(5)*sqrt(S(3)*x**S(4) - x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(2)*x**S(2) + S(-2)), x), x, S(7)**(S(3)/4)*sqrt((x**S(2)*(S(1) + sqrt(S(7))) + S(2))/(x**S(2)*(-sqrt(S(7)) + S(1)) + S(2)))*sqrt(-x**S(2)*(-sqrt(S(7)) + S(1)) + S(-2))*elliptic_f(asin(sqrt(S(2))*S(7)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(7)) + S(1)) + S(-2))), -sqrt(S(7))/S(14) + S(1)/2)/(S(14)*sqrt(S(3)*x**S(4) - S(2)*x**S(2) + S(-2))*sqrt(S(1)/(x**S(2)*(-sqrt(S(7)) + S(1)) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(3)*x**S(2) + S(-2)), x), x, sqrt(S(2))*S(33)**(S(3)/4)*sqrt((x**S(2)*(S(3) + sqrt(S(33))) + S(4))/(x**S(2)*(-sqrt(S(33)) + S(3)) + S(4)))*sqrt(-x**S(2)*(-sqrt(S(33)) + S(3)) + S(-4))*elliptic_f(asin(sqrt(S(2))*S(33)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(33)) + S(3)) + S(-4))), -sqrt(S(33))/S(22) + S(1)/2)/(S(132)*sqrt(S(3)*x**S(4) - S(3)*x**S(2) + S(-2))*sqrt(S(1)/(x**S(2)*(-sqrt(S(33)) + S(3)) + S(4)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(4)*x**S(2) + S(-2)), x), x, S(10)**(S(3)/4)*sqrt((x**S(2)*(S(2) + sqrt(S(10))) + S(2))/(x**S(2)*(-sqrt(S(10)) + S(2)) + S(2)))*sqrt(-x**S(2)*(-sqrt(S(10)) + S(2)) + S(-2))*elliptic_f(asin(S(2)**(S(3)/4)*S(5)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(10)) + S(2)) + S(-2))), -sqrt(S(10))/S(10) + S(1)/2)/(S(20)*sqrt(S(3)*x**S(4) - S(4)*x**S(2) + S(-2))*sqrt(S(1)/(x**S(2)*(-sqrt(S(10)) + S(2)) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(5)*x**S(2) + S(-2)), x), x, sqrt(S(7))*sqrt(x**S(2) + S(-2))*sqrt(S(3)*x**S(2) + S(1))*elliptic_f(asin(sqrt(S(7))*x/sqrt(x**S(2) + S(-2))), S(1)/7)/(S(7)*sqrt(S(3)*x**S(4) - S(5)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(7)*x**S(2) + S(-3)), x), x, sqrt(S(3))*S(73)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(73)) + S(7)) + S(6))/(-x**S(2)*(S(7) + sqrt(S(73))) + S(6)))*sqrt(x**S(2)*(S(7) + sqrt(S(73))) + S(-6))*elliptic_f(asin(sqrt(S(2))*S(73)**(S(1)/4)*x/sqrt(x**S(2)*(S(7) + sqrt(S(73))) + S(-6))), S(7)*sqrt(S(73))/S(146) + S(1)/2)/(S(438)*sqrt(S(2)*x**S(4) + S(7)*x**S(2) + S(-3))*sqrt(S(1)/(-x**S(2)*(S(7) + sqrt(S(73))) + S(6)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(6)*x**S(2) + S(-3)), x), x, sqrt(S(2))*S(3)**(S(1)/4)*S(5)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(15)) + S(3)) + S(3))/(-x**S(2)*(S(3) + sqrt(S(15))) + S(3)))*sqrt(x**S(2)*(S(3) + sqrt(S(15))) + S(-3))*elliptic_f(asin(S(15)**(S(1)/4)*sqrt(S(2))*x/sqrt(x**S(2)*(S(3) + sqrt(S(15))) + S(-3))), sqrt(S(15))/S(10) + S(1)/2)/(S(30)*sqrt(S(2)*x**S(4) + S(6)*x**S(2) + S(-3))*sqrt(S(1)/(-x**S(2)*(S(3) + sqrt(S(15))) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(-3)), x), x, sqrt(S(7))*sqrt(x**S(2) + S(3))*sqrt(S(2)*x**S(2) + S(-1))*elliptic_f(asin(sqrt(S(21))*x/(S(3)*sqrt(S(2)*x**S(2) + S(-1)))), S(6)/7)/(S(7)*sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(4)*x**S(2) + S(-3)), x), x, S(2)**(S(1)/4)*sqrt(S(3))*S(5)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(10)) + S(2)) + S(3))/(-x**S(2)*(S(2) + sqrt(S(10))) + S(3)))*sqrt(x**S(2)*(S(2) + sqrt(S(10))) + S(-3))*elliptic_f(asin(S(2)**(S(3)/4)*S(5)**(S(1)/4)*x/sqrt(x**S(2)*(S(2) + sqrt(S(10))) + S(-3))), sqrt(S(10))/S(10) + S(1)/2)/(S(30)*sqrt(S(2)*x**S(4) + S(4)*x**S(2) + S(-3))*sqrt(S(1)/(-x**S(2)*(S(2) + sqrt(S(10))) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(3)*x**S(2) + S(-3)), x), x, S(11)**(S(3)/4)*S(3)**(S(1)/4)*sqrt((-x**S(2)*(-sqrt(S(33)) + S(3)) + S(6))/(-x**S(2)*(S(3) + sqrt(S(33))) + S(6)))*sqrt(x**S(2)*(S(3) + sqrt(S(33))) + S(-6))*elliptic_f(asin(sqrt(S(2))*S(33)**(S(1)/4)*x/sqrt(x**S(2)*(S(3) + sqrt(S(33))) + S(-6))), sqrt(S(33))/S(22) + S(1)/2)/(S(66)*sqrt(S(2)*x**S(4) + S(3)*x**S(2) + S(-3))*sqrt(S(1)/(-x**S(2)*(S(3) + sqrt(S(33))) + S(6)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(-3)), x), x, sqrt(S(6))*S(7)**(S(3)/4)*sqrt((-x**S(2)*(-sqrt(S(7)) + S(1)) + S(3))/(-x**S(2)*(S(1) + sqrt(S(7))) + S(3)))*sqrt(x**S(2)*(S(1) + sqrt(S(7))) + S(-3))*elliptic_f(asin(sqrt(S(2))*S(7)**(S(1)/4)*x/sqrt(x**S(2)*(S(1) + sqrt(S(7))) + S(-3))), sqrt(S(7))/S(14) + S(1)/2)/(S(42)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(-3))*sqrt(S(1)/(-x**S(2)*(S(1) + sqrt(S(7))) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + x**S(2) + S(-3)), x), x, sqrt(S(5))*sqrt(x**S(2) + S(-1))*sqrt(S(2)*x**S(2) + S(3))*elliptic_f(asin(sqrt(S(15))*x/(S(3)*sqrt(x**S(2) + S(-1)))), S(3)/5)/(S(5)*sqrt(S(2)*x**S(4) + x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(-3)), x), x, S(6)**(S(1)/4)*sqrt((sqrt(S(6))*x**S(2) + S(3))/(-sqrt(S(6))*x**S(2) + S(3)))*sqrt(sqrt(S(6))*x**S(2) + S(-3))*elliptic_f(asin(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/sqrt(sqrt(S(6))*x**S(2) + S(-3))), S(1)/2)/(S(6)*sqrt(S(2)*x**S(4) + S(-3))*sqrt(S(1)/(-sqrt(S(6))*x**S(2) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - x**S(2) + S(-3)), x), x, sqrt(S(5))*sqrt(x**S(2) + S(1))*sqrt(S(2)*x**S(2) + S(-3))*elliptic_f(asin(sqrt(S(5))*x/sqrt(S(2)*x**S(2) + S(-3))), S(2)/5)/(S(5)*sqrt(S(2)*x**S(4) - x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(2)*x**S(2) + S(-3)), x), x, sqrt(S(6))*S(7)**(S(3)/4)*sqrt((x**S(2)*(S(1) + sqrt(S(7))) + S(3))/(x**S(2)*(-sqrt(S(7)) + S(1)) + S(3)))*sqrt(-x**S(2)*(-sqrt(S(7)) + S(1)) + S(-3))*elliptic_f(asin(sqrt(S(2))*S(7)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(7)) + S(1)) + S(-3))), -sqrt(S(7))/S(14) + S(1)/2)/(S(42)*sqrt(S(2)*x**S(4) - S(2)*x**S(2) + S(-3))*sqrt(S(1)/(x**S(2)*(-sqrt(S(7)) + S(1)) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(3)*x**S(2) + S(-3)), x), x, S(11)**(S(3)/4)*S(3)**(S(1)/4)*sqrt((x**S(2)*(S(3) + sqrt(S(33))) + S(6))/(x**S(2)*(-sqrt(S(33)) + S(3)) + S(6)))*sqrt(-x**S(2)*(-sqrt(S(33)) + S(3)) + S(-6))*elliptic_f(asin(sqrt(S(2))*S(33)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(33)) + S(3)) + S(-6))), -sqrt(S(33))/S(22) + S(1)/2)/(S(66)*sqrt(S(2)*x**S(4) - S(3)*x**S(2) + S(-3))*sqrt(S(1)/(x**S(2)*(-sqrt(S(33)) + S(3)) + S(6)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(4)*x**S(2) + S(-3)), x), x, S(2)**(S(1)/4)*sqrt(S(3))*S(5)**(S(3)/4)*sqrt((x**S(2)*(S(2) + sqrt(S(10))) + S(3))/(x**S(2)*(-sqrt(S(10)) + S(2)) + S(3)))*sqrt(-x**S(2)*(-sqrt(S(10)) + S(2)) + S(-3))*elliptic_f(asin(S(2)**(S(3)/4)*S(5)**(S(1)/4)*x/sqrt(-x**S(2)*(-sqrt(S(10)) + S(2)) + S(-3))), -sqrt(S(10))/S(10) + S(1)/2)/(S(30)*sqrt(S(2)*x**S(4) - S(4)*x**S(2) + S(-3))*sqrt(S(1)/(x**S(2)*(-sqrt(S(10)) + S(2)) + S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(5)*x**S(2) + S(-3)), x), x, sqrt(S(7))*sqrt(x**S(2) + S(-3))*sqrt(S(2)*x**S(2) + S(1))*elliptic_f(asin(sqrt(S(7))*x/sqrt(x**S(2) + S(-3))), S(1)/7)/(S(7)*sqrt(S(2)*x**S(4) - S(5)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*sqrt((S(3)*x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(-1)/2)/(S(2)*sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(4)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(4)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + S(4)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(3)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(2)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(2)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + S(2)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) - x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(2)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(2)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) - S(2)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(3)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(3)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) - S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(4)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(4)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(S(3)*x**S(4) - S(4)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(5)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(5)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), S(1)/2 + S(5)*sqrt(S(6))/S(24))/(S(12)*sqrt(S(3)*x**S(4) - S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) - S(6)*x**S(2) + S(2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(6)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), S(1)/2 + sqrt(S(6))/S(4))/(S(12)*sqrt(S(3)*x**S(4) - S(6)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(9)*x**S(2) + S(3)), x), x, sqrt((x**S(2)*(-sqrt(S(57)) + S(9)) + S(6))/(x**S(2)*(sqrt(S(57)) + S(9)) + S(6)))*(x**S(2)*(sqrt(S(57)) + S(9)) + S(6))*elliptic_f(atan(x*sqrt(sqrt(S(57))/S(6) + S(3)/2)), S(-19)/4 + S(3)*sqrt(S(57))/S(4))/(sqrt(S(6)*sqrt(S(57)) + S(54))*sqrt(S(2)*x**S(4) + S(9)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(8)*x**S(2) + S(3)), x), x, sqrt((x**S(2)*(-sqrt(S(10)) + S(4)) + S(3))/(x**S(2)*(sqrt(S(10)) + S(4)) + S(3)))*(x**S(2)*(sqrt(S(10)) + S(4)) + S(3))*elliptic_f(atan(x*sqrt(sqrt(S(10))/S(3) + S(4)/3)), S(-10)/3 + S(4)*sqrt(S(10))/S(3))/(sqrt(S(3)*sqrt(S(10)) + S(12))*sqrt(S(2)*x**S(4) + S(8)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(7)*x**S(2) + S(3)), x), x, sqrt(S(6))*sqrt((x**S(2) + S(3))/(S(2)*x**S(2) + S(1)))*(S(2)*x**S(2) + S(1))*elliptic_f(atan(sqrt(S(2))*x), S(5)/6)/(S(6)*sqrt(S(2)*x**S(4) + S(7)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(6)*x**S(2) + S(3)), x), x, sqrt((x**S(2)*(-sqrt(S(3)) + S(3)) + S(3))/(x**S(2)*(sqrt(S(3)) + S(3)) + S(3)))*(x**S(2)*(sqrt(S(3)) + S(3)) + S(3))*elliptic_f(atan(x*sqrt(sqrt(S(3))/S(3) + S(1))), S(-1) + sqrt(S(3)))/(sqrt(S(3)*sqrt(S(3)) + S(9))*sqrt(S(2)*x**S(4) + S(6)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(3)), x), x, sqrt(S(3))*sqrt((S(2)*x**S(2) + S(3))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/3)/(S(3)*sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(4)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(4)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(4)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(3)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(3)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(3)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) - x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(2)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(2)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) - S(2)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(3)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(3)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) - S(3)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(4)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(4)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) - S(4)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(5)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(5)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(1)/2 + S(5)*sqrt(S(6))/S(24))/(S(12)*sqrt(S(2)*x**S(4) - S(5)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(6)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(6)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(1)/2 + sqrt(S(6))/S(4))/(S(12)*sqrt(S(2)*x**S(4) - S(6)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) - S(7)*x**S(2) + S(3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(7)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(1)/2 + S(7)*sqrt(S(6))/S(24))/(S(12)*sqrt(S(2)*x**S(4) - S(7)*x**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(7)*x**S(2) + S(-3)), x), x, -sqrt(S(5))*elliptic_f(acos(sqrt(S(3))*x/S(3)), S(6)/5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(6)*x**S(2) + S(-3)), x), x, -sqrt(S(2))*S(3)**(S(3)/4)*elliptic_f(acos(x*sqrt(-sqrt(S(3))/S(3) + S(1))), S(1)/2 + sqrt(S(3))/S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(5)*x**S(2) + S(-3)), x), x, -elliptic_f(acos(sqrt(S(6))*x/S(3)), S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(4)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(4)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) + S(4)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(3)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(3)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) + S(3)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(2)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - S(2)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) + S(2)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) - x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) + x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) - x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(2)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) - S(2)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(3)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(3)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) - S(3)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(4)*x**S(2) + S(-3)), x), x, S(6)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(4)*x**S(2) + S(3))/(sqrt(S(6))*x**S(2) + S(3))**S(2))*(sqrt(S(6))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*S(3)**(S(3)/4)*x/S(3)), -sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(-S(2)*x**S(4) - S(4)*x**S(2) + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) - S(5)*x**S(2) + S(-3)), x), x, sqrt(S(3))*sqrt(S(2)*x**S(2) + S(3))*elliptic_f(atan(x), S(1)/3)/(S(3)*sqrt((S(2)*x**S(2) + S(3))/(x**S(2) + S(1)))*sqrt(-x**S(2) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(6)*x**S(2) + S(-2)), x), x, -sqrt(S(2))*S(3)**(S(3)/4)*elliptic_f(acos(sqrt(S(3))*x/sqrt(sqrt(S(3)) + S(3))), S(1)/2 + sqrt(S(3))/S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(5)*x**S(2) + S(-2)), x), x, -elliptic_f(acos(x), S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(4)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(4)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) + S(4)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(3)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(3)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) + S(3)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(2)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - S(2)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) + S(2)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) - x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) + x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(24) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) - x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(2)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(2)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(12) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) - S(2)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(3)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(3)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(8) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) - S(3)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(4)*x**S(2) + S(-2)), x), x, S(6)**(S(3)/4)*sqrt((S(3)*x**S(4) + S(4)*x**S(2) + S(2))/(sqrt(S(6))*x**S(2) + S(2))**S(2))*(sqrt(S(6))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(3)**(S(1)/4)*x/S(2)), -sqrt(S(6))/S(6) + S(1)/2)/(S(12)*sqrt(-S(3)*x**S(4) - S(4)*x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) - S(5)*x**S(2) + S(-2)), x), x, -sqrt(S(2))*sqrt(-S(3)*x**S(2) + S(-2))*elliptic_f(atan(x), S(-1)/2)/(S(2)*sqrt((S(3)*x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(5)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, S(10)**(S(3)/4)*sqrt((S(5)*x**S(4) + S(5)*x**S(2) + S(2))/(sqrt(S(10))*x**S(2) + S(2))**S(2))*(sqrt(S(10))*x**S(2) + S(2))*elliptic_f(S(2)*atan(S(2)**(S(3)/4)*S(5)**(S(1)/4)*x/S(2)), -sqrt(S(10))/S(8) + S(1)/2)/(S(20)*sqrt(S(5)*x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(4)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, S(2)**(S(1)/4)*sqrt((S(4)*x**S(4) + S(5)*x**S(2) + S(2))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -S(5)*sqrt(S(2))/S(16) + S(1)/2)/(S(4)*sqrt(S(4)*x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*sqrt((S(3)*x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(-1)/2)/(S(2)*sqrt(S(3)*x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt((x**S(2) + S(2))/(S(2)*x**S(2) + S(1)))*(S(2)*x**S(2) + S(1))*elliptic_f(atan(sqrt(S(2))*x), S(3)/4)/(S(2)*sqrt(S(2)*x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt((x**S(2)*(-sqrt(S(17)) + S(5)) + S(4))/(x**S(2)*(sqrt(S(17)) + S(5)) + S(4)))*(x**S(2)*(sqrt(S(17)) + S(5)) + S(4))*elliptic_f(atan(x*sqrt(sqrt(S(17)) + S(5))/S(2)), S(-17)/4 + S(5)*sqrt(S(17))/S(4))/(S(2)*sqrt(sqrt(S(17)) + S(5))*sqrt(x**S(4) + S(5)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(sqrt(S(2))*x/sqrt(S(5) + sqrt(S(33)))), S(-29)/4 - S(5)*sqrt(S(33))/S(4))/sqrt(S(-5) + sqrt(S(33))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(2)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*x/sqrt(S(5) + sqrt(S(41)))), S(-33)/8 - S(5)*sqrt(S(41))/S(8))/sqrt(S(-5) + sqrt(S(41))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(3)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, elliptic_f(asin(sqrt(S(2))*x/S(2)), S(-6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(4)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*sqrt(S(2))*x/sqrt(S(5) + sqrt(S(57)))), S(-41)/16 - S(5)*sqrt(S(57))/S(16))/sqrt(S(-5) + sqrt(S(57))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(5)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(sqrt(S(10))*x/sqrt(S(5) + sqrt(S(65)))), S(-9)/4 - sqrt(S(65))/S(4))/sqrt(S(-5) + sqrt(S(65))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(6)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(S(2)*sqrt(S(3))*x/sqrt(S(5) + sqrt(S(73)))), S(-49)/24 - S(5)*sqrt(S(73))/S(24))/sqrt(S(-5) + sqrt(S(73))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(7)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(x), S(-7)/2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(8)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(S(4)*x/sqrt(S(5) + sqrt(S(89)))), S(-57)/32 - S(5)*sqrt(S(89))/S(32))/sqrt(S(-5) + sqrt(S(89))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(9)*x**S(4) + S(5)*x**S(2) + S(2)), x), x, sqrt(S(2))*elliptic_f(asin(S(3)*sqrt(S(2))*x/sqrt(S(5) + sqrt(S(97)))), S(-61)/36 - S(5)*sqrt(S(97))/S(36))/sqrt(S(-5) + sqrt(S(97))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -S(2)*b*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c**S(2)*x) + x*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -b*atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*c**(S(3)/2)) + sqrt(b*x**S(2) + c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(b*x**S(2) + c*x**S(4)), x), x, sqrt(b*x**S(2) + c*x**S(4))/(c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(b*x**S(2) + c*x**S(4)), x), x, atanh(sqrt(c)*x**S(2)/sqrt(b*x**S(2) + c*x**S(4)))/sqrt(c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(b*x**S(2) + c*x**S(4)), x), x, -atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(2)*b*x**S(3)) + c*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(2)*b**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b*x**S(4)) + S(2)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(3)*b**S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(b*x**S(2) + c*x**S(4))), x), x, -sqrt(b*x**S(2) + c*x**S(4))/(S(4)*b*x**S(5)) + S(3)*c*sqrt(b*x**S(2) + c*x**S(4))/(S(8)*b**S(2)*x**S(3)) - S(3)*c**S(2)*atanh(sqrt(b)*x/sqrt(b*x**S(2) + c*x**S(4)))/(S(8)*b**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a + c*x**S(4)), x), x, -a**(S(3)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(6)*c**(S(5)/4)*sqrt(a + c*x**S(4))) + x*sqrt(a + c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + c*x**S(4)), x), x, sqrt(a + c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + c*x**S(4)), x), x, -a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(a + c*x**S(4))) + a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*c**(S(3)/4)*sqrt(a + c*x**S(4))) + x*sqrt(a + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + c*x**S(4)), x), x, atanh(sqrt(c)*x**S(2)/sqrt(a + c*x**S(4)))/(S(2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + c*x**S(4)), x), x, sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + c*x**S(4))), x), x, -atanh(sqrt(a + c*x**S(4))/sqrt(a))/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + c*x**S(4))), x), x, sqrt(c)*x*sqrt(a + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))) - sqrt(a + c*x**S(4))/(a*x) - c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(a**(S(3)/4)*sqrt(a + c*x**S(4))) + c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(3)/4)*sqrt(a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + c*x**S(4))), x), x, -sqrt(a + c*x**S(4))/(S(2)*a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + c*x**S(4))), x), x, -sqrt(a + c*x**S(4))/(S(3)*a*x**S(3)) - c**(S(3)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(6)*a**(S(5)/4)*sqrt(a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a + b*x**S(2)), x), x, S(3)*a**S(2)*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(8)*b**(S(5)/2)) - S(3)*a*x*sqrt(a + b*x**S(2))/(S(8)*b**S(2)) + x**S(3)*sqrt(a + b*x**S(2))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*x**S(2)), x), x, -a*sqrt(a + b*x**S(2))/b**S(2) + (a + b*x**S(2))**(S(3)/2)/(S(3)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*x**S(2)), x), x, -a*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(2)*b**(S(3)/2)) + x*sqrt(a + b*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*x**S(2)), x), x, sqrt(a + b*x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*x**S(2)), x), x, atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*x**S(2))), x), x, -atanh(sqrt(a + b*x**S(2))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*x**S(2))), x), x, -sqrt(a + b*x**S(2))/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*x**S(2))), x), x, -sqrt(a + b*x**S(2))/(S(2)*a*x**S(2)) + b*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(S(2)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*x**S(2))), x), x, -sqrt(a + b*x**S(2))/(S(3)*a*x**S(3)) + S(2)*b*sqrt(a + b*x**S(2))/(S(3)*a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(c*x**S(4)), x), x, x*sqrt(c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(c*x**S(4)), x), x, sqrt(c*x**S(4))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(c*x**S(4)), x), x, x**S(3)/sqrt(c*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(c*x**S(4)), x), x, x**S(2)*log(x)/sqrt(c*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(c*x**S(4)), x), x, -x/sqrt(c*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(c*x**S(4))), x), x, -S(1)/(S(2)*sqrt(c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(c*x**S(4))), x), x, -S(1)/(S(3)*x*sqrt(c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(c*x**S(4))), x), x, -S(1)/(S(4)*x**S(2)*sqrt(c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(c*x**S(4))), x), x, -S(1)/(S(5)*x**S(3)*sqrt(c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a), x), x, x**S(5)/(S(5)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a), x), x, x**S(4)/(S(4)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a), x), x, x**S(3)/(S(3)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a), x), x, x**S(2)/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a), x), x, x/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a)*x), x), x, log(x)/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a)*x**S(2)), x), x, -S(1)/(sqrt(a)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a)*x**S(3)), x), x, -S(1)/(S(2)*sqrt(a)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a)*x**S(4)), x), x, -S(1)/(S(3)*sqrt(a)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(4) - S(2)*x**S(2) + S(3)), x), x, sqrt(S(3))*elliptic_f(asin(x), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(4) + S(5)*x**S(2) + S(-1)), x), x, -S(21)**(S(3)/4)*elliptic_f(acos(sqrt(S(2))*x/sqrt(sqrt(S(21)) + S(5))), S(1)/2 + S(5)*sqrt(S(21))/S(42))/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*a*x**(S(7)/2)/S(7) + S(2)*b*x**(S(11)/2)/S(11) + S(2)*c*x**(S(15)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*a*x**(S(5)/2)/S(5) + S(2)*b*x**(S(9)/2)/S(9) + S(2)*c*x**(S(13)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*a*x**(S(3)/2)/S(3) + S(2)*b*x**(S(7)/2)/S(7) + S(2)*c*x**(S(11)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/sqrt(x), x), x, S(2)*a*sqrt(x) + S(2)*b*x**(S(5)/2)/S(5) + S(2)*c*x**(S(9)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**(S(3)/2), x), x, -S(2)*a/sqrt(x) + S(2)*b*x**(S(3)/2)/S(3) + S(2)*c*x**(S(7)/2)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**(S(5)/2), x), x, -S(2)*a/(S(3)*x**(S(3)/2)) + S(2)*b*sqrt(x) + S(2)*c*x**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/x**(S(7)/2), x), x, -S(2)*a/(S(5)*x**(S(5)/2)) - S(2)*b/sqrt(x) + S(2)*c*x**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*a**S(2)*x**(S(7)/2)/S(7) + S(4)*a*b*x**(S(11)/2)/S(11) + S(4)*b*c*x**(S(19)/2)/S(19) + S(2)*c**S(2)*x**(S(23)/2)/S(23) + x**(S(15)/2)*(S(4)*a*c/S(15) + S(2)*b**S(2)/S(15)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*a**S(2)*x**(S(5)/2)/S(5) + S(4)*a*b*x**(S(9)/2)/S(9) + S(4)*b*c*x**(S(17)/2)/S(17) + S(2)*c**S(2)*x**(S(21)/2)/S(21) + x**(S(13)/2)*(S(4)*a*c/S(13) + S(2)*b**S(2)/S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*a**S(2)*x**(S(3)/2)/S(3) + S(4)*a*b*x**(S(7)/2)/S(7) + S(4)*b*c*x**(S(15)/2)/S(15) + S(2)*c**S(2)*x**(S(19)/2)/S(19) + x**(S(11)/2)*(S(4)*a*c/S(11) + S(2)*b**S(2)/S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/sqrt(x), x), x, S(2)*a**S(2)*sqrt(x) + S(4)*a*b*x**(S(5)/2)/S(5) + S(4)*b*c*x**(S(13)/2)/S(13) + S(2)*c**S(2)*x**(S(17)/2)/S(17) + x**(S(9)/2)*(S(4)*a*c/S(9) + S(2)*b**S(2)/S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**(S(3)/2), x), x, -S(2)*a**S(2)/sqrt(x) + S(4)*a*b*x**(S(3)/2)/S(3) + S(4)*b*c*x**(S(11)/2)/S(11) + S(2)*c**S(2)*x**(S(15)/2)/S(15) + x**(S(7)/2)*(S(4)*a*c/S(7) + S(2)*b**S(2)/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**(S(5)/2), x), x, -S(2)*a**S(2)/(S(3)*x**(S(3)/2)) + S(4)*a*b*sqrt(x) + S(4)*b*c*x**(S(9)/2)/S(9) + S(2)*c**S(2)*x**(S(13)/2)/S(13) + x**(S(5)/2)*(S(4)*a*c/S(5) + S(2)*b**S(2)/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/x**(S(7)/2), x), x, -S(2)*a**S(2)/(S(5)*x**(S(5)/2)) - S(4)*a*b/sqrt(x) + S(4)*b*c*x**(S(7)/2)/S(7) + S(2)*c**S(2)*x**(S(11)/2)/S(11) + x**(S(3)/2)*(S(4)*a*c/S(3) + S(2)*b**S(2)/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*a**S(3)*x**(S(7)/2)/S(7) + S(6)*a**S(2)*b*x**(S(11)/2)/S(11) + S(2)*a*x**(S(15)/2)*(a*c + b**S(2))/S(5) + S(2)*b*c**S(2)*x**(S(27)/2)/S(9) + S(2)*b*x**(S(19)/2)*(S(6)*a*c + b**S(2))/S(19) + S(2)*c**S(3)*x**(S(31)/2)/S(31) + S(6)*c*x**(S(23)/2)*(a*c + b**S(2))/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*a**S(3)*x**(S(5)/2)/S(5) + S(2)*a**S(2)*b*x**(S(9)/2)/S(3) + S(6)*a*x**(S(13)/2)*(a*c + b**S(2))/S(13) + S(6)*b*c**S(2)*x**(S(25)/2)/S(25) + S(2)*b*x**(S(17)/2)*(S(6)*a*c + b**S(2))/S(17) + S(2)*c**S(3)*x**(S(29)/2)/S(29) + S(2)*c*x**(S(21)/2)*(a*c + b**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*a**S(3)*x**(S(3)/2)/S(3) + S(6)*a**S(2)*b*x**(S(7)/2)/S(7) + S(6)*a*x**(S(11)/2)*(a*c + b**S(2))/S(11) + S(6)*b*c**S(2)*x**(S(23)/2)/S(23) + S(2)*b*x**(S(15)/2)*(S(6)*a*c + b**S(2))/S(15) + S(2)*c**S(3)*x**(S(27)/2)/S(27) + S(6)*c*x**(S(19)/2)*(a*c + b**S(2))/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/sqrt(x), x), x, S(2)*a**S(3)*sqrt(x) + S(6)*a**S(2)*b*x**(S(5)/2)/S(5) + S(2)*a*x**(S(9)/2)*(a*c + b**S(2))/S(3) + S(2)*b*c**S(2)*x**(S(21)/2)/S(7) + S(2)*b*x**(S(13)/2)*(S(6)*a*c + b**S(2))/S(13) + S(2)*c**S(3)*x**(S(25)/2)/S(25) + S(6)*c*x**(S(17)/2)*(a*c + b**S(2))/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**(S(3)/2), x), x, -S(2)*a**S(3)/sqrt(x) + S(2)*a**S(2)*b*x**(S(3)/2) + S(6)*a*x**(S(7)/2)*(a*c + b**S(2))/S(7) + S(6)*b*c**S(2)*x**(S(19)/2)/S(19) + S(2)*b*x**(S(11)/2)*(S(6)*a*c + b**S(2))/S(11) + S(2)*c**S(3)*x**(S(23)/2)/S(23) + S(2)*c*x**(S(15)/2)*(a*c + b**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**(S(5)/2), x), x, -S(2)*a**S(3)/(S(3)*x**(S(3)/2)) + S(6)*a**S(2)*b*sqrt(x) + S(6)*a*x**(S(5)/2)*(a*c + b**S(2))/S(5) + S(6)*b*c**S(2)*x**(S(17)/2)/S(17) + S(2)*b*x**(S(9)/2)*(S(6)*a*c + b**S(2))/S(9) + S(2)*c**S(3)*x**(S(21)/2)/S(21) + S(6)*c*x**(S(13)/2)*(a*c + b**S(2))/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)/x**(S(7)/2), x), x, -S(2)*a**S(3)/(S(5)*x**(S(5)/2)) - S(6)*a**S(2)*b/sqrt(x) + S(2)*a*x**(S(3)/2)*(a*c + b**S(2)) + S(2)*b*c**S(2)*x**(S(15)/2)/S(5) + S(2)*b*x**(S(7)/2)*(S(6)*a*c + b**S(2))/S(7) + S(2)*c**S(3)*x**(S(19)/2)/S(19) + S(6)*c*x**(S(11)/2)*(a*c + b**S(2))/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*x**(S(3)/2)/(S(3)*c) - S(2)**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*sqrt(x)/c + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, S(2)**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(a + b*x**S(2) + c*x**S(4)), x), x, S(2)**(S(1)/4)*c**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*c**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/((-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)**(S(1)/4)*c**(S(1)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*c**(S(1)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)/(a*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(5)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, S(2)**(S(3)/4)*c**(S(3)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)/(S(3)*a*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(7)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)/(S(5)*a*x**(S(5)/2)) + S(2)*b/(a**S(2)*sqrt(x)) + S(2)**(S(1)/4)*c**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*c**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*c**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*x**(S(3)/2)/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**(S(7)/2)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - S(2)**(S(1)/4)*(-S(20)*a*b*c + S(3)*b**S(3) - (-S(14)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(1)/4)*(-S(20)*a*b*c + S(3)*b**S(3) - (-S(14)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(1)/4)*(-S(20)*a*b*c + S(3)*b**S(3) + (-S(14)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(1)/4)*(-S(20)*a*b*c + S(3)*b**S(3) + (-S(14)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -b*sqrt(x)/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**(S(5)/2)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - S(2)**(S(3)/4)*(-S(10)*a*c + b**S(2) - b*(-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-S(10)*a*c + b**S(2) - b*(-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-S(10)*a*c + b**S(2) + b*(-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-S(10)*a*c + b**S(2) + b*(-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, x**(S(3)/2)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + S(2)**(S(1)/4)*(b - (S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*(b - (S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*(S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(1)/4)*(S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, sqrt(x)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + S(2)**(S(3)/4)*(S(4)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(3)/4)*(S(4)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(3)/4)*(S(4)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(3)/4)*(S(4)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)**(S(1)/4)*c**(S(1)/4)*(S(4)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(1)/4)*c**(S(1)/4)*(S(4)*b - sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(1)/4)*c**(S(1)/4)*(S(4)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(1)/4)*c**(S(1)/4)*(S(4)*b + sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - x**(S(3)/2)*(b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)**(S(3)/4)*c**(S(3)/4)*(-S(4)*b/sqrt(-S(4)*a*c + b**S(2)) + S(3))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*(-S(4)*b/sqrt(-S(4)*a*c + b**S(2)) + S(3))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(4)*b/sqrt(-S(4)*a*c + b**S(2)) + S(3))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(4)*b/sqrt(-S(4)*a*c + b**S(2)) + S(3))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))) - sqrt(x)*(b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)**(S(1)/4)*c**(S(1)/4)*(b + (-S(20)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*(b + (-S(20)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*c**(S(1)/4)*(b - (-S(20)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*(b - (-S(20)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))) + x**(S(3)/2)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -S(2)**(S(3)/4)*c**(S(3)/4)*(-S(28)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(3)/4)*c**(S(3)/4)*(-S(28)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-S(28)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-S(28)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(x)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*sqrt(x)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - S(2)**(S(1)/4)*c**(S(1)/4)*(-S(28)*a*b*c + S(5)*b**S(3) + (-S(18)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(1)/4)*c**(S(1)/4)*(-S(28)*a*b*c + S(5)*b**S(3) + (-S(18)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)**(S(1)/4)*c**(S(1)/4)*(-S(28)*a*b*c + S(5)*b**S(3) - (-S(18)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)**(S(1)/4)*c**(S(1)/4)*(-S(28)*a*b*c + S(5)*b**S(3) - (-S(18)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(8)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(18)*a*c + S(5)*b**S(2))/(S(2)*a**S(2)*sqrt(x)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(15)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**(S(9)/2)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(3)*x**(S(5)/2)*(S(8)*a*b + x**S(2)*(S(12)*a*c + b**S(2)))/(S(16)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - sqrt(x)*(S(36)*a*c + S(3)*b**S(2))/(S(16)*c*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(-S(84)*a*b*c + S(3)*b**S(3) - S(3)*(-S(24)*a**S(2)*c**S(2) - S(30)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(-S(84)*a*b*c + S(3)*b**S(3) - S(3)*(-S(24)*a**S(2)*c**S(2) - S(30)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(-S(84)*a*b*c + S(3)*b**S(3) + S(3)*(-S(24)*a**S(2)*c**S(2) - S(30)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(-S(84)*a*b*c + S(3)*b**S(3) + S(3)*(-S(24)*a**S(2)*c**S(2) - S(30)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(13)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**(S(7)/2)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x**(S(3)/2)*(S(24)*a*b + x**S(2)*(S(28)*a*c + S(5)*b**S(2)))/(S(16)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + S(2)**(S(1)/4)*(S(28)*a*c + S(5)*b**S(2) - (S(172)*a*b*c + S(5)*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(1)/4)*(S(28)*a*c + S(5)*b**S(2) - (S(172)*a*b*c + S(5)*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**S(2)) + S(2)**(S(1)/4)*(S(172)*a*b*c + S(5)*b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(28)*a*c + S(5)*b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(2)**(S(1)/4)*(S(172)*a*b*c + S(5)*b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(28)*a*c + S(5)*b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(11)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**(S(5)/2)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + sqrt(x)*(S(24)*a*b + x**S(2)*(S(20)*a*c + S(7)*b**S(2)))/(S(16)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - S(2)**(S(3)/4)*(S(60)*a*c + S(21)*b**S(2) - S(3)*(S(36)*a*b*c + S(7)*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(S(60)*a*c + S(21)*b**S(2) - S(3)*(S(36)*a*b*c + S(7)*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(2)**(S(3)/4)*(S(108)*a*b*c + S(21)*b**S(3) + S(3)*sqrt(-S(4)*a*c + b**S(2))*(S(20)*a*c + S(7)*b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(2)**(S(3)/4)*(S(108)*a*b*c + S(21)*b**S(3) + S(3)*sqrt(-S(4)*a*c + b**S(2))*(S(20)*a*c + S(7)*b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(9)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(20)*a*c + S(11)*b**S(2) - S(4)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(20)*a*c + S(11)*b**S(2) - S(4)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(20)*a*c + S(11)*b**S(2) + S(4)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(20)*a*c + S(11)*b**S(2) + S(4)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x**(S(3)/2)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - S(3)*x**(S(3)/2)*(-S(4)*a*c + S(5)*b**S(2) + S(8)*b*c*x**S(2))/(S(16)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(7)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(2)**(S(3)/4)*c**(S(3)/4)*(S(28)*a*c + S(41)*b**S(2) - S(36)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(2)**(S(3)/4)*c**(S(3)/4)*(S(28)*a*c + S(41)*b**S(2) - S(36)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(28)*a*c + S(41)*b**S(2) + S(36)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(28)*a*c + S(41)*b**S(2) + S(36)*b*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(32)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(x)*(S(2)*a + b*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(x)*(-S(4)*a*c + S(13)*b**S(2) + S(24)*b*c*x**S(2))/(S(16)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(5)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**(S(3)/2)*(b + S(2)*c*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(-S(68)*a*b*c + b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(12)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(-S(68)*a*b*c + b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(12)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(68)*a*b*c/sqrt(-S(4)*a*c + b**S(2)) + S(12)*a*c - b**S(3)/sqrt(-S(4)*a*c + b**S(2)) + b**S(2))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*S(2)**(S(1)/4)*c**(S(1)/4)*(S(68)*a*b*c/sqrt(-S(4)*a*c + b**S(2)) + S(12)*a*c - b**S(3)/sqrt(-S(4)*a*c + b**S(2)) + b**S(2))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**S(2)) + S(3)*x**(S(3)/2)*(b*(S(4)*a*c + b**S(2)) + c*x**S(2)*(S(12)*a*c + b**S(2)))/(S(16)*a*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -sqrt(x)*(b + S(2)*c*x**S(2))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(-S(68)*a*b*c + b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(44)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(-S(68)*a*b*c + b**S(3) + sqrt(-S(4)*a*c + b**S(2))*(S(44)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(68)*a*b*c/sqrt(-S(4)*a*c + b**S(2)) + S(44)*a*c - b**S(3)/sqrt(-S(4)*a*c + b**S(2)) + b**S(2))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(68)*a*b*c/sqrt(-S(4)*a*c + b**S(2)) + S(44)*a*c - b**S(3)/sqrt(-S(4)*a*c + b**S(2)) + b**S(2))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(x)*(b*(S(20)*a*c + b**S(2)) + c*x**S(2)*(S(44)*a*c + b**S(2)))/(S(16)*a*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, x**(S(3)/2)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(2)**(S(1)/4)*c**(S(1)/4)*(S(520)*a**S(2)*c**S(2) - S(54)*a*b**S(2)*c + S(5)*b**S(4) + b*(-S(44)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(2)**(S(1)/4)*c**(S(1)/4)*(S(520)*a**S(2)*c**S(2) - S(54)*a*b**S(2)*c + S(5)*b**S(4) + b*(-S(44)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(2)**(S(1)/4)*c**(S(1)/4)*(S(520)*a**S(2)*c**S(2) - S(54)*a*b**S(2)*c + S(5)*b**S(4) - b*(-S(44)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(2)**(S(1)/4)*c**(S(1)/4)*(S(520)*a**S(2)*c**S(2) - S(54)*a*b**S(2)*c + S(5)*b**S(4) - b*(-S(44)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x**(S(3)/2)*(S(52)*a**S(2)*c**S(2) - S(45)*a*b**S(2)*c + S(5)*b**S(4) + b*c*x**S(2)*(-S(44)*a*c + S(5)*b**S(2)))/(S(16)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, sqrt(x)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(280)*a**S(2)*c**S(2) - S(66)*a*b**S(2)*c + S(7)*b**S(4) + b*(-S(52)*a*c + S(7)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(280)*a**S(2)*c**S(2) - S(66)*a*b**S(2)*c + S(7)*b**S(4) + b*(-S(52)*a*c + S(7)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(280)*a**S(2)*c**S(2) - S(66)*a*b**S(2)*c + S(7)*b**S(4) - b*(-S(52)*a*c + S(7)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*S(2)**(S(3)/4)*c**(S(3)/4)*(S(280)*a**S(2)*c**S(2) - S(66)*a*b**S(2)*c + S(7)*b**S(4) - b*(-S(52)*a*c + S(7)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(x)/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(64)*a**S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(x)*(S(60)*a**S(2)*c**S(2) - S(55)*a*b**S(2)*c + S(7)*b**S(4) + b*c*x**S(2)*(-S(52)*a*c + S(7)*b**S(2)))/(S(16)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*(d*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-1)/2, S(-1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*(d*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-1)/2, S(-1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/sqrt(d*x), x), x, S(2)*sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(1)/4, S(-1)/2, S(-1)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/(d*x)**(S(3)/2), x), x, -S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(-1)/4, S(-1)/2, S(-1)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(d*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*a*(d*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-3)/2, S(-3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*a*(d*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-3)/2, S(-3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/sqrt(d*x), x), x, S(2)*a*sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(1)/4, S(-3)/2, S(-3)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(d*x)**(S(3)/2), x), x, -S(2)*a*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(-1)/4, S(-3)/2, S(-3)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(d*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*(d*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(1)/2, S(1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*(d*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(1)/2, S(1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, S(2)*sqrt(d*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/4, S(1)/2, S(1)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/4, S(1)/2, S(1)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(S(3)/2)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*(d*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(3)/2, S(3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*a*d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d*x)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*(d*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(3)/2, S(3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d*x)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(2)*sqrt(d*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/4, S(3)/2, S(3)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*x)**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -S(2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/4, S(3)/2, S(3)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*sqrt(d*x)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, a**S(3)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(3)*a**S(2)*b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + S(3)*a*(d*x)**(m + S(5))*(a*c + b**S(2))/(d**S(5)*(m + S(5))) + S(3)*b*c**S(2)*(d*x)**(m + S(11))/(d**S(11)*(m + S(11))) + b*(d*x)**(m + S(7))*(S(6)*a*c + b**S(2))/(d**S(7)*(m + S(7))) + c**S(3)*(d*x)**(m + S(13))/(d**S(13)*(m + S(13))) + S(3)*c*(d*x)**(m + S(9))*(a*c + b**S(2))/(d**S(9)*(m + S(9))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(2)*a*b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + S(2)*b*c*(d*x)**(m + S(7))/(d**S(7)*(m + S(7))) + c**S(2)*(d*x)**(m + S(9))/(d**S(9)*(m + S(9))) + (d*x)**(m + S(5))*(S(2)*a*c + b**S(2))/(d**S(5)*(m + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(2) + c*x**S(4)), x), x, a*(d*x)**(m + S(1))/(d*(m + S(1))) + b*(d*x)**(m + S(3))/(d**S(3)*(m + S(3))) + c*(d*x)**(m + S(5))/(d**S(5)*(m + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*c*(d*x)**(m + S(1))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*(d*x)**(m + S(1))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(d*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -c*(d*x)**(m + S(1))*(-S(4)*a*c*(-m + S(3)) + b**S(2)*(-m + S(1)) - b*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*d*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + c*(d*x)**(m + S(1))*(-S(4)*a*c*(-m + S(3)) + b**S(2)*(-m + S(1)) + b*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*d*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (d*x)**(m + S(1))*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*d*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p/x, x), x, S(4)**(p + S(-1))*((b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*((b + S(2)*c*x**S(2) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(-S(2)*p, -p, -p, -S(2)*p + S(1), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)))/p, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p/x**S(3), x), x, -S(2)**(S(2)*p + S(-1))*((b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*((b + S(2)*c*x**S(2) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(-S(2)*p + S(1), -p, -p, -S(2)*p + S(2), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)))/(x**S(2)*(-S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p/x**S(5), x), x, -S(4)**(p + S(-1))*((b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*((b + S(2)*c*x**S(2) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(2)))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(-S(2)*p + S(2), -p, -p, -S(2)*p + S(3), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(2)))/(x**S(4)*(-p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))**p, x), x, x**S(5)*(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(S(5)/2, -p, -p, S(7)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))**p, x), x, x**S(3)*(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(S(3)/2, -p, -p, S(5)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p, x), x, x*(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(S(1)/2, -p, -p, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p/x**S(2), x), x, -(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(S(-1)/2, -p, -p, S(1)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**p/x**S(4), x), x, -(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(S(-3)/2, -p, -p, S(-1)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, a*(d*x)**(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(1)/2, S(-3)/2, S(-3)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, (d*x)**(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(1)/2, S(-1)/2, S(-1)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(1)/2, S(1)/2, S(1)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(1)/2, S(3)/2, S(3)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(2) + c*x**S(4))**p, x), x, (d*x)**(m + S(1))*(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(2) + c*x**S(4))**p*AppellF1(m/S(2) + S(1)/2, -p, -p, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2) + c*x**S(4))**p, x), x, S(2)**(p + S(-1))*b*(-(b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))**(-p + S(-1))*(a + b*x**S(2) + c*x**S(4))**(p + S(1))*hyper((-p, p + S(1)), (p + S(2),), (b + S(2)*c*x**S(2) + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))))/(c*(p + S(1))*sqrt(-S(4)*a*c + b**S(2))) + (a + b*x**S(2) + c*x**S(4))**(p + S(1))/(S(4)*c*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))**p, x), x, -S(2)**p*(-(b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))**(-p + S(-1))*(a + b*x**S(2) + c*x**S(4))**(p + S(1))*hyper((-p, p + S(1)), (p + S(2),), (b + S(2)*c*x**S(2) + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))))/((p + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(3) + b*x**S(6))**(S(5)/3), x), x, -S(3)*a*(a*x**S(3) + b*x**S(6))**(S(8)/3)/(S(88)*b**S(2)*x**S(8)) + (a*x**S(3) + b*x**S(6))**(S(8)/3)/(S(11)*b*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(3) + b*x**S(6))**(S(2)/3), x), x, (a*x**S(3) + b*x**S(6))**(S(5)/3)/(S(5)*b*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(3) + b*x**S(6))**(S(-2)/3), x), x, -(a*x**S(3) + b*x**S(6))**(S(1)/3)/(a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(3) + b*x**S(6))**(S(-5)/3), x), x, S(1)/(S(2)*a*x**S(2)*(a*x**S(3) + b*x**S(6))**(S(2)/3)) - S(3)*(a*x**S(3) + b*x**S(6))**(S(1)/3)/(S(4)*a**S(2)*x**S(5)) + S(9)*b*(a*x**S(3) + b*x**S(6))**(S(1)/3)/(S(4)*a**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6) - x**S(3)), x), x, log(-x + S(1))/S(3) - log(x**S(2) + x + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3) + S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, S(3)*a*x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((a + b*x**S(3))*(m**S(2) + S(5)*m + S(4))) + x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(m + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, a*x**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(18)*a + S(18)*b*x**S(3)) + x**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, S(3)*a*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*a + S(40)*b*x**S(3)) + x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, S(3)*a*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*a + S(28)*b*x**S(3)) + x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, (a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, S(3)*a*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(10)*a + S(10)*b*x**S(3)) + x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, S(3)*a*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(4)*a + S(4)*b*x**S(3)) + x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x, x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(2), x), x, -S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x*(a + b*x**S(3))) + sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(3), x), x, -S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x**S(2)*(a + b*x**S(3))) + sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(4), x), x, -a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*x**S(3)*(a + b*x**S(3))) + b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(5), x), x, S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(4)*x**S(4)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(6), x), x, S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(10)*x**S(5)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(7), x), x, -(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*a*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(8), x), x, S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x**S(7)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(4)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(9), x), x, S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x**S(8)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(10), x), x, a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(18)*x**S(9)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/x**S(11), x), x, S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(70)*x**S(10)*(a + b*x**S(3))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(7)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(162)*a**S(3)*x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((a + b*x**S(3))*(m + S(7))*(m + S(10))*(m**S(2) + S(5)*m + S(4))) + S(54)*a**S(2)*x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((m + S(4))*(m + S(7))*(m + S(10))) + S(9)*a*x**(m + S(1))*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(m**S(2) + S(17)*m + S(70)) + x**(m + S(1))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(m + S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(19760)*a + S(19760)*b*x**S(3)) + S(27)*a**S(2)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(1976) + S(9)*a*x**S(10)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(304) + x**S(10)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, a**S(2)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(36)*b**S(3)) - a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(45)*b**S(3)) + x**S(6)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(18)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(10472)*a + S(10472)*b*x**S(3)) + S(27)*a**S(2)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(1309) + S(9)*a*x**S(8)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(238) + x**S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(7280)*a + S(7280)*b*x**S(3)) + S(27)*a**S(2)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(1040) + S(9)*a*x**S(7)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(208) + x**S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, -a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*b**S(2)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(15)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3080)*a + S(3080)*b*x**S(3)) + S(27)*a**S(2)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(616) + S(9)*a*x**S(5)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(154) + x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1820)*a + S(1820)*b*x**S(3)) + S(27)*a**S(2)*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(455) + S(9)*a*x**S(4)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(130) + x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, (a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(440)*a + S(440)*b*x**S(3)) + S(27)*a**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(220) + S(9)*a*x**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(88) + x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, S(81)*a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(140)*a + S(140)*b*x**S(3)) + S(27)*a**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(140) + S(9)*a*x*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(70) + x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x, x), x, a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) + a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(6) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(2), x), x, -S(81)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x*(a + b*x**S(3))) + S(27)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(8)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(3), x), x, -S(81)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x**S(2)*(a + b*x**S(3))) + S(27)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(14)*x**S(2)) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x**S(2)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(7)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(4), x), x, S(3)*a**S(2)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + a*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)) - a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x**S(3)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(6)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(5), x), x, S(81)*a*b**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(20)*a + S(20)*b*x**S(3)) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(4)*x**S(4)) + S(27)*b**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(10) - S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(2)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(6), x), x, S(81)*a*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(20)*a + S(20)*b*x**S(3)) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(10)*x**S(5)) + S(27)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(20) - S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(10)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(7), x), x, S(3)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2)*x**S(6)) + b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)) - S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(3)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(8), x), x, -S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x**S(7)) + S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x) - S(13)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(28)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(9), x), x, -S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x**S(2)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(40)*x**S(8)) + S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(20)*x**S(2)) - S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(20)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(10), x), x, -a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*x**S(3)*(a + b*x**S(3))) + a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*x**S(9)) + b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) - S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(18)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(11), x), x, S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(140)*x**S(4)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(70)*x**S(10)) - S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(35)*x**S(4)) - S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(35)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(12), x), x, S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(440)*x**S(5)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(88)*x**S(11)) - S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(88)*x**S(5)) - S(17)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(88)*x**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(13), x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*a*x**S(12)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(14), x), x, S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1820)*x**S(7)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(130)*x**S(13)) - S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(260)*x**S(7)) - S(19)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(130)*x**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(15), x), x, S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3080)*x**S(8)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(154)*x**S(14)) - S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(385)*x**S(8)) - S(10)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(77)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(16), x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*a*x**S(15)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(60)*a**S(2)*x**S(15)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/x**S(17), x), x, S(81)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(7280)*x**S(10)*(a + b*x**S(3))) + S(9)*a*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(208)*x**S(16)) - S(27)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(728)*x**S(10)) - S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(104)*x**S(16)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(29160)*a**S(5)*x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((a + b*x**S(3))*(m + S(7))*(m + S(10))*(m + S(13))*(m + S(16))*(m**S(2) + S(5)*m + S(4))) + S(9720)*a**S(4)*x**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((m + S(4))*(m + S(7))*(m + S(10))*(m + S(13))*(m + S(16))) + S(1620)*a**S(3)*x**(m + S(1))*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/((m + S(13))*(m + S(16))*(m**S(2) + S(17)*m + S(70))) + S(180)*a**S(2)*x**(m + S(1))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/((m + S(10))*(m + S(13))*(m + S(16))) + S(15)*a*x**(m + S(1))*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(m**S(2) + S(29)*m + S(208)) + x**(m + S(1))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(m + S(16)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(13)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(14)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2063698)*a + S(2063698)*b*x**S(3)) + S(243)*a**S(4)*x**S(14)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(147407) + S(81)*a**S(3)*x**S(14)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(17342) + S(90)*a**S(2)*x**S(14)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(8671) + S(15)*a*x**S(14)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(754) + x**S(14)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(29), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(12)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(13)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1521520)*a + S(1521520)*b*x**S(3)) + S(243)*a**S(4)*x**S(13)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(117040) + S(81)*a**S(3)*x**S(13)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(14630) + S(9)*a**S(2)*x**S(13)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(770) + S(3)*a*x**S(13)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(140) + x**S(13)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, -a**S(3)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(216)*b**S(4)) + a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(7)/2)/(S(252)*b**S(4)) - a*x**S(6)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(72)*b**S(2)) + x**S(9)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(27)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(11)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(782782)*a + S(782782)*b*x**S(3)) + S(243)*a**S(4)*x**S(11)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(71162) + S(81)*a**S(3)*x**S(11)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(10166) + S(9)*a**S(2)*x**S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(598) + S(15)*a*x**S(11)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(598) + x**S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(26), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(543400)*a + S(543400)*b*x**S(3)) + S(243)*a**S(4)*x**S(10)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(54340) + S(81)*a**S(3)*x**S(10)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(8360) + S(18)*a**S(2)*x**S(10)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(1045) + S(3)*a*x**S(10)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(110) + x**S(10)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, a**S(2)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(72)*b**S(3)) - a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(7)/2)/(S(84)*b**S(3)) + x**S(6)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(24)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(240856)*a + S(240856)*b*x**S(3)) + S(243)*a**S(4)*x**S(8)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(30107) + S(81)*a**S(3)*x**S(8)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(5474) + S(9)*a**S(2)*x**S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(391) + S(3)*a*x**S(8)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(92) + x**S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(152152)*a + S(152152)*b*x**S(3)) + S(243)*a**S(4)*x**S(7)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(21736) + S(405)*a**S(3)*x**S(7)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(21736) + S(45)*a**S(2)*x**S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(1672) + S(15)*a*x**S(7)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(418) + x**S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(22), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, -a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(18)*b**S(2)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(7)/2)/(S(21)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(52360)*a + S(52360)*b*x**S(3)) + S(243)*a**S(4)*x**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(10472) + S(81)*a**S(3)*x**S(5)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(2618) + S(9)*a**S(2)*x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(238) + S(3)*a*x**S(5)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(68) + x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(20), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(27664)*a + S(27664)*b*x**S(3)) + S(243)*a**S(4)*x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(6916) + S(81)*a**S(3)*x**S(4)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(1976) + S(45)*a**S(2)*x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(988) + S(15)*a*x**S(4)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(304) + x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(19), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, (a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(18)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5236)*a + S(5236)*b*x**S(3)) + S(243)*a**S(4)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(2618) + S(405)*a**S(3)*x**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(5236) + S(90)*a**S(2)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(1309) + S(15)*a*x**S(2)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(238) + x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, S(729)*a**S(5)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1456)*a + S(1456)*b*x**S(3)) + S(243)*a**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(1456) + S(81)*a**S(3)*x*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(728) + S(9)*a**S(2)*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(104) + S(15)*a*x*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(208) + x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x, x), x, a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) + a**S(3)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(6) + a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(9) + a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(12) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(2), x), x, -S(729)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(308)*x*(a + b*x**S(3))) + S(243)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(308)*x) + S(81)*a**S(3)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(308)*x) + S(45)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(308)*x) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(154)*x) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(14)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(3), x), x, -S(729)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(182)*x**S(2)*(a + b*x**S(3))) + S(243)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(91)*x**S(2)) + S(81)*a**S(3)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(182)*x**S(2)) + S(18)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(91)*x**S(2)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(26)*x**S(2)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(13)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(4), x), x, S(5)*a**S(4)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + S(5)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) + S(5)*a**S(2)*b*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(6) + S(5)*a*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(9) - S(5)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*x**S(3)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(12)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(5), x), x, S(729)*a**S(3)*b**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(88)*a + S(88)*b*x**S(3)) + S(243)*a**S(2)*b**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(44) + S(405)*a*b**S(2)*x**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(88) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(4)*x**S(4)) + S(45)*b**S(2)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(11) - S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(6), x), x, S(729)*a**S(3)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(70)*a + S(70)*b*x**S(3)) + S(243)*a**S(2)*b**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(70) + S(81)*a*b**S(2)*x*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(35) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(2)*x**S(5)) + S(9)*b**S(2)*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(5) - S(17)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(10)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(7), x), x, S(10)*a**S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + S(10)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) + S(5)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) + S(5)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(6)*x**S(6)) + S(10)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/S(9) - (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(8), x), x, -S(729)*a**S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(56)*x*(a + b*x**S(3))) + S(243)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(56)*x) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(56)*x) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(28)*x**S(7)) + S(45)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(56)*x) - S(19)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(28)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(9), x), x, -S(729)*a**S(3)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(56)*x**S(2)*(a + b*x**S(3))) + S(243)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(28)*x**S(2)) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(56)*x**S(2)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(8)*x**S(8)) + S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(14)*x**S(2)) - (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(2)*x**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(10), x), x, S(10)*a**S(2)*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + S(10)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) - S(5)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*x**S(3)) + S(5)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(18)*x**S(9)) + S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(9)*x**S(3)) - S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(18)*x**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(11), x), x, S(729)*a*b**S(4)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(70)*a + S(70)*b*x**S(3)) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(14)*x**S(4)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(14)*x**S(10)) + S(243)*b**S(4)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(35) - S(45)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(7)*x**S(4)) - S(11)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(35)*x**S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(12), x), x, S(729)*a*b**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(88)*a + S(88)*b*x**S(3)) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(44)*x**S(5)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(88)*x**S(11)) + S(243)*b**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(88) - S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(4)*x**S(5)) - S(23)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(88)*x**S(11)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(13), x), x, S(5)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) + S(5)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*x**S(6)) + S(5)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(36)*x**S(12)) + S(5)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/S(3) - S(10)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(9)*x**S(6)) - S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(9)*x**S(12)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(14), x), x, -S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(182)*x*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(182)*x**S(7)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(26)*x**S(13)) + S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(182)*x) - S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(14)*x**S(7)) - S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(26)*x**S(13)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(15), x), x, -S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(308)*x**S(2)*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(308)*x**S(8)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(154)*x**S(14)) + S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(154)*x**S(2)) - S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(22)*x**S(8)) - S(13)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(77)*x**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(16), x), x, -a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*x**S(3)*(a + b*x**S(3))) + a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6)*x**S(9)) + a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(12)*x**S(15)) + b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))*log(x)/(a + b*x**S(3)) - S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(18)*x**S(9)) - S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(20)*x**S(15)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(17), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1456)*x**S(4)*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(728)*x**S(10)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(208)*x**S(16)) - S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(364)*x**S(4)) - S(18)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(91)*x**S(10)) - S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(52)*x**S(16)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(18), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5236)*x**S(5)*(a + b*x**S(3))) + S(405)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5236)*x**S(11)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(238)*x**S(17)) - S(1215)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5236)*x**S(5)) - S(45)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(308)*x**S(11)) - S(29)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(238)*x**S(17)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(19), x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(18)*a*x**S(18)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(20), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(27664)*x**S(7)*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(1976)*x**S(13)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(304)*x**S(19)) - S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3952)*x**S(7)) - S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(104)*x**S(13)) - S(31)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(304)*x**S(19)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(21), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(52360)*x**S(8)*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(2618)*x**S(14)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(68)*x**S(20)) - S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(6545)*x**S(8)) - S(90)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(1309)*x**S(14)) - S(8)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(85)*x**S(20)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(22), x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(18)*a*x**S(21)) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(7)/2)/(S(126)*a**S(2)*x**S(21)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(23), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(152152)*x**S(10)*(a + b*x**S(3))) + S(405)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(21736)*x**S(16)) + S(15)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(418)*x**S(22)) - S(1215)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(76076)*x**S(10)) - S(45)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(988)*x**S(16)) - S(17)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(209)*x**S(22)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(24), x), x, S(729)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(240856)*x**S(11)*(a + b*x**S(3))) + S(81)*a*b**S(2)*(a + b*x**S(3))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(5474)*x**S(17)) + S(3)*a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(92)*x**S(23)) - S(243)*b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(21896)*x**S(11)) - S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)/(S(238)*x**S(17)) - S(7)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(92)*x**S(23)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/x**S(25), x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(24)*a*x**S(24)) + b*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)/(S(72)*a**S(2)*x**S(21)) - b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(7)/2)/(S(504)*a**S(3)*x**S(21)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, x**(m + S(1))*(a + b*x**S(3))*hyper((S(1), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -b*x**S(3)/a)/(a*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, a**(S(2)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - a**(S(2)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + sqrt(S(3))*a**(S(2)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + x**S(2)*(a + b*x**S(3))/(S(2)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, -a**(S(1)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + a**(S(1)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + sqrt(S(3))*a**(S(1)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + x*(a + b*x**S(3))/(b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, (a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, -(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*a**(S(1)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(1)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6)), x), x, (a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*a**(S(2)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*a**(S(2)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), x), x, (a + b*x**S(3))*log(x)/(a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), x), x, -(a + b*x**S(3))/(a*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*a**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*a**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + sqrt(S(3))*b**(S(1)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), x), x, (-a - b*x**S(3))/(S(2)*a*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*a**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*a**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + sqrt(S(3))*b**(S(2)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), x), x, -b*(a + b*x**S(3))*log(x)/(a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + b*(a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*a**S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, x**(m + S(1))*(a + b*x**S(3))*hyper((S(3), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -b*x**S(3)/a)/(a**S(3)*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, x**S(5)*(a + b*x**S(3))/(S(6)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) - x**S(2)/(S(18)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(4)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(54)*a**(S(4)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(4)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, x**S(4)*(a + b*x**S(3))/(S(6)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) - x/(S(9)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(5)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(54)*a**(S(5)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(5)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, (-a - b*x**S(3))/(S(6)*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2), x), x, x**S(2)*(a + b*x**S(3))/(S(6)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(2)*x**S(2)/(S(9)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(27)*a**(S(7)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(2)*a + S(2)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(7)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(2)*a + S(2)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(7)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(-3)/2), x), x, x*(a + b*x**S(3))/(S(6)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(5)*x/(S(18)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(5)*a + S(5)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(8)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(5)*a + S(5)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(54)*a**(S(8)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(5)*a + S(5)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(8)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), x), x, (a + b*x**S(3))/(S(6)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(1)/(S(3)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(x)/(a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), x), x, (a + b*x**S(3))/(S(6)*a*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(7)/(S(18)*a**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(14)*a + S(14)*b*x**S(3))/(S(9)*a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(14)*b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(10)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(7)*b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(27)*a**(S(10)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(14)*sqrt(S(3))*b**(S(1)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(10)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), x), x, (a + b*x**S(3))/(S(6)*a*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(4)/(S(9)*a**S(2)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(10)*a + S(10)*b*x**S(3))/(S(9)*a**S(3)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(20)*b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(27)*a**(S(11)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(10)*b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(27)*a**(S(11)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(20)*sqrt(S(3))*b**(S(2)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(11)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), x), x, (a + b*x**S(3))/(S(6)*a*x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(1)/(S(2)*a**S(2)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(3)*b*(a + b*x**S(3))*log(x)/(a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + b*(a + b*x**S(3))*log(a + b*x**S(3))/(a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(a**S(4)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, x**(m + S(1))*(a + b*x**S(3))*hyper((S(5), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -b*x**S(3)/a)/(a**S(5)*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, a*x*(a + b*x**S(3))/(S(12)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) - S(13)*x/(S(108)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + x*(a + b*x**S(3))/(S(162)*a*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(5)*x/(S(486)*a**S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(5)*a + S(5)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(8)/3)*b**(S(7)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(5)*a + S(5)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(1458)*a**(S(8)/3)*b**(S(7)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(5)*a + S(5)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(8)/3)*b**(S(7)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, a*(a + b*x**S(3))/(S(12)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) - S(1)/(S(9)*b**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, x**S(5)*(a + b*x**S(3))/(S(12)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) - S(7)*x**S(2)/(S(108)*a*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(7)*x**S(2)*(a + b*x**S(3))/(S(324)*a**S(2)*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(7)*x**S(2)/(S(243)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(7)*a + S(7)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(10)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(7)*a + S(7)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(1458)*a**(S(10)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(7)*a + S(7)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(10)/3)*b**(S(5)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, x**S(4)*(a + b*x**S(3))/(S(12)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) - S(2)*x/(S(27)*a*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + x*(a + b*x**S(3))/(S(81)*a**S(2)*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(5)*x/(S(243)*a**S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(5)*a + S(5)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(729)*a**(S(11)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(10)*a + S(10)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(11)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(10)*a + S(10)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(11)/3)*b**(S(4)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, (-a - b*x**S(3))/(S(12)*b*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2), x), x, x**S(2)*(a + b*x**S(3))/(S(12)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(5)*x**S(2)/(S(54)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(35)*x**S(2)*(a + b*x**S(3))/(S(324)*a**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(35)*x**S(2)/(S(243)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(35)*a + S(35)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(13)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(35)*a + S(35)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(1458)*a**(S(13)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(35)*a + S(35)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(13)/3)*b**(S(2)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(-5)/2), x), x, x*(a + b*x**S(3))/(S(12)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(11)*x/(S(108)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(11)*x*(a + b*x**S(3))/(S(81)*a**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(55)*x/(S(243)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(55)*a + S(55)*b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(729)*a**(S(14)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (S(110)*a + S(110)*b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(14)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - sqrt(S(3))*(S(110)*a + S(110)*b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(14)/3)*b**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)), x), x, (a + b*x**S(3))/(S(12)*a*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(1)/(S(9)*a**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + (a + b*x**S(3))/(S(6)*a**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(1)/(S(3)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + (a + b*x**S(3))*log(x)/(a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*a**S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)), x), x, (a + b*x**S(3))/(S(12)*a*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(13)/(S(108)*a**S(2)*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + (S(65)*a + S(65)*b*x**S(3))/(S(324)*a**S(3)*x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(455)/(S(972)*a**S(4)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(455)*a + S(455)*b*x**S(3))/(S(243)*a**S(5)*x*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(455)*b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(16)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(455)*b**(S(1)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(1458)*a**(S(16)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(455)*sqrt(S(3))*b**(S(1)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(16)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)), x), x, (a + b*x**S(3))/(S(12)*a*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(7)/(S(54)*a**S(2)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + (S(77)*a + S(77)*b*x**S(3))/(S(324)*a**S(3)*x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(154)/(S(243)*a**S(4)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - (S(385)*a + S(385)*b*x**S(3))/(S(243)*a**S(5)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(770)*b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(729)*a**(S(17)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(385)*b**(S(2)/3)*(a + b*x**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(729)*a**(S(17)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(770)*sqrt(S(3))*b**(S(2)/3)*(a + b*x**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(729)*a**(S(17)/3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)), x), x, (a + b*x**S(3))/(S(12)*a*x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(5)/2)) + S(5)/(S(36)*a**S(2)*x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + (S(5)*a + S(5)*b*x**S(3))/(S(18)*a**S(3)*x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(S(3)/2)) + S(5)/(S(6)*a**S(4)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(5)*b*(a + b*x**S(3))*log(x)/(a**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) + S(5)*b*(a + b*x**S(3))*log(a + b*x**S(3))/(S(3)*a**S(6)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))) - S(5)*sqrt(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))/(S(3)*a**S(6)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**(m + S(1))*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(1), m/S(3) + S(2)*p + S(4)/3), (m/S(3) + S(4)/3,), -b*x**S(3)/a)/(a*(m + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**m*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**(m + S(1))*(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((m/S(3) + S(1)/3, -S(2)*p), (m/S(3) + S(4)/3,), -b*x**S(3)/a)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, -a*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/(S(3)*b**S(2)*(S(2)*p + S(1))) + (a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**(p + S(1))/(S(6)*b**S(2)*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**S(5)*(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(5)/3, -S(2)*p), (S(8)/3,), -b*x**S(3)/a)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**S(4)*(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(4)/3, -S(2)*p), (S(7)/3,), -b*x**S(3)/a)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, (a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/(S(3)*b*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**S(2)*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(1), S(2)*p + S(5)/3), (S(5)/3,), -b*x**S(3)/a)/(S(2)*a), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x**S(2)*(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(2)/3, -S(2)*p), (S(5)/3,), -b*x**S(3)/a)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(1), S(2)*p + S(4)/3), (S(4)/3,), -b*x**S(3)/a)/a, expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p, x), x, x*(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(1)/3, -S(2)*p), (S(4)/3,), -b*x**S(3)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/x, x), x, -(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(1), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**S(3)/a)/(S(3)*a*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/x**S(2), x), x, -(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(-1)/3, -S(2)*p), (S(2)/3,), -b*x**S(3)/a)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/x**S(3), x), x, -(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(-2)/3, -S(2)*p), (S(1)/3,), -b*x**S(3)/a)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/x**S(4), x), x, b*(a + b*x**S(3))*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(2), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**S(3)/a)/(S(3)*a**S(2)*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p/x**S(5), x), x, -(S(1) + b*x**S(3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**S(3) + b**S(2)*x**S(6))**p*hyper((S(-4)/3, -S(2)*p), (S(-1)/3,), -b*x**S(3)/a)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a + b*x**S(3) + c*x**S(6)), x), x, -b*log(a + b*x**S(3) + c*x**S(6))/(S(6)*c**S(2)) + x**S(3)/(S(3)*c) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(3) + c*x**S(6)), x), x, b*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x**S(3) + c*x**S(6))/(S(6)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(3) + c*x**S(6)), x), x, -S(2)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(3) + c*x**S(6))), x), x, b*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x**S(3) + c*x**S(6))/(S(6)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a + b*x**S(3) + c*x**S(6))), x), x, -S(1)/(S(3)*a*x**S(3)) - b*log(x)/a**S(2) + b*log(a + b*x**S(3) + c*x**S(6))/(S(6)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(3) + c*x**S(6)), x), x, x**S(2)/(S(2)*c) + S(2)**(S(1)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(3) + c*x**S(6)), x), x, x/c - S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(3) + c*x**S(6)), x), x, S(2)**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/3)*sqrt(S(3))*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*sqrt(S(3))*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(3) + c*x**S(6)), x), x, -S(2)**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*sqrt(S(3))*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*sqrt(S(3))*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(3) + c*x**S(6)), x), x, S(2)**(S(1)/3)*c**(S(1)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*c**(S(1)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(6)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*c**(S(1)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/3)*c**(S(1)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(6)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**S(3) + c*x**S(6)), x), x, -S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(6)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(6)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(3) + c*x**S(6))), x), x, S(2)**(S(1)/3)*c**(S(1)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*c**(S(1)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*c**(S(1)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*c**(S(1)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(1)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(3) + c*x**S(6))), x), x, -S(2)**(S(2)/3)*c**(S(2)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*c**(S(2)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*c**(S(2)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*c**(S(2)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(1)/(S(2)*a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x**S(6)/S(6) - S(4)*x**S(3)/S(3) - log(x**S(3) + S(1))/S(6) + S(9)*log(x**S(3) + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x**S(3)/S(3) + log(x**S(3) + S(1))/S(6) - S(3)*log(x**S(3) + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, -log(x**S(3) + S(1))/S(6) + log(x**S(3) + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, -atanh(x**S(3) + S(2))/S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, log(x**S(3) + S(1))/S(6) - log(x**S(3) + S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, log(x)/S(3) - log(x**S(3) + S(1))/S(6) + log(x**S(3) + S(3))/S(18), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, -S(4)*log(x)/S(9) + log(x**S(3) + S(1))/S(6) - log(x**S(3) + S(3))/S(54) - S(1)/(S(9)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, S(13)*log(x)/S(27) - log(x**S(3) + S(1))/S(6) + log(x**S(3) + S(3))/S(162) + S(4)/(S(27)*x**S(3)) - S(1)/(S(18)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x**S(5)/S(5) - S(2)*x**S(2) + log(x + S(1))/S(6) - S(3)*S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(2) - log(x**S(2) - x + S(1))/S(12) + S(3)*S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(4) - S(9)*S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x**S(4)/S(4) - S(4)*x - log(x + S(1))/S(6) + S(3)*S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(2) + log(x**S(2) - x + S(1))/S(12) - S(3)*S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(4) - S(3)*S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x**S(2)/S(2) - log(x + S(1))/S(6) + S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(2) + log(x**S(2) - x + S(1))/S(12) - S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(4) + S(3)*S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(2) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, x + log(x + S(1))/S(6) - S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(2) - log(x**S(2) - x + S(1))/S(12) + S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(4) + S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(2) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, log(x + S(1))/S(6) - S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(6) - log(x**S(2) - x + S(1))/S(12) + S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(12) - S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, -log(x + S(1))/S(6) + S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(6) + log(x**S(2) - x + S(1))/S(12) - S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(12) - S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, -log(x + S(1))/S(6) + S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(18) + log(x**S(2) - x + S(1))/S(12) - S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(36) + S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6) + S(4)*x**S(3) + S(3)), x), x, log(x + S(1))/S(6) - S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(18) - log(x**S(2) - x + S(1))/S(12) + S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(36) + S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(18) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, log(x + S(1))/S(6) - S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(54) - log(x**S(2) - x + S(1))/S(12) + S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(108) - S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(18) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) - S(1)/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, -log(x + S(1))/S(6) + S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(54) + log(x**S(2) - x + S(1))/S(12) - S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(108) - S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(54) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) - S(1)/(S(6)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, -log(x + S(1))/S(6) + S(3)**(S(2)/3)*log(x + S(3)**(S(1)/3))/S(162) + log(x**S(2) - x + S(1))/S(12) - S(3)**(S(2)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(324) + S(3)**(S(1)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(54) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + S(4)/(S(9)*x) - S(1)/(S(12)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(6) + S(4)*x**S(3) + S(3))), x), x, log(x + S(1))/S(6) - S(3)**(S(1)/3)*log(x + S(3)**(S(1)/3))/S(162) - log(x**S(2) - x + S(1))/S(12) + S(3)**(S(1)/3)*log(x**S(2) - S(3)**(S(1)/3)*x + S(3)**(S(2)/3))/S(324) + S(3)**(S(5)/6)*atan(S(3)**(S(1)/6)*(-S(2)*x + S(3)**(S(1)/3))/S(3))/S(162) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + S(2)/(S(9)*x**S(2)) - S(1)/(S(15)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(6) - x**S(3) + S(1)), x), x, x + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(6) - x**S(3) + S(1)), x), x, log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(6) - x**S(3) + S(1)), x), x, S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(6) - x**S(3) + S(1)), x), x, S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(6) - x**S(3) + S(1)), x), x, -S(2)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(6) - x**S(3) + S(1)), x), x, sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3)) - sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3)) - I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6) - x**S(3) + S(1)), x), x, -(S(-1))**(S(5)/18)*sqrt(S(3))*(S(3)*log(-x + (S(-1))**(S(1)/9)) + log(S(2)))/S(27) + (S(-1))**(S(13)/18)*sqrt(S(3))*log(-S(2)**(S(1)/3)*(x + (S(-1))**(S(8)/9)))/S(9) - (S(-1))**(S(13)/18)*sqrt(S(3))*log(-S(2)**(S(2)/3)*(x*(-x + (S(-1))**(S(8)/9)) + (S(-1))**(S(7)/9)))/S(18) + (S(-1))**(S(5)/18)*sqrt(S(3))*log(S(2)**(S(2)/3)*(x*(x + (S(-1))**(S(1)/9)) + (S(-1))**(S(2)/9)))/S(18) - (S(-1))**(S(13)/18)*atan(sqrt(S(3))*(S(2)*(S(-1))**(S(1)/9)*x + S(1))/S(3))/S(3) + (S(-1))**(S(5)/18)*atan(sqrt(S(3))*(-S(2)*(S(-1))**(S(8)/9)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(6) - x**S(3) + S(1)), x), x, sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(2)/3)) - sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(2)/3)) + I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(6) - x**S(3) + S(1))), x), x, log(x) - log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(6) - x**S(3) + S(1))), x), x, -S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(6) - x**S(3) + S(1))), x), x, -S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(6) - x**S(3) + S(1))), x), x, log(x) - log(x**S(6) - x**S(3) + S(1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9) - S(1)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(6) - x**S(3) + S(1))), x), x, -S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(1)/x - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6) + x**S(3) + S(2)), x), x, -sqrt(S(7))*I*log(S(2)**(S(1)/3)*x + (S(1) - sqrt(S(7))*I)**(S(1)/3))/(S(21)*(S(1)/2 - sqrt(S(7))*I/S(2))**(S(2)/3)) + sqrt(S(7))*I*log(S(2)**(S(1)/3)*x + (S(1) + sqrt(S(7))*I)**(S(1)/3))/(S(21)*(S(1)/2 + sqrt(S(7))*I/S(2))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(7))*I*log(S(2)**(S(2)/3)*x**S(2) - x*(S(2) - S(2)*sqrt(S(7))*I)**(S(1)/3) + (S(1) - sqrt(S(7))*I)**(S(2)/3))/(S(42)*(S(1) - sqrt(S(7))*I)**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(7))*I*log(S(2)**(S(2)/3)*x**S(2) - x*(S(2) + S(2)*sqrt(S(7))*I)**(S(1)/3) + (S(1) + sqrt(S(7))*I)**(S(2)/3))/(S(42)*(S(1) + sqrt(S(7))*I)**(S(2)/3)) + sqrt(S(21))*I*atan(sqrt(S(3))*(-S(2)*x/(S(1)/2 - sqrt(S(7))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(21)*(S(1)/2 - sqrt(S(7))*I/S(2))**(S(2)/3)) - sqrt(S(21))*I*atan(sqrt(S(3))*(-S(2)*x/(S(1)/2 + sqrt(S(7))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(21)*(S(1)/2 + sqrt(S(7))*I/S(2))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(6) + x**S(3) + S(2)), x), x, S(2)*sqrt(S(7))*atan(sqrt(S(7))*(S(2)*x**S(3) + S(1))/S(7))/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(6) + x**S(3) + S(2)), x), x, S(2)**(S(2)/3)*(S(7) + sqrt(S(7))*I)*log(S(2)**(S(1)/3)*x + (S(1) - sqrt(S(7))*I)**(S(1)/3))/(S(42)*(S(1) - sqrt(S(7))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(7) - sqrt(S(7))*I)*log(S(2)**(S(1)/3)*x + (S(1) + sqrt(S(7))*I)**(S(1)/3))/(S(42)*(S(1) + sqrt(S(7))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(7) + sqrt(S(7))*I)*log(S(2)**(S(2)/3)*x**S(2) - x*(S(2) - S(2)*sqrt(S(7))*I)**(S(1)/3) + (S(1) - sqrt(S(7))*I)**(S(2)/3))/(S(84)*(S(1) - sqrt(S(7))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(7) - sqrt(S(7))*I)*log(S(2)**(S(2)/3)*x**S(2) - x*(S(2) + S(2)*sqrt(S(7))*I)**(S(1)/3) + (S(1) + sqrt(S(7))*I)**(S(2)/3))/(S(84)*(S(1) + sqrt(S(7))*I)**(S(2)/3)) - sqrt(S(21))*I*(S(1)/2 - sqrt(S(7))*I/S(2))**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*x/(S(1)/2 - sqrt(S(7))*I/S(2))**(S(1)/3) + S(1))/S(3))/S(21) + sqrt(S(21))*I*(S(1)/2 + sqrt(S(7))*I/S(2))**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*x/(S(1)/2 + sqrt(S(7))*I/S(2))**(S(1)/3) + S(1))/S(3))/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*x**S(6)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(20)*c**S(2)) + x**S(9)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(18)*c) - (S(7)*b*(-S(28)*a*c + S(15)*b**S(2)) - S(6)*c*x**S(3)*(-S(20)*a*c + S(21)*b**S(2)))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(2880)*c**S(4)) + (b + S(2)*c*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))*(S(16)*a**S(2)*c**S(2) - S(56)*a*b**S(2)*c + S(21)*b**S(4))/(S(1536)*c**S(5)) - (-S(4)*a*c + b**S(2))*(S(16)*a**S(2)*c**S(2) - S(56)*a*b**S(2)*c + S(21)*b**S(4))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3072)*c**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*(b + S(2)*c*x**S(3))*(-S(12)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(384)*c**S(4)) + b*(-S(12)*a*c + S(7)*b**S(2))*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(768)*c**(S(9)/2)) + x**S(6)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(15)*c) + (a + b*x**S(3) + c*x**S(6))**(S(3)/2)*(-S(32)*a*c + S(35)*b**S(2) - S(42)*b*c*x**S(3))/(S(720)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -S(5)*b*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(72)*c**S(2)) + x**S(3)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(12)*c) + (b + S(2)*c*x**S(3))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(192)*c**S(3)) - (-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(384)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*(b + S(2)*c*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(24)*c**S(2)) + b*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*c**(S(5)/2)) + (a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(9)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, (b + S(2)*c*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*c) - (-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(24)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x, x), x, -sqrt(a)*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(3) + b*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(6)*sqrt(c)) + sqrt(a + b*x**S(3) + c*x**S(6))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(4), x), x, sqrt(c)*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(3) - sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*x**S(3)) - b*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(6)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(7), x), x, -(S(2)*a + b*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*a*x**S(6)) + (-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(24)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(10), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(9)*a*x**S(9)) + b*(S(2)*a + b*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(24)*a**S(2)*x**S(6)) - b*(-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(13), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(12)*a*x**S(12)) + S(5)*b*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(72)*a**S(2)*x**S(9)) - (S(2)*a + b*x**S(3))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(192)*a**S(3)*x**S(6)) + (-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(384)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(16), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(15)*a*x**S(15)) + S(7)*b*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(120)*a**S(2)*x**S(12)) - (-S(32)*a*c + S(35)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(720)*a**S(3)*x**S(9)) + b*(S(2)*a + b*x**S(3))*(-S(12)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(384)*a**S(4)*x**S(6)) - b*(-S(12)*a*c + S(7)*b**S(2))*(-S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(768)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x**S(4)*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(4)/3, S(-1)/2, S(-1)/2, S(7)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(2)/3, S(-1)/2, S(-1)/2, S(5)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(1)/3, S(-1)/2, S(-1)/2, S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(2), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(-1)/3, S(-1)/2, S(-1)/2, S(2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(3) + c*x**S(6))/x**S(3), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(-2)/3, S(-1)/2, S(-1)/2, S(1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, a*x**S(4)*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(4)/3, S(-3)/2, S(-3)/2, S(7)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, a*x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(2)/3, S(-3)/2, S(-3)/2, S(5)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, a*x*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(1)/3, S(-3)/2, S(-3)/2, S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(2), x), x, -a*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(-1)/3, S(-3)/2, S(-3)/2, S(2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(3), x), x, -a*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(S(-2)/3, S(-3)/2, S(-3)/2, S(1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x**S(4)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(4)/3, S(1)/2, S(1)/2, S(7)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x**S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/3, S(1)/2, S(1)/2, S(5)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, x*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/3, S(1)/2, S(1)/2, S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/sqrt(a + b*x**S(3) + c*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/3, S(1)/2, S(1)/2, S(2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-2)/3, S(1)/2, S(1)/2, S(1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, x**S(4)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(4)/3, S(3)/2, S(3)/2, S(7)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, x**S(2)*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/3, S(3)/2, S(3)/2, S(5)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(-3)/2), x), x, x*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/3, S(3)/2, S(3)/2, S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, -sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/3, S(3)/2, S(3)/2, S(2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*x*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, -sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-2)/3, S(3)/2, S(3)/2, S(1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*x**S(2)*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, a*(d*x)**(m + S(1))*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(m/S(3) + S(1)/3, S(-3)/2, S(-3)/2, m/S(3) + S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*sqrt(a + b*x**S(3) + c*x**S(6)), x), x, (d*x)**(m + S(1))*sqrt(a + b*x**S(3) + c*x**S(6))*AppellF1(m/S(3) + S(1)/3, S(-1)/2, S(-1)/2, m/S(3) + S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(3) + S(1)/3, S(1)/2, S(1)/2, m/S(3) + S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(3) + S(1)/3, S(3)/2, S(3)/2, m/S(3) + S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*(m + S(1))*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(3) + c*x**S(6))**p, x), x, (d*x)**(m + S(1))*(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(m/S(3) + S(1)/3, -p, -p, m/S(3) + S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(3) + c*x**S(6))**p, x), x, x**S(5)*(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(5)/3, -p, -p, S(8)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(3) + c*x**S(6))**p, x), x, x**S(4)*(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(4)/3, -p, -p, S(7)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(3) + c*x**S(6))**p, x), x, x**S(2)*(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(2)/3, -p, -p, S(5)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p, x), x, x*(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(1)/3, -p, -p, S(4)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x, x), x, S(2)**(S(2)*p + S(-1))*((b + S(2)*c*x**S(3) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*((b + S(2)*c*x**S(3) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(-S(2)*p, -p, -p, -S(2)*p + S(1), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)))/(S(3)*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(2), x), x, -(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(-1)/3, -p, -p, S(2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(3), x), x, -(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(-2)/3, -p, -p, S(1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(4), x), x, -S(4)**p*((b + S(2)*c*x**S(3) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*((b + S(2)*c*x**S(3) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(-S(2)*p + S(1), -p, -p, -S(2)*p + S(2), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)))/(x**S(3)*(-S(6)*p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(5), x), x, -(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(-4)/3, -p, -p, S(-1)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(6), x), x, -(S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(S(-5)/3, -p, -p, S(-2)/3, -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**p/x**S(7), x), x, -S(2)**(S(2)*p + S(-1))*((b + S(2)*c*x**S(3) - sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*((b + S(2)*c*x**S(3) + sqrt(-S(4)*a*c + b**S(2)))/(c*x**S(3)))**(-p)*(a + b*x**S(3) + c*x**S(6))**p*AppellF1(-S(2)*p + S(2), -p, -p, -S(2)*p + S(3), -(b - sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)), -(b + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*x**S(3)))/(x**S(6)*(-S(3)*p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -S(11)*b*x**S(6)*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(336)*c**S(2)) + x**S(9)*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(24)*c) - (S(3)*b*(-S(124)*a*c + S(77)*b**S(2)) - S(10)*c*x**S(3)*(-S(28)*a*c + S(33)*b**S(2)))*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(13440)*c**S(4)) + (b + S(2)*c*x**S(3))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)*(S(16)*a**S(2)*c**S(2) - S(72)*a*b**S(2)*c + S(33)*b**S(4))/(S(6144)*c**S(5)) - (b + S(2)*c*x**S(3))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))*(S(16)*a**S(2)*c**S(2) - S(72)*a*b**S(2)*c + S(33)*b**S(4))/(S(16384)*c**S(6)) + (-S(4)*a*c + b**S(2))**S(2)*(S(16)*a**S(2)*c**S(2) - S(72)*a*b**S(2)*c + S(33)*b**S(4))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(32768)*c**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -b*(b + S(2)*c*x**S(3))*(-S(4)*a*c + S(3)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(384)*c**S(4)) + b*(b + S(2)*c*x**S(3))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(1024)*c**S(5)) - b*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(2048)*c**(S(11)/2)) + x**S(6)*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(21)*c) + (a + b*x**S(3) + c*x**S(6))**(S(5)/2)*(-S(16)*a*c + S(21)*b**S(2) - S(30)*b*c*x**S(3))/(S(840)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -S(7)*b*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(180)*c**S(2)) + x**S(3)*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(18)*c) + (b + S(2)*c*x**S(3))*(-S(4)*a*c + S(7)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(576)*c**S(3)) - (b + S(2)*c*x**S(3))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(1536)*c**S(4)) + (-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(7)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3072)*c**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -b*(b + S(2)*c*x**S(3))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(48)*c**S(2)) + b*(b + S(2)*c*x**S(3))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(128)*c**S(3)) - b*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(256)*c**(S(7)/2)) + (a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(15)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, (b + S(2)*c*x**S(3))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(24)*c) - (b + S(2)*c*x**S(3))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(64)*c**S(2)) + (-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(128)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x, x), x, -a**(S(3)/2)*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(3) - b*(-S(12)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*c**(S(3)/2)) + (a + b*x**S(3) + c*x**S(6))**(S(3)/2)/S(9) + sqrt(a + b*x**S(3) + c*x**S(6))*(S(8)*a*c + b**S(2) + S(2)*b*c*x**S(3))/(S(24)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(4), x), x, -sqrt(a)*b*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(2) + (S(3)*b/S(4) + c*x**S(3)/S(2))*sqrt(a + b*x**S(3) + c*x**S(6)) - (a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(3)*x**S(3)) + (S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(8)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(7), x), x, b*sqrt(c)*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(2) - (b - S(2)*c*x**S(3))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(4)*x**S(3)) - (a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(6)*x**S(6)) - (S(4)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(8)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(10), x), x, c**(S(3)/2)*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/S(3) - (a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(9)*x**S(9)) - (S(2)*a*b + x**S(3)*(S(8)*a*c + b**S(2)))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(24)*a*x**S(6)) + b*(-S(12)*a*c + b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(13), x), x, -(S(2)*a + b*x**S(3))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(24)*a*x**S(12)) + (S(2)*a + b*x**S(3))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(64)*a**S(2)*x**S(6)) - (-S(4)*a*c + b**S(2))**S(2)*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(128)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(16), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(15)*a*x**S(15)) + b*(S(2)*a + b*x**S(3))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(48)*a**S(2)*x**S(12)) - b*(S(2)*a + b*x**S(3))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(128)*a**S(3)*x**S(6)) + b*(-S(4)*a*c + b**S(2))**S(2)*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(256)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(19), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(18)*a*x**S(18)) + S(7)*b*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(180)*a**S(2)*x**S(15)) - (S(2)*a + b*x**S(3))*(-S(4)*a*c + S(7)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(576)*a**S(3)*x**S(12)) + (S(2)*a + b*x**S(3))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(1536)*a**S(4)*x**S(6)) - (-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(7)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3072)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))**(S(3)/2)/x**S(22), x), x, -(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(21)*a*x**S(21)) + b*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(28)*a**S(2)*x**S(18)) - (-S(16)*a*c + S(21)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(5)/2)/(S(840)*a**S(3)*x**S(15)) + b*(S(2)*a + b*x**S(3))*(-S(4)*a*c + S(3)*b**S(2))*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)/(S(384)*a**S(4)*x**S(12)) - b*(S(2)*a + b*x**S(3))*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(1024)*a**S(5)*x**S(6)) + b*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(3)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(2048)*a**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, x**(m + S(1))*hyper((S(2), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -x**S(4))/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -S(7)*b*x**S(6)*sqrt(a + b*x**S(3) + c*x**S(6))/(S(72)*c**S(2)) + x**S(9)*sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*c) - (S(5)*b*(-S(44)*a*c + S(21)*b**S(2)) - S(2)*c*x**S(3)*(-S(36)*a*c + S(35)*b**S(2)))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(576)*c**S(4)) + (S(48)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c + S(35)*b**S(4))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(384)*c**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*(-S(12)*a*c + S(5)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*c**(S(7)/2)) + x**S(6)*sqrt(a + b*x**S(3) + c*x**S(6))/(S(9)*c) + sqrt(a + b*x**S(3) + c*x**S(6))*(-S(16)*a*c + S(15)*b**S(2) - S(10)*b*c*x**S(3))/(S(72)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*sqrt(a + b*x**S(3) + c*x**S(6))/(S(4)*c**S(2)) + x**S(3)*sqrt(a + b*x**S(3) + c*x**S(6))/(S(6)*c) + (-S(4)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(24)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, -b*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(6)*c**(S(3)/2)) + sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*x**S(3) + c*x**S(6)), x), x, atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*a*x**S(3)) + b*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(6)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))/(S(6)*a*x**S(6)) + b*sqrt(a + b*x**S(3) + c*x**S(6))/(S(4)*a**S(2)*x**S(3)) - (-S(4)*a*c + S(3)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(24)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(10)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))/(S(9)*a*x**S(9)) + S(5)*b*sqrt(a + b*x**S(3) + c*x**S(6))/(S(36)*a**S(2)*x**S(6)) - (-S(16)*a*c + S(15)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(72)*a**S(3)*x**S(3)) + b*(-S(12)*a*c + S(5)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(13)*sqrt(a + b*x**S(3) + c*x**S(6))), x), x, -sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*a*x**S(12)) + S(7)*b*sqrt(a + b*x**S(3) + c*x**S(6))/(S(72)*a**S(2)*x**S(9)) - (-S(36)*a*c + S(35)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(288)*a**S(3)*x**S(6)) + S(5)*b*(-S(44)*a*c + S(21)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(576)*a**S(4)*x**S(3)) - (S(48)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c + S(35)*b**S(4))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(384)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -S(2)*b*x**S(6)*sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*c*(-S(4)*a*c + b**S(2))) + S(2)*x**S(9)*(S(2)*a + b*x**S(3))/((-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) - (b*(-S(52)*a*c + S(15)*b**S(2)) - S(2)*c*x**S(3)*(-S(12)*a*c + S(5)*b**S(2)))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*c**S(3)*(-S(4)*a*c + b**S(2))) + (-S(4)*a*c + S(5)*b**S(2))*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(8)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -b*atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(2)*c**(S(5)/2)) + S(2)*x**S(6)*(S(2)*a + b*x**S(3))/((-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) + sqrt(a + b*x**S(3) + c*x**S(6))*(-S(8)*a*c + S(3)*b**S(2) - S(2)*b*c*x**S(3))/(S(3)*c**S(2)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -S(2)*b*sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*c*(-S(4)*a*c + b**S(2))) + S(2)*x**S(3)*(S(2)*a + b*x**S(3))/((-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) + atanh((b + S(2)*c*x**S(3))/(S(2)*sqrt(c)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, (S(4)*a + S(2)*b*x**S(3))/((-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(3) + c*x**S(6))**(S(3)/2), x), x, -(S(2)*b + S(4)*c*x**S(3))/((-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x**S(3))/(S(3)*a*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) - atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(3)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x**S(3))/(S(3)*a*x**S(3)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) - (-S(8)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(3)*a**S(2)*x**S(3)*(-S(4)*a*c + b**S(2))) + b*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(2)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x**S(3))/(S(3)*a*x**S(6)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) - (-S(12)*a*c + S(5)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(6)*a**S(2)*x**S(6)*(-S(4)*a*c + b**S(2))) + b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(12)*a**S(3)*x**S(3)*(-S(4)*a*c + b**S(2))) - (-S(4)*a*c + S(5)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(8)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(10)*(a + b*x**S(3) + c*x**S(6))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x**S(3))/(S(3)*a*x**S(9)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))) - (-S(16)*a*c + S(7)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(9)*a**S(2)*x**S(9)*(-S(4)*a*c + b**S(2))) + b*(-S(116)*a*c + S(35)*b**S(2))*sqrt(a + b*x**S(3) + c*x**S(6))/(S(36)*a**S(3)*x**S(6)*(-S(4)*a*c + b**S(2))) - sqrt(a + b*x**S(3) + c*x**S(6))*(S(256)*a**S(2)*c**S(2) - S(460)*a*b**S(2)*c + S(105)*b**S(4))/(S(72)*a**S(4)*x**S(3)*(-S(4)*a*c + b**S(2))) + S(5)*b*(-S(12)*a*c + S(7)*b**S(2))*atanh((S(2)*a + b*x**S(3))/(S(2)*sqrt(a)*sqrt(a + b*x**S(3) + c*x**S(6))))/(S(48)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(3) + c*x**S(6))**S(2), x), x, a**S(2)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(2)*a*b*(d*x)**(m + S(4))/(d**S(4)*(m + S(4))) + S(2)*b*c*(d*x)**(m + S(10))/(d**S(10)*(m + S(10))) + c**S(2)*(d*x)**(m + S(13))/(d**S(13)*(m + S(13))) + (d*x)**(m + S(7))*(S(2)*a*c + b**S(2))/(d**S(7)*(m + S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**S(3) + c*x**S(6)), x), x, a*(d*x)**(m + S(1))/(d*(m + S(1))) + b*(d*x)**(m + S(4))/(d**S(4)*(m + S(4))) + c*(d*x)**(m + S(7))/(d**S(7)*(m + S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(3) + c*x**S(6)), x), x, -S(2)*c*(d*x)**(m + S(1))*hyper((S(1), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*(d*x)**(m + S(1))*hyper((S(1), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))))/(d*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**S(3) + c*x**S(6))**S(2), x), x, -c*(d*x)**(m + S(1))*(-S(4)*a*c*(-m + S(5)) + b**S(2)*(-m + S(2)) - b*(-m + S(2))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -S(2)*c*x**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*d*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + c*(d*x)**(m + S(1))*(-S(4)*a*c*(-m + S(5)) + b**S(2)*(-m + S(2)) + b*(-m + S(2))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(3) + S(1)/3), (m/S(3) + S(4)/3,), -S(2)*c*x**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*d*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (d*x)**(m + S(1))*(-S(2)*a*c + b**S(2) + b*c*x**S(3))/(S(3)*a*d*(-S(4)*a*c + b**S(2))*(a + b*x**S(3) + c*x**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(3) + c*x**S(6))**p, x), x, S(2)**p*b*(-(b + S(2)*c*x**S(3) - sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))**(-p + S(-1))*(a + b*x**S(3) + c*x**S(6))**(p + S(1))*hyper((-p, p + S(1)), (p + S(2),), (b + S(2)*c*x**S(3) + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))))/(S(3)*c*(p + S(1))*sqrt(-S(4)*a*c + b**S(2))) + (a + b*x**S(3) + c*x**S(6))**(p + S(1))/(S(6)*c*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(3) + c*x**S(6))**p, x), x, -S(2)**(p + S(1))*(-(b + S(2)*c*x**S(3) - sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))**(-p + S(-1))*(a + b*x**S(3) + c*x**S(6))**(p + S(1))*hyper((-p, p + S(1)), (p + S(2),), (b + S(2)*c*x**S(3) + sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))))/(S(3)*(p + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -x**S(6)/(S(4)*x**S(4) + S(4)) + S(3)*x**S(2)/S(4) - S(3)*atan(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, log(x**S(4) + S(1))/S(4) + S(1)/(S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -x**S(2)/(S(4)*x**S(4) + S(4)) + atan(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -S(1)/(S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, x**S(2)/(S(4)*x**S(4) + S(4)) + atan(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, log(x) - log(x**S(4) + S(1))/S(4) + S(1)/(S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, -S(3)*atan(x**S(2))/S(4) - S(3)/(S(4)*x**S(2)) + S(1)/(S(4)*x**S(2)*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, -S(2)*log(x) + log(x**S(4) + S(1))/S(2) - S(1)/(S(4)*x**S(4) + S(4)) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, S(5)*atan(x**S(2))/S(4) + S(5)/(S(4)*x**S(2)) - S(5)/(S(12)*x**S(6)) + S(1)/(S(4)*x**S(6)*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -x**S(5)/(S(4)*x**S(4) + S(4)) + S(5)*x/S(4) + S(5)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) - S(5)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) - S(5)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) - S(5)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -x**S(3)/(S(4)*x**S(4) + S(4)) + S(3)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) - S(3)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + S(3)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + S(3)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, -x/(S(4)*x**S(4) + S(4)) - sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) + sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, x**S(3)/(S(4)*x**S(4) + S(4)) + sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) - sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8) + S(2)*x**S(4) + S(1)), x), x, x/(S(4)*x**S(4) + S(4)) - S(3)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) + S(3)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + S(3)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + S(3)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, -S(5)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) + S(5)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) - S(5)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) - S(5)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16) - S(5)/(S(4)*x) + S(1)/(S(4)*x*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, S(7)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) - S(7)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) - S(7)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) - S(7)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16) - S(7)/(S(12)*x**S(3)) + S(1)/(S(4)*x**S(3)*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, S(9)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) - S(9)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + S(9)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + S(9)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16) + S(9)/(S(4)*x) - S(9)/(S(20)*x**S(5)) + S(1)/(S(4)*x**S(5)*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(x**S(8) + S(2)*x**S(4) + S(1))), x), x, -S(11)*sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(32) + S(11)*sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(32) + S(11)*sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(16) + S(11)*sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(16) + S(11)/(S(12)*x**S(3)) - S(11)/(S(28)*x**S(7)) + S(1)/(S(4)*x**S(7)*(x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**(m + S(1))*hyper((S(2), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), x**S(4))/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(6)/(-S(4)*x**S(4) + S(4)) + S(3)*x**S(2)/S(4) - S(3)*atanh(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, log(-x**S(4) + S(1))/S(4) + S(1)/(-S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(2)/(-S(4)*x**S(4) + S(4)) - atanh(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, S(1)/(-S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(2)/(-S(4)*x**S(4) + S(4)) + atanh(x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, log(x) - log(-x**S(4) + S(1))/S(4) + S(1)/(-S(4)*x**S(4) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, S(3)*atanh(x**S(2))/S(4) - S(3)/(S(4)*x**S(2)) + S(1)/(S(4)*x**S(2)*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, S(2)*log(x) - log(-x**S(4) + S(1))/S(2) + S(1)/(-S(4)*x**S(4) + S(4)) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, S(5)*atanh(x**S(2))/S(4) - S(5)/(S(4)*x**S(2)) - S(5)/(S(12)*x**S(6)) + S(1)/(S(4)*x**S(6)*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(5)/(-S(4)*x**S(4) + S(4)) + S(5)*x/S(4) - S(5)*atan(x)/S(8) - S(5)*atanh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(3)/(-S(4)*x**S(4) + S(4)) + S(3)*atan(x)/S(8) - S(3)*atanh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x/(-S(4)*x**S(4) + S(4)) - atan(x)/S(8) - atanh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x**S(3)/(-S(4)*x**S(4) + S(4)) - atan(x)/S(8) + atanh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8) - S(2)*x**S(4) + S(1)), x), x, x/(-S(4)*x**S(4) + S(4)) + S(3)*atan(x)/S(8) + S(3)*atanh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, -S(5)*atan(x)/S(8) + S(5)*atanh(x)/S(8) - S(5)/(S(4)*x) + S(1)/(S(4)*x*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, S(7)*atan(x)/S(8) + S(7)*atanh(x)/S(8) - S(7)/(S(12)*x**S(3)) + S(1)/(S(4)*x**S(3)*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, -S(9)*atan(x)/S(8) + S(9)*atanh(x)/S(8) - S(9)/(S(4)*x) - S(9)/(S(20)*x**S(5)) + S(1)/(S(4)*x**S(5)*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(x**S(8) - S(2)*x**S(4) + S(1))), x), x, S(11)*atan(x)/S(8) + S(11)*atanh(x)/S(8) - S(11)/(S(12)*x**S(3)) - S(11)/(S(28)*x**S(7)) + S(1)/(S(4)*x**S(7)*(-x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a + b*x**S(4) + c*x**S(8)), x), x, -S(2)*c*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*c*x**S(4)/(b + sqrt(-S(4)*a*c + b**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*c*x**S(4)/(b - sqrt(-S(4)*a*c + b**S(2))))/((b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a + b*x**S(4) + c*x**S(8)), x), x, -b*log(a + b*x**S(4) + c*x**S(8))/(S(8)*c**S(2)) + x**S(4)/(S(4)*c) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a + b*x**S(4) + c*x**S(8)), x), x, x**S(2)/(S(2)*c) - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a + b*x**S(4) + c*x**S(8)), x), x, b*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x**S(4) + c*x**S(8))/(S(8)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a + b*x**S(4) + c*x**S(8)), x), x, -sqrt(S(2))*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**S(4) + c*x**S(8)), x), x, -atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(4) + c*x**S(8)), x), x, -sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**S(4) + c*x**S(8))), x), x, b*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x**S(4) + c*x**S(8))/(S(8)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**S(4) + c*x**S(8))), x), x, -sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(S(2)*a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a + b*x**S(4) + c*x**S(8))), x), x, -S(1)/(S(4)*a*x**S(4)) - b*log(x)/a**S(2) + b*log(a + b*x**S(4) + c*x**S(8))/(S(8)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a + b*x**S(4) + c*x**S(8)), x), x, x**S(3)/(S(3)*c) - S(2)**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(7)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(7)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a + b*x**S(4) + c*x**S(8)), x), x, x/c + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a + b*x**S(4) + c*x**S(8)), x), x, -S(2)**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a + b*x**S(4) + c*x**S(8)), x), x, S(2)**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**S(4) + c*x**S(8)), x), x, S(2)**(S(1)/4)*c**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(1)/4)*c**(S(1)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(1)/4)*c**(S(1)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**S(4) + c*x**S(8)), x), x, -S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(2)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**S(4) + c*x**S(8))), x), x, -S(2)**(S(1)/4)*c**(S(1)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*c**(S(1)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(1)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a + b*x**S(4) + c*x**S(8))), x), x, S(2)**(S(3)/4)*c**(S(3)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(1)/(S(3)*a*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) + x**S(4) + S(1)), x), x, S(2)*sqrt(S(3))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*x**S(4)/(S(1) - sqrt(S(3))*I))/(S(3)*(sqrt(S(3)) + I)*(m + S(1))) - S(2)*sqrt(S(3))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*x**S(4)/(S(1) + sqrt(S(3))*I))/(S(3)*(-sqrt(S(3)) + I)*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(8) + x**S(4) + S(1)), x), x, x**S(4)/S(4) - log(x**S(8) + x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) + x**S(4) + S(1)), x), x, x**S(2)/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(2) + S(1))/S(3))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) + x**S(4) + S(1)), x), x, log(x**S(8) + x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) + x**S(4) + S(1)), x), x, log(x**S(4) - x**S(2) + S(1))/S(8) - log(x**S(4) + x**S(2) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(2) + S(1))/S(3))/S(12) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) + x**S(4) + S(1)), x), x, sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(4) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) + x**S(4) + S(1)), x), x, -log(x**S(4) - x**S(2) + S(1))/S(8) + log(x**S(4) + x**S(2) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(2) + S(1))/S(3))/S(12) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) + x**S(4) + S(1))), x), x, log(x) - log(x**S(8) + x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) + x**S(4) + S(1))), x), x, sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(2) + S(1))/S(3))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(6) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) + x**S(4) + S(1))), x), x, -log(x) + log(x**S(8) + x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(4) + S(1))/S(3))/S(12) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) + x**S(4) + S(1))), x), x, log(x**S(4) - x**S(2) + S(1))/S(8) - log(x**S(4) + x**S(2) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(2) + S(1))/S(3))/S(12) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(12) + S(1)/(S(2)*x**S(2)) - S(1)/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(8) + x**S(4) + S(1)), x), x, x + log(x**S(2) - x + S(1))/S(8) - log(x**S(2) + x + S(1))/S(8) + sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) - atan(S(2)*x - sqrt(S(3)))/S(4) - atan(S(2)*x + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(8) + x**S(4) + S(1)), x), x, sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(8) + x**S(4) + S(1)), x), x, -log(x**S(2) - x + S(1))/S(8) + log(x**S(2) + x + S(1))/S(8) + sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(4) + atan(S(2)*x + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(8) + x**S(4) + S(1)), x), x, log(x**S(2) - x + S(1))/S(8) - log(x**S(2) + x + S(1))/S(8) - sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(4) + atan(S(2)*x + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8) + x**S(4) + S(1)), x), x, -sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(12) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(8) + x**S(4) + S(1))), x), x, -log(x**S(2) - x + S(1))/S(8) + log(x**S(2) + x + S(1))/S(8) - sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) - atan(S(2)*x - sqrt(S(3)))/S(4) - atan(S(2)*x + sqrt(S(3)))/S(4) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(8) + x**S(4) + S(1))), x), x, log(x**S(2) - x + S(1))/S(8) - log(x**S(2) + x + S(1))/S(8) + sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) - atan(S(2)*x - sqrt(S(3)))/S(4) - atan(S(2)*x + sqrt(S(3)))/S(4) - S(1)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(8) + x**S(4) + S(1))), x), x, sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6) + S(1)/x - S(1)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(x**S(8) + x**S(4) + S(1))), x), x, -log(x**S(2) - x + S(1))/S(8) + log(x**S(2) + x + S(1))/S(8) + sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) - sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(4) + atan(S(2)*x + sqrt(S(3)))/S(4) + S(1)/(S(3)*x**S(3)) - S(1)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) - x**S(4) + S(1)), x), x, S(2)*sqrt(S(3))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), S(2)*x**S(4)/(S(1) - sqrt(S(3))*I))/(S(3)*(sqrt(S(3)) + I)*(m + S(1))) - S(2)*sqrt(S(3))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), S(2)*x**S(4)/(S(1) + sqrt(S(3))*I))/(S(3)*(-sqrt(S(3)) + I)*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(8) - x**S(4) + S(1)), x), x, x**S(4)/S(4) + log(x**S(8) - x**S(4) + S(1))/S(8) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) - x**S(4) + S(1)), x), x, x**S(2)/S(2) + sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(12) - sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) - x**S(4) + S(1)), x), x, log(x**S(8) - x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) - x**S(4) + S(1)), x), x, sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(24) - sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(24) + atan(S(2)*x**S(2) - sqrt(S(3)))/S(4) + atan(S(2)*x**S(2) + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(24) + sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(24) + atan(S(2)*x**S(2) - sqrt(S(3)))/S(4) + atan(S(2)*x**S(2) + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) - x**S(4) + S(1))), x), x, log(x) - log(x**S(8) - x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) - x**S(4) + S(1))), x), x, -sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(12) + sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(12) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) - x**S(4) + S(1))), x), x, log(x) - log(x**S(8) - x**S(4) + S(1))/S(8) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) - x**S(4) + S(1))), x), x, -sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(24) + sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(24) - atan(S(2)*x**S(2) - sqrt(S(3)))/S(4) - atan(S(2)*x**S(2) + sqrt(S(3)))/S(4) - S(1)/(S(2)*x**S(2)) - S(1)/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(8) - x**S(4) + S(1)), x), x, x - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) - atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(8) - x**S(4) + S(1)), x), x, sqrt(S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(8) - x**S(4) + S(1)), x), x, -log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-S(3)*sqrt(S(3)) + S(6))) + log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-S(3)*sqrt(S(3)) + S(6))) + log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(S(3)*sqrt(S(3)) + S(6))) - log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(S(3)*sqrt(S(3)) + S(6))) - atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) + atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) + atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) - atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(8) - x**S(4) + S(1)), x), x, log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(S(3)*sqrt(S(3)) + S(6))) + log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(S(3)*sqrt(S(3)) + S(6))) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(8) - x**S(4) + S(1))), x), x, sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) - atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(x**S(8) - x**S(4) + S(1))), x), x, sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) - S(1)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(8) - x**S(4) + S(1))), x), x, -sqrt(S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) - S(1)/x - S(1)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(x**S(8) - x**S(4) + S(1))), x), x, sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) - S(1)/(S(3)*x**S(3)) - S(1)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, S(2)*sqrt(S(5))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*x**S(4)/(-sqrt(S(5)) + S(3)))/(S(5)*(-sqrt(S(5)) + S(3))*(m + S(1))) - S(2)*sqrt(S(5))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), -S(2)*x**S(4)/(sqrt(S(5)) + S(3)))/(S(5)*(sqrt(S(5)) + S(3))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, x**S(4)/S(4) - (-S(7)*sqrt(S(5))/S(40) + S(3)/8)*log(S(2)*x**S(4) - sqrt(S(5)) + S(3)) - (S(3)/8 + S(7)*sqrt(S(5))/S(40))*log(S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, x**S(2)/S(2) + sqrt(-S(4)*sqrt(S(5))/S(5) + S(9)/5)*atan(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - sqrt(S(4)*sqrt(S(5))/S(5) + S(9)/5)*atan(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, (-S(3)*sqrt(S(5))/S(40) + S(1)/8)*log(S(2)*x**S(4) - sqrt(S(5)) + S(3)) + (S(1)/8 + S(3)*sqrt(S(5))/S(40))*log(S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, -sqrt(-sqrt(S(5))/S(10) + S(3)/10)*atan(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) + sqrt(sqrt(S(5))/S(10) + S(3)/10)*atan(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, -sqrt(S(5))*atanh(sqrt(S(5))*(S(2)*x**S(4) + S(3))/S(5))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) + S(3)*x**S(4) + S(1)), x), x, sqrt(sqrt(S(5))/S(10) + S(3)/10)*atan(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - atan(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/sqrt(S(10)*sqrt(S(5)) + S(30)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) + S(3)*x**S(4) + S(1))), x), x, log(x) - (S(1)/8 + S(3)*sqrt(S(5))/S(40))*log(S(2)*x**S(4) - sqrt(S(5)) + S(3)) - (-S(3)*sqrt(S(5))/S(40) + S(1)/8)*log(S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) + S(3)*x**S(4) + S(1))), x), x, -sqrt(S(10))*(sqrt(S(5)) + S(3))**(S(3)/2)*atan(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(40) + sqrt(-S(4)*sqrt(S(5))/S(5) + S(9)/5)*atan(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) + S(3)*x**S(4) + S(1))), x), x, -S(3)*log(x) + (S(3)/8 + S(7)*sqrt(S(5))/S(40))*log(S(2)*x**S(4) - sqrt(S(5)) + S(3)) + (-S(7)*sqrt(S(5))/S(40) + S(3)/8)*log(S(2)*x**S(4) + sqrt(S(5)) + S(3)) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) + S(3)*x**S(4) + S(1))), x), x, sqrt(S(11)*sqrt(S(5))/S(2) + S(123)/10)*atan(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - sqrt(-S(11)*sqrt(S(5))/S(2) + S(123)/10)*atan(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2) + S(3)/(S(2)*x**S(2)) - S(1)/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, S(2)*sqrt(S(5))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), S(2)*x**S(4)/(-sqrt(S(5)) + S(3)))/(S(5)*(-sqrt(S(5)) + S(3))*(m + S(1))) - S(2)*sqrt(S(5))*x**(m + S(1))*hyper((S(1), m/S(4) + S(1)/4), (m/S(4) + S(5)/4,), S(2)*x**S(4)/(sqrt(S(5)) + S(3)))/(S(5)*(sqrt(S(5)) + S(3))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, x**S(4)/S(4) + (-S(7)*sqrt(S(5))/S(40) + S(3)/8)*log(-S(2)*x**S(4) - sqrt(S(5)) + S(3)) + (S(3)/8 + S(7)*sqrt(S(5))/S(40))*log(-S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, x**S(2)/S(2) + sqrt(-S(4)*sqrt(S(5))/S(5) + S(9)/5)*atanh(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - sqrt(S(4)*sqrt(S(5))/S(5) + S(9)/5)*atanh(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, (-S(3)*sqrt(S(5))/S(40) + S(1)/8)*log(-S(2)*x**S(4) - sqrt(S(5)) + S(3)) + (S(1)/8 + S(3)*sqrt(S(5))/S(40))*log(-S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(-sqrt(S(5))/S(10) + S(3)/10)*atanh(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - sqrt(sqrt(S(5))/S(10) + S(3)/10)*atanh(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(S(5))*atanh(sqrt(S(5))*(-S(2)*x**S(4) + S(3))/S(5))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(sqrt(S(5))/S(10) + S(3)/10)*atanh(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - atanh(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/sqrt(S(10)*sqrt(S(5)) + S(30)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, log(x) - (S(1)/8 + S(3)*sqrt(S(5))/S(40))*log(-S(2)*x**S(4) - sqrt(S(5)) + S(3)) - (-S(3)*sqrt(S(5))/S(40) + S(1)/8)*log(-S(2)*x**S(4) + sqrt(S(5)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, sqrt(S(10))*(sqrt(S(5)) + S(3))**(S(3)/2)*atanh(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(40) - sqrt(-S(4)*sqrt(S(5))/S(5) + S(9)/5)*atanh(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, S(3)*log(x) - (S(3)/8 + S(7)*sqrt(S(5))/S(40))*log(-S(2)*x**S(4) - sqrt(S(5)) + S(3)) - (-S(7)*sqrt(S(5))/S(40) + S(3)/8)*log(-S(2)*x**S(4) + sqrt(S(5)) + S(3)) - S(1)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, sqrt(S(11)*sqrt(S(5))/S(2) + S(123)/10)*atanh(x**S(2)*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(2) - sqrt(-S(11)*sqrt(S(5))/S(2) + S(123)/10)*atanh(sqrt(S(2))*x**S(2)/sqrt(sqrt(S(5)) + S(3)))/S(2) - S(3)/(S(2)*x**S(2)) - S(1)/(S(6)*x**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, x + sqrt(S(5))*(-S(440)*sqrt(S(5)) + S(984))**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(20) - sqrt(S(5))*(S(55)*sqrt(S(5))/S(2) + S(123)/2)**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) + sqrt(S(5))*(-S(440)*sqrt(S(5)) + S(984))**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(20) - sqrt(S(5))*(S(55)*sqrt(S(5))/S(2) + S(123)/2)**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, -sqrt(S(5))*(-S(64)*sqrt(S(5)) + S(144))**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(20) + S(2)**(S(1)/4)*sqrt(S(5))*(sqrt(S(5)) + S(3))**(S(3)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(20) + sqrt(S(5))*(-S(64)*sqrt(S(5)) + S(144))**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(20) - S(2)**(S(1)/4)*sqrt(S(5))*(sqrt(S(5)) + S(3))**(S(3)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(20), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(S(5))*(-sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) + sqrt(S(5))*(-sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(S(-10) + S(10)*sqrt(S(5)))*atan(x*sqrt(S(-2) + S(2)*sqrt(S(5)))/S(2))/S(20) - sqrt(S(10) + S(10)*sqrt(S(5)))*atan(x*sqrt(S(2) + S(2)*sqrt(S(5)))/S(2))/S(20) - sqrt(S(-10) + S(10)*sqrt(S(5)))*atanh(x*sqrt(S(-2) + S(2)*sqrt(S(5)))/S(2))/S(20) + sqrt(S(10) + S(10)*sqrt(S(5)))*atanh(x*sqrt(S(2) + S(2)*sqrt(S(5)))/S(2))/S(20), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, -sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) + S(2)**(S(1)/4)*sqrt(S(5))*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/(S(10)*(sqrt(S(5)) + S(3))**(S(1)/4)) + sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - S(2)**(S(1)/4)*sqrt(S(5))*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/(S(10)*(sqrt(S(5)) + S(3))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, -S(2)**(S(3)/4)*sqrt(S(5))*(sqrt(S(5)) + S(3))**(S(5)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(40) + sqrt(S(5))*(-S(440)*sqrt(S(5)) + S(984))**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(20) + S(2)**(S(3)/4)*sqrt(S(5))*(sqrt(S(5)) + S(3))**(S(5)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(40) - sqrt(S(5))*(-S(440)*sqrt(S(5)) + S(984))**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(20) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, -sqrt(S(5))*(S(1292)*sqrt(S(5)) + S(2889))**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) + sqrt(S(5))*(-S(1292)*sqrt(S(5)) + S(2889))**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) + sqrt(S(5))*(S(1292)*sqrt(S(5)) + S(2889))**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - sqrt(S(5))*(-S(1292)*sqrt(S(5)) + S(2889))**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) - S(3)/x - S(1)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(x**S(8) - S(3)*x**S(4) + S(1))), x), x, sqrt(S(5))*(S(17711)*sqrt(S(5))/S(2) + S(39603)/2)**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - sqrt(S(5))*(-S(17711)*sqrt(S(5))/S(2) + S(39603)/2)**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) + sqrt(S(5))*(S(17711)*sqrt(S(5))/S(2) + S(39603)/2)**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) - sqrt(S(5))*(-S(17711)*sqrt(S(5))/S(2) + S(39603)/2)**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) - S(1)/x**S(3) - S(1)/(S(7)*x**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(x**S(8) + S(3)*x**S(4) + S(2)), x), x, -atanh(S(2)*x**S(4) + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(x**S(8) + S(3)*x**S(4) + S(2)), x), x, x**S(4)/S(4) + log(x**S(4) + S(1))/S(4) - log(x**S(4) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(x**S(10) + x**S(5) + S(2)), x), x, log(x**S(10) + x**S(5) + S(2))/S(10) - sqrt(S(7))*atan(sqrt(S(7))*(S(2)*x**S(5) + S(1))/S(7))/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(10) + x**S(5) + S(2)), x), x, S(2)*sqrt(S(7))*atan(sqrt(S(7))*(S(2)*x**S(5) + S(1))/S(7))/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(10) + x**S(5) + S(1))), x), x, log(x) - log(x**S(10) + x**S(5) + S(1))/S(10) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(5) + S(1))/S(3))/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(x**S(10) + x**S(5) + S(1))), x), x, -log(x) + log(x**S(10) + x**S(5) + S(1))/S(10) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(5) + S(1))/S(3))/S(15) - S(1)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(11) + x**S(6) + x), x), x, log(x) - log(x**S(10) + x**S(5) + S(1))/S(10) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(5) + S(1))/S(3))/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a/x**S(2) + b/x + c), x), x, -b*x**S(3)/(S(3)*c**S(2)) - b*x*(-S(2)*a*c + b**S(2))/c**S(4) + b*(S(5)*a**S(2)*c**S(2) - S(5)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(5)*sqrt(-S(4)*a*c + b**S(2))) + x**S(4)/(S(4)*c) + x**S(2)*(-a*c + b**S(2))/(S(2)*c**S(3)) + (a**S(2)*c**S(2) - S(3)*a*b**S(2)*c + b**S(4))*log(a + b*x + c*x**S(2))/(S(2)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a/x**S(2) + b/x + c), x), x, -b*x**S(2)/(S(2)*c**S(2)) - b*(-S(2)*a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*c**S(4)) + x**S(3)/(S(3)*c) + x*(-a*c + b**S(2))/c**S(3) - (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a/x**S(2) + b/x + c), x), x, -b*x/c**S(2) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*sqrt(-S(4)*a*c + b**S(2))) + x**S(2)/(S(2)*c) + (-a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a/x**S(2) + b/x + c), x), x, -b*log(a + b*x + c*x**S(2))/(S(2)*c**S(2)) + x/c - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a/x**S(2) + b/x + c)), x), x, b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x + c*x**S(2))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a/x**S(2) + b/x + c)), x), x, S(2)*atanh((S(2)*a/x + b)/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a/x**S(2) + b/x + c)), x), x, b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x + c*x**S(2))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a/x**S(2) + b/x + c)), x), x, -S(1)/(a*x) - b*log(x)/a**S(2) + b*log(a + b*x + c*x**S(2))/(S(2)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a/x**S(2) + b/x + c)), x), x, -S(1)/(S(2)*a*x**S(2)) + b/(a**S(2)*x) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*sqrt(-S(4)*a*c + b**S(2))) + (-a*c + b**S(2))*log(x)/a**S(3) - (-a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a/x**S(2) + b/x + c)), x), x, -S(1)/(S(3)*a*x**S(3)) + b/(S(2)*a**S(2)*x**S(2)) - (-a*c + b**S(2))/(a**S(3)*x) - b*(-S(2)*a*c + b**S(2))*log(x)/a**S(4) + b*(-S(2)*a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(4)) - (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a/x**S(2) + b/x + c)**S(2), x), x, -b*x**S(3)/(c*(-S(4)*a*c + b**S(2))) - b*x*(-S(11)*a*c + S(3)*b**S(2))/(c**S(3)*(-S(4)*a*c + b**S(2))) + b*(S(30)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**S(4)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + x**S(2)*(-S(8)*a*c + S(3)*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) + (-S(2)*a*c + S(3)*b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*c**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a/x**S(2) + b/x + c)**(S(-2)), x), x, -b*x**S(2)/(c*(-S(4)*a*c + b**S(2))) - b*log(a + b*x + c*x**S(2))/c**S(3) + x**S(3)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + x*(-S(6)*a*c + S(2)*b**S(2))/(c**S(2)*(-S(4)*a*c + b**S(2))) - (S(12)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(2)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a/x**S(2) + b/x + c)**S(2)), x), x, -b*x/(c*(-S(4)*a*c + b**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**S(2)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + log(a + b*x + c*x**S(2))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a/x**S(2) + b/x + c)**S(2)), x), x, -S(4)*a*atanh((S(2)*a/x + b)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + (S(2)*a/x + b)/((-S(4)*a*c + b**S(2))*(a/x**S(2) + b/x + c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a/x**S(2) + b/x + c)**S(2)), x), x, -S(2)*b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + (S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a/x**S(2) + b/x + c)**S(2)), x), x, S(4)*c*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - (b + S(2)*c*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a/x**S(2) + b/x + c)**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(x)/a**S(2) - log(a + b*x + c*x**S(2))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a/x**S(2) + b/x + c)**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + (S(6)*a*c - S(2)*b**S(2))/(a**S(2)*x*(-S(4)*a*c + b**S(2))) - S(2)*b*log(x)/a**S(3) + b*log(a + b*x + c*x**S(2))/a**S(3) - (S(12)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(2)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(a/x**S(2) + b/x + c)**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) - (-S(8)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) + b*(-S(11)*a*c + S(3)*b**S(2))/(a**S(3)*x*(-S(4)*a*c + b**S(2))) + b*(S(30)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (-S(2)*a*c + S(3)*b**S(2))*log(x)/a**S(4) - (-S(2)*a*c + S(3)*b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a/x**S(2) + b/x + c)**(S(-3)), x), x, -S(3)*b*x**S(2)*(-S(6)*a*c + b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*b*log(a + b*x + c*x**S(2))/(S(2)*c**S(4)) + x**S(5)*(S(2)*a + b*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)) + x**S(3)*(a*(-S(10)*a*c + b**S(2)) + b*x*(-S(7)*a*c + b**S(2)))/(c*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) + x*(S(30)*a**S(2)*c**S(2) - S(21)*a*b**S(2)*c + S(3)*b**S(4))/(c**S(3)*(-S(4)*a*c + b**S(2))**S(2)) - (-S(60)*a**S(3)*c**S(3) + S(90)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(3)*b**S(6))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a/x**S(2) + b/x + c)**S(3)), x), x, -b*x*(-S(7)*a*c + b**S(2))/(c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x**S(4)*(S(2)*a + b*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)) + x**S(2)*(a*(-S(16)*a*c + b**S(2)) + b*x*(-S(10)*a*c + b**S(2)))/(S(2)*c*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) + log(a + b*x + c*x**S(2))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a/x**S(2) + b/x + c)**S(3)), x), x, S(12)*a**S(2)*atanh((S(2)*a/x + b)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - S(3)*a*(S(2)*a/x + b)/((-S(4)*a*c + b**S(2))**S(2)*(a/x**S(2) + b/x + c)) + (S(2)*a/x + b)/((-S(8)*a*c + S(2)*b**S(2))*(a/x**S(2) + b/x + c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a/x**S(2) + b/x + c)**S(3)), x), x, S(6)*a*b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + S(3)*b*x*(S(2)*a + b*x)/(S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) - x**S(3)*(b + S(2)*c*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a/x**S(2) + b/x + c)**S(3)), x), x, x*(S(2)*a + b*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)) + (S(3)*a*b + x*(S(2)*a*c + b**S(2)))/((-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) - (S(4)*a*c + S(2)*b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(a/x**S(2) + b/x + c)**S(3)), x), x, S(6)*b*c*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - S(3)*b*(b + S(2)*c*x)/(S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) + (S(2)*a + b*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(a/x**S(2) + b/x + c)**S(3)), x), x, -S(12)*c**S(2)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + S(3)*c*(b + S(2)*c*x)/((-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) + (-b - S(2)*c*x)/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(7)*(a/x**S(2) + b/x + c)**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))**S(2)) + (S(16)*a**S(2)*c**S(2) - S(15)*a*b**S(2)*c + S(2)*b**S(4) + S(2)*b*c*x*(-S(7)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + log(x)/a**S(3) - log(a + b*x + c*x**S(2))/(S(2)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(8)*(a/x**S(2) + b/x + c)**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))**S(2)) + (S(20)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4) + S(3)*b*c*x*(-S(6)*a*c + b**S(2)))/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) - (S(30)*a**S(2)*c**S(2) - S(21)*a*b**S(2)*c + S(3)*b**S(4))/(a**S(3)*x*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*b*log(x)/a**S(4) + S(3)*b*log(a + b*x + c*x**S(2))/(S(2)*a**S(4)) - (-S(60)*a**S(3)*c**S(3) + S(90)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(3)*b**S(6))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(S(15) + S(13)/x + S(2)/x**S(2)), x), x, x**S(3)/S(45) - S(13)*x**S(2)/S(450) + S(139)*x/S(3375) - S(16)*log(S(3)*x + S(2))/S(567) + log(S(5)*x + S(1))/S(4375), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(S(15) + S(13)/x + S(2)/x**S(2)), x), x, x**S(2)/S(30) - S(13)*x/S(225) + S(8)*log(S(3)*x + S(2))/S(189) - log(S(5)*x + S(1))/S(875), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(15) + S(13)/x + S(2)/x**S(2)), x), x, x/S(15) - S(4)*log(S(3)*x + S(2))/S(63) + log(S(5)*x + S(1))/S(175), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, S(2)*log(S(3)*x + S(2))/S(21) - log(S(5)*x + S(1))/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, -log(S(3) + S(2)/x)/S(7) + log(S(5) + S(1)/x)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, log(x)/S(2) + S(3)*log(S(3)*x + S(2))/S(14) - S(5)*log(S(5)*x + S(1))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, -S(13)*log(x)/S(4) - S(9)*log(S(3)*x + S(2))/S(28) + S(25)*log(S(5)*x + S(1))/S(7) - S(1)/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, S(139)*log(x)/S(8) + S(27)*log(S(3)*x + S(2))/S(56) - S(125)*log(S(5)*x + S(1))/S(7) + S(13)/(S(4)*x) - S(1)/(S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*(S(15) + S(13)/x + S(2)/x**S(2))), x), x, -S(1417)*log(x)/S(16) - S(81)*log(S(3)*x + S(2))/S(112) + S(625)*log(S(5)*x + S(1))/S(7) - S(139)/(S(8)*x) + S(13)/(S(8)*x**S(2)) - S(1)/(S(6)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x + c/x**S(2))**(S(5)/2), x), x, S(5)*a**(S(3)/2)*b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/S(2) + x*(a + b/x + c/x**S(2))**(S(5)/2) - S(5)*(S(7)*b + S(6)*c/x)*(a + b/x + c/x**S(2))**(S(3)/2)/S(24) - S(5)*(b*(S(44)*a*c + b**S(2)) + S(2)*c*(S(12)*a*c + b**S(2))/x)*sqrt(a + b/x + c/x**S(2))/(S(64)*c) + (-S(240)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c + S(5)*b**S(4))*atanh((b + S(2)*c/x)/(S(2)*sqrt(c)*sqrt(a + b/x + c/x**S(2))))/(S(128)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x + c/x**S(2))**(S(3)/2), x), x, S(3)*sqrt(a)*b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/S(2) + x*(a + b/x + c/x**S(2))**(S(3)/2) - S(3)*(S(3)*b + S(2)*c/x)*sqrt(a + b/x + c/x**S(2))/S(4) - (S(12)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c/x)/(S(2)*sqrt(c)*sqrt(a + b/x + c/x**S(2))))/(S(8)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b/x + c/x**S(2)), x), x, -sqrt(c)*atanh((b + S(2)*c/x)/(S(2)*sqrt(c)*sqrt(a + b/x + c/x**S(2)))) + x*sqrt(a + b/x + c/x**S(2)) + b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b/x + c/x**S(2)), x), x, x*sqrt(a + b/x + c/x**S(2))/a - b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/(S(2)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x + c/x**S(2))**(S(-3)/2), x), x, -x*(-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c/x)/(a*(-S(4)*a*c + b**S(2))*sqrt(a + b/x + c/x**S(2))) + x*(-S(8)*a*c + S(3)*b**S(2))*sqrt(a + b/x + c/x**S(2))/(a**S(2)*(-S(4)*a*c + b**S(2))) - S(3)*b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/(S(2)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x + c/x**S(2))**(S(-5)/2), x), x, -x*(-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c/x)/(S(3)*a*(-S(4)*a*c + b**S(2))*(a + b/x + c/x**S(2))**(S(3)/2)) - x*(S(64)*a**S(2)*c**S(2) - S(64)*a*b**S(2)*c + S(10)*b**S(4) + S(2)*b*c*(-S(28)*a*c + S(5)*b**S(2))/x)/(S(3)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b/x + c/x**S(2))) + x*sqrt(a + b/x + c/x**S(2))*(S(128)*a**S(2)*c**S(2) - S(100)*a*b**S(2)*c + S(15)*b**S(4))/(S(3)*a**S(3)*(-S(4)*a*c + b**S(2))**S(2)) - S(5)*b*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/(S(2)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b/x + b**S(2)/x**S(2)), x), x, a*x*sqrt(a**S(2) + S(2)*a*b/x + b**S(2)/x**S(2))/(a + b/x) + b*sqrt(a**S(2) + S(2)*a*b/x + b**S(2)/x**S(2))*log(x)/(a + b/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a/x**S(4) + b/x**S(2) + c), x), x, x/c - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a/x**S(6) + b/x**S(3) + c), x), x, x/c - S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a/x**S(8) + b/x**S(4) + c), x), x, x/c + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(x) + c*x)/x, x), x, -S(2)*sqrt(a)*atanh((S(2)*a + b*sqrt(x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(x) + c*x))) + b*atanh((b + S(2)*c*sqrt(x))/(S(2)*sqrt(c)*sqrt(a + b*sqrt(x) + c*x)))/sqrt(c) + S(2)*sqrt(a + b*sqrt(x) + c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b**S(2)/(S(4)*c) + b*sqrt(x) + c*x)**S(2), x), x, -b*(b + S(2)*c*sqrt(x))**S(5)/(S(160)*c**S(4)) + (b + S(2)*c*sqrt(x))**S(6)/(S(192)*c**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b*sqrt(x) + b**S(2)*x), x), x, -S(2)*a*(a + b*sqrt(x))*log(a + b*sqrt(x))/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*sqrt(x) + b**S(2)*x)) + S(2)*sqrt(a**S(2) + S(2)*a*b*sqrt(x) + b**S(2)*x)/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p, x), x, x*(d*x)**m*(S(1) + b*x**(S(1)/3)/a)**(-S(2)*p)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p*hyper((S(3)*m + S(3), -S(2)*p), (S(3)*m + S(4),), -b*x**(S(1)/3)/a)/(m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p, x), x, S(3)*a**S(8)*(a + b*x**(S(1)/3))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(9)*(S(2)*p + S(1))) - S(12)*a**S(7)*(a*b + b**S(2)*x**(S(1)/3))**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(11)*(p + S(1))) + S(84)*a**S(6)*(a*b + b**S(2)*x**(S(1)/3))**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(12)*(S(2)*p + S(3))) - S(84)*a**S(5)*(a*b + b**S(2)*x**(S(1)/3))**S(4)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(13)*(p + S(2))) + S(210)*a**S(4)*(a*b + b**S(2)*x**(S(1)/3))**S(5)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(14)*(S(2)*p + S(5))) - S(84)*a**S(3)*(a*b + b**S(2)*x**(S(1)/3))**S(6)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(15)*(p + S(3))) + S(84)*a**S(2)*(a*b + b**S(2)*x**(S(1)/3))**S(7)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(16)*(S(2)*p + S(7))) - S(12)*a*(a*b + b**S(2)*x**(S(1)/3))**S(8)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(17)*(p + S(4))) + S(3)*(a*b + b**S(2)*x**(S(1)/3))**S(9)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(18)*(S(2)*p + S(9))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p, x), x, -S(3)*a**S(5)*(a + b*x**(S(1)/3))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(6)*(S(2)*p + S(1))) + S(15)*a**S(4)*(a*b + b**S(2)*x**(S(1)/3))**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(S(2)*b**S(8)*(p + S(1))) - S(30)*a**S(3)*(a*b + b**S(2)*x**(S(1)/3))**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(9)*(S(2)*p + S(3))) + S(15)*a**S(2)*(a*b + b**S(2)*x**(S(1)/3))**S(4)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(10)*(p + S(2))) - S(15)*a*(a*b + b**S(2)*x**(S(1)/3))**S(5)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(b**S(11)*(S(2)*p + S(5))) + S(3)*(a*b + b**S(2)*x**(S(1)/3))**S(6)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(S(2)*b**S(12)*(p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/x, x), x, -(S(3)*a + S(3)*b*x**(S(1)/3))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p*hyper((S(1), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**(S(1)/3)/a)/(a*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/x**S(2), x), x, (S(3)*a*b**S(3) + S(3)*b**S(4)*x**(S(1)/3))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p*hyper((S(4), S(2)*p + S(1)), (S(2)*p + S(2),), S(1) + b*x**(S(1)/3)/a)/(a**S(4)*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/x**S(2) - S(2)*b**S(3)*p*(-S(2)*p + S(1))*(-p + S(1))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(S(3)*a**S(3)*x), x), x, -(a + b*x**(S(1)/3))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(a*x) + b*(a + b*x**(S(1)/3))*(-p + S(1))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(a**S(2)*x**(S(2)/3)) - b**S(2)*(a + b*x**(S(1)/3))*(-S(2)*p + S(1))*(-p + S(1))*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**p/(a**S(3)*x**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/4) + b**S(2)*sqrt(x))**(S(-3)/2), x), x, -S(12)*a*(a + b*x**(S(1)/4))*log(a + b*x**(S(1)/4))/(b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/4) + b**S(2)*sqrt(x))) - x**(S(3)/4)*(S(2)*a + S(2)*b*x**(S(1)/4))/(b*(a**S(2) + S(2)*a*b*x**(S(1)/4) + b**S(2)*sqrt(x))**(S(3)/2)) - S(6)*sqrt(x)/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/4) + b**S(2)*sqrt(x))) + S(12)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/4) + b**S(2)*sqrt(x))/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))**(S(-5)/2), x), x, -S(30)*a*(a + b*x**(S(1)/6))*log(a + b*x**(S(1)/6))/(b**S(6)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))) - x**(S(5)/6)*(S(3)*a + S(3)*b*x**(S(1)/6))/(S(2)*b*(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))**(S(5)/2)) - S(5)*x**(S(2)/3)/(S(2)*b**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))**(S(3)/2)) - sqrt(x)*(S(5)*a + S(5)*b*x**(S(1)/6))/(b**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))**(S(3)/2)) - S(15)*x**(S(1)/3)/(b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))) + S(30)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/6) + b**S(2)*x**(S(1)/3))/b**S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/sqrt(x) + b**S(2)/x)**(S(3)/2), x), x, -S(6)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b/sqrt(x) + b**S(2)/x)*log(S(1)/sqrt(x))/(a + b/sqrt(x)) - S(6)*b**S(2)*sqrt(a**S(2) + S(2)*a*b/sqrt(x) + b**S(2)/x) + S(3)*b*sqrt(x)*(a + b/sqrt(x))*sqrt(a**S(2) + S(2)*a*b/sqrt(x) + b**S(2)/x) + x*(a**S(2) + S(2)*a*b/sqrt(x) + b**S(2)/x)**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(7)/2), x), x, -S(105)*a**S(4)*b**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))*log(x**(S(-1)/3))/(a + b/x**(S(1)/3)) - S(105)*a**S(3)*b**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)) - S(105)*a**S(2)*b**S(3)*(a + b/x**(S(1)/3))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/S(2) - S(35)*a*b**S(3)*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2) - S(105)*b**S(3)*(a + b/x**(S(1)/3))*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2)/S(4) + S(21)*b**S(2)*x**(S(1)/3)*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(5)/2) + S(7)*b*x**(S(2)/3)*(a + b/x**(S(1)/3))*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(5)/2)/S(2) + x*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(7)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(5)/2), x), x, -S(30)*a**S(2)*b**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))*log(x**(S(-1)/3))/(a + b/x**(S(1)/3)) - S(30)*a*b**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)) - S(15)*b**S(3)*(a + b/x**(S(1)/3))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)) + S(10)*b**S(2)*x**(S(1)/3)*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2) + S(5)*b*x**(S(2)/3)*(a + b/x**(S(1)/3))*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2)/S(2) + x*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2), x), x, S(3)*a*b**S(2)*x**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/(a + b/x**(S(1)/3)) - S(3)*b**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))*log(x**(S(-1)/3))/(a + b/x**(S(1)/3)) + S(3)*b*x**(S(2)/3)*(a + b/x**(S(1)/3))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/S(2) + x*(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)), x), x, -a*x*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/(S(2)*a + S(2)*b/x**(S(1)/3)) + S(3)*x*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)), x), x, x*(a + b/x**(S(1)/3))/(a*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) - S(3)*b*x**(S(2)/3)*(a + b/x**(S(1)/3))/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) + S(3)*b**S(2)*x**(S(1)/3)*(a + b/x**(S(1)/3))/(a**S(3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) - S(3)*b**S(3)*(a + b/x**(S(1)/3))*log(a*x**(S(1)/3) + b)/(a**S(4)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3)), x), x, x*(a + b/x**(S(1)/3))/(a*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) - S(3)*b*x**(S(2)/3)*(a + b/x**(S(1)/3))/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) + S(3)*b**S(3)*(a + b/x**(S(1)/3))*log(x**(S(-1)/3))/(a**S(4)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) - S(3)*b**S(3)*(a + b/x**(S(1)/3))*log(a + b/x**(S(1)/3))/(a**S(4)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))) + S(3)*b**S(2)*x**(S(1)/3)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/3) + b**S(2)/x**(S(2)/3))/a**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(-3)/2), x), x, -x**(S(2)/3)*(S(3)*a + S(3)*b*x**(S(1)/3))/(S(2)*b*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(3)/2)) - S(3)*x**(S(1)/3)/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))) + (S(3)*a + S(3)*b*x**(S(1)/3))*log(a + b*x**(S(1)/3))/(b**S(3)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(-5)/2), x), x, x*(S(3)*a + S(3)*b*x**(S(1)/3))/(S(4)*a*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(5)/2)) + x/(S(4)*a**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(-7)/2), x), x, -x**(S(2)/3)*(a + b*x**(S(1)/3))/(S(2)*b*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(7)/2)) - x**(S(1)/3)/(S(5)*b**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(5)/2)) - (a + b*x**(S(1)/3))/(S(20)*b**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(-9)/2), x), x, -x**(S(2)/3)*(S(3)*a + S(3)*b*x**(S(1)/3))/(S(8)*b*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(9)/2)) - S(3)*x**(S(1)/3)/(S(28)*b**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(7)/2)) - (a + b*x**(S(1)/3))/(S(56)*b**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(-11)/2), x), x, -x**(S(2)/3)*(S(3)*a + S(3)*b*x**(S(1)/3))/(S(10)*b*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(11)/2)) - x**(S(1)/3)/(S(15)*b**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(9)/2)) - (a + b*x**(S(1)/3))/(S(120)*b**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/3) + b**S(2)*x**(S(2)/3))**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x))**(S(5)/2), x), x, -S(20)*a*b**S(4)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x))*log(x**(S(-1)/4))/(a + b/x**(S(1)/4)) - S(20)*b**S(4)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x)) + S(10)*b**S(3)*x**(S(1)/4)*(a + b/x**(S(1)/4))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x)) + S(10)*b**S(2)*sqrt(x)*(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x))**(S(3)/2)/S(3) + S(5)*b*x**(S(3)/4)*(a + b/x**(S(1)/4))*(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x))**(S(3)/2)/S(3) + x*(a**S(2) + S(2)*a*b/x**(S(1)/4) + b**S(2)/sqrt(x))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))**(S(5)/2), x), x, S(5)*a*b**S(4)*x**(S(1)/5)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))/(a + b/x**(S(1)/5)) - S(5)*b**S(5)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))*log(x**(S(-1)/5))/(a + b/x**(S(1)/5)) + S(5)*b**S(3)*x**(S(2)/5)*(a + b/x**(S(1)/5))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))/S(2) + S(5)*b**S(2)*x**(S(3)/5)*(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))**(S(3)/2)/S(3) + S(5)*b*x**(S(4)/5)*(a + b/x**(S(1)/5))*(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))**(S(3)/2)/S(4) + x*(a**S(2) + S(2)*a*b/x**(S(1)/5) + b**S(2)/x**(S(2)/5))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))**(S(-5)/2), x), x, -x**(S(4)/5)*(S(5)*a + S(5)*b*x**(S(1)/5))/(S(4)*b*(a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))**(S(5)/2)) - S(5)*x**(S(3)/5)/(S(3)*b**S(2)*(a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))**(S(3)/2)) - x**(S(2)/5)*(S(5)*a + S(5)*b*x**(S(1)/5))/(S(2)*b**S(3)*(a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))**(S(3)/2)) - S(5)*x**(S(1)/5)/(b**S(4)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))) + (S(5)*a + S(5)*b*x**(S(1)/5))*log(a + b*x**(S(1)/5))/(b**S(5)*sqrt(a**S(2) + S(2)*a*b*x**(S(1)/5) + b**S(2)*x**(S(2)/5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(7)/2), x), x, -S(42)*a*b**S(6)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))*log(x**(S(-1)/6))/(a + b/x**(S(1)/6)) - S(42)*b**S(6)*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3)) + S(21)*b**S(5)*x**(S(1)/6)*(a + b/x**(S(1)/6))*sqrt(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3)) + S(7)*b**S(4)*x**(S(1)/3)*(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(3)/2) + S(7)*b**S(3)*sqrt(x)*(a + b/x**(S(1)/6))*(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(3)/2)/S(2) + S(21)*b**S(2)*x**(S(2)/3)*(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(5)/2)/S(10) + S(7)*b*x**(S(5)/6)*(a + b/x**(S(1)/6))*(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(5)/2)/S(5) + x*(a**S(2) + S(2)*a*b/x**(S(1)/6) + b**S(2)/x**(S(1)/3))**(S(7)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(4)*n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, b**S(2)*log(b + c*x**n)/(c**S(3)*n) - b*x**n/(c**S(2)*n) + x**(S(2)*n)/(S(2)*c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)*n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -b*log(b + c*x**n)/(c**S(2)*n) + x**n/(c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, log(b + c*x**n)/(c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, log(x)/b - log(b + c*x**n)/(b*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -x**(-S(2)*n)/(S(2)*b*n) + c*x**(-n)/(b**S(2)*n) + c**S(2)*log(x)/b**S(3) - c**S(2)*log(b + c*x**n)/(b**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-S(2)*n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -x**(-S(3)*n)/(S(3)*b*n) + c*x**(-S(2)*n)/(S(2)*b**S(2)*n) - c**S(2)*x**(-n)/(b**S(3)*n) - c**S(3)*log(x)/b**S(4) + c**S(3)*log(b + c*x**n)/(b**S(4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-S(3)*n + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -x**(-S(4)*n)/(S(4)*b*n) + c*x**(-S(3)*n)/(S(3)*b**S(2)*n) - c**S(2)*x**(-S(2)*n)/(S(2)*b**S(3)*n) + c**S(3)*x**(-n)/(b**S(4)*n) + c**S(4)*log(x)/b**S(5) - c**S(4)*log(b + c*x**n)/(b**S(5)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(4) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(4)*x**(-S(3)*n/S(4))/(S(3)*b*n) + sqrt(S(2))*c**(S(3)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*x**(n/S(4)) + sqrt(b) + sqrt(c)*x**(n/S(2)))/(S(2)*b**(S(7)/4)*n) - sqrt(S(2))*c**(S(3)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*x**(n/S(4)) + sqrt(b) + sqrt(c)*x**(n/S(2)))/(S(2)*b**(S(7)/4)*n) + sqrt(S(2))*c**(S(3)/4)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*x**(n/S(4))/b**(S(1)/4))/(b**(S(7)/4)*n) - sqrt(S(2))*c**(S(3)/4)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*x**(n/S(4))/b**(S(1)/4))/(b**(S(7)/4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(3) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(3)*x**(-S(2)*n/S(3))/(S(2)*b*n) - c**(S(2)/3)*log(b**(S(1)/3) + c**(S(1)/3)*x**(n/S(3)))/(b**(S(5)/3)*n) + c**(S(2)/3)*log(b**(S(2)/3) - b**(S(1)/3)*c**(S(1)/3)*x**(n/S(3)) + c**(S(2)/3)*x**(S(2)*n/S(3)))/(S(2)*b**(S(5)/3)*n) + sqrt(S(3))*c**(S(2)/3)*atan(sqrt(S(3))*(b**(S(1)/3) - S(2)*c**(S(1)/3)*x**(n/S(3)))/(S(3)*b**(S(1)/3)))/(b**(S(5)/3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(2) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(2)*x**(-n/S(2))/(b*n) + S(2)*sqrt(c)*atan(sqrt(b)*x**(-n/S(2))/sqrt(c))/(b**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(2) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(2)*x**(-S(3)*n/S(2))/(S(3)*b*n) + S(2)*c*x**(-n/S(2))/(b**S(2)*n) - S(2)*c**(S(3)/2)*atan(sqrt(b)*x**(-n/S(2))/sqrt(c))/(b**(S(5)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(3) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(3)*x**(-S(4)*n/S(3))/(S(4)*b*n) + S(3)*c*x**(-n/S(3))/(b**S(2)*n) - c**(S(4)/3)*log(b**(S(1)/3)*x**(-n/S(3)) + c**(S(1)/3))/(b**(S(7)/3)*n) + c**(S(4)/3)*log(b**(S(2)/3)*x**(-S(2)*n/S(3)) - b**(S(1)/3)*c**(S(1)/3)*x**(-n/S(3)) + c**(S(2)/3))/(S(2)*b**(S(7)/3)*n) + sqrt(S(3))*c**(S(4)/3)*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*x**(-n/S(3)) + c**(S(1)/3))/(S(3)*c**(S(1)/3)))/(b**(S(7)/3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(4) + S(-1))/(b*x**n + c*x**(S(2)*n)), x), x, -S(4)*x**(-S(5)*n/S(4))/(S(5)*b*n) + S(4)*c*x**(-n/S(4))/(b**S(2)*n) + sqrt(S(2))*c**(S(5)/4)*log(-sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*x**(-n/S(4)) + sqrt(b)*x**(-n/S(2)) + sqrt(c))/(S(2)*b**(S(9)/4)*n) - sqrt(S(2))*c**(S(5)/4)*log(sqrt(S(2))*b**(S(1)/4)*c**(S(1)/4)*x**(-n/S(4)) + sqrt(b)*x**(-n/S(2)) + sqrt(c))/(S(2)*b**(S(9)/4)*n) - sqrt(S(2))*c**(S(5)/4)*atan(sqrt(S(2))*b**(S(1)/4)*x**(-n/S(4))/c**(S(1)/4) + S(-1))/(b**(S(9)/4)*n) - sqrt(S(2))*c**(S(5)/4)*atan(sqrt(S(2))*b**(S(1)/4)*x**(-n/S(4))/c**(S(1)/4) + S(1))/(b**(S(9)/4)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*(p + S(-1)) + S(-1))*(b*x**n + c*x**(S(2)*n))**p, x), x, x**(-n*(p + S(1)))*(b*x**n + c*x**(S(2)*n))**(p + S(1))/(c*n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*(S(2)*p + S(1)) + S(-1))*(b*x**n + c*x**(S(2)*n))**p, x), x, -x**(-S(2)*n*(p + S(1)))*(b*x**n + c*x**(S(2)*n))**(p + S(1))/(b*n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**p, x), x, -a*(a + b*x**n)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**p/(b**S(2)*n*(S(2)*p + S(1))) + (a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(p + S(1))/(S(2)*b**S(2)*n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2), x), x, -a*(a + b*x**n)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2)/(S(6)*b**S(2)*n) + (a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(7)/2)/(S(7)*b**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, -a*(a + b*x**n)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/(S(4)*b**S(2)*n) + (a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2)/(S(5)*b**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, a*x**(S(2)*n)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(6)*n*(a + b*x**n)) + x**(S(2)*n)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, -a*(a + b*x**n)*log(a + b*x**n)/(b**S(2)*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))) + sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(b**S(2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, x**(S(2)*n)*(a + b*x**n)/(S(2)*a*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2), x), x, a*(a + b*x**n)/(S(4)*b**S(2)*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2)) - S(1)/(S(3)*b**S(2)*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(7)/2), x), x, a*(a + b*x**n)/(S(6)*b**S(2)*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(7)/2)) - S(1)/(S(5)*b**S(2)*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, a*n*(d*x)**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(d*(a + b*x**n)*(m + S(1))*(m + n + S(1))) + (d*x)**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(d*(m + n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, a*n*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a + b*x**n)*(S(3)*n + S(9))) + x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(n + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, a*n*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a + b*x**n)*(S(2)*n + S(4))) + x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, a*n*x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a + b*x**n)*(n + S(1))) + x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/x, x), x, a*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))*log(x)/(a + b*x**n) + sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/x**S(2), x), x, a*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(x*(a + b*x**n)*(-n + S(1))) - sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(x*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/x**S(3), x), x, a*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(x**S(2)*(a + b*x**n)*(-S(2)*n + S(4))) - sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(x**S(2)*(-n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, a**S(3)*(d*x)**(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(d*(a + b*x**n)*(m + S(1))) + S(3)*a**S(2)*b**S(2)*x**(n + S(1))*(d*x)**m*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a*b + b**S(2)*x**n)*(m + n + S(1))) + S(3)*a*b**S(3)*x**(S(2)*n + S(1))*(d*x)**m*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a*b + b**S(2)*x**n)*(m + S(2)*n + S(1))) + b**S(4)*x**(S(3)*n + S(1))*(d*x)**m*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a*b + b**S(2)*x**n)*(m + S(3)*n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, a**S(3)*x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(3)*a + S(3)*b*x**n) + S(3)*a**S(2)*b**S(2)*x**(n + S(3))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((n + S(3))*(a*b + b**S(2)*x**n)) + S(3)*a*b**S(3)*x**(S(2)*n + S(3))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((S(2)*n + S(3))*(a*b + b**S(2)*x**n)) + b**S(4)*x**(S(3)*n + S(3))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((S(3)*n + S(3))*(a*b + b**S(2)*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, a**S(3)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(2)*a + S(2)*b*x**n) + S(3)*a**S(2)*b**S(2)*x**(n + S(2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((n + S(2))*(a*b + b**S(2)*x**n)) + S(3)*a*b**S(3)*x**(S(2)*n + S(2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((S(2)*n + S(2))*(a*b + b**S(2)*x**n)) + b**S(4)*x**(S(3)*n + S(2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((S(3)*n + S(2))*(a*b + b**S(2)*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, S(6)*a**S(3)*n**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((a + b*x**n)*(S(6)*n**S(3) + S(11)*n**S(2) + S(6)*n + S(1))) + S(6)*a**S(2)*n**S(2)*x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(6)*n**S(3) + S(11)*n**S(2) + S(6)*n + S(1)) + S(3)*n*x*(a**S(2) + a*b*x**n)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(6)*n**S(2) + S(5)*n + S(1)) + x*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/(S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/x, x), x, a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))*log(x)/(a + b*x**n) + a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/n + (a**S(2) + a*b*x**n)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(2)*n) + (a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/x**S(2), x), x, -a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(x*(a + b*x**n)) - S(3)*a**S(2)*b**S(2)*x**(n + S(-1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-n + S(1))*(a*b + b**S(2)*x**n)) - S(3)*a*b**S(3)*x**(S(2)*n + S(-1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-S(2)*n + S(1))*(a*b + b**S(2)*x**n)) - b**S(4)*x**(S(3)*n + S(-1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-S(3)*n + S(1))*(a*b + b**S(2)*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)/x**S(3), x), x, -a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/(S(2)*x**S(2)*(a + b*x**n)) - S(3)*a**S(2)*b**S(2)*x**(n + S(-2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-n + S(2))*(a*b + b**S(2)*x**n)) - S(3)*a*b**S(3)*x**(S(2)*n + S(-2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-S(2)*n + S(2))*(a*b + b**S(2)*x**n)) - b**S(4)*x**(S(3)*n + S(-2))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))/((-S(3)*n + S(2))*(a*b + b**S(2)*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, (d*x)**(m + S(1))*(a + b*x**n)*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -b*x**n/a)/(a*d*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, x**S(3)*(a + b*x**n)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -b*x**n/a)/(S(3)*a*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, x**S(2)*(a + b*x**n)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -b*x**n/a)/(S(2)*a*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n)), x), x, x*(a + b*x**n)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -b*x**n/a)/(a*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), x), x, (a + b*x**n)*log(x)/(a*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))) - (a + b*x**n)*log(a + b*x**n)/(a*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), x), x, -(a + b*x**n)*hyper((S(1), -S(1)/n), (-(-n + S(1))/n,), -b*x**n/a)/(a*x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), x), x, -(a + b*x**n)*hyper((S(1), -S(2)/n), (-(-n + S(2))/n,), -b*x**n/a)/(S(2)*a*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, (d*x)**(m + S(1))*(a + b*x**n)*hyper((S(3), (m + S(1))/n), ((m + n + S(1))/n,), -b*x**n/a)/(a**S(3)*d*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, x**S(3)*(a + b*x**n)*hyper((S(3), S(3)/n), ((n + S(3))/n,), -b*x**n/a)/(S(3)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2), x), x, x**S(2)*(a + b*x**n)*hyper((S(3), S(2)/n), ((n + S(2))/n,), -b*x**n/a)/(S(2)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(-3)/2), x), x, x*(a + b*x**n)*hyper((S(3), S(1)/n), (S(1) + S(1)/n,), -b*x**n/a)/(a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)), x), x, (a + b*x**n)/(S(2)*a*n*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)) + S(1)/(a**S(2)*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))) + (a + b*x**n)*log(x)/(a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))) - (a + b*x**n)*log(a + b*x**n)/(a**S(3)*n*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)), x), x, -(a + b*x**n)*hyper((S(3), -S(1)/n), (-(-n + S(1))/n,), -b*x**n/a)/(a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(3)/2)), x), x, -(a + b*x**n)*hyper((S(3), -S(2)/n), (-(-n + S(2))/n,), -b*x**n/a)/(S(2)*a**S(3)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(-S(1)/(S(2)*p + S(1))) + b**S(2)*x**(-S(2)/(S(2)*p + S(1))))**p, x), x, x*(a + b*x**(S(1)/(-S(2)*p + S(-1))))*(a**S(2) + S(2)*a*b*x**(S(1)/(-S(2)*p + S(-1))) + b**S(2)*x**(-S(2)/(S(2)*p + S(1))))**p/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**((-n + S(-1))/(S(2)*n)), x), x, x*(a + b*x**n)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(-(n + S(1))/(S(2)*n))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**(-S(1)/(S(2)*p + S(2))) + b**S(2)*x**(-S(1)/(p + S(1))))**p, x), x, x*(a + b*x**(-S(1)/(S(2)*p + S(2))))*(S(2)*p + S(2))*(a**S(2) + S(2)*a*b*x**(-S(1)/(S(2)*p + S(2))) + b**S(2)*x**(-S(1)/(p + S(1))))**p/(a*(S(2)*p + S(1))) - x*(a**S(2) + S(2)*a*b*x**(-S(1)/(S(2)*p + S(2))) + b**S(2)*x**(-S(1)/(p + S(1))))**(p + S(1))/(a**S(2)*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**((-S(2)*n + S(-1))/(S(2)*n)), x), x, x*(a + b*x**n)*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(S(-1) - S(1)/(S(2)*n))/(a*(n + S(1))) + n*x*(a**S(2) + S(2)*a*b*x**n + b**S(2)*x**(S(2)*n))**(-S(1)/(S(2)*n))/(a**S(2)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(4)*n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -b*x**n/(c**S(2)*n) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*n*sqrt(-S(4)*a*c + b**S(2))) + x**(S(2)*n)/(S(2)*c*n) + (-a*c + b**S(2))*log(a + b*x**n + c*x**(S(2)*n))/(S(2)*c**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)*n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -b*log(a + b*x**n + c*x**(S(2)*n))/(S(2)*c**S(2)*n) + x**n/(c*n) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*n*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, b*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(c*n*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x**n + c*x**(S(2)*n))/(S(2)*c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(n*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -x**(-n)/(a*n) - b*log(x)/a**S(2) + b*log(a + b*x**n + c*x**(S(2)*n))/(S(2)*a**S(2)*n) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(2)*n*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-S(2)*n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -x**(-S(2)*n)/(S(2)*a*n) + b*x**(-n)/(a**S(2)*n) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*n*sqrt(-S(4)*a*c + b**S(2))) + (-a*c + b**S(2))*log(x)/a**S(3) - (-a*c + b**S(2))*log(a + b*x**n + c*x**(S(2)*n))/(S(2)*a**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-S(3)*n + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -x**(-S(3)*n)/(S(3)*a*n) + b*x**(-S(2)*n)/(S(2)*a**S(2)*n) - x**(-n)*(-a*c + b**S(2))/(a**S(3)*n) - b*(-S(2)*a*c + b**S(2))*log(x)/a**S(4) + b*(-S(2)*a*c + b**S(2))*log(a + b*x**n + c*x**(S(2)*n))/(S(2)*a**S(4)*n) - (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*n*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(4) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x**(n/S(4))/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(n*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) - S(2)*S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x**(n/S(4))/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(n*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)*S(2)**(S(3)/4)*c**(S(3)/4)*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x**(n/S(4))/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(n*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))) + S(2)*S(2)**(S(3)/4)*c**(S(3)/4)*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x**(n/S(4))/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(n*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(3) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3)) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**(S(2)*n/S(3)) - S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3))*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(2)*n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3))/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3)) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*c**(S(2)/3)*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**(S(2)*n/S(3)) - S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3))*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(2)*n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))) - S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x**(n/S(3))/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(2) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x**(n/S(2))/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(n*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x**(n/S(2))/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(n*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(2) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*x**(-n/S(2))/(a*n) + sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(a)*x**(-n/S(2))/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(a**(S(3)/2)*n*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(a)*x**(-n/S(2))/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(a**(S(3)/2)*n*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(3) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(3)*x**(-n/S(3))/(a*n) + S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3)) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(2)*a**(S(4)/3)*n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*a**(S(2)/3)*x**(-S(2)*n/S(3)) - S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3))*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(4)*a**(S(4)/3)*n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3))/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(2)*a**(S(4)/3)*n*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3)) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(2)*a**(S(4)/3)*n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*a**(S(2)/3)*x**(-S(2)*n/S(3)) - S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3))*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(4)*a**(S(4)/3)*n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*a**(S(1)/3)*x**(-n/S(3))/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(2)*a**(S(4)/3)*n*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n/S(4) + S(-1))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(4)*x**(-n/S(4))/(a*n) - S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*a**(S(1)/4)*x**(-n/S(4))/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(a**(S(5)/4)*n*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*a**(S(1)/4)*x**(-n/S(4))/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(a**(S(5)/4)*n*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*a**(S(1)/4)*x**(-n/S(4))/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(a**(S(5)/4)*n*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*a**(S(1)/4)*x**(-n/S(4))/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(a**(S(5)/4)*n*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**n + c*x**(S(2)*n)), x), x, -c*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - c*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**n + c*x**(S(2)*n))), x), x, b*atanh((b + S(2)*c*x**n)/sqrt(-S(4)*a*c + b**S(2)))/(a*n*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x**n + c*x**(S(2)*n))/(S(2)*a*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**n + c*x**(S(2)*n))), x), x, S(2)*c*hyper((S(1), -S(1)/n), (-(-n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + S(2)*c*hyper((S(1), -S(1)/n), (-(-n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(x*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**n + c*x**(S(2)*n))), x), x, c*hyper((S(1), -S(2)/n), (-(-n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(x**S(2)*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + c*hyper((S(1), -S(2)/n), (-(-n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(x**S(2)*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(4)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(4)/n, S(-1)/2, S(-1)/2, (n + S(4))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(3)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(3)/n, S(-1)/2, S(-1)/2, (n + S(3))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(2)/n, S(-1)/2, S(-1)/2, (n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1)/n, S(-1)/2, S(-1)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**n + c*x**(S(2)*n))/x**S(2), x), x, -sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(-S(1)/n, S(-1)/2, S(-1)/2, -(-n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**n + c*x**(S(2)*n))/x**S(3), x), x, -sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(-S(2)/n, S(-1)/2, S(-1)/2, -(-n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*x**S(4)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(4)/n, S(-3)/2, S(-3)/2, (n + S(4))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*x**S(3)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(3)/n, S(-3)/2, S(-3)/2, (n + S(3))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(2)/n, S(-3)/2, S(-3)/2, (n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*x*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1)/n, S(-3)/2, S(-3)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(3)/2)/x**S(2), x), x, -a*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(-S(1)/n, S(-3)/2, S(-3)/2, -(-n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(3)/2)/x**S(3), x), x, -a*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(-S(2)/n, S(-3)/2, S(-3)/2, -(-n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(4)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(4)/n, S(1)/2, S(1)/2, (n + S(4))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(3)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/n, S(1)/2, S(1)/2, (n + S(3))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x**S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/n, S(1)/2, S(1)/2, (n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/n, S(1)/2, S(1)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/sqrt(a + b*x**n + c*x**(S(2)*n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, x**S(3)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/n, S(3)/2, S(3)/2, (n + S(3))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, x**S(2)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/n, S(3)/2, S(3)/2, (n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(-3)/2), x), x, x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/n, S(3)/2, S(3)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**n + c*x**(S(2)*n))) - atanh((S(2)*a + b*x**n)/(S(2)*sqrt(a)*sqrt(a + b*x**n + c*x**(S(2)*n))))/(a**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2)), x), x, -sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(-S(1)/n, S(3)/2, S(3)/2, -(-n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*x*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2)), x), x, -sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(-S(2)/n, S(3)/2, S(3)/2, -(-n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))), x), x, -sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(-S(1)/n, S(1)/2, S(1)/2, -(-n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(x*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*x**n + c*x**(S(2)*n))), x), x, -sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(-S(2)/n, S(1)/2, S(1)/2, -(-n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*x**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, x**S(4)*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(4)/n, S(3)/2, S(3)/2, (n + S(4))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*(d*x)**(m + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1((m + S(1))/n, S(-3)/2, S(-3)/2, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, (d*x)**(m + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1((m + S(1))/n, S(-1)/2, S(-1)/2, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1((m + S(1))/n, S(1)/2, S(1)/2, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, (d*x)**(m + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1((m + S(1))/n, S(3)/2, S(3)/2, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*(m + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**n + c*x**(S(2)*n))**p, x), x, (d*x)**(m + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + S(1))/n, -p, -p, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6)), x), x, -d*(d + e*x)*sqrt(S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/3, S(1)/2, S(1)/2, S(4)/3, -S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(e**S(2)*sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6))) + (d + e*x)**S(2)*sqrt(S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/3, S(1)/2, S(1)/2, S(5)/3, -S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*e**S(2)*sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6)), x), x, d**S(2)*(d + e*x)*sqrt(S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/3, S(1)/2, S(1)/2, S(4)/3, -S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(e**S(3)*sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6))) - d*(d + e*x)**S(2)*sqrt(S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(2)/3, S(1)/2, S(1)/2, S(5)/3, -S(2)*c*(d + e*x)**S(3)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*(d + e*x)**S(3)/(b + sqrt(-S(4)*a*c + b**S(2))))/(e**S(3)*sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6))) + atanh((b + S(2)*c*(d + e*x)**S(3))/(S(2)*sqrt(c)*sqrt(a + b*(d + e*x)**S(3) + c*(d + e*x)**S(6))))/(S(3)*sqrt(c)*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**n + c*x**(S(2)*n))/x, x), x, -sqrt(a)*atanh((S(2)*a + b*x**n)/(S(2)*sqrt(a)*sqrt(a + b*x**n + c*x**(S(2)*n))))/n + b*atanh((b + S(2)*c*x**n)/(S(2)*sqrt(c)*sqrt(a + b*x**n + c*x**(S(2)*n))))/(S(2)*sqrt(c)*n) + sqrt(a + b*x**n + c*x**(S(2)*n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(3)/2)/x, x), x, -a**(S(3)/2)*atanh((S(2)*a + b*x**n)/(S(2)*sqrt(a)*sqrt(a + b*x**n + c*x**(S(2)*n))))/n - b*(-S(12)*a*c + b**S(2))*atanh((b + S(2)*c*x**n)/(S(2)*sqrt(c)*sqrt(a + b*x**n + c*x**(S(2)*n))))/(S(16)*c**(S(3)/2)*n) + (a + b*x**n + c*x**(S(2)*n))**(S(3)/2)/(S(3)*n) + sqrt(a + b*x**n + c*x**(S(2)*n))*(S(8)*a*c + b**S(2) + S(2)*b*c*x**n)/(S(8)*c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*x**n + c*x**(S(2)*n))), x), x, -atanh((S(2)*a + b*x**n)/(S(2)*sqrt(a)*sqrt(a + b*x**n + c*x**(S(2)*n))))/(sqrt(a)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, a**S(3)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(3)*a**S(2)*b*x**(n + S(1))*(d*x)**m/(m + n + S(1)) + S(3)*a*x**(S(2)*n + S(1))*(d*x)**m*(a*c + b**S(2))/(m + S(2)*n + S(1)) + S(3)*b*c**S(2)*x**(S(5)*n + S(1))*(d*x)**m/(m + S(5)*n + S(1)) + b*x**(S(3)*n + S(1))*(d*x)**m*(S(6)*a*c + b**S(2))/(m + S(3)*n + S(1)) + c**S(3)*x**(S(6)*n + S(1))*(d*x)**m/(m + S(6)*n + S(1)) + S(3)*c*x**(S(4)*n + S(1))*(d*x)**m*(a*c + b**S(2))/(m + S(4)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, a**S(2)*(d*x)**(m + S(1))/(d*(m + S(1))) + S(2)*a*b*x**(n + S(1))*(d*x)**m/(m + n + S(1)) + S(2)*b*c*x**(S(3)*n + S(1))*(d*x)**m/(m + S(3)*n + S(1)) + c**S(2)*x**(S(4)*n + S(1))*(d*x)**m/(m + S(4)*n + S(1)) + x**(S(2)*n + S(1))*(d*x)**m*(S(2)*a*c + b**S(2))/(m + S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m*(a + b*x**n + c*x**(S(2)*n)), x), x, a*(d*x)**(m + S(1))/(d*(m + S(1))) + b*x**(n + S(1))*(d*x)**m/(m + n + S(1)) + c*x**(S(2)*n + S(1))*(d*x)**m/(m + S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*(d*x)**(m + S(1))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(d*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*(d*x)**(m + S(1))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(d*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, -c*(d*x)**(m + S(1))*(S(4)*a*c*(m - S(2)*n + S(1)) - b**S(2)*(m - n + S(1)) + b*sqrt(-S(4)*a*c + b**S(2))*(m - n + S(1)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*d*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + c*(d*x)**(m + S(1))*(-b*(m - n + S(1)) + (S(4)*a*c*(m - S(2)*n + S(1)) - b**S(2)*(m - n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*d*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))) + (d*x)**(m + S(1))*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*d*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**m/(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, (d*x)**(m + S(1))*(-S(2)*a*c + b**S(2) + b*c*x**n)/(S(2)*a*d*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)) - c*(d*x)**(m + S(1))*(S(8)*a**S(2)*c**S(2)*(m**S(2) + m*(-S(6)*n + S(2)) + S(8)*n**S(2) - S(6)*n + S(1)) - S(6)*a*b**S(2)*c*(m**S(2) + m*(-S(4)*n + S(2)) + S(3)*n**S(2) - S(4)*n + S(1)) + b**S(4)*(m**S(2) + m*(-S(3)*n + S(2)) + S(2)*n**S(2) - S(3)*n + S(1)) + b*sqrt(-S(4)*a*c + b**S(2))*(S(2)*a*c*(S(2)*m - S(7)*n + S(2)) - b**S(2)*(m - S(2)*n + S(1)))*(m - n + S(1)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*d*n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(5)/2)) - c*(d*x)**(m + S(1))*(-S(8)*a**S(2)*c**S(2)*(m**S(2) + m*(-S(6)*n + S(2)) + S(8)*n**S(2) - S(6)*n + S(1)) + S(6)*a*b**S(2)*c*(m**S(2) + m*(-S(4)*n + S(2)) + S(3)*n**S(2) - S(4)*n + S(1)) - b**S(4)*(m**S(2) + m*(-S(3)*n + S(2)) + S(2)*n**S(2) - S(3)*n + S(1)) + b*sqrt(-S(4)*a*c + b**S(2))*(S(2)*a*c*(S(2)*m - S(7)*n + S(2)) - b**S(2)*(m - S(2)*n + S(1)))*(m - n + S(1)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*d*n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(5)/2)) - (d*x)**(m + S(1))*(S(4)*a**S(2)*c**S(2)*(m - S(4)*n + S(1)) - S(5)*a*b**S(2)*c*(m - S(3)*n + S(1)) + b**S(4)*(m - S(2)*n + S(1)) - b*c*x**n*(S(2)*a*c*(S(2)*m - S(7)*n + S(2)) - b**S(2)*(m - S(2)*n + S(1))))/(S(2)*a**S(2)*d*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, a*(d + e*x)**S(4)/(S(4)*e) + b*(d + e*x)**S(6)/(S(6)*e) + c*(d + e*x)**S(8)/(S(8)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, a**S(2)*(d + e*x)**S(4)/(S(4)*e) + a*b*(d + e*x)**S(6)/(S(3)*e) + b*c*(d + e*x)**S(10)/(S(5)*e) + c**S(2)*(d + e*x)**S(12)/(S(12)*e) + (d + e*x)**S(8)*(S(2)*a*c + b**S(2))/(S(8)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, a**S(3)*(d + e*x)**S(4)/(S(4)*e) + a**S(2)*b*(d + e*x)**S(6)/(S(2)*e) + S(3)*a*(d + e*x)**S(8)*(a*c + b**S(2))/(S(8)*e) + S(3)*b*c**S(2)*(d + e*x)**S(14)/(S(14)*e) + b*(d + e*x)**S(10)*(S(6)*a*c + b**S(2))/(S(10)*e) + c**S(3)*(d + e*x)**S(16)/(S(16)*e) + c*(d + e*x)**S(12)*(a*c + b**S(2))/(S(4)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, a*f**S(3)*(d + e*x)**S(4)/(S(4)*e) + b*f**S(3)*(d + e*x)**S(6)/(S(6)*e) + c*f**S(3)*(d + e*x)**S(8)/(S(8)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, a**S(2)*f**S(3)*(d + e*x)**S(4)/(S(4)*e) + a*b*f**S(3)*(d + e*x)**S(6)/(S(3)*e) + b*c*f**S(3)*(d + e*x)**S(10)/(S(5)*e) + c**S(2)*f**S(3)*(d + e*x)**S(12)/(S(12)*e) + f**S(3)*(d + e*x)**S(8)*(S(2)*a*c + b**S(2))/(S(8)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, a**S(3)*f**S(3)*(d + e*x)**S(4)/(S(4)*e) + a**S(2)*b*f**S(3)*(d + e*x)**S(6)/(S(2)*e) + S(3)*a*f**S(3)*(d + e*x)**S(8)*(a*c + b**S(2))/(S(8)*e) + S(3)*b*c**S(2)*f**S(3)*(d + e*x)**S(14)/(S(14)*e) + b*f**S(3)*(d + e*x)**S(10)*(S(6)*a*c + b**S(2))/(S(10)*e) + c**S(3)*f**S(3)*(d + e*x)**S(16)/(S(16)*e) + c*f**S(3)*(d + e*x)**S(12)*(a*c + b**S(2))/(S(4)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, x/c - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, b*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*e*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*c*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, -sqrt(S(2))*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*e*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, -atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, b*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*e*sqrt(-S(4)*a*c + b**S(2))) + log(d + e*x)/(a*e) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(a*e*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -S(1)/(S(2)*a*e*(d + e*x)**S(2)) - b*log(d + e*x)/(a**S(2)*e) + b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(2)*e) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(4)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -S(1)/(S(3)*a*e*(d + e*x)**S(3)) + b/(a**S(2)*e*(d + e*x)) + sqrt(S(2))*sqrt(c)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*sqrt(c)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, (S(2)*a + b*(d + e*x)**S(2))*(d + e*x)/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + sqrt(S(2))*(b - (S(4)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, -b*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (S(2)*a + b*(d + e*x)**S(2))/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, -sqrt(S(2))*sqrt(c)*(S(2)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(2)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (b + S(2)*c*(d + e*x)**S(2))*(d + e*x)/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, S(2)*c*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (-b - S(2)*c*(d + e*x)**S(2))/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**(S(-2)), x), x, -sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (d + e*x)*(-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*e*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(d + e*x)/(a**S(2)*e) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*(d + e*x)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) - (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) + (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*e*(d + e*x)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (-S(3)*a*c + b**S(2))/(a**S(2)*e*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))) - S(2)*b*log(d + e*x)/(a**S(3)*e) + b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(2)*a**S(3)*e) - (S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*e*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(4)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*(d + e*x)**S(3)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (-S(14)*a*c + S(5)*b**S(2))/(S(6)*a**S(2)*e*(d + e*x)**S(3)*(-S(4)*a*c + b**S(2))) + b*(-S(19)*a*c + S(5)*b**S(2))/(S(2)*a**S(3)*e*(d + e*x)*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) - b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) + b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -S(3)*sqrt(S(2))*sqrt(c)*(S(4)*a*c + S(3)*b**S(2) + S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(8)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*sqrt(S(2))*sqrt(c)*(S(4)*a*c + S(3)*b**S(2) - S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(8)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + (S(2)*a + b*(d + e*x)**S(2))*(d + e*x)/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) - (d + e*x)*(-S(4)*a*c + S(7)*b**S(2) + S(12)*b*c*(d + e*x)**S(2))/(S(8)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, S(3)*b*c*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*b*(b + S(2)*c*(d + e*x)**S(2))/(S(4)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + (S(2)*a + b*(d + e*x)**S(2))/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -(b + S(2)*c*(d + e*x)**S(2))*(d + e*x)/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + sqrt(S(2))*sqrt(c)*(S(20)*a*c + b**S(2) - b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(S(20)*a*c + b**S(2) + b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + (d + e*x)*(b*(S(8)*a*c + b**S(2)) + c*(d + e*x)**S(2)*(S(20)*a*c + b**S(2)))/(S(8)*a*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -S(6)*c**S(2)*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*c*(b + S(2)*c*(d + e*x)**S(2))/(S(2)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + (-b - S(2)*c*(d + e*x)**S(2))/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**(S(-3)), x), x, (d + e*x)*(-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + S(3)*sqrt(S(2))*sqrt(c)*(-S(8)*a*b*c + b**S(3) - (S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + S(3)*sqrt(S(2))*sqrt(c)*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4) + b*(-S(8)*a*c + b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + (d + e*x)*(S(3)*b*c*(d + e*x)**S(2)*(-S(8)*a*c + b**S(2)) + (-S(7)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2)))/(S(8)*a**S(2)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(16)*a**S(2)*c**S(2) - S(15)*a*b**S(2)*c + S(2)*b**S(4) + S(2)*b*c*(d + e*x)**S(2)*(-S(7)*a*c + b**S(2)))/(S(4)*a**S(2)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*e*(-S(4)*a*c + b**S(2))**(S(5)/2)) + log(d + e*x)/(a**S(3)*e) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*(d + e*x)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(36)*a**S(2)*c**S(2) - S(35)*a*b**S(2)*c + S(5)*b**S(4) + b*c*(d + e*x)**S(2)*(-S(32)*a*c + S(5)*b**S(2)))/(S(8)*a**S(2)*e*(d + e*x)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - S(3)*sqrt(S(2))*sqrt(c)*((-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)) - (S(124)*a**S(2)*b*c**S(2) - S(47)*a*b**S(3)*c + S(5)*b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*sqrt(S(2))*sqrt(c)*(b*(S(124)*a**S(2)*c**S(2) - S(47)*a*b**S(2)*c + S(5)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)) + (-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - (-S(36)*a*c + S(15)*b**S(2))*(-S(5)*a*c + b**S(2))/(S(8)*a**S(3)*e*(d + e*x)*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(20)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4) + S(3)*b*c*(d + e*x)**S(2)*(-S(6)*a*c + b**S(2)))/(S(4)*a**S(2)*e*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (S(30)*a**S(2)*c**S(2) - S(21)*a*b**S(2)*c + S(3)*b**S(4))/(S(2)*a**S(3)*e*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*b*log(d + e*x)/(a**S(4)*e) + S(3)*b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(4)*e) - (-S(60)*a**S(3)*c**S(3) + S(90)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(3)*b**S(6))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(4)*e*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, f**S(4)*x/c - sqrt(S(2))*f**S(4)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*f**S(4)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, b*f**S(3)*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*e*sqrt(-S(4)*a*c + b**S(2))) + f**S(3)*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*c*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, -sqrt(S(2))*f**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*e*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*f**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4)), x), x, -f*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, b*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*e*f*sqrt(-S(4)*a*c + b**S(2))) + log(d + e*x)/(a*e*f) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*e*f**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*e*f**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(a*e*f**S(2)*(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -S(1)/(S(2)*a*e*f**S(3)*(d + e*x)**S(2)) - b*log(d + e*x)/(a**S(2)*e*f**S(3)) + b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(2)*e*f**S(3)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*e*f**S(3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(4)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), x), x, -S(1)/(S(3)*a*e*f**S(4)*(d + e*x)**S(3)) + b/(a**S(2)*e*f**S(4)*(d + e*x)) + sqrt(S(2))*sqrt(c)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*e*f**S(4)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*sqrt(c)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*e*f**S(4)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, f**S(4)*(S(2)*a + b*(d + e*x)**S(2))*(d + e*x)/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + sqrt(S(2))*f**S(4)*(b - (S(4)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*f**S(4)*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, -b*f**S(3)*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(3)/2)) + f**S(3)*(S(2)*a + b*(d + e*x)**S(2))/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, -sqrt(S(2))*sqrt(c)*f**S(2)*(S(2)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*f**S(2)*(S(2)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - f**S(2)*(b + S(2)*c*(d + e*x)**S(2))*(d + e*x)/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2), x), x, S(2)*c*f*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(3)/2)) - f*(b + S(2)*c*(d + e*x)**S(2))/(e*(-S(8)*a*c + S(2)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*f*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*e*f*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(d + e*x)/(a**S(2)*e*f) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(2)*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*f**S(2)*(d + e*x)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) - (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*e*f**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) + (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*e*f**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*e*f**S(2)*(d + e*x)*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*f**S(3)*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (-S(3)*a*c + b**S(2))/(a**S(2)*e*f**S(3)*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))) - S(2)*b*log(d + e*x)/(a**S(3)*e*f**S(3)) + b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(2)*a**S(3)*e*f**S(3)) - (S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*e*f**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(4)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(2)*a*e*f**S(4)*(d + e*x)**S(3)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (-S(14)*a*c + S(5)*b**S(2))/(S(6)*a**S(2)*e*f**S(4)*(d + e*x)**S(3)*(-S(4)*a*c + b**S(2))) + b*(-S(19)*a*c + S(5)*b**S(2))/(S(2)*a**S(3)*e*f**S(4)*(d + e*x)*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) - b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*e*f**S(4)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) + b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*e*f**S(4)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(4)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -S(3)*sqrt(S(2))*sqrt(c)*f**S(4)*(S(4)*a*c + S(3)*b**S(2) + S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(8)*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*sqrt(S(2))*sqrt(c)*f**S(4)*(S(4)*a*c + S(3)*b**S(2) - S(2)*b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(8)*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + f**S(4)*(S(2)*a + b*(d + e*x)**S(2))*(d + e*x)/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) - f**S(4)*(d + e*x)*(-S(4)*a*c + S(7)*b**S(2) + S(12)*b*c*(d + e*x)**S(2))/(S(8)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(3)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, S(3)*b*c*f**S(3)*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(5)/2)) - S(3)*b*f**S(3)*(b + S(2)*c*(d + e*x)**S(2))/(S(4)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + f**S(3)*(S(2)*a + b*(d + e*x)**S(2))/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)**S(2)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -f**S(2)*(b + S(2)*c*(d + e*x)**S(2))*(d + e*x)/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + sqrt(S(2))*sqrt(c)*f**S(2)*(S(20)*a*c + b**S(2) - b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*e*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*f**S(2)*(S(20)*a*c + b**S(2) + b*(-S(52)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*e*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + f**S(2)*(d + e*x)*(b*(S(8)*a*c + b**S(2)) + c*(d + e*x)**S(2)*(S(20)*a*c + b**S(2)))/(S(8)*a*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*f + e*f*x)/(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3), x), x, -S(6)*c**S(2)*f*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(e*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*c*f*(b + S(2)*c*(d + e*x)**S(2))/(S(2)*e*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - f*(b + S(2)*c*(d + e*x)**S(2))/(e*(-S(16)*a*c + S(4)*b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*f*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(16)*a**S(2)*c**S(2) - S(15)*a*b**S(2)*c + S(2)*b**S(4) + S(2)*b*c*(d + e*x)**S(2)*(-S(7)*a*c + b**S(2)))/(S(4)*a**S(2)*e*f*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) + b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*e*f*(-S(4)*a*c + b**S(2))**(S(5)/2)) + log(d + e*x)/(a**S(3)*e*f) - log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(3)*e*f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*f**S(2)*(d + e*x)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(36)*a**S(2)*c**S(2) - S(35)*a*b**S(2)*c + S(5)*b**S(4) + b*c*(d + e*x)**S(2)*(-S(32)*a*c + S(5)*b**S(2)))/(S(8)*a**S(2)*e*f**S(2)*(d + e*x)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - S(3)*sqrt(S(2))*sqrt(c)*((-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)) - (S(124)*a**S(2)*b*c**S(2) - S(47)*a*b**S(3)*c + S(5)*b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*e*f**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*sqrt(S(2))*sqrt(c)*(b*(S(124)*a**S(2)*c**S(2) - S(47)*a*b**S(2)*c + S(5)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)) + (-S(12)*a*c + S(5)*b**S(2))*(-S(5)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*(d + e*x)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(3)*e*f**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - (-S(36)*a*c + S(15)*b**S(2))*(-S(5)*a*c + b**S(2))/(S(8)*a**S(3)*e*f**S(2)*(d + e*x)*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d*f + e*f*x)**S(3)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(3)), x), x, (-S(2)*a*c + b**S(2) + b*c*(d + e*x)**S(2))/(S(4)*a*e*f**S(3)*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))**S(2)) + (S(20)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4) + S(3)*b*c*(d + e*x)**S(2)*(-S(6)*a*c + b**S(2)))/(S(4)*a**S(2)*e*f**S(3)*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))) - (S(30)*a**S(2)*c**S(2) - S(21)*a*b**S(2)*c + S(3)*b**S(4))/(S(2)*a**S(3)*e*f**S(3)*(d + e*x)**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - S(3)*b*log(d + e*x)/(a**S(4)*e*f**S(3)) + S(3)*b*log(a + b*(d + e*x)**S(2) + c*(d + e*x)**S(4))/(S(4)*a**S(4)*e*f**S(3)) - (-S(60)*a**S(3)*c**S(3) + S(90)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(3)*b**S(6))*atanh((b + S(2)*c*(d + e*x)**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(4)*e*f**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x + S(2))**S(6)*((S(3)*x + S(2))**S(14) + (S(3)*x + S(2))**S(7) + S(1)), x), x, (S(3)*x + S(2))**S(21)/S(63) + (S(3)*x + S(2))**S(14)/S(42) + (S(3)*x + S(2))**S(7)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x + S(2))**S(6)*((S(3)*x + S(2))**S(14) + (S(3)*x + S(2))**S(7) + S(1))**S(2), x), x, (S(3)*x + S(2))**S(35)/S(105) + (S(3)*x + S(2))**S(28)/S(42) + (S(3)*x + S(2))**S(21)/S(21) + (S(3)*x + S(2))**S(14)/S(21) + (S(3)*x + S(2))**S(7)/S(21), expand=True, _diff=True, _numerical=True) def test_2(): assert rubi_test(rubi_integrate((c + d*x**S(2))/(a + b*x**S(4)), x), x, -sqrt(S(2))*(-sqrt(a)*d + sqrt(b)*c)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)) + sqrt(S(2))*(-sqrt(a)*d + sqrt(b)*c)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)) - sqrt(S(2))*(sqrt(a)*d + sqrt(b)*c)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)) + sqrt(S(2))*(sqrt(a)*d + sqrt(b)*c)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c - d*x**S(2))/(a + b*x**S(4)), x), x, -sqrt(S(2))*(-sqrt(a)*d + sqrt(b)*c)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)) + sqrt(S(2))*(-sqrt(a)*d + sqrt(b)*c)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)) - sqrt(S(2))*(sqrt(a)*d + sqrt(b)*c)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)) + sqrt(S(2))*(sqrt(a)*d + sqrt(b)*c)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x**S(2))/(a - b*x**S(4)), x), x, (-sqrt(a)*d + sqrt(b)*c)*atan(b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(3)/4)*b**(S(3)/4)) + (sqrt(a)*d + sqrt(b)*c)*atanh(b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(3)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c - d*x**S(2))/(a - b*x**S(4)), x), x, (-sqrt(a)*d + sqrt(b)*c)*atanh(b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(3)/4)*b**(S(3)/4)) + (sqrt(a)*d + sqrt(b)*c)*atan(b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(3)/4)*b**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + S(2))/(S(9)*x**S(4) + S(4)), x), x, sqrt(S(3))*atan(sqrt(S(3))*x + S(-1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*x + S(1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x**S(2) + S(2))/(S(9)*x**S(4) + S(4)), x), x, -sqrt(S(3))*log(S(3)*x**S(2) - S(2)*sqrt(S(3))*x + S(2))/S(12) + sqrt(S(3))*log(S(3)*x**S(2) + S(2)*sqrt(S(3))*x + S(2))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + S(2))/(-S(9)*x**S(4) + S(4)), x), x, sqrt(S(6))*atanh(sqrt(S(6))*x/S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x**S(2) + S(2))/(-S(9)*x**S(4) + S(4)), x), x, sqrt(S(6))*atan(sqrt(S(6))*x/S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a)*sqrt(b) + b*x**S(2))/(a + b*x**S(4)), x), x, -sqrt(S(2))*b**(S(1)/4)*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(1)/4)) + sqrt(S(2))*b**(S(1)/4)*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(2)*a**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a)*sqrt(b) - b*x**S(2))/(a + b*x**S(4)), x), x, -sqrt(S(2))*b**(S(1)/4)*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(4)*a**(S(1)/4)) + sqrt(S(2))*b**(S(1)/4)*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(4)*a**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(d**S(2) + e**S(2)*x**S(4)), x), x, -sqrt(S(2))*atan(S(1) - sqrt(S(2))*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(d**S(2) + e**S(2)*x**S(4)), x), x, -sqrt(S(2))*log(-sqrt(S(2))*sqrt(d)*sqrt(e)*x + d + e*x**S(2))/(S(4)*sqrt(d)*sqrt(e)) + sqrt(S(2))*log(sqrt(S(2))*sqrt(d)*sqrt(e)*x + d + e*x**S(2))/(S(4)*sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(5))/(x**S(4) + S(-1)), x), x, -S(3)*atan(x)/S(2) - S(7)*atanh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/sqrt(a + c*x**S(4)), x), x, -S(3)*a**(S(1)/4)*e*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-a*e**S(2) + S(5)*c*d**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(5)*c**(S(7)/4)*sqrt(a + c*x**S(4))) + a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*e**S(3) + S(15)*c*d**S(2)*e + S(5)*sqrt(c)*d*(-a*e**S(2) + c*d**S(2))/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(10)*c**(S(7)/4)*sqrt(a + c*x**S(4))) + d*e**S(2)*x*sqrt(a + c*x**S(4))/c + e**S(3)*x**S(3)*sqrt(a + c*x**S(4))/(S(5)*c) + S(3)*e*x*sqrt(a + c*x**S(4))*(-a*e**S(2) + S(5)*c*d**S(2))/(S(5)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/sqrt(a + c*x**S(4)), x), x, -S(2)*a**(S(1)/4)*d*e*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(a + c*x**S(4))) + e**S(2)*x*sqrt(a + c*x**S(4))/(S(3)*c) + S(2)*d*e*x*sqrt(a + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))) + sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(6)*sqrt(a)*sqrt(c)*d*e - a*e**S(2) + S(3)*c*d**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(6)*a**(S(1)/4)*c**(S(5)/4)*sqrt(a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(a + c*x**S(4)), x), x, -a**(S(1)/4)*e*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(a + c*x**S(4))) + a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*c**(S(3)/4)*sqrt(a + c*x**S(4))) + e*x*sqrt(a + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + c*x**S(4))*(d + e*x**S(2))), x), x, atan(x*sqrt(a*e/d + c*d/e)/sqrt(a + c*x**S(4)))/(S(2)*d*sqrt(a*e/d + c*d/e)) + c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*sqrt(a + c*x**S(4))*(-sqrt(a)*e + sqrt(c)*d)) - sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_pi(-sqrt(a)*(-e + sqrt(c)*d/sqrt(a))**S(2)/(S(4)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*sqrt(a + c*x**S(4))*(-e + sqrt(c)*d/sqrt(a))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + c*x**S(4))*(d + e*x**S(2))**S(2)), x), x, a**(S(1)/4)*c**(S(1)/4)*e*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*d*sqrt(a + c*x**S(4))*(a*e**S(2) + c*d**S(2))) - a**(S(1)/4)*c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(4)*d*sqrt(a + c*x**S(4))*(a*e**S(2) + c*d**S(2))) - a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*(a*e**S(2) + S(3)*c*d**S(2))*elliptic_pi(-(-sqrt(a)*e + sqrt(c)*d)**S(2)/(S(4)*sqrt(a)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(8)*c**(S(1)/4)*d**S(2)*sqrt(a + c*x**S(4))*(-sqrt(a)*e + sqrt(c)*d)*(a*e**S(2) + c*d**S(2))) - sqrt(c)*e*x*sqrt(a + c*x**S(4))/(S(2)*d*(sqrt(a) + sqrt(c)*x**S(2))*(a*e**S(2) + c*d**S(2))) + e**S(2)*x*sqrt(a + c*x**S(4))/(S(2)*d*(d + e*x**S(2))*(a*e**S(2) + c*d**S(2))) + (a*e**S(2) + S(3)*c*d**S(2))*atan(x*sqrt(a*e/d + c*d/e)/sqrt(a + c*x**S(4)))/(S(4)*d**S(3)*e*(a*e/d + c*d/e)**(S(3)/2)) + c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(a*e**S(2) + S(3)*c*d**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(4)*a**(S(1)/4)*d*sqrt(a + c*x**S(4))*(-sqrt(a)*e + sqrt(c)*d)*(a*e**S(2) + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/sqrt(a - c*x**S(4)), x), x, S(3)*a**(S(3)/4)*e*sqrt(S(1) - c*x**S(4)/a)*(a*e**S(2) + S(5)*c*d**S(2))*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(5)*c**(S(7)/4)*sqrt(a - c*x**S(4))) - a**(S(3)/4)*sqrt(S(1) - c*x**S(4)/a)*(S(3)*a*e**S(3) + S(15)*c*d**S(2)*e - S(5)*sqrt(c)*d*(a*e**S(2) + c*d**S(2))/sqrt(a))*elliptic_f(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(5)*c**(S(7)/4)*sqrt(a - c*x**S(4))) - d*e**S(2)*x*sqrt(a - c*x**S(4))/c - e**S(3)*x**S(3)*sqrt(a - c*x**S(4))/(S(5)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/sqrt(a - c*x**S(4)), x), x, S(2)*a**(S(3)/4)*d*e*sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(3)/4)*sqrt(a - c*x**S(4))) + a**(S(1)/4)*sqrt(S(1) - c*x**S(4)/a)*(-S(6)*sqrt(a)*sqrt(c)*d*e + a*e**S(2) + S(3)*c*d**S(2))*elliptic_f(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(3)*c**(S(5)/4)*sqrt(a - c*x**S(4))) - e**S(2)*x*sqrt(a - c*x**S(4))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(a - c*x**S(4)), x), x, a**(S(3)/4)*e*sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(3)/4)*sqrt(a - c*x**S(4))) + a**(S(3)/4)*sqrt(S(1) - c*x**S(4)/a)*(-e + sqrt(c)*d/sqrt(a))*elliptic_f(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(3)/4)*sqrt(a - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a - c*x**S(4))*(d + e*x**S(2))), x), x, a**(S(1)/4)*sqrt(S(1) - c*x**S(4)/a)*elliptic_pi(-sqrt(a)*e/(sqrt(c)*d), asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(1)/4)*d*sqrt(a - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a - c*x**S(4))*(d + e*x**S(2))**S(2)), x), x, -a**(S(3)/4)*c**(S(1)/4)*e*sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(2)*d*sqrt(a - c*x**S(4))*(-a*e**S(2) + c*d**S(2))) - a**(S(1)/4)*c**(S(1)/4)*sqrt(S(1) - c*x**S(4)/a)*elliptic_f(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(2)*d*sqrt(a - c*x**S(4))*(sqrt(a)*e + sqrt(c)*d)) + a**(S(1)/4)*sqrt(S(1) - c*x**S(4)/a)*(-a*e**S(2) + S(3)*c*d**S(2))*elliptic_pi(-sqrt(a)*e/(sqrt(c)*d), asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(S(2)*c**(S(1)/4)*d**S(2)*sqrt(a - c*x**S(4))*(-a*e**S(2) + c*d**S(2))) - e**S(2)*x*sqrt(a - c*x**S(4))/(S(2)*d*(d + e*x**S(2))*(-a*e**S(2) + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(-a + c*x**S(4)), x), x, a**(S(3)/4)*e*sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(3)/4)*sqrt(-a + c*x**S(4))) + a**(S(3)/4)*sqrt(S(1) - c*x**S(4)/a)*(-e + sqrt(c)*d/sqrt(a))*elliptic_f(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(3)/4)*sqrt(-a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-a + c*x**S(4))*(d + e*x**S(2))), x), x, a**(S(1)/4)*sqrt(S(1) - c*x**S(4)/a)*elliptic_pi(-sqrt(a)*e/(sqrt(c)*d), asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(1)/4)*d*sqrt(-a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a) + sqrt(c)*x**S(2))/sqrt(-a + c*x**S(4)), x), x, a**(S(3)/4)*sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(c**(S(1)/4)*x/a**(S(1)/4)), S(-1))/(c**(S(1)/4)*sqrt(-a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2)*sqrt(c/a) + S(1))/sqrt(-a + c*x**S(4)), x), x, sqrt(S(1) - c*x**S(4)/a)*elliptic_e(asin(x*(c/a)**(S(1)/4)), S(-1))/((c/a)**(S(1)/4)*sqrt(-a + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(-a - c*x**S(4)), x), x, -a**(S(1)/4)*e*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(c**(S(3)/4)*sqrt(-a - c*x**S(4))) + a**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*c**(S(3)/4)*sqrt(-a - c*x**S(4))) - e*x*sqrt(-a - c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-a - c*x**S(4))*(d + e*x**S(2))), x), x, atan(x*sqrt(-a*e/d - c*d/e)/sqrt(-a - c*x**S(4)))/(S(2)*d*sqrt(-a*e/d - c*d/e)) + c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*sqrt(-a - c*x**S(4))*(-sqrt(a)*e + sqrt(c)*d)) - sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_pi(-sqrt(a)*(-e + sqrt(c)*d/sqrt(a))**S(2)/(S(4)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*sqrt(-a - c*x**S(4))*(-e + sqrt(c)*d/sqrt(a))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))*sqrt(-S(5)*x**S(4) + S(4))), x), x, sqrt(S(2))*S(5)**(S(3)/4)*elliptic_pi(-S(2)*sqrt(S(5))*b/(S(5)*a), asin(sqrt(S(2))*S(5)**(S(1)/4)*x/S(2)), S(-1))/(S(10)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))*sqrt(S(5)*x**S(4) + S(4))), x), x, sqrt(S(2))*S(5)**(S(1)/4)*sqrt((S(5)*x**S(4) + S(4))/(sqrt(S(5))*x**S(2) + S(2))**S(2))*(sqrt(S(5))*x**S(2) + S(2))*elliptic_f(S(2)*atan(sqrt(S(2))*S(5)**(S(1)/4)*x/S(2)), S(1)/2)/(S(4)*sqrt(S(5)*x**S(4) + S(4))*(sqrt(S(5))*a - S(2)*b)) - sqrt(S(2))*S(5)**(S(3)/4)*sqrt((S(5)*x**S(4) + S(4))/(sqrt(S(5))*x**S(2) + S(2))**S(2))*(sqrt(S(5))*a + S(2)*b)*(sqrt(S(5))*x**S(2) + S(2))*elliptic_pi(-sqrt(S(5))*(sqrt(S(5))*a - S(2)*b)**S(2)/(S(40)*a*b), S(2)*atan(sqrt(S(2))*S(5)**(S(1)/4)*x/S(2)), S(1)/2)/(S(40)*a*sqrt(S(5)*x**S(4) + S(4))*(sqrt(S(5))*a - S(2)*b)) + atan(x*sqrt(S(5)*a/b + S(4)*b/a)/sqrt(S(5)*x**S(4) + S(4)))/(S(2)*a*sqrt(S(5)*a/b + S(4)*b/a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))*sqrt(-d*x**S(4) + S(4))), x), x, sqrt(S(2))*elliptic_pi(-S(2)*b/(a*sqrt(d)), asin(sqrt(S(2))*d**(S(1)/4)*x/S(2)), S(-1))/(S(2)*a*d**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))*sqrt(d*x**S(4) + S(4))), x), x, -sqrt(S(2))*d**(S(1)/4)*sqrt((d*x**S(4) + S(4))/(sqrt(d)*x**S(2) + S(2))**S(2))*(sqrt(d)*x**S(2) + S(2))*elliptic_f(S(2)*atan(sqrt(S(2))*d**(S(1)/4)*x/S(2)), S(1)/2)/(S(4)*(-a*sqrt(d) + S(2)*b)*sqrt(d*x**S(4) + S(4))) + atan(x*sqrt(a*d/b + S(4)*b/a)/sqrt(d*x**S(4) + S(4)))/(S(2)*a*sqrt(a*d/b + S(4)*b/a)) + sqrt(S(2))*sqrt((d*x**S(4) + S(4))/(sqrt(d)*x**S(2) + S(2))**S(2))*(a*sqrt(d) + S(2)*b)*(sqrt(d)*x**S(2) + S(2))*elliptic_pi(-(-a*sqrt(d) + S(2)*b)**S(2)/(S(8)*a*b*sqrt(d)), S(2)*atan(sqrt(S(2))*d**(S(1)/4)*x/S(2)), S(1)/2)/(S(8)*a*d**(S(1)/4)*(-a*sqrt(d) + S(2)*b)*sqrt(d*x**S(4) + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c**S(2)*x**S(2) + S(1))/sqrt(-c**S(2)*x**S(2) + S(1)), x), x, elliptic_e(asin(c*x), S(-1))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c**S(2)*x**S(2) + S(1))/sqrt(-c**S(4)*x**S(4) + S(1)), x), x, elliptic_e(asin(c*x), S(-1))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-c**S(2)*x**S(2) + S(1))/sqrt(c**S(2)*x**S(2) + S(1)), x), x, -elliptic_e(asin(c*x), S(-1))/c + S(2)*elliptic_f(asin(c*x), S(-1))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-c**S(2)*x**S(2) + S(1))/sqrt(-c**S(4)*x**S(4) + S(1)), x), x, -elliptic_e(asin(c*x), S(-1))/c + S(2)*elliptic_f(asin(c*x), S(-1))/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + S(1))/sqrt(-b**S(2)*x**S(4) + S(1)), x), x, elliptic_e(asin(sqrt(b)*x), S(-1))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-b*x**S(2) + S(1))/sqrt(-b**S(2)*x**S(4) + S(1)), x), x, -elliptic_e(asin(sqrt(b)*x), S(-1))/sqrt(b) + S(2)*elliptic_f(asin(sqrt(b)*x), S(-1))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + S(1))/sqrt(b**S(2)*x**S(4) + S(-1)), x), x, sqrt(-b**S(2)*x**S(4) + S(1))*elliptic_e(asin(sqrt(b)*x), S(-1))/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-b*x**S(2) + S(1))/sqrt(b**S(2)*x**S(4) + S(-1)), x), x, -sqrt(-b**S(2)*x**S(4) + S(1))*elliptic_e(asin(sqrt(b)*x), S(-1))/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(-1))) + S(2)*sqrt(-b**S(2)*x**S(4) + S(1))*elliptic_f(asin(sqrt(b)*x), S(-1))/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-b*x**S(2) + S(1))/sqrt(b**S(2)*x**S(4) + S(1)), x), x, -x*sqrt(b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1)) + sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_e(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + S(1))/sqrt(b**S(2)*x**S(4) + S(1)), x), x, x*sqrt(b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1)) - sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_e(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(1))) + sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_f(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(b**S(2)*x**S(4) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-b*x**S(2) + S(1))/sqrt(-b**S(2)*x**S(4) + S(-1)), x), x, x*sqrt(-b**S(2)*x**S(4) + S(-1))/(b*x**S(2) + S(1)) + sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_e(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(-b**S(2)*x**S(4) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x**S(2) + S(1))/sqrt(-b**S(2)*x**S(4) + S(-1)), x), x, -x*sqrt(-b**S(2)*x**S(4) + S(-1))/(b*x**S(2) + S(1)) - sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_e(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(-b**S(2)*x**S(4) + S(-1))) + sqrt((b**S(2)*x**S(4) + S(1))/(b*x**S(2) + S(1))**S(2))*(b*x**S(2) + S(1))*elliptic_f(S(2)*atan(sqrt(b)*x), S(1)/2)/(sqrt(b)*sqrt(-b**S(2)*x**S(4) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(4)/(-d**S(2) + e**S(2)*x**S(4)), x), x, -S(8)*d**(S(5)/2)*atanh(sqrt(e)*x/sqrt(d))/sqrt(e) + S(7)*d**S(2)*x + S(4)*d*e*x**S(3)/S(3) + e**S(2)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/(-d**S(2) + e**S(2)*x**S(4)), x), x, -S(4)*d**(S(3)/2)*atanh(sqrt(e)*x/sqrt(d))/sqrt(e) + S(3)*d*x + e*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/(-d**S(2) + e**S(2)*x**S(4)), x), x, -S(2)*sqrt(d)*atanh(sqrt(e)*x/sqrt(d))/sqrt(e) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(-d**S(2) + e**S(2)*x**S(4)), x), x, -atanh(sqrt(e)*x/sqrt(d))/(sqrt(d)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*(-d**S(2) + e**S(2)*x**S(4))), x), x, -x/(S(4)*d**S(2)*(d + e*x**S(2))) - atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(5)/2)*sqrt(e)) - atanh(sqrt(e)*x/sqrt(d))/(S(4)*d**(S(5)/2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*(-d**S(2) + e**S(2)*x**S(4))), x), x, -x/(S(8)*d**S(2)*(d + e*x**S(2))**S(2)) - S(5)*x/(S(16)*d**S(3)*(d + e*x**S(2))) - S(7)*atan(sqrt(e)*x/sqrt(d))/(S(16)*d**(S(7)/2)*sqrt(e)) - atanh(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(7)/2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(-d**S(2) + e**S(2)*x**S(4)), x), x, atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/sqrt(e) - sqrt(S(2))*atanh(sqrt(S(2))*sqrt(e)*x/sqrt(d + e*x**S(2)))/sqrt(e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(-d**S(2) + e**S(2)*x**S(4)), x), x, -sqrt(S(2))*atanh(sqrt(S(2))*sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*d*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d + e*x**S(2))*(-d**S(2) + e**S(2)*x**S(4))), x), x, -x/(S(2)*d**S(2)*sqrt(d + e*x**S(2))) - sqrt(S(2))*atanh(sqrt(S(2))*sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(4)*d**S(2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**(S(3)/2)*(-d**S(2) + e**S(2)*x**S(4))), x), x, -x/(S(6)*d**S(2)*(d + e*x**S(2))**(S(3)/2)) - S(7)*x/(S(12)*d**S(3)*sqrt(d + e*x**S(2))) - sqrt(S(2))*atanh(sqrt(S(2))*sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(8)*d**S(3)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(4)/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, e**S(2)*x**S(5)/(S(5)*c) + e*x**S(3)*(-b*e + S(4)*c*d)/(S(3)*c**S(2)) + x*(b**S(2)*e**S(2) - S(5)*b*c*d*e + S(7)*c**S(2)*d**S(2))/c**S(3) - (-b*e + S(2)*c*d)**S(3)*atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(c**(S(7)/2)*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, e*x**S(3)/(S(3)*c) + x*(-b*e + S(3)*c*d)/c**S(2) - (-b*e + S(2)*c*d)**S(2)*atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(c**(S(5)/2)*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, x/c - (-b*e + S(2)*c*d)*atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(c**(S(3)/2)*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, -atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(sqrt(c)*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4))), x), x, -c**(S(3)/2)*atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(sqrt(e)*sqrt(-b*e + c*d)*(-b*e + S(2)*c*d)**S(2)) - x/(S(2)*d*(d + e*x**S(2))*(-b*e + S(2)*c*d)) - (-b*e + S(4)*c*d)*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*sqrt(e)*(-b*e + S(2)*c*d)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4))), x), x, -c**(S(5)/2)*atanh(sqrt(c)*sqrt(e)*x/sqrt(-b*e + c*d))/(sqrt(e)*sqrt(-b*e + c*d)*(-b*e + S(2)*c*d)**S(3)) - x/(S(4)*d*(d + e*x**S(2))**S(2)*(-b*e + S(2)*c*d)) - x*(-S(3)*b*e + S(10)*c*d)/(S(8)*d**S(2)*(d + e*x**S(2))*(-b*e + S(2)*c*d)**S(2)) - (S(3)*b**S(2)*e**S(2) - S(16)*b*c*d*e + S(28)*c**S(2)*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(5)/2)*sqrt(e)*(-b*e + S(2)*c*d)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(5)/2)/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, x*sqrt(d + e*x**S(2))/(S(2)*c) + (-S(2)*b*e + S(5)*c*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(2)*sqrt(e)) - (-b*e + S(2)*c*d)**(S(3)/2)*atanh(sqrt(e)*x*sqrt(-b*e + S(2)*c*d)/(sqrt(d + e*x**S(2))*sqrt(-b*e + c*d)))/(c**S(2)*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c*sqrt(e)) - sqrt(-b*e + S(2)*c*d)*atanh(sqrt(e)*x*sqrt(-b*e + S(2)*c*d)/(sqrt(d + e*x**S(2))*sqrt(-b*e + c*d)))/(c*sqrt(e)*sqrt(-b*e + c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4)), x), x, -atanh(sqrt(e)*x*sqrt(-b*e + S(2)*c*d)/(sqrt(d + e*x**S(2))*sqrt(-b*e + c*d)))/(sqrt(e)*sqrt(-b*e + c*d)*sqrt(-b*e + S(2)*c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d + e*x**S(2))*(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4))), x), x, -c*atanh(sqrt(e)*x*sqrt(-b*e + S(2)*c*d)/(sqrt(d + e*x**S(2))*sqrt(-b*e + c*d)))/(sqrt(e)*sqrt(-b*e + c*d)*(-b*e + S(2)*c*d)**(S(3)/2)) - x/(d*sqrt(d + e*x**S(2))*(-b*e + S(2)*c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**(S(3)/2)*(b*d*e + b*e**S(2)*x**S(2) - c*d**S(2) + c*e**S(2)*x**S(4))), x), x, -c**S(2)*atanh(sqrt(e)*x*sqrt(-b*e + S(2)*c*d)/(sqrt(d + e*x**S(2))*sqrt(-b*e + c*d)))/(sqrt(e)*sqrt(-b*e + c*d)*(-b*e + S(2)*c*d)**(S(5)/2)) - x/(S(3)*d*(d + e*x**S(2))**(S(3)/2)*(-b*e + S(2)*c*d)) - x*(-S(2)*b*e + S(7)*c*d)/(S(3)*d**S(2)*sqrt(d + e*x**S(2))*(-b*e + S(2)*c*d)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(b*x**S(2) + d**S(2) + e**S(2)*x**S(4)), x), x, -atan((-S(2)*e*x + sqrt(-b + S(2)*d*e))/sqrt(b + S(2)*d*e))/sqrt(b + S(2)*d*e) + atan((S(2)*e*x + sqrt(-b + S(2)*d*e))/sqrt(b + S(2)*d*e))/sqrt(b + S(2)*d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(-b*x**S(2) + d**S(2) + e**S(2)*x**S(4)), x), x, atanh((-S(2)*e*x + sqrt(b + S(2)*d*e))/sqrt(b - S(2)*d*e))/sqrt(b - S(2)*d*e) - atanh((S(2)*e*x + sqrt(b + S(2)*d*e))/sqrt(b - S(2)*d*e))/sqrt(b - S(2)*d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(d**S(2) + e**S(2)*x**S(4) + f*x**S(2)), x), x, -atan((-S(2)*e*x + sqrt(S(2)*d*e - f))/sqrt(S(2)*d*e + f))/sqrt(S(2)*d*e + f) + atan((S(2)*e*x + sqrt(S(2)*d*e - f))/sqrt(S(2)*d*e + f))/sqrt(S(2)*d*e + f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(d**S(2) + e**S(2)*x**S(4) - f*x**S(2)), x), x, -atan((-S(2)*e*x + sqrt(S(2)*d*e + f))/sqrt(S(2)*d*e - f))/sqrt(S(2)*d*e - f) + atan((S(2)*e*x + sqrt(S(2)*d*e + f))/sqrt(S(2)*d*e - f))/sqrt(S(2)*d*e - f), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(b*x**S(2) + d**S(2) + e**S(2)*x**S(4)), x), x, -log(d + e*x**S(2) - x*sqrt(-b + S(2)*d*e))/(S(2)*sqrt(-b + S(2)*d*e)) + log(d + e*x**S(2) + x*sqrt(-b + S(2)*d*e))/(S(2)*sqrt(-b + S(2)*d*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(-b*x**S(2) + d**S(2) + e**S(2)*x**S(4)), x), x, -log(d + e*x**S(2) - x*sqrt(b + S(2)*d*e))/(S(2)*sqrt(b + S(2)*d*e)) + log(d + e*x**S(2) + x*sqrt(b + S(2)*d*e))/(S(2)*sqrt(b + S(2)*d*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(d**S(2) + e**S(2)*x**S(4) + f*x**S(2)), x), x, -log(d + e*x**S(2) - x*sqrt(S(2)*d*e - f))/(S(2)*sqrt(S(2)*d*e - f)) + log(d + e*x**S(2) + x*sqrt(S(2)*d*e - f))/(S(2)*sqrt(S(2)*d*e - f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(d**S(2) + e**S(2)*x**S(4) - f*x**S(2)), x), x, -log(d + e*x**S(2) - x*sqrt(S(2)*d*e + f))/(S(2)*sqrt(S(2)*d*e + f)) + log(d + e*x**S(2) + x*sqrt(S(2)*d*e + f))/(S(2)*sqrt(S(2)*d*e + f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d - e*x**S(2))/(b*x**S(2) + c*d**S(2)/e**S(2) + c*x**S(4)), x), x, -e**(S(3)/2)*log(sqrt(c)*d + sqrt(c)*e*x**S(2) - sqrt(e)*x*sqrt(-b*e + S(2)*c*d))/(S(2)*sqrt(c)*sqrt(-b*e + S(2)*c*d)) + e**(S(3)/2)*log(sqrt(c)*d + sqrt(c)*e*x**S(2) + sqrt(e)*x*sqrt(-b*e + S(2)*c*d))/(S(2)*sqrt(c)*sqrt(-b*e + S(2)*c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(b*x**S(2) + c*d**S(2)/e**S(2) + c*x**S(4)), x), x, -e**(S(3)/2)*atan((-S(2)*sqrt(c)*sqrt(e)*x + sqrt(-b*e + S(2)*c*d))/sqrt(b*e + S(2)*c*d))/(sqrt(c)*sqrt(b*e + S(2)*c*d)) + e**(S(3)/2)*atan((S(2)*sqrt(c)*sqrt(e)*x + sqrt(-b*e + S(2)*c*d))/sqrt(b*e + S(2)*c*d))/(sqrt(c)*sqrt(b*e + S(2)*c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(b*x**S(2) + c*(d**S(2)/e**S(2) + x**S(4))), x), x, -e**(S(3)/2)*atan((-S(2)*sqrt(c)*sqrt(e)*x + sqrt(-b*e + S(2)*c*d))/sqrt(b*e + S(2)*c*d))/(sqrt(c)*sqrt(b*e + S(2)*c*d)) + e**(S(3)/2)*atan((S(2)*sqrt(c)*sqrt(e)*x + sqrt(-b*e + S(2)*c*d))/sqrt(b*e + S(2)*c*d))/(sqrt(c)*sqrt(b*e + S(2)*c*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - b*x**S(2))/(a**S(2) + b**S(2)*x**S(4) + x**S(2)*(S(2)*a*b + S(-1))), x), x, -log(a + b*x**S(2) - x)/S(2) + log(a + b*x**S(2) + x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(a**S(2) + b**S(2)*x**S(4) + x**S(2)*(S(2)*a*b + S(-1))), x), x, atanh((-S(2)*b*x + S(1))/sqrt(-S(4)*a*b + S(1)))/sqrt(-S(4)*a*b + S(1)) - atanh((S(2)*b*x + S(1))/sqrt(-S(4)*a*b + S(1)))/sqrt(-S(4)*a*b + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(b*x**S(2) + S(4)*x**S(4) + S(1)), x), x, -atan((-S(4)*x + sqrt(-b + S(4)))/sqrt(b + S(4)))/sqrt(b + S(4)) + atan((S(4)*x + sqrt(-b + S(4)))/sqrt(b + S(4)))/sqrt(b + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(-b*x**S(2) + S(4)*x**S(4) + S(1)), x), x, -atan((-S(4)*x + sqrt(b + S(4)))/sqrt(-b + S(4)))/sqrt(-b + S(4)) + atan((S(4)*x + sqrt(b + S(4)))/sqrt(-b + S(4)))/sqrt(-b + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(6)*x**S(2) + S(1)), x), x, sqrt(S(10))*atan(S(2)*x/sqrt(-sqrt(S(5)) + S(3)))/S(10) + sqrt(S(10))*atan(S(2)*x/sqrt(sqrt(S(5)) + S(3)))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(5)*x**S(2) + S(1)), x), x, atan(x)/S(3) + atan(S(2)*x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(4)*x**S(2) + S(1)), x), x, sqrt(S(2))*atan(sqrt(S(2))*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(3)*x**S(2) + S(1)), x), x, -sqrt(S(7))*atan(sqrt(S(7))*(-S(4)*x + S(1))/S(7))/S(7) + sqrt(S(7))*atan(sqrt(S(7))*(S(4)*x + S(1))/S(7))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(2)*x**S(2) + S(1)), x), x, -sqrt(S(6))*atan(sqrt(S(6))*(-S(4)*x + sqrt(S(2)))/S(6))/S(6) + sqrt(S(6))*atan(sqrt(S(6))*(S(4)*x + sqrt(S(2)))/S(6))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + x**S(2) + S(1)), x), x, -sqrt(S(5))*atan(sqrt(S(5))*(-S(4)*x + sqrt(S(3)))/S(5))/S(5) + sqrt(S(5))*atan(sqrt(S(5))*(S(4)*x + sqrt(S(3)))/S(5))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(1)), x), x, atan(S(2)*x + S(-1))/S(2) + atan(S(2)*x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - x**S(2) + S(1)), x), x, -sqrt(S(3))*atan(sqrt(S(3))*(-S(4)*x + sqrt(S(5)))/S(3))/S(3) + sqrt(S(3))*atan(sqrt(S(3))*(S(4)*x + sqrt(S(5)))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(2)*x**S(2) + S(1)), x), x, -sqrt(S(2))*atan(sqrt(S(2))*(-S(4)*x + sqrt(S(6)))/S(2))/S(2) + sqrt(S(2))*atan(sqrt(S(2))*(S(4)*x + sqrt(S(6)))/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(3)*x**S(2) + S(1)), x), x, atan(S(4)*x - sqrt(S(7))) + atan(S(4)*x + sqrt(S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(4)*x**S(2) + S(1)), x), x, x/(-S(2)*x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(5)*x**S(2) + S(1)), x), x, -log(-S(2)*x**S(2) - x + S(1))/S(2) + log(-S(2)*x**S(2) + x + S(1))/S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(5)*x**S(2) + S(1)), x), x, -log(-S(2)*x + S(1))/S(2) + log(-x + S(1))/S(2) - log(x + S(1))/S(2) + log(S(2)*x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(6)*x**S(2) + S(1)), x), x, -sqrt(S(10))*log(S(2)*x**S(2) - sqrt(S(10))*x + S(1))/S(20) + sqrt(S(10))*log(S(2)*x**S(2) + sqrt(S(10))*x + S(1))/S(20), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(6)*x**S(2) + S(1)), x), x, sqrt(S(2))*atanh(sqrt(S(2))*(-S(4)*x + sqrt(S(10)))/S(2))/S(2) - sqrt(S(2))*atanh(sqrt(S(2))*(S(4)*x + sqrt(S(10)))/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(b*x**S(2) + S(4)*x**S(4) + S(1)), x), x, -log(S(2)*x**S(2) - x*sqrt(-b + S(4)) + S(1))/(S(2)*sqrt(-b + S(4))) + log(S(2)*x**S(2) + x*sqrt(-b + S(4)) + S(1))/(S(2)*sqrt(-b + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(6)*x**S(2) + S(1)), x), x, sqrt(S(2))*atan(S(2)*x/sqrt(-sqrt(S(5)) + S(3)))/S(2) - sqrt(S(2))*atan(S(2)*x/sqrt(sqrt(S(5)) + S(3)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(5)*x**S(2) + S(1)), x), x, -atan(x) + atan(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(4)*x**S(2) + S(1)), x), x, x/(S(2)*x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(3)*x**S(2) + S(1)), x), x, -log(S(2)*x**S(2) - x + S(1))/S(2) + log(S(2)*x**S(2) + x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(2)*x**S(2) + S(1)), x), x, -sqrt(S(2))*log(S(2)*x**S(2) - sqrt(S(2))*x + S(1))/S(4) + sqrt(S(2))*log(S(2)*x**S(2) + sqrt(S(2))*x + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + x**S(2) + S(1)), x), x, -sqrt(S(3))*log(S(2)*x**S(2) - sqrt(S(3))*x + S(1))/S(6) + sqrt(S(3))*log(S(2)*x**S(2) + sqrt(S(3))*x + S(1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) + S(1)), x), x, -log(S(2)*x**S(2) - S(2)*x + S(1))/S(4) + log(S(2)*x**S(2) + S(2)*x + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - x**S(2) + S(1)), x), x, -sqrt(S(5))*log(S(2)*x**S(2) - sqrt(S(5))*x + S(1))/S(10) + sqrt(S(5))*log(S(2)*x**S(2) + sqrt(S(5))*x + S(1))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(2)*x**S(2) + S(1)), x), x, -sqrt(S(6))*log(S(2)*x**S(2) - sqrt(S(6))*x + S(1))/S(12) + sqrt(S(6))*log(S(2)*x**S(2) + sqrt(S(6))*x + S(1))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(3)*x**S(2) + S(1)), x), x, -sqrt(S(7))*log(S(2)*x**S(2) - sqrt(S(7))*x + S(1))/S(14) + sqrt(S(7))*log(S(2)*x**S(2) + sqrt(S(7))*x + S(1))/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(4)*x**S(2) + S(1)), x), x, sqrt(S(2))*atanh(sqrt(S(2))*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(5)*x**S(2) + S(1)), x), x, -log(S(2)*x**S(2) - S(3)*x + S(1))/S(6) + log(S(2)*x**S(2) + S(3)*x + S(1))/S(6), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(5)*x**S(2) + S(1)), x), x, atanh(x)/S(3) + atanh(S(2)*x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(6)*x**S(2) + S(1)), x), x, -sqrt(S(10))*log(S(2)*x**S(2) - sqrt(S(10))*x + S(1))/S(20) + sqrt(S(10))*log(S(2)*x**S(2) + sqrt(S(10))*x + S(1))/S(20), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-S(2)*x**S(2) + S(1))/(S(4)*x**S(4) - S(6)*x**S(2) + S(1)), x), x, sqrt(S(10))*atanh(S(2)*x/sqrt(-sqrt(S(5)) + S(3)))/S(10) + sqrt(S(10))*atanh(S(2)*x/sqrt(sqrt(S(5)) + S(3)))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(b*x**S(2) + x**S(4) + S(1)), x), x, -atan((-S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/sqrt(b + S(2)) + atan((S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/sqrt(b + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + S(5)*x**S(2) + S(1)), x), x, sqrt(S(7))*atan(x*sqrt(sqrt(S(21))/S(2) + S(5)/2))/S(7) + sqrt(S(7))*atan(sqrt(S(2))*x/sqrt(sqrt(S(21)) + S(5)))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + S(4)*x**S(2) + S(1)), x), x, sqrt(S(6))*atan(x/sqrt(-sqrt(S(3)) + S(2)))/S(6) + sqrt(S(6))*atan(x/sqrt(sqrt(S(3)) + S(2)))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + S(3)*x**S(2) + S(1)), x), x, sqrt(S(5))*atan(x*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(5) + sqrt(S(5))*atan(sqrt(S(2))*x/sqrt(sqrt(S(5)) + S(3)))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + x**S(2) + S(1)), x), x, -sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) + S(1)), x), x, sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(2) + sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - x**S(2) + S(1)), x), x, atan(S(2)*x - sqrt(S(3))) + atan(S(2)*x + sqrt(S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - S(2)*x**S(2) + S(1)), x), x, x/(-x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - S(3)*x**S(2) + S(1)), x), x, atanh(-S(2)*x + sqrt(S(5))) - atanh(S(2)*x + sqrt(S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - S(4)*x**S(2) + S(1)), x), x, sqrt(S(2))*atanh(-sqrt(S(2))*x + sqrt(S(3)))/S(2) - sqrt(S(2))*atanh(sqrt(S(2))*x + sqrt(S(3)))/S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - S(4)*x**S(2) + S(1)), x), x, sqrt(S(2))*atanh(sqrt(S(2))*(-S(2)*x + sqrt(S(6)))/S(2))/S(2) - sqrt(S(2))*atanh(sqrt(S(2))*(S(2)*x + sqrt(S(6)))/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(4) - S(5)*x**S(2) + S(1)), x), x, sqrt(S(3))*atanh(sqrt(S(3))*(-S(2)*x + sqrt(S(7)))/S(3))/S(3) - sqrt(S(3))*atanh(sqrt(S(3))*(S(2)*x + sqrt(S(7)))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(b*x**S(2) + x**S(4) + S(1)), x), x, -log(x**S(2) - x*sqrt(-b + S(2)) + S(1))/(S(2)*sqrt(-b + S(2))) + log(x**S(2) + x*sqrt(-b + S(2)) + S(1))/(S(2)*sqrt(-b + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + S(5)*x**S(2) + S(1)), x), x, sqrt(S(3))*atan(x*sqrt(sqrt(S(21))/S(2) + S(5)/2))/S(3) - sqrt(S(3))*atan(sqrt(S(2))*x/sqrt(sqrt(S(21)) + S(5)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + S(4)*x**S(2) + S(1)), x), x, sqrt(S(2))*atan(x/sqrt(-sqrt(S(3)) + S(2)))/S(2) - sqrt(S(2))*atan(x/sqrt(sqrt(S(3)) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + S(3)*x**S(2) + S(1)), x), x, atan(x*sqrt(sqrt(S(5))/S(2) + S(3)/2)) - atan(sqrt(S(2))*x/sqrt(sqrt(S(5)) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, x/(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + x**S(2) + S(1)), x), x, -log(x**S(2) - x + S(1))/S(2) + log(x**S(2) + x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) + S(1)), x), x, -sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(4) + sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - x**S(2) + S(1)), x), x, -sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(6) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(2)*x**S(2) + S(1)), x), x, atanh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(3)*x**S(2) + S(1)), x), x, -sqrt(S(5))*log(x**S(2) - sqrt(S(5))*x + S(1))/S(10) + sqrt(S(5))*log(x**S(2) + sqrt(S(5))*x + S(1))/S(10), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(3)*x**S(2) + S(1)), x), x, sqrt(S(5))*atanh(x*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(5) + sqrt(S(5))*atanh(sqrt(S(2))*x/sqrt(sqrt(S(5)) + S(3)))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(4)*x**S(2) + S(1)), x), x, -sqrt(S(6))*log(x**S(2) - sqrt(S(6))*x + S(1))/S(12) + sqrt(S(6))*log(x**S(2) + sqrt(S(6))*x + S(1))/S(12), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(4)*x**S(2) + S(1)), x), x, sqrt(S(6))*atanh(x/sqrt(-sqrt(S(3)) + S(2)))/S(6) + sqrt(S(6))*atanh(x/sqrt(sqrt(S(3)) + S(2)))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(5)*x**S(2) + S(1)), x), x, -sqrt(S(7))*log(x**S(2) - sqrt(S(7))*x + S(1))/S(14) + sqrt(S(7))*log(x**S(2) + sqrt(S(7))*x + S(1))/S(14), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-x**S(2) + S(1))/(x**S(4) - S(5)*x**S(2) + S(1)), x), x, sqrt(S(7))*atanh(x*sqrt(sqrt(S(21))/S(2) + S(5)/2))/S(7) + sqrt(S(7))*atanh(sqrt(S(2))*x/sqrt(sqrt(S(21)) + S(5)))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(4)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(4)*x + c*e**S(4)*x**S(13)/S(13) + d**S(3)*x**S(3)*(S(4)*a*e + b*d)/S(3) + d**S(2)*x**S(5)*(S(6)*a*e**S(2) + S(4)*b*d*e + c*d**S(2))/S(5) + S(2)*d*e*x**S(7)*(S(2)*c*d**S(2) + e*(S(2)*a*e + S(3)*b*d))/S(7) + e**S(3)*x**S(11)*(b*e + S(4)*c*d)/S(11) + e**S(2)*x**S(9)*(S(6)*c*d**S(2) + e*(a*e + S(4)*b*d))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(3)*x + c*e**S(3)*x**S(11)/S(11) + d**S(2)*x**S(3)*(S(3)*a*e + b*d)/S(3) + d*x**S(5)*(c*d**S(2) + S(3)*e*(a*e + b*d))/S(5) + e**S(2)*x**S(9)*(b*e + S(3)*c*d)/S(9) + e*x**S(7)*(S(3)*c*d**S(2) + e*(a*e + S(3)*b*d))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(2)*x + c*e**S(2)*x**S(9)/S(9) + d*x**S(3)*(S(2)*a*e + b*d)/S(3) + e*x**S(7)*(b*e + S(2)*c*d)/S(7) + x**S(5)*(c*d**S(2) + e*(a*e + S(2)*b*d))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, a*d*x + c*e*x**S(7)/S(7) + x**S(5)*(b*e + c*d)/S(5) + x**S(3)*(a*e + b*d)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2)), x), x, c*x**S(3)/(S(3)*e) - x*(-b*e + c*d)/e**S(2) + (a*e**S(2) - b*d*e + c*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x/e**S(2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d*e**S(2)*(d + e*x**S(2))) - (S(3)*c*d**S(2) - e*(a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(3), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*d*e**S(2)*(d + e*x**S(2))**S(2)) - x*(S(5)*c*d**S(2) - e*(S(3)*a*e + b*d))/(S(8)*d**S(2)*e**S(2)*(d + e*x**S(2))) + (S(3)*c*d**S(2) + e*(S(3)*a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(5)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(4), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(6)*d*e**S(2)*(d + e*x**S(2))**S(3)) - x*(S(7)*c*d**S(2) - e*(S(5)*a*e + b*d))/(S(24)*d**S(2)*e**S(2)*(d + e*x**S(2))**S(2)) + x*(c*d**S(2) + e*(S(5)*a*e + b*d))/(S(16)*d**S(3)*e**S(2)*(d + e*x**S(2))) + (c*d**S(2) + e*(S(5)*a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(16)*d**(S(7)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*d**S(3)*x + a*d**S(2)*x**S(3)*(S(3)*a*e + S(2)*b*d)/S(3) + c**S(2)*e**S(3)*x**S(15)/S(15) + c*e**S(2)*x**S(13)*(S(2)*b*e + S(3)*c*d)/S(13) + d*x**S(5)*(S(6)*a*b*d*e + a*(S(3)*a*e**S(2) + S(2)*c*d**S(2)) + b**S(2)*d**S(2))/S(5) + e*x**S(11)*(b**S(2)*e**S(2) + S(3)*c**S(2)*d**S(2) + S(2)*c*e*(a*e + S(3)*b*d))/S(11) + x**S(9)*(b*e**S(2)*(S(2)*a*e + S(3)*b*d)/S(9) + c**S(2)*d**S(3)/S(9) + S(2)*c*d*e*(a*e + b*d)/S(3)) + x**S(7)*(a**S(2)*e**S(3)/S(7) + S(6)*a*b*d*e**S(2)/S(7) + S(6)*a*c*d**S(2)*e/S(7) + S(3)*b**S(2)*d**S(2)*e/S(7) + S(2)*b*c*d**S(3)/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*d**S(2)*x + S(2)*a*d*x**S(3)*(a*e + b*d)/S(3) + c**S(2)*e**S(2)*x**S(13)/S(13) + S(2)*c*e*x**S(11)*(b*e + c*d)/S(11) + x**S(9)*(b**S(2)*e**S(2)/S(9) + c**S(2)*d**S(2)/S(9) + S(2)*c*e*(a*e + S(2)*b*d)/S(9)) + x**S(7)*(S(2)*a*b*e**S(2)/S(7) + S(4)*a*c*d*e/S(7) + S(2)*b**S(2)*d*e/S(7) + S(2)*b*c*d**S(2)/S(7)) + x**S(5)*(S(4)*a*b*d*e/S(5) + a*(a*e**S(2) + S(2)*c*d**S(2))/S(5) + b**S(2)*d**S(2)/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*d*x + a*x**S(3)*(a*e + S(2)*b*d)/S(3) + c**S(2)*e*x**S(11)/S(11) + c*x**S(9)*(S(2)*b*e + c*d)/S(9) + x**S(7)*(S(2)*a*c*e/S(7) + b**S(2)*e/S(7) + S(2)*b*c*d/S(7)) + x**S(5)*(S(2)*a*b*e/S(5) + S(2)*a*c*d/S(5) + b**S(2)*d/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*x + S(2)*a*b*x**S(3)/S(3) + S(2)*b*c*x**S(7)/S(7) + c**S(2)*x**S(9)/S(9) + x**S(5)*(S(2)*a*c/S(5) + b**S(2)/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/(d + e*x**S(2)), x), x, c**S(2)*x**S(7)/(S(7)*e) - c*x**S(5)*(-S(2)*b*e + c*d)/(S(5)*e**S(2)) + x**S(3)*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - S(2)*c*e*(-a*e + b*d))/(S(3)*e**S(3)) - x*(-b*e + c*d)*(c*d**S(2) - e*(-S(2)*a*e + b*d))/e**S(4) + (a*e**S(2) - b*d*e + c*d**S(2))**S(2)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/(d + e*x**S(2))**S(2), x), x, c**S(2)*x**S(7)/(S(5)*e*(d + e*x**S(2))) - c*x**S(3)*(-S(10)*b*e + S(7)*c*d)/(S(15)*e**S(3)) + x*(S(5)*b**S(2)*e**S(2) + S(14)*c**S(2)*d**S(2) - S(10)*c*e*(-a*e + S(2)*b*d))/(S(5)*e**S(4)) + x*(S(7)*c**S(2)*d**S(4) - S(10)*c*d**S(2)*e*(-a*e + b*d) + S(5)*e**S(2)*(-a*e + b*d)**S(2))/(S(10)*d*e**S(4)*(d + e*x**S(2))) - (S(7)*c*d**S(2) - e*(a*e + S(3)*b*d))*(a*e**S(2) - b*d*e + c*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/(d + e*x**S(2))**S(3), x), x, c**S(2)*x**S(7)/(S(3)*e*(d + e*x**S(2))**S(2)) - c*x*(-S(6)*b*e + S(7)*c*d)/(S(3)*e**S(4)) + x*(S(7)*c**S(2)*d**S(4) - S(6)*c*d**S(2)*e*(-a*e + b*d) + S(3)*e**S(2)*(-a*e + b*d)**S(2))/(S(12)*d*e**S(4)*(d + e*x**S(2))**S(2)) - x*(S(21)*c**S(2)*d**S(4) - S(2)*c*d**S(2)*e*(-S(5)*a*e + S(9)*b*d) + e**S(2)*(-S(3)*a**S(2)*e**S(2) - S(2)*a*b*d*e + S(5)*b**S(2)*d**S(2)))/(S(8)*d**S(2)*e**S(4)*(d + e*x**S(2))) + (S(35)*c**S(2)*d**S(4) - S(6)*c*d**S(2)*e*(-a*e + S(5)*b*d) + e**S(2)*(S(3)*a**S(2)*e**S(2) + S(2)*a*b*d*e + S(3)*b**S(2)*d**S(2)))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(5)/2)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/(d + e*x**S(2))**S(4), x), x, c**S(2)*x**S(7)/(e*(d + e*x**S(2))**S(3)) + x*(S(7)*c**S(2)*d**S(4) - S(2)*c*d**S(2)*e*(-a*e + b*d) + e**S(2)*(-a*e + b*d)**S(2))/(S(6)*d*e**S(4)*(d + e*x**S(2))**S(3)) - x*(S(91)*c**S(2)*d**S(4) - S(2)*c*d**S(2)*e*(-S(7)*a*e + S(13)*b*d) + e**S(2)*(-S(5)*a**S(2)*e**S(2) - S(2)*a*b*d*e + S(7)*b**S(2)*d**S(2)))/(S(24)*d**S(2)*e**S(4)*(d + e*x**S(2))**S(2)) + x*(S(77)*c**S(2)*d**S(4) - S(2)*c*d**S(2)*e*(-a*e + S(11)*b*d) + e**S(2)*(S(5)*a**S(2)*e**S(2) + S(2)*a*b*d*e + b**S(2)*d**S(2)))/(S(16)*d**S(3)*e**S(4)*(d + e*x**S(2))) - (S(35)*c**S(2)*d**S(4) - S(2)*c*d**S(2)*e*(a*e + S(5)*b*d) - e**S(2)*(S(5)*a**S(2)*e**S(2) + S(2)*a*b*d*e + b**S(2)*d**S(2)))*atan(sqrt(e)*x/sqrt(d))/(S(16)*d**(S(7)/2)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)/(d + e*x**S(2))**S(5), x), x, -c**S(2)*x**S(7)/(e*(d + e*x**S(2))**S(4)) - x*(S(7)*c**S(2)*d**S(4) + S(2)*c*d**S(2)*e*(-a*e + b*d) - e**S(2)*(-a*e + b*d)**S(2))/(S(8)*d*e**S(4)*(d + e*x**S(2))**S(4)) + x*(S(119)*c**S(2)*d**S(4) + S(2)*c*d**S(2)*e*(-S(9)*a*e + S(17)*b*d) - e**S(2)*(-S(7)*a**S(2)*e**S(2) - S(2)*a*b*d*e + S(9)*b**S(2)*d**S(2)))/(S(48)*d**S(2)*e**S(4)*(d + e*x**S(2))**S(3)) - x*(S(413)*c**S(2)*d**S(4) + S(2)*c*d**S(2)*e*(-S(3)*a*e + S(59)*b*d) - e**S(2)*(S(35)*a**S(2)*e**S(2) + S(10)*a*b*d*e + S(3)*b**S(2)*d**S(2)))/(S(192)*d**S(3)*e**S(4)*(d + e*x**S(2))**S(2)) + x*(S(35)*c**S(2)*d**S(4) + S(2)*c*d**S(2)*e*(S(3)*a*e + S(5)*b*d) + e**S(2)*(S(35)*a**S(2)*e**S(2) + S(10)*a*b*d*e + S(3)*b**S(2)*d**S(2)))/(S(128)*d**S(4)*e**S(4)*(d + e*x**S(2))) + (S(35)*c**S(2)*d**S(4) + S(2)*c*d**S(2)*e*(S(3)*a*e + S(5)*b*d) + e**S(2)*(S(35)*a**S(2)*e**S(2) + S(10)*a*b*d*e + S(3)*b**S(2)*d**S(2)))*atan(sqrt(e)*x/sqrt(d))/(S(128)*d**(S(9)/2)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x/e**S(2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d*e**S(2)*(d + e*x**S(2))) - (S(3)*c*d**S(2) - e*(a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2)*(b + c*x**S(2)))/(d + e*x**S(2))**S(2), x), x, c*x/e**S(2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d*e**S(2)*(d + e*x**S(2))) - (S(3)*c*d**S(2) - e*(a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(4)/(a + b*x**S(2) + c*x**S(4)), x), x, e**S(4)*x**S(5)/(S(5)*c) + e**S(3)*x**S(3)*(-b*e + S(4)*c*d)/(S(3)*c**S(2)) + e**S(2)*x*(b**S(2)*e**S(2) + S(6)*c**S(2)*d**S(2) - c*e*(a*e + S(4)*b*d))/c**S(3) + sqrt(S(2))*(e*(-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d)) - (b**S(4)*e**S(4) - S(4)*b**S(2)*c*e**S(3)*(a*e + b*d) + S(2)*c**S(4)*d**S(4) - S(4)*c**S(3)*d**S(2)*e*(S(3)*a*e + b*d) + S(2)*c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(6)*a*b*d*e + S(3)*b**S(2)*d**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(7)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e*(-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d)) + (b**S(4)*e**S(4) - S(4)*b**S(2)*c*e**S(3)*(a*e + b*d) + S(2)*c**S(4)*d**S(4) - S(4)*c**S(3)*d**S(2)*e*(S(3)*a*e + b*d) + S(2)*c**S(2)*e**S(2)*(a**S(2)*e**S(2) + S(6)*a*b*d*e + S(3)*b**S(2)*d**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(7)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/(a + b*x**S(2) + c*x**S(4)), x), x, e**S(3)*x**S(3)/(S(3)*c) + e**S(2)*x*(-b*e + S(3)*c*d)/c**S(2) + sqrt(S(2))*(e*(b**S(2)*e**S(2) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d)) - (-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e*(b**S(2)*e**S(2) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d)) + (-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/(a + b*x**S(2) + c*x**S(4)), x), x, e**S(2)*x/c + sqrt(S(2))*(e*(-b*e + S(2)*c*d) - (b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e*(-b*e + S(2)*c*d) + (b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*sqrt(c)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**(S(3)/2)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(2)*x/(S(2)*d*(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**(S(3)/2)*(-b*e + S(2)*c*d)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**(S(3)/2)*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, x*(-a*b*e*(a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*c*d*(-S(3)*a*e**S(2) + c*d**S(2)) + b**S(2)*c*d**S(3) - x**S(2)*(a*b**S(2)*e**S(3) + S(2)*a*c*e*(-a*e**S(2) + S(3)*c*d**S(2)) - b*c*d*(S(3)*a*e**S(2) + c*d**S(2))))/(S(2)*a*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(a*b**S(3)*e**S(3) + S(6)*a*c*(a*e**S(2) + c*d**S(2))*(S(2)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*(-S(3)*a*c*d*e**S(2) - a*e**S(3)*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*d**S(3)) + b*c*(a*e**S(2)*(-S(8)*a*e + S(3)*d*sqrt(-S(4)*a*c + b**S(2))) + c*d**S(2)*(-S(12)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*(a*b**S(3)*e**S(3) + S(6)*a*c*(a*e**S(2) + c*d**S(2))*(S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*(-S(3)*a*c*d*e**S(2) + a*e**S(3)*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*d**S(3)) - b*c*(a*e**S(2)*(S(8)*a*e + S(3)*d*sqrt(-S(4)*a*c + b**S(2))) + c*d**S(2)*(S(12)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, x*(-S(2)*a*b*d*e - S(2)*a*(-a*e**S(2) + c*d**S(2)) + b**S(2)*d**S(2) + x**S(2)*(a*b*e**S(2) - S(4)*a*c*d*e + b*c*d**S(2)))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(-S(4)*a*c*(S(3)*c*d**S(2) - e*(-a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(2)*(-a*e**S(2) + c*d**S(2)) - b*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) + c*d*(-S(8)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(-S(4)*a*c*(S(3)*c*d**S(2) + e*(a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(2)*(-a*e**S(2) + c*d**S(2)) + b*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) + c*d*(S(8)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, sqrt(S(2))*sqrt(c)*(-S(2)*a*e + b*d - (S(4)*a*b*e - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-S(2)*a*e + b*d + (S(4)*a*b*e - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**S(2)*(-S(2)*a*e + b*d))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(-2)), x), x, -sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -sqrt(S(2))*sqrt(c)*e**S(2)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - sqrt(S(2))*sqrt(c)*e**S(2)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**(S(7)/2)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(S(2)*a*c*e - b**S(2)*e + b*c*d - (S(8)*a*b*c*e - S(12)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*sqrt(c)*(S(2)*a*c*e - b**S(2)*e + b*c*d + (S(8)*a*b*c*e - S(12)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + x*(S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d + c*x**S(2)*(S(2)*a*c*e - b**S(2)*e + b*c*d))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -sqrt(S(2))*sqrt(c)*e**S(2)*(b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d - S(2)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + sqrt(S(2))*sqrt(c)*e**S(2)*(b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d + S(2)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**S(4)*x/(S(2)*d*(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + S(2)*e**(S(7)/2)*(-b*e + S(2)*c*d)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**(S(7)/2)*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - sqrt(S(2))*sqrt(c)*(-S(4)*a*c**S(2)*(S(3)*c*d**S(2) + e*(-S(3)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*e**S(2) - b**S(3)*e*(S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*c*(c*d**S(2) + e*(-S(9)*a*e + S(2)*d*sqrt(-S(4)*a*c + b**S(2)))) + b*c*(S(3)*a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) - c*d*(-S(16)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(-S(4)*a*c**S(2)*(S(3)*c*d**S(2) - e*(S(3)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*e**S(2) - b**S(3)*e*(S(2)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*c*(c*d**S(2) - e*(S(9)*a*e + S(2)*d*sqrt(-S(4)*a*c + b**S(2)))) - b*c*(S(3)*a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) - c*d*(S(16)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - x*(-S(6)*a*b*c**S(2)*d*e + S(2)*a*c**S(2)*(-a*e**S(2) + c*d**S(2)) - b**S(4)*e**S(2) + S(2)*b**S(3)*c*d*e - b**S(2)*c*(-S(4)*a*e**S(2) + c*d**S(2)) + c*x**S(2)*(-S(4)*a*c**S(2)*d*e - b**S(3)*e**S(2) + S(2)*b**S(2)*c*d*e - b*c*(-S(3)*a*e**S(2) + c*d**S(2))))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(3))/(x**S(4) - S(2)*x**S(2) + S(1)), x), x, S(5)*x/(-S(2)*x**S(2) + S(2)) + atanh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + S(2))/(S(3)*x**S(4) - S(8)*x**S(2) + S(5)), x), x, S(5)*atanh(x)/S(2) - S(7)*sqrt(S(15))*atanh(sqrt(S(15))*x/S(5))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(S(3)*x**S(4) - S(8)*x**S(2) + S(5)), x), x, (d/S(2) + e/S(2))*atanh(x) - sqrt(S(15))*(S(3)*d + S(5)*e)*atanh(sqrt(S(15))*x/S(5))/S(30), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(3))/(x**S(4) + S(3)*x**S(2) + S(1)), x), x, sqrt(S(10))*(sqrt(S(5)) + S(3))**(S(3)/2)*atan(x*sqrt(sqrt(S(5))/S(2) + S(3)/2))/S(20) - sqrt(-S(80)*sqrt(S(5)) + S(180))*atan(sqrt(S(2))*x/sqrt(sqrt(S(5)) + S(3)))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4) + x**S(2) + S(1)), x), x, -(a/S(4) - b/S(4))*log(x**S(2) - x + S(1)) + (a/S(4) - b/S(4))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(a + b)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(a + b)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4) + x**S(2) + S(1))**S(2), x), x, x*(a + b - x**S(2)*(a - S(2)*b))/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)) - (a/S(4) - b/S(8))*log(x**S(2) - x + S(1)) + (a/S(4) - b/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(4)*a + b)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(4)*a + b)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(36), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4) + x**S(2) + S(2)), x), x, -(a - sqrt(S(2))*b)*log(x**S(2) - x*sqrt(S(-1) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(-2) + S(4)*sqrt(S(2)))) + (a - sqrt(S(2))*b)*log(x**S(2) + x*sqrt(S(-1) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(-2) + S(4)*sqrt(S(2)))) - sqrt(S(-1)/14 + sqrt(S(2))/S(7))*(a + sqrt(S(2))*b)*atan((-S(2)*x + sqrt(S(-1) + S(2)*sqrt(S(2))))/sqrt(S(1) + S(2)*sqrt(S(2))))/S(2) + sqrt(S(-1)/14 + sqrt(S(2))/S(7))*(a + sqrt(S(2))*b)*atan((S(2)*x + sqrt(S(-1) + S(2)*sqrt(S(2))))/sqrt(S(1) + S(2)*sqrt(S(2))))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4) + x**S(2) + S(2))**S(2), x), x, x*(S(3)*a + S(2)*b - x**S(2)*(a - S(4)*b))/(S(28)*x**S(4) + S(28)*x**S(2) + S(56)) - sqrt(S(-1)/14 + sqrt(S(2))/S(7))*(a*(-sqrt(S(2)) + S(11)) - b*(-S(4)*sqrt(S(2)) + S(2)))*atan((-S(2)*x + sqrt(S(-1) + S(2)*sqrt(S(2))))/sqrt(S(1) + S(2)*sqrt(S(2))))/S(56) + sqrt(S(-1)/14 + sqrt(S(2))/S(7))*(a*(-sqrt(S(2)) + S(11)) - b*(-S(4)*sqrt(S(2)) + S(2)))*atan((S(2)*x + sqrt(S(-1) + S(2)*sqrt(S(2))))/sqrt(S(1) + S(2)*sqrt(S(2))))/S(56) - (S(11)*a - S(2)*b + sqrt(S(2))*(a - S(4)*b))*log(x**S(2) - x*sqrt(S(-1) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(112)*sqrt(S(-2) + S(4)*sqrt(S(2)))) + (a*(sqrt(S(2)) + S(11)) - S(4)*sqrt(S(2))*b - S(2)*b)*log(x**S(2) + x*sqrt(S(-1) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(112)*sqrt(S(-2) + S(4)*sqrt(S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + sqrt(S(2)))/(x**S(4) - sqrt(S(2))*x**S(2) + S(1)), x), x, -sqrt(sqrt(S(2))/S(2) + S(1))*log(x**S(2) - x*sqrt(sqrt(S(2)) + S(2)) + S(1))/S(4) + sqrt(sqrt(S(2))/S(2) + S(1))*log(x**S(2) + x*sqrt(sqrt(S(2)) + S(2)) + S(1))/S(4) - atan((-S(2)*x + sqrt(sqrt(S(2)) + S(2)))/sqrt(-sqrt(S(2)) + S(2)))/(S(2)*sqrt(sqrt(S(2)) + S(2))) + atan((S(2)*x + sqrt(sqrt(S(2)) + S(2)))/sqrt(-sqrt(S(2)) + S(2)))/(S(2)*sqrt(sqrt(S(2)) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + sqrt(S(2)))/(x**S(4) + sqrt(S(2))*x**S(2) + S(1)), x), x, -sqrt(-sqrt(S(2))/S(2) + S(1))*log(x**S(2) - x*sqrt(-sqrt(S(2)) + S(2)) + S(1))/S(4) + sqrt(-sqrt(S(2))/S(2) + S(1))*log(x**S(2) + x*sqrt(-sqrt(S(2)) + S(2)) + S(1))/S(4) - atan((-S(2)*x + sqrt(-sqrt(S(2)) + S(2)))/sqrt(sqrt(S(2)) + S(2)))/(S(2)*sqrt(-sqrt(S(2)) + S(2))) + atan((S(2)*x + sqrt(-sqrt(S(2)) + S(2)))/sqrt(sqrt(S(2)) + S(2)))/(S(2)*sqrt(-sqrt(S(2)) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + sqrt(S(2)))/(b*x**S(2) + x**S(4) + S(1)), x), x, (-sqrt(S(2)) + S(1))*atan((-S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/(S(2)*sqrt(b + S(2))) - (-sqrt(S(2)) + S(1))*atan((S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/(S(2)*sqrt(b + S(2))) - (S(1) + sqrt(S(2)))*log(x**S(2) - x*sqrt(-b + S(2)) + S(1))/(S(4)*sqrt(-b + S(2))) + (S(1) + sqrt(S(2)))*log(x**S(2) + x*sqrt(-b + S(2)) + S(1))/(S(4)*sqrt(-b + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + sqrt(S(2)))/(b*x**S(2) + x**S(4) + S(1)), x), x, -(S(1) + sqrt(S(2)))*atan((-S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/(S(2)*sqrt(b + S(2))) + (S(1) + sqrt(S(2)))*atan((S(2)*x + sqrt(-b + S(2)))/sqrt(b + S(2)))/(S(2)*sqrt(b + S(2))) + (-sqrt(S(2)) + S(1))*log(x**S(2) - x*sqrt(-b + S(2)) + S(1))/(S(4)*sqrt(-b + S(2))) - (-sqrt(S(2)) + S(1))*log(x**S(2) + x*sqrt(-b + S(2)) + S(1))/(S(4)*sqrt(-b + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*a - x**S(2))/(a**S(2) - a*x**S(2) + x**S(4)), x), x, -sqrt(S(3))*log(-sqrt(S(3))*sqrt(a)*x + a + x**S(2))/(S(4)*sqrt(a)) + sqrt(S(3))*log(sqrt(S(3))*sqrt(a)*x + a + x**S(2))/(S(4)*sqrt(a)) - atan((sqrt(S(3))*sqrt(a) - S(2)*x)/sqrt(a))/(S(2)*sqrt(a)) + atan((sqrt(S(3))*sqrt(a) + S(2)*x)/sqrt(a))/(S(2)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*sqrt(a) - x**S(2))/(-sqrt(a)*x**S(2) + a + x**S(4)), x), x, -sqrt(S(3))*log(-sqrt(S(3))*a**(S(1)/4)*x + sqrt(a) + x**S(2))/(S(4)*a**(S(1)/4)) + sqrt(S(3))*log(sqrt(S(3))*a**(S(1)/4)*x + sqrt(a) + x**S(2))/(S(4)*a**(S(1)/4)) - atan((sqrt(S(3))*a**(S(1)/4) - S(2)*x)/a**(S(1)/4))/(S(2)*a**(S(1)/4)) + atan((sqrt(S(3))*a**(S(1)/4) + S(2)*x)/a**(S(1)/4))/(S(2)*a**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*b**(S(2)/3) + x**S(2))/(b**(S(4)/3) + b**(S(2)/3)*x**S(2) + x**S(4)), x), x, -log(b**(S(2)/3) - b**(S(1)/3)*x + x**S(2))/(S(4)*b**(S(1)/3)) + log(b**(S(2)/3) + b**(S(1)/3)*x + x**S(2))/(S(4)*b**(S(1)/3)) - sqrt(S(3))*atan(sqrt(S(3))*(b**(S(1)/3) - S(2)*x)/(S(3)*b**(S(1)/3)))/(S(2)*b**(S(1)/3)) + sqrt(S(3))*atan(sqrt(S(3))*(b**(S(1)/3) + S(2)*x)/(S(3)*b**(S(1)/3)))/(S(2)*b**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a**S(2) - a*x**S(2) + x**S(4)), x), x, -sqrt(S(3))*(A - B*a)*log(-sqrt(S(3))*sqrt(a)*x + a + x**S(2))/(S(12)*a**(S(3)/2)) + sqrt(S(3))*(A - B*a)*log(sqrt(S(3))*sqrt(a)*x + a + x**S(2))/(S(12)*a**(S(3)/2)) - (A + B*a)*atan((sqrt(S(3))*sqrt(a) - S(2)*x)/sqrt(a))/(S(2)*a**(S(3)/2)) + (A + B*a)*atan((sqrt(S(3))*sqrt(a) + S(2)*x)/sqrt(a))/(S(2)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(-sqrt(a)*x**S(2) + a + x**S(4)), x), x, -sqrt(S(3))*(A - B*sqrt(a))*log(-sqrt(S(3))*a**(S(1)/4)*x + sqrt(a) + x**S(2))/(S(12)*a**(S(3)/4)) + sqrt(S(3))*(A - B*sqrt(a))*log(sqrt(S(3))*a**(S(1)/4)*x + sqrt(a) + x**S(2))/(S(12)*a**(S(3)/4)) - (A + B*sqrt(a))*atan((sqrt(S(3))*a**(S(1)/4) - S(2)*x)/a**(S(1)/4))/(S(2)*a**(S(3)/4)) + (A + B*sqrt(a))*atan((sqrt(S(3))*a**(S(1)/4) + S(2)*x)/a**(S(1)/4))/(S(2)*a**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a + c*x**S(4) - x**S(2)*sqrt(a*c)), x), x, -(A - B*sqrt(a)/sqrt(c))*log(sqrt(a) + sqrt(c)*x**S(2) - x*sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c)))/(S(4)*sqrt(a)*sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c))) + (A - B*sqrt(a)/sqrt(c))*log(sqrt(a) + sqrt(c)*x**S(2) + x*sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c)))/(S(4)*sqrt(a)*sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c))) - (A*sqrt(c) + B*sqrt(a))*atan((-S(2)*sqrt(c)*x + sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c)))/sqrt(S(2)*sqrt(a)*sqrt(c) - sqrt(a*c)))/(S(2)*sqrt(a)*sqrt(c)*sqrt(S(2)*sqrt(a)*sqrt(c) - sqrt(a*c))) + (A*sqrt(c) + B*sqrt(a))*atan((S(2)*sqrt(c)*x + sqrt(S(2)*sqrt(a)*sqrt(c) + sqrt(a*c)))/sqrt(S(2)*sqrt(a)*sqrt(c) - sqrt(a*c)))/(S(2)*sqrt(a)*sqrt(c)*sqrt(S(2)*sqrt(a)*sqrt(c) - sqrt(a*c))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(-sqrt(a)*sqrt(c)*x**S(2) + a + c*x**S(4)), x), x, -sqrt(S(3))*(A - B*sqrt(a)/sqrt(c))*log(-sqrt(S(3))*a**(S(1)/4)*c**(S(1)/4)*x + sqrt(a) + sqrt(c)*x**S(2))/(S(12)*a**(S(3)/4)*c**(S(1)/4)) + sqrt(S(3))*(A - B*sqrt(a)/sqrt(c))*log(sqrt(S(3))*a**(S(1)/4)*c**(S(1)/4)*x + sqrt(a) + sqrt(c)*x**S(2))/(S(12)*a**(S(3)/4)*c**(S(1)/4)) - (A*sqrt(c) + B*sqrt(a))*atan((sqrt(S(3))*a**(S(1)/4) - S(2)*c**(S(1)/4)*x)/a**(S(1)/4))/(S(2)*a**(S(3)/4)*c**(S(3)/4)) + (A*sqrt(c) + B*sqrt(a))*atan((sqrt(S(3))*a**(S(1)/4) + S(2)*c**(S(1)/4)*x)/a**(S(1)/4))/(S(2)*a**(S(3)/4)*c**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(125)*x**S(3)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(9) + S(577)*x*(x**S(2) + S(2))/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(757)*x**S(2) + S(2608))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(21) + S(275)*x*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(7) - S(577)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(2945)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(21)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(31)*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + x*(S(114)*x**S(2) + S(407))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(21) + S(25)*x*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(7) - S(31)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(472)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(21)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))*sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(5)*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + x*(S(3)*x**S(2) + S(10))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(3) - S(5)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(11)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(3) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(2)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(5)*x**S(2) + S(7)), x), x, x*(x**S(2) + S(2))/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(3)*x**S(2) + S(3))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(70)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt((x**S(2) + S(2))/(S(2)*x**S(2) + S(2)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(5)*x**S(2) + S(7)), x), x, x*(x**S(2) + S(2))/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(4)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(25)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(3)*x**S(2) + S(3))*elliptic_f(atan(x), S(1)/2)/(S(50)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*(S(3)*x**S(2) + S(6))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(70)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(5)*x**S(2) + S(7))**S(2), x), x, x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(70)*x**S(2) + S(98)) - x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(70)*x**S(2) + S(70)) + sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_e(atan(x), S(1)/2)/(S(70)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))) + S(3)*sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_f(atan(x), S(1)/2)/(S(280)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))) - sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(1960)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(3)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, S(125)*x**S(3)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(5)/2)/S(13) + S(20884)*x*(x**S(2) + S(2))/(S(65)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(65345)*x**S(2) + S(208212))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(3003) + x*(S(297911)*x**S(2) + S(1032541))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(5005) + S(3825)*x*(x**S(4) + S(3)*x**S(2) + S(2))**(S(5)/2)/S(143) - S(20884)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(65)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(1171349)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(5005)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(2)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, S(742)*x*(x**S(2) + S(2))/(S(15)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(2240)*x**S(2) + S(7281))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(693) + x*(S(10643)*x**S(2) + S(36783))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(1155) + S(25)*x*(x**S(4) + S(3)*x**S(2) + S(2))**(S(5)/2)/S(11) - S(742)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(15)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(13879)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(385)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, S(116)*x*(x**S(2) + S(2))/(S(15)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(35)*x**S(2) + S(108))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(63) + x*(S(149)*x**S(2) + S(519))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(105) - S(116)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(15)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(197)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(35)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, S(6)*x*(x**S(2) + S(2))/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(9)*x**S(2) + S(29))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(35) + x*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/S(7) - S(6)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(31)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(35)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/(S(5)*x**S(2) + S(7)), x), x, x**S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(25) + S(24)*x*(x**S(2) + S(2))/(S(125)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(11)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(75) - S(24)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(125)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(47)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(375)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + (S(24)*x**S(2) + S(24))*elliptic_pi(S(-3)/7, atan(sqrt(S(2))*x/S(2)), S(-1))/(S(875)*sqrt((x**S(2) + S(1))/(x**S(2) + S(2)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)/(S(5)*x**S(2) + S(7))**S(2), x), x, x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(75) - S(3)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(875)*x**S(2) + S(1225)) + S(9)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(175)*x**S(2) + S(175)) + S(8)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_pi(S(-3)/7, atan(sqrt(S(2))*x/S(2)), S(-1))/(S(875)*sqrt((x**S(2) + S(1))/(x**S(2) + S(2)))*(x**S(2) + S(2))) - S(9)*sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_e(atan(x), S(1)/2)/(sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(175)*x**S(2) + S(175))) + S(211)*sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_f(atan(x), S(1)/2)/(S(10500)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))) + S(129)*sqrt(S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(24500)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(9)*a*e**S(3)/c + S(8)*b**S(2)*e**S(3)/c**S(2) - S(30)*b*d*e**S(2)/c + S(45)*d**S(2)*e + (S(4)*a*b*e**S(3) - S(15)*a*c*d*e**S(2) + S(15)*c**S(2)*d**S(3))/(sqrt(a)*c**(S(3)/2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*e*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(8)*b**S(2)*e**S(2) + S(45)*c**S(2)*d**S(2) - S(3)*c*e*(S(3)*a*e + S(10)*b*d))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + e**S(3)*x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*c) + e**S(2)*x*(-S(4)*b*e + S(15)*c*d)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*c**S(2)) + e*x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(8)*b**S(2)*e**S(2) + S(45)*c**S(2)*d**S(2) - S(3)*c*e*(S(3)*a*e + S(10)*b*d))/(S(15)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(2)*b*e**S(2)/c + S(6)*d*e + (-a*e**S(2) + S(3)*c*d**S(2))/(sqrt(a)*sqrt(c)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - S(2)*a**(S(1)/4)*e*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-b*e + S(3)*c*d)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + e**S(2)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c) + S(2)*e*x*(-b*e + S(3)*c*d)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -a**(S(1)/4)*e*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + e*x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, atan(x*sqrt(a*e/d - b + c*d/e)/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(2)*d*sqrt(a*e/d - b + c*d/e)) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*(-sqrt(a)*e + sqrt(c)*d)*sqrt(a + b*x**S(2) + c*x**S(4))) - sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_pi(-sqrt(a)*(-e + sqrt(c)*d/sqrt(a))**S(2)/(S(4)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*(-e + sqrt(c)*d/sqrt(a))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, a**(S(1)/4)*c**(S(1)/4)*e*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*d*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) - a**(S(1)/4)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*d*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*(S(3)*c*d**S(2) - e*(-a*e + S(2)*b*d))*elliptic_pi(-(-sqrt(a)*e + sqrt(c)*d)**S(2)/(S(4)*sqrt(a)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(8)*c**(S(1)/4)*d**S(2)*(-sqrt(a)*e + sqrt(c)*d)*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(c)*e*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*d*(sqrt(a) + sqrt(c)*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**S(2)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*d*(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + (S(3)*c*d**S(2) - e*(-a*e + S(2)*b*d))*atan(x*sqrt(a*e/d - b + c*d/e)/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(4)*d**S(3)*e*(a*e/d - b + c*d/e)**(S(3)/2)) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(3)*c*d**S(2) - e*(-a*e + S(2)*b*d))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*a**(S(1)/4)*d*(-sqrt(a)*e + sqrt(c)*d)*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -e**S(3)*x**S(3)*sqrt(a + b*x**S(2) - c*x**S(4))/(S(5)*c) - e**S(2)*x*(S(4)*b*e + S(15)*c*d)*sqrt(a + b*x**S(2) - c*x**S(4))/(S(15)*c**S(2)) + sqrt(S(2))*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*(S(9)*a*e**S(3)/c + S(8)*b**S(2)*e**S(3)/c**S(2) + S(30)*b*d*e**S(2)/c + S(45)*d**S(2)*e + (S(8)*a*b*e**S(3) + S(30)*a*c*d*e**S(2) + S(30)*c**S(2)*d**S(3))/(b*c - c*sqrt(S(4)*a*c + b**S(2))))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(60)*c**(S(3)/2)*sqrt(a + b*x**S(2) - c*x**S(4))) - sqrt(S(2))*e*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*(S(8)*b**S(2)*e**S(2) + S(45)*c**S(2)*d**S(2) + S(3)*c*e*(S(3)*a*e + S(10)*b*d))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(60)*c**(S(7)/2)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -e**S(2)*x*sqrt(a + b*x**S(2) - c*x**S(4))/(S(3)*c) - sqrt(S(2))*e*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(b*e + S(3)*c*d)*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*c**(S(5)/2)*sqrt(a + b*x**S(2) - c*x**S(4))) + sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*(b*e**S(2)*(b - sqrt(S(4)*a*c + b**S(2))) + S(3)*c**S(2)*d**S(2) + c*e*(a*e + S(3)*b*d - S(3)*d*sqrt(S(4)*a*c + b**S(2))))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(6)*c**(S(5)/2)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(a + b*x**S(2) - c*x**S(4)), x), x, -sqrt(S(2))*e*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(a + b*x**S(2) - c*x**S(4))) + sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*d + e*(b - sqrt(S(4)*a*c + b**S(2))))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(a + b*x**S(2) - c*x**S(4))), x), x, sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_pi(-e*(b + sqrt(S(4)*a*c + b**S(2)))/(S(2)*c*d), asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*d*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*sqrt(a + b*x**S(2) - c*x**S(4))), x), x, -e**S(2)*x*sqrt(a + b*x**S(2) - c*x**S(4))/(S(2)*d*(d + e*x**S(2))*(-a*e**S(2) + b*d*e + c*d**S(2))) + sqrt(S(2))*e*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(8)*sqrt(c)*d*(c*d**S(2) + e*(-a*e + b*d))*sqrt(a + b*x**S(2) - c*x**S(4))) - sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*d + e*(b - sqrt(S(4)*a*c + b**S(2))))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(8)*sqrt(c)*d*(c*d**S(2) + e*(-a*e + b*d))*sqrt(a + b*x**S(2) - c*x**S(4))) + sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(3)*c*d**S(2) + e*(-a*e + S(2)*b*d))*sqrt(-S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(-S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_pi(-e*(b + sqrt(S(4)*a*c + b**S(2)))/(S(2)*c*d), asin(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), (b + sqrt(S(4)*a*c + b**S(2)))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*d**S(2)*(c*d**S(2) + e*(-a*e + b*d))*sqrt(a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(-a + b*x**S(2) + c*x**S(4)), x), x, e*x*(b - sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))/(S(2)*c*sqrt(-a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*d*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), -S(2)*sqrt(S(4)*a*c + b**S(2))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt((S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))/(S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1)))*sqrt(-a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*e*(b - sqrt(S(4)*a*c + b**S(2)))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_e(atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), -S(2)*sqrt(S(4)*a*c + b**S(2))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt((S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))/(S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1)))*sqrt(-a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, sqrt(S(2))*sqrt(-b + sqrt(S(4)*a*c + b**S(2)))*sqrt(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_pi(e*(b - sqrt(S(4)*a*c + b**S(2)))/(S(2)*c*d), asin(sqrt(S(2))*sqrt(c)*x/sqrt(-b + sqrt(S(4)*a*c + b**S(2)))), (b - sqrt(S(4)*a*c + b**S(2)))/(b + sqrt(S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*d*sqrt(-a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(-a + b*x**S(2) + c*x**S(4))), x), x, sqrt(S(2))*sqrt(c)*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_f(atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), -S(2)*sqrt(S(4)*a*c + b**S(2))/(b - sqrt(S(4)*a*c + b**S(2))))/(sqrt((S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))/(S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1)))*(S(2)*c*d - e*(b + sqrt(S(4)*a*c + b**S(2))))*sqrt(-a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*e*(b + sqrt(S(4)*a*c + b**S(2)))**(S(3)/2)*(S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))*elliptic_pi(S(1) - e*(b + sqrt(S(4)*a*c + b**S(2)))/(S(2)*c*d), atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(S(4)*a*c + b**S(2)))), -S(2)*sqrt(S(4)*a*c + b**S(2))/(b - sqrt(S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*d*sqrt((S(2)*c*x**S(2)/(b - sqrt(S(4)*a*c + b**S(2))) + S(1))/(S(2)*c*x**S(2)/(b + sqrt(S(4)*a*c + b**S(2))) + S(1)))*(S(2)*c*d - e*(b + sqrt(S(4)*a*c + b**S(2))))*sqrt(-a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(-a + b*x**S(2) - c*x**S(4)), x), x, -a**(S(1)/4)*e*sqrt((a - b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 + b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*sqrt(-a + b*x**S(2) - c*x**S(4))) + a**(S(1)/4)*sqrt((a - b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 + b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*c**(S(3)/4)*sqrt(-a + b*x**S(2) - c*x**S(4))) - e*x*sqrt(-a + b*x**S(2) - c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(-a + b*x**S(2) - c*x**S(4))), x), x, atan(x*sqrt(-a*e/d - b - c*d/e)/sqrt(-a + b*x**S(2) - c*x**S(4)))/(S(2)*d*sqrt(-a*e/d - b - c*d/e)) + c**(S(1)/4)*sqrt((a - b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 + b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*(-sqrt(a)*e + sqrt(c)*d)*sqrt(-a + b*x**S(2) - c*x**S(4))) - sqrt((a - b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(e + sqrt(c)*d/sqrt(a))*elliptic_pi(-sqrt(a)*(-e + sqrt(c)*d/sqrt(a))**S(2)/(S(4)*sqrt(c)*d*e), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 + b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*(-e + sqrt(c)*d/sqrt(a))*sqrt(-a + b*x**S(2) - c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(3)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, e**S(3)*x**S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(5) + e**S(2)*x*(d - S(4)*e/S(5))*sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(3)*e*x*(x**S(2) + S(2))*(S(5)*d**S(2) - S(10)*d*e + S(6)*e**S(2))/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - S(3)*sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*(S(5)*d**S(2) - S(10)*d*e + S(6)*e**S(2))*elliptic_e(atan(x), S(1)/2)/(S(5)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*(S(5)*d**S(3) - S(10)*d*e**S(2) + S(8)*e**S(3))*elliptic_f(atan(x), S(1)/2)/(S(10)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, e**S(2)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(3) + e*x*(S(2)*d - S(2)*e)*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) - S(2)*sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(d - e)*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(3)*d**S(2) - S(2)*e**S(2))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(6)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, sqrt(S(2))*d*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + e*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) - sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_pi(S(1) - e/d, atan(x), S(1)/2)/(S(2)*d*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*e*(x**S(2) + S(2))*elliptic_pi(S(1) - e/d, atan(x), S(1)/2)/(S(2)*d*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, e**S(2)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(2)*d*(d + e*x**S(2))*(d**S(2) - S(3)*d*e + S(2)*e**S(2))) - e*x*(x**S(2) + S(2))/(S(2)*d*(d**S(2) - S(3)*d*e + S(2)*e**S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(2)*d*(d - S(2)*e)*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt((x**S(2) + S(2))/(S(2)*x**S(2) + S(2)))*(S(2)*d - e)*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*d*(d - e)**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*e*(x**S(2) + S(2))*(S(3)*d**S(2) - S(6)*d*e + S(2)*e**S(2))*elliptic_pi(S(1) - e/d, atan(x), S(1)/2)/(S(4)*d**S(2)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(d - S(2)*e)*(d - e)**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, -sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(4)*(d - S(2)*e)*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + e**S(2)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(2)*d*(d + e*x**S(2))*(d**S(2) - S(3)*d*e + S(2)*e**S(2))) - e*x*(x**S(2) + S(2))/(S(2)*d*(d**S(2) - S(3)*d*e + S(2)*e**S(2))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*e*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(2)*d*(d - S(2)*e)*(d - e)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*(S(3)*d**S(2) - S(6)*d*e + S(2)*e**S(2))*elliptic_f(atan(x), S(1)/2)/(S(4)*d*(d - S(2)*e)*(d - e)**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*e*(x**S(2) + S(2))*(S(3)*d**S(2) - S(6)*d*e + S(2)*e**S(2))*elliptic_pi(S(1) - e/d, atan(x), S(1)/2)/(S(4)*d**S(2)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(d - S(2)*e)*(d - e)**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(3)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(25)*x**S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(135)*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(75)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2)) - S(135)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(193)*x**S(2) + S(193))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(20)*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + S(25)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/S(3) - S(20)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(97)*x**S(2) + S(97))*elliptic_f(atan(x), S(1)/2)/(S(6)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, S(5)*x*(x**S(2) + S(2))/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) - S(5)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(7)*x**S(2) + S(7))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)), x), x, sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(4)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*(S(5)*x**S(2) + S(10))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(28)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))**S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, S(5)*x*(x**S(2) + S(2))/(S(84)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - S(25)*x*sqrt(x**S(4) + S(3)*x**S(2) + S(2))/(S(420)*x**S(2) + S(588)) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(5)*x**S(2) + S(5))*elliptic_e(atan(x), S(1)/2)/(S(84)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(9)*x**S(2) + S(9))*elliptic_f(atan(x), S(1)/2)/(S(112)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*(S(65)*x**S(2) + S(130))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(2352)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(3)/(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, x*(-S(11)*x**S(2) + S(5))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(261)*x*(x**S(2) + S(2))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(169)*x**S(2) + S(169))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(261)*x**S(2) + S(261))*elliptic_e(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))**S(2)/(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, -S(17)*x*(x**S(2) + S(2))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(17)*x**S(2) + S(25))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + S(6)*sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(17)*x**S(2) + S(17))*elliptic_e(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(7))/(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2), x), x, -x*(x**S(2) + S(2))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(x**S(2) + S(5))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(3)*x**S(2) + S(2))**(S(-3)/2), x), x, -S(3)*x*(x**S(2) + S(2))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(3)*x**S(2) + S(5))/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_f(atan(x), S(1)/2)/sqrt(x**S(4) + S(3)*x**S(2) + S(2)) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(3)*x**S(2) + S(3))*elliptic_e(atan(x), S(1)/2)/(S(2)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)), x), x, x/(S(6)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(125)*x**S(2) + S(125))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(168)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt((x**S(2) + S(2))/(S(2)*x**S(2) + S(2)))*(S(9)*x**S(2) + S(9))*elliptic_f(atan(x), S(1)/2)/(S(4)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)), x), x, -x*(x**S(2) + S(2))/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + x*(S(2)*x**S(2) + S(5))/(S(6)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(x**S(2) + S(1))*elliptic_e(atan(x), S(1)/2)/(S(3)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(9)*x**S(2) + S(9))*elliptic_f(atan(x), S(1)/2)/(S(8)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*(S(125)*x**S(2) + S(250))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(168)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))**S(2)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)), x), x, S(625)*x*(x**S(2) + S(1))*(x**S(2) + S(2))/((S(2520)*x**S(2) + S(3528))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - S(125)*x*(x**S(2) + S(2))/(S(504)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - x/(S(18)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(31)*x**S(2) + S(31))*elliptic_e(atan(x), S(1)/2)/(S(56)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*(S(375)*x**S(2) + S(375))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(1568)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt((x**S(2) + S(2))/(S(2)*x**S(2) + S(2)))*(S(463)*x**S(2) + S(463))*elliptic_f(atan(x), S(1)/2)/(S(336)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((S(5)*x**S(2) + S(7))**S(2)*(x**S(4) + S(3)*x**S(2) + S(2))**(S(3)/2)), x), x, S(625)*x*(x**S(2) + S(1))*(x**S(2) + S(2))/((S(2520)*x**S(2) + S(3528))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - S(125)*x*(x**S(2) + S(2))/(S(504)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - x/(S(18)*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + (S(125)*x**S(2) + S(125))*elliptic_pi(S(-3)/7, atan(sqrt(S(2))*x/S(2)), S(-1))/(S(189)*sqrt((x**S(2) + S(1))/(x**S(2) + S(2)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*(S(31)*x**S(2) + S(62))*elliptic_e(atan(x), S(1)/2)/(S(56)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) + sqrt(S(2))*(S(6875)*x**S(2) + S(13750))*elliptic_pi(S(2)/7, atan(x), S(1)/2)/(S(14112)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))) - sqrt(S(2))*(S(7667)*x**S(2) + S(15334))*elliptic_f(atan(x), S(1)/2)/(S(6048)*sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) + x**S(2) + S(3)), x), x, -sqrt(S(-1)/2 + sqrt(S(13))/S(2))*elliptic_e(asin(sqrt(S(2))*x/sqrt(S(1) + sqrt(S(13)))), S(-7)/6 - sqrt(S(13))/S(6)) + sqrt(S(7) + S(2)*sqrt(S(13)))*elliptic_f(asin(sqrt(S(2))*x/sqrt(S(1) + sqrt(S(13)))), S(-7)/6 - sqrt(S(13))/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) + S(2)*x**S(2) + S(3)), x), x, -elliptic_e(asin(sqrt(S(3))*x/S(3)), S(-3)) + S(4)*elliptic_f(asin(sqrt(S(3))*x/S(3)), S(-3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) + S(3)*x**S(2) + S(3)), x), x, -sqrt(S(-3)/2 + sqrt(S(21))/S(2))*elliptic_e(asin(sqrt(S(2))*x/sqrt(S(3) + sqrt(S(21)))), S(-5)/2 - sqrt(S(21))/S(2)) + sqrt(S(9) + S(2)*sqrt(S(21)))*elliptic_f(asin(sqrt(S(2))*x/sqrt(S(3) + sqrt(S(21)))), S(-5)/2 - sqrt(S(21))/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) - x**S(2) + S(3)), x), x, -sqrt(S(1)/2 + sqrt(S(13))/S(2))*elliptic_e(asin(sqrt(S(2))*x/sqrt(S(-1) + sqrt(S(13)))), S(-7)/6 + sqrt(S(13))/S(6)) + sqrt(S(5) + S(2)*sqrt(S(13)))*elliptic_f(asin(sqrt(S(2))*x/sqrt(S(-1) + sqrt(S(13)))), S(-7)/6 + sqrt(S(13))/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) - S(2)*x**S(2) + S(3)), x), x, -sqrt(S(3))*elliptic_e(asin(x), S(-1)/3) + S(2)*sqrt(S(3))*elliptic_f(asin(x), S(-1)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(3))/sqrt(-x**S(4) - S(3)*x**S(2) + S(3)), x), x, -sqrt(S(3)/2 + sqrt(S(21))/S(2))*elliptic_e(asin(sqrt(S(2))*x/sqrt(S(-3) + sqrt(S(21)))), S(-5)/2 + sqrt(S(21))/S(2)) + sqrt(S(3) + S(2)*sqrt(S(21)))*elliptic_f(asin(sqrt(S(2))*x/sqrt(S(-3) + sqrt(S(21)))), S(-5)/2 + sqrt(S(21))/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**S(2) - sqrt(-S(4)*a*c + b**S(2)))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/sqrt(a + b*x**S(2) + c*x**S(4)) + S(2)*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2)) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b - sqrt(-S(4)*a*c + b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2))/((x**S(2) + S(1))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), x), x, sqrt(S(2))*(x**S(2) + S(2))*elliptic_e(atan(x), S(1)/2)/(sqrt((x**S(2) + S(2))/(x**S(2) + S(1)))*sqrt(x**S(4) + S(3)*x**S(2) + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(5)/2)*(a + b*x**S(2) + c*x**S(4)), x), x, c*x**S(3)*(d + e*x**S(2))**(S(7)/2)/(S(10)*e) + d**S(3)*(S(80)*a*e**S(2) - S(10)*b*d*e + S(3)*c*d**S(2))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(256)*e**(S(5)/2)) + d**S(2)*x*sqrt(d + e*x**S(2))*(S(80)*a*e**S(2) - S(10)*b*d*e + S(3)*c*d**S(2))/(S(256)*e**S(2)) + d*x*(d + e*x**S(2))**(S(3)/2)*(S(80)*a*e**S(2) - S(10)*b*d*e + S(3)*c*d**S(2))/(S(384)*e**S(2)) - x*(d + e*x**S(2))**(S(7)/2)*(-S(10)*b*e + S(3)*c*d)/(S(80)*e**S(2)) + x*(d + e*x**S(2))**(S(5)/2)*(S(80)*a*e**S(2) - S(10)*b*d*e + S(3)*c*d**S(2))/(S(480)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4)), x), x, c*x**S(3)*(d + e*x**S(2))**(S(5)/2)/(S(8)*e) + d**S(2)*(S(48)*a*e**S(2) - S(8)*b*d*e + S(3)*c*d**S(2))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(128)*e**(S(5)/2)) + d*x*sqrt(d + e*x**S(2))*(S(48)*a*e**S(2) - S(8)*b*d*e + S(3)*c*d**S(2))/(S(128)*e**S(2)) - x*(d + e*x**S(2))**(S(5)/2)*(-S(8)*b*e + S(3)*c*d)/(S(48)*e**S(2)) + x*(d + e*x**S(2))**(S(3)/2)*(S(48)*a*e**S(2) - S(8)*b*d*e + S(3)*c*d**S(2))/(S(192)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, c*x**S(3)*(d + e*x**S(2))**(S(3)/2)/(S(6)*e) + d*(S(8)*a*e**S(2) - S(2)*b*d*e + c*d**S(2))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(16)*e**(S(5)/2)) - x*(d + e*x**S(2))**(S(3)/2)*(-S(2)*b*e + c*d)/(S(8)*e**S(2)) + x*sqrt(d + e*x**S(2))*(S(8)*a*e**S(2) - S(2)*b*d*e + c*d**S(2))/(S(16)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/sqrt(d + e*x**S(2)), x), x, c*x**S(3)*sqrt(d + e*x**S(2))/(S(4)*e) - x*sqrt(d + e*x**S(2))*(-S(4)*b*e + S(3)*c*d)/(S(8)*e**S(2)) + (S(8)*a*e**S(2) - S(4)*b*d*e + S(3)*c*d**S(2))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(8)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**(S(3)/2), x), x, c*x*sqrt(d + e*x**S(2))/(S(2)*e**S(2)) - (-S(2)*b*e + S(3)*c*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*e**(S(5)/2)) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(d*e**S(2)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**(S(5)/2), x), x, c*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/e**(S(5)/2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(3)*d*e**S(2)*(d + e*x**S(2))**(S(3)/2)) - x*(S(4)*c*d**S(2) - e*(S(2)*a*e + b*d))/(S(3)*d**S(2)*e**S(2)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**(S(7)/2), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(5)*d*e**S(2)*(d + e*x**S(2))**(S(5)/2)) - x*(c*d**S(2) - S(5)*c*d*e*x**S(2) - e*(S(4)*a*e + b*d))/(S(15)*d**S(2)*e**S(2)*(d + e*x**S(2))**(S(3)/2)) - x*(S(2)*c*d**S(2) - S(2)*e*(S(4)*a*e + b*d))/(S(15)*d**S(3)*e**S(2)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**(S(9)/2), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(7)*d*e**S(2)*(d + e*x**S(2))**(S(7)/2)) - x*(S(8)*c*d**S(2) - e*(S(6)*a*e + b*d))/(S(35)*d**S(2)*e**S(2)*(d + e*x**S(2))**(S(5)/2)) + x*(S(3)*c*d**S(2) + S(4)*e*(S(6)*a*e + b*d))/(S(105)*d**S(3)*e**S(2)*(d + e*x**S(2))**(S(3)/2)) + x*(S(6)*c*d**S(2) + S(8)*e*(S(6)*a*e + b*d))/(S(105)*d**S(4)*e**S(2)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**(S(11)/2), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(9)*d*e**S(2)*(d + e*x**S(2))**(S(9)/2)) - x*(S(10)*c*d**S(2) - e*(S(8)*a*e + b*d))/(S(63)*d**S(2)*e**S(2)*(d + e*x**S(2))**(S(7)/2)) + x*(c*d**S(2) + S(2)*e*(S(8)*a*e + b*d))/(S(105)*d**S(3)*e**S(2)*(d + e*x**S(2))**(S(5)/2)) + x*(S(4)*c*d**S(2) + S(8)*e*(S(8)*a*e + b*d))/(S(315)*d**S(4)*e**S(2)*(d + e*x**S(2))**(S(3)/2)) + x*(S(8)*c*d**S(2) + S(16)*e*(S(8)*a*e + b*d))/(S(315)*d**S(5)*e**S(2)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + c*x**(S(2)*n)), x), x, S(3)*d*e**S(2)*x/c + e**S(3)*x**(n + S(1))/(c*(n + S(1))) - x*(-a*e**S(3) + sqrt(c)*d*(-S(3)*a*e**S(2) + c*d**S(2))/sqrt(-a) + S(3)*c*d**S(2)*e)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*c**(S(3)/2)*sqrt(-a)) + x*(-S(3)*a*sqrt(c)*d*e**S(2) + a*e**S(3)*sqrt(-a) + c**(S(3)/2)*d**S(3) - S(3)*c*d**S(2)*e*sqrt(-a))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + c*x**(S(2)*n)), x), x, e**S(2)*x/c + x*(-a*e**S(2) - S(2)*sqrt(c)*d*e*sqrt(-a) + c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*c) + x*(-a*e**S(2) + S(2)*sqrt(c)*d*e*sqrt(-a) + c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + c*x**(S(2)*n)), x), x, x*(d - e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a) + x*(d + e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))*(d + e*x**n)), x), x, e**S(2)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))) + c*x*(d - e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))) + c*x*(d + e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))*(d + e*x**n)**S(2)), x), x, S(2)*c*e**S(2)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(a*e**S(2) + c*d**S(2))**S(2) + e**S(2)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) + c*d**S(2))) + c*x*(-a*e**S(2) - S(2)*sqrt(c)*d*e*sqrt(-a) + c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(2)) + c*x*(-a*e**S(2) + S(2)*sqrt(c)*d*e*sqrt(-a) + c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))*(d + e*x**n)**S(3)), x), x, c**(S(3)/2)*x*(-a*e**S(3) - sqrt(c)*d*(-S(3)*a*e**S(2) + c*d**S(2))/sqrt(-a) + S(3)*c*d**S(2)*e)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*sqrt(-a)*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(2)*x*(-a*e**S(2) + S(3)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(3)) + S(2)*c*e**S(2)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(2)) + e**S(2)*x*hyper((S(3), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(3)*(a*e**S(2) + c*d**S(2))) + c**(S(3)/2)*x*(-S(3)*a*sqrt(c)*d*e**S(2) + c**(S(3)/2)*d**S(3) + S(3)*c*d**S(2)*e*sqrt(-a) + e**S(3)*(-a)**(S(3)/2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a - c*x**(S(2)*n)), x), x, x*(-sqrt(a)*e/sqrt(c) + d)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(a))/(S(2)*a) + x*(sqrt(a)*e/sqrt(c) + d)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(a))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + c*x**(S(2)*n))**S(2), x), x, -x*(sqrt(c)*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) - (-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*c**(S(3)/2)*n*(-a)**(S(3)/2)) - x*(sqrt(c)*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) + (-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*c**(S(3)/2)*n*(-a)**(S(3)/2)) + e**S(2)*x*(S(3)*d - e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*c) + e**S(2)*x*(S(3)*d + e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*c) + x*(d*(-S(3)*a*e**S(2) + c*d**S(2)) + e*x**n*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(2)*a*c*n*(a + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + c*x**(S(2)*n))**S(2), x), x, e**S(2)*x*hyper((S(1), S(1)/(S(2)*n)), (S(1) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(a*c) + x*(-a*e**S(2) + c*d**S(2) + S(2)*c*d*e*x**n)/(S(2)*a*c*n*(a + c*x**(S(2)*n))) - x*(-a*e**S(2)*(-S(2)*n + S(1)) - S(2)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*c*n) - x*(-a*e**S(2)*(-S(2)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + c*x**(S(2)*n))**S(2), x), x, x*(d + e*x**n)/(S(2)*a*n*(a + c*x**(S(2)*n))) - x*(sqrt(c)*(-S(2)*d*n + d) + e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*sqrt(c)*n) - x*(sqrt(c)*d*(-S(2)*n + S(1)) - e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*sqrt(c)*n), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(2)*(d + e*x**n)), x), x, e**S(4)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(2)) + c*e**S(2)*x*(d - e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(2)) + c*e**S(2)*x*(d + e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(2)) + c*x*(d - e*x**n)/(S(2)*a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))) - sqrt(c)*x*(sqrt(c)*(-S(2)*d*n + d) + e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))) - sqrt(c)*x*(sqrt(c)*d*(-S(2)*n + S(1)) - e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))), expand=True, _diff=True, _numerical=True) # apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(2)*(d + e*x**n)**S(2)), x), x, S(4)*c*e**S(4)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(a*e**S(2) + c*d**S(2))**S(3) + e**S(4)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) + c*d**S(2))**S(2)) + c*e**S(2)*x*(-a*e**S(2) - S(4)*sqrt(c)*d*e*sqrt(-a) + S(3)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(2)*x*(-a*e**S(2) + S(4)*sqrt(c)*d*e*sqrt(-a) + S(3)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(3)) + c*x*(-a*e**S(2) + c*d**S(2) - S(2)*c*d*e*x**n)/(S(2)*a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(2)) - c*x*(-a*e**S(2)*(-S(2)*n + S(1)) - S(2)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(2)) - c*x*(-a*e**S(2)*(-S(2)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) # apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(2)*(d + e*x**n)**S(3)), x), x, c**(S(3)/2)*e**S(2)*x*(-a*e**S(3) - S(3)*sqrt(c)*d*(-a*e**S(2) + c*d**S(2))/sqrt(-a) + S(5)*c*d**S(2)*e)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(sqrt(-a)*(a*e**S(2) + c*d**S(2))**S(4)) - c**(S(3)/2)*x*(sqrt(c)*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) - (-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*n*(-a)**(S(3)/2)*(a*e**S(2) + c*d**S(2))**S(3)) - c**(S(3)/2)*x*(sqrt(c)*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) + (-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*n*(-a)**(S(3)/2)*(a*e**S(2) + c*d**S(2))**S(3)) + S(2)*c*e**S(4)*x*(-a*e**S(2) + S(5)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(4)) + S(4)*c*e**S(4)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(3)) + e**S(4)*x*hyper((S(3), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(3)*(a*e**S(2) + c*d**S(2))**S(2)) + c**(S(3)/2)*e**S(2)*x*(-S(3)*a*sqrt(c)*d*e**S(2) + S(3)*c**(S(3)/2)*d**S(3) + S(5)*c*d**S(2)*e*sqrt(-a) + e**S(3)*(-a)**(S(3)/2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(a*(a*e**S(2) + c*d**S(2))**S(4)) + c**S(2)*x*(d*(-S(3)*a*e**S(2) + c*d**S(2)) - e*x**n*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(2)*a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + c*x**(S(2)*n))**S(3), x), x, -x*(sqrt(c)*(-S(4)*n + S(1))*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) - (-S(3)*n + S(1))*(-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*c**(S(3)/2)*n**S(2)*(-a)**(S(5)/2)) - x*(sqrt(c)*(-S(4)*n + S(1))*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) + (-S(3)*n + S(1))*(-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*c**(S(3)/2)*n**S(2)*(-a)**(S(5)/2)) + e**S(2)*x*(S(3)*d + e*x**n)/(S(2)*a*c*n*(a + c*x**(S(2)*n))) + x*(d*(-S(3)*a*e**S(2) + c*d**S(2)) + e*x**n*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(4)*a*c*n*(a + c*x**(S(2)*n))**S(2)) - x*(d*(-S(4)*n + S(1))*(-S(3)*a*e**S(2) + c*d**S(2)) + e*x**n*(-S(3)*n + S(1))*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(8)*a**S(2)*c*n**S(2)*(a + c*x**(S(2)*n))) - e**S(2)*x*(sqrt(c)*d*(-S(6)*n + S(3)) - e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*c**(S(3)/2)*n) - e**S(2)*x*(sqrt(c)*d*(-S(6)*n + S(3)) + e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*c**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + c*x**(S(2)*n))**S(3), x), x, x*(-a*e**S(2) + c*d**S(2) + S(2)*c*d*e*x**n)/(S(4)*a*c*n*(a + c*x**(S(2)*n))**S(2)) + e**S(2)*x*hyper((S(2), S(1)/(S(2)*n)), (S(1) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(a**S(2)*c) - x*(S(2)*c*d*e*x**n*(-S(3)*n + S(1)) + (-S(4)*n + S(1))*(-a*e**S(2) + c*d**S(2)))/(S(8)*a**S(2)*c*n**S(2)*(a + c*x**(S(2)*n))) + x*(-a*e**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)) + c*d**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*c*n**S(2)) - x*(a*e**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)) - c*d**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*c*n**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + c*x**(S(2)*n))**S(3), x), x, x*(d + e*x**n)/(S(4)*a*n*(a + c*x**(S(2)*n))**S(2)) - x*(d*(-S(4)*n + S(1)) + e*x**n*(-S(3)*n + S(1)))/(S(8)*a**S(2)*n**S(2)*(a + c*x**(S(2)*n))) - x*(-sqrt(c)*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*sqrt(c)*n**S(2)) + x*(sqrt(c)*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*sqrt(c)*n**S(2)), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(3)*(d + e*x**n)), x), x, e**S(6)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(4)*x*(d - e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(4)*x*(d + e*sqrt(-a)/sqrt(c))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(2)*x*(d - e*x**n)/(S(2)*a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(2)) + c*x*(d - e*x**n)/(S(4)*a*n*(a + c*x**(S(2)*n))**S(2)*(a*e**S(2) + c*d**S(2))) - sqrt(c)*e**S(2)*x*(sqrt(c)*(-S(2)*d*n + d) + e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(2)) - sqrt(c)*e**S(2)*x*(sqrt(c)*d*(-S(2)*n + S(1)) - e*sqrt(-a)*(-n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(2)) - c*x*(d*(-S(4)*n + S(1)) - e*x**n*(-S(3)*n + S(1)))/(S(8)*a**S(2)*n**S(2)*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))) - sqrt(c)*x*(-sqrt(c)*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*n**S(2)*(a*e**S(2) + c*d**S(2))) + sqrt(c)*x*(sqrt(c)*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*n**S(2)*(a*e**S(2) + c*d**S(2))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(3)*(d + e*x**n)**S(2)), x), x, S(6)*c*e**S(6)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(a*e**S(2) + c*d**S(2))**S(4) + e**S(6)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) + c*d**S(2))**S(3)) + c*e**S(4)*x*(-a*e**S(2) - S(6)*sqrt(c)*d*e*sqrt(-a) + S(5)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(4)) + c*e**S(4)*x*(-a*e**S(2) + S(6)*sqrt(c)*d*e*sqrt(-a) + S(5)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(4)) + c*e**S(2)*x*(-a*e**S(2) + S(3)*c*d**S(2) - S(4)*c*d*e*x**n)/(S(2)*a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(3)) + c*x*(-a*e**S(2) + c*d**S(2) - S(2)*c*d*e*x**n)/(S(4)*a*n*(a + c*x**(S(2)*n))**S(2)*(a*e**S(2) + c*d**S(2))**S(2)) - c*e**S(2)*x*(-a*e**S(2)*(-S(2)*n + S(1)) - S(4)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + S(3)*c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(3)) - c*e**S(2)*x*(-a*e**S(2)*(-S(2)*n + S(1)) + S(4)*sqrt(c)*d*e*sqrt(-a)*(-n + S(1)) + S(3)*c*d**S(2)*(-S(2)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(4)*a**S(2)*n*(a*e**S(2) + c*d**S(2))**S(3)) - c*x*(-S(2)*c*d*e*x**n*(-S(3)*n + S(1)) + (-S(4)*n + S(1))*(-a*e**S(2) + c*d**S(2)))/(S(8)*a**S(2)*n**S(2)*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(2)) + c*x*(-a*e**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)) + c*d**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*n**S(2)*(a*e**S(2) + c*d**S(2))**S(2)) - c*x*(a*e**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*sqrt(c)*d*e*sqrt(-a)*(S(3)*n**S(2) - S(4)*n + S(1)) - c*d**S(2)*(S(8)*n**S(2) - S(6)*n + S(1)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*a**S(3)*n**S(2)*(a*e**S(2) + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((a + c*x**(S(2)*n))**S(3)*(d + e*x**n)**S(3)), x), x, S(3)*c**(S(3)/2)*e**S(4)*x*(-a*e**S(3) - sqrt(c)*d*(-S(3)*a*e**S(2) + S(5)*c*d**S(2))/sqrt(-a) + S(7)*c*d**S(2)*e)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*sqrt(-a)*(a*e**S(2) + c*d**S(2))**S(5)) - c**(S(3)/2)*e**S(2)*x*(S(3)*sqrt(c)*(-S(2)*n + S(1))*(-a*d*e**S(2) + c*d**S(3))/sqrt(-a) - (-n + S(1))*(-a*e**S(3) + S(5)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(2)*n*(-a)**(S(3)/2)*(a*e**S(2) + c*d**S(2))**S(4)) - c**(S(3)/2)*e**S(2)*x*(S(3)*sqrt(c)*(-S(2)*n + S(1))*(-a*d*e**S(2) + c*d**S(3))/sqrt(-a) + (-n + S(1))*(-a*e**S(3) + S(5)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*n*(-a)**(S(3)/2)*(a*e**S(2) + c*d**S(2))**S(4)) - c**(S(3)/2)*x*(sqrt(c)*(-S(4)*n + S(1))*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) - (-S(3)*n + S(1))*(-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), sqrt(c)*x**n/sqrt(-a))/(S(16)*n**S(2)*(-a)**(S(5)/2)*(a*e**S(2) + c*d**S(2))**S(3)) - c**(S(3)/2)*x*(sqrt(c)*(-S(4)*n + S(1))*(-S(2)*n + S(1))*(-S(3)*a*d*e**S(2) + c*d**S(3))/sqrt(-a) + (-S(3)*n + S(1))*(-n + S(1))*(-a*e**S(3) + S(3)*c*d**S(2)*e))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(16)*n**S(2)*(-a)**(S(5)/2)*(a*e**S(2) + c*d**S(2))**S(3)) + S(3)*c*e**S(6)*x*(-a*e**S(2) + S(7)*c*d**S(2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(5)) + S(6)*c*e**S(6)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) + c*d**S(2))**S(4)) + e**S(6)*x*hyper((S(3), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(3)*(a*e**S(2) + c*d**S(2))**S(3)) + S(3)*c**(S(3)/2)*e**S(4)*x*(-S(3)*a*sqrt(c)*d*e**S(2) + S(5)*c**(S(3)/2)*d**S(3) + S(7)*c*d**S(2)*e*sqrt(-a) + e**S(3)*(-a)**(S(3)/2))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -sqrt(c)*x**n/sqrt(-a))/(S(2)*a*(a*e**S(2) + c*d**S(2))**S(5)) + c**S(2)*e**S(2)*x*(S(3)*d*(-a*e**S(2) + c*d**S(2)) - e*x**n*(-a*e**S(2) + S(5)*c*d**S(2)))/(a*n*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(4)) + c**S(2)*x*(d*(-S(3)*a*e**S(2) + c*d**S(2)) - e*x**n*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(4)*a*n*(a + c*x**(S(2)*n))**S(2)*(a*e**S(2) + c*d**S(2))**S(3)) - c**S(2)*x*(d*(-S(4)*n + S(1))*(-S(3)*a*e**S(2) + c*d**S(2)) - e*x**n*(-S(3)*n + S(1))*(-a*e**S(2) + S(3)*c*d**S(2)))/(S(8)*a**S(2)*n**S(2)*(a + c*x**(S(2)*n))*(a*e**S(2) + c*d**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p*(d + e*x**n)**S(3), x), x, d**S(3)*x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(1)/(S(2)*n), -p), (S(1) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a) + S(3)*d**S(2)*e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((n + S(1))/(S(2)*n), -p), (S(3)/2 + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(n + S(1)) + S(3)*d*e**S(2)*x**(S(2)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(1) + S(1)/(S(2)*n), -p), (S(2) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(S(2)*n + S(1)) + e**S(3)*x**(S(3)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(3)/2 + S(1)/(S(2)*n), -p), (S(5)/2 + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p*(d + e*x**n)**S(2), x), x, d**S(2)*x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(1)/(S(2)*n), -p), (S(1) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a) + S(2)*d*e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((n + S(1))/(S(2)*n), -p), (S(3)/2 + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(n + S(1)) + e**S(2)*x**(S(2)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(1) + S(1)/(S(2)*n), -p), (S(2) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p*(d + e*x**n), x), x, d*x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper((S(1)/(S(2)*n), -p), (S(1) + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a) + e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((n + S(1))/(S(2)*n), -p), (S(3)/2 + S(1)/(S(2)*n),), -c*x**(S(2)*n)/a)/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n)), x), x, a*d*x + c*e*x**(S(3)*n + S(1))/(S(3)*n + S(1)) + x**(n + S(1))*(a*e + b*d)/(n + S(1)) + x**(S(2)*n + S(1))*(b*e + c*d)/(S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, a**S(2)*d*x + a*x**(n + S(1))*(a*e + S(2)*b*d)/(n + S(1)) + c**S(2)*e*x**(S(5)*n + S(1))/(S(5)*n + S(1)) + c*x**(S(4)*n + S(1))*(S(2)*b*e + c*d)/(S(4)*n + S(1)) + x**(S(2)*n + S(1))*(S(2)*a*b*e + S(2)*a*c*d + b**S(2)*d)/(S(2)*n + S(1)) + x**(S(3)*n + S(1))*(S(2)*a*c*e + b**S(2)*e + S(2)*b*c*d)/(S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, a**S(3)*d*x + a**S(2)*x**(n + S(1))*(a*e + S(3)*b*d)/(n + S(1)) + S(3)*a*x**(S(2)*n + S(1))*(a*b*e + a*c*d + b**S(2)*d)/(S(2)*n + S(1)) + c**S(3)*e*x**(S(7)*n + S(1))/(S(7)*n + S(1)) + c**S(2)*x**(S(6)*n + S(1))*(S(3)*b*e + c*d)/(S(6)*n + S(1)) + S(3)*c*x**(S(5)*n + S(1))*(a*c*e + b**S(2)*e + b*c*d)/(S(5)*n + S(1)) + x**(S(3)*n + S(1))*(S(3)*a**S(2)*c*e + S(3)*a*b**S(2)*e + S(6)*a*b*c*d + b**S(3)*d)/(S(3)*n + S(1)) + x**(S(4)*n + S(1))*(S(6)*a*b*c*e + S(3)*a*c**S(2)*d + b**S(3)*e + S(3)*b**S(2)*c*d)/(S(4)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + b*x**n + c*x**(S(2)*n)), x), x, e**S(3)*x**(n + S(1))/(c*(n + S(1))) + e**S(2)*x*(-b*e + S(3)*c*d)/c**S(2) + x*(-a*c*e**S(3) + b**S(2)*e**S(3) - S(3)*b*c*d*e**S(2) + S(3)*c**S(2)*d**S(2)*e - (-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(c**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + x*(-a*c*e**S(3) + b**S(2)*e**S(3) - S(3)*b*c*d*e**S(2) + S(3)*c**S(2)*d**S(2)*e + (-b*e + S(2)*c*d)*(b**S(2)*e**S(2) + c**S(2)*d**S(2) - c*e*(S(3)*a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(c**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + b*x**n + c*x**(S(2)*n)), x), x, e**S(2)*x/c + x*(-b*e**S(2) + S(2)*c*d*e - (b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(c*(b + sqrt(-S(4)*a*c + b**S(2)))) + x*(-b*e**S(2) + S(2)*c*d*e + (b**S(2)*e**S(2) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(c*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + b*x**n + c*x**(S(2)*n)), x), x, x*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(b + sqrt(-S(4)*a*c + b**S(2))) + x*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(b - sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))), x), x, -c*x*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - c*x*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**S(2)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)**S(2)*(a + b*x**n + c*x**(S(2)*n))), x), x, -c*x*(b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - c*x*(b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(2)*x*(-b*e + S(2)*c*d)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(2)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)**S(3)*(a + b*x**n + c*x**(S(2)*n))), x), x, -c*x*(-b**S(2)*e**S(3)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(3)*d**S(3) - S(3)*c**S(2)*d*e*(S(2)*a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2))) + c*e**S(2)*(S(3)*a*b*e - a*e*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(2)*d - S(3)*b*d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) - c*x*(-b**S(2)*e**S(3)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(3)*d**S(3) - S(3)*c**S(2)*d*e*(S(2)*a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2))) + c*e**S(2)*(a*e*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(2)*d + S(3)*b*(a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**S(2)*x*(b**S(2)*e**S(2) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**S(2)*x*(-b*e + S(2)*c*d)*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(2)*x*hyper((S(3), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, e**S(2)*x*(e - (-S(3)*b*e + S(6)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(c*(b + sqrt(-S(4)*a*c + b**S(2)))) + e**S(2)*x*(e + (-S(3)*b*e + S(6)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(c*(b - sqrt(-S(4)*a*c + b**S(2)))) + x*(-a*b*e*(a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*c*d*(-S(3)*a*e**S(2) + c*d**S(2)) + b**S(2)*c*d**S(3) - x**n*(a*b**S(2)*e**S(3) + S(2)*a*c*e*(-a*e**S(2) + S(3)*c*d**S(2)) - b*c*d*(S(3)*a*e**S(2) + c*d**S(2))))/(a*c*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + x*((-n + S(1))*(a*b**S(2)*e**S(3) + S(2)*a*c*e*(-a*e**S(2) + S(3)*c*d**S(2)) - b*c*d*(S(3)*a*e**S(2) + c*d**S(2))) - (-a*b**S(3)*e**S(3)*(-S(3)*n + S(1)) + S(2)*a*b*c*e*(a*e**S(2)*(-S(5)*n + S(2)) + S(3)*c*d**S(2)*n) + S(4)*a*c**S(2)*d*(-S(2)*n + S(1))*(-S(3)*a*e**S(2) + c*d**S(2)) + b**S(2)*c*d*(S(3)*a*e**S(2)*(-S(3)*n + S(1)) - c*d**S(2)*(-n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*c*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*((-n + S(1))*(a*b**S(2)*e**S(3) + S(2)*a*c*e*(-a*e**S(2) + S(3)*c*d**S(2)) - b*c*d*(S(3)*a*e**S(2) + c*d**S(2))) + (-a*b**S(3)*e**S(3)*(-S(3)*n + S(1)) + S(2)*a*b*c*e*(a*e**S(2)*(-S(5)*n + S(2)) + S(3)*c*d**S(2)*n) + S(4)*a*c**S(2)*d*(-S(2)*n + S(1))*(-S(3)*a*e**S(2) + c*d**S(2)) + b**S(2)*c*d*(S(3)*a*e**S(2)*(-S(3)*n + S(1)) - c*d**S(2)*(-n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*c*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, -S(2)*e**S(2)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*e**S(2)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) + x*(-S(2)*a*b*d*e - S(2)*a*(-a*e**S(2) + c*d**S(2)) + b**S(2)*d**S(2) + x**n*(a*b*e**S(2) - S(4)*a*c*d*e + b*c*d**S(2)))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) - x*((-n + S(1))*(a*b*e**S(2) - S(4)*a*c*d*e + b*c*d**S(2)) + (S(4)*a*b*c*d*e*n + S(4)*a*c*(-S(2)*n + S(1))*(-a*e**S(2) + c*d**S(2)) + b**S(2)*(a*e**S(2)*(-S(3)*n + S(1)) - c*d**S(2)*(-n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - x*((-n + S(1))*(a*b*e**S(2) - S(4)*a*c*d*e + b*c*d**S(2)) - (S(4)*a*b*c*d*e*n + S(4)*a*c*(-S(2)*n + S(1))*(-a*e**S(2) + c*d**S(2)) + b**S(2)*(a*e**S(2)*(-S(3)*n + S(1)) - c*d**S(2)*(-n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, -c*x*(S(2)*a*(c*d*(-S(4)*n + S(2)) - e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*d*(-n + S(1)) + b*(S(2)*a*e*n + d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*x*(S(2)*a*(S(2)*c*d*(-S(2)*n + S(1)) + e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*(-d*n + d) - b*(-S(2)*a*e*n + d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + x*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**n*(-S(2)*a*e + b*d))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) #Apart assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**S(2)), x), x, -c*e**S(2)*x*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - c*e**S(2)*x*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(4)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*x*(-S(2)*a*c*(S(2)*c*d*(-S(2)*n + S(1)) + e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(3)*e*(-n + S(1)) + b**S(2)*(-n + S(1))*(c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(S(2)*a*e*(-S(3)*n + S(2)) - d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - c*x*((-n + S(1))*(S(2)*a*c*e - b**S(2)*e + b*c*d) + (S(2)*a*b*c*e*(-S(3)*n + S(2)) - S(4)*a*c**S(2)*d*(-S(2)*n + S(1)) - b**S(3)*e*(-n + S(1)) + b**S(2)*c*d*(-n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + x*(S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d + c*x**n*(S(2)*a*c*e - b**S(2)*e + b*c*d))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) #Apart assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)**S(2)*(a + b*x**n + c*x**(S(2)*n))**S(2)), x), x, -S(2)*c*e**S(2)*x*(b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d - S(2)*d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) - S(2)*c*e**S(2)*x*(b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(3)*c**S(2)*d**S(2) - c*e*(a*e + S(3)*b*d + S(2)*d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + S(2)*e**S(4)*x*(-b*e + S(2)*c*d)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**S(4)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*x*(S(4)*a*c**S(2)*(-c*d**S(2)*(-S(2)*n + S(1)) + e*(a*e*(-S(2)*n + S(1)) - d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*e**S(2)*(-n + S(1)) - b**S(3)*e*(-n + S(1))*(S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*c*(-c*d**S(2)*(-n + S(1)) + e*(a*e*(-S(7)*n + S(5)) - S(2)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b*c*(S(3)*a*e**S(2)*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)) + c*d*(S(4)*a*e*(-S(3)*n + S(2)) - d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*x*(S(4)*a*c**S(2)*(-c*d**S(2)*(-S(2)*n + S(1)) + e*(a*e*(-S(2)*n + S(1)) + d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*e**S(2)*(-n + S(1)) - b**S(3)*e*(-n + S(1))*(S(2)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*c*(-c*d**S(2)*(-n + S(1)) + e*(a*e*(-S(7)*n + S(5)) + S(2)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b*c*(-S(3)*a*e**S(2)*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)) + c*d*(S(4)*a*e*(-S(3)*n + S(2)) + d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - x*(-S(6)*a*b*c**S(2)*d*e + S(2)*a*c**S(2)*(-a*e**S(2) + c*d**S(2)) - b**S(4)*e**S(2) + S(2)*b**S(3)*c*d*e - b**S(2)*c*(-S(4)*a*e**S(2) + c*d**S(2)) + c*x**n*(-S(4)*a*c**S(2)*d*e - b**S(3)*e**S(2) + S(2)*b**S(2)*c*d*e - b*c*(-S(3)*a*e**S(2) + c*d**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)/(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, e**S(2)*x*(-S(2)*a*c*(S(6)*c*d*(-S(2)*n + S(1)) - e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(3)*e*(-n + S(1)) + b**S(2)*(-n + S(1))*(S(3)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(S(2)*a*e*(-S(5)*n + S(2)) - S(3)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*c*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + e**S(2)*x*(-S(2)*a*c*(S(6)*c*d*(-S(2)*n + S(1)) + e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(3)*e*(-n + S(1)) + b**S(2)*(-n + S(1))*(S(3)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(S(2)*a*e*(-S(5)*n + S(2)) + S(3)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*c*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + x*(-a*b*e*(a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*c*d*(-S(3)*a*e**S(2) + c*d**S(2)) + b**S(2)*c*d**S(3) - x**n*(a*b**S(2)*e**S(3) + S(2)*a*c*e*(-a*e**S(2) + S(3)*c*d**S(2)) - b*c*d*(S(3)*a*e**S(2) + c*d**S(2))))/(S(2)*a*c*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)) + e**S(2)*x*(a*b*c*e - S(6)*a*c**S(2)*d - b**S(3)*e + S(3)*b**S(2)*c*d + c*x**n*(-S(2)*a*c*e - b**S(2)*e + S(3)*b*c*d))/(a*c**S(2)*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + x*((-n + S(1))*(S(4)*a**S(2)*c**S(2)*e*(-S(3)*n + S(1))*(-a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*b**S(4)*e**S(3)*n - a*b**S(2)*c*e*(-a*e**S(2)*(S(2)*n + S(1)) + S(3)*c*d**S(2)) - S(2)*a*b*c**S(2)*d*(S(3)*a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) + b**S(3)*c*d*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))) + (-S(4)*a**S(2)*b*c**S(2)*e*(a*e**S(2)*(S(19)*n**S(2) - S(11)*n + S(1)) + S(3)*c*d**S(2)*(-S(3)*n**S(2) - n + S(1))) - S(8)*a**S(2)*c**S(3)*d*(-S(3)*a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*a*b**S(5)*e**S(3)*n*(-n + S(1)) + a*b**S(3)*c*e*(a*e**S(2)*(S(30)*n**S(2) - S(19)*n + S(1)) + S(3)*c*d**S(2)*(-n + S(1))) + S(6)*a*b**S(2)*c**S(2)*d*(-a*e**S(2)*(S(15)*n**S(2) - S(10)*n + S(1)) + c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(4)*c*d*(-n + S(1))*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*c*n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + x*((-n + S(1))*(S(4)*a**S(2)*c**S(2)*e*(-S(3)*n + S(1))*(-a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*b**S(4)*e**S(3)*n - a*b**S(2)*c*e*(-a*e**S(2)*(S(2)*n + S(1)) + S(3)*c*d**S(2)) - S(2)*a*b*c**S(2)*d*(S(3)*a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) + b**S(3)*c*d*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))) - (-S(4)*a**S(2)*b*c**S(2)*e*(a*e**S(2)*(S(19)*n**S(2) - S(11)*n + S(1)) + S(3)*c*d**S(2)*(-S(3)*n**S(2) - n + S(1))) - S(8)*a**S(2)*c**S(3)*d*(-S(3)*a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*a*b**S(5)*e**S(3)*n*(-n + S(1)) + a*b**S(3)*c*e*(a*e**S(2)*(S(30)*n**S(2) - S(19)*n + S(1)) + S(3)*c*d**S(2)*(-n + S(1))) + S(6)*a*b**S(2)*c**S(2)*d*(-a*e**S(2)*(S(15)*n**S(2) - S(10)*n + S(1)) + c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(4)*c*d*(-n + S(1))*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*c*n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - x*(S(2)*a**S(2)*b*c**S(2)*e*(-S(5)*a*e**S(2)*n + S(3)*c*d**S(2)*(-S(3)*n + S(2))) + S(4)*a**S(2)*c**S(3)*d*(-S(4)*n + S(1))*(-S(3)*a*e**S(2) + c*d**S(2)) - S(2)*a*b**S(5)*e**S(3)*n - S(3)*a*b**S(3)*c*e*(-S(3)*a*e**S(2)*n + c*d**S(2)) + a*b**S(2)*c**S(2)*d*(S(3)*a*e**S(2)*(-S(9)*n + S(1)) - S(5)*c*d**S(2)*(-S(3)*n + S(1))) + b**S(4)*c*d*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))) + c*x**n*(S(4)*a**S(2)*c**S(2)*e*(-S(3)*n + S(1))*(-a*e**S(2) + S(3)*c*d**S(2)) - S(2)*a*b**S(4)*e**S(3)*n - a*b**S(2)*c*e*(-a*e**S(2)*(S(2)*n + S(1)) + S(3)*c*d**S(2)) - S(2)*a*b*c**S(2)*d*(S(3)*a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) + b**S(3)*c*d*(S(6)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))))/(S(2)*a**S(2)*c**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)/(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, -e**S(2)*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) + b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - e**S(2)*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) - b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + x*(-S(2)*a*b*d*e - S(2)*a*(-a*e**S(2) + c*d**S(2)) + b**S(2)*d**S(2) + x**n*(a*b*e**S(2) - S(4)*a*c*d*e + b*c*d**S(2)))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)) + e**S(2)*x*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*c*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) - x*((-n + S(1))*(-S(8)*a**S(2)*c**S(2)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c*d*e + S(2)*a*b*c*(a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) - b**S(3)*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))) - (-S(8)*a**S(2)*b*c**S(2)*d*e*(-S(3)*n**S(2) - n + S(1)) - S(8)*a**S(2)*c**S(2)*(-a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*a*b**S(3)*c*d*e*(-n + S(1)) + S(2)*a*b**S(2)*c*(-a*e**S(2)*(S(15)*n**S(2) - S(10)*n + S(1)) + S(3)*c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(4)*(-n + S(1))*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - x*((-n + S(1))*(-S(8)*a**S(2)*c**S(2)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c*d*e + S(2)*a*b*c*(a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) - b**S(3)*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))) + (-S(8)*a**S(2)*b*c**S(2)*d*e*(-S(3)*n**S(2) - n + S(1)) - S(8)*a**S(2)*c**S(2)*(-a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) + S(2)*a*b**S(3)*c*d*e*(-n + S(1)) + S(2)*a*b**S(2)*c*(-a*e**S(2)*(S(15)*n**S(2) - S(10)*n + S(1)) + S(3)*c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(4)*(-n + S(1))*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + x*(-S(4)*a**S(2)*b*c**S(2)*d*e*(-S(3)*n + S(2)) - S(4)*a**S(2)*c**S(2)*(-S(4)*n + S(1))*(-a*e**S(2) + c*d**S(2)) + S(2)*a*b**S(3)*c*d*e - a*b**S(2)*c*(a*e**S(2)*(-S(9)*n + S(1)) - S(5)*c*d**S(2)*(-S(3)*n + S(1))) - b**S(4)*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1))) + c*x**n*(-S(8)*a**S(2)*c**S(2)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c*d*e + S(2)*a*b*c*(a*e**S(2)*n + c*d**S(2)*(-S(7)*n + S(2))) - b**S(3)*(S(2)*a*e**S(2)*n + c*d**S(2)*(-S(2)*n + S(1)))))/(S(2)*a**S(2)*c*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, x*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**n*(-S(2)*a*e + b*d))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)) - c*x*(-S(4)*a**S(2)*c*(-S(2)*c*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))*(S(3)*n**S(2) - S(4)*n + S(1))) + a*b**S(2)*(-n + S(1))*(-S(6)*c*d*(-S(3)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))) + S(2)*a*b*c*(S(2)*a*e*(-S(3)*n**S(2) - n + S(1)) + d*sqrt(-S(4)*a*c + b**S(2))*(S(7)*n**S(2) - S(9)*n + S(2))) + b**S(4)*d*(S(2)*n**S(2) - S(3)*n + S(1)) - b**S(3)*(-n + S(1))*(a*e + d*(-S(2)*n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + c*x*(-S(4)*a**S(2)*c*(S(2)*c*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))*(S(3)*n**S(2) - S(4)*n + S(1))) + a*b**S(2)*(-n + S(1))*(S(6)*c*d*(-S(3)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))) - S(2)*a*b*c*(S(2)*a*e*(-S(3)*n**S(2) - n + S(1)) - d*sqrt(-S(4)*a*c + b**S(2))*(S(7)*n**S(2) - S(9)*n + S(2))) - b**S(4)*d*(S(2)*n**S(2) - S(3)*n + S(1)) + b**S(3)*(-n + S(1))*(a*e - d*(-S(2)*n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + x*(-S(2)*a**S(2)*b*c*e*(-S(3)*n + S(2)) - S(4)*a**S(2)*c**S(2)*d*(-S(4)*n + S(1)) + a*b**S(3)*e + S(5)*a*b**S(2)*c*d*(-S(3)*n + S(1)) - b**S(4)*d*(-S(2)*n + S(1)) + c*x**n*(-S(4)*a**S(2)*c*e*(-S(3)*n + S(1)) + a*b**S(2)*e + S(2)*a*b*c*d*(-S(7)*n + S(2)) - b**S(3)*d*(-S(2)*n + S(1))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) #Apart# assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**S(3)), x), x, -c*e**S(4)*x*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) - c*e**S(4)*x*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + e**S(6)*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + c*e**S(2)*x*(-S(2)*a*c*(S(2)*c*d*(-S(2)*n + S(1)) + e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(3)*e*(-n + S(1)) + b**S(2)*(-n + S(1))*(c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(S(2)*a*e*(-S(3)*n + S(2)) - d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*e**S(2)*x*(-S(2)*a*c*(S(2)*c*d*(-S(2)*n + S(1)) - e*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))) - b**S(3)*e*(-n + S(1)) + b**S(2)*(-n + S(1))*(c*d - e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(S(2)*a*e*(-S(3)*n + S(2)) + d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + e**S(2)*x*(S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d + c*x**n*(S(2)*a*c*e - b**S(2)*e + b*c*d))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + x*(S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d + c*x**n*(S(2)*a*c*e - b**S(2)*e + b*c*d))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) - c*x*(-S(4)*a**S(2)*c**S(2)*(-S(2)*c*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))*(S(3)*n**S(2) - S(4)*n + S(1))) + a*b**S(2)*c*(-n + S(1))*(-S(6)*c*d*(-S(3)*n + S(1)) + e*(-S(14)*n + S(5))*sqrt(-S(4)*a*c + b**S(2))) - S(2)*a*b*c**S(2)*(S(2)*a*e*(S(13)*n**S(2) - S(13)*n + S(3)) + d*sqrt(-S(4)*a*c + b**S(2))*(S(7)*n**S(2) - S(9)*n + S(2))) - b**S(5)*e*(S(2)*n**S(2) - S(3)*n + S(1)) + b**S(4)*(c*d - e*sqrt(-S(4)*a*c + b**S(2)))*(S(2)*n**S(2) - S(3)*n + S(1)) + b**S(3)*c*(-n + S(1))*(a*e*(-S(18)*n + S(7)) + d*(-S(2)*n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + c*x*(-S(4)*a**S(2)*c**S(2)*(S(2)*c*d*(S(8)*n**S(2) - S(6)*n + S(1)) + e*sqrt(-S(4)*a*c + b**S(2))*(S(3)*n**S(2) - S(4)*n + S(1))) + a*b**S(2)*c*(-n + S(1))*(S(6)*c*d*(-S(3)*n + S(1)) + e*(-S(14)*n + S(5))*sqrt(-S(4)*a*c + b**S(2))) - S(2)*a*b*c**S(2)*(-S(2)*a*e*(S(13)*n**S(2) - S(13)*n + S(3)) + d*sqrt(-S(4)*a*c + b**S(2))*(S(7)*n**S(2) - S(9)*n + S(2))) + b**S(5)*e*(S(2)*n**S(2) - S(3)*n + S(1)) - b**S(4)*(c*d + e*sqrt(-S(4)*a*c + b**S(2)))*(S(2)*n**S(2) - S(3)*n + S(1)) - b**S(3)*c*(-n + S(1))*(a*e*(-S(18)*n + S(7)) - d*(-S(2)*n + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(c*d**S(2) - e*(-a*e + b*d))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + x*(S(2)*a**S(2)*b*c**S(2)*e*(-S(11)*n + S(4)) - S(4)*a**S(2)*c**S(3)*d*(-S(4)*n + S(1)) - S(3)*a*b**S(3)*c*e*(-S(5)*n + S(2)) + S(5)*a*b**S(2)*c**S(2)*d*(-S(3)*n + S(1)) + b**S(5)*(-S(2)*e*n + e) - b**S(4)*c*d*(-S(2)*n + S(1)) - c*x**n*(-S(4)*a**S(2)*c**S(2)*e*(-S(3)*n + S(1)) + a*b**S(2)*c*e*(-S(14)*n + S(5)) - S(2)*a*b*c**S(2)*d*(-S(7)*n + S(2)) - b**S(4)*e*(-S(2)*n + S(1)) + b**S(3)*c*d*(-S(2)*n + S(1))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) #Apart# assert rubi_test(rubi_integrate(S(1)/((d + e*x**n)**S(2)*(a + b*x**n + c*x**(S(2)*n))**S(3)), x), x, -c*e**S(4)*x*(S(3)*b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(10)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + S(5)*b*d - S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(4)) - c*e**S(4)*x*(S(3)*b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(10)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + S(5)*b*d + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/((-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(4)) + S(3)*e**S(6)*x*(-b*e + S(2)*c*d)*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d*(a*e**S(2) - b*d*e + c*d**S(2))**S(4)) + e**S(6)*x*hyper((S(2), S(1)/n), (S(1) + S(1)/n,), -e*x**n/d)/(d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + c*e**S(2)*x*(S(4)*a*c**S(2)*(-S(3)*c*d**S(2)*(-S(2)*n + S(1)) + e*(a*e*(-S(2)*n + S(1)) - S(2)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + S(2)*b**S(4)*e**S(2)*(-n + S(1)) - b**S(3)*e*(-n + S(1))*(S(5)*c*d + S(2)*e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*c*(-S(3)*c*d**S(2)*(-n + S(1)) + e*(a*e*(-S(13)*n + S(9)) - S(5)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b*c*(S(5)*a*e**S(2)*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)) + c*d*(S(4)*a*e*(-S(8)*n + S(5)) - S(3)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) + c*e**S(2)*x*(S(4)*a*c**S(2)*(-S(3)*c*d**S(2)*(-S(2)*n + S(1)) + e*(a*e*(-S(2)*n + S(1)) + S(2)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + S(2)*b**S(4)*e**S(2)*(-n + S(1)) - b**S(3)*e*(-n + S(1))*(S(5)*c*d - S(2)*e*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*c*(-S(3)*c*d**S(2)*(-n + S(1)) + e*(a*e*(-S(13)*n + S(9)) + S(5)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))) + b*c*(-S(5)*a*e**S(2)*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)) + c*d*(S(4)*a*e*(-S(8)*n + S(5)) + S(3)*d*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) - e**S(2)*x*(-S(14)*a*b*c**S(2)*d*e + S(2)*a*c**S(2)*(-a*e**S(2) + S(3)*c*d**S(2)) - S(2)*b**S(4)*e**S(2) + S(5)*b**S(3)*c*d*e - b**S(2)*c*(-S(7)*a*e**S(2) + S(3)*c*d**S(2)) + c*x**n*(-S(8)*a*c**S(2)*d*e - S(2)*b**S(3)*e**S(2) + S(5)*b**S(2)*c*d*e - b*c*(-S(5)*a*e**S(2) + S(3)*c*d**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))**S(3)) - x*(-S(6)*a*b*c**S(2)*d*e + S(2)*a*c**S(2)*(-a*e**S(2) + c*d**S(2)) - b**S(4)*e**S(2) + S(2)*b**S(3)*c*d*e - b**S(2)*c*(-S(4)*a*e**S(2) + c*d**S(2)) + c*x**n*(-S(4)*a*c**S(2)*d*e - b**S(3)*e**S(2) + S(2)*b**S(2)*c*d*e - b*c*(-S(3)*a*e**S(2) + c*d**S(2))))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*x*((-n + S(1))*(-S(8)*a**S(2)*c**S(3)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c**S(2)*d*e*(-S(14)*n + S(5)) + S(2)*a*b*c**S(2)*(a*e**S(2)*(-S(13)*n + S(4)) - c*d**S(2)*(-S(7)*n + S(2))) + b**S(5)*e**S(2)*(-S(2)*n + S(1)) - S(2)*b**S(4)*c*d*e*(-S(2)*n + S(1)) - b**S(3)*c*(S(2)*a*e**S(2)*(-S(8)*n + S(3)) - c*d**S(2)*(-S(2)*n + S(1)))) + (S(8)*a**S(2)*b*c**S(3)*d*e*(S(13)*n**S(2) - S(13)*n + S(3)) - S(8)*a**S(2)*c**S(3)*(-a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) - S(2)*a*b**S(3)*c**S(2)*d*e*(S(18)*n**S(2) - S(25)*n + S(7)) + S(2)*a*b**S(2)*c**S(2)*(-a*e**S(2)*(S(35)*n**S(2) - S(38)*n + S(9)) + S(3)*c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(6)*e**S(2)*(S(2)*n**S(2) - S(3)*n + S(1)) + S(2)*b**S(5)*c*d*e*(S(2)*n**S(2) - S(3)*n + S(1)) + b**S(4)*c*(-n + S(1))*(S(4)*a*e**S(2)*(-S(5)*n + S(2)) - c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) + c*x*((-n + S(1))*(-S(8)*a**S(2)*c**S(3)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c**S(2)*d*e*(-S(14)*n + S(5)) + S(2)*a*b*c**S(2)*(a*e**S(2)*(-S(13)*n + S(4)) - c*d**S(2)*(-S(7)*n + S(2))) + b**S(5)*e**S(2)*(-S(2)*n + S(1)) - S(2)*b**S(4)*c*d*e*(-S(2)*n + S(1)) - b**S(3)*c*(S(2)*a*e**S(2)*(-S(8)*n + S(3)) - c*d**S(2)*(-S(2)*n + S(1)))) - (S(8)*a**S(2)*b*c**S(3)*d*e*(S(13)*n**S(2) - S(13)*n + S(3)) - S(8)*a**S(2)*c**S(3)*(-a*e**S(2) + c*d**S(2))*(S(8)*n**S(2) - S(6)*n + S(1)) - S(2)*a*b**S(3)*c**S(2)*d*e*(S(18)*n**S(2) - S(25)*n + S(7)) + S(2)*a*b**S(2)*c**S(2)*(-a*e**S(2)*(S(35)*n**S(2) - S(38)*n + S(9)) + S(3)*c*d**S(2)*(S(3)*n**S(2) - S(4)*n + S(1))) - b**S(6)*e**S(2)*(S(2)*n**S(2) - S(3)*n + S(1)) + S(2)*b**S(5)*c*d*e*(S(2)*n**S(2) - S(3)*n + S(1)) + b**S(4)*c*(-n + S(1))*(S(4)*a*e**S(2)*(-S(5)*n + S(2)) - c*d**S(2)*(-S(2)*n + S(1))))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)) - x*(-S(4)*a**S(2)*b*c**S(3)*d*e*(-S(11)*n + S(4)) + S(4)*a**S(2)*c**S(3)*(-S(4)*n + S(1))*(-a*e**S(2) + c*d**S(2)) + S(6)*a*b**S(3)*c**S(2)*d*e*(-S(5)*n + S(2)) + a*b**S(2)*c**S(2)*(a*e**S(2)*(-S(37)*n + S(13)) - S(5)*c*d**S(2)*(-S(3)*n + S(1))) + b**S(6)*e**S(2)*(-S(2)*n + S(1)) - S(2)*b**S(5)*c*d*e*(-S(2)*n + S(1)) - b**S(4)*c*(a*e**S(2)*(-S(17)*n + S(7)) - c*d**S(2)*(-S(2)*n + S(1))) + c*x**n*(-S(8)*a**S(2)*c**S(3)*d*e*(-S(3)*n + S(1)) + S(2)*a*b**S(2)*c**S(2)*d*e*(-S(14)*n + S(5)) + S(2)*a*b*c**S(2)*(a*e**S(2)*(-S(13)*n + S(4)) - c*d**S(2)*(-S(7)*n + S(2))) + b**S(5)*e**S(2)*(-S(2)*n + S(1)) - S(2)*b**S(4)*c*d*e*(-S(2)*n + S(1)) - b**S(3)*c*(S(2)*a*e**S(2)*(-S(8)*n + S(3)) - c*d**S(2)*(-S(2)*n + S(1)))))/(S(2)*a**S(2)*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))*(a*e**S(2) - b*d*e + c*d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p/(d + e*x**n), x), x, x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(1)/(S(2)*n), -p, S(1), S(1) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/d - e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((n + S(1))/(S(2)*n), -p, S(1), S(3)/2 + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(2)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p/(d + e*x**n)**S(2), x), x, x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(1)/(S(2)*n), -p, S(2), S(1) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/d**S(2) - S(2)*e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((n + S(1))/(S(2)*n), -p, S(2), S(3)/2 + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(3)*(n + S(1))) + e**S(2)*x**(S(2)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(1) + S(1)/(S(2)*n), -p, S(2), S(2) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(4)*(S(2)*n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**(S(2)*n))**p/(d + e*x**n)**S(3), x), x, x*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(1)/(S(2)*n), -p, S(3), S(1) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/d**S(3) - S(3)*e*x**(n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((n + S(1))/(S(2)*n), -p, S(3), S(3)/2 + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(4)*(n + S(1))) + S(3)*e**S(2)*x**(S(2)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(1) + S(1)/(S(2)*n), -p, S(3), S(2) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(5)*(S(2)*n + S(1))) - e**S(3)*x**(S(3)*n + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1(S(3)/2 + S(1)/(S(2)*n), -p, S(3), S(5)/2 + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(6)*(S(3)*n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + c*x**(S(2)*n))*(d + e*x**n)), x), x, x*sqrt(S(1) + c*x**(S(2)*n)/a)*AppellF1(S(1)/(S(2)*n), S(1)/2, S(1), S(1) + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d*sqrt(a + c*x**(S(2)*n))) - e*x**(n + S(1))*sqrt(S(1) + c*x**(S(2)*n)/a)*AppellF1((n + S(1))/(S(2)*n), S(1)/2, S(1), S(3)/2 + S(1)/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(2)*sqrt(a + c*x**(S(2)*n))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, d*x*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1)/n, S(-1)/2, S(-1)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + e*x**(n + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1) + S(1)/n, S(-1)/2, S(-1)/2, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((n + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, a*d*x*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1)/n, S(-3)/2, S(-3)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + a*e*x**(n + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))*AppellF1(S(1) + S(1)/n, S(-3)/2, S(-3)/2, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((n + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/sqrt(a + b*x**n + c*x**(S(2)*n)), x), x, d*x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/n, S(1)/2, S(1)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/sqrt(a + b*x**n + c*x**(S(2)*n)) + e*x**(n + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1) + S(1)/n, S(1)/2, S(1)/2, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/((n + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, d*x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/n, S(3)/2, S(3)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*sqrt(a + b*x**n + c*x**(S(2)*n))) + e*x**(n + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1) + S(1)/n, S(3)/2, S(3)/2, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*(n + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**(S(5)/2), x), x, d*x*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/n, S(5)/2, S(5)/2, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a**S(2)*sqrt(a + b*x**n + c*x**(S(2)*n))) + e*x**(n + S(1))*sqrt(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1) + S(1)/n, S(5)/2, S(5)/2, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a**S(2)*(n + S(1))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(3)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, d**S(3)*x*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1)/n, -p, -p, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2)))) + S(3)*d**S(2)*e*x**(n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1) + S(1)/n, -p, -p, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(n + S(1)) + S(3)*d*e**S(2)*x**(S(2)*n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(2) + S(1)/n, -p, -p, S(3) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*n + S(1)) + e**S(3)*x**(S(3)*n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(3) + S(1)/n, -p, -p, S(4) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**S(2)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, d**S(2)*x*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1)/n, -p, -p, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2)))) + S(2)*d*e*x**(n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1) + S(1)/n, -p, -p, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(n + S(1)) + e**S(2)*x**(S(2)*n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(2) + S(1)/n, -p, -p, S(3) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, d*x*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1)/n, -p, -p, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2)))) + e*x**(n + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1(S(1) + S(1)/n, -p, -p, S(2) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(n + S(1)), expand=True, _diff=True, _numerical=True) def test_3(): assert rubi_test(rubi_integrate(x**S(3)*(a + c*x**S(4))**S(5)*(d + e*x**S(2)), x), x, a**S(5)*d*x**S(4)/S(4) + a**S(5)*e*x**S(6)/S(6) + S(5)*a**S(4)*c*d*x**S(8)/S(8) + a**S(4)*c*e*x**S(10)/S(2) + S(5)*a**S(3)*c**S(2)*d*x**S(12)/S(6) + S(5)*a**S(3)*c**S(2)*e*x**S(14)/S(7) + S(5)*a**S(2)*c**S(3)*d*x**S(16)/S(8) + S(5)*a**S(2)*c**S(3)*e*x**S(18)/S(9) + a*c**S(4)*d*x**S(20)/S(4) + S(5)*a*c**S(4)*e*x**S(22)/S(22) + c**S(5)*d*x**S(24)/S(24) + c**S(5)*e*x**S(26)/S(26), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + c*x**S(4))**S(5)*(d + e*x**S(2)), x), x, a**S(5)*d*x**S(3)/S(3) + a**S(5)*e*x**S(5)/S(5) + S(5)*a**S(4)*c*d*x**S(7)/S(7) + S(5)*a**S(4)*c*e*x**S(9)/S(9) + S(10)*a**S(3)*c**S(2)*d*x**S(11)/S(11) + S(10)*a**S(3)*c**S(2)*e*x**S(13)/S(13) + S(2)*a**S(2)*c**S(3)*d*x**S(15)/S(3) + S(10)*a**S(2)*c**S(3)*e*x**S(17)/S(17) + S(5)*a*c**S(4)*d*x**S(19)/S(19) + S(5)*a*c**S(4)*e*x**S(21)/S(21) + c**S(5)*d*x**S(23)/S(23) + c**S(5)*e*x**S(25)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + c*x**S(4))**S(5)*(d + e*x**S(2)), x), x, a**S(5)*d*x**S(2)/S(2) + S(5)*a**S(4)*c*d*x**S(6)/S(6) + a**S(3)*c**S(2)*d*x**S(10) + S(5)*a**S(2)*c**S(3)*d*x**S(14)/S(7) + S(5)*a*c**S(4)*d*x**S(18)/S(18) + c**S(5)*d*x**S(22)/S(22) + e*(a + c*x**S(4))**S(6)/(S(24)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(4))**S(5)*(d + e*x**S(2)), x), x, a**S(5)*d*x + a**S(5)*e*x**S(3)/S(3) + a**S(4)*c*d*x**S(5) + S(5)*a**S(4)*c*e*x**S(7)/S(7) + S(10)*a**S(3)*c**S(2)*d*x**S(9)/S(9) + S(10)*a**S(3)*c**S(2)*e*x**S(11)/S(11) + S(10)*a**S(2)*c**S(3)*d*x**S(13)/S(13) + S(2)*a**S(2)*c**S(3)*e*x**S(15)/S(3) + S(5)*a*c**S(4)*d*x**S(17)/S(17) + S(5)*a*c**S(4)*e*x**S(19)/S(19) + c**S(5)*d*x**S(21)/S(21) + c**S(5)*e*x**S(23)/S(23), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(4))**S(5)*(d + e*x**S(2))/x, x), x, a**S(5)*d*log(x) + a**S(5)*e*x**S(2)/S(2) + S(5)*a**S(4)*c*d*x**S(4)/S(4) + S(5)*a**S(4)*c*e*x**S(6)/S(6) + S(5)*a**S(3)*c**S(2)*d*x**S(8)/S(4) + a**S(3)*c**S(2)*e*x**S(10) + S(5)*a**S(2)*c**S(3)*d*x**S(12)/S(6) + S(5)*a**S(2)*c**S(3)*e*x**S(14)/S(7) + S(5)*a*c**S(4)*d*x**S(16)/S(16) + S(5)*a*c**S(4)*e*x**S(18)/S(18) + c**S(5)*d*x**S(20)/S(20) + c**S(5)*e*x**S(22)/S(22), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(4))**S(5)*(d + e*x**S(2))/x**S(2), x), x, -a**S(5)*d/x + a**S(5)*e*x + S(5)*a**S(4)*c*d*x**S(3)/S(3) + a**S(4)*c*e*x**S(5) + S(10)*a**S(3)*c**S(2)*d*x**S(7)/S(7) + S(10)*a**S(3)*c**S(2)*e*x**S(9)/S(9) + S(10)*a**S(2)*c**S(3)*d*x**S(11)/S(11) + S(10)*a**S(2)*c**S(3)*e*x**S(13)/S(13) + a*c**S(4)*d*x**S(15)/S(3) + S(5)*a*c**S(4)*e*x**S(17)/S(17) + c**S(5)*d*x**S(19)/S(19) + c**S(5)*e*x**S(21)/S(21), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(4))**S(5)*(d + e*x**S(2))/x**S(3), x), x, -a**S(5)*d/(S(2)*x**S(2)) + a**S(5)*e*log(x) + S(5)*a**S(4)*c*d*x**S(2)/S(2) + S(5)*a**S(4)*c*e*x**S(4)/S(4) + S(5)*a**S(3)*c**S(2)*d*x**S(6)/S(3) + S(5)*a**S(3)*c**S(2)*e*x**S(8)/S(4) + a**S(2)*c**S(3)*d*x**S(10) + S(5)*a**S(2)*c**S(3)*e*x**S(12)/S(6) + S(5)*a*c**S(4)*d*x**S(14)/S(14) + S(5)*a*c**S(4)*e*x**S(16)/S(16) + c**S(5)*d*x**S(18)/S(18) + c**S(5)*e*x**S(20)/S(20), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, d*(f*x)**(m + S(1))/(f*(m + S(1))) + e*(f*x)**(m + S(23))/(f**S(23)*(m + S(23))) + (f*x)**(m + S(3))*(S(10)*d + e)/(f**S(3)*(m + S(3))) + (f*x)**(m + S(5))*(S(45)*d + S(10)*e)/(f**S(5)*(m + S(5))) + (f*x)**(m + S(7))*(S(120)*d + S(45)*e)/(f**S(7)*(m + S(7))) + (f*x)**(m + S(9))*(S(210)*d + S(120)*e)/(f**S(9)*(m + S(9))) + (f*x)**(m + S(11))*(S(252)*d + S(210)*e)/(f**S(11)*(m + S(11))) + (f*x)**(m + S(13))*(S(210)*d + S(252)*e)/(f**S(13)*(m + S(13))) + (f*x)**(m + S(15))*(S(120)*d + S(210)*e)/(f**S(15)*(m + S(15))) + (f*x)**(m + S(17))*(S(45)*d + S(120)*e)/(f**S(17)*(m + S(17))) + (f*x)**(m + S(19))*(S(10)*d + S(45)*e)/(f**S(19)*(m + S(19))) + (f*x)**(m + S(21))*(d + S(10)*e)/(f**S(21)*(m + S(21))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, e*(x**S(2) + S(1))**S(14)/S(28) + (d/S(26) - S(3)*e/S(26))*(x**S(2) + S(1))**S(13) + (d/S(22) - e/S(22))*(x**S(2) + S(1))**S(11) - (d/S(12) - e/S(8))*(x**S(2) + S(1))**S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, d*x**S(5)/S(5) + e*x**S(27)/S(27) + x**S(25)*(d/S(25) + S(2)*e/S(5)) + x**S(23)*(S(10)*d/S(23) + S(45)*e/S(23)) + x**S(21)*(S(15)*d/S(7) + S(40)*e/S(7)) + x**S(19)*(S(120)*d/S(19) + S(210)*e/S(19)) + x**S(17)*(S(210)*d/S(17) + S(252)*e/S(17)) + x**S(15)*(S(84)*d/S(5) + S(14)*e) + x**S(13)*(S(210)*d/S(13) + S(120)*e/S(13)) + x**S(11)*(S(120)*d/S(11) + S(45)*e/S(11)) + x**S(9)*(S(5)*d + S(10)*e/S(9)) + x**S(7)*(S(10)*d/S(7) + e/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, e*(x**S(2) + S(1))**S(13)/S(26) + (-d/S(22) + e/S(22))*(x**S(2) + S(1))**S(11) + (d/S(24) - e/S(12))*(x**S(2) + S(1))**S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, d*x**S(3)/S(3) + e*x**S(25)/S(25) + x**S(23)*(d/S(23) + S(10)*e/S(23)) + x**S(21)*(S(10)*d/S(21) + S(15)*e/S(7)) + x**S(19)*(S(45)*d/S(19) + S(120)*e/S(19)) + x**S(17)*(S(120)*d/S(17) + S(210)*e/S(17)) + x**S(15)*(S(14)*d + S(84)*e/S(5)) + x**S(13)*(S(252)*d/S(13) + S(210)*e/S(13)) + x**S(11)*(S(210)*d/S(11) + S(120)*e/S(11)) + x**S(9)*(S(40)*d/S(3) + S(5)*e) + x**S(7)*(S(45)*d/S(7) + S(10)*e/S(7)) + x**S(5)*(S(2)*d + e/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, e*(x**S(2) + S(1))**S(12)/S(24) + (d/S(22) - e/S(22))*(x**S(2) + S(1))**S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, d*x + e*x**S(23)/S(23) + x**S(21)*(d/S(21) + S(10)*e/S(21)) + x**S(19)*(S(10)*d/S(19) + S(45)*e/S(19)) + x**S(17)*(S(45)*d/S(17) + S(120)*e/S(17)) + x**S(15)*(S(8)*d + S(14)*e) + x**S(13)*(S(210)*d/S(13) + S(252)*e/S(13)) + x**S(11)*(S(252)*d/S(11) + S(210)*e/S(11)) + x**S(9)*(S(70)*d/S(3) + S(40)*e/S(3)) + x**S(7)*(S(120)*d/S(7) + S(45)*e/S(7)) + x**S(5)*(S(9)*d + S(2)*e) + x**S(3)*(S(10)*d/S(3) + e/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x, x), x, d*x**S(20)/S(20) + S(5)*d*x**S(18)/S(9) + S(45)*d*x**S(16)/S(16) + S(60)*d*x**S(14)/S(7) + S(35)*d*x**S(12)/S(2) + S(126)*d*x**S(10)/S(5) + S(105)*d*x**S(8)/S(4) + S(20)*d*x**S(6) + S(45)*d*x**S(4)/S(4) + S(5)*d*x**S(2) + d*log(x) + e*(x**S(2) + S(1))**S(11)/S(22), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x**S(2), x), x, -d/x + e*x**S(21)/S(21) + x**S(19)*(d/S(19) + S(10)*e/S(19)) + x**S(17)*(S(10)*d/S(17) + S(45)*e/S(17)) + x**S(15)*(S(3)*d + S(8)*e) + x**S(13)*(S(120)*d/S(13) + S(210)*e/S(13)) + x**S(11)*(S(210)*d/S(11) + S(252)*e/S(11)) + x**S(9)*(S(28)*d + S(70)*e/S(3)) + x**S(7)*(S(30)*d + S(120)*e/S(7)) + x**S(5)*(S(24)*d + S(9)*e) + x**S(3)*(S(15)*d + S(10)*e/S(3)) + x*(S(10)*d + e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x**S(3), x), x, -d/(S(2)*x**S(2)) + e*x**S(20)/S(20) + x**S(18)*(d/S(18) + S(5)*e/S(9)) + x**S(16)*(S(5)*d/S(8) + S(45)*e/S(16)) + x**S(14)*(S(45)*d/S(14) + S(60)*e/S(7)) + x**S(12)*(S(10)*d + S(35)*e/S(2)) + x**S(10)*(S(21)*d + S(126)*e/S(5)) + x**S(8)*(S(63)*d/S(2) + S(105)*e/S(4)) + x**S(6)*(S(35)*d + S(20)*e) + x**S(4)*(S(30)*d + S(45)*e/S(4)) + x**S(2)*(S(45)*d/S(2) + S(5)*e) + (S(10)*d + e)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, (f*x)**(m + S(1))/(f*(m + S(1))) + S(11)*(f*x)**(m + S(3))/(f**S(3)*(m + S(3))) + S(55)*(f*x)**(m + S(5))/(f**S(5)*(m + S(5))) + S(165)*(f*x)**(m + S(7))/(f**S(7)*(m + S(7))) + S(330)*(f*x)**(m + S(9))/(f**S(9)*(m + S(9))) + S(462)*(f*x)**(m + S(11))/(f**S(11)*(m + S(11))) + S(462)*(f*x)**(m + S(13))/(f**S(13)*(m + S(13))) + S(330)*(f*x)**(m + S(15))/(f**S(15)*(m + S(15))) + S(165)*(f*x)**(m + S(17))/(f**S(17)*(m + S(17))) + S(55)*(f*x)**(m + S(19))/(f**S(19)*(m + S(19))) + S(11)*(f*x)**(m + S(21))/(f**S(21)*(m + S(21))) + (f*x)**(m + S(23))/(f**S(23)*(m + S(23))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, (x**S(2) + S(1))**S(14)/S(28) - (x**S(2) + S(1))**S(13)/S(13) + (x**S(2) + S(1))**S(12)/S(24), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, x**S(27)/S(27) + S(11)*x**S(25)/S(25) + S(55)*x**S(23)/S(23) + S(55)*x**S(21)/S(7) + S(330)*x**S(19)/S(19) + S(462)*x**S(17)/S(17) + S(154)*x**S(15)/S(5) + S(330)*x**S(13)/S(13) + S(15)*x**S(11) + S(55)*x**S(9)/S(9) + S(11)*x**S(7)/S(7) + x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, (x**S(2) + S(1))**S(13)/S(26) - (x**S(2) + S(1))**S(12)/S(24), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, x**S(25)/S(25) + S(11)*x**S(23)/S(23) + S(55)*x**S(21)/S(21) + S(165)*x**S(19)/S(19) + S(330)*x**S(17)/S(17) + S(154)*x**S(15)/S(5) + S(462)*x**S(13)/S(13) + S(30)*x**S(11) + S(55)*x**S(9)/S(3) + S(55)*x**S(7)/S(7) + S(11)*x**S(5)/S(5) + x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, (x**S(2) + S(1))**S(12)/S(24), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5), x), x, x**S(23)/S(23) + S(11)*x**S(21)/S(21) + S(55)*x**S(19)/S(19) + S(165)*x**S(17)/S(17) + S(22)*x**S(15) + S(462)*x**S(13)/S(13) + S(42)*x**S(11) + S(110)*x**S(9)/S(3) + S(165)*x**S(7)/S(7) + S(11)*x**S(5) + S(11)*x**S(3)/S(3) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x, x), x, x**S(22)/S(22) + S(11)*x**S(20)/S(20) + S(55)*x**S(18)/S(18) + S(165)*x**S(16)/S(16) + S(165)*x**S(14)/S(7) + S(77)*x**S(12)/S(2) + S(231)*x**S(10)/S(5) + S(165)*x**S(8)/S(4) + S(55)*x**S(6)/S(2) + S(55)*x**S(4)/S(4) + S(11)*x**S(2)/S(2) + log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x**S(2), x), x, x**S(21)/S(21) + S(11)*x**S(19)/S(19) + S(55)*x**S(17)/S(17) + S(11)*x**S(15) + S(330)*x**S(13)/S(13) + S(42)*x**S(11) + S(154)*x**S(9)/S(3) + S(330)*x**S(7)/S(7) + S(33)*x**S(5) + S(55)*x**S(3)/S(3) + S(11)*x - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))*(x**S(4) + S(2)*x**S(2) + S(1))**S(5)/x**S(3), x), x, x**S(20)/S(20) + S(11)*x**S(18)/S(18) + S(55)*x**S(16)/S(16) + S(165)*x**S(14)/S(14) + S(55)*x**S(12)/S(2) + S(231)*x**S(10)/S(5) + S(231)*x**S(8)/S(4) + S(55)*x**S(6) + S(165)*x**S(4)/S(4) + S(55)*x**S(2)/S(2) + S(11)*log(x) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, e*(f*x)**(m + S(1))*(a + b*x**S(2))/(b*f*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (f*x)**(m + S(1))*(a + b*x**S(2))*(-a*e + b*d)*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(a*b*f*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, -sqrt(a)*(a + b*x**S(2))*(-a*e + b*d)*atan(sqrt(b)*x/sqrt(a))/(b**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + e*x**S(3)*(a + b*x**S(2))/(S(3)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + x*(a + b*x**S(2))*(-a*e + b*d)/(b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, e*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*b**S(2)) + (a + b*x**S(2))*(-a*e + b*d)*log(a + b*x**S(2))/(S(2)*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, e*x*(a + b*x**S(2))/(b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*(-a*e + b*d)*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*b**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, d*(a + b*x**S(2))*log(x)/(a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*(-a*e + b*d)*log(a + b*x**S(2))/(S(2)*a*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -d*(a + b*x**S(2))/(a*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*(-a*e + b*d)*atan(sqrt(b)*x/sqrt(a))/(a**(S(3)/2)*sqrt(b)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), x), x, -d*(a + b*x**S(2))/(S(2)*a*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*(-a*e + b*d)*log(x)/(a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*(-a*e + b*d)*log(a + b*x**S(2))/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, (f*x)**(m + S(1))*(-a*e + b*d)/(S(4)*a*b*f*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (f*x)**(m + S(1))*(a + b*x**S(2))*(a*e*(m + S(1)) + b*d*(-m + S(3)))*hyper((S(2), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -b*x**S(2)/a)/(S(4)*a**S(3)*b*f*(m + S(1))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -x*(-a*e + b*d)/(S(4)*b**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + x*(-S(5)*a*e + b*d)/(S(8)*a*b**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*(S(3)*a*e + b*d)*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(3)/2)*b**(S(5)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, -(a + b*x**S(2))*(d + e*x**S(2))**S(2)/((-S(4)*a*e + S(4)*b*d)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2), x), x, x*(-a*e + b*d)/(S(4)*a*b*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + x*(a*e + S(3)*b*d)/(S(8)*a**S(2)*b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*(a*e + S(3)*b*d)*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(5)/2)*b**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, (-a*e + b*d)/(S(4)*a*b*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + d/(S(2)*a**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + d*(a + b*x**S(2))*log(x)/(a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - d*(a + b*x**S(2))*log(a + b*x**S(2))/(S(2)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x**S(2)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, -x*(-a*e + b*d)/(S(4)*a**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - d*(a + b*x**S(2))/(a**S(3)*x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - x*(-S(3)*a*e + S(7)*b*d)/(S(8)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*(-S(3)*a*e + S(15)*b*d)*atan(sqrt(b)*x/sqrt(a))/(S(8)*a**(S(7)/2)*sqrt(b)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(x**S(3)*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(S(3)/2)), x), x, -(-a*e + b*d)/(S(4)*a**S(2)*(a + b*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - d*(a + b*x**S(2))/(S(2)*a**S(3)*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (-a*e + S(2)*b*d)/(S(2)*a**S(3)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) - (a + b*x**S(2))*(-a*e + S(3)*b*d)*log(x)/(a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))) + (a + b*x**S(2))*(-a*e + S(3)*b*d)*log(a + b*x**S(2))/(S(2)*a**S(4)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2))*(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**p, x), x, (a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))**(p + S(1))/(S(4)*b*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, b*x**S(3)*(c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(6)*d*(a + b*x**S(2))) + c**S(2)*(-S(2)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh(sqrt(d)*x/sqrt(c + d*x**S(2)))/(S(16)*d**(S(5)/2)*(a + b*x**S(2))) - c*x*sqrt(c + d*x**S(2))*(-S(2)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(16)*d**S(2)*(a + b*x**S(2))) - x**S(3)*sqrt(c + d*x**S(2))*(-S(2)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(8)*d*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, (c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(5)*d) - (c + d*x**S(2))**(S(3)/2)*(-S(2)*a*d + S(2)*b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(15)*d**S(2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4)), x), x, b*x*(c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(4)*d*(a + b*x**S(2))) - c*(-S(4)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh(sqrt(d)*x/sqrt(c + d*x**S(2)))/(S(8)*d**(S(3)/2)*(a + b*x**S(2))) - x*sqrt(c + d*x**S(2))*(-S(4)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(8)*d*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x, x), x, -a*sqrt(c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh(sqrt(c + d*x**S(2))/sqrt(c))/(a + b*x**S(2)) + a*sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(a + b*x**S(2)) + b*(c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(3)*d*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(2), x), x, -a*(c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(c*x*(a + b*x**S(2))) + (S(2)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh(sqrt(d)*x/sqrt(c + d*x**S(2)))/(S(2)*sqrt(d)*(a + b*x**S(2))) + x*sqrt(c + d*x**S(2))*(S(2)*a*d + b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*c*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c + d*x**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/x**S(3), x), x, -a*(c + d*x**S(2))**(S(3)/2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*c*x**S(2)*(a + b*x**S(2))) + sqrt(c + d*x**S(2))*(a*d + S(2)*b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))/(S(2)*c*(a + b*x**S(2))) - (a*d + S(2)*b*c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh(sqrt(c + d*x**S(2))/sqrt(c))/(S(2)*sqrt(c)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, A*a**S(3)*x**S(4)/S(4) + B*c**S(3)*x**S(18)/S(18) + a**S(2)*x**S(6)*(S(3)*A*b + B*a)/S(6) + S(3)*a*x**S(8)*(A*(a*c + b**S(2)) + B*a*b)/S(8) + c**S(2)*x**S(16)*(A*c + S(3)*B*b)/S(16) + S(3)*c*x**S(14)*(A*b*c + B*a*c + B*b**S(2))/S(14) + x**S(12)*(A*a*c**S(2)/S(4) + A*b**S(2)*c/S(4) + B*a*b*c/S(2) + B*b**S(3)/S(12)) + x**S(10)*(A*(S(6)*a*b*c + b**S(3))/S(10) + S(3)*B*a*(a*c + b**S(2))/S(10)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, A*a**S(3)*x**S(3)/S(3) + B*c**S(3)*x**S(17)/S(17) + a**S(2)*x**S(5)*(S(3)*A*b + B*a)/S(5) + S(3)*a*x**S(7)*(A*(a*c + b**S(2)) + B*a*b)/S(7) + c**S(2)*x**S(15)*(A*c + S(3)*B*b)/S(15) + S(3)*c*x**S(13)*(A*b*c + B*a*c + B*b**S(2))/S(13) + x**S(11)*(S(3)*A*a*c**S(2)/S(11) + S(3)*A*b**S(2)*c/S(11) + S(6)*B*a*b*c/S(11) + B*b**S(3)/S(11)) + x**S(9)*(A*(S(6)*a*b*c + b**S(3))/S(9) + B*a*(a*c + b**S(2))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, A*a**S(3)*x**S(2)/S(2) + B*c**S(3)*x**S(16)/S(16) + a**S(2)*x**S(4)*(S(3)*A*b + B*a)/S(4) + a*x**S(6)*(A*(a*c + b**S(2)) + B*a*b)/S(2) + c**S(2)*x**S(14)*(A*c + S(3)*B*b)/S(14) + c*x**S(12)*(A*b*c + B*a*c + B*b**S(2))/S(4) + x**S(10)*(S(3)*A*a*c**S(2)/S(10) + S(3)*A*b**S(2)*c/S(10) + S(3)*B*a*b*c/S(5) + B*b**S(3)/S(10)) + x**S(8)*(A*(S(6)*a*b*c + b**S(3))/S(8) + S(3)*B*a*(a*c + b**S(2))/S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, A*a**S(3)*x + B*c**S(3)*x**S(15)/S(15) + a**S(2)*x**S(3)*(S(3)*A*b + B*a)/S(3) + S(3)*a*x**S(5)*(A*(a*c + b**S(2)) + B*a*b)/S(5) + c**S(2)*x**S(13)*(A*c + S(3)*B*b)/S(13) + S(3)*c*x**S(11)*(A*b*c + B*a*c + B*b**S(2))/S(11) + x**S(9)*(A*a*c**S(2)/S(3) + A*b**S(2)*c/S(3) + S(2)*B*a*b*c/S(3) + B*b**S(3)/S(9)) + x**S(7)*(A*(S(6)*a*b*c + b**S(3))/S(7) + S(3)*B*a*(a*c + b**S(2))/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3)/x, x), x, A*a**S(3)*log(x) + B*c**S(3)*x**S(14)/S(14) + a**S(2)*x**S(2)*(S(3)*A*b + B*a)/S(2) + S(3)*a*x**S(4)*(A*(a*c + b**S(2)) + B*a*b)/S(4) + c**S(2)*x**S(12)*(A*c + S(3)*B*b)/S(12) + S(3)*c*x**S(10)*(A*b*c + B*a*c + B*b**S(2))/S(10) + x**S(8)*(S(3)*A*a*c**S(2)/S(8) + S(3)*A*b**S(2)*c/S(8) + S(3)*B*a*b*c/S(4) + B*b**S(3)/S(8)) + x**S(6)*(A*(S(6)*a*b*c + b**S(3))/S(6) + B*a*(a*c + b**S(2))/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3)/x**S(2), x), x, -A*a**S(3)/x + B*c**S(3)*x**S(13)/S(13) + a**S(2)*x*(S(3)*A*b + B*a) + a*x**S(3)*(A*(a*c + b**S(2)) + B*a*b) + c**S(2)*x**S(11)*(A*c + S(3)*B*b)/S(11) + c*x**S(9)*(A*b*c + B*a*c + B*b**S(2))/S(3) + x**S(7)*(S(3)*A*a*c**S(2)/S(7) + S(3)*A*b**S(2)*c/S(7) + S(6)*B*a*b*c/S(7) + B*b**S(3)/S(7)) + x**S(5)*(A*(S(6)*a*b*c + b**S(3))/S(5) + S(3)*B*a*(a*c + b**S(2))/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3)/x**S(3), x), x, -A*a**S(3)/(S(2)*x**S(2)) + B*c**S(3)*x**S(12)/S(12) + a**S(2)*(S(3)*A*b + B*a)*log(x) + S(3)*a*x**S(2)*(A*(a*c + b**S(2)) + B*a*b)/S(2) + c**S(2)*x**S(10)*(A*c + S(3)*B*b)/S(10) + S(3)*c*x**S(8)*(A*b*c + B*a*c + B*b**S(2))/S(8) + x**S(6)*(A*a*c**S(2)/S(2) + A*b**S(2)*c/S(2) + B*a*b*c + B*b**S(3)/S(6)) + x**S(4)*(A*(S(6)*a*b*c + b**S(3))/S(4) + S(3)*B*a*(a*c + b**S(2))/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*x**S(4)/(S(4)*c) - x**S(2)*(-A*c + B*b)/(S(2)*c**S(2)) + (-A*b*c - B*a*c + B*b**S(2))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) + (S(2)*A*a*c**S(2) - A*b**S(2)*c - S(3)*B*a*b*c + B*b**S(3))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*x**S(2)/(S(2)*c) - (-A*c + B*b)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) - (-A*b*c - S(2)*B*a*c + B*b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c) + (-S(2)*A*c + B*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))), x), x, A*log(x)/a - A*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a) + (A*b - S(2)*B*a)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, -A/(S(2)*a*x**S(2)) - (A*b - B*a)*log(x)/a**S(2) + (A*b - B*a)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - (-S(2)*A*a*c + A*b**S(2) - B*a*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*x**S(3)/(S(3)*c) - x*(-A*c + B*b)/c**S(2) + sqrt(S(2))*(-A*b*c - B*a*c + B*b**S(2) + (S(2)*A*a*c**S(2) - A*b**S(2)*c - S(3)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-A*b*c - B*a*c + B*b**S(2) - (S(2)*A*a*c**S(2) - A*b**S(2)*c - S(3)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*x/c - sqrt(S(2))*(-A*c + B*b + (-A*b*c - S(2)*B*a*c + B*b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(-A*c + B*b - (-A*b*c - S(2)*B*a*c + B*b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(S(2))*(B - (-S(2)*A*c + B*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(B + (-S(2)*A*c + B*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -A/(a*x) - sqrt(S(2))*sqrt(c)*(A - (A*b - S(2)*B*a)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(A + (A*b - S(2)*B*a)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(4)*(a + b*x**S(2) + c*x**S(4))), x), x, -A/(S(3)*a*x**S(3)) + sqrt(S(2))*sqrt(c)*(-A*(-S(2)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) + B*a*(b - sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(c)*(-A*(-S(2)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) + B*a*(b + sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + (A*b - B*a)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -x**S(4)*(a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(S(2)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + x**S(2)*(-A*b*c - S(6)*B*a*c + S(2)*B*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) - (-A*c + S(2)*B*b)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) - (S(6)*A*a*b*c**S(2) - A*b**S(3)*c + S(12)*B*a**S(2)*c**S(2) - S(12)*B*a*b**S(2)*c + S(2)*B*b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) - x**S(2)*(a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(S(2)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + (S(4)*A*a*c**S(2) - S(6)*B*a*b*c + B*b**S(3))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, (A + B*x**S(2))*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (A*b - S(2)*B*a)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -(-S(2)*A*c + B*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - (A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, A*log(x)/a**S(2) - A*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - (-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + (A*(-S(6)*a*b*c + b**S(3)) + S(4)*B*a**S(2)*c)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(2)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(6)*A*a*c + S(2)*A*b**S(2) - B*a*b)/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) - (S(2)*A*b - B*a)*log(x)/a**S(3) + (S(2)*A*b - B*a)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)) + (-S(2)*A*(S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4)) + B*a*b*(-S(6)*a*c + b**S(2)))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -x**S(5)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - x**S(3)*(-S(2)*A*c + B*b)/(S(2)*c*(-S(4)*a*c + b**S(2))) + x*(-A*b*c - S(10)*B*a*c + S(3)*B*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(S(6)*A*a*c**S(2) - A*b**S(2)*c - S(13)*B*a*b*c + S(3)*B*b**S(3) + (S(8)*A*a*b*c**S(2) - A*b**S(3)*c + S(20)*B*a**S(2)*c**S(2) - S(19)*B*a*b**S(2)*c + S(3)*B*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(S(6)*A*a*c**S(2) - A*b**S(2)*c - S(13)*B*a*b*c + S(3)*B*b**S(3) - (S(8)*A*a*b*c**S(2) - A*b**S(3)*c + S(20)*B*a**S(2)*c**S(2) - S(19)*B*a*b**S(2)*c + S(3)*B*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -x**S(3)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - x*(-S(2)*A*c + B*b)/(S(2)*c*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(A*b*c - S(6)*B*a*c + B*b**S(2) + (S(4)*A*a*c**S(2) + A*b**S(2)*c - S(8)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(A*b*c - S(6)*B*a*c + B*b**S(2) - (S(4)*A*a*c**S(2) + A*b**S(2)*c - S(8)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -x*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(-S(2)*A*c + B*b + (-S(4)*A*b*c + S(4)*B*a*c + B*b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(-S(2)*A*c + B*b - (-S(4)*A*b*c + S(4)*B*a*c + B*b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, sqrt(S(2))*sqrt(c)*(A*b - S(2)*B*a - (-S(12)*A*a*c + A*b**S(2) + S(4)*B*a*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(A*b - S(2)*B*a + (A*(-S(12)*a*c + b**S(2)) + S(4)*B*a*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - x*(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*sqrt(c)*(-S(10)*A*a*c + S(3)*A*b**S(2) - B*a*b + (-A*(-S(16)*a*b*c + S(3)*b**S(3)) + B*a*(-S(12)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-A*(-S(16)*a*b*c - S(10)*a*c*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(3) + S(3)*b**S(2)*sqrt(-S(4)*a*c + b**S(2))) + B*a*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*A*a*c + S(3)*A*b**S(2) - B*a*b)/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(4)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(2)*a*x**S(3)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(14)*A*a*c + S(5)*A*b**S(2) - S(3)*B*a*b)/(S(6)*a**S(2)*x**S(3)*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-A*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(19)*a*b*c*sqrt(-S(4)*a*c + b**S(2)) + S(5)*b**S(4) - S(5)*b**S(3)*sqrt(-S(4)*a*c + b**S(2))) + B*a*(-S(16)*a*b*c + S(10)*a*c*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(3) - S(3)*b**S(2)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-A*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c - S(19)*a*b*c*sqrt(-S(4)*a*c + b**S(2)) + S(5)*b**S(4) + S(5)*b**S(3)*sqrt(-S(4)*a*c + b**S(2))) + B*a*(-S(16)*a*b*c - S(10)*a*c*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(3) + S(3)*b**S(2)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-A*(-S(19)*a*b*c + S(5)*b**S(3)) + B*a*(-S(10)*a*c + S(3)*b**S(2)))/(S(2)*a**S(3)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(8)*(a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(S(4)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - x**S(4)*(a*(S(16)*A*a*c**S(2) - A*b**S(2)*c - S(18)*B*a*b*c + S(3)*B*b**S(3)) + x**S(2)*(S(10)*A*a*b*c**S(2) - A*b**S(3)*c + S(20)*B*a**S(2)*c**S(2) - S(20)*B*a*b**S(2)*c + S(3)*B*b**S(4)))/(S(4)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - x**S(2)*(A*(-S(7)*a*b*c + b**S(3)) + S(3)*B*(-S(10)*a**S(2)*c + S(7)*a*b**S(2) - b**S(4)/c))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - (-A*c + S(3)*B*b)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(4)) - (-S(30)*A*a**S(2)*b*c**S(3) + S(10)*A*a*b**S(3)*c**S(2) - A*b**S(5)*c - S(60)*B*a**S(3)*c**S(3) + S(90)*B*a**S(2)*b**S(2)*c**S(2) - S(30)*B*a*b**S(4)*c + S(3)*B*b**S(6))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) - x**S(6)*(a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(S(4)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - x**S(2)*(S(2)*a*(S(6)*A*a*c**S(2) - S(7)*B*a*b*c + B*b**S(3)) + x**S(2)*(S(6)*A*a*b*c**S(2) + S(16)*B*a**S(2)*c**S(2) - S(15)*B*a*b**S(2)*c + S(2)*B*b**S(4)))/(S(4)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + (-S(12)*A*a**S(2)*c**S(3) + S(30)*B*a**S(2)*b*c**S(2) - S(10)*B*a*b**S(3)*c + B*b**S(5))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(3)*a*(A*b - S(2)*B*a)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - x**S(6)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x**S(2)*(S(2)*a + b*x**S(2))*(S(3)*A*b - S(6)*B*a)/(S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(4)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (S(2)*a + b*x**S(2))*(S(2)*A*b - S(4)*B*a + x**S(2)*(-S(2)*A*c + B*b))/(S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + (-A*(S(2)*a*c + b**S(2)) + S(3)*B*a*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -(-S(3)*A*b*c + S(2)*B*a*c + B*b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + (b + S(2)*c*x**S(2))*(-S(3)*A*b*c + S(2)*B*a*c + B*b**S(2))/(S(4)*c*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(S(4)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(3)*c*(-S(2)*A*c + B*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - (b + S(2)*c*x**S(2))*(-S(6)*A*c + S(3)*B*b)/(S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, A*log(x)/a**S(3) - A*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)) - (-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + (A*(S(16)*a**S(2)*c**S(2) - S(15)*a*b**S(2)*c + S(2)*b**S(4)) + S(6)*B*a**S(2)*b*c + S(2)*c*x**S(2)*(A*(-S(7)*a*b*c + b**S(3)) + S(6)*B*a**S(2)*c))/(S(4)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - (-A*(S(30)*a**S(2)*b*c**S(2) - S(10)*a*b**S(3)*c + b**S(5)) + S(12)*B*a**S(3)*c**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**S(3)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(4)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - (-A*(S(20)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4)) + B*a*b*(-S(10)*a*c + b**S(2)) + c*x**S(2)*(-S(3)*A*(-S(6)*a*b*c + b**S(3)) + B*a*(-S(16)*a*c + b**S(2))))/(S(4)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + (-S(3)*A*(S(10)*a**S(2)*c**S(2) - S(7)*a*b**S(2)*c + b**S(4)) + B*a*b*(-S(7)*a*c + b**S(2)))/(S(2)*a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))**S(2)) - (S(3)*A*b - B*a)*log(x)/a**S(4) + (S(3)*A*b - B*a)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(4)) + (-S(3)*A*(-S(20)*a**S(3)*c**S(3) + S(30)*a**S(2)*b**S(2)*c**S(2) - S(10)*a*b**S(4)*c + b**S(6)) + B*a*b*(S(30)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4)))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(4)*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(7)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - x**S(5)*(-S(4)*A*a*c + S(7)*A*b**S(2) - S(12)*B*a*b + x**S(2)*(S(12)*A*b*c - S(28)*B*a*c + B*b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + x**S(3)*(S(12)*A*b*c - S(28)*B*a*c + B*b**S(2))/(S(8)*c*(-S(4)*a*c + b**S(2))**S(2)) - x*(S(20)*A*a*c**S(2) + A*b**S(2)*c - S(24)*B*a*b*c + S(3)*B*b**S(3))/(S(8)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(-S(16)*A*a*b*c**S(2) + A*b**S(3)*c + S(84)*B*a**S(2)*c**S(2) - S(27)*B*a*b**S(2)*c + S(3)*B*b**S(4) + (-S(40)*A*a**S(2)*c**S(3) - S(18)*A*a*b**S(2)*c**S(2) + A*b**S(4)*c + S(132)*B*a**S(2)*b*c**S(2) - S(33)*B*a*b**S(3)*c + S(3)*B*b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(-S(16)*A*a*b*c**S(2) + A*b**S(3)*c + S(84)*B*a**S(2)*c**S(2) - S(27)*B*a*b**S(2)*c + S(3)*B*b**S(4) - (-S(40)*A*a**S(2)*c**S(3) - S(18)*A*a*b**S(2)*c**S(2) + A*b**S(4)*c + S(132)*B*a**S(2)*b*c**S(2) - S(33)*B*a*b**S(3)*c + S(3)*B*b**S(5))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(5)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - x**S(3)*(S(4)*A*a*c + S(5)*A*b**S(2) - S(12)*B*a*b - x**S(2)*(-S(12)*A*b*c + S(20)*B*a*c + B*b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - x*(-S(12)*A*b*c + S(20)*B*a*c + B*b**S(2))/(S(8)*c*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(S(12)*A*a*c**S(2) + S(3)*A*b**S(2)*c - S(16)*B*a*b*c + B*b**S(3) + (S(36)*A*a*b*c**S(2) + S(3)*A*b**S(3)*c - S(40)*B*a**S(2)*c**S(2) - S(18)*B*a*b**S(2)*c + B*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(S(12)*A*a*c**S(2) + S(3)*A*b**S(2)*c - S(16)*B*a*b*c + B*b**S(3) - (S(36)*A*a*b*c**S(2) + S(3)*A*b**S(3)*c - S(40)*B*a**S(2)*c**S(2) - S(18)*B*a*b**S(2)*c + B*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x**S(3)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + S(3)*x*(-A*(S(4)*a*c + b**S(2)) + S(4)*B*a*b + x**S(2)*(-S(4)*A*b*c + S(4)*B*a*c + B*b**S(2)))/(S(8)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(-S(12)*A*b*c + S(12)*B*a*c + S(3)*B*b**S(2) + S(3)*(-S(8)*A*a*c**S(2) - S(6)*A*b**S(2)*c + S(12)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*(-S(12)*A*b*c + S(12)*B*a*c + S(3)*B*b**S(2) - S(3)*(-S(8)*A*a*c**S(2) - S(6)*A*b**S(2)*c + S(12)*B*a*b*c + B*b**S(3))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(16)*a*c + S(4)*b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(-A*(S(20)*a*c + b**S(2)) + S(12)*B*a*b + (A*(-S(52)*a*b*c + b**S(3)) + S(6)*B*a*(S(4)*a*c + S(3)*b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - sqrt(S(2))*sqrt(c)*(-A*(S(20)*a*c + b**S(2)) + S(12)*B*a*b - (A*(-S(52)*a*b*c + b**S(3)) + S(6)*B*a*(S(4)*a*c + S(3)*b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) - x*(-A*(S(8)*a*b*c + b**S(3)) + B*a*(-S(4)*a*c + S(7)*b**S(2)) + c*x**S(2)*(-A*(S(20)*a*c + b**S(2)) + S(12)*B*a*b))/(S(8)*a*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -x*(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + sqrt(S(2))*sqrt(c)*(S(3)*A*(-S(8)*a*b*c + b**S(3)) + B*a*(S(20)*a*c + b**S(2)) - (S(3)*A*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4)) + B*a*b*(-S(52)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + sqrt(S(2))*sqrt(c)*(S(3)*A*(-S(8)*a*b*c + b**S(3)) + B*a*(S(20)*a*c + b**S(2)) + (S(3)*A*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4)) + B*a*b*(-S(52)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**S(2)) + x*(A*(S(28)*a**S(2)*c**S(2) - S(25)*a*b**S(2)*c + S(3)*b**S(4)) + B*a*b*(S(8)*a*c + b**S(2)) + c*x**S(2)*(S(3)*A*(-S(8)*a*b*c + b**S(3)) + B*a*(S(20)*a*c + b**S(2))))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(4)*x**S(2) + S(-7))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, log(-x**S(2) + S(1))/S(2) + S(3)*log(-x**S(2) + S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(3) - S(7)*x)/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, log(-x**S(2) + S(1))/S(2) + S(3)*log(-x**S(2) + S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(x**S(2) + S(2))/(x**S(4) + x**S(2) + S(1)), x), x, log(x**S(4) + x**S(2) + S(1))/S(4) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(2)*x)/(x**S(4) + x**S(2) + S(1)), x), x, log(x**S(4) + x**S(2) + S(1))/S(4) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(11)*x)/(x**S(4) + S(2)*x**S(2) + S(3))**S(2), x), x, (S(9)*x**S(2) + S(5))/(S(8)*x**S(4) + S(16)*x**S(2) + S(24)) + S(9)*sqrt(S(2))*atan(sqrt(S(2))*(x**S(2) + S(1))/S(2))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(a + b*x**S(2) + c*x**S(4))**(S(5)/2)*(-S(12)*A*c + S(7)*B*b - S(10)*B*c*x**S(2))/(S(120)*c**S(2)) + (b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)*(-S(12)*A*b*c - S(4)*B*a*c + S(7)*B*b**S(2))/(S(384)*c**S(3)) - (b + S(2)*c*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(-S(12)*A*b*c - S(4)*B*a*c + S(7)*B*b**S(2))/(S(1024)*c**S(4)) + (-S(4)*a*c + b**S(2))**S(2)*(-S(12)*A*b*c - S(4)*B*a*c + S(7)*B*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2048)*c**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, B*(a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(10)*c) - (b + S(2)*c*x**S(2))*(-S(2)*A*c + B*b)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(32)*c**S(2)) + (b + S(2)*c*x**S(2))*(-S(2)*A*c + B*b)*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*c**S(3)) - S(3)*(-S(2)*A*c + B*b)*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x, x), x, -A*a**(S(3)/2)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(2) + (a + b*x**S(2) + c*x**S(4))**(S(3)/2)*(S(8)*A*c + S(3)*B*b + S(6)*B*c*x**S(2))/(S(48)*c) - sqrt(a + b*x**S(2) + c*x**S(4))*(-S(64)*A*a*c**S(2) - S(8)*A*b**S(2)*c - S(12)*B*a*b*c + S(3)*B*b**S(3) + S(2)*c*x**S(2)*(-S(8)*A*b*c - S(12)*B*a*c + S(3)*B*b**S(2)))/(S(128)*c**S(2)) + (S(64)*A*a*b*c**S(2) + (-S(4)*a*c + b**S(2))*(-S(8)*A*b*c - S(12)*B*a*c + S(3)*B*b**S(2)))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(3), x), x, -sqrt(a)*(S(3)*A*b + S(2)*B*a)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/S(4) - (S(3)*A - B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*x**S(2)) + sqrt(a + b*x**S(2) + c*x**S(4))*(S(18)*A*b*c + S(8)*B*a*c + B*b**S(2) + S(2)*c*x**S(2)*(S(6)*A*c + B*b))/(S(16)*c) - (-S(24)*A*a*c**S(2) - S(6)*A*b**S(2)*c - S(12)*B*a*b*c + B*b**S(3))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(5), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))*(S(3)*A*b + S(6)*B*a - S(3)*x**S(2)*(S(2)*A*c + B*b))/(S(8)*x**S(2)) - (A - B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(4)*x**S(4)) + (S(12)*A*b*c + S(12)*B*a*c + S(3)*B*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(c)) - (S(3)*A*(S(4)*a*c + b**S(2)) + S(12)*B*a*b)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(a)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(144)*A*a*b*c**S(2) - S(18)*A*b**S(3)*c + S(84)*B*a**S(2)*c**S(2) - S(57)*B*a*b**S(2)*c + S(8)*B*b**S(4))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(315)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(144)*A*a*b*c**S(2) - S(18)*A*b**S(3)*c + S(84)*B*a**S(2)*c**S(2) - S(57)*B*a*b**S(2)*c + S(8)*B*b**S(4) + sqrt(a)*sqrt(c)*(S(180)*A*a*c**S(2) - S(9)*A*b**S(2)*c - S(24)*B*a*b*c + S(4)*B*b**S(3)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(630)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)*(S(9)*A*c + S(3)*B*b + S(7)*B*c*x**S(2))/(S(63)*c) - x*sqrt(a + b*x**S(2) + c*x**S(4))*(-S(90)*A*a*c**S(2) - S(9)*A*b**S(2)*c - S(9)*B*a*b*c + S(4)*B*b**S(3) + S(3)*c*x**S(2)*(-S(9)*A*b*c - S(14)*B*a*c + S(4)*B*b**S(2)))/(S(315)*c**S(2)) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(144)*A*a*b*c**S(2) - S(18)*A*b**S(3)*c + S(84)*B*a**S(2)*c**S(2) - S(57)*B*a*b**S(2)*c + S(8)*B*b**S(4))/(S(315)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(2), x), x, a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(84)*A*a*c**S(2) - S(7)*A*b**S(2)*c - S(16)*B*a*b*c + S(2)*B*b**S(3))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(35)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(84)*A*a*c**S(2) - S(7)*A*b**S(2)*c - S(16)*B*a*b*c + S(2)*B*b**S(3) + sqrt(a)*sqrt(c)*(-S(56)*A*b*c - S(20)*B*a*c + B*b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(70)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - (S(7)*A - B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(7)*x) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(49)*A*b*c + S(10)*B*a*c + B*b**S(2) + S(3)*c*x**S(2)*(S(14)*A*c + B*b))/(S(35)*c) - x*sqrt(a + b*x**S(2) + c*x**S(4))*(-S(84)*A*a*c**S(2) - S(7)*A*b**S(2)*c - S(16)*B*a*b*c + S(2)*B*b**S(3))/(S(35)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(4), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(40)*A*b*c + S(36)*B*a*c + S(3)*B*b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(40)*A*b*c + S(36)*B*a*c + S(3)*B*b**S(2) + sqrt(c)*(S(5)*A*(S(4)*a*c + S(3)*b**S(2)) + S(24)*B*a*b)/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - sqrt(a + b*x**S(2) + c*x**S(4))*(S(15)*A*b + S(18)*B*a - x**S(2)*(S(10)*A*c + S(3)*B*b))/(S(15)*x) - (S(5)*A - S(3)*B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(15)*x**S(3)) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(S(40)*A*b*c + S(36)*B*a*c + S(3)*B*b**S(2))/(S(15)*sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/x**S(6), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))*(S(3)*A*b + S(10)*B*a - x**S(2)*(S(18)*A*c + S(15)*B*b))/(S(15)*x**S(3)) - (S(3)*A - S(5)*B*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(15)*x**S(5)) + sqrt(c)*x*(S(3)*A*(S(12)*a*c + b**S(2)) + S(40)*B*a*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*a*(sqrt(a) + sqrt(c)*x**S(2))) - (S(3)*A*(S(12)*a*c + b**S(2)) + S(40)*B*a*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*a*x) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(3)*A*(S(12)*a*c + b**S(2)) + S(40)*B*a*b)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b)*(S(3)*A*b*sqrt(c) + S(10)*B*a*sqrt(c) + S(3)*sqrt(a)*(S(6)*A*c + S(5)*B*b))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*a**(S(3)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, B*x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(6)*c) + sqrt(a + b*x**S(2) + c*x**S(4))*(-S(18)*A*b*c - S(16)*B*a*c + S(15)*B*b**S(2) - S(2)*c*x**S(2)*(-S(6)*A*c + S(5)*B*b))/(S(48)*c**S(3)) - (S(8)*A*a*c**S(2) - S(6)*A*b**S(2)*c - S(12)*B*a*b*c + S(5)*B*b**S(3))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(a + b*x**S(2) + c*x**S(4))*(-S(4)*A*c + S(3)*B*b - S(2)*B*c*x**S(2))/(S(8)*c**S(2)) + (-S(4)*A*b*c - S(4)*B*a*c + S(3)*B*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, B*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*c) - (-S(2)*A*c + B*b)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*c**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -A*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)) + B*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -A*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*a*x**S(2)) + (A*b - S(2)*B*a)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(5)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -A*sqrt(a + b*x**S(2) + c*x**S(4))/(S(4)*a*x**S(4)) + (S(3)*A*b - S(4)*B*a)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*a**S(2)*x**S(2)) - (-S(4)*A*a*c + S(3)*A*b**S(2) - S(4)*B*a*b)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(7)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -A*sqrt(a + b*x**S(2) + c*x**S(4))/(S(6)*a*x**S(6)) + (S(5)*A*b - S(6)*B*a)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(24)*a**S(2)*x**S(4)) - sqrt(a + b*x**S(2) + c*x**S(4))*(-S(16)*A*a*c + S(15)*A*b**S(2) - S(18)*B*a*b)/(S(48)*a**S(3)*x**S(2)) + (-S(12)*A*a*b*c + S(5)*A*b**S(3) + S(8)*B*a**S(2)*c - S(6)*B*a*b**S(2))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, B*x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(5)*c) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(10)*A*b*c - S(9)*B*a*c + S(8)*B*b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(10)*A*b*c - S(9)*B*a*c + S(8)*B*b**S(2) + sqrt(a)*sqrt(c)*(-S(5)*A*c + S(4)*B*b))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*c**(S(11)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - x*(-S(5)*A*c + S(4)*B*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(15)*c**S(2)) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(-S(10)*A*b*c - S(9)*B*a*c + S(8)*B*b**S(2))/(S(15)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, B*x*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*A*c + S(2)*B*b)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*A*c + B*sqrt(a)*sqrt(c) + S(2)*B*b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*c**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - x*(-S(3)*A*c + S(2)*B*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, -B*a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + B*x*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(A*sqrt(c)/sqrt(a) + B)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*c**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, A*sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))) - A*sqrt(a + b*x**S(2) + c*x**S(4))/(a*x) - A*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(A*sqrt(c) + B*sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*c**(S(1)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(4)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -A*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a*x**S(3)) - sqrt(c)*x*(S(2)*A*b - S(3)*B*a)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))) + (S(2)*A*b - S(3)*B*a)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(3)*a**S(2)*x) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*A*b - S(3)*B*a)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(A*sqrt(a)*sqrt(c) + S(2)*A*b - S(3)*B*a)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*a**(S(7)/4)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -x**S(2)*(a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(c*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt(a + b*x**S(2) + c*x**S(4))*(-S(2)*A*b*c - S(8)*B*a*c + S(3)*B*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) - (-S(2)*A*c + S(3)*B*b)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*c**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, B*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*c**(S(3)/2)) - (a*(-S(2)*A*c + B*b) + x**S(2)*(-A*b*c - S(2)*B*a*c + B*b**S(2)))/(c*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -A*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*a**(S(3)/2)) - (-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(a*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(a*x**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - sqrt(a + b*x**S(2) + c*x**S(4))*(-S(8)*A*a*c + S(3)*A*b**S(2) - S(2)*B*a*b)/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) + (S(3)*A*b - S(2)*B*a)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-A*b*c - S(6)*B*a*c + S(2)*B*b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-A*c - S(3)*B*sqrt(a)*sqrt(c) + S(2)*B*b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(7)/4)*(-S(4)*sqrt(a)*sqrt(c) + S(2)*b)*sqrt(a + b*x**S(2) + c*x**S(4))) - x**S(3)*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - x*(-S(2)*A*c + B*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) + x*sqrt(a + b*x**S(2) + c*x**S(4))*(-A*b*c - S(6)*B*a*c + S(2)*B*b**S(2))/(c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, a**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(2)*A*c + B*b)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(c**(S(3)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - x*(A*b - S(2)*B*a - x**S(2)*(-S(2)*A*c + B*b))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - x*(-S(2)*A*c + B*b)*sqrt(a + b*x**S(2) + c*x**S(4))/(sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) - sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-A*sqrt(c) + B*sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(3)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -sqrt(c)*x*(A*b - S(2)*B*a)*sqrt(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) - x*(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(a*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(A*b - S(2)*B*a)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-A*sqrt(c) + B*sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*c**(S(1)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -(-A*(-S(2)*a*c + b**S(2)) + B*a*b - c*x**S(2)*(A*b - S(2)*B*a))/(a*x*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + sqrt(c)*x*sqrt(a + b*x**S(2) + c*x**S(4))*(-S(6)*A*a*c + S(2)*A*b**S(2) - B*a*b)/(a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))) - sqrt(a + b*x**S(2) + c*x**S(4))*(-S(6)*A*a*c + S(2)*A*b**S(2) - B*a*b)/(a**S(2)*x*(-S(4)*a*c + b**S(2))) - c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(6)*A*a*c + S(2)*A*b**S(2) - B*a*b)*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*A*sqrt(a)*sqrt(c) + S(2)*A*b - B*a)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(7)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**(S(3)/2)*(d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*d*(f*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-1)/2, S(-1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*e*(f*x)**(S(9)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(9)/4, S(-1)/2, S(-1)/2, S(13)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(9)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(f*x)*(d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*d*(f*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-1)/2, S(-1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*e*(f*x)**(S(7)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(7)/4, S(-1)/2, S(-1)/2, S(11)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(7)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/sqrt(f*x), x), x, S(2)*d*sqrt(f*x)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(1)/4, S(-1)/2, S(-1)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*e*(f*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-1)/2, S(-1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(f*x)**(S(3)/2), x), x, -S(2)*d*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(-1)/4, S(-1)/2, S(-1)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(f*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*e*(f*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-1)/2, S(-1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**(S(3)/2)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*a*d*(f*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-3)/2, S(-3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*a*e*(f*x)**(S(9)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(9)/4, S(-3)/2, S(-3)/2, S(13)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(9)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(f*x)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*a*d*(f*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-3)/2, S(-3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*a*e*(f*x)**(S(7)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(7)/4, S(-3)/2, S(-3)/2, S(11)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(7)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/sqrt(f*x), x), x, S(2)*a*d*sqrt(f*x)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(1)/4, S(-3)/2, S(-3)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*a*e*(f*x)**(S(5)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(5)/4, S(-3)/2, S(-3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(f*x)**(S(3)/2), x), x, -S(2)*a*d*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(-1)/4, S(-3)/2, S(-3)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(f*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + S(2)*a*e*(f*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(S(3)/4, S(-3)/2, S(-3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f**S(3)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**(S(3)/2)*(d + e*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*d*(f*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(1)/2, S(1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(9)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(9)/4, S(1)/2, S(1)/2, S(13)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(9)*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(f*x)*(d + e*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, S(2)*d*(f*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(1)/2, S(1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(7)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(7)/4, S(1)/2, S(1)/2, S(11)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(7)*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(sqrt(f*x)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, S(2)*d*sqrt(f*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/4, S(1)/2, S(1)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(1)/2, S(1)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/((f*x)**(S(3)/2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/4, S(1)/2, S(1)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*sqrt(f*x)*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(1)/2, S(1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**(S(3)/2)*(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*d*(f*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(3)/2, S(3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*a*f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(9)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(9)/4, S(3)/2, S(3)/2, S(13)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(9)*a*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(f*x)*(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, S(2)*d*(f*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(3)/2, S(3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(7)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(7)/4, S(3)/2, S(3)/2, S(11)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(7)*a*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/(sqrt(f*x)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, S(2)*d*sqrt(f*x)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(1)/4, S(3)/2, S(3)/2, S(5)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*f*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(5)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(5)/4, S(3)/2, S(3)/2, S(9)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(5)*a*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))/((f*x)**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -S(2)*d*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(-1)/4, S(3)/2, S(3)/2, S(3)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*f*sqrt(f*x)*sqrt(a + b*x**S(2) + c*x**S(4))) + S(2)*e*(f*x)**(S(3)/2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(3)/2, S(3)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*f**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -c*(f*x)**(m + S(1))*(S(2)*a*(-S(2)*c*d*(-m + S(3)) + e*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*d*(-m + S(1)) + b*(S(4)*a*e - d*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*f*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + c*(f*x)**(m + S(1))*(-S(2)*a*(S(2)*c*d*(-m + S(3)) + e*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*(-d*m + d) + b*(S(4)*a*e + d*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*f*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (f*x)**(m + S(1))*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**S(2)*(-S(2)*a*e + b*d))/(S(2)*a*f*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, a*d*(f*x)**(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(1)/2, S(-3)/2, S(-3)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + a*e*(f*x)**(m + S(3))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(3)/2, S(-3)/2, S(-3)/2, m/S(2) + S(5)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f**S(3)*(m + S(3))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4)), x), x, d*(f*x)**(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(1)/2, S(-1)/2, S(-1)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))) + e*(f*x)**(m + S(3))*sqrt(a + b*x**S(2) + c*x**S(4))*AppellF1(m/S(2) + S(3)/2, S(-1)/2, S(-1)/2, m/S(2) + S(5)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f**S(3)*(m + S(3))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/sqrt(a + b*x**S(2) + c*x**S(4)), x), x, d*(f*x)**(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(1)/2, S(1)/2, S(1)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))) + e*(f*x)**(m + S(3))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(3)/2, S(1)/2, S(1)/2, m/S(2) + S(5)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f**S(3)*(m + S(3))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, d*(f*x)**(m + S(1))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(1)/2, S(3)/2, S(3)/2, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*f*(m + S(1))*sqrt(a + b*x**S(2) + c*x**S(4))) + e*(f*x)**(m + S(3))*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(m/S(2) + S(3)/2, S(3)/2, S(3)/2, m/S(2) + S(5)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*f**S(3)*(m + S(3))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(3), x), x, a**S(3)*d*(f*x)**(m + S(1))/(f*(m + S(1))) + a**S(2)*(f*x)**(m + S(3))*(a*e + S(3)*b*d)/(f**S(3)*(m + S(3))) + S(3)*a*(f*x)**(m + S(5))*(a*b*e + a*c*d + b**S(2)*d)/(f**S(5)*(m + S(5))) + c**S(3)*e*(f*x)**(m + S(15))/(f**S(15)*(m + S(15))) + c**S(2)*(f*x)**(m + S(13))*(S(3)*b*e + c*d)/(f**S(13)*(m + S(13))) + S(3)*c*(f*x)**(m + S(11))*(a*c*e + b**S(2)*e + b*c*d)/(f**S(11)*(m + S(11))) + (f*x)**(m + S(7))*(S(3)*a**S(2)*c*e + S(3)*a*b**S(2)*e + S(6)*a*b*c*d + b**S(3)*d)/(f**S(7)*(m + S(7))) + (f*x)**(m + S(9))*(S(6)*a*b*c*e + S(3)*a*c**S(2)*d + b**S(3)*e + S(3)*b**S(2)*c*d)/(f**S(9)*(m + S(9))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*d*(f*x)**(m + S(1))/(f*(m + S(1))) + a*(f*x)**(m + S(3))*(a*e + S(2)*b*d)/(f**S(3)*(m + S(3))) + c**S(2)*e*(f*x)**(m + S(11))/(f**S(11)*(m + S(11))) + c*(f*x)**(m + S(9))*(S(2)*b*e + c*d)/(f**S(9)*(m + S(9))) + (f*x)**(m + S(5))*(S(2)*a*b*e + S(2)*a*c*d + b**S(2)*d)/(f**S(5)*(m + S(5))) + (f*x)**(m + S(7))*(S(2)*a*c*e + b**S(2)*e + S(2)*b*c*d)/(f**S(7)*(m + S(7))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, a*d*(f*x)**(m + S(1))/(f*(m + S(1))) + c*e*(f*x)**(m + S(7))/(f**S(7)*(m + S(7))) + (f*x)**(m + S(3))*(a*e + b*d)/(f**S(3)*(m + S(3))) + (f*x)**(m + S(5))*(b*e + c*d)/(f**S(5)*(m + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, (f*x)**(m + S(1))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))) + (f*x)**(m + S(1))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(f*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(2)*x**S(4)/S(4) + c*e**S(2)*x**S(12)/S(12) + d*x**S(6)*(S(2)*a*e + b*d)/S(6) + e*x**S(10)*(b*e + S(2)*c*d)/S(10) + x**S(8)*(c*d**S(2)/S(8) + e*(a*e + S(2)*b*d)/S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(2)*x**S(3)/S(3) + c*e**S(2)*x**S(11)/S(11) + d*x**S(5)*(S(2)*a*e + b*d)/S(5) + e*x**S(9)*(b*e + S(2)*c*d)/S(9) + x**S(7)*(c*d**S(2)/S(7) + e*(a*e + S(2)*b*d)/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(2)*x**S(2)/S(2) + c*e**S(2)*x**S(10)/S(10) + d*x**S(4)*(S(2)*a*e + b*d)/S(4) + e*x**S(8)*(b*e + S(2)*c*d)/S(8) + x**S(6)*(c*d**S(2)/S(6) + e*(a*e + S(2)*b*d)/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d**S(2)*x + c*e**S(2)*x**S(9)/S(9) + d*x**S(3)*(S(2)*a*e + b*d)/S(3) + e*x**S(7)*(b*e + S(2)*c*d)/S(7) + x**S(5)*(c*d**S(2)/S(5) + e*(a*e + S(2)*b*d)/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))/x, x), x, a*d**S(2)*log(x) + c*e**S(2)*x**S(8)/S(8) + d*x**S(2)*(S(2)*a*e + b*d)/S(2) + e*x**S(6)*(b*e + S(2)*c*d)/S(6) + x**S(4)*(c*d**S(2)/S(4) + e*(a*e + S(2)*b*d)/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))/x**S(2), x), x, -a*d**S(2)/x + c*e**S(2)*x**S(7)/S(7) + d*x*(S(2)*a*e + b*d) + e*x**S(5)*(b*e + S(2)*c*d)/S(5) + x**S(3)*(c*d**S(2)/S(3) + e*(a*e + S(2)*b*d)/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))/x**S(3), x), x, -a*d**S(2)/(S(2)*x**S(2)) + c*e**S(2)*x**S(6)/S(6) + d*(S(2)*a*e + b*d)*log(x) + e*x**S(4)*(b*e + S(2)*c*d)/S(4) + x**S(2)*(c*d**S(2)/S(2) + e*(a*e + S(2)*b*d)/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x**S(7)/(S(7)*e**S(2)) + d**(S(3)/2)*(S(9)*c*d**S(2) - e*(-S(5)*a*e + S(7)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*e**(S(11)/2)) - d**S(2)*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*e**S(5)*(d + e*x**S(2))) - d*x*(S(4)*c*d**S(2) - e*(-S(2)*a*e + S(3)*b*d))/e**S(5) - x**S(5)*(-b*e + S(2)*c*d)/(S(5)*e**S(3)) + x**S(3)*(S(3)*c*d**S(2) - e*(-a*e + S(2)*b*d))/(S(3)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x**S(5)/(S(5)*e**S(2)) - sqrt(d)*(S(7)*c*d**S(2) - e*(-S(3)*a*e + S(5)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*e**(S(9)/2)) + d*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*e**S(4)*(d + e*x**S(2))) - x**S(3)*(-b*e + S(2)*c*d)/(S(3)*e**S(3)) + x*(S(3)*c*d**S(2) - e*(-a*e + S(2)*b*d))/e**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x**S(3)/(S(3)*e**S(2)) - x*(-b*e + S(2)*c*d)/e**S(3) - x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*e**S(3)*(d + e*x**S(2))) + (S(5)*c*d**S(2) - e*(-a*e + S(3)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*sqrt(d)*e**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(2), x), x, c*x/e**S(2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d*e**S(2)*(d + e*x**S(2))) - (S(3)*c*d**S(2) - e*(a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(3)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(2)*(d + e*x**S(2))**S(2)), x), x, -a/(d**S(2)*x) - x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d**S(2)*e*(d + e*x**S(2))) + (c*d**S(2) + e*(-S(3)*a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(5)/2)*e**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(4)*(d + e*x**S(2))**S(2)), x), x, -a/(S(3)*d**S(2)*x**S(3)) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d**S(3)*(d + e*x**S(2))) - (-S(2)*a*e + b*d)/(d**S(3)*x) + (c*d**S(2) - e*(-S(5)*a*e + S(3)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(7)/2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(6)*(d + e*x**S(2))**S(2)), x), x, -a/(S(5)*d**S(2)*x**S(5)) - (-S(2)*a*e + b*d)/(S(3)*d**S(3)*x**S(3)) - e*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d**S(4)*(d + e*x**S(2))) - (c*d**S(2) - e*(-S(3)*a*e + S(2)*b*d))/(d**S(4)*x) - sqrt(e)*(S(3)*c*d**S(2) - e*(-S(7)*a*e + S(5)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(8)*(d + e*x**S(2))**S(2)), x), x, -a/(S(7)*d**S(2)*x**S(7)) - (-S(2)*a*e + b*d)/(S(5)*d**S(3)*x**S(5)) - (c*d**S(2) - e*(-S(3)*a*e + S(2)*b*d))/(S(3)*d**S(4)*x**S(3)) + e**S(2)*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*d**S(5)*(d + e*x**S(2))) + e*(S(2)*c*d**S(2) - e*(-S(4)*a*e + S(3)*b*d))/(d**S(5)*x) + e**(S(3)/2)*(S(5)*c*d**S(2) - e*(-S(9)*a*e + S(7)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(2)*d**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(3), x), x, c*x**S(5)/(S(5)*e**S(3)) - sqrt(d)*(S(15)*a*e**S(2) - S(35)*b*d*e + S(63)*c*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(S(8)*e**(S(11)/2)) - d**S(2)*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*e**S(5)*(d + e*x**S(2))**S(2)) + d*x*(S(17)*c*d**S(2) - e*(-S(9)*a*e + S(13)*b*d))/(S(8)*e**S(5)*(d + e*x**S(2))) - x**S(3)*(-b*e + S(3)*c*d)/(S(3)*e**S(4)) + x*(S(6)*c*d**S(2) - e*(-a*e + S(3)*b*d))/e**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(3), x), x, c*x**S(3)/(S(3)*e**S(3)) + d*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*e**S(4)*(d + e*x**S(2))**S(2)) - x*(-b*e + S(3)*c*d)/e**S(4) - x*(S(13)*c*d**S(2) - e*(-S(5)*a*e + S(9)*b*d))/(S(8)*e**S(4)*(d + e*x**S(2))) + (S(35)*c*d**S(2) - S(3)*e*(-a*e + S(5)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(8)*sqrt(d)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(3), x), x, c*x/e**S(3) - x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*e**S(3)*(d + e*x**S(2))**S(2)) + x*(S(9)*c*d**S(2) - e*(-a*e + S(5)*b*d))/(S(8)*d*e**S(3)*(d + e*x**S(2))) - (S(15)*c*d**S(2) - e*(a*e + S(3)*b*d))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(3)/2)*e**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2))**S(3), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*d*e**S(2)*(d + e*x**S(2))**S(2)) - x*(S(5)*c*d**S(2) - e*(S(3)*a*e + b*d))/(S(8)*d**S(2)*e**S(2)*(d + e*x**S(2))) + (S(3)*c*d**S(2) + e*(S(3)*a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(5)/2)*e**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(2)*(d + e*x**S(2))**S(3)), x), x, -a/(d**S(3)*x) - x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*d**S(2)*e*(d + e*x**S(2))**S(2)) + x*(c*d**S(2) + e*(-S(7)*a*e + S(3)*b*d))/(S(8)*d**S(3)*e*(d + e*x**S(2))) + (c*d**S(2) + S(3)*e*(-S(5)*a*e + b*d))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(7)/2)*e**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(4)*(d + e*x**S(2))**S(3)), x), x, -a/(S(3)*d**S(3)*x**S(3)) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*d**S(3)*(d + e*x**S(2))**S(2)) + x*(S(3)*c*d**S(2) - e*(-S(11)*a*e + S(7)*b*d))/(S(8)*d**S(4)*(d + e*x**S(2))) - (-S(3)*a*e + b*d)/(d**S(4)*x) + (S(35)*a*e**S(2) - S(15)*b*d*e + S(3)*c*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(9)/2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(6)*(d + e*x**S(2))**S(3)), x), x, -a/(S(5)*d**S(3)*x**S(5)) - e*x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(4)*d**S(4)*(d + e*x**S(2))**S(2)) - (-S(3)*a*e + b*d)/(S(3)*d**S(4)*x**S(3)) - e*x*(S(7)*c*d**S(2) - e*(-S(15)*a*e + S(11)*b*d))/(S(8)*d**S(5)*(d + e*x**S(2))) - (S(6)*a*e**S(2) - S(3)*b*d*e + c*d**S(2))/(d**S(5)*x) - sqrt(e)*(S(63)*a*e**S(2) - S(35)*b*d*e + S(15)*c*d**S(2))*atan(sqrt(e)*x/sqrt(d))/(S(8)*d**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, d**S(4)*log(d + e*x**S(2))/(S(2)*e**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) + x**S(4)/(S(4)*c*e) - x**S(2)*(b*e + c*d)/(S(2)*c**S(2)*e**S(2)) - (a**S(2)*c*e - a*b**S(2)*e - S(2)*a*b*c*d + b**S(3)*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) - (S(3)*a**S(2)*b*c*e + S(2)*a**S(2)*c**S(2)*d - a*b**S(3)*e - S(4)*a*b**S(2)*c*d + b**S(4)*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -d**S(3)*log(d + e*x**S(2))/(S(2)*e**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) + x**S(2)/(S(2)*c*e) + (-a*b*e - a*c*d + b**S(2)*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) + (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, d**S(2)*log(d + e*x**S(2))/(S(2)*e*(a*e**S(2) - b*d*e + c*d**S(2))) - (-a*e + b*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c*(a*e**S(2) - b*d*e + c*d**S(2))) - (-a*b*e - S(2)*a*c*d + b**S(2)*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, d*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a*e**S(2) - S(4)*b*d*e + S(4)*c*d**S(2)) - d*log(d + e*x**S(2))/(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2)) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -e*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a*e**S(2) - S(4)*b*d*e + S(4)*c*d**S(2)) + e*log(d + e*x**S(2))/(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2)) - (-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -e**S(2)*log(d + e*x**S(2))/(S(2)*d*(a*e**S(2) - b*d*e + c*d**S(2))) - (-b*e + c*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a*(a*e**S(2) - b*d*e + c*d**S(2))) + (S(2)*a*c*e - b**S(2)*e + b*c*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + log(x)/(a*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, e**S(3)*log(d + e*x**S(2))/(S(2)*d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) - S(1)/(S(2)*a*d*x**S(2)) + (a*c*e - b**S(2)*e + b*c*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))) - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - (a*e + b*d)*log(x)/(a**S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -e**S(4)*log(d + e*x**S(2))/(S(2)*d**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) - S(1)/(S(4)*a*d*x**S(4)) + (a*e + b*d)/(S(2)*a**S(2)*d**S(2)*x**S(2)) - (S(2)*a*b*c*e - a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) + (-S(2)*a**S(2)*c**S(2)*e + S(4)*a*b**S(2)*c*e - S(3)*a*b*c**S(2)*d - b**S(4)*e + b**S(3)*c*d)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + (a*b*d*e - a*(-a*e**S(2) + c*d**S(2)) + b**S(2)*d**S(2))*log(x)/(a**S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, d**(S(7)/2)*atan(sqrt(e)*x/sqrt(d))/(e**(S(5)/2)*(a*e**S(2) - b*d*e + c*d**S(2))) + x**S(3)/(S(3)*c*e) - x*(b*e + c*d)/(c**S(2)*e**S(2)) - sqrt(S(2))*(a**S(2)*c*e - a*b**S(2)*e - S(2)*a*b*c*d + b**S(3)*d + (S(3)*a**S(2)*b*c*e + S(2)*a**S(2)*c**S(2)*d - a*b**S(3)*e - S(4)*a*b**S(2)*c*d + b**S(4)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*(a**S(2)*c*e - a*b**S(2)*e - S(2)*a*b*c*d + b**S(3)*d - (S(3)*a**S(2)*b*c*e + S(2)*a**S(2)*c**S(2)*d - a*b**S(3)*e - S(4)*a*b**S(2)*c*d + b**S(4)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -d**(S(5)/2)*atan(sqrt(e)*x/sqrt(d))/(e**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))) + x/(c*e) + sqrt(S(2))*(-a*b*e - a*c*d + b**S(2)*d + (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*(-a*b*e - a*c*d + b**S(2)*d - (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, d**(S(3)/2)*atan(sqrt(e)*x/sqrt(d))/(sqrt(e)*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*(-a*e + b*d + (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*(-a*e + b*d - (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, sqrt(S(2))*sqrt(c)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*sqrt(c)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(d)*sqrt(e)*atan(sqrt(e)*x/sqrt(d))/(a*e**S(2) - b*d*e + c*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*sqrt(c)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**(S(3)/2)*atan(sqrt(e)*x/sqrt(d))/(sqrt(d)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -e**(S(5)/2)*atan(sqrt(e)*x/sqrt(d))/(d**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*sqrt(c)*(S(2)*a*c*e - b**S(2)*e + b*c*d - sqrt(-S(4)*a*c + b**S(2))*(-b*e + c*d))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*sqrt(c)*(S(2)*a*c*e - b**S(2)*e + b*c*d + sqrt(-S(4)*a*c + b**S(2))*(-b*e + c*d))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - S(1)/(a*d*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, e**(S(7)/2)*atan(sqrt(e)*x/sqrt(d))/(d**(S(5)/2)*(a*e**S(2) - b*d*e + c*d**S(2))) - S(1)/(S(3)*a*d*x**S(3)) + sqrt(S(2))*sqrt(c)*(a*c*(S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b**S(3)*e - b**S(2)*(c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(-S(3)*a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*sqrt(c)*(a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(a*e**S(2) - b*d*e + c*d**S(2))) + (a*e + b*d)/(a**S(2)*d**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(f*x)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)**(S(3)/4)*c**(S(3)/4)*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(f*x)/(sqrt(f)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)))/(S(2)*sqrt(f)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - S(2)**(S(3)/4)*c**(S(3)/4)*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(f*x)/(sqrt(f)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)))/(S(2)*sqrt(f)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(f*x)/(sqrt(f)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)))/(S(2)*sqrt(f)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + S(2)**(S(3)/4)*c**(S(3)/4)*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*sqrt(f*x)/(sqrt(f)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)))/(S(2)*sqrt(f)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)*sqrt(-S(4)*a*c + b**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*e**(S(7)/4)*log(-sqrt(S(2))*d**(S(1)/4)*e**(S(1)/4)*sqrt(f*x) + sqrt(d)*sqrt(f) + sqrt(e)*sqrt(f)*x)/(S(4)*d**(S(3)/4)*sqrt(f)*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*e**(S(7)/4)*log(sqrt(S(2))*d**(S(1)/4)*e**(S(1)/4)*sqrt(f*x) + sqrt(d)*sqrt(f) + sqrt(e)*sqrt(f)*x)/(S(4)*d**(S(3)/4)*sqrt(f)*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(S(2))*e**(S(7)/4)*atan(S(1) - sqrt(S(2))*e**(S(1)/4)*sqrt(f*x)/(d**(S(1)/4)*sqrt(f)))/(S(2)*d**(S(3)/4)*sqrt(f)*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(S(2))*e**(S(7)/4)*atan(S(1) + sqrt(S(2))*e**(S(1)/4)*sqrt(f*x)/(d**(S(1)/4)*sqrt(f)))/(S(2)*d**(S(3)/4)*sqrt(f)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2)), x), x, -b*(b + S(2)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(16)*c**S(2)*e) + b*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(5)/2)*e) + d**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*e**S(3)) + d**S(2)*sqrt(a*e**S(2) - b*d*e + c*d**S(2))*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(4)) - d*(b + S(2)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*c*e**S(2)) + (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*c*e) - d**S(2)*(-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*e**S(4)) + d*(-S(4)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(3)/2)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2)), x), x, -d*sqrt(a*e**S(2) - b*d*e + c*d**S(2))*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(3)) - sqrt(a + b*x**S(2) + c*x**S(4))*(-b*e + S(4)*c*d - S(2)*c*e*x**S(2))/(S(8)*c*e**S(2)) + (-b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(4)*c*e*(-a*e + b*d))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(3)/2)*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*x**S(2) + c*x**S(4))/(d + e*x**S(2)), x), x, sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*e) + sqrt(a*e**S(2) - b*d*e + c*d**S(2))*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(2)) - (-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/(x*(d + e*x**S(2))), x), x, -sqrt(a)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*d) + sqrt(c)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*e) - sqrt(a*e**S(2) - b*d*e + c*d**S(2))*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/(x**S(3)*(d + e*x**S(2))), x), x, sqrt(a)*e*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*d**S(2)) - b*e*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*d**S(2)) + sqrt(c)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*d) - sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*d*x**S(2)) + sqrt(a*e**S(2) - b*d*e + c*d**S(2))*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d**S(2)) - (-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*d**S(2)) - b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(a)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, x*(S(3)*x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(30) - x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(4) + S(109)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(120)*(sqrt(S(2))*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(-70) + S(263)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(120)*(S(-2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(15)*sqrt(S(2)) + S(45))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(32)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(109)*sqrt(S(2))*x**S(2) + S(109))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(120)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(16), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(4)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, x*(S(3)*x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(30) - x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(4) + S(109)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(120)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(1) + sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(139)*sqrt(S(2)) + S(139))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(480)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(15)*sqrt(S(2)) + S(45))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(32)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(45)*sqrt(S(2))*x**S(2) + S(45))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(109)*sqrt(S(2))*x**S(2) + S(109))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(120)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(6) - S(7)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(12)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(-4) + S(17)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*(S(-2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(7)*sqrt(S(2))*x**S(2) + S(7))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(8), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(6) - S(7)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(12)*(sqrt(S(2))*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(3)*sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(1) + sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(7)*sqrt(S(2))*x**S(2) + S(7))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(15)*sqrt(S(2))*x**S(2) + S(15))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((S(-2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(24)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(12), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*x**S(2) + S(3)), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(2)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(24)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2))*x**S(2) + S(5))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(4)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(x**S(2)*(S(2)*x**S(2) + S(3))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*sqrt(S(2))*x**S(2) + S(3)) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((S(-6) + S(9)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(36)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(18) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(x**S(2)*(S(2)*x**S(2) + S(3))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*sqrt(S(2))*x**S(2) + S(3)) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(36)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2))*x**S(2) + S(5))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(6)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(18) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(x**S(4)*(S(2)*x**S(2) + S(3))), x), x, -S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(18)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(5)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(27)*sqrt(S(2)) + S(18))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(15))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(54)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(27) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(9)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(x**S(6)*(S(2)*x**S(2) + S(3))), x), x, S(4)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(45)*sqrt(S(2))*x**S(2) + S(45)) - S(4)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(45)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(10)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(81)*sqrt(S(2)) + S(54))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(2)*sqrt(S(2)) + S(19))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(135)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(5)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(27)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(5)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(243)*sqrt(S(2)) + S(162))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(81) - S(4)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(45)*x) + S(4)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(135)*x**S(3)) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(15)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(d + e*x**S(2)), x), x, -b*(b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(32)*c**S(2)*e) + S(3)*b*(b + S(2)*c*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(256)*c**S(3)*e) - S(3)*b*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*c**(S(7)/2)*e) + d**S(2)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*e**S(3)) + d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(6)) + d**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*(b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(2)*c*e*x**S(2)*(-b*e + S(2)*c*d) - S(2)*c*e*(-S(4)*a*e + S(5)*b*d))/(S(16)*c*e**S(5)) - d*(b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(16)*c*e**S(2)) + (a + b*x**S(2) + c*x**S(4))**(S(5)/2)/(S(10)*c*e) + d*(b + S(2)*c*x**S(2))*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(128)*c**S(2)*e**S(2)) - d**S(2)*(-b*e + S(2)*c*d)*(-b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(4)*c*e*(-S(3)*a*e + S(2)*b*d))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)*e**S(6)) - S(3)*d*(-S(4)*a*c + b**S(2))**S(2)*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(5)/2)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(d + e*x**S(2)), x), x, -d*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(5)) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)*(-S(3)*b*e + S(8)*c*d - S(6)*c*e*x**S(2))/(S(48)*c*e**S(2)) - sqrt(a + b*x**S(2) + c*x**S(4))*(S(3)*b**S(3)*e**S(3) + S(4)*b*c*e**S(2)*(-S(3)*a*e + S(2)*b*d) + S(64)*c**S(3)*d**S(3) - S(16)*c**S(2)*d*e*(-S(4)*a*e + S(5)*b*d) - S(2)*c*e*x**S(2)*(-S(3)*b**S(2)*e**S(2) + S(16)*c**S(2)*d**S(2) - S(4)*c*e*(-S(3)*a*e + S(2)*b*d)))/(S(128)*c**S(2)*e**S(4)) + (S(3)*b**S(4)*e**S(4) + S(8)*b**S(2)*c*e**S(3)*(-S(3)*a*e + b*d) + S(128)*c**S(4)*d**S(4) - S(192)*c**S(3)*d**S(2)*e*(-a*e + b*d) + S(48)*c**S(2)*e**S(2)*(-a*e + b*d)**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(5)/2)*e**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(d + e*x**S(2)), x), x, (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(6)*e) + (a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(4)) + sqrt(a + b*x**S(2) + c*x**S(4))*(b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(2)*c*e*x**S(2)*(-b*e + S(2)*c*d) - S(2)*c*e*(-S(4)*a*e + S(5)*b*d))/(S(16)*c*e**S(3)) - (-b*e + S(2)*c*d)*(-b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(4)*c*e*(-S(3)*a*e + S(2)*b*d))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(x*(d + e*x**S(2))), x), x, -a**(S(3)/2)*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*d) + a*b*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*d) + a*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*d) - sqrt(a + b*x**S(2) + c*x**S(4))*(S(4)*c*d**S(2) - S(2)*c*d*e*x**S(2) - e*(-S(4)*a*e + S(5)*b*d))/(S(8)*d*e**S(2)) - (a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d*e**S(3)) + (b*e**S(2)*(-S(4)*a*e + S(3)*b*d) + S(8)*c**S(2)*d**S(3) - S(12)*c*d*e*(-a*e + b*d))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(c)*d*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(x**S(3)*(d + e*x**S(2))), x), x, a**(S(3)/2)*e*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*d**S(2)) - S(3)*sqrt(a)*b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*d) + b*e*(-S(12)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)*d**S(2)) + (S(9)*b + S(6)*c*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(8)*d) - (a + b*x**S(2) + c*x**S(4))**(S(3)/2)/(S(2)*d*x**S(2)) + (a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d**S(2)*e**S(2)) - e*sqrt(a + b*x**S(2) + c*x**S(4))*(S(8)*a*c + b**S(2) + S(2)*b*c*x**S(2))/(S(16)*c*d**S(2)) + sqrt(a + b*x**S(2) + c*x**S(4))*(b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(2)*c*e*x**S(2)*(-b*e + S(2)*c*d) - S(2)*c*e*(-S(4)*a*e + S(5)*b*d))/(S(16)*c*d**S(2)*e) + (S(12)*a*c + S(3)*b**S(2))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*sqrt(c)*d) - (-b*e + S(2)*c*d)*(-b**S(2)*e**S(2) + S(8)*c**S(2)*d**S(2) - S(4)*c*e*(-S(3)*a*e + S(2)*b*d))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(32)*c**(S(3)/2)*d**S(2)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(-S(2)*x**S(2) + S(3)), x), x, -S(27)*x**S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(70) - x*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/S(14) - S(213)*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(140) - S(2211)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(280)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(1542) + S(8151)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(280)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(32)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(2211)*sqrt(S(2))*x**S(2) + S(2211))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(280)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(16), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(-S(2)*x**S(2) + S(3)), x), x, -S(3)*x*(x**S(2) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(35) - x*(S(3)*x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(10) - x*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/S(14) - S(5)*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(4) - S(6)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(35)*sqrt(S(2))*x**S(2) + S(35)) - S(309)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(40)*(sqrt(S(2))*x**S(2) + S(1))) + S(6)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(35)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(51)*sqrt(S(2)) + S(255))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(32)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5) + S(5)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(6)*sqrt(S(2)) + S(9))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(140)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(32)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(309)*sqrt(S(2))*x**S(2) + S(309))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(867)*sqrt(S(2))*x**S(2) + S(867))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(-S(2)*x**S(2) + S(3)), x), x, -x**S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(5) - S(9)*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(10) - S(103)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(20)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(66) + S(383)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(48)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(103)*sqrt(S(2))*x**S(2) + S(103))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(24), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(-S(2)*x**S(2) + S(3)), x), x, -x*(S(3)*x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(15) - S(5)*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(6) - S(103)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(20)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(17)*sqrt(S(2)) + S(85))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5) + S(5)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(60)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(48)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(103)*sqrt(S(2))*x**S(2) + S(103))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(289)*sqrt(S(2))*x**S(2) + S(289))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(24), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(x**S(2)*(-S(2)*x**S(2) + S(3))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*sqrt(S(2))*x**S(2) + S(3)) - S(17)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(6)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(17)*sqrt(S(2)) + S(85))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(24)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(6)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(72)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(17)*sqrt(S(2))*x**S(2) + S(17))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(6)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(289)*sqrt(S(2))*x**S(2) + S(289))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(36) - (x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(x**S(4)*(-S(2)*x**S(2) + S(3))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(9)*sqrt(S(2))*x**S(2) + S(9)) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(9)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(17)*sqrt(S(2)) + S(85))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(36)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(5)*sqrt(S(2)) + S(9))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(9)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(108)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(289)*sqrt(S(2))*x**S(2) + S(289))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(18)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(54) - S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/x - (-S(8)*x**S(2) + S(1))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(9)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)/(x**S(6)*(-S(2)*x**S(2) + S(3))), x), x, S(262)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(135)*sqrt(S(2))*x**S(2) + S(135)) - S(262)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(135)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(17)*sqrt(S(2)) + S(51))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(54)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(23)*sqrt(S(2)) + S(37))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(135)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(289)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((S(54) + S(81)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-S(289)*sqrt(S(2)) + S(867))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(S(1)/2 + S(11)*sqrt(S(2))/S(24), S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(162)*(S(2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(17)*sqrt(S(51))*atanh(sqrt(S(51))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(81) - S(262)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(135)*x) + S(74)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(135)*x**S(3)) - (S(40)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(45)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -b*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*c**(S(3)/2)*e) + d**S(2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e**S(2)*sqrt(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*c*e) - d*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(c)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -d*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e*sqrt(a*e**S(2) - b*d*e + c*d**S(2))) + atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(c)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*sqrt(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -e*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d*sqrt(a*e**S(2) - b*d*e + c*d**S(2))) - atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(d + e*x**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, e**S(2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d**S(2)*sqrt(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*a*d*x**S(2)) + e*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)*d**S(2)) + b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(3)/2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((S(2)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(4)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(4)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2)) + S(9))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(16)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(9)*sqrt(S(2))*x**S(2) + S(9))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(40), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((S(2)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))), x), x, S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(8)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(4)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(20), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(2)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))), x), x, -S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(2)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(30), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(S(2)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))), x), x, sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*sqrt(S(2))*x**S(2) + S(3)) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(9)*sqrt(S(2)) + S(6))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(6)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(18)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(45) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(S(2)*x**S(2) + S(3))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))), x), x, -S(2)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*sqrt(S(2))*x**S(2) + S(3)) + S(2)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(1) + S(2)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(18)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(9)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(27)*sqrt(S(2)) + S(18))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(81)*sqrt(S(2)) + S(54))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(135) + S(2)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(9)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -b*sqrt(a + b*x**S(2) + c*x**S(4))/(c*e*(-S(4)*a*c + b**S(2))) - d**S(3)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*e*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) + d**S(3)*(S(2)*a*c*e - b**S(2)*e + b*c*d + c*x**S(2)*(-b*e + S(2)*c*d))/(e**S(3)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) - d**S(2)*(b + S(2)*c*x**S(2))/(e**S(3)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - d*(S(2)*a + b*x**S(2))/(e**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + x**S(2)*(S(2)*a + b*x**S(2))/(e*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*c**(S(3)/2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, d**S(2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) - d**S(2)*(S(2)*a*c*e - b**S(2)*e + b*c*d + c*x**S(2)*(-b*e + S(2)*c*d))/(e**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) + d*(b + S(2)*c*x**S(2))/(e**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) + (S(2)*a + b*x**S(2))/(e*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -d*e*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) + (a*(-b*e + S(2)*c*d) + c*x**S(2)*(-S(2)*a*e + b*d))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, e**S(2)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) - (S(2)*a*c*e - b**S(2)*e + b*c*d + c*x**S(2)*(-b*e + S(2)*c*d))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, -e**S(3)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) + e*(S(2)*a*c*e - b**S(2)*e + b*c*d + c*x**S(2)*(-b*e + S(2)*c*d))/(d*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) + (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*d*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*a**(S(3)/2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))**(S(3)/2)), x), x, e**S(4)*atanh((-S(2)*a*e + b*d + x**S(2)*(-b*e + S(2)*c*d))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(2) - b*d*e + c*d**S(2))))/(S(2)*d**S(2)*(a*e**S(2) - b*d*e + c*d**S(2))**(S(3)/2)) - e**S(2)*(S(2)*a*c*e - b**S(2)*e + b*c*d + c*x**S(2)*(-b*e + S(2)*c*d))/(d**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(2) - b*d*e + c*d**S(2))) + (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*d*x**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - e*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*d**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - (-S(8)*a*c + S(3)*b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))/(S(2)*a**S(2)*d*x**S(2)*(-S(4)*a*c + b**S(2))) + e*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*a**(S(3)/2)*d**S(2)) + S(3)*b*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(5)/2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, x**S(3)*(-S(2)*x**S(2) + S(1))/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/S(20) + sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(20)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(7))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(27)*sqrt(S(2)) + S(81))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(160)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(9)*sqrt(S(2))*x**S(2) + S(9))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(27)*sqrt(S(2))*x**S(2) + S(27))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(160)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(81)*sqrt(S(2))*x**S(2) + S(81))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(27)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(400), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, x*(-S(2)*x**S(2) + S(1))/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(20)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(9)*sqrt(S(2)) + S(27))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(9)*sqrt(S(2))*x**S(2) + S(9))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(80)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(27)*sqrt(S(2))*x**S(2) + S(27))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(9)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(200), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, -x*(x**S(2) + S(2))/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(20)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2)) + S(9))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(9)*sqrt(S(2))*x**S(2) + S(9))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(100), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, x*(S(4)*x**S(2) + S(3))/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(5)*sqrt(S(2))*x**S(2) + S(5)) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(5)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(1) + S(2)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(40)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(10)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(50), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, -x*(S(3)*x**S(2) + S(1))/(S(5)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(10)*(sqrt(S(2))*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(4)*(S(-2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(30)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(75), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/((S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, -x*(S(3)*x**S(2) + S(1))/(S(5)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(3)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(10)*(sqrt(S(2))*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(15)*sqrt(S(2)) + S(10))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(30)*(-S(3)*sqrt(S(2)) + S(2))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(3)*sqrt(S(2))*x**S(2) + S(3))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(20)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(75), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, S(2)*x*(S(3)*x**S(2) + S(1))/(S(15)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(15)*sqrt(S(2))*x**S(2) + S(15)) - S(2)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(15)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(S(-7) + S(3)*sqrt(S(2)))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(6)*(S(-2) + S(3)*sqrt(S(2)))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(135)*sqrt(S(2)) + S(90))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(225) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(2)*(S(2)*x**S(2) + S(3))*(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, S(2)*x*(S(3)*x**S(2) + S(1))/(S(15)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)*sqrt(S(2))*x*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(15)*sqrt(S(2))*x**S(2) + S(15)) - S(2)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_e(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(15)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(10)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(15)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) + S(2)*S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(45)*sqrt(S(2)) + S(30))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(3)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(-sqrt(S(2)) + S(1))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_f(S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/(S(12)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)**(S(1)/4)*sqrt((S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(sqrt(S(2))*x**S(2) + S(1))**S(2))*(sqrt(S(2)) + S(3))*(sqrt(S(2))*x**S(2) + S(1))*elliptic_pi(-S(11)*sqrt(S(2))/S(24) + S(1)/2, S(2)*atan(S(2)**(S(1)/4)*x), -sqrt(S(2))/S(4) + S(1)/2)/((-S(135)*sqrt(S(2)) + S(90))*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))) - S(2)*sqrt(S(15))*atan(sqrt(S(15))*x/(S(3)*sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))))/S(225) - sqrt(S(2)*x**S(4) + S(2)*x**S(2) + S(1))/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, (d + e*x**S(2))**(S(5)/2)/(S(5)*c*e**S(2)) - (d + e*x**S(2))**(S(3)/2)*(b*e + c*d)/(S(3)*c**S(2)*e**S(2)) + sqrt(d + e*x**S(2))*(-a*c + b**S(2))/c**S(3) - sqrt(S(2))*(S(2)*a*b*c*e - a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d + (-S(2)*a**S(2)*c**S(2)*e + S(4)*a*b**S(2)*c*e - S(3)*a*b*c**S(2)*d - b**S(4)*e + b**S(3)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(7)/2)*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - sqrt(S(2))*(S(2)*a*b*c*e - a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d - (-S(2)*a**S(2)*c**S(2)*e + S(4)*a*b**S(2)*c*e - S(3)*a*b*c**S(2)*d - b**S(4)*e + b**S(3)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(7)/2)*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -b*sqrt(d + e*x**S(2))/c**S(2) + (d + e*x**S(2))**(S(3)/2)/(S(3)*c*e) + sqrt(S(2))*(a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(5)/2)*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + sqrt(S(2))*(a*c*e - b**S(2)*e + b*c*d - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(5)/2)*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(d + e*x**S(2))/c - sqrt(S(2))*(S(2)*a*c*e - b**S(2)*e + b*c*d + sqrt(-S(4)*a*c + b**S(2))*(-b*e + c*d))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + sqrt(S(2))*(S(2)*a*c*e - b**S(2)*e + b*c*d - sqrt(-S(4)*a*c + b**S(2))*(-b*e + c*d))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(-S(2)*a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + sqrt(S(2))*sqrt(c)*(-S(2)*a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - sqrt(d)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(x**S(5)*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(d + e*x**S(2))/(S(4)*a*x**S(4)) + S(3)*e*sqrt(d + e*x**S(2))/(S(8)*a*d*x**S(2)) - S(3)*e**S(2)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/(S(8)*a*d**(S(3)/2)) + sqrt(d + e*x**S(2))*(-a*e + b*d)/(S(2)*a**S(2)*d*x**S(2)) - e*(-a*e + b*d)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/(S(2)*a**S(2)*d**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-a*b*(S(3)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) + a*c*(S(2)*a*e + d*sqrt(-S(4)*a*c + b**S(2))) + b**S(3)*d - b**S(2)*(a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a**S(3)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + sqrt(S(2))*sqrt(c)*(-a*b*(S(3)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) - a*c*(-S(2)*a*e + d*sqrt(-S(4)*a*c + b**S(2))) + b**S(3)*d + b**S(2)*(-a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a**S(3)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - (-a*b*e - a*c*d + b**S(2)*d)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/(a**S(3)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, x*sqrt(d + e*x**S(2))/(S(2)*c) - (a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - (a*c*e - b**S(2)*e + b*c*d - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + (-S(2)*b*e + c*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(2)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(e)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/c + (-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + (-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -c*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - sqrt(d + e*x**S(2))/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(x**S(4)*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(d + e*x**S(2))/(S(3)*a*x**S(3)) + S(2)*e*sqrt(d + e*x**S(2))/(S(3)*a*d*x) + c*(-a*e + b*d - (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + c*(-a*e + b*d + (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + sqrt(d + e*x**S(2))*(-a*e + b*d)/(a**S(2)*d*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(2))/(x**S(6)*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(d + e*x**S(2))/(S(5)*a*x**S(5)) + S(4)*e*sqrt(d + e*x**S(2))/(S(15)*a*d*x**S(3)) - S(8)*e**S(2)*sqrt(d + e*x**S(2))/(S(15)*a*d**S(2)*x) + sqrt(d + e*x**S(2))*(-a*e + b*d)/(S(3)*a**S(2)*d*x**S(3)) - S(2)*e*sqrt(d + e*x**S(2))*(-a*e + b*d)/(S(3)*a**S(2)*d**S(2)*x) - c*(-a*b*e - a*c*d + b**S(2)*d - (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(-a*b*e - a*c*d + b**S(2)*d + (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - sqrt(d + e*x**S(2))*(-a*b*e - a*c*d + b**S(2)*d)/(a**S(3)*d*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(2))**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, (d + e*x**S(2))**(S(3)/2)/(S(3)*c) + sqrt(d + e*x**S(2))*(-b*e + c*d)/c**S(2) - sqrt(S(2))*(b**S(3)*e**S(2) - b**S(2)*e*(S(2)*c*d - e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(c*d**S(2) - e*(S(3)*a*e + S(2)*d*sqrt(-S(4)*a*c + b**S(2)))) - c*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) - c*d*(S(4)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(5)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + sqrt(S(2))*(b**S(3)*e**S(2) - b**S(2)*e*(S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))) + b*c*(c*d**S(2) + e*(-S(3)*a*e + S(2)*d*sqrt(-S(4)*a*c + b**S(2)))) + c*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) - c*d*(-S(4)*a*e + d*sqrt(-S(4)*a*c + b**S(2)))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(5)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, e*sqrt(d + e*x**S(2))/c + sqrt(S(2))*(b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - sqrt(S(2))*(b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(x*(a + b*x**S(2) + c*x**S(4))), x), x, -d**(S(3)/2)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/a - sqrt(S(2))*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) + b*(a*e**S(2) + c*d**S(2)) - c*d*(S(4)*a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - sqrt(S(2))*(a*e**S(2)*sqrt(-S(4)*a*c + b**S(2)) - b*(a*e**S(2) + c*d**S(2)) - c*d*(-S(4)*a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, sqrt(d)*e*atanh(sqrt(d + e*x**S(2))/sqrt(d))/(S(2)*a) - d*sqrt(d + e*x**S(2))/(S(2)*a*x**S(2)) + sqrt(S(2))*sqrt(c)*(-S(2)*a*(c*d**S(2) - e*(a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(2)*d**S(2) - b*d*(S(2)*a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - sqrt(S(2))*sqrt(c)*(-S(2)*a*(c*d**S(2) + e*(-a*e + d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(2)*d**S(2) + b*d*(-S(2)*a*e + d*sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(d + e*x**S(2))/sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + sqrt(d)*(-S(2)*a*e + b*d)*atanh(sqrt(d + e*x**S(2))/sqrt(d))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(d + e*x**S(2))**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, x*(d + e*x**S(2))**(S(3)/2)/(S(4)*c) + d*(-S(4)*b*e + S(3)*c*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(8)*c**S(2)*sqrt(e)) + x*sqrt(d + e*x**S(2))*(-S(4)*b*e + S(3)*c*d)/(S(8)*c**S(2)) - sqrt(e)*(a*c*e - b**S(2)*e + b*c*d - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(3)) - sqrt(e)*(a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(3)) - sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*c**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*c*e - b**S(2)*e + b*c*d - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*c**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, d*sqrt(e)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c) + e*x*sqrt(d + e*x**S(2))/(S(2)*c) + sqrt(e)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(2)) + sqrt(e)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(2)) + sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*c**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*c**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(e)*(S(3)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) - sqrt(e)*(S(3)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) - (b*e**S(2)*(b + sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d + d*sqrt(-S(4)*a*c + b**S(2))))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + (b*e**S(2)*(b - sqrt(-S(4)*a*c + b**S(2))) + S(2)*c**S(2)*d**S(2) - S(2)*c*e*(a*e + b*d - d*sqrt(-S(4)*a*c + b**S(2))))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, (S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))) - (S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/((b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/2)*sqrt(-S(4)*a*c + b**S(2))) - d*sqrt(d + e*x**S(2))/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(2))**(S(3)/2)/(x**S(4)*(a + b*x**S(2) + c*x**S(4))), x), x, -(d + e*x**S(2))**(S(3)/2)/(S(3)*a*x**S(3)) - sqrt(e)*(-a*e + b*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/a**S(2) + sqrt(e)*(-a*e + b*d - (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*a**S(2)) + sqrt(e)*(-a*e + b*d + (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*a**S(2)) + sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(-a*e + b*d - (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(-a*e + b*d + (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(S(2)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) + sqrt(d + e*x**S(2))*(-a*e + b*d)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, -b*sqrt(-x**S(2) + S(1))/c**S(2) - (-x**S(2) + S(1))**(S(3)/2)/(S(3)*c) + sqrt(S(2))*(-a*c + b**S(2) + b*c + (-S(3)*a*b*c - S(2)*a*c**S(2) + b**S(3) + b**S(2)*c)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-a*c + b**S(2) + b*c - (-S(3)*a*b*c - S(2)*a*c**S(2) + b**S(3) + b**S(2)*c)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, sqrt(-x**S(2) + S(1))/c - sqrt(S(2))*(b + c - (-S(2)*a*c + b**S(2) + b*c)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + c + (-S(2)*a*c + b**S(2) + b*c)/sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/(x*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(S(2))*sqrt(c)*(S(2)*a + b - sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*sqrt(c)*(S(2)*a + b + sqrt(-S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))) - atanh(sqrt(-x**S(2) + S(1)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, S(1)/(S(4)*a*(sqrt(-x**S(2) + S(1)) + S(1))) - S(1)/(S(4)*a*(-sqrt(-x**S(2) + S(1)) + S(1))) + sqrt(S(2))*sqrt(c)*(a*(b - S(2)*c - sqrt(-S(4)*a*c + b**S(2))) + b*(b - sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(a*(b - S(2)*c + sqrt(-S(4)*a*c + b**S(2))) + b*(b + sqrt(-S(4)*a*c + b**S(2))))*atanh(sqrt(S(2))*sqrt(c)*sqrt(-x**S(2) + S(1))/sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))) + (a + S(2)*b)*atanh(sqrt(-x**S(2) + S(1)))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, x*sqrt(-x**S(2) + S(1))/(S(2)*c) + (S(2)*b + c)*asin(x)/(S(2)*c**S(2)) - (-a*c + b**S(2) + b*c + (-S(3)*a*b*c - S(2)*a*c**S(2) + b**S(3) + b**S(2)*c)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(c**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) - (-a*c + b**S(2) + b*c - (-S(3)*a*b*c - S(2)*a*c**S(2) + b**S(3) + b**S(2)*c)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(c**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, -asin(x)/c + (b + c + (-S(2)*a*c + b**S(2) + b*c)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) + (b + c - (-S(2)*a*c + b**S(2) + b*c)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -c*(-(S(2)*a + b)/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c + sqrt(-S(4)*a*c + b**S(2)))) - c*((S(2)*a + b)/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-x**S(2) + S(1))))/(a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(b + S(2)*c - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(-x**S(2) + S(1))/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(-x**S(2) + S(1))/(x**S(4) + x**S(2) + S(-1)), x), x, -asin(x) + sqrt(S(2)/5 + sqrt(S(5))/S(5))*atan(x*sqrt(S(1)/2 + sqrt(S(5))/S(2))/sqrt(-x**S(2) + S(1))) - sqrt(S(-2)/5 + sqrt(S(5))/S(5))*atanh(x*sqrt(S(-1)/2 + sqrt(S(5))/S(2))/sqrt(-x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, b*d*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c**S(2)*e**(S(3)/2)) - b*x*sqrt(d + e*x**S(2))/(S(2)*c**S(2)*e) + S(3)*d**S(2)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(8)*c*e**(S(5)/2)) - S(3)*d*x*sqrt(d + e*x**S(2))/(S(8)*c*e**S(2)) + x**S(3)*sqrt(d + e*x**S(2))/(S(4)*c*e) - (-S(2)*a*b*c + b**S(3) + (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - (-S(2)*a*b*c + b**S(3) - (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + (-a*c + b**S(2))*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c**S(3)*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -b*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c**S(2)*sqrt(e)) - d*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(S(2)*c*e**(S(3)/2)) + x*sqrt(d + e*x**S(2))/(S(2)*c*e) + (-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + (-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c*sqrt(e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)*c*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + S(2)*c*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -c*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - sqrt(d + e*x**S(2))/(a*d*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(d + e*x**S(2))/(S(3)*a*d*x**S(3)) + S(2)*e*sqrt(d + e*x**S(2))/(S(3)*a*d**S(2)*x) + b*sqrt(d + e*x**S(2))/(a**S(2)*d*x) + c*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + c*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(6)*sqrt(d + e*x**S(2))*(a + b*x**S(2) + c*x**S(4))), x), x, -sqrt(d + e*x**S(2))/(S(5)*a*d*x**S(5)) + S(4)*e*sqrt(d + e*x**S(2))/(S(15)*a*d**S(2)*x**S(3)) - S(8)*e**S(2)*sqrt(d + e*x**S(2))/(S(15)*a*d**S(3)*x) + b*sqrt(d + e*x**S(2))/(S(3)*a**S(2)*d*x**S(3)) - S(2)*b*e*sqrt(d + e*x**S(2))/(S(3)*a**S(2)*d**S(2)*x) - c*(-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - sqrt(d + e*x**S(2))*(-a*c + b**S(2))/(a**S(3)*d*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -d**S(2)*x/(e*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + (-S(2)*a*c + S(2)*b**S(2) + S(2)*b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) + (-S(2)*a*c + S(2)*b**S(2) - S(2)*b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) + atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c*e**(S(3)/2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(6)/((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -d**S(2)*x/(e*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + d**S(2)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(e**(S(3)/2)*(a*e**S(2) - b*d*e + c*d**S(2))) + (-a*b*e - a*c*d + b**S(2)*d + (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) + (-a*b*e - a*c*d + b**S(2)*d - (S(2)*a**S(2)*c*e - a*b**S(2)*e - S(3)*a*b*c*d + b**S(3)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(c*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - (-a*e + b*d)*atanh(sqrt(e)*x/sqrt(d + e*x**S(2)))/(c*sqrt(e)*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, d*x/(sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - (-a*e + b*d + (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - (-a*e + b*d - (-a*b*e - S(2)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, c*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) + c*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - e*x/(sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -c*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - c*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) + e**S(2)*x/(d*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(2)*c**S(2)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) - S(2)*c**S(2)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) + e*x*(-b*e + c*d)/(a*d*sqrt(d + e*x**S(2))*(c*d**S(2) + e*(a*e - b*d))) + (-d - S(2)*e*x**S(2))/(a*d**S(2)*x*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(2)*(d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -e**S(2)/(d*x*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - S(2)*e**S(3)*x/(d**S(2)*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - c*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - c*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(d + e*x**S(2))*(-b*e + c*d)/(a*d*x*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -S(1)/(S(3)*a*d*x**S(3)*sqrt(d + e*x**S(2))) + S(2)*c**S(2)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) + S(2)*c**S(2)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))**(S(3)/2)) - e*x*(a*c*e - b**S(2)*e + b*c*d)/(a**S(2)*d*sqrt(d + e*x**S(2))*(c*d**S(2) + e*(a*e - b*d))) + (S(4)*a*e + S(3)*b*d)/(S(3)*a**S(2)*d**S(2)*x*sqrt(d + e*x**S(2))) + S(2)*e*x*(S(4)*a*e + S(3)*b*d)/(S(3)*a**S(2)*d**S(3)*sqrt(d + e*x**S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(4)*(d + e*x**S(2))**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))), x), x, -e**S(2)/(S(3)*d*x**S(3)*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + S(4)*e**S(3)/(S(3)*d**S(2)*x*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) + S(8)*e**S(4)*x/(S(3)*d**S(3)*sqrt(d + e*x**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))) - sqrt(d + e*x**S(2))*(-b*e + c*d)/(S(3)*a*d*x**S(3)*(a*e**S(2) - b*d*e + c*d**S(2))) + S(2)*e*sqrt(d + e*x**S(2))*(-b*e + c*d)/(S(3)*a*d**S(2)*x*(a*e**S(2) - b*d*e + c*d**S(2))) + c*(a*c*e - b**S(2)*e + b*c*d - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) + c*(a*c*e - b**S(2)*e + b*c*d + (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(x*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(d + e*x**S(2))))/(a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))*(a*e**S(2) - b*d*e + c*d**S(2))) + sqrt(d + e*x**S(2))*(a*c*e - b**S(2)*e + b*c*d)/(a**S(2)*d*x*(a*e**S(2) - b*d*e + c*d**S(2))), expand=True, _diff=True, _numerical=True) # '''Apart # assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*c*(f*x)**(m + S(1))*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(m/S(2) + S(1)/2, S(1), -q, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(f*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*(f*x)**(m + S(1))*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(m/S(2) + S(1)/2, S(1), -q, m/S(2) + S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(f*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(x**S(7)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, (d + e*x**S(2))**(q + S(1))*(a - b**S(2)/c - b*(-S(3)*a*c + b**S(2))/(c*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c*(q + S(1))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + (d + e*x**S(2))**(q + S(1))*(a - b**S(2)/c + b*(-S(3)*a*c + b**S(2))/(c*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c*(q + S(1))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + (d + e*x**S(2))**(q + S(2))/(S(2)*c*e**S(2)*(q + S(2))) - (d + e*x**S(2))**(q + S(1))*(b*e + c*d)/(S(2)*c**S(2)*e**S(2)*(q + S(1))), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(x**S(5)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, (b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c*(q + S(1))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) + (b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*c*(q + S(1))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + (d + e*x**S(2))**(q + S(1))/(S(2)*c*e*(q + S(1))), expand=True, _diff=True, _numerical=True) # assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -(d + e*x**S(2))**(q + S(1))*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/((q + S(1))*(S(4)*c*d - S(2)*e*(b - sqrt(-S(4)*a*c + b**S(2))))) - (d + e*x**S(2))**(q + S(1))*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/((q + S(1))*(S(4)*c*d - S(2)*e*(b + sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate(x*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, c*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/((q + S(1))*sqrt(-S(4)*a*c + b**S(2))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/((q + S(1))*sqrt(-S(4)*a*c + b**S(2))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(2))**q/(x*(a + b*x**S(2) + c*x**S(4))), x), x, c*(d + e*x**S(2))**(q + S(1))*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a*(q + S(1))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + c*(d + e*x**S(2))**(q + S(1))*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*(q + S(1))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - (d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(1) + e*x**S(2)/d)/(S(2)*a*d*(q + S(1))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(2))**q/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, e*(d + e*x**S(2))**(q + S(1))*hyper((S(2), q + S(1)), (q + S(2),), S(1) + e*x**S(2)/d)/(S(2)*a*d**S(2)*(q + S(1))) + b*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(1) + e*x**S(2)/d)/(S(2)*a**S(2)*d*(q + S(1))) - c*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(S(2)*a**S(2)*(q + S(1))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) - c*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**S(2))/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*(q + S(1))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate(x**S(6)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -b*x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(1)/2, -q), (S(3)/2,), -e*x**S(2)/d)/c**S(2) + x**S(3)*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(3)/2, -q), (S(5)/2,), -e*x**S(2)/d)/(S(3)*c) + x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*(-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(c**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*(-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(c**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate(x**S(4)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -x*(S(1) + e*x**S(2)/d)**(-q)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(c*(b - sqrt(-S(4)*a*c + b**S(2)))) - x*(S(1) + e*x**S(2)/d)**(-q)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(c*(b + sqrt(-S(4)*a*c + b**S(2)))) + x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(1)/2, -q), (S(3)/2,), -e*x**S(2)/d)/c, expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/sqrt(-S(4)*a*c + b**S(2)) + x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(2))**q/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*c*x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(2))**q/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -c*x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(a*(b + sqrt(-S(4)*a*c + b**S(2)))) - c*x*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(a*(b - sqrt(-S(4)*a*c + b**S(2)))) - (S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(-1)/2, -q), (S(1)/2,), -e*x**S(2)/d)/(a*x), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(2))**q/(x**S(4)*(a + b*x**S(2) + c*x**S(4))), x), x, -(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(-3)/2, -q), (S(-1)/2,), -e*x**S(2)/d)/(S(3)*a*x**S(3)) + b*(S(1) + e*x**S(2)/d)**(-q)*(d + e*x**S(2))**q*hyper((S(-1)/2, -q), (S(1)/2,), -e*x**S(2)/d)/(a**S(2)*x) + c*x*(S(1) + e*x**S(2)/d)**(-q)*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(a**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))) + c*x*(S(1) + e*x**S(2)/d)**(-q)*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*(d + e*x**S(2))**q*AppellF1(S(1)/2, S(1), -q, S(3)/2, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**S(2)/d)/(a**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(3))/(a + c*x**S(6)), x), x, -(sqrt(c)*d - e*sqrt(-a))*log(c**(S(1)/6)*x + (-a)**(S(1)/6))/(S(6)*c**(S(2)/3)*(-a)**(S(5)/6)) + (sqrt(c)*d - e*sqrt(-a))*log(-c**(S(1)/6)*x*(-a)**(S(1)/6) + c**(S(1)/3)*x**S(2) + (-a)**(S(1)/3))/(S(12)*c**(S(2)/3)*(-a)**(S(5)/6)) + sqrt(S(3))*(sqrt(c)*d - e*sqrt(-a))*atan(sqrt(S(3))*(-S(2)*c**(S(1)/6)*x/(-a)**(S(1)/6) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(-a)**(S(5)/6)) + (sqrt(c)*d + e*sqrt(-a))*log(-c**(S(1)/6)*x + (-a)**(S(1)/6))/(S(6)*c**(S(2)/3)*(-a)**(S(5)/6)) - (sqrt(c)*d + e*sqrt(-a))*log(c**(S(1)/6)*x*(-a)**(S(1)/6) + c**(S(1)/3)*x**S(2) + (-a)**(S(1)/3))/(S(12)*c**(S(2)/3)*(-a)**(S(5)/6)) - sqrt(S(3))*(sqrt(c)*d + e*sqrt(-a))*atan(sqrt(S(3))*(S(2)*c**(S(1)/6)*x/(-a)**(S(1)/6) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(-a)**(S(5)/6)), expand=True, _diff=True, _numerical=True) # NC assert rubi_test(rubi_integrate((d + e*x**S(3))/(a - c*x**S(6)), x), x, (-sqrt(a)*e + sqrt(c)*d)*log(a**(S(1)/6) + c**(S(1)/6)*x)/(S(6)*a**(S(5)/6)*c**(S(2)/3)) - (-sqrt(a)*e + sqrt(c)*d)*log(-a**(S(1)/6)*c**(S(1)/6)*x + a**(S(1)/3) + c**(S(1)/3)*x**S(2))/(S(12)*a**(S(5)/6)*c**(S(2)/3)) - sqrt(S(3))*(-sqrt(a)*e + sqrt(c)*d)*atan(sqrt(S(3))*(a**(S(1)/6) - S(2)*c**(S(1)/6)*x)/(S(3)*a**(S(1)/6)))/(S(6)*a**(S(5)/6)*c**(S(2)/3)) - (sqrt(a)*e + sqrt(c)*d)*log(a**(S(1)/6) - c**(S(1)/6)*x)/(S(6)*a**(S(5)/6)*c**(S(2)/3)) + (sqrt(a)*e + sqrt(c)*d)*log(a**(S(1)/6)*c**(S(1)/6)*x + a**(S(1)/3) + c**(S(1)/3)*x**S(2))/(S(12)*a**(S(5)/6)*c**(S(2)/3)) + sqrt(S(3))*(sqrt(a)*e + sqrt(c)*d)*atan(sqrt(S(3))*(a**(S(1)/6) + S(2)*c**(S(1)/6)*x)/(S(3)*a**(S(1)/6)))/(S(6)*a**(S(5)/6)*c**(S(2)/3)), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((d + e*x**S(3))**S(5)*(a + b*x**S(3) + c*x**S(6)), x), x, a*d**S(5)*x + c*e**S(5)*x**S(22)/S(22) + d**S(4)*x**S(4)*(S(5)*a*e + b*d)/S(4) + d**S(3)*x**S(7)*(c*d**S(2) + S(5)*e*(S(2)*a*e + b*d))/S(7) + d**S(2)*e*x**S(10)*(c*d**S(2) + S(2)*e*(a*e + b*d))/S(2) + S(5)*d*e**S(2)*x**S(13)*(S(2)*c*d**S(2) + e*(a*e + S(2)*b*d))/S(13) + e**S(4)*x**S(19)*(b*e + S(5)*c*d)/S(19) + e**S(3)*x**S(16)*(S(10)*c*d**S(2) + e*(a*e + S(5)*b*d))/S(16), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((d + e*x**S(3))**S(4)*(a + b*x**S(3) + c*x**S(6)), x), x, a*d**S(4)*x + c*e**S(4)*x**S(19)/S(19) + d**S(3)*x**S(4)*(S(4)*a*e + b*d)/S(4) + d**S(2)*x**S(7)*(S(6)*a*e**S(2) + S(4)*b*d*e + c*d**S(2))/S(7) + d*e*x**S(10)*(S(2)*c*d**S(2) + e*(S(2)*a*e + S(3)*b*d))/S(5) + e**S(3)*x**S(16)*(b*e + S(4)*c*d)/S(16) + e**S(2)*x**S(13)*(S(6)*c*d**S(2) + e*(a*e + S(4)*b*d))/S(13), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((d + e*x**S(3))**S(3)*(a + b*x**S(3) + c*x**S(6)), x), x, a*d**S(3)*x + c*e**S(3)*x**S(16)/S(16) + d**S(2)*x**S(4)*(S(3)*a*e + b*d)/S(4) + d*x**S(7)*(c*d**S(2) + S(3)*e*(a*e + b*d))/S(7) + e**S(2)*x**S(13)*(b*e + S(3)*c*d)/S(13) + e*x**S(10)*(S(3)*c*d**S(2) + e*(a*e + S(3)*b*d))/S(10), expand=True, _diff=True, _numerical=True) # ncassert rubi_test(rubi_integrate((d + e*x**S(3))**S(2)*(a + b*x**S(3) + c*x**S(6)), x), x, a*d**S(2)*x + c*e**S(2)*x**S(13)/S(13) + d*x**S(4)*(S(2)*a*e + b*d)/S(4) + e*x**S(10)*(b*e + S(2)*c*d)/S(10) + x**S(7)*(c*d**S(2) + e*(a*e + S(2)*b*d))/S(7), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((d + e*x**S(3))*(a + b*x**S(3) + c*x**S(6)), x), x, a*d*x + c*e*x**S(10)/S(10) + x**S(7)*(b*e + c*d)/S(7) + x**S(4)*(a*e + b*d)/S(4), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3)), x), x, c*x**S(4)/(S(4)*e) - x*(-b*e + c*d)/e**S(2) + (a*e**S(2) - b*d*e + c*d**S(2))*log(d**(S(1)/3) + e**(S(1)/3)*x)/(S(3)*d**(S(2)/3)*e**(S(7)/3)) - (a*e**S(2) - b*d*e + c*d**S(2))*log(d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(S(6)*d**(S(2)/3)*e**(S(7)/3)) - sqrt(S(3))*(a*e**S(2) - b*d*e + c*d**S(2))*atan(sqrt(S(3))*(d**(S(1)/3) - S(2)*e**(S(1)/3)*x)/(S(3)*d**(S(1)/3)))/(S(3)*d**(S(2)/3)*e**(S(7)/3)), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**S(2), x), x, c*x/e**S(2) + x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(3)*d*e**S(2)*(d + e*x**S(3))) - (S(4)*c*d**S(2) - e*(S(2)*a*e + b*d))*log(d**(S(1)/3) + e**(S(1)/3)*x)/(S(9)*d**(S(5)/3)*e**(S(7)/3)) + (S(4)*c*d**S(2) - e*(S(2)*a*e + b*d))*log(d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(S(18)*d**(S(5)/3)*e**(S(7)/3)) + sqrt(S(3))*(S(4)*c*d**S(2) - e*(S(2)*a*e + b*d))*atan(sqrt(S(3))*(d**(S(1)/3) - S(2)*e**(S(1)/3)*x)/(S(3)*d**(S(1)/3)))/(S(9)*d**(S(5)/3)*e**(S(7)/3)), expand=True, _diff=True, _numerical=True) # nc assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**S(3), x), x, x*(a*e**S(2) - b*d*e + c*d**S(2))/(S(6)*d*e**S(2)*(d + e*x**S(3))**S(2)) - x*(S(7)*c*d**S(2) - e*(S(5)*a*e + b*d))/(S(18)*d**S(2)*e**S(2)*(d + e*x**S(3))) + (S(2)*c*d**S(2) + e*(S(5)*a*e + b*d))*log(d**(S(1)/3) + e**(S(1)/3)*x)/(S(27)*d**(S(8)/3)*e**(S(7)/3)) - (S(2)*c*d**S(2) + e*(S(5)*a*e + b*d))*log(d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(S(54)*d**(S(8)/3)*e**(S(7)/3)) - sqrt(S(3))*(S(2)*c*d**S(2) + e*(S(5)*a*e + b*d))*atan(sqrt(S(3))*(d**(S(1)/3) - S(2)*e**(S(1)/3)*x)/(S(3)*d**(S(1)/3)))/(S(27)*d**(S(8)/3)*e**(S(7)/3)), expand=True, _diff=True, _numerical=True) # ''' assert rubi_test(rubi_integrate(x**S(8)*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, e*x**S(6)/(S(6)*c) + x**S(3)*(-b*e + c*d)/(S(3)*c**S(2)) - (a*c*e - b**S(2)*e + b*c*d)*log(a + b*x**S(3) + c*x**S(6))/(S(6)*c**S(3)) - (S(3)*a*b*c*e - S(2)*a*c**S(2)*d - b**S(3)*e + b**S(2)*c*d)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, e*x**S(3)/(S(3)*c) + (-b*e + c*d)*log(a + b*x**S(3) + c*x**S(6))/(S(6)*c**S(2)) + (S(2)*a*c*e - b**S(2)*e + b*c*d)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, e*log(a + b*x**S(3) + c*x**S(6))/(S(6)*c) - (-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))/(x*(a + b*x**S(3) + c*x**S(6))), x), x, d*log(x)/a - d*log(a + b*x**S(3) + c*x**S(6))/(S(6)*a) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*a*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))/(x**S(4)*(a + b*x**S(3) + c*x**S(6))), x), x, -d/(S(3)*a*x**S(3)) - (-a*e + b*d)*log(x)/a**S(2) + (-a*e + b*d)*log(a + b*x**S(3) + c*x**S(6))/(S(6)*a**S(2)) - (-a*b*e - S(2)*a*c*d + b**S(2)*d)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, e*x**S(2)/(S(2)*c) - S(2)**(S(1)/3)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(5)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(5)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, e*x/c + S(2)**(S(2)/3)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, -S(2)**(S(1)/3)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, S(2)**(S(2)/3)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))/(x**S(2)*(a + b*x**S(3) + c*x**S(6))), x), x, S(2)**(S(1)/3)*c**(S(1)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*c**(S(1)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*c**(S(1)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*c**(S(1)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*c**(S(1)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - d/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))/(x**S(3)*(a + b*x**S(3) + c*x**S(6))), x), x, -S(2)**(S(2)/3)*c**(S(2)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*c**(S(2)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*c**(S(2)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*c**(S(2)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*c**(S(2)/3)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*a*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - d/(S(2)*a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -x**S(6)/S(6) + log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -x**S(3)/S(3) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(1))/(x*(x**S(6) - x**S(3) + S(1))), x), x, log(x) - log(x**S(6) - x**S(3) + S(1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(1))/(x**S(4)*(x**S(6) - x**S(3) + S(1))), x), x, S(2)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(9) - S(1)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -x**S(4)/S(4) + S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -x**S(2)/S(2) + sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3)) - sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3)) - I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -x + sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(2)/3)) - sqrt(S(3))*I*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(9)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*I*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 - sqrt(S(3))*I/S(2))**(S(2)/3)) + I*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(S(1)/2 + sqrt(S(3))*I/S(2))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(1))/(x**S(6) - x**S(3) + S(1)), x), x, -S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(1))/(x**S(2)*(x**S(6) - x**S(3) + S(1))), x), x, -S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(2)**(S(1)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(1)/3)) + S(2)**(S(1)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(1)/3)) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(1))/(x**S(3)*(x**S(6) - x**S(3) + S(1))), x), x, -S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) - sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(-S(2)**(S(1)/3)*x + (S(1) + sqrt(S(3))*I)**(S(1)/3))/(S(18)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) + sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) - S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) - sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(S(3) - sqrt(S(3))*I)*log(S(2)**(S(2)/3)*x**S(2) + x*(S(2) + S(2)*sqrt(S(3))*I)**(S(1)/3) + (S(1) + sqrt(S(3))*I)**(S(2)/3))/(S(36)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) + S(2)**(S(2)/3)*(sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 - sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) - sqrt(S(3))*I)**(S(2)/3)) - S(2)**(S(2)/3)*(-sqrt(S(3)) + I)*atan(sqrt(S(3))*(S(2)*x/(S(1)/2 + sqrt(S(3))*I/S(2))**(S(1)/3) + S(1))/S(3))/(S(6)*(S(1) + sqrt(S(3))*I)**(S(2)/3)) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(x**S(3) + S(-2))/(x**S(6) - x**S(3) + S(1)), x), x, log(x**S(6) - x**S(3) + S(1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x*(x**S(6) - x**S(3) + S(1))), x), x, log(x) - log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x**S(7) - x**S(4) + x), x), x, log(x) - log(x**S(6) - x**S(3) + S(1))/S(6) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(3) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))**(S(5)/2)*(a + b*x**S(3) + c*x**S(6)), x), x, S(2)*c*x**S(4)*(d + e*x**S(3))**(S(7)/2)/(S(29)*e) + S(54)*S(3)**(S(3)/4)*d**S(3)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(667)*a*e**S(2) - S(58)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(124729)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))) + S(54)*d**S(2)*x*sqrt(d + e*x**S(3))*(S(667)*a*e**S(2) - S(58)*b*d*e + S(16)*c*d**S(2))/(S(124729)*e**S(2)) + S(30)*d*x*(d + e*x**S(3))**(S(3)/2)*(S(667)*a*e**S(2) - S(58)*b*d*e + S(16)*c*d**S(2))/(S(124729)*e**S(2)) - x*(d + e*x**S(3))**(S(7)/2)*(-S(58)*b*e + S(16)*c*d)/(S(667)*e**S(2)) + x*(d + e*x**S(3))**(S(5)/2)*(S(1334)*a*e**S(2) - S(116)*b*d*e + S(32)*c*d**S(2))/(S(11339)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(3))**(S(3)/2)*(a + b*x**S(3) + c*x**S(6)), x), x, S(2)*c*x**S(4)*(d + e*x**S(3))**(S(5)/2)/(S(23)*e) + S(18)*S(3)**(S(3)/4)*d**S(2)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(391)*a*e**S(2) - S(46)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(21505)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))) + S(18)*d*x*sqrt(d + e*x**S(3))*(S(391)*a*e**S(2) - S(46)*b*d*e + S(16)*c*d**S(2))/(S(21505)*e**S(2)) - x*(d + e*x**S(3))**(S(5)/2)*(-S(46)*b*e + S(16)*c*d)/(S(391)*e**S(2)) + x*(d + e*x**S(3))**(S(3)/2)*(S(782)*a*e**S(2) - S(92)*b*d*e + S(32)*c*d**S(2))/(S(4301)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x**S(3))*(a + b*x**S(3) + c*x**S(6)), x), x, S(2)*c*x**S(4)*(d + e*x**S(3))**(S(3)/2)/(S(17)*e) + S(2)*S(3)**(S(3)/4)*d*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(187)*a*e**S(2) - S(34)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(935)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))) - x*(d + e*x**S(3))**(S(3)/2)*(-S(34)*b*e + S(16)*c*d)/(S(187)*e**S(2)) + x*sqrt(d + e*x**S(3))*(S(374)*a*e**S(2) - S(68)*b*d*e + S(32)*c*d**S(2))/(S(935)*e**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/sqrt(d + e*x**S(3)), x), x, S(2)*c*x**S(4)*sqrt(d + e*x**S(3))/(S(11)*e) - x*sqrt(d + e*x**S(3))*(-S(22)*b*e + S(16)*c*d)/(S(55)*e**S(2)) + S(2)*S(3)**(S(3)/4)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(55)*a*e**S(2) - S(22)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(165)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**(S(3)/2), x), x, S(2)*c*x*sqrt(d + e*x**S(3))/(S(5)*e**S(2)) + x*(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2))/(S(3)*d*e**S(2)*sqrt(d + e*x**S(3))) - S(2)*S(3)**(S(3)/4)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(16)*c*d**S(2) - S(5)*e*(a*e + S(2)*b*d))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(45)*d*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**(S(5)/2), x), x, x*(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2))/(S(9)*d*e**S(2)*(d + e*x**S(3))**(S(3)/2)) - x*(-S(14)*a*e**S(2) - S(4)*b*d*e + S(22)*c*d**S(2))/(S(27)*d**S(2)*e**S(2)*sqrt(d + e*x**S(3))) + S(2)*S(3)**(S(3)/4)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(16)*c*d**S(2) + e*(S(7)*a*e + S(2)*b*d))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(81)*d**S(2)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**(S(7)/2), x), x, x*(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2))/(S(15)*d*e**S(2)*(d + e*x**S(3))**(S(5)/2)) - x*(-S(26)*a*e**S(2) - S(4)*b*d*e + S(34)*c*d**S(2))/(S(135)*d**S(2)*e**S(2)*(d + e*x**S(3))**(S(3)/2)) + x*(S(182)*a*e**S(2) + S(28)*b*d*e + S(32)*c*d**S(2))/(S(405)*d**S(3)*e**S(2)*sqrt(d + e*x**S(3))) + S(2)*S(3)**(S(3)/4)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(91)*a*e**S(2) + S(14)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(1215)*d**S(3)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3) + c*x**S(6))/(d + e*x**S(3))**(S(9)/2), x), x, x*(S(2)*a*e**S(2) - S(2)*b*d*e + S(2)*c*d**S(2))/(S(21)*d*e**S(2)*(d + e*x**S(3))**(S(7)/2)) - x*(-S(38)*a*e**S(2) - S(4)*b*d*e + S(46)*c*d**S(2))/(S(315)*d**S(2)*e**S(2)*(d + e*x**S(3))**(S(5)/2)) + x*(S(494)*a*e**S(2) + S(52)*b*d*e + S(32)*c*d**S(2))/(S(2835)*d**S(3)*e**S(2)*(d + e*x**S(3))**(S(3)/2)) + x*(S(494)*a*e**S(2) + S(52)*b*d*e + S(32)*c*d**S(2))/(S(1215)*d**S(4)*e**S(2)*sqrt(d + e*x**S(3))) + S(2)*S(3)**(S(3)/4)*sqrt((d**(S(2)/3) - d**(S(1)/3)*e**(S(1)/3)*x + e**(S(2)/3)*x**S(2))/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(sqrt(S(3)) + S(2))*(d**(S(1)/3) + e**(S(1)/3)*x)*(S(247)*a*e**S(2) + S(26)*b*d*e + S(16)*c*d**S(2))*elliptic_f(asin((d**(S(1)/3)*(-sqrt(S(3)) + S(1)) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)), S(-7) - S(4)*sqrt(S(3)))/(S(3645)*d**S(4)*e**(S(7)/3)*sqrt(d**(S(1)/3)*(d**(S(1)/3) + e**(S(1)/3)*x)/(d**(S(1)/3)*(S(1) + sqrt(S(3))) + e**(S(1)/3)*x)**S(2))*sqrt(d + e*x**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(a + c*x**S(8)), x), x, sqrt(S(2))*(sqrt(c)*d - e*sqrt(-a))*log(-sqrt(S(2))*c**(S(1)/8)*x*(-a)**(S(1)/8) + c**(S(1)/4)*x**S(2) + (-a)**(S(1)/4))/(S(16)*c**(S(5)/8)*(-a)**(S(7)/8)) - sqrt(S(2))*(sqrt(c)*d - e*sqrt(-a))*log(sqrt(S(2))*c**(S(1)/8)*x*(-a)**(S(1)/8) + c**(S(1)/4)*x**S(2) + (-a)**(S(1)/4))/(S(16)*c**(S(5)/8)*(-a)**(S(7)/8)) - sqrt(S(2))*(sqrt(c)*d - e*sqrt(-a))*atan(sqrt(S(2))*c**(S(1)/8)*x/(-a)**(S(1)/8) + S(-1))/(S(8)*c**(S(5)/8)*(-a)**(S(7)/8)) - sqrt(S(2))*(sqrt(c)*d - e*sqrt(-a))*atan(sqrt(S(2))*c**(S(1)/8)*x/(-a)**(S(1)/8) + S(1))/(S(8)*c**(S(5)/8)*(-a)**(S(7)/8)) - (sqrt(c)*d + e*sqrt(-a))*atan(c**(S(1)/8)*x/(-a)**(S(1)/8))/(S(4)*c**(S(5)/8)*(-a)**(S(7)/8)) - (sqrt(c)*d + e*sqrt(-a))*atanh(c**(S(1)/8)*x/(-a)**(S(1)/8))/(S(4)*c**(S(5)/8)*(-a)**(S(7)/8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(a - c*x**S(8)), x), x, -sqrt(S(2))*(-sqrt(a)*e + sqrt(c)*d)*log(-sqrt(S(2))*a**(S(1)/8)*c**(S(1)/8)*x + a**(S(1)/4) + c**(S(1)/4)*x**S(2))/(S(16)*a**(S(7)/8)*c**(S(5)/8)) + sqrt(S(2))*(-sqrt(a)*e + sqrt(c)*d)*log(sqrt(S(2))*a**(S(1)/8)*c**(S(1)/8)*x + a**(S(1)/4) + c**(S(1)/4)*x**S(2))/(S(16)*a**(S(7)/8)*c**(S(5)/8)) - sqrt(S(2))*(-sqrt(a)*e + sqrt(c)*d)*atan(S(1) - sqrt(S(2))*c**(S(1)/8)*x/a**(S(1)/8))/(S(8)*a**(S(7)/8)*c**(S(5)/8)) + sqrt(S(2))*(-sqrt(a)*e + sqrt(c)*d)*atan(S(1) + sqrt(S(2))*c**(S(1)/8)*x/a**(S(1)/8))/(S(8)*a**(S(7)/8)*c**(S(5)/8)) + (sqrt(a)*e + sqrt(c)*d)*atan(c**(S(1)/8)*x/a**(S(1)/8))/(S(4)*a**(S(7)/8)*c**(S(5)/8)) + (sqrt(a)*e + sqrt(c)*d)*atanh(c**(S(1)/8)*x/a**(S(1)/8))/(S(4)*a**(S(7)/8)*c**(S(5)/8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(d + e*x**S(4))/(a + b*x**S(4) + c*x**S(8)), x), x, e*x/c - S(2)**(S(3)/4)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(-b*e + c*d - (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(-b*e + c*d + (S(2)*a*c*e - b**S(2)*e + b*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(d + e*x**S(4))/(a + b*x**S(4) + c*x**S(8)), x), x, e*log(a + b*x**S(4) + c*x**S(8))/(S(8)*c) - (-b*e + S(2)*c*d)*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*c*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**S(4))/(a + b*x**S(4) + c*x**S(8)), x), x, S(2)**(S(1)/4)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(3)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(4))/(a + b*x**S(4) + c*x**S(8)), x), x, sqrt(S(2))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(a + b*x**S(4) + c*x**S(8)), x), x, -S(2)**(S(3)/4)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - S(2)**(S(3)/4)*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(1)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(x*(a + b*x**S(4) + c*x**S(8))), x), x, d*log(x)/a - d*log(a + b*x**S(4) + c*x**S(8))/(S(8)*a) + (-S(2)*a*e + b*d)*atanh((b + S(2)*c*x**S(4))/sqrt(-S(4)*a*c + b**S(2)))/(S(4)*a*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(x**S(2)*(a + b*x**S(4) + c*x**S(8))), x), x, -S(2)**(S(1)/4)*c**(S(1)/4)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - S(2)**(S(1)/4)*c**(S(1)/4)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) + S(2)**(S(1)/4)*c**(S(1)/4)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4)) - d/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(x**S(3)*(a + b*x**S(4) + c*x**S(8))), x), x, -sqrt(S(2))*sqrt(c)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x**S(2)/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - d/(S(2)*a*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**S(4))/(x**S(4)*(a + b*x**S(4) + c*x**S(8))), x), x, S(2)**(S(3)/4)*c**(S(3)/4)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(d + (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*c**(S(3)/4)*(d - (-S(2)*a*e + b*d)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*a*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) - d/(S(3)*a*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(-x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, -x - sqrt(S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(-x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, -log(x**S(8) - x**S(4) + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(-x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) - atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) + atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) - atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(-x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(12) + sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) - atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/(S(4)*sqrt(S(3)*sqrt(S(3)) + S(6))) - atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))) + atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/(S(4)*sqrt(-S(3)*sqrt(S(3)) + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x*(x**S(8) - x**S(4) + S(1))), x), x, log(x) - log(x**S(8) - x**S(4) + S(1))/S(8) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**S(4) + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(2)*(x**S(8) - x**S(4) + S(1))), x), x, -sqrt(S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(24) - sqrt(S(6))*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(24) + sqrt(S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(12) + sqrt(S(6))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) - sqrt(S(6))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(12) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(3)*(x**S(8) - x**S(4) + S(1))), x), x, -sqrt(S(3))*log(x**S(4) - sqrt(S(3))*x**S(2) + S(1))/S(24) + sqrt(S(3))*log(x**S(4) + sqrt(S(3))*x**S(2) + S(1))/S(24) - atan(S(2)*x**S(2) - sqrt(S(3)))/S(4) - atan(S(2)*x**S(2) + sqrt(S(3)))/S(4) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(4)*(x**S(8) - x**S(4) + S(1))), x), x, sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(8) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/S(8) + sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) + sqrt(-sqrt(S(3))/S(3) + S(2)/3)*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) - S(1)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(1))/(x**S(8) + x**S(4) + S(1)), x), x, -log(x**S(2) - x + S(1))/S(8) + log(x**S(2) + x + S(1))/S(8) - sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(24) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(24) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(12) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12) + atan(S(2)*x - sqrt(S(3)))/S(4) + atan(S(2)*x + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(8) + x**S(4) + S(1)), x), x, log(x**S(2) - x + S(1))/S(8) - log(x**S(2) + x + S(1))/S(8) - sqrt(S(3))*log(x**S(2) - sqrt(S(3))*x + S(1))/S(8) + sqrt(S(3))*log(x**S(2) + sqrt(S(3))*x + S(1))/S(8) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(4) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(4) - atan(S(2)*x - sqrt(S(3)))/S(4) - atan(S(2)*x + sqrt(S(3)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, -log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-sqrt(S(3)) + S(2))) + log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(-sqrt(S(3)) + S(2))) - log(x**S(2) - x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(sqrt(S(3)) + S(2))) + log(x**S(2) + x*sqrt(sqrt(S(3)) + S(2)) + S(1))/(S(8)*sqrt(sqrt(S(3)) + S(2))) - sqrt(sqrt(S(3)) + S(2))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) + sqrt(sqrt(S(3)) + S(2))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(4) - sqrt(-sqrt(S(3)) + S(2))*atan((-S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4) + sqrt(-sqrt(S(3)) + S(2))*atan((S(2)*x + sqrt(-sqrt(S(3)) + S(2)))/sqrt(sqrt(S(3)) + S(2)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(1))/(x**S(8) - S(3)*x**S(4) + S(1)), x), x, sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atan(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) + sqrt(S(5))*(-sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atan(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10) + sqrt(S(5))*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atanh(x*(sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4))/S(10) + sqrt(S(5))*(-sqrt(S(5))/S(2) + S(3)/2)**(S(1)/4)*atanh(S(2)**(S(1)/4)*x/(sqrt(S(5)) + S(3))**(S(1)/4))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(4) + S(-1) + sqrt(S(3)))/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(S(2))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) + sqrt(S(2))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) - sqrt(S(2))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2) + sqrt(S(2))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4)*(S(1) + sqrt(S(3))) + S(1))/(x**S(8) - x**S(4) + S(1)), x), x, -sqrt(sqrt(S(3)) + S(2))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) + sqrt(sqrt(S(3)) + S(2))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) - sqrt(sqrt(S(3)) + S(2))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2) + sqrt(sqrt(S(3)) + S(2))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4)*(S(-3) + sqrt(S(3))) - S(2)*sqrt(S(3)) + S(3))/(x**S(8) - x**S(4) + S(1)), x), x, sqrt(-S(3)*sqrt(S(3)) + S(6))*log(x**S(2) - x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) - sqrt(-S(3)*sqrt(S(3)) + S(6))*log(x**S(2) + x*sqrt(-sqrt(S(3)) + S(2)) + S(1))/S(4) + sqrt(-S(3)*sqrt(S(3)) + S(6))*atan((-S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2) - sqrt(-S(3)*sqrt(S(3)) + S(6))*atan((S(2)*x + sqrt(sqrt(S(3)) + S(2)))/sqrt(-sqrt(S(3)) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x)/(a/x**S(2) + c), x), x, -sqrt(a)*d*atan(sqrt(c)*x/sqrt(a))/c**(S(3)/2) + d*x/c + e*log(a + c*x**S(2))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x)/(a/x**S(2) + b/x + c), x), x, d*x/c - (b*d - c*e)*log(a + b*x + c*x**S(2))/(S(2)*c**S(2)) - (-S(2)*a*c*d + b**S(2)*d - b*c*e)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(2))/(a/x**S(4) + c), x), x, d*x/c + sqrt(S(2))*(sqrt(a)*d - sqrt(c)*e)*atan(S(1) - sqrt(S(2))*c**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(1)/4)*c**(S(5)/4)) - sqrt(S(2))*(sqrt(a)*d - sqrt(c)*e)*atan(S(1) + sqrt(S(2))*c**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(1)/4)*c**(S(5)/4)) + sqrt(S(2))*(sqrt(a)*d + sqrt(c)*e)*log(-sqrt(S(2))*a**(S(1)/4)*c**(S(1)/4)*x + sqrt(a) + sqrt(c)*x**S(2))/(S(8)*a**(S(1)/4)*c**(S(5)/4)) - sqrt(S(2))*(sqrt(a)*d + sqrt(c)*e)*log(sqrt(S(2))*a**(S(1)/4)*c**(S(1)/4)*x + sqrt(a) + sqrt(c)*x**S(2))/(S(8)*a**(S(1)/4)*c**(S(5)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(2))/(a/x**S(4) + b/x**S(2) + c), x), x, d*x/c - sqrt(S(2))*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(3))/(a/x**S(6) + c), x), x, d*x/c - (-sqrt(c)*e + d*sqrt(-a))*log(c**(S(1)/6)*x + (-a)**(S(1)/6))/(S(6)*c**(S(7)/6)*(-a)**(S(1)/3)) + (-sqrt(c)*e + d*sqrt(-a))*log(-c**(S(1)/6)*x*(-a)**(S(1)/6) + c**(S(1)/3)*x**S(2) + (-a)**(S(1)/3))/(S(12)*c**(S(7)/6)*(-a)**(S(1)/3)) + sqrt(S(3))*(-sqrt(c)*e + d*sqrt(-a))*atan(sqrt(S(3))*(-S(2)*c**(S(1)/6)*x/(-a)**(S(1)/6) + S(1))/S(3))/(S(6)*c**(S(7)/6)*(-a)**(S(1)/3)) + (sqrt(c)*e + d*sqrt(-a))*log(-c**(S(1)/6)*x + (-a)**(S(1)/6))/(S(6)*c**(S(7)/6)*(-a)**(S(1)/3)) - (sqrt(c)*e + d*sqrt(-a))*log(c**(S(1)/6)*x*(-a)**(S(1)/6) + c**(S(1)/3)*x**S(2) + (-a)**(S(1)/3))/(S(12)*c**(S(7)/6)*(-a)**(S(1)/3)) - sqrt(S(3))*(sqrt(c)*e + d*sqrt(-a))*atan(sqrt(S(3))*(S(2)*c**(S(1)/6)*x/(-a)**(S(1)/6) + S(1))/S(3))/(S(6)*c**(S(7)/6)*(-a)**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(3))/(a/x**S(6) + b/x**S(3) + c), x), x, d*x/c - S(2)**(S(2)/3)*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*sqrt(S(3))*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(4)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(4))/(a/x**S(8) + c), x), x, d*x/c + sqrt(S(2))*(-sqrt(c)*e + d*sqrt(-a))*log(-sqrt(S(2))*c**(S(1)/8)*x*(-a)**(S(1)/8) + c**(S(1)/4)*x**S(2) + (-a)**(S(1)/4))/(S(16)*c**(S(9)/8)*(-a)**(S(3)/8)) - sqrt(S(2))*(-sqrt(c)*e + d*sqrt(-a))*log(sqrt(S(2))*c**(S(1)/8)*x*(-a)**(S(1)/8) + c**(S(1)/4)*x**S(2) + (-a)**(S(1)/4))/(S(16)*c**(S(9)/8)*(-a)**(S(3)/8)) - sqrt(S(2))*(-sqrt(c)*e + d*sqrt(-a))*atan(sqrt(S(2))*c**(S(1)/8)*x/(-a)**(S(1)/8) + S(-1))/(S(8)*c**(S(9)/8)*(-a)**(S(3)/8)) - sqrt(S(2))*(-sqrt(c)*e + d*sqrt(-a))*atan(sqrt(S(2))*c**(S(1)/8)*x/(-a)**(S(1)/8) + S(1))/(S(8)*c**(S(9)/8)*(-a)**(S(3)/8)) - (sqrt(c)*e + d*sqrt(-a))*atan(c**(S(1)/8)*x/(-a)**(S(1)/8))/(S(4)*c**(S(9)/8)*(-a)**(S(3)/8)) - (sqrt(c)*e + d*sqrt(-a))*atanh(c**(S(1)/8)*x/(-a)**(S(1)/8))/(S(4)*c**(S(9)/8)*(-a)**(S(3)/8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e/x**S(4))/(a/x**S(8) + b/x**S(4) + c), x), x, d*x/c + S(2)**(S(3)/4)*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b*d - c*e - (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b + sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atan(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)) + S(2)**(S(3)/4)*(b*d - c*e + (-S(2)*a*c*d + b**S(2)*d - b*c*e)/sqrt(-S(4)*a*c + b**S(2)))*atanh(S(2)**(S(1)/4)*c**(S(1)/4)*x/(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/4))/(S(4)*c**(S(5)/4)*(-b - sqrt(-S(4)*a*c + b**S(2)))**(S(3)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p*(d + e*x**n)**S(3), x), x, d**S(3)*(f*x)**(m + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(1))/(S(2)*n), -p), (S(1) + (m + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(f*(m + S(1))) + S(3)*d**S(2)*e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + n + S(1))/(S(2)*n), -p), ((m + S(3)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + n + S(1)) + S(3)*d*e**S(2)*x**(S(2)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(2)*n + S(1))/(S(2)*n), -p), ((m + S(4)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + S(2)*n + S(1)) + e**S(3)*x**(S(3)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(3)*n + S(1))/(S(2)*n), -p), ((m + S(5)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p*(d + e*x**n)**S(2), x), x, d**S(2)*(f*x)**(m + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(1))/(S(2)*n), -p), (S(1) + (m + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(f*(m + S(1))) + S(2)*d*e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + n + S(1))/(S(2)*n), -p), ((m + S(3)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + n + S(1)) + e**S(2)*x**(S(2)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(2)*n + S(1))/(S(2)*n), -p), ((m + S(4)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p*(d + e*x**n), x), x, d*(f*x)**(m + S(1))*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + S(1))/(S(2)*n), -p), (S(1) + (m + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(f*(m + S(1))) + e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*hyper(((m + n + S(1))/(S(2)*n), -p), ((m + S(3)*n + S(1))/(S(2)*n),), -c*x**(S(2)*n)/a)/(m + n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**S(13), x), x, (a + b*x + c*x**S(2))**S(14)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(13), x), x, (a + b*x**S(2) + c*x**S(4))**S(14)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(a + b*x**S(3) + c*x**S(6))**S(13), x), x, (a + b*x**S(3) + c*x**S(6))**S(14)/S(42), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(a + b*x**n + c*x**(S(2)*n))**S(13), x), x, (a + b*x**n + c*x**(S(2)*n))**S(14)/(S(14)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(-a + b*x + c*x**S(2))**S(13), x), x, (-a + b*x + c*x**S(2))**S(14)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(-a + b*x**S(2) + c*x**S(4))**S(13), x), x, (a - b*x**S(2) - c*x**S(4))**S(14)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(-a + b*x**S(3) + c*x**S(6))**S(13), x), x, (a - b*x**S(3) - c*x**S(6))**S(14)/S(42), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(-a + b*x**n + c*x**(S(2)*n))**S(13), x), x, (a - b*x**n - c*x**(S(2)*n))**S(14)/(S(14)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(b*x + c*x**S(2))**S(13), x), x, (b*x + c*x**S(2))**S(14)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(b*x**S(2) + c*x**S(4))**S(13), x), x, x**S(28)*(b + c*x**S(2))**S(14)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(b*x**S(3) + c*x**S(6))**S(13), x), x, x**S(42)*(b + c*x**S(3))**S(14)/S(42), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(b*x**n + c*x**(S(2)*n))**S(13), x), x, x**(S(14)*n)*(b + c*x**n)**S(14)/(S(14)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(a + b*x + c*x**S(2)), x), x, log(a + b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, log(a + b*x**S(2) + c*x**S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(a + b*x**S(3) + c*x**S(6)), x), x, log(a + b*x**S(3) + c*x**S(6))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(a + b*x**n + c*x**(S(2)*n)), x), x, log(a + b*x**n + c*x**(S(2)*n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(a + b*x + c*x**S(2))**S(8), x), x, -S(1)/(S(7)*(a + b*x + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(8), x), x, -S(1)/(S(14)*(a + b*x**S(2) + c*x**S(4))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(a + b*x**S(3) + c*x**S(6))**S(8), x), x, -S(1)/(S(21)*(a + b*x**S(3) + c*x**S(6))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(a + b*x**n + c*x**(S(2)*n))**S(8), x), x, -S(1)/(S(7)*n*(a + b*x**n + c*x**(S(2)*n))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(-a + b*x + c*x**S(2)), x), x, log(a - b*x - c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(-a + b*x**S(2) + c*x**S(4)), x), x, log(a - b*x**S(2) - c*x**S(4))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(-a + b*x**S(3) + c*x**S(6)), x), x, log(a - b*x**S(3) - c*x**S(6))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(-a + b*x**n + c*x**(S(2)*n)), x), x, log(a - b*x**n - c*x**(S(2)*n))/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(-a + b*x + c*x**S(2))**S(8), x), x, -S(1)/(S(7)*(-a + b*x + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(-a + b*x**S(2) + c*x**S(4))**S(8), x), x, S(1)/(S(14)*(a - b*x**S(2) - c*x**S(4))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(-a + b*x**S(3) + c*x**S(6))**S(8), x), x, S(1)/(S(21)*(a - b*x**S(3) - c*x**S(6))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(-a + b*x**n + c*x**(S(2)*n))**S(8), x), x, S(1)/(S(7)*n*(a - b*x**n - c*x**(S(2)*n))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(b*x + c*x**S(2)), x), x, log(b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(b*x**S(2) + c*x**S(4)), x), x, log(x) + log(b + c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(b*x**S(3) + c*x**S(6)), x), x, log(x) + log(b + c*x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(b*x**n + c*x**(S(2)*n)), x), x, log(x) + log(b + c*x**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(b*x + c*x**S(2))**S(8), x), x, -S(1)/(S(7)*(b*x + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))/(b*x**S(2) + c*x**S(4))**S(8), x), x, -S(1)/(S(14)*x**S(14)*(b + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))/(b*x**S(3) + c*x**S(6))**S(8), x), x, -S(1)/(S(21)*x**S(21)*(b + c*x**S(3))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)/(b*x**n + c*x**(S(2)*n))**S(8), x), x, -x**(-S(7)*n)/(S(7)*n*(b + c*x**n)**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(a + b*x + c*x**S(2))**p, x), x, (a + b*x + c*x**S(2))**(p + S(1))/(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(a + b*x**S(2) + c*x**S(4))**p, x), x, (a + b*x**S(2) + c*x**S(4))**(p + S(1))/(S(2)*p + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(a + b*x**S(3) + c*x**S(6))**p, x), x, (a + b*x**S(3) + c*x**S(6))**(p + S(1))/(S(3)*p + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, (a + b*x**n + c*x**(S(2)*n))**(p + S(1))/(n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(-a + b*x + c*x**S(2))**p, x), x, (-a + b*x + c*x**S(2))**(p + S(1))/(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(-a + b*x**S(2) + c*x**S(4))**p, x), x, (-a + b*x**S(2) + c*x**S(4))**(p + S(1))/(S(2)*p + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(-a + b*x**S(3) + c*x**S(6))**p, x), x, (-a + b*x**S(3) + c*x**S(6))**(p + S(1))/(S(3)*p + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(-a + b*x**n + c*x**(S(2)*n))**p, x), x, (-a + b*x**n + c*x**(S(2)*n))**(p + S(1))/(n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(b*x + c*x**S(2))**p, x), x, (b*x + c*x**S(2))**(p + S(1))/(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(b + S(2)*c*x**S(2))*(b*x**S(2) + c*x**S(4))**p, x), x, (b*x**S(2) + c*x**S(4))**(p + S(1))/(S(2)*p + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(b + S(2)*c*x**S(3))*(b*x**S(3) + c*x**S(6))**p, x), x, (b*x**S(3) + c*x**S(6))**(p + S(1))/(S(3)*p + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))*(b + S(2)*c*x**n)*(b*x**n + c*x**(S(2)*n))**p, x), x, (b*x**n + c*x**(S(2)*n))**(p + S(1))/(n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)/(a + b*x**n + c*x**(S(2)*n)), x), x, (f*x)**(m + S(1))*(e - (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))) + (f*x)**(m + S(1))*(e + (-b*e + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(f*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, -c*(f*x)**(m + S(1))*((-S(2)*a*e + b*d)*(m - n + S(1)) + (S(2)*a*b*e*n + S(4)*a*c*d*(m - S(2)*n + S(1)) - b**S(2)*d*(m - n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*f*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))) - c*(f*x)**(m + S(1))*((-S(2)*a*e + b*d)*(m - n + S(1)) - (S(2)*a*b*e*n + S(4)*a*c*d*(m - S(2)*n + S(1)) - b**S(2)*d*(m - n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*f*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))) + (f*x)**(m + S(1))*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**n*(-S(2)*a*e + b*d))/(a*f*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) # large time assert rubi_test(rubi_integrate((d + e*x**n)**q/(x*(a + b*x**n + c*x**(S(2)*n))), x), x, c*(d + e*x**n)**(q + S(1))*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**n)/(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2)))))/(a*n*(q + S(1))*(S(2)*c*d - e*(b + sqrt(-S(4)*a*c + b**S(2))))) + c*(d + e*x**n)**(q + S(1))*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(2)*c*(d + e*x**n)/(-b*e + S(2)*c*d + e*sqrt(-S(4)*a*c + b**S(2))))/(a*n*(q + S(1))*(S(2)*c*d - e*(b - sqrt(-S(4)*a*c + b**S(2))))) - (d + e*x**n)**(q + S(1))*hyper((S(1), q + S(1)), (q + S(2),), S(1) + e*x**n/d)/(a*d*n*(q + S(1))), expand=True, _diff=True, _numerical=True) # Apart assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)/(a + b*x**n + c*x**(S(2)*n))**S(3), x), x, (f*x)**(m + S(1))*(-a*b*e - S(2)*a*c*d + b**S(2)*d + c*x**n*(-S(2)*a*e + b*d))/(S(2)*a*f*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))**S(2)) - c*(f*x)**(m + S(1))*((m - n + S(1))*(-S(4)*a**S(2)*c*e*(m - S(3)*n + S(1)) + a*b**S(2)*e*(m + S(1)) + S(2)*a*b*c*d*(S(2)*m - S(7)*n + S(2)) - b**S(3)*d*(m - S(2)*n + S(1))) - (-S(4)*a**S(2)*b*c*e*(m**S(2) + m*(-n + S(2)) - S(3)*n**S(2) - n + S(1)) - S(8)*a**S(2)*c**S(2)*d*(m**S(2) + m*(-S(6)*n + S(2)) + S(8)*n**S(2) - S(6)*n + S(1)) + a*b**S(3)*e*(m + S(1))*(m - n + S(1)) + S(6)*a*b**S(2)*c*d*(m**S(2) + m*(-S(4)*n + S(2)) + S(3)*n**S(2) - S(4)*n + S(1)) - b**S(4)*d*(m**S(2) + m*(-S(3)*n + S(2)) + S(2)*n**S(2) - S(3)*n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*f*n**S(2)*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**S(2)) - c*(f*x)**(m + S(1))*((m - n + S(1))*(-S(4)*a**S(2)*c*e*(m - S(3)*n + S(1)) + a*b**S(2)*e*(m + S(1)) + S(2)*a*b*c*d*(S(2)*m - S(7)*n + S(2)) - b**S(3)*d*(m - S(2)*n + S(1))) + (-S(4)*a**S(2)*b*c*e*(m**S(2) + m*(-n + S(2)) - S(3)*n**S(2) - n + S(1)) - S(8)*a**S(2)*c**S(2)*d*(m**S(2) + m*(-S(6)*n + S(2)) + S(8)*n**S(2) - S(6)*n + S(1)) + a*b**S(3)*e*(m + S(1))*(m - n + S(1)) + S(6)*a*b**S(2)*c*d*(m**S(2) + m*(-S(4)*n + S(2)) + S(3)*n**S(2) - S(4)*n + S(1)) - b**S(4)*d*(m**S(2) + m*(-S(3)*n + S(2)) + S(2)*n**S(2) - S(3)*n + S(1)))/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a**S(2)*f*n**S(2)*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**S(2)) + (f*x)**(m + S(1))*(a*b*c*(-S(2)*a*e + b*d)*(m - S(3)*n + S(1)) + c*x**n*(-S(4)*a**S(2)*c*e*(m - S(3)*n + S(1)) + a*b**S(2)*e*(m + S(1)) + S(2)*a*b*c*d*(S(2)*m - S(7)*n + S(2)) - b**S(3)*d*(m - S(2)*n + S(1))) + (-S(2)*a*c + b**S(2))*(a*b*e*(m + S(1)) + S(2)*a*c*d*(m - S(4)*n + S(1)) - b**S(2)*d*(m - S(2)*n + S(1))))/(S(2)*a**S(2)*f*n**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c**(S(1)/3) - S(2)*d**(S(1)/3)*x**(S(1)/3))/(-c**(S(2)/3)*d**(S(2)/3)*x + c**(S(1)/3)*d*x**(S(4)/3) + c*d**(S(1)/3)*x**(S(2)/3)), x), x, -S(3)*log(c**(S(2)/3) - c**(S(1)/3)*d**(S(1)/3)*x**(S(1)/3) + d**(S(2)/3)*x**(S(2)/3))/(c**(S(1)/3)*d**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*(d - e*x)**(S(9)/2)*(d + e*x)**(S(9)/2)/(S(9)*e**S(10)) - d**S(4)*sqrt(d - e*x)*sqrt(d + e*x)*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/e**S(10) + d**S(2)*(d - e*x)**(S(3)/2)*(d + e*x)**(S(3)/2)*(S(2)*a*e**S(4) + S(3)*b*d**S(2)*e**S(2) + S(4)*c*d**S(4))/(S(3)*e**S(10)) + (d - e*x)**(S(7)/2)*(d + e*x)**(S(7)/2)*(b*e**S(2) + S(4)*c*d**S(2))/(S(7)*e**S(10)) - (d - e*x)**(S(5)/2)*(d + e*x)**(S(5)/2)*(a*e**S(4) + S(3)*b*d**S(2)*e**S(2) + S(6)*c*d**S(4))/(S(5)*e**S(10)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*(d**S(2) - e**S(2)*x**S(2))**S(5)/(S(9)*e**S(10)*sqrt(d - e*x)*sqrt(d + e*x)) - d**S(4)*(d**S(2) - e**S(2)*x**S(2))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/(e**S(10)*sqrt(d - e*x)*sqrt(d + e*x)) + d**S(2)*(d**S(2) - e**S(2)*x**S(2))**S(2)*(S(2)*a*e**S(4) + S(3)*b*d**S(2)*e**S(2) + S(4)*c*d**S(4))/(S(3)*e**S(10)*sqrt(d - e*x)*sqrt(d + e*x)) + (d**S(2) - e**S(2)*x**S(2))**S(4)*(b*e**S(2) + S(4)*c*d**S(2))/(S(7)*e**S(10)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))**S(3)*(a*e**S(4) + S(3)*b*d**S(2)*e**S(2) + S(6)*c*d**S(4))/(S(5)*e**S(10)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, c*(d - e*x)**(S(7)/2)*(d + e*x)**(S(7)/2)/(S(7)*e**S(8)) - d**S(2)*sqrt(d - e*x)*sqrt(d + e*x)*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/e**S(8) - (d - e*x)**(S(5)/2)*(d + e*x)**(S(5)/2)*(b*e**S(2) + S(3)*c*d**S(2))/(S(5)*e**S(8)) + (d - e*x)**(S(3)/2)*(d + e*x)**(S(3)/2)*(a*e**S(4) + S(2)*b*d**S(2)*e**S(2) + S(3)*c*d**S(4))/(S(3)*e**S(8)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, c*(d**S(2) - e**S(2)*x**S(2))**S(4)/(S(7)*e**S(8)*sqrt(d - e*x)*sqrt(d + e*x)) - d**S(2)*(d**S(2) - e**S(2)*x**S(2))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/(e**S(8)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))**S(3)*(b*e**S(2) + S(3)*c*d**S(2))/(S(5)*e**S(8)*sqrt(d - e*x)*sqrt(d + e*x)) + (d**S(2) - e**S(2)*x**S(2))**S(2)*(a*e**S(4) + S(2)*b*d**S(2)*e**S(2) + S(3)*c*d**S(4))/(S(3)*e**S(8)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*(d - e*x)**(S(5)/2)*(d + e*x)**(S(5)/2)/(S(5)*e**S(6)) + (d - e*x)**(S(3)/2)*(d + e*x)**(S(3)/2)*(b*e**S(2) + S(2)*c*d**S(2))/(S(3)*e**S(6)) - sqrt(d - e*x)*sqrt(d + e*x)*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/e**S(6), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*(d**S(2) - e**S(2)*x**S(2))**S(3)/(S(5)*e**S(6)*sqrt(d - e*x)*sqrt(d + e*x)) + (d**S(2) - e**S(2)*x**S(2))**S(2)*(b*e**S(2) + S(2)*c*d**S(2))/(S(3)*e**S(6)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))/(e**S(6)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*atanh(sqrt(d - e*x)*sqrt(d + e*x)/d)/d + c*(d - e*x)**(S(3)/2)*(d + e*x)**(S(3)/2)/(S(3)*e**S(4)) - sqrt(d - e*x)*sqrt(d + e*x)*(b*e**S(2) + c*d**S(2))/e**S(4), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d**S(2) - e**S(2)*x**S(2))*atanh(sqrt(d**S(2) - e**S(2)*x**S(2))/d)/(d*sqrt(d - e*x)*sqrt(d + e*x)) + c*(d**S(2) - e**S(2)*x**S(2))**S(2)/(S(3)*e**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(b*e**S(2) + c*d**S(2))/(e**S(4)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(S(2)*d**S(2)*x**S(2)) - c*sqrt(d - e*x)*sqrt(d + e*x)/e**S(2) - (a*e**S(2) + S(2)*b*d**S(2))*atanh(sqrt(d - e*x)*sqrt(d + e*x)/d)/(S(2)*d**S(3)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(S(2)*d**S(2)*x**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) - c*(d**S(2) - e**S(2)*x**S(2))/(e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) - sqrt(d**S(2) - e**S(2)*x**S(2))*(a*e**S(2) + S(2)*b*d**S(2))*atanh(sqrt(d**S(2) - e**S(2)*x**S(2))/d)/(S(2)*d**S(3)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(5)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(S(4)*d**S(2)*x**S(4)) - sqrt(d - e*x)*sqrt(d + e*x)*(S(3)*a*e**S(2) + S(4)*b*d**S(2))/(S(8)*d**S(4)*x**S(2)) - (S(3)*a*e**S(4) + S(4)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))*atanh(sqrt(d - e*x)*sqrt(d + e*x)/d)/(S(8)*d**S(5)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(5)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(S(4)*d**S(2)*x**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(S(3)*a*e**S(2) + S(4)*b*d**S(2))/(S(8)*d**S(4)*x**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) - sqrt(d**S(2) - e**S(2)*x**S(2))*(S(3)*a*e**S(4) + S(4)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))*atanh(sqrt(d**S(2) - e**S(2)*x**S(2))/d)/(S(8)*d**S(5)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(7)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(S(6)*d**S(2)*x**S(6)) - sqrt(d - e*x)*sqrt(d + e*x)*(S(5)*a*e**S(2) + S(6)*b*d**S(2))/(S(24)*d**S(4)*x**S(4)) - sqrt(d - e*x)*sqrt(d + e*x)*(S(5)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))/(S(16)*d**S(6)*x**S(2)) - e**S(2)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(5)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))*atanh(sqrt(d**S(2) - e**S(2)*x**S(2))/d)/(S(16)*d**S(7)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(7)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(S(6)*d**S(2)*x**S(6)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(S(5)*a*e**S(2) + S(6)*b*d**S(2))/(S(24)*d**S(4)*x**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(S(5)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))/(S(16)*d**S(6)*x**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) - e**S(2)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(5)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(8)*c*d**S(4))*atanh(sqrt(d**S(2) - e**S(2)*x**S(2))/d)/(S(16)*d**S(7)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, c*x**S(7)*(-d + e*x)*sqrt(d + e*x)/(S(8)*e**S(2)*sqrt(d - e*x)) + d**S(4)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(128)*e**S(9)*sqrt(d - e*x)*sqrt(d + e*x)) - d**S(2)*x*sqrt(d - e*x)*sqrt(d + e*x)*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))/(S(128)*e**S(8)) - x**S(5)*sqrt(d - e*x)*sqrt(d + e*x)*(S(8)*b*e**S(2) + S(7)*c*d**S(2))/(S(48)*e**S(4)) - x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))/(S(192)*e**S(6)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*x**S(7)*(d**S(2) - e**S(2)*x**S(2))/(S(8)*e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) + d**S(4)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(128)*e**S(9)*sqrt(d - e*x)*sqrt(d + e*x)) - d**S(2)*x*(d**S(2) - e**S(2)*x**S(2))*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))/(S(128)*e**S(8)*sqrt(d - e*x)*sqrt(d + e*x)) - x**S(5)*(d**S(2) - e**S(2)*x**S(2))*(S(8)*b*e**S(2) + S(7)*c*d**S(2))/(S(48)*e**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) - x**S(3)*(d**S(2) - e**S(2)*x**S(2))*(S(48)*a*e**S(4) + S(40)*b*d**S(2)*e**S(2) + S(35)*c*d**S(4))/(S(192)*e**S(6)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, c*x**S(5)*(-d + e*x)*sqrt(d + e*x)/(S(6)*e**S(2)*sqrt(d - e*x)) + d**S(2)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(5)*c*d**S(4))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(16)*e**S(7)*sqrt(d - e*x)*sqrt(d + e*x)) - x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)*(S(6)*b*e**S(2) + S(5)*c*d**S(2))/(S(24)*e**S(4)) - x*sqrt(d - e*x)*sqrt(d + e*x)*(S(8)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(5)*c*d**S(4))/(S(16)*e**S(6)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*x**S(5)*(d**S(2) - e**S(2)*x**S(2))/(S(6)*e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) + d**S(2)*sqrt(d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(5)*c*d**S(4))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(16)*e**S(7)*sqrt(d - e*x)*sqrt(d + e*x)) - x**S(3)*(d**S(2) - e**S(2)*x**S(2))*(S(6)*b*e**S(2) + S(5)*c*d**S(2))/(S(24)*e**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) - x*(d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(6)*b*d**S(2)*e**S(2) + S(5)*c*d**S(4))/(S(16)*e**S(6)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, c*x**S(3)*(-d + e*x)*sqrt(d + e*x)/(S(4)*e**S(2)*sqrt(d - e*x)) - x*sqrt(d - e*x)*sqrt(d + e*x)*(S(4)*b*e**S(2) + S(3)*c*d**S(2))/(S(8)*e**S(4)) - (S(8)*a*e**S(4) + S(4)*b*d**S(2)*e**S(2) + S(3)*c*d**S(4))*atan(sqrt(d - e*x)/sqrt(d + e*x))/(S(4)*e**S(5)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(sqrt(d - e*x)*sqrt(d + e*x)), x), x, -c*x**S(3)*(d**S(2) - e**S(2)*x**S(2))/(S(4)*e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) - x*(d**S(2) - e**S(2)*x**S(2))*(S(4)*b*e**S(2) + S(3)*c*d**S(2))/(S(8)*e**S(4)*sqrt(d - e*x)*sqrt(d + e*x)) + sqrt(d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(4)*b*d**S(2)*e**S(2) + S(3)*c*d**S(4))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(8)*e**S(5)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(2)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(d**S(2)*x) + c*x*(-d + e*x)*sqrt(d + e*x)/(S(2)*e**S(2)*sqrt(d - e*x)) - (S(2)*b*e**S(2) + c*d**S(2))*atan(sqrt(d - e*x)/sqrt(d + e*x))/e**S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(2)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(d**S(2)*x*sqrt(d - e*x)*sqrt(d + e*x)) - c*x*(d**S(2) - e**S(2)*x**S(2))/(S(2)*e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)) + sqrt(d**S(2) - e**S(2)*x**S(2))*(S(2)*b*e**S(2) + c*d**S(2))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(S(2)*e**S(3)*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(4)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(S(3)*d**S(2)*x**S(3)) - S(2)*a*e**S(2)*sqrt(d - e*x)*sqrt(d + e*x)/(S(3)*d**S(4)*x) - b*sqrt(d - e*x)*sqrt(d + e*x)/(d**S(2)*x) + c*sqrt(d**S(2) - e**S(2)*x**S(2))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(e*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(4)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(S(3)*d**S(2)*x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)) - S(2)*a*e**S(2)*(d**S(2) - e**S(2)*x**S(2))/(S(3)*d**S(4)*x*sqrt(d - e*x)*sqrt(d + e*x)) - b*(d**S(2) - e**S(2)*x**S(2))/(d**S(2)*x*sqrt(d - e*x)*sqrt(d + e*x)) + c*sqrt(d**S(2) - e**S(2)*x**S(2))*atan(e*x/sqrt(d**S(2) - e**S(2)*x**S(2)))/(e*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(6)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*sqrt(d - e*x)*sqrt(d + e*x)/(S(5)*d**S(2)*x**S(5)) - c*(-d + e*x)*sqrt(d + e*x)/(S(2)*e**S(2)*x**S(3)*sqrt(d - e*x)) - sqrt(d - e*x)*sqrt(d + e*x)*(S(8)*a*e**S(4) + S(10)*b*d**S(2)*e**S(2) + S(15)*c*d**S(4))/(S(30)*d**S(4)*e**S(2)*x**S(3)) - sqrt(d - e*x)*sqrt(d + e*x)*(S(8)*a*e**S(4) + S(10)*b*d**S(2)*e**S(2) + S(15)*c*d**S(4))/(S(15)*d**S(6)*x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))/(x**S(6)*sqrt(d - e*x)*sqrt(d + e*x)), x), x, -a*(d**S(2) - e**S(2)*x**S(2))/(S(5)*d**S(2)*x**S(5)*sqrt(d - e*x)*sqrt(d + e*x)) + c*(d**S(2) - e**S(2)*x**S(2))/(S(2)*e**S(2)*x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(10)*b*d**S(2)*e**S(2) + S(15)*c*d**S(4))/(S(30)*d**S(4)*e**S(2)*x**S(3)*sqrt(d - e*x)*sqrt(d + e*x)) - (d**S(2) - e**S(2)*x**S(2))*(S(8)*a*e**S(4) + S(10)*b*d**S(2)*e**S(2) + S(15)*c*d**S(4))/(S(15)*d**S(6)*x*sqrt(d - e*x)*sqrt(d + e*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p/(d + e*x**n), x), x, x*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(1))/(S(2)*n), -p, S(1), S(1) + (m + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d*(m + S(1))) - e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + n + S(1))/(S(2)*n), -p, S(1), (m + S(3)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(2)*(m + n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p/(d + e*x**n)**S(2), x), x, x*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(1))/(S(2)*n), -p, S(2), S(1) + (m + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(2)*(m + S(1))) - S(2)*e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + n + S(1))/(S(2)*n), -p, S(2), (m + S(3)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(3)*(m + n + S(1))) + e**S(2)*x**(S(2)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(2)*n + S(1))/(S(2)*n), -p, S(2), (m + S(4)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(4)*(m + S(2)*n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + c*x**(S(2)*n))**p/(d + e*x**n)**S(3), x), x, x*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(1))/(S(2)*n), -p, S(3), S(1) + (m + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(3)*(m + S(1))) - S(3)*e*x**(n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + n + S(1))/(S(2)*n), -p, S(3), (m + S(3)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(4)*(m + n + S(1))) + S(3)*e**S(2)*x**(S(2)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(2)*n + S(1))/(S(2)*n), -p, S(3), (m + S(4)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(5)*(m + S(2)*n + S(1))) - e**S(3)*x**(S(3)*n + S(1))*(f*x)**m*(S(1) + c*x**(S(2)*n)/a)**(-p)*(a + c*x**(S(2)*n))**p*AppellF1((m + S(3)*n + S(1))/(S(2)*n), -p, S(3), (m + S(5)*n + S(1))/(S(2)*n), -c*x**(S(2)*n)/a, e**S(2)*x**(S(2)*n)/d**S(2))/(d**S(6)*(m + S(3)*n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)**S(2)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, d**S(2)*(f*x)**(m + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + S(1))/n, -p, -p, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))) + S(2)*d*e*x**(n + S(1))*(f*x)**m*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + n + S(1))/n, -p, -p, (m + S(2)*n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(m + n + S(1)) + e**S(2)*x**(S(2)*n + S(1))*(f*x)**m*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + S(2)*n + S(1))/n, -p, -p, (m + S(3)*n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(m + S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)*(a + b*x**n + c*x**(S(2)*n))**p, x), x, d*(f*x)**(m + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + S(1))/n, -p, -p, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))) + e*x**(n + S(1))*(f*x)**m*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + n + S(1))/n, -p, -p, (m + S(2)*n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(m + n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(a + b*x**n + c*x**(S(2)*n))**p, x), x, (f*x)**(m + S(1))*(S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))**(-p)*(a + b*x**n + c*x**(S(2)*n))**p*AppellF1((m + S(1))/n, -p, -p, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(f*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((f*x)**m*(d + e*x**n)**q/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*(f*x)**(m + S(1))*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1((m + S(1))/n, S(1), -q, (m + n + S(1))/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(f*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*c*(f*x)**(m + S(1))*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1((m + S(1))/n, S(1), -q, (m + n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(f*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(d + e*x**n)**q/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*x**S(3)*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(3)/n, S(1), -q, (n + S(3))/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(12)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x**S(3)*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(3)/n, S(1), -q, (n + S(3))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(12)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**n)**q/(a + b*x**n + c*x**(S(2)*n)), x), x, -c*x**S(2)*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(2)/n, S(1), -q, (n + S(2))/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - c*x**S(2)*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(2)/n, S(1), -q, (n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**q/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*x*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(1)/n, S(1), -q, S(1) + S(1)/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(S(1)/n, S(1), -q, S(1) + S(1)/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**q/(x**S(2)*(a + b*x**n + c*x**(S(2)*n))), x), x, S(2)*c*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(-S(1)/n, S(1), -q, -(-n + S(1))/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(x*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + S(2)*c*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(-S(1)/n, S(1), -q, -(-n + S(1))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(x*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x**n)**q/(x**S(3)*(a + b*x**n + c*x**(S(2)*n))), x), x, c*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(-S(2)/n, S(1), -q, -(-n + S(2))/n, -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(x**S(2)*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) + c*(S(1) + e*x**n/d)**(-q)*(d + e*x**n)**q*AppellF1(-S(2)/n, S(1), -q, -(-n + S(2))/n, -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))), -e*x**n/d)/(x**S(2)*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) def test_4(): assert rubi_test(rubi_integrate((x**S(3) + x**S(2))/(x**S(2) + x + S(-2)), x), x, x**S(2)/S(2) + S(2)*log(-x + S(1))/S(3) + S(4)*log(x + S(2))/S(3), expand=True, _diff=True, _numerical=True) # Large time assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + j*x**S(5) + k*x**S(6) + l*x**S(7) + m*x**S(8))/(a + b*x + c*x**S(2)), x), x, m*x**S(7)/(S(7)*c) + x**S(6)*(-b*m + c*l)/(S(6)*c**S(2)) + x**S(5)*(b**S(2)*m + c**S(2)*k - c*(a*m + b*l))/(S(5)*c**S(3)) + x**S(4)*(-b**S(3)*m + b*c*(S(2)*a*m + b*l) + c**S(3)*j - c**S(2)*(a*l + b*k))/(S(4)*c**S(4)) + x**S(3)*(b**S(4)*m - b**S(2)*c*(S(3)*a*m + b*l) + c**S(4)*h - c**S(3)*(a*k + b*j) + c**S(2)*(a**S(2)*m + S(2)*a*b*l + b**S(2)*k))/(S(3)*c**S(5)) + x**S(2)*(-b**S(5)*m + b**S(3)*c*(S(4)*a*m + b*l) - b*c**S(2)*(S(3)*a**S(2)*m + S(3)*a*b*l + b**S(2)*k) + c**S(5)*g - c**S(4)*(a*j + b*h) + c**S(3)*(a**S(2)*l + S(2)*a*b*k + b**S(2)*j))/(S(2)*c**S(6)) + x*(b**S(6)*m - b**S(4)*c*(S(5)*a*m + b*l) + b**S(2)*c**S(2)*(S(6)*a**S(2)*m + S(4)*a*b*l + b**S(2)*k) + c**S(6)*f - c**S(5)*(a*h + b*g) + c**S(4)*(a**S(2)*k + S(2)*a*b*j + b**S(2)*h) - c**S(3)*(a**S(3)*m + S(3)*a**S(2)*b*l + S(3)*a*b**S(2)*k + b**S(3)*j))/c**S(7) + (-b**S(7)*m + b**S(5)*c*(S(6)*a*m + b*l) - b**S(3)*c**S(2)*(S(10)*a**S(2)*m + S(5)*a*b*l + b**S(2)*k) + b*c**S(3)*(S(4)*a**S(3)*m + S(6)*a**S(2)*b*l + S(4)*a*b**S(2)*k + b**S(3)*j) + c**S(7)*e - c**S(6)*(a*g + b*f) + c**S(5)*(a**S(2)*j + S(2)*a*b*h + b**S(2)*g) - c**S(4)*(a**S(3)*l + S(3)*a**S(2)*b*k + S(3)*a*b**S(2)*j + b**S(3)*h))*log(a + b*x + c*x**S(2))/(S(2)*c**S(8)) - (b**S(8)*m - b**S(6)*c*(S(8)*a*m + b*l) + b**S(4)*c**S(2)*(S(20)*a**S(2)*m + S(7)*a*b*l + b**S(2)*k) - b**S(2)*c**S(3)*(S(16)*a**S(3)*m + S(14)*a**S(2)*b*l + S(6)*a*b**S(2)*k + b**S(3)*j) + S(2)*c**S(8)*d - c**S(7)*(S(2)*a*f + b*e) + c**S(6)*(S(2)*a**S(2)*h + S(3)*a*b*g + b**S(2)*f) - c**S(5)*(S(2)*a**S(3)*k + S(5)*a**S(2)*b*j + S(4)*a*b**S(2)*h + b**S(3)*g) + c**S(4)*(S(2)*a**S(4)*m + S(7)*a**S(3)*b*l + S(9)*a**S(2)*b**S(2)*k + S(5)*a*b**S(3)*j + b**S(4)*h))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(8)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x + c*x**S(2))**S(2), x), x, g*log(a + b*x + c*x**S(2))/(S(2)*c**S(2)) - (-a*b**S(2)*g - S(2)*a*c*(-a*g + c*e) + b*c*(a*f + c*d) + x*(-b**S(3)*g + b*c*(S(3)*a*g + b*f) + S(2)*c**S(3)*d - c**S(2)*(S(2)*a*f + b*e)))/(c**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + (-S(6)*a*b*c*g + b**S(3)*g + S(4)*c**S(3)*d - c**S(2)*(-S(4)*a*f + S(2)*b*e))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(a + b*x + c*x**S(2))**S(3), x), x, -x**S(3)*(-S(5)*b*i + S(2)*c*h)/(S(2)*c**S(2)*(a + b*x + c*x**S(2))**S(2)) + i*log(a + b*x + c*x**S(2))/(S(2)*c**S(3)) - x**S(2)*(-S(4)*a*c*i - S(9)*b**S(2)*i + S(2)*b*c*h + S(2)*c**S(2)*g)/(S(4)*c**S(3)*(a + b*x + c*x**S(2))**S(2)) - (-S(30)*a**S(2)*b*c**S(2)*i + S(10)*a*b**S(3)*c*i - b**S(5)*i + S(12)*c**S(5)*d - c**S(4)*(-S(4)*a*f + S(6)*b*e) + S(2)*c**S(3)*(S(6)*a**S(2)*h - S(3)*a*b*g + b**S(2)*f))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) + (b + S(2)*c*x)*(-S(30)*a**S(2)*b*c**S(2)*i + S(10)*a*b**S(3)*c*i - b**S(5)*i + S(12)*c**S(5)*d - c**S(4)*(-S(4)*a*f + S(6)*b*e) + S(2)*c**S(3)*(S(6)*a**S(2)*h - S(3)*a*b*g + b**S(2)*f))/(S(4)*c**S(4)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x + c*x**S(2))) - (c**S(3)*(-a*b**S(4)*i/c**S(3) - S(4)*a*(-S(3)*a**S(2)*i/c + a*g + c*e) + S(2)*b*(a**S(2)*h/c + a*f + c*d)) + x*(-S(8)*a*b**S(3)*c*i + S(2)*a*b*c**S(2)*(S(23)*a*i + S(2)*b*h) - b**S(5)*i + S(4)*c**S(5)*d - S(2)*c**S(4)*(S(2)*a*f + b*e) + S(2)*c**S(3)*(-S(6)*a**S(2)*h - a*b*g + b**S(2)*f)))/(S(4)*c**S(4)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(a + b*x + c*x**S(2))**(S(5)/2), x), x, -x**S(2)*(-S(2)*b*h + c*g)/(c**S(2)*(a + b*x + c*x**S(2))**(S(3)/2)) + (b + S(2)*c*x)*(-S(4)*b**S(4)*h + b**S(2)*c*(S(28)*a*h + b*g) + S(16)*c**S(4)*d - c**S(3)*(-S(8)*a*f + S(8)*b*e) + S(2)*c**S(2)*(-S(16)*a**S(2)*h - S(6)*a*b*g + b**S(2)*f))/(S(3)*c**S(3)*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))) - (c**S(2)*(-S(4)*a*b**S(3)*h/c**S(2) + a*b**S(2)*g/c - S(4)*a*(S(2)*a*g + c*e) + S(2)*b*(S(9)*a**S(2)*h/c + a*f + c*d)) + x*(-S(4)*b**S(4)*h + b**S(2)*c*(S(16)*a*h + b*g) + S(4)*c**S(4)*d - S(2)*c**S(3)*(S(2)*a*f + b*e) + S(2)*c**S(2)*(S(2)*a**S(2)*h - S(3)*a*b*g + b**S(2)*f)))/(S(3)*c**S(3)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))**(S(3)/2)) + h*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/c**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(a + b*x - c*x**S(2))**(S(5)/2), x), x, x**S(2)*(S(2)*b*h + c*g)/(c**S(2)*(a + b*x - c*x**S(2))**(S(3)/2)) - (b - S(2)*c*x)*(-S(4)*b**S(4)*h - b**S(2)*c*(S(28)*a*h + b*g) + S(16)*c**S(4)*d + S(8)*c**S(3)*(-a*f + b*e) + S(2)*c**S(2)*(-S(16)*a**S(2)*h - S(6)*a*b*g + b**S(2)*f))/(S(3)*c**S(3)*(S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x - c*x**S(2))) - (c**S(2)*(S(4)*a*b**S(3)*h/c**S(2) + a*b**S(2)*g/c - S(4)*a*(-S(2)*a*g + c*e) + S(2)*b*(S(9)*a**S(2)*h/c - a*f + c*d)) - x*(-S(4)*b**S(4)*h - b**S(2)*c*(S(16)*a*h + b*g) + S(4)*c**S(4)*d + S(2)*c**S(3)*(S(2)*a*f + b*e) + S(2)*c**S(2)*(S(2)*a**S(2)*h - S(3)*a*b*g + b**S(2)*f)))/(S(3)*c**S(3)*(S(4)*a*c + b**S(2))*(a + b*x - c*x**S(2))**(S(3)/2)) - h*atan((b - S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x - c*x**S(2))))/c**(S(5)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(a + b*x**S(2) + c*x**S(4)), x), x, a*d*x + a*e*x**S(2)/S(2) + b*d*x**S(3)/S(3) + b*e*x**S(4)/S(4) + c*d*x**S(5)/S(5) + c*e*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))*(d + e*x + f*x**S(2)), x), x, a*d*x + a*e*x**S(2)/S(2) + b*e*x**S(4)/S(4) + c*e*x**S(6)/S(6) + c*f*x**S(7)/S(7) + x**S(5)*(b*f/S(5) + c*d/S(5)) + x**S(3)*(a*f/S(3) + b*d/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))*(d + e*x + f*x**S(2) + g*x**S(3)), x), x, a*d*x + a*e*x**S(2)/S(2) + c*f*x**S(7)/S(7) + c*g*x**S(8)/S(8) + x**S(6)*(b*g/S(6) + c*e/S(6)) + x**S(5)*(b*f/S(5) + c*d/S(5)) + x**S(4)*(a*g/S(4) + b*e/S(4)) + x**S(3)*(a*f/S(3) + b*d/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4)), x), x, a*d*x + a*e*x**S(2)/S(2) + c*g*x**S(8)/S(8) + c*h*x**S(9)/S(9) + x**S(7)*(b*h/S(7) + c*f/S(7)) + x**S(6)*(b*g/S(6) + c*e/S(6)) + x**S(5)*(a*h/S(5) + b*f/S(5) + c*d/S(5)) + x**S(4)*(a*g/S(4) + b*e/S(4)) + x**S(3)*(a*f/S(3) + b*d/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5)), x), x, a*d*x + a*e*x**S(2)/S(2) + c*h*x**S(9)/S(9) + c*i*x**S(10)/S(10) + x**S(8)*(b*i/S(8) + c*g/S(8)) + x**S(7)*(b*h/S(7) + c*f/S(7)) + x**S(6)*(a*i/S(6) + b*g/S(6) + c*e/S(6)) + x**S(5)*(a*h/S(5) + b*f/S(5) + c*d/S(5)) + x**S(4)*(a*g/S(4) + b*e/S(4)) + x**S(3)*(a*f/S(3) + b*d/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, a**S(2)*d*x + a**S(2)*e*x**S(2)/S(2) + S(2)*a*b*d*x**S(3)/S(3) + a*b*e*x**S(4)/S(2) + S(2)*b*c*d*x**S(7)/S(7) + b*c*e*x**S(8)/S(4) + c**S(2)*d*x**S(9)/S(9) + c**S(2)*e*x**S(10)/S(10) + d*x**S(5)*(S(2)*a*c/S(5) + b**S(2)/S(5)) + e*x**S(6)*(a*c/S(3) + b**S(2)/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)*(d + e*x + f*x**S(2)), x), x, a**S(2)*d*x + a**S(2)*e*x**S(2)/S(2) + a*b*e*x**S(4)/S(2) + a*x**S(3)*(a*f + S(2)*b*d)/S(3) + b*c*e*x**S(8)/S(4) + c**S(2)*e*x**S(10)/S(10) + c**S(2)*f*x**S(11)/S(11) + c*x**S(9)*(S(2)*b*f + c*d)/S(9) + e*x**S(6)*(a*c/S(3) + b**S(2)/S(6)) + x**S(7)*(S(2)*a*c*f/S(7) + b**S(2)*f/S(7) + S(2)*b*c*d/S(7)) + x**S(5)*(S(2)*a*b*f/S(5) + S(2)*a*c*d/S(5) + b**S(2)*d/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)*(d + e*x + f*x**S(2) + g*x**S(3)), x), x, a**S(2)*d*x + a**S(2)*e*x**S(2)/S(2) + a*x**S(4)*(a*g + S(2)*b*e)/S(4) + a*x**S(3)*(a*f + S(2)*b*d)/S(3) + c**S(2)*f*x**S(11)/S(11) + c**S(2)*g*x**S(12)/S(12) + c*x**S(10)*(S(2)*b*g + c*e)/S(10) + c*x**S(9)*(S(2)*b*f + c*d)/S(9) + x**S(8)*(a*c*g/S(4) + b**S(2)*g/S(8) + b*c*e/S(4)) + x**S(7)*(S(2)*a*c*f/S(7) + b**S(2)*f/S(7) + S(2)*b*c*d/S(7)) + x**S(6)*(a*b*g/S(3) + a*c*e/S(3) + b**S(2)*e/S(6)) + x**S(5)*(S(2)*a*b*f/S(5) + S(2)*a*c*d/S(5) + b**S(2)*d/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4)), x), x, a**S(2)*d*x + a**S(2)*e*x**S(2)/S(2) + a*x**S(4)*(a*g + S(2)*b*e)/S(4) + a*x**S(3)*(a*f + S(2)*b*d)/S(3) + c**S(2)*g*x**S(12)/S(12) + c**S(2)*h*x**S(13)/S(13) + c*x**S(11)*(S(2)*b*h + c*f)/S(11) + c*x**S(10)*(S(2)*b*g + c*e)/S(10) + x**S(9)*(b**S(2)*h/S(9) + c**S(2)*d/S(9) + S(2)*c*(a*h + b*f)/S(9)) + x**S(8)*(a*c*g/S(4) + b**S(2)*g/S(8) + b*c*e/S(4)) + x**S(7)*(S(2)*a*c*f/S(7) + b**S(2)*f/S(7) + S(2)*b*(a*h + c*d)/S(7)) + x**S(6)*(a*b*g/S(3) + a*c*e/S(3) + b**S(2)*e/S(6)) + x**S(5)*(S(2)*a*b*f/S(5) + a*(a*h + S(2)*c*d)/S(5) + b**S(2)*d/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -d*atanh(x/S(2))/S(6) + d*atanh(x)/S(3) - e*log(-x**S(2) + S(1))/S(6) + e*log(-x**S(2) + S(4))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -e*log(-x**S(2) + S(1))/S(6) + e*log(-x**S(2) + S(4))/S(6) + (-d/S(6) - S(2)*f/S(3))*atanh(x/S(2)) + (d/S(3) + f/S(3))*atanh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, (-d/S(6) - S(2)*f/S(3))*atanh(x/S(2)) + (d/S(3) + f/S(3))*atanh(x) - (e/S(6) + g/S(6))*log(-x**S(2) + S(1)) + (e/S(6) + S(2)*g/S(3))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, h*x - (e/S(6) + g/S(6))*log(-x**S(2) + S(1)) + (e/S(6) + S(2)*g/S(3))*log(-x**S(2) + S(4)) - (d/S(6) + S(2)*f/S(3) + S(8)*h/S(3))*atanh(x/S(2)) + (d/S(3) + f/S(3) + h/S(3))*atanh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, h*x + i*x**S(2)/S(2) - (d/S(6) + S(2)*f/S(3) + S(8)*h/S(3))*atanh(x/S(2)) + (d/S(3) + f/S(3) + h/S(3))*atanh(x) - (e/S(6) + g/S(6) + i/S(6))*log(-x**S(2) + S(1)) + (e/S(6) + S(2)*g/S(3) + S(8)*i/S(3))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) + x**S(2) + S(1)), x), x, -d*log(x**S(2) - x + S(1))/S(4) + d*log(x**S(2) + x + S(1))/S(4) - sqrt(S(3))*d*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*d*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) + x**S(2) + S(1)), x), x, sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(3) - (d/S(4) - f/S(4))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(4))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(d + f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(d + f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) + x**S(2) + S(1)), x), x, g*log(x**S(4) + x**S(2) + S(1))/S(4) - (d/S(4) - f/S(4))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(4))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(d + f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(d + f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) + x**S(2) + S(1)), x), x, g*log(x**S(4) + x**S(2) + S(1))/S(4) + h*x - (d/S(4) - f/S(4))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(4))*log(x**S(2) + x + S(1)) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(6) - sqrt(S(3))*(d + f - S(2)*h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(d + f - S(2)*h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) + x**S(2) + S(1)), x), x, h*x + i*x**S(2)/S(2) - (d/S(4) - f/S(4))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(4))*log(x**S(2) + x + S(1)) + (g/S(4) - i/S(4))*log(x**S(4) + x**S(2) + S(1)) - sqrt(S(3))*(d + f - S(2)*h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(d + f - S(2)*h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(6) + sqrt(S(3))*(S(2)*e - g - i)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*sqrt(c)*d*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*d*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) - e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)) + sqrt(S(2))*(f - (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(f + (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x**S(2) + c*x**S(4)), x), x, g*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c) - (-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(f - (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(f + (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(a + b*x**S(2) + c*x**S(4)), x), x, g*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c) + h*x/c - (-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(-b*h/c + f - (-S(2)*a*c*h + b**S(2)*h - b*c*f + S(2)*c**S(2)*d)/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-b*h/c + f + (b**S(2)*h + S(2)*c**S(2)*d - c*(S(2)*a*h + b*f))/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(a + b*x**S(2) + c*x**S(4)), x), x, h*x/c + i*x**S(2)/(S(2)*c) + (-b*i + c*g)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) - (-S(2)*a*c*i + b**S(2)*i - b*c*g + S(2)*c**S(2)*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(-b*h/c + f - (-S(2)*a*c*h + b**S(2)*h - b*c*f + S(2)*c**S(2)*d)/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-b*h/c + f + (b**S(2)*h + S(2)*c**S(2)*d - c*(S(2)*a*h + b*f))/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) # failing assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + j*x**S(5) + k*x**S(6) + l*x**S(7) + m*x**S(8))/(a + b*x**S(2) + c*x**S(4)), x), x, l*x**S(4)/(S(4)*c) + m*x**S(5)/(S(5)*c) + x**S(3)*(-b*m + c*k)/(S(3)*c**S(2)) + x**S(2)*(-b*l + c*j)/(S(2)*c**S(2)) + x*(b**S(2)*m + c**S(2)*h - c*(a*m + b*k))/c**S(3) + (b**S(2)*l + c**S(2)*g - c*(a*l + b*j))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) - (-b**S(3)*l + b*c*(S(3)*a*l + b*j) + S(2)*c**S(3)*e - c**S(2)*(S(2)*a*j + b*g))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(S(2)*a*b*m/c**S(2) - a*k/c - b**S(3)*m/c**S(3) + b**S(2)*k/c**S(2) - b*h/c + f - (b**S(4)*m - b**S(2)*c*(S(4)*a*m + b*k) + S(2)*c**S(4)*d - c**S(3)*(S(2)*a*h + b*f) + c**S(2)*(S(2)*a**S(2)*m + S(3)*a*b*k + b**S(2)*h))/(c**S(3)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(S(2)*a*b*m/c**S(2) - a*k/c - b**S(3)*m/c**S(3) + b**S(2)*k/c**S(2) - b*h/c + f + (b**S(4)*m - b**S(2)*c*(S(4)*a*m + b*k) + S(2)*c**S(4)*d - c**S(3)*(S(2)*a*h + b*f) + c**S(2)*(S(2)*a**S(2)*m + S(3)*a*b*k + b**S(2)*h))/(c**S(3)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, S(19)*d*atanh(x/S(2))/S(432) - d*atanh(x)/S(54) + e*log(-x**S(2) + S(1))/S(27) - e*log(-x**S(2) + S(4))/S(27) + x*(-S(5)*d*x**S(2) + S(17)*d - S(5)*e*x**S(3) + S(17)*e*x)/(S(72)*x**S(4) - S(360)*x**S(2) + S(288)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, e*log(-x**S(2) + S(1))/S(27) - e*log(-x**S(2) + S(4))/S(27) + x*(S(17)*d - S(5)*e*x**S(3) + S(17)*e*x + S(20)*f - x**S(2)*(S(5)*d + S(8)*f))/(S(72)*x**S(4) - S(360)*x**S(2) + S(288)) - (d/S(54) + S(7)*f/S(54))*atanh(x) + (S(19)*d/S(432) + S(13)*f/S(108))*atanh(x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, x*(S(17)*d + S(20)*f - x**S(3)*(S(5)*e + S(8)*g) - x**S(2)*(S(5)*d + S(8)*f) + x*(S(17)*e + S(20)*g))/(S(72)*x**S(4) - S(360)*x**S(2) + S(288)) - (d/S(54) + S(7)*f/S(54))*atanh(x) + (S(19)*d/S(432) + S(13)*f/S(108))*atanh(x/S(2)) + (e/S(27) + S(5)*g/S(54))*log(-x**S(2) + S(1)) - (e/S(27) + S(5)*g/S(54))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, x*(S(17)*d + S(20)*f + S(32)*h - x**S(3)*(S(5)*e + S(8)*g) - x**S(2)*(S(5)*d + S(8)*f + S(20)*h) + x*(S(17)*e + S(20)*g))/(S(72)*x**S(4) - S(360)*x**S(2) + S(288)) + (e/S(27) + S(5)*g/S(54))*log(-x**S(2) + S(1)) - (e/S(27) + S(5)*g/S(54))*log(-x**S(2) + S(4)) - (d/S(54) + S(7)*f/S(54) + S(13)*h/S(54))*atanh(x) + (S(19)*d/S(432) + S(13)*f/S(108) + S(7)*h/S(27))*atanh(x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, x*(S(17)*d + S(20)*f + S(32)*h - x**S(3)*(S(5)*e + S(8)*g + S(20)*i) - x**S(2)*(S(5)*d + S(8)*f + S(20)*h) + x*(S(17)*e + S(20)*g + S(32)*i))/(S(72)*x**S(4) - S(360)*x**S(2) + S(288)) - (d/S(54) + S(7)*f/S(54) + S(13)*h/S(54))*atanh(x) + (S(19)*d/S(432) + S(13)*f/S(108) + S(7)*h/S(27))*atanh(x/S(2)) + (e/S(27) + S(5)*g/S(54) + S(4)*i/S(27))*log(-x**S(2) + S(1)) - (e/S(27) + S(5)*g/S(54) + S(4)*i/S(27))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) + x**S(2) + S(1))**S(2), x), x, -d*log(x**S(2) - x + S(1))/S(4) + d*log(x**S(2) + x + S(1))/S(4) - sqrt(S(3))*d*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(9) + sqrt(S(3))*d*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9) + S(2)*sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) + x*(-d*x**S(2) + d - e*x**S(3) + e*x)/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) + x**S(2) + S(1))**S(2), x), x, S(2)*sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) + x*(d - e*x**S(3) + e*x + f - x**S(2)*(d - S(2)*f))/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)) - (d/S(4) - f/S(8))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(4)*d + f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(4)*d + f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(36), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) + x**S(2) + S(1))**S(2), x), x, x*(d + f - x**S(3)*(e - S(2)*g) - x**S(2)*(d - S(2)*f) + x*(e + g))/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)) - (d/S(4) - f/S(8))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(4)*d + f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(4)*d + f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) + x**S(2) + S(1))**S(2), x), x, x*(d + f - S(2)*h - x**S(3)*(e - S(2)*g) - x**S(2)*(d - S(2)*f + h) + x*(e + g))/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) - (d/S(4) - f/S(8) + h/S(8))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(8) + h/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(4)*d + f + h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(4)*d + f + h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(36), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) + x**S(2) + S(1))**S(2), x), x, x*(d + f - S(2)*h - x**S(3)*(e - S(2)*g + i) - x**S(2)*(d - S(2)*f + h) + x*(e + g - S(2)*i))/(S(6)*x**S(4) + S(6)*x**S(2) + S(6)) - (d/S(4) - f/S(8) + h/S(8))*log(x**S(2) - x + S(1)) + (d/S(4) - f/S(8) + h/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(4)*d + f + h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(4)*d + f + h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*(S(2)*e - g + S(2)*i)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*c*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + sqrt(S(2))*sqrt(c)*d*(b - (-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*d*(b + (-S(12)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(b*c*d*x**S(2) + b*c*e*x**S(3) + d*(-S(2)*a*c + b**S(2)) + e*x*(-S(2)*a*c + b**S(2)))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*c*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d - (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d + (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + b*c*e*x**S(3) + c*x**S(2)*(-S(2)*a*f + b*d) + e*x*(-S(2)*a*c + b**S(2)))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, (-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d - (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d + (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + c*x**S(3)*(-S(2)*a*g + b*e) + c*x**S(2)*(-S(2)*a*f + b*d) + x*(-a*b*g - S(2)*a*c*e + b**S(2)*e))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, (-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x*(-a*b*f - S(2)*a*(-a*h + c*d) + b**S(2)*d + c*x**S(3)*(-S(2)*a*g + b*e) + x**S(2)*(a*b*h - S(2)*a*c*f + b*c*d) + x*(-a*b*g - S(2)*a*c*e + b**S(2)*e))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(-S(2)*a*c*(S(2)*a*h + S(6)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*(-a*h + c*d) - b*(-S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(-S(2)*a*c*(S(2)*a*h + S(6)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*(-a*h + c*d) + b*(S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, (S(2)*a*i - b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x*(-a*b*f - S(2)*a*(-a*h + c*d) + b**S(2)*d + x**S(3)*(a*b*i - S(2)*a*c*g + b*c*e) + x**S(2)*(a*b*h - S(2)*a*c*f + b*c*d) + x*(-a*b*g - S(2)*a*(-a*i + c*e) + b**S(2)*e))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(-S(2)*a*c*(S(2)*a*h + S(6)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*(-a*h + c*d) - b*(-S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(-S(2)*a*c*(S(2)*a*h + S(6)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*(-a*h + c*d) + b*(S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + j*x**S(5) + k*x**S(6) + l*x**S(7) + m*x**S(8))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, l*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + m*x/c**S(2) + (-S(6)*a*b*c*l + b**S(3)*l + S(4)*c**S(3)*e - c**S(2)*(-S(4)*a*j + S(2)*b*g))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) - x*(a*b*c*(a*k + c*f) + S(2)*a*c*(a**S(2)*m - a*c*h + c**S(2)*d) - b**S(2)*(a**S(2)*m + c**S(2)*d) - c*x**S(3)*(-a*b**S(2)*l - S(2)*a*c*(-a*l + c*g) + b*c*(a*j + c*e)) - c*x*(-a*b*(a*l + c*g) - S(2)*a*c*(-a*j + c*e) + b**S(2)*c*e) + x**S(2)*(-a*b**S(3)*m + a*b**S(2)*c*k + S(2)*a*c**S(2)*(-a*k + c*f) - b*c*(-S(3)*a**S(2)*m + a*c*h + c**S(2)*d)))/(S(2)*a*c**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(3)*a*b**S(4)*m - a*b**S(3)*(c*k - S(3)*m*sqrt(-S(4)*a*c + b**S(2))) - S(2)*a*c**S(2)*(-S(10)*a**S(2)*m + S(2)*a*c*h - S(3)*a*k*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c**S(2)*d - c*f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*c*(-a*c*h - a*(S(19)*a*m + k*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*d) - b*c*(S(13)*a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + a*c*(-S(8)*a*k + h*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*(-S(4)*a*f + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(3)*a*b**S(4)*m - a*b**S(3)*(c*k + S(3)*m*sqrt(-S(4)*a*c + b**S(2))) - S(2)*a*c**S(2)*(-S(10)*a**S(2)*m + S(2)*a*c*h + S(3)*a*k*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c**S(2)*d + c*f*sqrt(-S(4)*a*c + b**S(2))) + b**S(2)*c*(-a*c*h + a*(-S(19)*a*m + k*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*d) + b*c*(S(13)*a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + a*c*(S(8)*a*k + h*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*(S(4)*a*f + d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) - S(5)*x**S(2) + S(4))**S(3), x), x, -S(313)*d*atanh(x/S(2))/S(20736) + S(13)*d*atanh(x)/S(648) - e*log(-x**S(2) + S(1))/S(81) + e*log(-x**S(2) + S(4))/S(81) - x*(-S(35)*d*x**S(2) + S(59)*d - S(50)*e*x**S(3) + S(122)*e*x)/(S(3456)*x**S(4) - S(17280)*x**S(2) + S(13824)) + x*(-S(5)*d*x**S(2) + S(17)*d - S(5)*e*x**S(3) + S(17)*e*x)/(S(144)*(x**S(4) - S(5)*x**S(2) + S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(3), x), x, -e*log(-x**S(2) + S(1))/S(81) + e*log(-x**S(2) + S(4))/S(81) - x*(S(59)*d - S(50)*e*x**S(3) + S(122)*e*x + S(380)*f - x**S(2)*(S(35)*d + S(140)*f))/(S(3456)*x**S(4) - S(17280)*x**S(2) + S(13824)) + x*(S(17)*d - S(5)*e*x**S(3) + S(17)*e*x + S(20)*f - x**S(2)*(S(5)*d + S(8)*f))/(S(144)*(x**S(4) - S(5)*x**S(2) + S(4))**S(2)) + (S(13)*d/S(648) + S(25)*f/S(648))*atanh(x) - (S(313)*d + S(820)*f)*atanh(x/S(2))/S(20736), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4))**S(3), x), x, -x*(S(59)*d + S(380)*f - x**S(3)*(S(50)*e + S(152)*g) - x**S(2)*(S(35)*d + S(140)*f) + x*(S(122)*e + S(440)*g))/(S(3456)*x**S(4) - S(17280)*x**S(2) + S(13824)) + x*(S(17)*d + S(20)*f - x**S(3)*(S(5)*e + S(8)*g) - x**S(2)*(S(5)*d + S(8)*f) + x*(S(17)*e + S(20)*g))/(S(144)*(x**S(4) - S(5)*x**S(2) + S(4))**S(2)) + (S(13)*d/S(648) + S(25)*f/S(648))*atanh(x) - (S(313)*d + S(820)*f)*atanh(x/S(2))/S(20736) - (e/S(81) + S(5)*g/S(162))*log(-x**S(2) + S(1)) + (e/S(81) + S(5)*g/S(162))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4))**S(3), x), x, -x*(S(59)*d + S(380)*f + S(848)*h - x**S(3)*(S(50)*e + S(152)*g) - x**S(2)*(S(35)*d + S(140)*f + S(320)*h) + x*(S(122)*e + S(440)*g))/(S(3456)*x**S(4) - S(17280)*x**S(2) + S(13824)) + x*(S(17)*d + S(20)*f + S(32)*h - x**S(3)*(S(5)*e + S(8)*g) - x**S(2)*(S(5)*d + S(8)*f + S(20)*h) + x*(S(17)*e + S(20)*g))/(S(144)*(x**S(4) - S(5)*x**S(2) + S(4))**S(2)) - (e/S(81) + S(5)*g/S(162))*log(-x**S(2) + S(1)) + (e/S(81) + S(5)*g/S(162))*log(-x**S(2) + S(4)) + (S(13)*d/S(648) + S(25)*f/S(648) + S(61)*h/S(648))*atanh(x) - (S(313)*d + S(820)*f + S(1936)*h)*atanh(x/S(2))/S(20736), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4))**S(3), x), x, -x*(S(59)*d + S(380)*f + S(848)*h - x**S(3)*(S(50)*e + S(152)*g + S(320)*i) - x**S(2)*(S(35)*d + S(140)*f + S(320)*h) + x*(S(122)*e + S(440)*g + S(896)*i))/(S(3456)*x**S(4) - S(17280)*x**S(2) + S(13824)) + x*(S(17)*d + S(20)*f + S(32)*h - x**S(3)*(S(5)*e + S(8)*g + S(20)*i) - x**S(2)*(S(5)*d + S(8)*f + S(20)*h) + x*(S(17)*e + S(20)*g + S(32)*i))/(S(144)*(x**S(4) - S(5)*x**S(2) + S(4))**S(2)) + (S(13)*d/S(648) + S(25)*f/S(648) + S(61)*h/S(648))*atanh(x) - (S(313)*d + S(820)*f + S(1936)*h)*atanh(x/S(2))/S(20736) - (e/S(81) + S(5)*g/S(162) + S(11)*i/S(162))*log(-x**S(2) + S(1)) + (e/S(81) + S(5)*g/S(162) + S(11)*i/S(162))*log(-x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(x**S(4) + x**S(2) + S(1))**S(3), x), x, -S(9)*d*log(x**S(2) - x + S(1))/S(32) + S(9)*d*log(x**S(2) + x + S(1))/S(32) - S(13)*sqrt(S(3))*d*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(144) + S(13)*sqrt(S(3))*d*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(144) + S(2)*sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) + x*(-S(7)*d*x**S(2) + S(2)*d - S(6)*e*x**S(3) + S(2)*e*x)/(S(24)*x**S(4) + S(24)*x**S(2) + S(24)) + x*(-d*x**S(2) + d - e*x**S(3) + e*x)/(S(12)*(x**S(4) + x**S(2) + S(1))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(x**S(4) + x**S(2) + S(1))**S(3), x), x, S(2)*sqrt(S(3))*e*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) + x*(S(2)*d - S(6)*e*x**S(3) + S(2)*e*x + S(3)*f - x**S(2)*(S(7)*d - S(7)*f))/(S(24)*x**S(4) + S(24)*x**S(2) + S(24)) + x*(d - e*x**S(3) + e*x + f - x**S(2)*(d - S(2)*f))/(S(12)*(x**S(4) + x**S(2) + S(1))**S(2)) - (S(9)*d/S(32) - f/S(8))*log(x**S(2) - x + S(1)) + (S(9)*d/S(32) - f/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(13)*d + S(2)*f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(13)*d + S(2)*f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(144), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) + x**S(2) + S(1))**S(3), x), x, x*(S(2)*d + S(3)*f - x**S(3)*(S(6)*e - S(6)*g) - x**S(2)*(S(7)*d - S(7)*f) + x*(S(2)*e + S(2)*g))/(S(24)*x**S(4) + S(24)*x**S(2) + S(24)) + x*(d + f - x**S(3)*(e - S(2)*g) - x**S(2)*(d - S(2)*f) + x*(e + g))/(S(12)*(x**S(4) + x**S(2) + S(1))**S(2)) - (S(9)*d/S(32) - f/S(8))*log(x**S(2) - x + S(1)) + (S(9)*d/S(32) - f/S(8))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(13)*d + S(2)*f)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(13)*d + S(2)*f)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) + x**S(2) + S(1))**S(3), x), x, x*(S(2)*d + S(3)*f - h - x**S(3)*(S(6)*e - S(6)*g) - x**S(2)*(S(7)*d - S(7)*f + S(4)*h) + x*(S(2)*e + S(2)*g))/(S(24)*x**S(4) + S(24)*x**S(2) + S(24)) + x*(d + f - S(2)*h - x**S(3)*(e - S(2)*g) - x**S(2)*(d - S(2)*f + h) + x*(e + g))/(S(12)*(x**S(4) + x**S(2) + S(1))**S(2)) + sqrt(S(3))*(S(2)*e - g)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9) - (S(9)*d/S(32) - f/S(8) + S(3)*h/S(32))*log(x**S(2) - x + S(1)) + (S(9)*d/S(32) - f/S(8) + S(3)*h/S(32))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(13)*d + S(2)*f + h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(13)*d + S(2)*f + h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(144), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) + x**S(2) + S(1))**S(3), x), x, x*(S(2)*d + S(3)*f - h - x**S(3)*(S(6)*e - S(6)*g + S(4)*i) - x**S(2)*(S(7)*d - S(7)*f + S(4)*h) + x*(S(2)*e + S(2)*g))/(S(24)*x**S(4) + S(24)*x**S(2) + S(24)) + x*(d + f - S(2)*h - x**S(3)*(e - S(2)*g + i) - x**S(2)*(d - S(2)*f + h) + x*(e + g - S(2)*i))/(S(12)*(x**S(4) + x**S(2) + S(1))**S(2)) - (S(9)*d/S(32) - f/S(8) + S(3)*h/S(32))*log(x**S(2) - x + S(1)) + (S(9)*d/S(32) - f/S(8) + S(3)*h/S(32))*log(x**S(2) + x + S(1)) - sqrt(S(3))*(S(13)*d + S(2)*f + h)*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(13)*d + S(2)*f + h)*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(144) + sqrt(S(3))*(S(2)*e - g + i)*atan(sqrt(S(3))*(S(2)*x**S(2) + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(6)*c**S(2)*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(b*c*d*x**S(2) + b*c*e*x**S(3) + d*(-S(2)*a*c + b**S(2)) + e*x*(-S(2)*a*c + b**S(2)))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - S(3)*sqrt(S(2))*sqrt(c)*d*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4) - b*(-S(8)*a*c + b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + S(3)*sqrt(S(2))*sqrt(c)*d*(S(56)*a**S(2)*c**S(2) - S(10)*a*b**S(2)*c + b**S(4) + b*(-S(8)*a*c + b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(3)*b*c*d*x**S(2)*(-S(8)*a*c + b**S(2)) + S(2)*b*c*e*x**S(3)*(-S(10)*a*c + b**S(2)) + d*(-S(7)*a*c + b**S(2))*(-S(4)*a*c + S(3)*b**S(2)) + e*x*(S(24)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(2)*b**S(4)))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(6)*c**S(2)*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + b*c*e*x**S(3) + c*x**S(2)*(-S(2)*a*f + b*d) + e*x*(-S(2)*a*c + b**S(2)))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d - S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*c*(-S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d - b**S(3)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d + S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*c*(S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d + b**S(3)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(8)*a**S(2)*b*c*f + S(28)*a**S(2)*c**S(2)*d + a*b**S(3)*f - S(25)*a*b**S(2)*c*d + S(3)*b**S(4)*d + S(2)*b*c*e*x**S(3)*(-S(10)*a*c + b**S(2)) + c*x**S(2)*(S(20)*a**S(2)*c*f + a*b**S(2)*f - S(24)*a*b*c*d + S(3)*b**S(3)*d) + e*x*(S(24)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(2)*b**S(4)))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(3)*c*(-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + c*x**S(3)*(-S(2)*a*g + b*e) + c*x**S(2)*(-S(2)*a*f + b*d) + x*(-a*b*g - S(2)*a*c*e + b**S(2)*e))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d - S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*c*(-S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d - b**S(3)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d + S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*c*(S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d + b**S(3)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(8)*a**S(2)*b*c*f + S(28)*a**S(2)*c**S(2)*d + a*b**S(3)*f - S(25)*a*b**S(2)*c*d + S(3)*b**S(4)*d + S(2)*c*x**S(3)*(S(8)*a**S(2)*c*g + a*b**S(2)*g - S(10)*a*b*c*e + b**S(3)*e) + c*x**S(2)*(S(20)*a**S(2)*c*f + a*b**S(2)*f - S(24)*a*b*c*d + S(3)*b**S(3)*d) + x*(S(4)*a**S(2)*b*c*g + S(24)*a**S(2)*c**S(2)*e + S(2)*a*b**S(3)*g - S(20)*a*b**S(2)*c*e + S(2)*b**S(4)*e))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -S(3)*c*(-b*g + S(2)*c*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(-a*b*f - S(2)*a*(-a*h + c*d) + b**S(2)*d + c*x**S(3)*(-S(2)*a*g + b*e) + x**S(2)*(a*b*h - S(2)*a*c*f + b*c*d) + x*(-a*b*g - S(2)*a*c*e + b**S(2)*e))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(6)*a*h + S(42)*c*d - S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(-S(18)*a*h + S(30)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*(-S(13)*a*c*f + S(3)*a*h*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d - b**S(3)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(6)*a*h + S(42)*c*d + S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(-S(18)*a*h + S(30)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*(S(13)*a*c*f + S(3)*a*h*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d + b**S(3)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(8)*a**S(2)*b*c*f + S(4)*a**S(2)*c*(a*h + S(7)*c*d) + a*b**S(3)*f - a*b**S(2)*(S(7)*a*h + S(25)*c*d) + S(3)*b**S(4)*d + S(2)*c*x**S(3)*(S(8)*a**S(2)*c*g + a*b**S(2)*g - S(10)*a*b*c*e + b**S(3)*e) + c*x**S(2)*(S(20)*a**S(2)*c*f + a*b**S(2)*f - S(12)*a*b*(a*h + S(2)*c*d) + S(3)*b**S(3)*d) + x*(S(4)*a**S(2)*b*c*g + S(24)*a**S(2)*c**S(2)*e + S(2)*a*b**S(3)*g - S(20)*a*b**S(2)*c*e + S(2)*b**S(4)*e))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -(S(2)*a*c*i + b**S(2)*i - S(3)*b*c*g + S(6)*c**S(2)*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(-a*b*f - S(2)*a*(-a*h + c*d) + b**S(2)*d + x**S(3)*(a*b*i - S(2)*a*c*g + b*c*e) + x**S(2)*(a*b*h - S(2)*a*c*f + b*c*d) + x*(-a*b*g - S(2)*a*(-a*i + c*e) + b**S(2)*e))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(6)*a*h + S(42)*c*d - S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(-S(18)*a*h + S(30)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*(-S(13)*a*c*f + S(3)*a*h*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d - b**S(3)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(6)*a*h + S(42)*c*d + S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(-S(18)*a*h + S(30)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*(S(13)*a*c*f + S(3)*a*h*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d + b**S(3)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(8)*a**S(2)*b*c*f + S(4)*a**S(2)*c*(a*h + S(7)*c*d) + a*b**S(3)*f - a*b**S(2)*(S(7)*a*h + S(25)*c*d) + S(3)*b**S(4)*d + S(2)*c*x**S(3)*(S(8)*a**S(2)*c*g + a*b**S(2)*g - S(2)*a*b*(S(3)*a*i + S(5)*c*e) + b**S(3)*e) + c*x**S(2)*(S(20)*a**S(2)*c*f + a*b**S(2)*f - S(12)*a*b*(a*h + S(2)*c*d) + S(3)*b**S(3)*d) + x*(S(4)*a**S(2)*b*c*g + S(8)*a**S(2)*c*(a*i + S(3)*c*e) + S(2)*a*b**S(3)*g - S(4)*a*b**S(2)*(S(2)*a*i + S(5)*c*e) + S(2)*b**S(4)*e))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + j*x**S(5) + k*x**S(6) + l*x**S(7) + m*x**S(8))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, -(-S(3)*a*b*l + S(2)*a*c*j + b**S(2)*j - S(3)*b*c*g + S(6)*c**S(2)*e)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) - x*(a*b*c*(a*k + c*f) + S(2)*a*c*(a**S(2)*m - a*c*h + c**S(2)*d) - b**S(2)*(a**S(2)*m + c**S(2)*d) - c*x**S(3)*(-a*b**S(2)*l - S(2)*a*c*(-a*l + c*g) + b*c*(a*j + c*e)) - c*x*(-a*b*(a*l + c*g) - S(2)*a*c*(-a*j + c*e) + b**S(2)*c*e) + x**S(2)*(-a*b**S(3)*m + a*b**S(2)*c*k + S(2)*a*c**S(2)*(-a*k + c*f) - b*c*(-S(3)*a**S(2)*m + a*c*h + c**S(2)*d)))/(S(4)*a*c**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x*(S(4)*a**S(2)*b*c**S(2)*(a*k + S(2)*c*f) + S(4)*a**S(2)*c**S(2)*(-S(9)*a**S(2)*m + a*c*h + S(7)*c**S(2)*d) + a*b**S(3)*c*(S(2)*a*k + c*f) - a*b**S(2)*c*(-S(11)*a**S(2)*m + S(7)*a*c*h + S(25)*c**S(2)*d) + b**S(4)*(-S(2)*a**S(2)*m + S(3)*c**S(2)*d) + S(2)*c**S(2)*x**S(3)*(S(8)*a**S(2)*c*(a*l + c*g) + a*b**S(2)*(a*l + c*g) - S(2)*a*b*c*(S(3)*a*j + S(5)*c*e) + b**S(3)*c*e) + c*x**S(2)*(S(4)*a**S(2)*c**S(2)*(S(3)*a*k + S(5)*c*f) + a*b**S(2)*c*(S(3)*a*k + c*f) - S(4)*a*b*c*(S(4)*a**S(2)*m + S(3)*a*c*h + S(6)*c**S(2)*d) + b**S(3)*(a**S(2)*m + S(3)*c**S(2)*d)) + S(2)*c*x*(S(2)*a**S(2)*b*c*(a*l + c*g) + S(4)*a**S(2)*c**S(2)*(a*j + S(3)*c*e) + a*b**S(3)*(a*l + c*g) - S(2)*a*b**S(2)*c*(S(2)*a*j + S(5)*c*e) + b**S(4)*c*e))/(S(8)*a**S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(4)*a**S(2)*c**S(2)*(S(10)*a**S(2)*m + S(6)*a*c*h - S(3)*a*k*sqrt(-S(4)*a*c + b**S(2)) + S(42)*c**S(2)*d - S(5)*c*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*c*(S(3)*a*(-S(6)*a*m + k*sqrt(-S(4)*a*c + b**S(2))) + S(30)*c**S(2)*d + c*(-S(18)*a*h + f*sqrt(-S(4)*a*c + b**S(2)))) + S(4)*a*b*c*(S(4)*a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + S(3)*a*c*(-S(3)*a*k + h*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*(-S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*(-a**S(2)*m + S(3)*c**S(2)*d) - b**S(3)*(S(3)*a**S(2)*c*k + a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*(S(4)*a**S(2)*c**S(2)*(S(10)*a**S(2)*m + S(6)*a*c*h + S(3)*a*k*sqrt(-S(4)*a*c + b**S(2)) + S(42)*c**S(2)*d + S(5)*c*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*c*(-S(3)*a*(S(6)*a*m + k*sqrt(-S(4)*a*c + b**S(2))) + S(30)*c**S(2)*d - c*(S(18)*a*h + f*sqrt(-S(4)*a*c + b**S(2)))) - S(4)*a*b*c*(S(4)*a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + S(3)*a*c*(S(3)*a*k + h*sqrt(-S(4)*a*c + b**S(2))) + c**S(2)*(S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2)))) + b**S(4)*(-a**S(2)*m + S(3)*c**S(2)*d) + b**S(3)*(-S(3)*a**S(2)*c*k + a**S(2)*m*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5) + j*x**S(6) + k*x**S(7))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, k*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + (-S(6)*a*b*c*k + b**S(3)*k + S(4)*c**S(3)*e - c**S(2)*(-S(4)*a*i + S(2)*b*g))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x*(-a*b*(a*j + c*f) - S(2)*a*c*(-a*h + c*d) + b**S(2)*c*d + x**S(3)*(-a*b**S(2)*k - S(2)*a*c*(-a*k + c*g) + b*c*(a*i + c*e)) + x**S(2)*(-a*b**S(2)*j - S(2)*a*c*(-a*j + c*f) + b*c*(a*h + c*d)) + x*(-a*b*(a*k + c*g) - S(2)*a*c*(-a*i + c*e) + b**S(2)*c*e))/(S(2)*a*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(a*b**S(3)*j + S(2)*a*c*(S(2)*a*c*h - S(3)*a*j*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c**S(2)*d - c*f*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*(-a*c*h - a*j*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*d) + b*c*(-S(8)*a**S(2)*j - S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*(a*b**S(3)*j + S(2)*a*c*(S(2)*a*c*h + S(3)*a*j*sqrt(-S(4)*a*c + b**S(2)) + S(6)*c**S(2)*d + c*f*sqrt(-S(4)*a*c + b**S(2))) - b**S(2)*(-a*c*h + a*j*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*d) - b*c*(S(8)*a**S(2)*j + S(4)*a*c*f + a*h*sqrt(-S(4)*a*c + b**S(2)) + c*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) # long time assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5) + j*x**S(8) + k*x**S(11))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, k*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) - (-S(30)*a**S(2)*b*c**S(2)*k + S(10)*a*b**S(3)*c*k - b**S(5)*k + S(2)*b**S(2)*c**S(3)*i + S(12)*c**S(5)*e - c**S(4)*(-S(4)*a*i + S(6)*b*g))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*(-S(4)*a*c + b**S(2))**(S(5)/2)) - x*(c*x**S(2)*(-a*b**S(3)*j + S(2)*a*c**S(3)*f - b*c*(-S(3)*a**S(2)*j + a*c*h + c**S(2)*d)) + c*(a*b*c**S(2)*f + S(2)*a*c*(a**S(2)*j - a*c*h + c**S(2)*d) - b**S(2)*(a**S(2)*j + c**S(2)*d)) - x**S(3)*(-S(2)*a**S(3)*c**S(2)*k + S(4)*a**S(2)*b**S(2)*c*k - a*b**S(4)*k - S(2)*a*c**S(4)*g + b*c**S(3)*(a*i + c*e)) - x*(-a**S(2)*b**S(3)*k - S(2)*a*c**S(3)*(-a*i + c*e) + b**S(2)*c**S(3)*e - b*(-S(3)*a**S(3)*c*k + a*c**S(3)*g)))/(S(4)*a*c**S(3)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) + x*(c**S(2)*x**S(2)*(S(20)*a**S(2)*c**S(3)*f + a*b**S(2)*c**S(2)*f - S(4)*a*b*c*(S(4)*a**S(2)*j + S(3)*a*c*h + S(6)*c**S(2)*d) + b**S(3)*(a**S(2)*j + S(3)*c**S(2)*d)) + S(2)*c*x**S(3)*(-S(24)*a**S(4)*c**S(2)*k - S(3)*a**S(2)*b**S(4)*k + S(8)*a**S(2)*c**S(4)*g - S(2)*a*b*c**S(3)*(S(3)*a*i + S(5)*c*e) + b**S(3)*c**S(3)*e + b**S(2)*(S(21)*a**S(3)*c*k + a*c**S(3)*g)) + c*(S(8)*a**S(2)*b*c**S(3)*f + S(4)*a**S(2)*c**S(2)*(-S(9)*a**S(2)*j + a*c*h + S(7)*c**S(2)*d) + a*b**S(3)*c**S(2)*f - a*b**S(2)*c*(-S(11)*a**S(2)*j + S(7)*a*c*h + S(25)*c**S(2)*d) + b**S(4)*(-S(2)*a**S(2)*j + S(3)*c**S(2)*d)) + x*(S(2)*a**S(2)*b**S(5)*k + S(8)*a**S(2)*c**S(4)*(a*i + S(3)*c*e) - S(4)*a*b**S(2)*c**S(3)*(S(2)*a*i + S(5)*c*e) + S(2)*b**S(4)*c**S(3)*e + S(2)*b**S(3)*(-S(9)*a**S(3)*c*k + a*c**S(3)*g) + S(4)*b*(S(13)*a**S(4)*c**S(2)*k + a**S(2)*c**S(4)*g)))/(S(8)*a**S(2)*c**S(3)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(-S(4)*a**S(2)*c**S(2)*(S(10)*a**S(2)*j + S(6)*a*c*h + S(42)*c**S(2)*d - S(5)*c*f*sqrt(-S(4)*a*c + b**S(2))) + a*b**S(2)*c*(-S(18)*a**S(2)*j - S(18)*a*c*h + S(30)*c**S(2)*d + c*f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*c*(S(4)*a**S(2)*j*sqrt(-S(4)*a*c + b**S(2)) + S(3)*a*c*h*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(-S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2)))) - b**S(4)*(-a**S(2)*j + S(3)*c**S(2)*d) + b**S(3)*(a**S(2)*j*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) - sqrt(S(2))*(-S(4)*a**S(2)*c**S(2)*(S(10)*a**S(2)*j + S(6)*a*c*h + S(42)*c**S(2)*d + S(5)*c*f*sqrt(-S(4)*a*c + b**S(2))) + a*b**S(2)*c*(-S(18)*a**S(2)*j - S(18)*a*c*h + S(30)*c**S(2)*d - c*f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*c*(S(4)*a**S(2)*j*sqrt(-S(4)*a*c + b**S(2)) + S(3)*a*c*h*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2)))) - b**S(4)*(-a**S(2)*j + S(3)*c**S(2)*d) - b**S(3)*(a**S(2)*j*sqrt(-S(4)*a*c + b**S(2)) + c**S(2)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2)))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(3)*(a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d)), x), x, a**S(4)*d*x + a**S(4)*e*x**S(2)/S(2) + a**S(3)*b*e*x**S(4) + a**S(3)*x**S(3)*(a*f + S(4)*b*d)/S(3) + a**S(2)*e*x**S(6)*(S(2)*a*c + S(3)*b**S(2))/S(3) + S(2)*a**S(2)*x**S(5)*(S(2)*a*b*f + S(2)*a*c*d + S(3)*b**S(2)*d)/S(5) + a*b*e*x**S(8)*(S(3)*a*c + b**S(2))/S(2) + S(2)*a*x**S(7)*(S(2)*a**S(2)*c*f + S(3)*a*b**S(2)*f + S(6)*a*b*c*d + S(2)*b**S(3)*d)/S(7) + b*c**S(3)*e*x**S(16)/S(4) + b*c*e*x**S(12)*(S(3)*a*c + b**S(2))/S(3) + c**S(4)*e*x**S(18)/S(18) + c**S(4)*f*x**S(19)/S(19) + c**S(3)*x**S(17)*(S(4)*b*f + c*d)/S(17) + c**S(2)*e*x**S(14)*(S(2)*a*c + S(3)*b**S(2))/S(7) + S(2)*c**S(2)*x**S(15)*(S(2)*a*c*f + S(3)*b**S(2)*f + S(2)*b*c*d)/S(15) + S(2)*c*x**S(13)*(S(6)*a*b*c*f + S(2)*a*c**S(2)*d + S(2)*b**S(3)*f + S(3)*b**S(2)*c*d)/S(13) + e*x**S(10)*(S(3)*a**S(2)*c**S(2)/S(5) + S(6)*a*b**S(2)*c/S(5) + b**S(4)/S(10)) + x**S(11)*(S(6)*a**S(2)*c**S(2)*f/S(11) + S(12)*a*b**S(2)*c*f/S(11) + S(12)*a*b*c**S(2)*d/S(11) + b**S(4)*f/S(11) + S(4)*b**S(3)*c*d/S(11)) + x**S(9)*(S(4)*a**S(2)*b*c*f/S(3) + S(2)*a**S(2)*c**S(2)*d/S(3) + S(4)*a*b**S(3)*f/S(9) + S(4)*a*b**S(2)*c*d/S(3) + b**S(4)*d/S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))**S(2)*(a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d)), x), x, a**S(3)*d*x + a**S(3)*e*x**S(2)/S(2) + S(3)*a**S(2)*b*e*x**S(4)/S(4) + a**S(2)*x**S(3)*(a*f + S(3)*b*d)/S(3) + a*e*x**S(6)*(a*c + b**S(2))/S(2) + S(3)*a*x**S(5)*(a*b*f + a*c*d + b**S(2)*d)/S(5) + b*c**S(2)*e*x**S(12)/S(4) + b*e*x**S(8)*(S(6)*a*c + b**S(2))/S(8) + c**S(3)*e*x**S(14)/S(14) + c**S(3)*f*x**S(15)/S(15) + c**S(2)*x**S(13)*(S(3)*b*f + c*d)/S(13) + S(3)*c*e*x**S(10)*(a*c + b**S(2))/S(10) + S(3)*c*x**S(11)*(a*c*f + b**S(2)*f + b*c*d)/S(11) + x**S(9)*(S(2)*a*b*c*f/S(3) + a*c**S(2)*d/S(3) + b**S(3)*f/S(9) + b**S(2)*c*d/S(3)) + x**S(7)*(S(3)*a**S(2)*c*f/S(7) + S(3)*a*b**S(2)*f/S(7) + S(6)*a*b*c*d/S(7) + b**S(3)*d/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2) + c*x**S(4))*(a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d)), x), x, a**S(2)*d*x + a**S(2)*e*x**S(2)/S(2) + a*b*e*x**S(4)/S(2) + a*x**S(3)*(a*f + S(2)*b*d)/S(3) + b*c*e*x**S(8)/S(4) + c**S(2)*e*x**S(10)/S(10) + c**S(2)*f*x**S(11)/S(11) + c*x**S(9)*(S(2)*b*f + c*d)/S(9) + e*x**S(6)*(a*c/S(3) + b**S(2)/S(6)) + x**S(7)*(S(2)*a*c*f/S(7) + b**S(2)*f/S(7) + S(2)*b*c*d/S(7)) + x**S(5)*(S(2)*a*b*f/S(5) + S(2)*a*c*d/S(5) + b**S(2)*d/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d))/(a + b*x**S(2) + c*x**S(4)), x), x, d*x + e*x**S(2)/S(2) + f*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)) + sqrt(S(2))*(f - (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(f + (-b*f + S(2)*c*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d))/(a + b*x**S(2) + c*x**S(4))**S(3), x), x, S(2)*c*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d - (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(-S(2)*a*f + b*d + (S(4)*a*b*f - S(12)*a*c*d + b**S(2)*d)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + b*c*e*x**S(3) + c*x**S(2)*(-S(2)*a*f + b*d) + e*x*(-S(2)*a*c + b**S(2)))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*d + a*e*x + b*e*x**S(3) + c*e*x**S(5) + c*f*x**S(6) + x**S(4)*(b*f + c*d) + x**S(2)*(a*f + b*d))/(a + b*x**S(2) + c*x**S(4))**S(4), x), x, -S(6)*c**S(2)*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(5)/2) + x*(-a*b*f - S(2)*a*c*d + b**S(2)*d + b*c*e*x**S(3) + c*x**S(2)*(-S(2)*a*f + b*d) + e*x*(-S(2)*a*c + b**S(2)))/(S(4)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)) - sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d - S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d + f*sqrt(-S(4)*a*c + b**S(2))) + S(4)*a*b*c*(-S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d - b**S(3)*(-a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + sqrt(S(2))*sqrt(c)*(S(4)*a**S(2)*c*(S(42)*c*d + S(5)*f*sqrt(-S(4)*a*c + b**S(2))) - a*b**S(2)*(S(30)*c*d - f*sqrt(-S(4)*a*c + b**S(2))) - S(4)*a*b*c*(S(13)*a*f + S(6)*d*sqrt(-S(4)*a*c + b**S(2))) + S(3)*b**S(4)*d + b**S(3)*(a*f + S(3)*d*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(16)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(5)/2)) + x*(S(8)*a**S(2)*b*c*f + S(28)*a**S(2)*c**S(2)*d + a*b**S(3)*f - S(25)*a*b**S(2)*c*d + S(3)*b**S(4)*d + S(2)*b*c*e*x**S(3)*(-S(10)*a*c + b**S(2)) + c*x**S(2)*(S(20)*a**S(2)*c*f + a*b**S(2)*f - S(24)*a*b*c*d + S(3)*b**S(3)*d) + e*x*(S(24)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(2)*b**S(4)))/(S(8)*a**S(2)*(-S(4)*a*c + b**S(2))**S(2)*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, e*x + (d - S(2)*e)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, f*(x + S(2))**S(2)/S(2) + x*(e - S(4)*f) + (d - S(2)*e + S(4)*f)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, g*(x + S(2))**S(3)/S(3) + x*(e - S(4)*f + S(12)*g) + (f/S(2) - S(3)*g)*(x + S(2))**S(2) + (d - S(2)*e + S(4)*f - S(8)*g)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, h*x**S(4)/S(4) + x**S(3)*(g/S(3) - S(2)*h/S(3)) + x**S(2)*(f/S(2) - g + S(2)*h) + x*(e - S(2)*f + S(4)*g - S(8)*h) + (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, i*x**S(5)/S(5) + x**S(4)*(h/S(4) - i/S(2)) + x**S(3)*(g/S(3) - S(2)*h/S(3) + S(4)*i/S(3)) + x**S(2)*(f/S(2) - g + S(2)*h - S(4)*i) + x*(e - S(2)*f + S(4)*g - S(8)*h + S(16)*i) + (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h - S(32)*i)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -S(2)*atanh(S(2)*x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -(d - S(2)*e)*log(x + S(2)) + (d - e)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))*(x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, f*x - (d - S(2)*e + S(4)*f)*log(x + S(2)) + (d - e + f)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, g*x**S(2)/S(2) + x*(f - S(3)*g) - (d - S(2)*e + S(4)*f - S(8)*g)*log(x + S(2)) + (d - e + f - g)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, h*x**S(3)/S(3) + x**S(2)*(g/S(2) - S(3)*h/S(2)) + x*(f - S(3)*g + S(7)*h) - (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h)*log(x + S(2)) + (d - e + f - g + h)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, i*x**S(4)/S(4) + x**S(3)*(h/S(3) - i) + x**S(2)*(g/S(2) - S(3)*h/S(2) + S(7)*i/S(2)) + x*(f - S(3)*g + S(7)*h - S(15)*i) - (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h - S(32)*i)*log(x + S(2)) + (d - e + f - g + h - i)*log(x + S(1)), expand=True, _diff=True, _numerical=True) # wromg result (rule) assert rubi_test(rubi_integrate((x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, -log(-x + S(1))/S(2) + log(-x + S(2))/S(3) + log(x + S(1))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, (-d/S(2) - e/S(2))*log(-x + S(1)) + (d/S(6) - e/S(6))*log(x + S(1)) + (d/S(3) + S(2)*e/S(3))*log(-x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, (-d/S(2) - e/S(2) - f/S(2))*log(-x + S(1)) + (d/S(6) - e/S(6) + f/S(6))*log(x + S(1)) + (d/S(3) + S(2)*e/S(3) + S(4)*f/S(3))*log(-x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, g*x + (d/S(6) - e/S(6) + f/S(6) - g/S(6))*log(x + S(1)) + (d/S(3) + S(2)*e/S(3) + S(4)*f/S(3) + S(8)*g/S(3))*log(-x + S(2)) - (d/S(2) + e/S(2) + f/S(2) + g/S(2))*log(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, h*x**S(2)/S(2) + x*(g + S(2)*h) + (d/S(6) - e/S(6) + f/S(6) - g/S(6) + h/S(6))*log(x + S(1)) + (d/S(3) + S(2)*e/S(3) + S(4)*f/S(3) + S(8)*g/S(3) + S(16)*h/S(3))*log(-x + S(2)) - (d/S(2) + e/S(2) + f/S(2) + g/S(2) + h/S(2))*log(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4)), x), x, i*x**S(3)/S(3) + x**S(2)*(h/S(2) + i) + x*(g + S(2)*h + S(5)*i) + (d/S(6) - e/S(6) + f/S(6) - g/S(6) + h/S(6) - i/S(6))*log(x + S(1)) + (d/S(3) + S(2)*e/S(3) + S(4)*f/S(3) + S(8)*g/S(3) + S(16)*h/S(3) + S(32)*i/S(3))*log(-x + S(2)) - (d/S(2) + e/S(2) + f/S(2) + g/S(2) + h/S(2) + i/S(2))*log(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, -log(-x + S(1))/S(18) + log(-x + S(2))/S(48) + log(x + S(1))/S(6) - S(19)*log(x + S(2))/S(144) + S(1)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(48) + e/S(24))*log(-x + S(2)) - (d/S(18) + e/S(18))*log(-x + S(1)) - (S(19)*d/S(144) - S(13)*e/S(72))*log(x + S(2)) + (d/S(6) - e/S(6))*log(x + S(1)) + (d - S(2)*e)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(48) + e/S(24) + f/S(12))*log(-x + S(2)) - (d/S(18) + e/S(18) + f/S(18))*log(-x + S(1)) - (S(19)*d/S(144) - S(13)*e/S(72) + S(7)*f/S(36))*log(x + S(2)) + (d/S(6) - e/S(6) + f/S(6))*log(x + S(1)) + (d - S(2)*e + S(4)*f)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))*(x**S(3) - S(2)*x**S(2) - x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(48) + e/S(24) + f/S(12) + g/S(6))*log(-x + S(2)) - (d/S(18) + e/S(18) + f/S(18) + g/S(18))*log(-x + S(1)) - (S(19)*d/S(144) - S(13)*e/S(72) + S(7)*f/S(36) - g/S(18))*log(x + S(2)) + (d/S(6) - e/S(6) + f/S(6) - g/S(6))*log(x + S(1)) + (d - S(2)*e + S(4)*f - S(8)*g)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(48) + e/S(24) + f/S(12) + g/S(6) + h/S(3))*log(-x + S(2)) - (d/S(18) + e/S(18) + f/S(18) + g/S(18) + h/S(18))*log(-x + S(1)) - (S(19)*d/S(144) - S(13)*e/S(72) + S(7)*f/S(36) - g/S(18) - S(5)*h/S(9))*log(x + S(2)) + (d/S(6) - e/S(6) + f/S(6) - g/S(6) + h/S(6))*log(x + S(1)) + (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) - x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, i*x + (d/S(48) + e/S(24) + f/S(12) + g/S(6) + h/S(3) + S(2)*i/S(3))*log(-x + S(2)) - (d/S(18) + e/S(18) + f/S(18) + g/S(18) + h/S(18) + i/S(18))*log(-x + S(1)) - (S(19)*d/S(144) - S(13)*e/S(72) + S(7)*f/S(36) - g/S(18) - S(5)*h/S(9) + S(22)*i/S(9))*log(x + S(2)) + (d/S(6) - e/S(6) + f/S(6) - g/S(6) + h/S(6) - i/S(6))*log(x + S(1)) + (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h - S(32)*i)/(S(12)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, -(S(3)*x + S(5))/(S(12)*x**S(2) + S(36)*x + S(24)) - log(-x + S(1))/S(36) + log(-x + S(2))/S(144) - S(7)*log(x + S(1))/S(36) + S(31)*log(x + S(2))/S(144), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) + e/S(72))*log(-x + S(2)) - (d/S(36) + e/S(36))*log(-x + S(1)) - (S(7)*d/S(36) - S(13)*e/S(36))*log(x + S(1)) + (S(31)*d/S(144) - S(25)*e/S(72))*log(x + S(2)) - (S(5)*d - S(6)*e + x*(S(3)*d - S(4)*e))/(S(12)*x**S(2) + S(36)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))*(x**S(2) - S(3)*x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) + e/S(72) + f/S(36))*log(-x + S(2)) - (d/S(36) + e/S(36) + f/S(36))*log(-x + S(1)) - (S(7)*d/S(36) - S(13)*e/S(36) + S(19)*f/S(36))*log(x + S(1)) + (S(31)*d/S(144) - S(25)*e/S(72) + S(19)*f/S(36))*log(x + S(2)) - (S(5)*d - S(6)*e + S(8)*f + x*(S(3)*d - S(4)*e + S(6)*f))/(S(12)*x**S(2) + S(36)*x + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) + e/S(72) + f/S(36) + g/S(18))*log(-x + S(2)) - (d/S(36) + e/S(36) + f/S(36) + g/S(36))*log(-x + S(1)) - (S(7)*d/S(36) - S(13)*e/S(36) + S(19)*f/S(36) - S(25)*g/S(36))*log(x + S(1)) + (S(31)*d/S(144) - S(25)*e/S(72) + S(19)*f/S(36) - S(13)*g/S(18))*log(x + S(2)) - (d - S(2)*e + S(4)*f - S(8)*g)/(S(12)*x + S(24)) - (d - e + f - g)/(S(6)*x + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) + e/S(72) + f/S(36) + g/S(18) + h/S(9))*log(-x + S(2)) - (d/S(36) + e/S(36) + f/S(36) + g/S(36) + h/S(36))*log(-x + S(1)) - (S(7)*d/S(36) - S(13)*e/S(36) + S(19)*f/S(36) - S(25)*g/S(36) + S(31)*h/S(36))*log(x + S(1)) + (S(31)*d/S(144) - S(25)*e/S(72) + S(19)*f/S(36) - S(13)*g/S(18) + S(7)*h/S(9))*log(x + S(2)) - (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h)/(S(12)*x + S(24)) - (d - e + f - g + h)/(S(6)*x + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) + e/S(72) + f/S(36) + g/S(18) + h/S(9) + S(2)*i/S(9))*log(-x + S(2)) - (d/S(36) + e/S(36) + f/S(36) + g/S(36) + h/S(36) + i/S(36))*log(-x + S(1)) - (S(7)*d/S(36) - S(13)*e/S(36) + S(19)*f/S(36) - S(25)*g/S(36) + S(31)*h/S(36) - S(37)*i/S(36))*log(x + S(1)) + (S(31)*d/S(144) - S(25)*e/S(72) + S(19)*f/S(36) - S(13)*g/S(18) + S(7)*h/S(9) - S(2)*i/S(9))*log(x + S(2)) - (d - S(2)*e + S(4)*f - S(8)*g + S(16)*h - S(32)*i)/(S(12)*x + S(24)) - (d - e + f - g + h - i)/(S(6)*x + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, log(-x + S(1))/S(18) - S(35)*log(-x + S(2))/S(432) + log(x + S(1))/S(54) + log(x + S(2))/S(144) - S(1)/(S(36)*x + S(36)) + S(1)/(-S(12)*x + S(12)) + S(1)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)*(x + S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) - e/S(72))*log(x + S(2)) + (d/S(54) + e/S(108))*log(x + S(1)) + (d/S(18) + S(5)*e/S(36))*log(-x + S(1)) - (S(35)*d/S(432) + S(29)*e/S(216))*log(-x + S(2)) - (d - e)/(S(36)*x + S(36)) + (d + e)/(-S(12)*x + S(12)) + (d + S(2)*e)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) - e/S(72) + f/S(36))*log(x + S(2)) + (d/S(54) + e/S(108) - f/S(27))*log(x + S(1)) + (d/S(18) + S(5)*e/S(36) + S(2)*f/S(9))*log(-x + S(1)) - (S(35)*d/S(432) + S(29)*e/S(216) + S(23)*f/S(108))*log(-x + S(2)) - (d - e + f)/(S(36)*x + S(36)) + (d + e + f)/(-S(12)*x + S(12)) + (d + S(2)*e + S(4)*f)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) - e/S(72) + f/S(36) - g/S(18))*log(x + S(2)) + (d/S(54) + e/S(108) - f/S(27) + S(7)*g/S(108))*log(x + S(1)) + (d/S(18) + S(5)*e/S(36) + S(2)*f/S(9) + S(11)*g/S(36))*log(-x + S(1)) - (S(35)*d/S(432) + S(29)*e/S(216) + S(23)*f/S(108) + S(17)*g/S(54))*log(-x + S(2)) - (d - e + f - g)/(S(36)*x + S(36)) + (d + e + f + g)/(-S(12)*x + S(12)) + (d + S(2)*e + S(4)*f + S(8)*g)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) - e/S(72) + f/S(36) - g/S(18) + h/S(9))*log(x + S(2)) + (d/S(54) + e/S(108) - f/S(27) + S(7)*g/S(108) - S(5)*h/S(54))*log(x + S(1)) + (d/S(18) + S(5)*e/S(36) + S(2)*f/S(9) + S(11)*g/S(36) + S(7)*h/S(18))*log(-x + S(1)) - (S(35)*d/S(432) + S(29)*e/S(216) + S(23)*f/S(108) + S(17)*g/S(54) + S(11)*h/S(27))*log(-x + S(2)) - (d - e + f - g + h)/(S(36)*x + S(36)) + (d + e + f + g + h)/(-S(12)*x + S(12)) + (d + S(2)*e + S(4)*f + S(8)*g + S(16)*h)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))*(d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + i*x**S(5))/(x**S(4) - S(5)*x**S(2) + S(4))**S(2), x), x, (d/S(144) - e/S(72) + f/S(36) - g/S(18) + h/S(9) - S(2)*i/S(9))*log(x + S(2)) + (d/S(54) + e/S(108) - f/S(27) + S(7)*g/S(108) - S(5)*h/S(54) + S(13)*i/S(108))*log(x + S(1)) + (d/S(18) + S(5)*e/S(36) + S(2)*f/S(9) + S(11)*g/S(36) + S(7)*h/S(18) + S(17)*i/S(36))*log(-x + S(1)) - (S(35)*d/S(432) + S(29)*e/S(216) + S(23)*f/S(108) + S(17)*g/S(54) + S(11)*h/S(27) + S(10)*i/S(27))*log(-x + S(2)) - (d - e + f - g + h - i)/(S(36)*x + S(36)) + (d + e + f + g + h + i)/(-S(12)*x + S(12)) + (d + S(2)*e + S(4)*f + S(8)*g + S(16)*h + S(32)*i)/(-S(36)*x + S(72)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*g - c*g*x**S(4))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, g*x/sqrt(a + b*x**S(2) + c*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*g - c*g*x**S(4) + e*x)/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(b*e + S(2)*c*e*x**S(2) - g*x*(-S(4)*a*c + b**S(2)))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*g - c*g*x**S(4) + f*x**S(3))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, (S(2)*a*f + b*f*x**S(2) + g*x*(-S(4)*a*c + b**S(2)))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*g - c*g*x**S(4) + e*x + f*x**S(3))/(a + b*x**S(2) + c*x**S(4))**(S(3)/2), x), x, -(-S(2)*a*f + b*e - g*x*(-S(4)*a*c + b**S(2)) + x**S(2)*(-b*f + S(2)*c*e))/((-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) # large time assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3) + h*x**S(4) + j*x**S(5) + k*x**S(6) + l*x**S(7) + m*x**S(8))/(a + b*x**S(3) + c*x**S(6)), x), x, k*x/c + l*x**S(2)/(S(2)*c) + m*x**S(3)/(S(3)*c) + (-b*m + c*j)*log(a + b*x**S(3) + c*x**S(6))/(S(6)*c**S(2)) - (-S(2)*a*c*m + b**S(2)*m - b*c*j + S(2)*c**S(2)*f)*atanh((b + S(2)*c*x**S(3))/sqrt(-S(4)*a*c + b**S(2)))/(S(3)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))) + S(2)**(S(2)/3)*(-b*k/c + g - (-S(2)*a*c*k + b**S(2)*k - b*c*g + S(2)*c**S(2)*d)/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(-b*k/c + g - (-S(2)*a*c*k + b**S(2)*k - b*c*g + S(2)*c**S(2)*d)/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(-b*k/c + g - (-S(2)*a*c*k + b**S(2)*k - b*c*g + S(2)*c**S(2)*d)/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) + S(2)**(S(2)/3)*(-b*k/c + g + (b**S(2)*k + S(2)*c**S(2)*d - c*(S(2)*a*k + b*g))/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*(-b*k/c + g + (b**S(2)*k + S(2)*c**S(2)*d - c*(S(2)*a*k + b*g))/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(2)/3)*sqrt(S(3))*(-b*k/c + g + (b**S(2)*k + S(2)*c**S(2)*d - c*(S(2)*a*k + b*g))/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(1)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3)) - S(2)**(S(1)/3)*(-b*l/c + h - (-S(2)*a*c*l + b**S(2)*l - b*c*h + S(2)*c**S(2)*e)/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(-b*l/c + h - (-S(2)*a*c*l + b**S(2)*l - b*c*h + S(2)*c**S(2)*e)/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b + sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(-b*l/c + h - (-S(2)*a*c*l + b**S(2)*l - b*c*h + S(2)*c**S(2)*e)/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(b + sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*(-b*l/c + h + (b**S(2)*l + S(2)*c**S(2)*e - c*(S(2)*a*l + b*h))/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(1)/3)*c**(S(1)/3)*x + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3))/(S(6)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) + S(2)**(S(1)/3)*(-b*l/c + h + (b**S(2)*l + S(2)*c**S(2)*e - c*(S(2)*a*l + b*h))/(c*sqrt(-S(4)*a*c + b**S(2))))*log(S(2)**(S(2)/3)*c**(S(2)/3)*x**S(2) - S(2)**(S(1)/3)*c**(S(1)/3)*x*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + (b - sqrt(-S(4)*a*c + b**S(2)))**(S(2)/3))/(S(12)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)) - S(2)**(S(1)/3)*sqrt(S(3))*(-b*l/c + h + (b**S(2)*l + S(2)*c**S(2)*e - c*(S(2)*a*l + b*h))/(c*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*c**(S(1)/3)*x/(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3) + S(1))/S(3))/(S(6)*c**(S(2)/3)*(b - sqrt(-S(4)*a*c + b**S(2)))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*f*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*f*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x**n + c*x**(S(2)*n)), x), x, -S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*d*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) - c*e*x**S(2)*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*f*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) + S(3)*b*sqrt(-S(4)*a*c + b**S(2))) - S(2)*c*f*x**S(3)*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(12)*a*c + S(3)*b**S(2) - S(3)*b*sqrt(-S(4)*a*c + b**S(2))) - c*g*x**S(4)*hyper((S(1), S(4)/n), ((n + S(4))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(-S(8)*a*c + S(2)*b**S(2) + S(2)*b*sqrt(-S(4)*a*c + b**S(2))) - c*g*x**S(4)*hyper((S(1), S(4)/n), ((n + S(4))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(-S(8)*a*c + S(2)*b**S(2) - S(2)*b*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**(S(-2)), x), x, -c*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) + b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) - b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + x*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) + b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) - b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + d*x*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + e*x**S(2)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2))/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)*b*c**S(2)*f*x**(n + S(3))*(-n + S(3))*hyper((S(1), (n + S(3))/n), (S(2) + S(3)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(3))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*f*x**(n + S(3))*(-n + S(3))*hyper((S(1), (n + S(3))/n), (S(2) + S(3)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(3))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) + b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) - b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - S(2)*c*f*x**S(3)*(S(2)*a*c*(-S(2)*n + S(3)) - b**S(2)*(-n + S(3)))*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - S(2)*c*f*x**S(3)*(S(2)*a*c*(-S(2)*n + S(3)) - b**S(2)*(-n + S(3)))*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + d*x*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + e*x**S(2)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + f*x**S(3)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*x**S(2) + g*x**S(3))/(a + b*x**n + c*x**(S(2)*n))**S(2), x), x, S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*e*x**(n + S(2))*(-n + S(2))*hyper((S(1), (n + S(2))/n), (S(2) + S(2)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)*b*c**S(2)*f*x**(n + S(3))*(-n + S(3))*hyper((S(1), (n + S(3))/n), (S(2) + S(3)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(3))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*f*x**(n + S(3))*(-n + S(3))*hyper((S(1), (n + S(3))/n), (S(2) + S(3)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(3))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + S(2)*b*c**S(2)*g*x**(n + S(4))*(-n + S(4))*hyper((S(1), (n + S(4))/n), (S(2) + S(4)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b + sqrt(-S(4)*a*c + b**S(2)))*(n + S(4))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - S(2)*b*c**S(2)*g*x**(n + S(4))*(-n + S(4))*hyper((S(1), (n + S(4))/n), (S(2) + S(4)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(b - sqrt(-S(4)*a*c + b**S(2)))*(n + S(4))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) + b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*d*x*(S(4)*a*c*(-S(2)*n + S(1)) - b**S(2)*(-n + S(1)) - b*(-n + S(1))*sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*e*x**S(2)*(S(4)*a*c*(-n + S(1)) - b**S(2)*(-n + S(2)))*hyper((S(1), S(2)/n), ((n + S(2))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - S(2)*c*f*x**S(3)*(S(2)*a*c*(-S(2)*n + S(3)) - b**S(2)*(-n + S(3)))*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - S(2)*c*f*x**S(3)*(S(2)*a*c*(-S(2)*n + S(3)) - b**S(2)*(-n + S(3)))*hyper((S(1), S(3)/n), ((n + S(3))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(3)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) - c*g*x**S(4)*(S(4)*a*c*(-n + S(2)) - b**S(2)*(-n + S(4)))*hyper((S(1), S(4)/n), ((n + S(4))/n,), -S(2)*c*x**n/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))) - c*g*x**S(4)*(S(4)*a*c*(-n + S(2)) - b**S(2)*(-n + S(4)))*hyper((S(1), S(4)/n), ((n + S(4))/n,), -S(2)*c*x**n/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*n*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))) + d*x*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + e*x**S(2)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + f*x**S(3)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))) + g*x**S(4)*(-S(2)*a*c + b**S(2) + b*c*x**n)/(a*n*(-S(4)*a*c + b**S(2))*(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-a*h*x**(n/S(2) + S(-1)) + c*f*x**(n + S(-1)) + c*g*x**(S(2)*n + S(-1)) + c*h*x**(S(5)*n/S(2) + S(-1)))/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, -(S(2)*c*x**n*(-b*g + S(2)*c*f) + S(2)*c*(-S(2)*a*g + b*f) + S(2)*h*x**(n/S(2))*(-S(4)*a*c + b**S(2)))/(n*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**n + c*x**(S(2)*n))**p*(a + b*x**n*(n*p + n + S(1)) + c*x**(S(2)*n)*(S(2)*n*(p + S(1)) + S(1))), x), x, x*(a + b*x**n + c*x**(S(2)*n))**(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, A*a*x**(m + S(1))/(m + S(1)) + B*a*x**(m + S(2))/(m + S(2)) + B*b*x**(m + S(4))/(m + S(4)) + B*c*x**(m + S(6))/(m + S(6)) + C*c*x**(m + S(7))/(m + S(7)) + x**(m + S(3))*(A*b + C*a)/(m + S(3)) + x**(m + S(5))*(A*c + C*b)/(m + S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, A*a*x**S(4)/S(4) + B*a*x**S(5)/S(5) + B*b*x**S(7)/S(7) + B*c*x**S(9)/S(9) + C*c*x**S(10)/S(10) + x**S(8)*(A*c/S(8) + C*b/S(8)) + x**S(6)*(A*b/S(6) + C*a/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, A*a*x**S(3)/S(3) + B*a*x**S(4)/S(4) + B*b*x**S(6)/S(6) + B*c*x**S(8)/S(8) + C*c*x**S(9)/S(9) + x**S(7)*(A*c/S(7) + C*b/S(7)) + x**S(5)*(A*b/S(5) + C*a/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, A*a*x**S(2)/S(2) + B*a*x**S(3)/S(3) + B*b*x**S(5)/S(5) + B*c*x**S(7)/S(7) + C*c*x**S(8)/S(8) + x**S(6)*(A*c/S(6) + C*b/S(6)) + x**S(4)*(A*b/S(4) + C*a/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4)), x), x, A*a*x + B*a*x**S(2)/S(2) + B*b*x**S(4)/S(4) + B*c*x**S(6)/S(6) + C*c*x**S(7)/S(7) + x**S(5)*(A*c/S(5) + C*b/S(5)) + x**S(3)*(A*b/S(3) + C*a/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x, x), x, A*a*log(x) + B*a*x + B*b*x**S(3)/S(3) + B*c*x**S(5)/S(5) + C*c*x**S(6)/S(6) + x**S(4)*(A*c/S(4) + C*b/S(4)) + x**S(2)*(A*b/S(2) + C*a/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(2), x), x, -A*a/x + B*a*log(x) + B*b*x**S(2)/S(2) + B*c*x**S(4)/S(4) + C*c*x**S(5)/S(5) + x**S(3)*(A*c/S(3) + C*b/S(3)) + x*(A*b + C*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(3), x), x, -A*a/(S(2)*x**S(2)) - B*a/x + B*b*x + B*c*x**S(3)/S(3) + C*c*x**S(4)/S(4) + x**S(2)*(A*c/S(2) + C*b/S(2)) + (A*b + C*a)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(4), x), x, -A*a/(S(3)*x**S(3)) - B*a/(S(2)*x**S(2)) + B*b*log(x) + B*c*x**S(2)/S(2) + C*c*x**S(3)/S(3) + x*(A*c + C*b) - (A*b + C*a)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(5), x), x, -A*a/(S(4)*x**S(4)) - B*a/(S(3)*x**S(3)) - B*b/x + B*c*x + C*c*x**S(2)/S(2) + (A*c + C*b)*log(x) - (A*b + C*a)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(6), x), x, -A*a/(S(5)*x**S(5)) - B*a/(S(4)*x**S(4)) - B*b/(S(2)*x**S(2)) + B*c*log(x) + C*c*x - (A*c + C*b)/x - (A*b + C*a)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))/x**S(7), x), x, -A*a/(S(6)*x**S(6)) - B*a/(S(5)*x**S(5)) - B*b/(S(3)*x**S(3)) - B*c/x + C*c*log(x) - (A*c + C*b)/(S(2)*x**S(2)) - (A*b + C*a)/(S(4)*x**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, A*a**S(2)*x**(m + S(1))/(m + S(1)) + B*a**S(2)*x**(m + S(2))/(m + S(2)) + S(2)*B*a*b*x**(m + S(4))/(m + S(4)) + S(2)*B*b*c*x**(m + S(8))/(m + S(8)) + B*c**S(2)*x**(m + S(10))/(m + S(10)) + B*x**(m + S(6))*(S(2)*a*c + b**S(2))/(m + S(6)) + C*c**S(2)*x**(m + S(11))/(m + S(11)) + a*x**(m + S(3))*(S(2)*A*b + C*a)/(m + S(3)) + c*x**(m + S(9))*(A*c + S(2)*C*b)/(m + S(9)) + x**(m + S(5))*(A*(S(2)*a*c + b**S(2)) + S(2)*C*a*b)/(m + S(5)) + x**(m + S(7))*(S(2)*A*b*c + C*(S(2)*a*c + b**S(2)))/(m + S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, A*a**S(2)*x**S(4)/S(4) + B*a**S(2)*x**S(5)/S(5) + S(2)*B*a*b*x**S(7)/S(7) + S(2)*B*b*c*x**S(11)/S(11) + B*c**S(2)*x**S(13)/S(13) + B*x**S(9)*(S(2)*a*c + b**S(2))/S(9) + C*c**S(2)*x**S(14)/S(14) + a*x**S(6)*(S(2)*A*b + C*a)/S(6) + c*x**S(12)*(A*c + S(2)*C*b)/S(12) + x**S(10)*(A*b*c/S(5) + C*(S(2)*a*c + b**S(2))/S(10)) + x**S(8)*(A*(S(2)*a*c + b**S(2))/S(8) + C*a*b/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, A*a**S(2)*x**S(3)/S(3) + B*a**S(2)*x**S(4)/S(4) + B*a*b*x**S(6)/S(3) + B*b*c*x**S(10)/S(5) + B*c**S(2)*x**S(12)/S(12) + B*x**S(8)*(S(2)*a*c + b**S(2))/S(8) + C*c**S(2)*x**S(13)/S(13) + a*x**S(5)*(S(2)*A*b + C*a)/S(5) + c*x**S(11)*(A*c + S(2)*C*b)/S(11) + x**S(9)*(S(2)*A*b*c/S(9) + C*(S(2)*a*c + b**S(2))/S(9)) + x**S(7)*(A*(S(2)*a*c + b**S(2))/S(7) + S(2)*C*a*b/S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, A*a**S(2)*x**S(2)/S(2) + B*a**S(2)*x**S(3)/S(3) + S(2)*B*a*b*x**S(5)/S(5) + S(2)*B*b*c*x**S(9)/S(9) + B*c**S(2)*x**S(11)/S(11) + B*x**S(7)*(S(2)*a*c + b**S(2))/S(7) + C*c**S(2)*x**S(12)/S(12) + a*x**S(4)*(S(2)*A*b + C*a)/S(4) + c*x**S(10)*(A*c + S(2)*C*b)/S(10) + x**S(8)*(A*b*c/S(4) + C*(S(2)*a*c + b**S(2))/S(8)) + x**S(6)*(A*(S(2)*a*c + b**S(2))/S(6) + C*a*b/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2), x), x, A*a**S(2)*x + B*a**S(2)*x**S(2)/S(2) + B*a*b*x**S(4)/S(2) + B*b*c*x**S(8)/S(4) + B*c**S(2)*x**S(10)/S(10) + B*x**S(6)*(S(2)*a*c + b**S(2))/S(6) + C*c**S(2)*x**S(11)/S(11) + a*x**S(3)*(S(2)*A*b + C*a)/S(3) + c*x**S(9)*(A*c + S(2)*C*b)/S(9) + x**S(7)*(S(2)*A*b*c/S(7) + C*(S(2)*a*c + b**S(2))/S(7)) + x**S(5)*(A*(S(2)*a*c + b**S(2))/S(5) + S(2)*C*a*b/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x, x), x, A*a**S(2)*log(x) + B*a**S(2)*x + S(2)*B*a*b*x**S(3)/S(3) + S(2)*B*b*c*x**S(7)/S(7) + B*c**S(2)*x**S(9)/S(9) + B*x**S(5)*(S(2)*a*c + b**S(2))/S(5) + C*c**S(2)*x**S(10)/S(10) + a*x**S(2)*(S(2)*A*b + C*a)/S(2) + c*x**S(8)*(A*c + S(2)*C*b)/S(8) + x**S(6)*(A*b*c/S(3) + C*(S(2)*a*c + b**S(2))/S(6)) + x**S(4)*(A*(S(2)*a*c + b**S(2))/S(4) + C*a*b/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(2), x), x, -A*a**S(2)/x + B*a**S(2)*log(x) + B*a*b*x**S(2) + B*b*c*x**S(6)/S(3) + B*c**S(2)*x**S(8)/S(8) + B*x**S(4)*(S(2)*a*c + b**S(2))/S(4) + C*c**S(2)*x**S(9)/S(9) + a*x*(S(2)*A*b + C*a) + c*x**S(7)*(A*c + S(2)*C*b)/S(7) + x**S(5)*(S(2)*A*b*c/S(5) + C*(S(2)*a*c + b**S(2))/S(5)) + x**S(3)*(A*(S(2)*a*c + b**S(2))/S(3) + S(2)*C*a*b/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(3), x), x, -A*a**S(2)/(S(2)*x**S(2)) - B*a**S(2)/x + S(2)*B*a*b*x + S(2)*B*b*c*x**S(5)/S(5) + B*c**S(2)*x**S(7)/S(7) + B*x**S(3)*(S(2)*a*c + b**S(2))/S(3) + C*c**S(2)*x**S(8)/S(8) + a*(S(2)*A*b + C*a)*log(x) + c*x**S(6)*(A*c + S(2)*C*b)/S(6) + x**S(4)*(A*b*c/S(2) + C*(S(2)*a*c + b**S(2))/S(4)) + x**S(2)*(A*(S(2)*a*c + b**S(2))/S(2) + C*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(4), x), x, -A*a**S(2)/(S(3)*x**S(3)) - B*a**S(2)/(S(2)*x**S(2)) + S(2)*B*a*b*log(x) + B*b*c*x**S(4)/S(2) + B*c**S(2)*x**S(6)/S(6) + B*x**S(2)*(S(2)*a*c + b**S(2))/S(2) + C*c**S(2)*x**S(7)/S(7) - a*(S(2)*A*b + C*a)/x + c*x**S(5)*(A*c + S(2)*C*b)/S(5) + x**S(3)*(S(2)*A*b*c/S(3) + C*(S(2)*a*c + b**S(2))/S(3)) + x*(A*(S(2)*a*c + b**S(2)) + S(2)*C*a*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(5), x), x, -A*a**S(2)/(S(4)*x**S(4)) - B*a**S(2)/(S(3)*x**S(3)) - S(2)*B*a*b/x + S(2)*B*b*c*x**S(3)/S(3) + B*c**S(2)*x**S(5)/S(5) + B*x*(S(2)*a*c + b**S(2)) + C*c**S(2)*x**S(6)/S(6) - a*(S(2)*A*b + C*a)/(S(2)*x**S(2)) + c*x**S(4)*(A*c + S(2)*C*b)/S(4) + x**S(2)*(A*b*c + C*(S(2)*a*c + b**S(2))/S(2)) + (A*(S(2)*a*c + b**S(2)) + S(2)*C*a*b)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(6), x), x, -A*a**S(2)/(S(5)*x**S(5)) - B*a**S(2)/(S(4)*x**S(4)) - B*a*b/x**S(2) + B*b*c*x**S(2) + B*c**S(2)*x**S(4)/S(4) + B*(S(2)*a*c + b**S(2))*log(x) + C*c**S(2)*x**S(5)/S(5) - a*(S(2)*A*b + C*a)/(S(3)*x**S(3)) + c*x**S(3)*(A*c + S(2)*C*b)/S(3) + x*(S(2)*A*b*c + C*(S(2)*a*c + b**S(2))) - (A*(S(2)*a*c + b**S(2)) + S(2)*C*a*b)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))*(a + b*x**S(2) + c*x**S(4))**S(2)/x**S(7), x), x, -A*a**S(2)/(S(6)*x**S(6)) - B*a**S(2)/(S(5)*x**S(5)) - S(2)*B*a*b/(S(3)*x**S(3)) + S(2)*B*b*c*x + B*c**S(2)*x**S(3)/S(3) - B*(S(2)*a*c + b**S(2))/x + C*c**S(2)*x**S(4)/S(4) - a*(S(2)*A*b + C*a)/(S(4)*x**S(4)) + c*x**S(2)*(A*c + S(2)*C*b)/S(2) + (S(2)*A*b*c + C*(S(2)*a*c + b**S(2)))*log(x) - (A*(S(2)*a*c + b**S(2)) + S(2)*C*a*b)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*B*c*x**(m + S(2))*hyper((S(1), m/S(2) + S(1)), (m/S(2) + S(2),), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(2))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*B*c*x**(m + S(2))*hyper((S(1), m/S(2) + S(1)), (m/S(2) + S(2),), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/((b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(2))*sqrt(-S(4)*a*c + b**S(2))) + x**(m + S(1))*(C - (S(2)*A*c - C*b)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/((b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))) + x**(m + S(1))*(C + (S(2)*A*c - C*b)/sqrt(-S(4)*a*c + b**S(2)))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/((b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -B*b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + B*x**S(2)/(S(2)*c) - B*(-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))) + C*x**S(3)/(S(3)*c) + x*(A*c - C*b)/c**S(2) - sqrt(S(2))*(A*b*c + C*a*c - C*b**S(2) + (A*c*(-S(2)*a*c + b**S(2)) - C*b*(-S(3)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(A*b*c + C*a*c - C*b**S(2) - (A*c*(-S(2)*a*c + b**S(2)) - C*b*(-S(3)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*x/c - sqrt(S(2))*B*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*B*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + C*x**S(2)/(S(2)*c) + (A*c - C*b)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + (A*b*c + S(2)*C*a*c - C*b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c) + C*x/c + sqrt(S(2))*(A*c - C*b + (A*b*c + S(2)*C*a*c - C*b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(A*c - C*b - (A*b*c - C*(-S(2)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -sqrt(S(2))*B*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*B*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + C*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c) - (S(2)*A*c - C*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4)), x), x, -B*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)) + sqrt(S(2))*(C - (S(2)*A*c - C*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(C + (S(2)*A*c - C*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))), x), x, A*log(x)/a - A*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a) - sqrt(S(2))*B*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*B*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + (A*b - S(2)*C*a)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))), x), x, -A/(a*x) + B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))) + B*log(x)/a - B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a) - sqrt(S(2))*sqrt(c)*(A - (A*b - S(2)*C*a)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(A + (A*b - S(2)*C*a)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))), x), x, -A/(S(2)*a*x**S(2)) - sqrt(S(2))*B*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*B*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - B/(a*x) - (A*b - C*a)*log(x)/a**S(2) + (A*b - C*a)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - (A*(-S(2)*a*c + b**S(2)) - C*a*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, B*c*x**(m + S(2))*(S(4)*a*c*(-m + S(2)) + b*m*(b - sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)), (m/S(2) + S(2),), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - B*c*x**(m + S(2))*(S(4)*a*c*(-m + S(2)) + b*m*(b + sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)), (m/S(2) + S(2),), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(2))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + B*x**(m + S(2))*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - c*x**(m + S(1))*(A*(-S(4)*a*c*(-m + S(3)) + b**S(2)*(-m + S(1)) - b*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*C*a*(S(2)*b + (-m + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*(b + sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + c*x**(m + S(1))*(A*(-S(4)*a*c*(-m + S(3)) + b**S(2)*(-m + S(1)) + b*(-m + S(1))*sqrt(-S(4)*a*c + b**S(2))) + S(2)*C*a*(S(2)*b - (-m + S(1))*sqrt(-S(4)*a*c + b**S(2))))*hyper((S(1), m/S(2) + S(1)/2), (m/S(2) + S(3)/2,), -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*(b - sqrt(-S(4)*a*c + b**S(2)))*(m + S(1))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**(m + S(1))*(A*(-S(2)*a*c + b**S(2)) - C*a*b + c*x**S(2)*(A*b - S(2)*C*a))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*B*a*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x*(S(2)*B*a*c*x + B*b*c*x**S(3) + a*(S(2)*A*c - C*b) + x**S(2)*(A*b*c + S(2)*C*a*c - C*b**S(2)))/(S(2)*c*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(A*c*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))) + C*(-S(8)*a*b*c - S(6)*a*c*sqrt(-S(4)*a*c + b**S(2)) + b**S(3) + b**S(2)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*(A*c*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))) + C*(-S(8)*a*b*c + S(6)*a*c*sqrt(-S(4)*a*c + b**S(2)) + b**S(3) - b**S(2)*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, sqrt(S(2))*B*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*B*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x*(S(2)*B*a + B*b*x**S(2) - x**S(3)*(S(2)*A*c - C*b) - x*(A*b - S(2)*C*a))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (A*b - S(2)*C*a)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -sqrt(S(2))*B*sqrt(c)*(S(2)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*B*sqrt(c)*(S(2)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (S(2)*A*c - C*b)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(B*a*b + S(2)*B*a*c*x**S(2) - c*x**S(3)*(A*b - S(2)*C*a) - x*(A*(-S(2)*a*c + b**S(2)) - C*a*b))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, S(2)*B*c*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + sqrt(S(2))*sqrt(c)*(A*b - S(2)*C*a - (-S(12)*A*a*c + A*b**S(2) + S(4)*C*a*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*(A*b - S(2)*C*a + (A*(-S(12)*a*c + b**S(2)) + S(4)*C*a*b)/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + x*(A*(-S(2)*a*c + b**S(2)) + B*b*c*x**S(3) + B*x*(-S(2)*a*c + b**S(2)) - C*a*b + c*x**S(2)*(A*b - S(2)*C*a))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, A*log(x)/a**S(2) - A*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - sqrt(S(2))*B*sqrt(c)*(-S(12)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*B*sqrt(c)*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + B*x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + (A*(-S(2)*a*c + b**S(2)) - C*a*b + c*x**S(2)*(A*b - S(2)*C*a))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + (A*(-S(6)*a*b*c + b**S(3)) + S(4)*C*a**S(2)*c)*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, B*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + B*b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + B*log(x)/a**S(2) - B*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) + (A*(-S(2)*a*c + b**S(2)) - C*a*b + c*x**S(2)*(A*b - S(2)*C*a))/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*sqrt(c)*(-S(10)*A*a*c + S(3)*A*b**S(2) - C*a*b - (A*(-S(16)*a*b*c + S(3)*b**S(3)) - C*a*(-S(12)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(c)*(A*(-S(16)*a*b*c - S(10)*a*c*sqrt(-S(4)*a*c + b**S(2)) + S(3)*b**S(3) + S(3)*b**S(2)*sqrt(-S(4)*a*c + b**S(2))) - C*a*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*A*a*c + S(3)*A*b**S(2) - C*a*b)/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2))/(x**S(3)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, B*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*B*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) - (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*B*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) + (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - B*(-S(10)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))) + (A*(-S(2)*a*c + b**S(2)) - C*a*b + c*x**S(2)*(A*b - S(2)*C*a))/(S(2)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(6)*A*a*c + S(2)*A*b**S(2) - C*a*b)/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) - (S(2)*A*b - C*a)*log(x)/a**S(3) + (S(2)*A*b - C*a)*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(3)) - (S(2)*A*(S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4)) - C*a*b*(-S(6)*a*c + b**S(2)))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(A + B*x + C*x**S(2))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(A*x + B*x**S(2) + C*x**S(3))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A*x**S(2) + B*x**S(3) + C*x**S(4))/(a + b*x**S(2) + c*x**S(4))**S(2), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A*x**S(3) + B*x**S(4) + C*x**S(5))/(x*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A*x**S(4) + B*x**S(5) + C*x**S(6))/(x**S(2)*(a + b*x**S(2) + c*x**S(4))**S(2)), x), x, -B*b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - x*(A*b + B*b*x + S(2)*B*c*x**S(3) - S(2)*C*a + x**S(2)*(S(2)*A*c - C*b))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) - sqrt(S(2))*(S(2)*A*c*(S(2)*b + sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*(S(2)*A*c*(S(2)*b - sqrt(-S(4)*a*c + b**S(2))) - C*(S(4)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2))))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2) + f*x**S(4) + g*x**S(6))/(a + b*x**S(2) + c*x**S(4)), x), x, g*x**S(4)/(S(4)*c) + x**S(2)*(-b*g + c*f)/(S(2)*c**S(2)) + (b**S(2)*g + c**S(2)*e - c*(a*g + b*f))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)) - (-b**S(3)*g + b*c*(S(3)*a*g + b*f) + S(2)*c**S(3)*d - c**S(2)*(S(2)*a*f + b*e))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2) + c*x**S(4))**p*(S(3)*a + b*x**S(2)*(S(2)*p + S(5)) + c*x**S(4)*(S(4)*p + S(7))), x), x, x**S(3)*(a + b*x**S(2) + c*x**S(4))**(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(4) + S(-1))*(-a*h + c*f*x**(n/S(4)) + c*g*x**(S(3)*n/S(4)) + c*h*x**n)/(a + c*x**n)**(S(3)/2), x), x, -(S(2)*a*g + S(4)*a*h*x**(n/S(4)) - S(2)*c*f*x**(n/S(2)))/(a*n*sqrt(a + c*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(n/S(4) + S(-1))*(-a*h + c*f*x**(n/S(4)) + c*g*x**(S(3)*n/S(4)) + c*h*x**n)/(a + c*x**n)**(S(3)/2), x), x, -S(2)*x**(-n/S(4) + S(1))*(d*x)**(n/S(4) + S(-1))*(a*g + S(2)*a*h*x**(n/S(4)) - c*f*x**(n/S(2)))/(a*n*sqrt(a + c*x**n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n/S(2) + S(-1))*(-a*h + c*f*x**(n/S(2)) + c*g*x**(S(3)*n/S(2)) + c*h*x**(S(2)*n))/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, -(S(2)*c*x**n*(-b*g + S(2)*c*f) + S(2)*c*(-S(2)*a*g + b*f) + S(2)*h*x**(n/S(2))*(-S(4)*a*c + b**S(2)))/(n*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x)**(n/S(2) + S(-1))*(-a*h + c*f*x**(n/S(2)) + c*g*x**(S(3)*n/S(2)) + c*h*x**(S(2)*n))/(a + b*x**n + c*x**(S(2)*n))**(S(3)/2), x), x, -S(2)*x**(-n/S(2) + S(1))*(d*x)**(n/S(2) + S(-1))*(c*x**n*(-b*g + S(2)*c*f) + c*(-S(2)*a*g + b*f) + h*x**(n/S(2))*(-S(4)*a*c + b**S(2)))/(n*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**n + c*x**(S(2)*n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((g*x)**m*(a + b*x**n + c*x**(S(2)*n))**p*(a*(m + S(1)) + b*x**n*(m + n*p + n + S(1)) + c*x**(S(2)*n)*(m + S(2)*n*(p + S(1)) + S(1))), x), x, (g*x)**(m + S(1))*(a + b*x**n + c*x**(S(2)*n))**(p + S(1))/g, expand=True, _diff=True, _numerical=True) def test_5(): assert rubi_test(rubi_integrate(x**S(2)*(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, a*x**S(5)/S(5) + b*x**S(6)/S(6) + c*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, a*x**S(4)/S(4) + b*x**S(5)/S(5) + c*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a*x**S(2) + b*x**S(3) + c*x**S(4), x), x, a*x**S(3)/S(3) + b*x**S(4)/S(4) + c*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))/x, x), x, a*x**S(2)/S(2) + b*x**S(3)/S(3) + c*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(2), x), x, a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, a**S(2)*x**S(7)/S(7) + a*b*x**S(8)/S(4) + b*c*x**S(10)/S(5) + c**S(2)*x**S(11)/S(11) + x**S(9)*(S(2)*a*c + b**S(2))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, a**S(2)*x**S(6)/S(6) + S(2)*a*b*x**S(7)/S(7) + S(2)*b*c*x**S(9)/S(9) + c**S(2)*x**S(10)/S(10) + x**S(8)*(S(2)*a*c + b**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, a**S(2)*x**S(5)/S(5) + a*b*x**S(6)/S(3) + b*c*x**S(8)/S(4) + c**S(2)*x**S(9)/S(9) + x**S(7)*(S(2)*a*c + b**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2)/x, x), x, a**S(2)*x**S(4)/S(4) + S(2)*a*b*x**S(5)/S(5) + S(2)*b*c*x**S(7)/S(7) + c**S(2)*x**S(8)/S(8) + x**S(6)*(S(2)*a*c + b**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2)/x**S(2), x), x, a**S(2)*x**S(3)/S(3) + a*b*x**S(4)/S(2) + b*c*x**S(6)/S(3) + c**S(2)*x**S(7)/S(7) + x**S(5)*(S(2)*a*c + b**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -b*x/c**S(2) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*sqrt(-S(4)*a*c + b**S(2))) + x**S(2)/(S(2)*c) + (-a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -b*log(a + b*x + c*x**S(2))/(S(2)*c**S(2)) + x/c - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x + c*x**S(2))/(S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -S(2)*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x + c*x**S(2))/(S(2)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -S(1)/(a*x) - b*log(x)/a**S(2) + b*log(a + b*x + c*x**S(2))/(S(2)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x**S(2) + b*x**S(3) + c*x**S(4))), x), x, -S(1)/(S(2)*a*x**S(2)) + b/(a**S(2)*x) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*sqrt(-S(4)*a*c + b**S(2))) + (-a*c + b**S(2))*log(x)/a**S(3) - (-a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*x**S(2) + b*x**S(3) + c*x**S(4))), x), x, -S(1)/(S(3)*a*x**S(3)) + b/(S(2)*a**S(2)*x**S(2)) - (-a*c + b**S(2))/(a**S(3)*x) - b*(-S(2)*a*c + b**S(2))*log(x)/a**S(4) + b*(-S(2)*a*c + b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(4)) - (S(2)*a**S(2)*c**S(2) - S(4)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, -b*x**S(2)/(c*(-S(4)*a*c + b**S(2))) - b*log(a + b*x + c*x**S(2))/c**S(3) + x**S(3)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + x*(-S(6)*a*c + S(2)*b**S(2))/(c**S(2)*(-S(4)*a*c + b**S(2))) - (S(12)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(2)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, -b*x/(c*(-S(4)*a*c + b**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**S(2)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + log(a + b*x + c*x**S(2))/(S(2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, S(4)*a*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, -S(2)*b*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + (S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, S(4)*c*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - (b + S(2)*c*x)/((-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(x)/a**S(2) - log(a + b*x + c*x**S(2))/(S(2)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) + (S(6)*a*c - S(2)*b**S(2))/(a**S(2)*x*(-S(4)*a*c + b**S(2))) - S(2)*b*log(x)/a**S(3) + b*log(a + b*x + c*x**S(2))/a**S(3) - (S(12)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(2)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) - (-S(8)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) + b*(-S(11)*a*c + S(3)*b**S(2))/(a**S(3)*x*(-S(4)*a*c + b**S(2))) + b*(S(30)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (-S(2)*a*c + S(3)*b**S(2))*log(x)/a**S(4) - (-S(2)*a*c + S(3)*b**S(2))*log(a + b*x + c*x**S(2))/(S(2)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(-2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x**S(3)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) - (-S(10)*a*c + S(4)*b**S(2))/(S(3)*a**S(2)*x**S(3)*(-S(4)*a*c + b**S(2))) + b*(-S(7)*a*c + S(2)*b**S(2))/(a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))) - (S(10)*a**S(2)*c**S(2) - S(18)*a*b**S(2)*c + S(4)*b**S(4))/(a**S(4)*x*(-S(4)*a*c + b**S(2))) - S(2)*b*(-S(3)*a*c + S(2)*b**S(2))*log(x)/a**S(5) + b*(-S(3)*a*c + S(2)*b**S(2))*log(a + b*x + c*x**S(2))/a**S(5) - (-S(20)*a**S(3)*c**S(3) + S(60)*a**S(2)*b**S(2)*c**S(2) - S(30)*a*b**S(4)*c + S(4)*b**S(6))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(5)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x**S(2) + b*x**S(3) + c*x**S(4))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x)/(a*x**S(4)*(-S(4)*a*c + b**S(2))*(a + b*x + c*x**S(2))) - (-S(12)*a*c + S(5)*b**S(2))/(S(4)*a**S(2)*x**S(4)*(-S(4)*a*c + b**S(2))) + b*(-S(17)*a*c + S(5)*b**S(2))/(S(3)*a**S(3)*x**S(3)*(-S(4)*a*c + b**S(2))) - (S(12)*a**S(2)*c**S(2) - S(22)*a*b**S(2)*c + S(5)*b**S(4))/(S(2)*a**S(4)*x**S(2)*(-S(4)*a*c + b**S(2))) + b*(S(29)*a**S(2)*c**S(2) - S(27)*a*b**S(2)*c + S(5)*b**S(4))/(a**S(5)*x*(-S(4)*a*c + b**S(2))) + b*(-S(70)*a**S(3)*c**S(3) + S(105)*a**S(2)*b**S(2)*c**S(2) - S(42)*a*b**S(4)*c + S(5)*b**S(6))*atanh((b + S(2)*c*x)/sqrt(-S(4)*a*c + b**S(2)))/(a**S(6)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (S(3)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(5)*b**S(4))*log(x)/a**S(6) - (S(3)*a**S(2)*c**S(2) - S(12)*a*b**S(2)*c + S(5)*b**S(4))*log(a + b*x + c*x**S(2))/(S(2)*a**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, b*(-S(116)*a*c + S(35)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(960)*c**S(3)) + b*x*(-S(12)*a*c + S(7)*b**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(256)*c**(S(9)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + x**S(2)*(b + S(8)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(40)*c) - x*(-S(16)*a*c + S(7)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(240)*c**S(2)) - sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(256)*a**S(2)*c**S(2) - S(460)*a*b**S(2)*c + S(105)*b**S(4))/(S(1920)*c**S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(192)*c**S(3)*x) + x*(b + S(6)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(24)*c) - (-S(12)*a*c + S(5)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(96)*c**S(2)) - x*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(128)*c**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -b*(b + S(2)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(8)*c**S(2)*x) + b*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(16)*c**(S(5)/2)*x*sqrt(a + b*x + c*x**S(2))) + (a + b*x + c*x**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(3)*c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x, x), x, (b + S(2)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*c*x) - x*(-S(4)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(8)*c**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(2), x), x, -sqrt(a)*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)) + b*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(2)*sqrt(c)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(3), x), x, sqrt(c)*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)) - sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(2) - b*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(2)*sqrt(a)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(4), x), x, -sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2)*x**S(3)) - b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*a*x**S(2)) + x*(-S(4)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(8)*a**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(5), x), x, -sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(3)*x**S(4)) - b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(12)*a*x**S(3)) + (-S(8)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(24)*a**S(2)*x**S(2)) - b*x*(-S(4)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(16)*a**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/x**S(6), x), x, -sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*x**S(5)) - b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(24)*a*x**S(4)) + (-S(12)*a*c + S(5)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(96)*a**S(2)*x**S(3)) - b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(192)*a**S(3)*x**S(2)) + x*(-S(4)*a*c + b**S(2))*(-S(4)*a*c + S(5)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(128)*a**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -b*x*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(2416)*a**S(2)*c**S(2) - S(1560)*a*b**S(2)*c + S(231)*b**S(4))/(S(71680)*c**S(4)) - b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(-S(58816)*a**S(3)*c**S(3) + S(81648)*a**S(2)*b**S(2)*c**S(2) - S(30660)*a*b**S(4)*c + S(3465)*b**S(6))/(S(573440)*c**S(6)*x) + x*(S(3)*b + S(14)*c*x)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(112)*c) - x**S(3)*(b*(S(68)*a*c + S(11)*b**S(2)) + S(10)*c*x*(-S(28)*a*c + S(11)*b**S(2)))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4480)*c**S(2)) + x**S(2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(560)*a**S(2)*c**S(2) - S(568)*a*b**S(2)*c + S(99)*b**S(4))/(S(35840)*c**S(3)) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(-S(6720)*a**S(3)*c**S(3) + S(18896)*a**S(2)*b**S(2)*c**S(2) - S(8988)*a*b**S(4)*c + S(1155)*b**S(6))/(S(286720)*c**S(5)) + S(3)*x*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))*(S(16)*a**S(2)*c**S(2) - S(72)*a*b**S(2)*c + S(33)*b**S(4))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(32768)*c**(S(13)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -b*x**S(2)*(-S(44)*a*c + S(9)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2240)*c**S(2)) - b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(1168)*a**S(2)*c**S(2) - S(728)*a*b**S(2)*c + S(105)*b**S(4))/(S(17920)*c**S(4)) - S(3)*b*x*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(2048)*c**(S(11)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + x*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/S(7) + x**S(3)*(S(24)*a*c + b**S(2) + S(10)*b*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(280)*c) + x*(-S(32)*a*c + S(7)*b**S(2))*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4480)*c**S(3)) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(-S(2048)*a**S(3)*c**S(3) + S(5488)*a**S(2)*b**S(2)*c**S(2) - S(2520)*a*b**S(4)*c + S(315)*b**S(6))/(S(35840)*c**S(5)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x, x), x, -b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(1296)*a**S(2)*c**S(2) - S(760)*a*b**S(2)*c + S(105)*b**S(4))/(S(7680)*c**S(4)*x) + (S(3)*b + S(10)*c*x)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(60)*c*x) - x*(b*(S(12)*a*c + S(7)*b**S(2)) + S(6)*c*x*(-S(20)*a*c + S(7)*b**S(2)))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(960)*c**S(2)) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(240)*a**S(2)*c**S(2) - S(216)*a*b**S(2)*c + S(35)*b**S(4))/(S(3840)*c**S(3)) + x*(-S(4)*a*c + b**S(2))**S(2)*(-S(4)*a*c + S(7)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(1024)*c**(S(9)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(2), x), x, -b*(b + S(2)*c*x)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(16)*c**S(2)*x**S(3)) + S(3)*b*(b + S(2)*c*x)*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(128)*c**S(3)*x) - S(3)*b*x*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(256)*c**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(5)/2)/(S(5)*c*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(3), x), x, (b + S(2)*c*x)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(8)*c*x**S(3)) - (b + S(2)*c*x)*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(64)*c**S(2)*x) + S(3)*x*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(128)*c**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(4), x), x, -a**(S(3)/2)*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)) - b*x*(-S(12)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(16)*c**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(3)*x**S(3)) + (S(8)*a*c + b**S(2) + S(2)*b*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(8)*c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(5), x), x, -S(3)*sqrt(a)*b*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + (S(9)*b + S(6)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*x) - (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(4) + x*(S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(8)*sqrt(c)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(6), x), x, S(3)*b*sqrt(c)*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - (S(3)*b - S(6)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*x**S(2)) - (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(2)*x**S(5)) - x*(S(12)*a*c + S(3)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(8)*sqrt(a)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(7), x), x, c**(S(3)/2)*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)) - (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(3)*x**S(6)) - b*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(4)*a*x**S(5)) + (-S(8)*a*c + b**S(2) + S(2)*b*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(8)*a*x**S(2)) + b*x*(-S(12)*a*c + b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(16)*a**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(8), x), x, -(b + S(6)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(8)*x**S(4)) - (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(4)*x**S(7)) - (-S(12)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(32)*a*x**S(3)) + b*(-S(20)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(64)*a**S(2)*x**S(2)) - S(3)*x*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(128)*a**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/x**S(9), x), x, -(S(3)*b + S(12)*c*x)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(40)*x**S(5)) - (a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)/(S(5)*x**S(8)) - (-S(8)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(80)*a*x**S(4)) + b*(-S(28)*a*c + S(5)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(320)*a**S(2)*x**S(3)) - sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(128)*a**S(2)*c**S(2) - S(100)*a*b**S(2)*c + S(15)*b**S(4))/(S(640)*a**S(3)*x**S(2)) + S(3)*b*x*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(256)*a**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -S(3)*b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*c**S(2)*x) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2)*c) + x*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(8)*c**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -b*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(2)*c**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(sqrt(c)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4)), x), x, -x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(sqrt(a)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), x), x, -sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(a*x**S(2)) + b*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(2)*a**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), x), x, -sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2)*a*x**S(3)) + S(3)*b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*a**S(2)*x**S(2)) - x*(-S(4)*a*c + S(3)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(8)*a**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -S(2)*b*x*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) - b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*c**S(3)*x*(-S(4)*a*c + b**S(2))) + S(2)*x**S(4)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + (-S(12)*a*c + S(5)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) + x*(-S(12)*a*c + S(15)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(8)*c**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -S(2)*b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(c*(-S(4)*a*c + b**S(2))) - S(3)*b*x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(S(2)*c**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + S(2)*x**S(3)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + (-S(8)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(c**S(2)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -S(2)*b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(c*x*(-S(4)*a*c + b**S(2))) + S(2)*x**S(2)*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) + x*sqrt(a + b*x + c*x**S(2))*atanh((b + S(2)*c*x)/(S(2)*sqrt(c)*sqrt(a + b*x + c*x**S(2))))/(c**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, S(2)*x*(S(2)*a + b*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, -S(2)*x*(b + S(2)*c*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, S(2)*x*(-S(2)*a*c + b**S(2) + b*c*x)/(a*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(a**(S(3)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x)/(a*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - (-S(8)*a*c + S(3)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) + S(3)*b*x*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(2)*a**(S(5)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(-3)/2), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x)/(a*x*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - (-S(12)*a*c + S(5)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(2)*a**S(2)*x**S(3)*(-S(4)*a*c + b**S(2))) + b*(-S(52)*a*c + S(15)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))) - x*(-S(12)*a*c + S(15)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(8)*a**(S(7)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x)/(a*x**S(2)*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - (-S(16)*a*c + S(7)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(3)*a**S(2)*x**S(4)*(-S(4)*a*c + b**S(2))) + b*(-S(116)*a*c + S(35)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(12)*a**S(3)*x**S(3)*(-S(4)*a*c + b**S(2))) - sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(256)*a**S(2)*c**S(2) - S(460)*a*b**S(2)*c + S(105)*b**S(4))/(S(24)*a**S(4)*x**S(2)*(-S(4)*a*c + b**S(2))) + S(5)*b*x*(-S(12)*a*c + S(7)*b**S(2))*sqrt(a + b*x + c*x**S(2))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(16)*a**(S(9)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*x**S(2) + b*x**S(3) + c*x**S(4))**(S(3)/2)), x), x, (-S(4)*a*c + S(2)*b**S(2) + S(2)*b*c*x)/(a*x**S(3)*(-S(4)*a*c + b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))) - (-S(20)*a*c + S(9)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(4)*a**S(2)*x**S(5)*(-S(4)*a*c + b**S(2))) + b*(-S(68)*a*c + S(21)*b**S(2))*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))/(S(8)*a**S(3)*x**S(4)*(-S(4)*a*c + b**S(2))) - sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(240)*a**S(2)*c**S(2) - S(448)*a*b**S(2)*c + S(105)*b**S(4))/(S(32)*a**S(4)*x**S(3)*(-S(4)*a*c + b**S(2))) + b*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))*(S(1808)*a**S(2)*c**S(2) - S(1680)*a*b**S(2)*c + S(315)*b**S(4))/(S(64)*a**S(5)*x**S(2)*(-S(4)*a*c + b**S(2))) - x*sqrt(a + b*x + c*x**S(2))*(S(240)*a**S(2)*c**S(2) - S(840)*a*b**S(2)*c + S(315)*b**S(4))*atanh((S(2)*a + b*x)/(S(2)*sqrt(a)*sqrt(a + b*x + c*x**S(2))))/(S(128)*a**(S(11)/2)*sqrt(a*x**S(2) + b*x**S(3) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a*x + b*x**S(3) + c*x**S(5)), x), x, a*x**(m + S(2))/(m + S(2)) + b*x**(m + S(4))/(m + S(4)) + c*x**(m + S(6))/(m + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a*x + b*x**S(3) + c*x**S(5)), x), x, a*x**S(4)/S(4) + b*x**S(6)/S(6) + c*x**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*x + b*x**S(3) + c*x**S(5)), x), x, a*x**S(3)/S(3) + b*x**S(5)/S(5) + c*x**S(7)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a*x + b*x**S(3) + c*x**S(5), x), x, a*x**S(2)/S(2) + b*x**S(4)/S(4) + c*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))/x, x), x, a*x + b*x**S(3)/S(3) + c*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))/x**S(2), x), x, a*log(x) + b*x**S(2)/S(2) + c*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))/x**S(3), x), x, -a/x + b*x + c*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, a**S(2)*x**(m + S(3))/(m + S(3)) + S(2)*a*b*x**(m + S(5))/(m + S(5)) + S(2)*b*c*x**(m + S(9))/(m + S(9)) + c**S(2)*x**(m + S(11))/(m + S(11)) + x**(m + S(7))*(S(2)*a*c + b**S(2))/(m + S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, a**S(2)*x**S(5)/S(5) + S(2)*a*b*x**S(7)/S(7) + S(2)*b*c*x**S(11)/S(11) + c**S(2)*x**S(13)/S(13) + x**S(9)*(S(2)*a*c + b**S(2))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, a**S(2)*x**S(4)/S(4) + a*b*x**S(6)/S(3) + b*c*x**S(10)/S(5) + c**S(2)*x**S(12)/S(12) + x**S(8)*(S(2)*a*c + b**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, a**S(2)*x**S(3)/S(3) + S(2)*a*b*x**S(5)/S(5) + S(2)*b*c*x**S(9)/S(9) + c**S(2)*x**S(11)/S(11) + x**S(7)*(S(2)*a*c + b**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**S(2)/x, x), x, a**S(2)*x**S(2)/S(2) + a*b*x**S(4)/S(2) + b*c*x**S(8)/S(4) + c**S(2)*x**S(10)/S(10) + x**S(6)*(S(2)*a*c + b**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**S(2)/x**S(2), x), x, a**S(2)*x + S(2)*a*b*x**S(3)/S(3) + S(2)*b*c*x**S(7)/S(7) + c**S(2)*x**S(9)/S(9) + x**S(5)*(S(2)*a*c + b**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a*x + b*x**S(3) + c*x**S(5)), x), x, -b*x**S(2)/(S(2)*c**S(2)) + b*(-S(3)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(3)*sqrt(-S(4)*a*c + b**S(2))) + x**S(4)/(S(4)*c) + (-a*c + b**S(2))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a*x + b*x**S(3) + c*x**S(5)), x), x, -b*x/c**S(2) + x**S(3)/(S(3)*c) + sqrt(S(2))*(-a*c + b**S(2) + b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(-a*c + b**S(2) - b*(-S(3)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a*x + b*x**S(3) + c*x**S(5)), x), x, -b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)) + x**S(2)/(S(2)*c) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x + b*x**S(3) + c*x**S(5)), x), x, x/c - sqrt(S(2))*(b - (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*(b + (-S(2)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x + b*x**S(3) + c*x**S(5)), x), x, b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c*sqrt(-S(4)*a*c + b**S(2))) + log(a + b*x**S(2) + c*x**S(4))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x + b*x**S(3) + c*x**S(5)), x), x, -sqrt(S(2))*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x + b*x**S(3) + c*x**S(5)), x), x, -atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x + b*x**S(3) + c*x**S(5)), x), x, -sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))) + sqrt(S(2))*sqrt(c)*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*x + b*x**S(3) + c*x**S(5)), x), x, b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a*sqrt(-S(4)*a*c + b**S(2))) + log(x)/a - log(a + b*x**S(2) + c*x**S(4))/(S(4)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x + b*x**S(3) + c*x**S(5))), x), x, -sqrt(S(2))*sqrt(c)*(-b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) - sqrt(S(2))*sqrt(c)*(b/sqrt(-S(4)*a*c + b**S(2)) + S(1))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))) - S(1)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*x + b*x**S(3) + c*x**S(5))), x), x, -S(1)/(S(2)*a*x**S(2)) - b*log(x)/a**S(2) + b*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)) - (-S(2)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*sqrt(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(11)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -b*x**S(4)/(S(2)*c*(-S(4)*a*c + b**S(2))) - b*log(a + b*x**S(2) + c*x**S(4))/(S(2)*c**S(3)) + x**S(6)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + x**S(2)*(-S(3)*a*c + b**S(2))/(c**S(2)*(-S(4)*a*c + b**S(2))) - (S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(c**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(10)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -b*x**S(3)/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**S(5)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + x*(-S(10)*a*c + S(3)*b**S(2))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(-S(13)*a*b*c + S(3)*b**S(3) + (S(20)*a**S(2)*c**S(2) - S(19)*a*b**S(2)*c + S(3)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*(-S(13)*a*b*c + S(3)*b**S(3) - (S(20)*a**S(2)*c**S(2) - S(19)*a*b**S(2)*c + S(3)*b**S(4))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(5)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -b*x**S(2)/(S(2)*c*(-S(4)*a*c + b**S(2))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*c**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x**S(4)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + log(a + b*x**S(2) + c*x**S(4))/(S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -b*x/(S(2)*c*(-S(4)*a*c + b**S(2))) + x**S(3)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(-S(6)*a*c + b**S(2) + b*(-S(8)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(-S(6)*a*c + b**S(2) - b*(-S(8)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*c**(S(3)/2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, S(2)*a*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + x**S(2)*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, x*(S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*(b - (S(4)*a*c + b**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))) + sqrt(S(2))*(S(4)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -b*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) + (S(2)*a + b*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -sqrt(S(2))*sqrt(c)*(S(2)*b + sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(2)*b - sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - x*(b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, S(2)*c*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(-S(4)*a*c + b**S(2))**(S(3)/2) - (b + S(2)*c*x**S(2))/((-S(8)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, -sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) - b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(-S(12)*a*c + b**S(2) + b*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + x*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*x + b*x**S(3) + c*x**S(5))**S(2), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + b*(-S(6)*a*c + b**S(2))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(2)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + log(x)/a**S(2) - log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**(S(-2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) + sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) - (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - sqrt(S(2))*sqrt(c)*(-S(16)*a*b*c + S(3)*b**S(3) + (-S(10)*a*c + S(3)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(2)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) - (-S(10)*a*c + S(3)*b**S(2))/(S(2)*a**S(2)*x*(-S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*x + b*x**S(3) + c*x**S(5))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x**S(2)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(3)*a*c + b**S(2))/(a**S(2)*x**S(2)*(-S(4)*a*c + b**S(2))) - S(2)*b*log(x)/a**S(3) + b*log(a + b*x**S(2) + c*x**S(4))/(S(2)*a**S(3)) - (S(6)*a**S(2)*c**S(2) - S(6)*a*b**S(2)*c + b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(a**S(3)*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*x + b*x**S(3) + c*x**S(5))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x**S(3)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(14)*a*c + S(5)*b**S(2))/(S(6)*a**S(2)*x**S(3)*(-S(4)*a*c + b**S(2))) + b*(-S(19)*a*c + S(5)*b**S(2))/(S(2)*a**S(3)*x*(-S(4)*a*c + b**S(2))) - sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) - b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)) + sqrt(S(2))*sqrt(c)*(S(28)*a**S(2)*c**S(2) - S(29)*a*b**S(2)*c + S(5)*b**S(4) + b*(-S(19)*a*c + S(5)*b**S(2))*sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(4)*a**S(3)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))*(-S(4)*a*c + b**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a*x + b*x**S(3) + c*x**S(5))**S(2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(S(2)*a*x**S(4)*(-S(4)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))) - (-S(8)*a*c + S(3)*b**S(2))/(S(4)*a**S(2)*x**S(4)*(-S(4)*a*c + b**S(2))) + b*(-S(11)*a*c + S(3)*b**S(2))/(S(2)*a**S(3)*x**S(2)*(-S(4)*a*c + b**S(2))) + b*(S(30)*a**S(2)*c**S(2) - S(20)*a*b**S(2)*c + S(3)*b**S(4))*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/(S(2)*a**S(4)*(-S(4)*a*c + b**S(2))**(S(3)/2)) + (-S(2)*a*c + S(3)*b**S(2))*log(x)/a**S(4) - (-S(2)*a*c + S(3)*b**S(2))*log(a + b*x**S(2) + c*x**S(4))/(S(4)*a**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, S(2)*a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(15)*c**(S(7)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) - a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(30)*c**(S(7)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + sqrt(x)*(b + S(3)*c*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(15)*c) - x**(S(3)/2)*(-S(6)*a*c + S(2)*b**S(2))*(a + b*x**S(2) + c*x**S(4))/(S(15)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, (b + S(2)*c*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(8)*c*sqrt(x)) - sqrt(x)*(-S(4)*a*c + b**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(16)*c**(S(3)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x + b*x**S(3) + c*x**S(5))/sqrt(x), x), x, -a**(S(1)/4)*b*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(3)*c**(S(3)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(2)*sqrt(a)*sqrt(c) + b)*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(6)*c**(S(3)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + b*x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))/(S(3)*sqrt(c)*(sqrt(a) + sqrt(c)*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + sqrt(x)*sqrt(a*x + b*x**S(3) + c*x**S(5))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x + b*x**S(3) + c*x**S(5))/x**(S(3)/2), x), x, -sqrt(a)*sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + b*sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*sqrt(c)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(2)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2), x), x, -S(3)*b*sqrt(x)*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(512)*c**(S(7)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + sqrt(x)*(S(3)*b + S(8)*c*x**S(2))*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/(S(80)*c) - x**(S(3)/2)*(b*(-S(4)*a*c + S(5)*b**S(2)) + S(4)*c*x**S(2)*(-S(16)*a*c + S(5)*b**S(2)))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(640)*c**S(2)) + sqrt(a*x + b*x**S(3) + c*x**S(5))*(S(128)*a**S(2)*c**S(2) - S(100)*a*b**S(2)*c + S(15)*b**S(4))/(S(1280)*c**S(3)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2), x), x, -a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(315)*c**(S(11)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(S(4)*sqrt(a)*b*sqrt(c)*(-S(6)*a*c + b**S(2)) + S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(630)*c**(S(11)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + (S(3)*b + S(7)*c*x**S(2))*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/(S(63)*c*sqrt(x)) - sqrt(x)*(b*(-S(9)*a*c + S(4)*b**S(2)) + S(6)*c*x**S(2)*(-S(7)*a*c + S(2)*b**S(2)))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(315)*c**S(2)) + x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))*(S(84)*a**S(2)*c**S(2) - S(57)*a*b**S(2)*c + S(8)*b**S(4))/(S(315)*c**(S(5)/2)*(sqrt(a) + sqrt(c)*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/sqrt(x), x), x, (b + S(2)*c*x**S(2))*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/(S(16)*c*x**(S(3)/2)) - (b + S(2)*c*x**S(2))*(-S(12)*a*c + S(3)*b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(128)*c**S(2)*sqrt(x)) + S(3)*sqrt(x)*(-S(4)*a*c + b**S(2))**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(256)*c**(S(5)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/x**(S(3)/2), x), x, S(2)*a**(S(1)/4)*b*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(8)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(35)*c**(S(7)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) - a**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*sqrt(c)*(-S(20)*a*c + b**S(2)) + S(2)*b*(-S(8)*a*c + b**S(2)))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(70)*c**(S(7)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) - S(2)*b*x**(S(3)/2)*(-S(8)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))/(S(35)*c**(S(3)/2)*(sqrt(a) + sqrt(c)*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + (a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)/(S(7)*sqrt(x)) + sqrt(x)*(S(10)*a*c + b**S(2) + S(3)*b*c*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(35)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((b + S(2)*c*x**S(2))/(S(2)*sqrt(c)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(c)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*c**(S(1)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*sqrt(a*x + b*x**S(3) + c*x**S(5))), x), x, -sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*sqrt(a)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))), x), x, sqrt(c)*x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) - sqrt(a*x + b*x**S(3) + c*x**S(5))/(a*x**(S(3)/2)) - c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)/2)/(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2), x), x, -b*sqrt(c)*x**(S(3)/2)*(a + b*x**S(2) + c*x**S(4))/(a*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + x**(S(3)/2)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + b*c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(3)/4)*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) - c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(3)/4)*(-S(2)*sqrt(a)*sqrt(c) + b)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2), x), x, sqrt(x)*(-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) - sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(2)*a**(S(3)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*sqrt(x)*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + S(2)*sqrt(c)*x**(S(3)/2)*(-S(3)*a*c + b**S(2))*(a + b*x**S(2) + c*x**S(4))/(a**S(2)*(sqrt(a) + sqrt(c)*x**S(2))*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) - (-S(6)*a*c + S(2)*b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(a**S(2)*x**(S(3)/2)*(-S(4)*a*c + b**S(2))) - S(2)*c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-S(3)*a*c + b**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(a**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) + c**(S(1)/4)*sqrt(x)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(sqrt(a)*b*sqrt(c) - S(6)*a*c + S(2)*b**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(7)/4)*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(3)/2)*(a*x + b*x**S(3) + c*x**S(5))**(S(3)/2)), x), x, (-S(2)*a*c + b**S(2) + b*c*x**S(2))/(a*x**(S(3)/2)*(-S(4)*a*c + b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))) - (-S(8)*a*c + S(3)*b**S(2))*sqrt(a*x + b*x**S(3) + c*x**S(5))/(S(2)*a**S(2)*x**(S(5)/2)*(-S(4)*a*c + b**S(2))) + S(3)*b*sqrt(x)*sqrt(a + b*x**S(2) + c*x**S(4))*atanh((S(2)*a + b*x**S(2))/(S(2)*sqrt(a)*sqrt(a + b*x**S(2) + c*x**S(4))))/(S(4)*a**(S(5)/2)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(3)*n/S(2) + S(-3)/2)/(a*x**(n + S(-1)) + b*x**n + c*x**(n + S(1)))**(S(3)/2), x), x, -S(2)*x**(n/S(2) + S(-1)/2)*(b + S(2)*c*x)/((-S(4)*a*c + b**S(2))*sqrt(a*x**(n + S(-1)) + b*x**n + c*x**(n + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, S(2)*x**S(2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(1)/2, S(1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(d + e*x**S(2))/sqrt(a*x + b*x**S(3) + c*x**S(5)), x), x, S(2)*d*x**S(2)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(3)/4, S(1)/2, S(1)/2, S(7)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(3)*sqrt(a*x + b*x**S(3) + c*x**S(5))) + S(2)*e*x**S(4)*sqrt(S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))) + S(1))*sqrt(S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))) + S(1))*AppellF1(S(7)/4, S(1)/2, S(1)/2, S(11)/4, -S(2)*c*x**S(2)/(b - sqrt(-S(4)*a*c + b**S(2))), -S(2)*c*x**S(2)/(b + sqrt(-S(4)*a*c + b**S(2))))/(S(7)*sqrt(a*x + b*x**S(3) + c*x**S(5))), expand=True, _diff=True, _numerical=True)
c43a8459487ba0bae300737254a5b55db98cd0b527599dbad29f1c5524ce124e
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot from sympy.functions.elementary.hyperbolic import atanh from sympy.functions.elementary.hyperbolic import asinh from sympy.functions.elementary.hyperbolic import acosh from sympy.functions.elementary.trigonometric import atan from sympy.functions.elementary.trigonometric import asin from sympy.functions.elementary.trigonometric import acos from sympy.integrals.rubi.utility_function import (EllipticE, EllipticF, hypergeom, rubi_test, AppellF1, EllipticPi, Log, Sqrt, ArcTan, ArcTanh, ArcSin, ArcCos, Hypergeometric2F1) from sympy import pi as Pi from sympy import S, hyper, I, simplify, exp_polar, symbols,elliptic_pi,elliptic_e, elliptic_f from sympy.testing.pytest import SKIP from sympy import acsch as arccsch, acsc as arccsc from sympy import acsch, acsc a, b, c, d, e, f, m, n, x, u , k, p, r, s, t= symbols('a b c d e f m n x u k p r s t') A, B, C, D, a, b, c, d, e, f, g, h, y, z, m, n, p, q, u, v, w, F = symbols('A B C D a b c d e f g h y z m n p q u v w F',) def test_1(): # difference in apart assert rubi_test(rubi_integrate(S(1)/(S(2)*sqrt(S(3))*b**(S(3)/2) - S(9)*b*x + S(9)*x**S(3)), x), x, -log(sqrt(b) - sqrt(S(3))*x)/(S(27)*b) + log(S(2)*sqrt(b) + sqrt(S(3))*x)/(S(27)*b) + sqrt(S(3))/(S(9)*sqrt(b)*(sqrt(S(3))*sqrt(b) - S(3)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**p, x), x, (a + b*x)*(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**p/(b*(S(3)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**S(3), x), x, (a + b*x)**S(10)/(S(10)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**S(2), x), x, (a + b*x)**S(7)/(S(7)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3), x), x, a**S(3)*x + S(3)*a**S(2)*b*x**S(2)/S(2) + a*b**S(2)*x**S(3) + b**S(3)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3)), x), x, -S(1)/(S(2)*b*(a + b*x)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**(S(-2)), x), x, -S(1)/(S(5)*b*(a + b*x)**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(3) + S(3)*a**S(2)*b*x + S(3)*a*b**S(2)*x**S(2) + b**S(3)*x**S(3))**(S(-3)), x), x, -S(1)/(S(8)*b*(a + b*x)**S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3))**S(3), x), x, -b**S(3)*x*(-S(3)*a*c + b**S(2))**S(3)/c**S(3) + S(3)*b**S(2)*(b + c*x)**S(4)*(-S(3)*a*c + b**S(2))**S(2)/(S(4)*c**S(4)) - S(3)*b*(b + c*x)**S(7)*(-S(3)*a*c + b**S(2))/(S(7)*c**S(4)) + (b + c*x)**S(10)/(S(10)*c**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3))**S(2), x), x, b**S(2)*x*(-S(3)*a*c + b**S(2))**S(2)/c**S(2) - b*(b + c*x)**S(4)*(-S(3)*a*c + b**S(2))/(S(2)*c**S(3)) + (b + c*x)**S(7)/(S(7)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3), x), x, S(3)*a*b*x + S(3)*b**S(2)*x**S(2)/S(2) + b*c*x**S(3) + c**S(2)*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3)), x), x, log(b**(S(1)/3)*(-S(3)*a*c + b**S(2))**(S(1)/3) - b - c*x)/(S(3)*b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3)) - log(b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3) + b**(S(1)/3)*(b + c*x)*(-S(3)*a*c + b**S(2))**(S(1)/3) + (b + c*x)**S(2))/(S(6)*b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3)) - sqrt(S(3))*atan(sqrt(S(3))*(b**(S(1)/3) + (S(2)*b + S(2)*c*x)/(-S(3)*a*c + b**S(2))**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(3)*b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3))**(S(-2)), x), x, c*(b + c*x)/(S(3)*b*(-S(3)*a*c + b**S(2))*(b*(-S(3)*a*c + b**S(2)) - (b + c*x)**S(3))) - S(2)*c*log(b**(S(1)/3)*(-S(3)*a*c + b**S(2))**(S(1)/3) - b - c*x)/(S(9)*b**(S(5)/3)*(-S(3)*a*c + b**S(2))**(S(5)/3)) + c*log(b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3) + b**(S(1)/3)*(b + c*x)*(-S(3)*a*c + b**S(2))**(S(1)/3) + (b + c*x)**S(2))/(S(9)*b**(S(5)/3)*(-S(3)*a*c + b**S(2))**(S(5)/3)) + S(2)*sqrt(S(3))*c*atan(sqrt(S(3))*(b**(S(1)/3) + (S(2)*b + S(2)*c*x)/(-S(3)*a*c + b**S(2))**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(9)*b**(S(5)/3)*(-S(3)*a*c + b**S(2))**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*a*b + S(3)*b**S(2)*x + S(3)*b*c*x**S(2) + c**S(2)*x**S(3))**(S(-3)), x), x, -c**S(2)*(b + c*x)/(S(6)*b*(-S(3)*a*c + b**S(2))*(b*(-S(3)*a*c + b**S(2)) - (b + c*x)**S(3))**S(2)) - S(5)*c**S(2)*(b + c*x)/(S(18)*b**S(2)*(-S(3)*a*c + b**S(2))**S(2)*(b*(-S(3)*a*c + b**S(2)) - (b + c*x)**S(3))) + S(5)*c**S(2)*log(b**(S(1)/3)*(-S(3)*a*c + b**S(2))**(S(1)/3) - b - c*x)/(S(27)*b**(S(8)/3)*(-S(3)*a*c + b**S(2))**(S(8)/3)) - S(5)*c**S(2)*log(b**(S(2)/3)*(-S(3)*a*c + b**S(2))**(S(2)/3) + b**(S(1)/3)*(b + c*x)*(-S(3)*a*c + b**S(2))**(S(1)/3) + (b + c*x)**S(2))/(S(54)*b**(S(8)/3)*(-S(3)*a*c + b**S(2))**(S(8)/3)) - S(5)*sqrt(S(3))*c**S(2)*atan(sqrt(S(3))*(b**(S(1)/3) + (S(2)*b + S(2)*c*x)/(-S(3)*a*c + b**S(2))**(S(1)/3))/(S(3)*b**(S(1)/3)))/(S(27)*b**(S(8)/3)*(-S(3)*a*c + b**S(2))**(S(8)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e))**S(3), x), x, a**S(3)*c**S(3)*e**S(3)*x + S(3)*a**S(2)*c**S(2)*e**S(2)*x**S(2)*(a*c*f + a*d*e + b*c*e)/S(2) + a*c*e*x**S(3)*(a**S(2)*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2)) + S(3)*a*b*c*e*(c*f + d*e) + b**S(2)*c**S(2)*e**S(2)) + b**S(3)*d**S(3)*f**S(3)*x**S(10)/S(10) + b**S(2)*d**S(2)*f**S(2)*x**S(9)*(a*d*f + b*c*f + b*d*e)/S(3) + S(3)*b*d*f*x**S(8)*(a**S(2)*d**S(2)*f**S(2) + S(3)*a*b*d*f*(c*f + d*e) + b**S(2)*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2)))/S(8) + x**S(7)*(a**S(3)*d**S(3)*f**S(3)/S(7) + S(9)*a**S(2)*b*d**S(2)*f**S(2)*(c*f + d*e)/S(7) + S(9)*a*b**S(2)*d*f*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(7) + b**S(3)*(c**S(3)*f**S(3) + S(9)*c**S(2)*d*e*f**S(2) + S(9)*c*d**S(2)*e**S(2)*f + d**S(3)*e**S(3))/S(7)) + x**S(6)*(a**S(3)*d**S(2)*f**S(2)*(c*f + d*e)/S(2) + S(3)*a**S(2)*b*d*f*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(2) + a*b**S(2)*(c**S(3)*f**S(3) + S(9)*c**S(2)*d*e*f**S(2) + S(9)*c*d**S(2)*e**S(2)*f + d**S(3)*e**S(3))/S(2) + b**S(3)*c*e*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(2)) + x**S(5)*(S(3)*a**S(3)*d*f*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(5) + S(3)*a**S(2)*b*(c**S(3)*f**S(3) + S(9)*c**S(2)*d*e*f**S(2) + S(9)*c*d**S(2)*e**S(2)*f + d**S(3)*e**S(3))/S(5) + S(9)*a*b**S(2)*c*e*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(5) + S(3)*b**S(3)*c**S(2)*e**S(2)*(c*f + d*e)/S(5)) + x**S(4)*(a**S(3)*(c**S(3)*f**S(3) + S(9)*c**S(2)*d*e*f**S(2) + S(9)*c*d**S(2)*e**S(2)*f + d**S(3)*e**S(3))/S(4) + S(9)*a**S(2)*b*c*e*(c**S(2)*f**S(2) + S(3)*c*d*e*f + d**S(2)*e**S(2))/S(4) + S(9)*a*b**S(2)*c**S(2)*e**S(2)*(c*f + d*e)/S(4) + b**S(3)*c**S(3)*e**S(3)/S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e))**S(2), x), x, a**S(2)*c**S(2)*e**S(2)*x + a*c*e*x**S(2)*(a*c*f + a*d*e + b*c*e) + b**S(2)*d**S(2)*f**S(2)*x**S(7)/S(7) + b*d*f*x**S(6)*(a*d*f + b*c*f + b*d*e)/S(3) + x**S(5)*(a**S(2)*d**S(2)*f**S(2)/S(5) + S(4)*a*b*d*f*(c*f + d*e)/S(5) + b**S(2)*(c**S(2)*f**S(2) + S(4)*c*d*e*f + d**S(2)*e**S(2))/S(5)) + x**S(4)*(a**S(2)*d*f*(c*f + d*e)/S(2) + a*b*(c**S(2)*f**S(2) + S(4)*c*d*e*f + d**S(2)*e**S(2))/S(2) + b**S(2)*c*e*(c*f + d*e)/S(2)) + x**S(3)*(a**S(2)*(c**S(2)*f**S(2) + S(4)*c*d*e*f + d**S(2)*e**S(2))/S(3) + S(4)*a*b*c*e*(c*f + d*e)/S(3) + b**S(2)*c**S(2)*e**S(2)/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e), x), x, a*c*e*x + b*d*f*x**S(4)/S(4) + x**S(3)*(a*d*f/S(3) + b*c*f/S(3) + b*d*e/S(3)) + x**S(2)*(a*c*f/S(2) + a*d*e/S(2) + b*c*e/S(2)), expand=True, _diff=True, _numerical=True) '''taking a long time assert rubi_test(rubi_integrate(S(1)/(a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e)), x), x, b*log(a + b*x)/((-a*d + b*c)*(-a*f + b*e)) - d*log(c + d*x)/((-a*d + b*c)*(-c*f + d*e)) + f*log(e + f*x)/((-a*f + b*e)*(-c*f + d*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e))**(S(-2)), x), x, -S(2)*b**S(3)*(-S(2)*a*d*f + b*c*f + b*d*e)*log(a + b*x)/((-a*d + b*c)**S(3)*(-a*f + b*e)**S(3)) - b**S(3)/((a + b*x)*(-a*d + b*c)**S(2)*(-a*f + b*e)**S(2)) + S(2)*d**S(3)*(a*d*f - S(2)*b*c*f + b*d*e)*log(c + d*x)/((-a*d + b*c)**S(3)*(-c*f + d*e)**S(3)) - d**S(3)/((c + d*x)*(-a*d + b*c)**S(2)*(-c*f + d*e)**S(2)) + S(2)*f**S(3)*(-a*d*f - b*c*f + S(2)*b*d*e)*log(e + f*x)/((-a*f + b*e)**S(3)*(-c*f + d*e)**S(3)) - f**S(3)/((e + f*x)*(-a*f + b*e)**S(2)*(-c*f + d*e)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*c*e + b*d*f*x**S(3) + x**S(2)*(a*d*f + b*c*f + b*d*e) + x*(a*c*f + a*d*e + b*c*e))**(S(-3)), x), x, S(3)*b**S(5)*(S(7)*a**S(2)*d**S(2)*f**S(2) - S(7)*a*b*d*f*(c*f + d*e) + b**S(2)*(S(2)*c**S(2)*f**S(2) + S(3)*c*d*e*f + S(2)*d**S(2)*e**S(2)))*log(a + b*x)/((-a*d + b*c)**S(5)*(-a*f + b*e)**S(5)) + S(3)*b**S(5)*(-S(2)*a*d*f + b*c*f + b*d*e)/((a + b*x)*(-a*d + b*c)**S(4)*(-a*f + b*e)**S(4)) - b**S(5)/(S(2)*(a + b*x)**S(2)*(-a*d + b*c)**S(3)*(-a*f + b*e)**S(3)) - S(3)*d**S(5)*(S(2)*a**S(2)*d**S(2)*f**S(2) + a*b*d*f*(-S(7)*c*f + S(3)*d*e) + b**S(2)*(S(7)*c**S(2)*f**S(2) - S(7)*c*d*e*f + S(2)*d**S(2)*e**S(2)))*log(c + d*x)/((-a*d + b*c)**S(5)*(-c*f + d*e)**S(5)) + S(3)*d**S(5)*(a*d*f - S(2)*b*c*f + b*d*e)/((c + d*x)*(-a*d + b*c)**S(4)*(-c*f + d*e)**S(4)) + d**S(5)/(S(2)*(c + d*x)**S(2)*(-a*d + b*c)**S(3)*(-c*f + d*e)**S(3)) + S(3)*f**S(5)*(S(2)*a**S(2)*d**S(2)*f**S(2) - a*b*d*f*(-S(3)*c*f + S(7)*d*e) + b**S(2)*(S(2)*c**S(2)*f**S(2) - S(7)*c*d*e*f + S(7)*d**S(2)*e**S(2)))*log(e + f*x)/((-a*f + b*e)**S(5)*(-c*f + d*e)**S(5)) - S(3)*f**S(5)*(-a*d*f - b*c*f + S(2)*b*d*e)/((e + f*x)*(-a*f + b*e)**S(4)*(-c*f + d*e)**S(4)) - f**S(5)/(S(2)*(e + f*x)**S(2)*(-a*f + b*e)**S(3)*(-c*f + d*e)**S(3)), expand=True, _diff=True, _numerical=True) ''' '''matchpy and mathematica difference assert rubi_test(rubi_integrate(S(1)/(S(16)*x**S(3) - S(4)*x**S(2) + S(4)*x + S(-1)), x), x, log(-S(4)*x + S(1))/S(5) - log(S(4)*x**S(2) + S(1))/S(10) - atan(S(2)*x)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3) + x**S(2) + x + S(1)), x), x, log(x + S(1))/S(2) - log(x**S(2) + S(1))/S(4) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) ''' assert rubi_test(rubi_integrate(S(1)/(d*x**S(3)), x), x, -S(1)/(S(2)*d*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(c*x**S(2) + d*x**S(3)), x), x, -S(1)/(c*x) - d*log(x)/c**S(2) + d*log(c + d*x)/c**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(b*x + d*x**S(3)), x), x, log(x)/b - log(b + d*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(b*x + c*x**S(2) + d*x**S(3)), x), x, c*atanh((c + S(2)*d*x)/sqrt(-S(4)*b*d + c**S(2)))/(b*sqrt(-S(4)*b*d + c**S(2))) + log(x)/b - log(b + c*x + d*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + d*x**S(3)), x), x, log(a**(S(1)/3) + d**(S(1)/3)*x)/(S(3)*a**(S(2)/3)*d**(S(1)/3)) - log(a**(S(2)/3) - a**(S(1)/3)*d**(S(1)/3)*x + d**(S(2)/3)*x**S(2))/(S(6)*a**(S(2)/3)*d**(S(1)/3)) - sqrt(S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*d**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*d**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d*x**S(3))**n, x), x, x*(d*x**S(3))**n/(S(3)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2) + d*x**S(3))**n, x), x, x*(S(1) + d*x/c)**(-n)*(c*x**S(2) + d*x**S(3))**n*hyper((-n, S(2)*n + S(1)), (S(2)*n + S(2),), -d*x/c)/(S(2)*n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x + d*x**S(3))**n, x), x, x*(b + d*x**S(2))*(b*x + d*x**S(3))**n*hyper((S(1), S(3)*n/S(2) + S(3)/2), (n/S(2) + S(3)/2,), -d*x**S(2)/b)/(b*(n + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((b*x + d*x**S(3))**n, x), x, x*(S(1) + d*x**S(2)/b)**(-n)*(b*x + d*x**S(3))**n*hyper((-n, n/S(2) + S(1)/2), (n/S(2) + S(3)/2,), -d*x**S(2)/b)/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x + c*x**S(2) + d*x**S(3))**n, x), x, x*(S(2)*d*x/(c - sqrt(-S(4)*b*d + c**S(2))) + S(1))**(-n)*(S(2)*d*x/(c + sqrt(-S(4)*b*d + c**S(2))) + S(1))**(-n)*(b*x + c*x**S(2) + d*x**S(3))**n*AppellF1(n + S(1), -n, -n, n + S(2), -S(2)*d*x/(c - sqrt(-S(4)*b*d + c**S(2))), -S(2)*d*x/(c + sqrt(-S(4)*b*d + c**S(2))))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + d*x**S(3))**n, x), x, x*(a + d*x**S(3))**(n + S(1))*hyper((S(1), n + S(4)/3), (S(4)/3,), -d*x**S(3)/a)/a, expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + d*x**S(3))**n, x), x, x*(S(1) + d*x**S(3)/a)**(-n)*(a + d*x**S(3))**n*hyper((S(1)/3, -n), (S(4)/3,), -d*x**S(3)/a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5))**S(3), x), x, (a + b*x)**S(16)/(S(16)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5))**S(2), x), x, (a + b*x)**S(11)/(S(11)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5), x), x, (a + b*x)**S(6)/(S(6)*b), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5), x), x, a**S(5)*x + S(5)*a**S(4)*b*x**S(2)/S(2) + S(10)*a**S(3)*b**S(2)*x**S(3)/S(3) + S(5)*a**S(2)*b**S(3)*x**S(4)/S(2) + a*b**S(4)*x**S(5) + b**S(5)*x**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5)), x), x, -S(1)/(S(4)*b*(a + b*x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5))**(S(-2)), x), x, -S(1)/(S(9)*b*(a + b*x)**S(9)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(5) + S(5)*a**S(4)*b*x + S(10)*a**S(3)*b**S(2)*x**S(2) + S(10)*a**S(2)*b**S(3)*x**S(3) + S(5)*a*b**S(4)*x**S(4) + b**S(5)*x**S(5))**(S(-3)), x), x, -S(1)/(S(14)*b*(a + b*x)**S(14)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(c + (a + b*x)**S(2)), x), x, -S(3)*a*x/b**S(3) - a*(a**S(2) - S(3)*c)*atan((a + b*x)/sqrt(c))/(b**S(4)*sqrt(c)) + (a + b*x)**S(2)/(S(2)*b**S(4)) + (S(3)*a**S(2)/S(2) - c/S(2))*log(c + (a + b*x)**S(2))/b**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(c + (a + b*x)**S(2)), x), x, -a*log(c + (a + b*x)**S(2))/b**S(3) + x/b**S(2) + (a**S(2) - c)*atan((a + b*x)/sqrt(c))/(b**S(3)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(c + (a + b*x)**S(2)), x), x, -a*atan((a + b*x)/sqrt(c))/(b**S(2)*sqrt(c)) + log(c + (a + b*x)**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(c + (a + b*x)**S(2)), x), x, atan((a + b*x)/sqrt(c))/(b*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(c + (a + b*x)**S(2))), x), x, -a*atan((a + b*x)/sqrt(c))/(sqrt(c)*(a**S(2) + c)) + log(x)/(a**S(2) + c) - log(c + (a + b*x)**S(2))/(S(2)*(a**S(2) + c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(c + (a + b*x)**S(2))), x), x, -S(2)*a*b*log(x)/(a**S(2) + c)**S(2) + a*b*log(c + (a + b*x)**S(2))/(a**S(2) + c)**S(2) + b*(a**S(2) - c)*atan((a + b*x)/sqrt(c))/(sqrt(c)*(a**S(2) + c)**S(2)) - S(1)/(x*(a**S(2) + c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(c + (a + b*x)**S(2))), x), x, -a*b**S(2)*(a**S(2) - S(3)*c)*atan((a + b*x)/sqrt(c))/(sqrt(c)*(a**S(2) + c)**S(3)) + S(2)*a*b/(x*(a**S(2) + c)**S(2)) + b**S(2)*(S(3)*a**S(2) - c)*log(x)/(a**S(2) + c)**S(3) - b**S(2)*(S(3)*a**S(2) - c)*log(c + (a + b*x)**S(2))/(S(2)*(a**S(2) + c)**S(3)) - S(1)/(S(2)*x**S(2)*(a**S(2) + c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c + d*x)**S(2)), x), x, atan(sqrt(b)*(c + d*x)/sqrt(a))/(sqrt(a)*sqrt(b)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c + d*x)**S(2))**(S(-2)), x), x, (c/S(2) + d*x/S(2))/(a*d*(a + b*(c + d*x)**S(2))) + atan(sqrt(b)*(c + d*x)/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c + d*x)**S(2))**(S(-3)), x), x, (c/S(4) + d*x/S(4))/(a*d*(a + b*(c + d*x)**S(2))**S(2)) + (S(3)*c/S(8) + S(3)*d*x/S(8))/(a**S(2)*d*(a + b*(c + d*x)**S(2))) + S(3)*atan(sqrt(b)*(c + d*x)/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(b*(c + d*x)**S(2) + sqrt(-a)), x), x, atan(sqrt(b)*(c + d*x)/(-a)**(S(1)/4))/(sqrt(b)*d*(-a)**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((c + d*x)**S(2) + S(1)), x), x, atan(c + d*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((c + d*x)**S(2) + S(1))**(S(-2)), x), x, (c/S(2) + d*x/S(2))/(d*((c + d*x)**S(2) + S(1))) + atan(c + d*x)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((c + d*x)**S(2) + S(1))**(S(-3)), x), x, (c/S(4) + d*x/S(4))/(d*((c + d*x)**S(2) + S(1))**S(2)) + (S(3)*c/S(8) + S(3)*d*x/S(8))/(d*((c + d*x)**S(2) + S(1))) + S(3)*atan(c + d*x)/(S(8)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-(c + d*x)**S(2) + S(1)), x), x, atanh(c + d*x)/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-(c + d*x)**S(2) + S(1))**(S(-2)), x), x, (c/S(2) + d*x/S(2))/(d*(-(c + d*x)**S(2) + S(1))) + atanh(c + d*x)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-(c + d*x)**S(2) + S(1))**(S(-3)), x), x, (c/S(4) + d*x/S(4))/(d*(-(c + d*x)**S(2) + S(1))**S(2)) + (S(3)*c/S(8) + S(3)*d*x/S(8))/(d*(-(c + d*x)**S(2) + S(1))) + S(3)*atanh(c + d*x)/(S(8)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-(x + S(1))**S(2) + S(1)), x), x, atanh(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-(x + S(1))**S(2) + S(1))**(S(-2)), x), x, (x/S(2) + S(1)/2)/(-(x + S(1))**S(2) + S(1)) + atanh(x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-(x + S(1))**S(2) + S(1))**(S(-3)), x), x, (x/S(4) + S(1)/4)/(-(x + S(1))**S(2) + S(1))**S(2) + (S(3)*x/S(8) + S(3)/8)/(-(x + S(1))**S(2) + S(1)) + S(3)*atanh(x + S(1))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((a + b*x)**S(2) + S(1))**S(2)/x, x), x, a*b*x*(a**S(2) + S(2)) + a*(a + b*x)**S(3)/S(3) + (a + b*x)**S(4)/S(4) + (a + b*x)**S(2)*(a**S(2)/S(2) + S(1)) + (a**S(2) + S(1))**S(2)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((x + S(-1))**S(2) + S(1)), x), x, x + log((x + S(-1))**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(-(x + S(1))**S(2) + S(1)), x), x, -x*sqrt(-(x + S(1))**S(2) + S(1))/S(2) + S(3)*sqrt(-(x + S(1))**S(2) + S(1))/S(2) + S(3)*asin(x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(-(a + b*x)**S(2) + S(1)), x), x, S(3)*a*sqrt(-(a + b*x)**S(2) + S(1))/(S(2)*b**S(3)) - x*sqrt(-(a + b*x)**S(2) + S(1))/(S(2)*b**S(2)) + (a**S(2) + S(1)/2)*asin(a + b*x)/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt((a + b*x)**S(2) + S(1)), x), x, -S(3)*a*sqrt((a + b*x)**S(2) + S(1))/(S(2)*b**S(3)) + x*sqrt((a + b*x)**S(2) + S(1))/(S(2)*b**S(2)) + (a**S(2) + S(-1)/2)*asinh(a + b*x)/b**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((A + B*x + C*x**S(2) + D*x**S(3))/(a*x**S(4) + a + b*x**S(3) + b*x + c*x**S(2)), x), x, -(D*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + S(2)*a*(A - C))*log(S(2)*a*x**S(2) + S(2)*a + x*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + (D*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + S(2)*a*(A - C))*log(S(2)*a*x**S(2) + S(2)*a + x*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))/(S(4)*a*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) - sqrt(S(2))*(S(4)*B*a**S(2) + D*b*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) - a*(A*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + C*b + C*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2)) + S(2)*D*c))*atan(sqrt(S(2))*(S(4)*a*x + b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2)))/(S(2)*sqrt(S(4)*a**S(2) + S(2)*a*c - b*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))))/(S(2)*a*sqrt(S(4)*a**S(2) + S(2)*a*c - b*(b + sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + sqrt(S(2))*(S(4)*B*a**S(2) + D*b*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) - a*(A*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))) + C*b - C*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2)) + S(2)*D*c))*atan(sqrt(S(2))*(S(4)*a*x + b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2)))/(S(2)*sqrt(S(4)*a**S(2) + S(2)*a*c - b*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))))/(S(2)*a*sqrt(S(4)*a**S(2) + S(2)*a*c - b*(b - sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))))*sqrt(S(8)*a**S(2) - S(4)*a*c + b**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2)), x), x, x**S(4)/S(4) + x**S(3)/S(3) - S(3)*x**S(2)/S(4) + S(5)*x/S(4) + log(x**S(2) + x + S(1))/S(3) - S(13)*log(S(2)*x**S(2) - x + S(2))/S(48) + sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(72) - S(10)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2)), x), x, x**S(3)/S(3) + x**S(2)/S(2) - S(3)*x/S(2) + S(2)*log(x**S(2) + x + S(1))/S(3) - log(S(2)*x**S(2) - x + S(2))/S(24) + S(5)*sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(36) + S(8)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2)), x), x, x**S(2)/S(2) + x - log(x**S(2) + x + S(1)) + log(S(2)*x**S(2) - x + S(2))/S(4) + sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(18) + S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2)), x), x, x + log(x**S(2) + x + S(1))/S(3) + log(S(2)*x**S(2) - x + S(2))/S(6) - sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(9) - S(10)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2)), x), x, S(2)*log(x**S(2) + x + S(1))/S(3) - log(S(2)*x**S(2) - x + S(2))/S(6) - sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(9) + S(8)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x*(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2))), x), x, S(5)*log(x)/S(2) - log(x**S(2) + x + S(1)) - log(S(2)*x**S(2) - x + S(2))/S(4) + sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(18) + S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x**S(2)*(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2))), x), x, -S(3)*log(x)/S(4) + log(x**S(2) + x + S(1))/S(3) + log(S(2)*x**S(2) - x + S(2))/S(24) + S(5)*sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(36) - S(10)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9) - S(5)/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x**S(3)*(S(2)*x**S(4) + x**S(3) + S(3)*x**S(2) + x + S(2))), x), x, -S(15)*log(x)/S(8) + S(2)*log(x**S(2) + x + S(1))/S(3) + S(13)*log(S(2)*x**S(2) - x + S(2))/S(48) + sqrt(S(15))*atan(sqrt(S(15))*(-S(4)*x + S(1))/S(15))/S(72) + S(8)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(9) + S(3)/(S(4)*x) - S(5)/(S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2)), x), x, x**S(3)*(S(7) - S(5)*sqrt(S(7))*I)/S(42) + x**S(3)*(S(7) + S(5)*sqrt(S(7))*I)/S(42) + x**S(2)*(S(7) - S(5)*sqrt(S(7))*I)/S(28) + x**S(2)*(S(7) + S(5)*sqrt(S(7))*I)/S(28) - x*(S(35) + S(9)*sqrt(S(7))*I)/S(28) - x*(S(35) - S(9)*sqrt(S(7))*I)/S(28) + S(3)*(S(7) - S(11)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) - sqrt(S(7))*I) + S(4))/S(112) + S(3)*(S(7) + S(11)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) + sqrt(S(7))*I) + S(4))/S(112) - S(11)*(-S(5)*sqrt(S(7)) + S(9)*I)*atan((S(8)*x + S(1) + sqrt(S(7))*I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/(S(4)*sqrt(S(490) - S(14)*sqrt(S(7))*I)) + S(11)*(S(5)*sqrt(S(7)) + S(9)*I)*atan((S(8)*x + S(1) - sqrt(S(7))*I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/(S(4)*sqrt(S(490) + S(14)*sqrt(S(7))*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2)), x), x, x**S(2)*(S(7) - S(5)*sqrt(S(7))*I)/S(28) + x**S(2)*(S(7) + S(5)*sqrt(S(7))*I)/S(28) + x*(S(7) - S(5)*sqrt(S(7))*I)/S(14) + x*(S(7) + S(5)*sqrt(S(7))*I)/S(14) - (S(35) + S(9)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) - sqrt(S(7))*I) + S(4))/S(56) - (S(35) - S(9)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) + sqrt(S(7))*I) + S(4))/S(56) + (-sqrt(S(7)) + S(53)*I)*atan((S(8)*x + S(1) + sqrt(S(7))*I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/(S(2)*sqrt(S(490) - S(14)*sqrt(S(7))*I)) - (sqrt(S(7)) + S(53)*I)*atan((S(8)*x + S(1) - sqrt(S(7))*I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/(S(2)*sqrt(S(490) + S(14)*sqrt(S(7))*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2)), x), x, x*(S(7) - S(5)*sqrt(S(7))*I)/S(14) + x*(S(7) + S(5)*sqrt(S(7))*I)/S(14) + (S(7) + S(5)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) - sqrt(S(7))*I) + S(4))/S(28) + (S(7) - S(5)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) + sqrt(S(7))*I) + S(4))/S(28) + (-S(7)*sqrt(S(7)) + S(19)*I)*atan((S(8)*x + S(1) + sqrt(S(7))*I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/sqrt(S(490) - S(14)*sqrt(S(7))*I) - (S(7)*sqrt(S(7)) + S(19)*I)*atan((S(8)*x + S(1) - sqrt(S(7))*I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/sqrt(S(490) + S(14)*sqrt(S(7))*I), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2)), x), x, (S(7) + S(5)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) - sqrt(S(7))*I) + S(4))/S(28) + (S(7) - S(5)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) + sqrt(S(7))*I) + S(4))/S(28) - (-S(7)*sqrt(S(7)) + S(19)*I)*atan((S(8)*x + S(1) + sqrt(S(7))*I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/sqrt(S(490) - S(14)*sqrt(S(7))*I) + (S(7)*sqrt(S(7)) + S(19)*I)*atan((S(8)*x + S(1) - sqrt(S(7))*I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/sqrt(S(490) + S(14)*sqrt(S(7))*I), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x*(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2))), x), x, (S(35) - S(9)*sqrt(S(7))*I)*log(x)/S(28) + (S(35) + S(9)*sqrt(S(7))*I)*log(x)/S(28) - (S(35) + S(9)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) - sqrt(S(7))*I) + S(4))/S(56) - (S(35) - S(9)*sqrt(S(7))*I)*log(S(4)*x**S(2) + x*(S(1) + sqrt(S(7))*I) + S(4))/S(56) - (-sqrt(S(7)) + S(53)*I)*atan((S(8)*x + S(1) + sqrt(S(7))*I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/(S(2)*sqrt(S(490) - S(14)*sqrt(S(7))*I)) + (sqrt(S(7)) + S(53)*I)*atan((S(8)*x + S(1) - sqrt(S(7))*I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/(S(2)*sqrt(S(490) + S(14)*sqrt(S(7))*I)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x**S(2)*(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2))), x), x, -S(3)*(S(7) + S(11)*sqrt(S(7))*I)*log(x)/S(56) - S(3)*(S(7) - S(11)*sqrt(S(7))*I)*log(x)/S(56) + S(3)*(S(7) + S(11)*sqrt(S(7))*I)*log(S(4)*I*x**S(2) + x*(-sqrt(S(7)) + I) + S(4)*I)/S(112) + S(3)*(S(7) - S(11)*sqrt(S(7))*I)*log(S(4)*I*x**S(2) + x*(sqrt(S(7)) + I) + S(4)*I)/S(112) + S(11)*(S(9) + S(5)*sqrt(S(7))*I)*atanh((S(8)*I*x - sqrt(S(7)) + I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/(S(4)*sqrt(S(490) - S(14)*sqrt(S(7))*I)) - S(11)*(S(9) - S(5)*sqrt(S(7))*I)*atanh((S(8)*I*x + sqrt(S(7)) + I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/(S(4)*sqrt(S(490) + S(14)*sqrt(S(7))*I)) + (S(-5)/4 - S(9)*sqrt(S(7))*I/S(28))/x + (S(-5)/4 + S(9)*sqrt(S(7))*I/S(28))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + x + S(5))/(x**S(3)*(S(2)*x**S(4) + x**S(3) + S(5)*x**S(2) + x + S(2))), x), x, -(S(35) + S(9)*sqrt(S(7))*I)*log(x)/S(16) - (S(35) - S(9)*sqrt(S(7))*I)*log(x)/S(16) + (S(35) - S(9)*sqrt(S(7))*I)*log(S(4)*I*x**S(2) + x*(-sqrt(S(7)) + I) + S(4)*I)/S(32) + (S(35) + S(9)*sqrt(S(7))*I)*log(S(4)*I*x**S(2) + x*(sqrt(S(7)) + I) + S(4)*I)/S(32) + (S(355) - S(73)*sqrt(S(7))*I)*atanh((S(8)*I*x - sqrt(S(7)) + I)/sqrt(S(70) - S(2)*sqrt(S(7))*I))/(S(8)*sqrt(S(490) - S(14)*sqrt(S(7))*I)) - (S(355) + S(73)*sqrt(S(7))*I)*atanh((S(8)*I*x + sqrt(S(7)) + I)/sqrt(S(70) + S(2)*sqrt(S(7))*I))/(S(8)*sqrt(S(490) + S(14)*sqrt(S(7))*I)) + (S(3)/8 - S(33)*sqrt(S(7))*I/S(56))/x + (S(3)/8 + S(33)*sqrt(S(7))*I/S(56))/x + (S(-5)/8 - S(9)*sqrt(S(7))*I/S(56))/x**S(2) + (S(-5)/8 + S(9)*sqrt(S(7))*I/S(56))/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(3)*x**S(2) + x + S(9))/((x**S(2) + S(1))*(x**S(2) + S(3))), x), x, log(x**S(2) + S(3))/S(2) + S(3)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + x + S(3))/((x**S(2) + S(1))*(x**S(2) + S(3))), x), x, log(x**S(2) + S(3))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(3) - x**S(2) + S(6)*x + S(-4))/((x**S(2) + S(1))*(x**S(2) + S(2))), x), x, S(3)*log(x**S(2) + S(1))/S(2) - S(3)*atan(x) + sqrt(S(2))*atan(sqrt(S(2))*x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x**S(4) + S(1))/((x + S(-2))*(x**S(2) + S(1))**S(2)), x), x, (S(2)*x/S(5) + S(-1)/5)/(x**S(2) + S(1)) - S(47)*log(-x + S(2))/S(25) - S(14)*log(x**S(2) + S(1))/S(25) - S(46)*atan(x)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) - S(9)*x + S(-9))/(x**S(3) - S(9)*x), x), x, log(x) - log(-x + S(3)) + S(2)*log(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + S(2)*x**S(2) + S(1))/(x**S(3) - x), x), x, x**S(3)/S(3) + x - log(x) + S(2)*log(-x + S(1)) + log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(3))/(x*(x + S(-1))**S(2)), x), x, S(3)*log(x) - log(-x + S(1)) + S(5)/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(-1))/((S(4)*x + S(-1))*(x**S(2) + S(1))), x), x, -S(7)*log(-S(4)*x + S(1))/S(34) + S(6)*log(x**S(2) + S(1))/S(17) + S(3)*atan(x)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(3)*x**S(2) + S(2)*x + S(-3))/(x**S(2) + S(1)), x), x, x**S(2)/S(2) - S(3)*x + log(x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(6)*x**S(3) + S(10)*x**S(2) + x)/(x**S(2) + S(6)*x + S(10)), x), x, x**S(3)/S(3) + log(x**S(2) + S(6)*x + S(10))/S(2) - S(3)*atan(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) - S(3)*x**S(3) - S(7)*x**S(2) + S(27)*x + S(-18)), x), x, log(-x + S(1))/S(8) - log(-x + S(2))/S(5) + log(-x + S(3))/S(12) - log(x + S(3))/S(120), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x + S(-2)), x), x, x**S(3)/S(3) + x**S(2) + S(4)*x + S(9)*log(-x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(3) - S(4)*x**S(2) + S(3)*x)/(x**S(2) + S(1)), x), x, S(3)*x**S(2)/S(2) - S(4)*x + S(4)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x + S(5))/(x**S(3) - x**S(2) - x + S(1)), x), x, atanh(x) + S(4)/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - x**S(3) - x + S(-1))/(x**S(3) - x**S(2)), x), x, x**S(2)/S(2) + S(2)*log(x) - S(2)*log(-x + S(1)) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + x + S(2))/(x**S(4) + S(3)*x**S(2) + S(2)), x), x, log(x**S(2) + S(2))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) - x**S(4) + S(4)*x**S(3) - S(4)*x**S(2) + S(8)*x + S(-4))/(x**S(2) + S(2))**S(3), x), x, log(x**S(2) + S(2))/S(2) - sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(2) - S(1)/(x**S(2) + S(2))**S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(5) - x**S(4) + S(4)*x**S(3) - S(4)*x**S(2) + S(8)*x + S(-4))/(x**S(2) + S(2))**S(3), x), x, x**S(2)/(S(4)*(x**S(2) + S(2))) + x**S(2)/(S(2)*(x**S(2) + S(2))**S(2)) + log(x**S(2) + S(2))/S(2) - sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(3)*x + S(-1))/(x**S(3) + x**S(2) - S(2)*x), x), x, log(x)/S(2) - log(-x + S(1)) + S(3)*log(x + S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - S(2)*x**S(3) + S(3)*x**S(2) - x + S(3))/(x**S(3) - S(2)*x**S(2) + S(3)*x), x), x, x**S(2)/S(2) + log(x) - log(x**S(2) - S(2)*x + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x + S(-1))/(x**S(2) + S(1))**S(2), x), x, -x/(S(2)*(x**S(2) + S(1))) + log(x**S(2) + S(1))/S(2) - atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(8)*x**S(3) - x**S(2) + S(2)*x + S(1))/((x**S(2) + x)*(x**S(3) + S(1))), x), x, log(x) - S(2)*log(x + S(1)) + log(x**S(2) - x + S(1)) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3) - S(3)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) - S(5)*x + S(15))/((x**S(2) + S(5))*(x**S(2) + S(2)*x + S(3))), x), x, log(x**S(2) + S(2)*x + S(3))/S(2) + S(5)*sqrt(S(2))*atan(sqrt(S(2))*(x + S(1))/S(2))/S(2) - sqrt(S(5))*atan(sqrt(S(5))*x/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(6) + S(7)*x**S(5) + S(15)*x**S(4) + S(32)*x**S(3) + S(23)*x**S(2) + S(25)*x + S(-3))/((x**S(2) + S(1))**S(2)*(x**S(2) + x + S(2))**S(2)), x), x, log(x**S(2) + S(1)) - log(x**S(2) + x + S(2)) + S(1)/(x**S(2) + x + S(2)) - S(3)/(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(2) + S(1))*(x**S(2) + S(4))), x), x, -atan(x/S(2))/S(6) + atan(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(3))/(x**S(2) + S(1)), x), x, a*atan(x) + b*x**S(2)/S(2) - b*log(x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x)/((x + S(4))*(x**S(2) + S(-4))), x), x, log(x + S(4)) - atanh(x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(4))/((x**S(2) + S(1))*(x**S(2) + S(2))), x), x, S(3)*atan(x) - sqrt(S(2))*atan(sqrt(S(2))*x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(3)*x**S(2) - S(4)*x + S(5))/((x + S(-1))**S(2)*(x**S(2) + S(1))), x), x, x + log(-x + S(1))/S(2) + S(3)*log(x**S(2) + S(1))/S(4) + S(2)*atan(x) + S(5)/(S(2)*(-x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(1))/(x**S(2) + S(2)), x), x, x**S(3)/S(3) - S(2)*x + S(5)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(2)*x + S(2))/(x**S(5) + x**S(4)), x), x, log(x + S(1)) - S(2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) - S(5)*x + S(-1))/(x**S(3) - S(2)*x**S(2) - x + S(2)), x), x, S(2)*log(-x + S(1)) - log(-x + S(2)) + log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x + S(2))/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, x/(x**S(2) + S(1)) + log(x**S(2) + S(1))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(2)*x + S(1))/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, log(x**S(2) + S(1))/S(2) + atan(x) - S(1)/(S(2)*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(2)*x + S(1))/(x**S(4) + S(2)*x**S(2) + S(1)), x), x, x**S(2)/(S(2)*(x**S(2) + S(1))) + log(x**S(2) + S(1))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x + S(3))/((x**S(2) + S(1))*(x**S(2) + S(2))), x), x, S(2)*log(x**S(2) + S(1)) - S(2)*log(x**S(2) + S(2)) + S(3)*atan(x) - S(3)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))/((x**S(2) + S(1))*(x**S(2) + S(4))), x), x, log(x**S(2) + S(1))/S(6) - log(x**S(2) + S(4))/S(6) - atan(x/S(2))/S(3) + S(2)*atan(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - x + S(2))/(x**S(2) - S(6)*x + S(-7)), x), x, x**S(2)/S(2) + S(6)*x + S(169)*log(-x + S(7))/S(4) - log(x + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + S(-1))/(x**S(2) + S(-1)), x), x, x**S(4)/S(4) + x**S(2)/S(2) + log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - x**S(2) + S(2)*x + S(5))/(x**S(2) + x + S(1)), x), x, x**S(2)/S(2) - S(2)*x + S(3)*log(x**S(2) + x + S(1))/S(2) + S(11)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - S(2)*x**S(3) + x + S(-3))/(S(2)*x**S(2) - S(8)*x + S(10)), x), x, x**S(3)/S(6) + x**S(2)/S(2) + S(3)*x/S(2) + S(3)*log(x**S(2) - S(4)*x + S(5))/S(4) - S(6)*atan(x + S(-2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(3)*x**S(2) + S(2)*x + S(1))/((x + S(-3))*(x + S(-2))*(x + S(-1))), x), x, x + S(7)*log(-x + S(1))/S(2) - S(25)*log(-x + S(2)) + S(61)*log(-x + S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - x**S(3) + x**S(2) - S(7)*x + S(2))/(x**S(3) + x**S(2) - S(14)*x + S(-24)), x), x, x**S(2)/S(2) - S(2)*x + S(13)*log(-x + S(4))/S(3) - S(22)*log(x + S(2))/S(3) + S(20)*log(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2))/(x*(x + S(-1))**S(2)*(x + S(1))), x), x, S(2)*log(x) - S(5)*log(-x + S(1))/S(4) - S(3)*log(x + S(1))/S(4) + S(3)/(S(2)*(-x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(3))/(x**S(2) + S(2))**S(2), x), x, (x/S(4) + S(1))/(x**S(2) + S(2)) + log(x**S(2) + S(2))/S(2) + S(5)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(8), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(3))/(x**S(2) + S(2))**S(2), x), x, x*(-x/S(2) + S(1)/4)/(x**S(2) + S(2)) + log(x**S(2) + S(2))/S(2) + S(5)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) - S(4)*x**S(2) + S(70)*x + S(-35))/((x**S(2) - S(10)*x + S(26))*(x**S(2) - S(2)*x + S(17))), x), x, S(1003)*log(x**S(2) - S(10)*x + S(26))/S(1025) + S(22)*log(x**S(2) - S(2)*x + S(17))/S(1025) - S(4607)*atan(x/S(4) + S(-1)/4)/S(4100) + S(15033)*atan(x + S(-5))/S(1025), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2))/((x + S(-5))*(x + S(-3))*(x + S(4))), x), x, -S(11)*log(-x + S(3))/S(14) + S(3)*log(-x + S(5))/S(2) + S(2)*log(x + S(4))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((x + S(-1))*(x**S(2) + S(2))), x), x, x**S(2)/S(2) + x + log(-x + S(1))/S(3) - S(2)*log(x**S(2) + S(2))/S(3) - S(2)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) + S(7)*x + S(-1))/(x**S(3) + x**S(2) - x + S(-1)), x), x, S(2)*log(-x + S(1)) - S(3)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(1))/(x**S(3) - S(3)*x**S(2) + S(3)*x + S(-1)), x), x, -(S(2)*x + S(1))**S(2)/(S(6)*(-x + S(1))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(7)*x**S(2) - S(5)*x + S(5))/((x + S(-1))**S(2)*(x + S(1))**S(3)), x), x, -S(2)/(x + S(1))**S(2) + S(1)/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + S(3)*x + S(1))/(x**S(3) + S(2)*x**S(2) + S(2)*x + S(1)), x), x, log(x + S(1)) + log(x**S(2) + x + S(1)) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2)*x + S(-1))/(S(2)*x**S(3) + S(3)*x**S(2) - S(2)*x), x), x, log(x)/S(2) + log(-S(2)*x + S(1))/S(10) - log(x + S(2))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - S(2)*x**S(2) + S(4)*x + S(1))/(x**S(3) - x**S(2) - x + S(1)), x), x, x**S(2)/S(2) + x - S(2)*atanh(x) + S(2)/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(2) - x + S(4))/(x**S(3) + S(4)*x), x), x, log(x) + log(x**S(2) + S(4))/S(2) - atan(x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(1))/(x*(x + S(-1))*(x**S(2) + S(1))**S(3)*(x**S(2) + x + S(1))), x), x, S(3)*x/(S(16)*(x**S(2) + S(1))) - (-S(3)*x/S(8) + S(3)/8)/(x**S(2) + S(1)) + (x/S(8) + S(1)/8)/(x**S(2) + S(1))**S(2) - log(x) + log(-x + S(1))/S(8) + S(15)*log(x**S(2) + S(1))/S(16) - log(x**S(2) + x + S(1))/S(2) + S(7)*atan(x)/S(16) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(2) + S(1))**S(2), x), x, (-x/S(2) + S(1))/(x**S(2) + S(1)) - log(x**S(2) + S(1))/S(2) + S(3)*atan(x)/S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(2) + S(1))**S(2), x), x, -x*(S(2)*x + S(1))/(S(2)*(x**S(2) + S(1))) - log(x**S(2) + S(1))/S(2) + S(3)*atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x*(x**S(2) + S(1))**S(2)), x), x, (-x + S(-1)/2)/(x**S(2) + S(1)) + log(x) - log(x**S(2) + S(1))/S(2) - S(2)*atan(x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x*(x**S(2) + S(1))**S(2)), x), x, x*(x/S(2) + S(-1))/(x**S(2) + S(1)) + log(x) - log(x**S(2) + S(1))/S(2) - S(2)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + x**S(3) - x**S(2) - x + S(1))/(x**S(3) - x), x), x, x**S(2)/S(2) + x - log(x) + log(-x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(4)*x**S(2) + S(2))/((x**S(2) + S(1))*(x**S(2) + S(2))), x), x, -log(x**S(2) + S(1))/S(2) + log(x**S(2) + S(2)) + S(6)*atan(x) - S(5)*sqrt(S(2))*atan(sqrt(S(2))*x/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + x**S(2) + S(1))/((x**S(2) + S(1))*(x**S(2) + S(4))**S(2)), x), x, -S(13)*x/(S(24)*(x**S(2) + S(4))) + S(25)*atan(x/S(2))/S(144) + atan(x)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(1))/(x**S(4) + x**S(3) + S(2)*x**S(2)), x), x, -log(x)/S(4) + S(5)*log(x**S(2) + x + S(2))/S(8) + sqrt(S(7))*atan(sqrt(S(7))*(S(2)*x + S(1))/S(7))/S(28) - S(1)/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) - S(12)*x + S(1))/(x**S(2) + x + S(-12)), x), x, x**S(2)/S(2) - S(2)*atanh(S(2)*x/S(7) + S(1)/7)/S(7), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(3) + x**S(2) - S(12)*x + S(1))/(x**S(2) + x + S(-12)), x), x, x**S(2)/S(2) + log(-x + S(3))/S(7) - log(x + S(4))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(6)*x**S(2) + S(5)*x + S(-3))/(x**S(3) + S(2)*x**S(2) - S(3)*x), x), x, log(x) + S(2)*log(-x + S(1)) + S(3)*log(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(2) + S(3)*x + S(-2))/(x**S(3) + S(2)*x**S(2)), x), x, S(2)*log(x) + S(3)*log(x + S(2)) + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(4)*x**S(2) - S(2)*x + S(18))/(x**S(3) + S(4)*x**S(2) + x + S(-6)), x), x, log(-x + S(1)) - S(2)*log(x + S(2)) - S(3)*log(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(2)*x**S(2) + x + S(1))/(x**S(4) + S(5)*x**S(2) + S(4)), x), x, log(x**S(2) + S(4))/S(2) - S(3)*atan(x/S(2))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(3) - S(27)*x**S(2) + S(5)*x + S(-32))/(S(30)*x**S(5) - S(13)*x**S(4) + S(50)*x**S(3) - S(286)*x**S(2) - S(299)*x + S(-70)), x), x, -S(3146)*log(-S(3)*x + S(7))/S(80155) - S(334)*log(S(2)*x + S(1))/S(323) + S(4822)*log(S(5)*x + S(2))/S(4879) + S(11049)*log(x**S(2) + x + S(5))/S(260015) + S(3988)*sqrt(S(19))*atan(sqrt(S(19))*(S(2)*x + S(1))/S(19))/S(260015), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(12)*x**S(5) - S(7)*x**S(3) - S(13)*x**S(2) + S(8))/(S(100)*x**S(6) - S(80)*x**S(5) + S(116)*x**S(4) - S(80)*x**S(3) + S(41)*x**S(2) - S(20)*x + S(4)), x), x, (-S(251)*x/S(726) + S(-313)/1452)/(S(2)*x**S(2) + S(1)) - S(59096)*log(-S(5)*x + S(2))/S(99825) + S(2843)*log(S(2)*x**S(2) + S(1))/S(7986) + S(503)*sqrt(S(2))*atan(sqrt(S(2))*x)/S(15972) + S(5828)/(S(9075)*(-S(5)*x + S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(12)*x**S(5) - S(7)*x**S(3) - S(13)*x**S(2) + S(8))/(S(100)*x**S(6) - S(80)*x**S(5) + S(116)*x**S(4) - S(80)*x**S(3) + S(41)*x**S(2) - S(20)*x + S(4)), x), x, (-S(251)*x/S(726) + S(-313)/1452)/(S(2)*x**S(2) + S(1)) - S(59096)*log(-S(5)*x + S(2))/S(99825) + S(2843)*log(S(2)*x**S(2) + S(1))/S(7986) + S(503)*sqrt(S(2))*atan(sqrt(S(2))*x)/S(15972) + S(5828)/(S(9075)*(-S(5)*x + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(9))/(x**S(2)*(x**S(2) + S(9))), x), x, x - S(10)*atan(x/S(3))/S(3) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(2)*x)/(x**S(2) + S(1)), x), x, x**S(3)/S(3) - x + log(x**S(2) + S(1)) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - x)/((x + S(-1))**S(2)*(x**S(2) + S(1))), x), x, log(-x + S(1)) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + S(5)*x + S(2))/(x**S(2) + x + S(1)), x), x, x**S(2) + x + log(x**S(2) + x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(3) - S(5)*x**S(2) - S(4)*x + S(3))/(x**S(3)*(x**S(2) + x + S(-1))), x), x, S(3)*log(x) - (sqrt(S(5)) + S(15))*log(S(2)*x + S(1) + sqrt(S(5)))/S(10) - (-sqrt(S(5)) + S(15))*log(S(2)*x - sqrt(S(5)) + S(1))/S(10) - S(1)/x + S(3)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(5)*x**S(2) + S(8)*x + S(4))/(x**S(2) + S(2)*x + S(2))**S(2), x), x, log(x**S(2) + S(2)*x + S(2)) - atan(x + S(1)) - S(1)/(x**S(2) + S(2)*x + S(2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(2)*x**S(3) + S(5)*x**S(2) + S(8)*x + S(4))/(x**S(2) + S(2)*x + S(2))**S(2), x), x, x*(x + S(2))/(S(2)*(x**S(2) + S(2)*x + S(2))) + log(x**S(2) + S(2)*x + S(2)) - atan(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(x + S(-1))**S(4)/(x**S(2) + S(1)), x), x, x**S(7)/S(7) - S(2)*x**S(6)/S(3) + x**S(5) - S(4)*x**S(3)/S(3) + S(4)*x - S(4)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(2) - S(20)*x)/(x**S(4) - S(10)*x**S(2) + S(9)), x), x, log(-x + S(1)) - log(-x + S(3))/S(2) + S(3)*log(x + S(1))/S(2) - S(2)*log(x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(3) + x + S(-1))/(x**S(2)*(x + S(-1))*(x**S(2) + S(1))), x), x, S(2)*log(-x + S(1)) - log(x**S(2) + S(1)) + atan(x) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - S(4)*x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(2) + S(1))**S(3), x), x, atan(x) - (S(4)*x**S(2) + S(3))**S(2)/(S(4)*(x**S(2) + S(1))**S(2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(4) - S(4)*x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(2) + S(1))**S(3), x), x, x**S(2)/(S(4)*(x**S(2) + S(1))**S(2)) + atan(x) + S(7)/(S(4)*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - S(4)*x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(6) + S(3)*x**S(4) + S(3)*x**S(2) + S(1)), x), x, atan(x) + S(2)/(x**S(2) + S(1)) - S(1)/(S(4)*(x**S(2) + S(1))**S(2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(4) - S(4)*x**S(3) + S(2)*x**S(2) - S(3)*x + S(1))/(x**S(6) + S(3)*x**S(4) + S(3)*x**S(2) + S(1)), x), x, x**S(2)/(S(4)*(x**S(2) + S(1))**S(2)) + atan(x) + S(7)/(S(4)*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(2)*x**S(2) + x + S(1))/(x**S(4) + x**S(3) + x**S(2)), x), x, log(x**S(2) + x + S(1)) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(2) - S(4)*x + S(4))*(x**S(2) - S(4)*x + S(5))), x), x, -atan(x + S(-2)) + S(1)/(-x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x + S(-3))/(x**S(2)*(x + S(-3))), x), x, log(-x + S(3)) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(2) + x + S(1))/(S(4)*x**S(3) + x), x), x, log(x) + atan(S(2)*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) - x + S(1))/(x**S(3) - x**S(2)), x), x, S(3)*log(-x + S(1)) + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(3)*x + S(4))/(x**S(2) + x), x), x, x + S(4)*log(x) - S(2)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + x + S(4))/(x**S(3) + x), x), x, S(4)*log(x) - log(x**S(2) + S(1))/S(2) + atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(2) - S(4)*x + S(7))/((S(4)*x + S(1))*(x**S(2) + S(1))), x), x, S(2)*log(S(4)*x + S(1)) - atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((x + S(-1))*(x**S(2) + S(2)*x + S(1))), x), x, log(-x + S(1))/S(4) + S(3)*log(x + S(1))/S(4) + S(1)/(S(2)*(x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(3)*x + S(-4))/((S(2)*x + S(-1))**S(2)*(S(2)*x + S(3))), x), x, S(41)*log(-S(2)*x + S(1))/S(128) - S(25)*log(S(2)*x + S(3))/S(128) - S(9)/(S(32)*(-S(2)*x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) - S(4)*x + S(5))/((x + S(-1))*(x**S(2) + S(1))), x), x, S(2)*log(-x + S(1)) + log(x**S(2) + S(1))/S(2) - S(3)*atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) - S(2)*x + S(-1))/((x + S(-1))**S(2)*(x**S(2) + S(1))), x), x, log(-x + S(1)) - log(x**S(2) + S(1))/S(2) + atan(x) + S(1)/(x + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(5))/((x**S(2) - S(6)*x + S(10))*(x**S(2) - x + S(1)/2)), x), x, S(56)*log(x**S(2) - S(6)*x + S(10))/S(221) + S(109)*log(S(2)*x**S(2) - S(2)*x + S(1))/S(442) + S(1026)*atan(x + S(-3))/S(221) + S(261)*atan(S(2)*x + S(-1))/S(221), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(3)*x + S(4))/((x + S(-3))*(x + S(-2))*(x + S(-1))), x), x, S(4)*log(-x + S(1)) - S(14)*log(-x + S(2)) + S(11)*log(-x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(16)*x + S(1))/((x + S(5))**S(2)*(S(2)*x + S(-3))*(x**S(2) + x + S(1))), x), x, S(200)*log(-S(2)*x + S(3))/S(3211) + S(2731)*log(x + S(5))/S(24843) - S(481)*log(x**S(2) + x + S(1))/S(5586) + S(451)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(8379) - S(79)/(S(273)*(x + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(-1))/(x**S(2) + x + S(1)), x), x, x**S(2)/S(2) - x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(-3))/(x**S(2) - S(6)*x + S(-7)), x), x, x**S(2)/S(2) + S(6)*x + S(85)*log(-x + S(7))/S(2) + log(x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x**S(2) + S(4)*x + S(13))**S(2), x), x, (S(47)*x/S(18) + S(67)/18)/(x**S(2) + S(4)*x + S(13)) + log(x**S(2) + S(4)*x + S(13))/S(2) - S(61)*atan(x/S(3) + S(2)/3)/S(54), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(5) - S(10)*x**S(4) + S(21)*x**S(3) - S(42)*x**S(2) + S(36)*x + S(-32))/(x*(x**S(2) + S(1))*(x**S(2) + S(4))**S(2)), x), x, -S(2)*log(x) + log(x**S(2) + S(4)) + atan(x/S(2))/S(2) + S(2)*atan(x) + S(1)/(x**S(2) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(9) + S(7)*x**S(5) + x**S(4) + S(-1))/(x**S(8) + S(6)*x**S(4) + S(-7)), x), x, x**S(2)/S(2) - sqrt(S(2))*S(7)**(S(1)/4)*log(x**S(2) - sqrt(S(2))*S(7)**(S(1)/4)*x + sqrt(S(7)))/S(56) + sqrt(S(2))*S(7)**(S(1)/4)*log(x**S(2) + sqrt(S(2))*S(7)**(S(1)/4)*x + sqrt(S(7)))/S(56) + sqrt(S(2))*S(7)**(S(1)/4)*atan(sqrt(S(2))*S(7)**(S(3)/4)*x/S(7) + S(-1))/S(28) + sqrt(S(2))*S(7)**(S(1)/4)*atan(sqrt(S(2))*S(7)**(S(3)/4)*x/S(7) + S(1))/S(28) - atanh(x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(6) + x**S(3) + S(1))/(x**S(5) + x), x), x, x**S(2)/S(2) + log(x) - log(x**S(4) + S(1))/S(4) + sqrt(S(2))*log(x**S(2) - sqrt(S(2))*x + S(1))/S(8) - sqrt(S(2))*log(x**S(2) + sqrt(S(2))*x + S(1))/S(8) - atan(x**S(2))/S(2) + sqrt(S(2))*atan(sqrt(S(2))*x + S(-1))/S(4) + sqrt(S(2))*atan(sqrt(S(2))*x + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(2) - x), x), x, x - log(x) + S(2)*log(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x**S(3) - x), x), x, x - log(x) + log(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(1))/(x**S(3) - x**S(2)), x), x, x - log(x) + S(2)*log(-x + S(1)) + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + S(-1))/(x**S(3) - x), x), x, x**S(3)/S(3) + x + log(x) - log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(1))/(x**S(5) + x**S(3)), x), x, -log(x) + log(x**S(2) + S(1)) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(3) + S(2)*x**S(2) + x), x), x, log(x) + S(2)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + S(1))/(x**S(3) - S(3)*x**S(2) - S(10)*x), x), x, x**S(3)/S(3) + S(3)*x**S(2)/S(2) + S(19)*x - log(x)/S(10) + S(3126)*log(-x + S(5))/S(35) - S(31)*log(x + S(2))/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) - S(5)*x + S(15))/((x**S(2) + S(5))*(x**S(2) + S(2)*x + S(3))), x), x, log(x**S(2) + S(2)*x + S(3))/S(2) + S(5)*sqrt(S(2))*atan(sqrt(S(2))*(x + S(1))/S(2))/S(2) - sqrt(S(5))*atan(sqrt(S(5))*x/S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(2) + S(1))*(S(10)*x/(x**S(2) + S(1)) + S(3))), x), x, -log(x + S(3))/S(8) + log(S(3)*x + S(1))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(S(15)*x + S(13) + S(2)/x), x), x, x**S(3)/S(45) - S(13)*x**S(2)/S(450) + S(139)*x/S(3375) - S(16)*log(S(3)*x + S(2))/S(567) + log(S(5)*x + S(1))/S(4375), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(S(15)*x + S(13) + S(2)/x), x), x, x**S(2)/S(30) - S(13)*x/S(225) + S(8)*log(S(3)*x + S(2))/S(189) - log(S(5)*x + S(1))/S(875), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(S(15)*x + S(13) + S(2)/x), x), x, x/S(15) - S(4)*log(S(3)*x + S(2))/S(63) + log(S(5)*x + S(1))/S(175), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(15)*x + S(13) + S(2)/x), x), x, S(2)*log(S(3)*x + S(2))/S(21) - log(S(5)*x + S(1))/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(S(15)*x + S(13) + S(2)/x)), x), x, -log(S(3)*x + S(2))/S(7) + log(S(5)*x + S(1))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(S(15)*x + S(13) + S(2)/x)), x), x, log(x)/S(2) + S(3)*log(S(3)*x + S(2))/S(14) - S(5)*log(S(5)*x + S(1))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(S(15)*x + S(13) + S(2)/x)), x), x, -S(13)*log(x)/S(4) - S(9)*log(S(3)*x + S(2))/S(28) + S(25)*log(S(5)*x + S(1))/S(7) - S(1)/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(S(15)*x + S(13) + S(2)/x)), x), x, S(139)*log(x)/S(8) + S(27)*log(S(3)*x + S(2))/S(56) - S(125)*log(S(5)*x + S(1))/S(7) + S(13)/(S(4)*x) - S(1)/(S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(5)*(S(15)*x + S(13) + S(2)/x)), x), x, -S(1417)*log(x)/S(16) - S(81)*log(S(3)*x + S(2))/S(112) + S(625)*log(S(5)*x + S(1))/S(7) - S(139)/(S(8)*x) + S(13)/(S(8)*x**S(2)) - S(1)/(S(6)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(a + b*(-x**S(2) + S(1))**S(4)), x), x, -atanh(b**(S(1)/8)*x/sqrt(b**(S(1)/4) + I*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(b**(S(1)/4) + I*(-a)**(S(1)/4))) + atanh(b**(S(1)/8)*x/sqrt(b**(S(1)/4) + (-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(b**(S(1)/4) + (-a)**(S(1)/4))) + atan(b**(S(1)/8)*x/sqrt(-b**(S(1)/4) + I*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(-b**(S(1)/4) + I*(-a)**(S(1)/4))) - atan(b**(S(1)/8)*x/sqrt(-b**(S(1)/4) + (-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(-b**(S(1)/4) + (-a)**(S(1)/4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/(a + b*(x**S(2) + S(-1))**S(4)), x), x, -atanh(b**(S(1)/8)*x/sqrt(b**(S(1)/4) + I*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(b**(S(1)/4) + I*(-a)**(S(1)/4))) + atanh(b**(S(1)/8)*x/sqrt(b**(S(1)/4) + (-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(b**(S(1)/4) + (-a)**(S(1)/4))) + atan(b**(S(1)/8)*x/sqrt(-b**(S(1)/4) + I*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(-b**(S(1)/4) + I*(-a)**(S(1)/4))) - atan(b**(S(1)/8)*x/sqrt(-b**(S(1)/4) + (-a)**(S(1)/4)))/(S(4)*b**(S(3)/8)*sqrt(-a)*sqrt(-b**(S(1)/4) + (-a)**(S(1)/4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(5) + S(-1))/(x**S(5) + x + S(1))**S(2), x), x, -x/(x**S(5) + x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-a*d - S(2)*a*e*x - S(3)*a*f*x**S(2) + b*c - b*e*x**S(2) - S(2)*b*f*x**S(3))/(c + d*x + e*x**S(2) + f*x**S(3))**S(2), x), x, a/(c + d*x + e*x**S(2) + f*x**S(3)) + b*x/(c + d*x + e*x**S(2) + f*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(39)*x**S(8) + S(26)*x**S(6) + S(24)*x**S(5) + S(174)*x**S(4) - S(18)*x**S(2) - S(40)*x + S(9))/(x**S(4) + S(2)*x**S(2) + S(3))**S(3), x), x, S(13)*x/(x**S(4) + S(2)*x**S(2) + S(3)) + (-S(26)*x**S(3) - S(4)*x**S(2) - S(36)*x + S(2))/(x**S(4) + S(2)*x**S(2) + S(3))**S(2), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-S(39)*x**S(8) + S(26)*x**S(6) + S(24)*x**S(5) + S(174)*x**S(4) - S(18)*x**S(2) - S(40)*x + S(9))/(x**S(4) + S(2)*x**S(2) + S(3))**S(3), x), x, x*(-S(2)*x**S(3) - S(4)*x + S(117))/(S(9)*(x**S(4) + S(2)*x**S(2) + S(3))) - S(2)*x*(x**S(3) + S(39)*x**S(2) + S(8)*x + S(54))/(S(3)*(x**S(4) + S(2)*x**S(2) + S(3))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(30)*x**S(9) - S(8)*x**S(7) - S(15)*x**S(6) - S(140)*x**S(5) + S(34)*x**S(4) - S(12)*x**S(3) - S(5)*x**S(2) + S(36)*x + S(-15))/(x**S(4) + x + S(3))**S(4), x), x, -S(5)*x**S(6)/(x**S(4) + x + S(3))**S(3) + x**S(4)/(x**S(4) + x + S(3))**S(3) + S(5)*x**S(2)/(x**S(4) + x + S(3))**S(3) - S(3)*x/(x**S(4) + x + S(3))**S(3) + S(2)/(x**S(4) + x + S(3))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(30)*x/(x**S(4) + x + S(3))**S(2) + (-S(8)*x**S(3) - S(75)*x**S(2) - S(320)*x + S(42))/(x**S(4) + x + S(3))**S(3) + (S(57)*x**S(3) + S(360)*x**S(2) + S(684)*x + S(-141))/(x**S(4) + x + S(3))**S(4), x), x, (-S(5)*x**S(6) + x**S(4) + S(5)*x**S(2) - S(3)*x + S(2))/(x**S(4) + x + S(3))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-(S(12)*x**S(3) + S(3))*(-S(5)*x**S(6) + x**S(4) + S(5)*x**S(2) - S(3)*x + S(2))/(x**S(4) + x + S(3))**S(4) + (-S(30)*x**S(5) + S(4)*x**S(3) + S(10)*x + S(-3))/(x**S(4) + x + S(3))**S(3), x), x, (-S(5)*x**S(6) + x**S(4) + S(5)*x**S(2) - S(3)*x + S(2))/(x**S(4) + x + S(3))**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-1))/(x**S(2) - x + S(1)), x), x, log(x**S(2) - x + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/(x**S(3) + S(1)), x), x, log(x**S(2) - x + S(1))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x + S(-4))/(x**S(2) - S(2)*x + S(4)), x), x, S(3)*log(x**S(2) - S(2)*x + S(4))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + S(2)*x + S(-8))/(x**S(3) + S(8)), x), x, S(3)*log(x**S(2) - S(2)*x + S(4))/S(2) + sqrt(S(3))*atan(sqrt(S(3))*(-x + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x + S(4))/(x**S(2)*(x**S(2) + S(1))), x), x, S(4)*log(x) - S(2)*log(x**S(2) + S(1)) - S(4)*atan(x) - S(4)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x + S(24))/(x*(x**S(2) + S(-4))), x), x, -S(6)*log(x) + S(5)*log(-x + S(2)) + log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/(x**S(3) - S(2)*x), x), x, log(x)/S(2) + log(-x**S(2) + S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x**S(3) + S(3)*x), x), x, log(x)/S(3) + log(x**S(2) + S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + S(3)*b*x**S(2))/(a*x + b*x**S(3)), x), x, log(x) + log(a + b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x + S(-2))/(x**S(3) - x), x), x, S(2)*log(x) + log(-x + S(1)) - S(3)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(4))/(x**S(3) + S(4)*x), x), x, log(x) - log(x**S(2) + S(4))/S(2) + atan(x/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) - x)/(x**S(4) - x**S(2) + S(1)), x), x, log(x**S(4) - x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-3))/(x**S(3) + S(3)*x**S(2) + S(2)*x), x), x, -S(3)*log(x)/S(2) + S(4)*log(x + S(1)) - S(5)*log(x + S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x + S(2))/(x**S(4) + S(2)*x**S(3) + x**S(2)), x), x, -S(2)/(x*(x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))/(x**S(3) + x**S(2) - S(6)*x), x), x, -log(x)/S(6) + S(3)*log(-x + S(2))/S(10) - S(2)*log(x + S(3))/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(4)*x**S(2))/(x**S(3) + x), x), x, x + S(2)*log(x**S(2) + S(1)) - atan(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + x)/(x**S(4) + x**S(2))**S(3), x), x, -S(1)/(S(4)*x**S(4)*(x**S(2) + S(1))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(2) + b*x**S(3))/(c*x**S(2) + d*x**S(3)), x), x, b*x/d - (-a*d + b*c)*log(c + d*x)/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x)/(x**S(3) - x**S(2) - S(2)*x), x), x, log(-x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(5)*x**S(2) + S(1))/(x**S(3)*(x**S(2) + S(1))), x), x, -S(6)*log(x) + S(3)*log(x**S(2) + S(1)) - S(1)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)*x/((x + S(-1))*(x**S(2) + S(5))), x), x, log(-x + S(1))/S(3) - log(x**S(2) + S(5))/S(6) + sqrt(S(5))*atan(sqrt(S(5))*x/S(5))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2))/(x + S(2)), x), x, x**S(2)/S(2) - S(2)*x + S(6)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(-3))*(x**S(2) + S(4))), x), x, log(-x + S(3))/S(13) - log(x**S(2) + S(4))/S(26) - S(3)*atan(x/S(2))/S(26), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(6) + S(-2))/(x*(S(2)*x**S(6) + S(5))), x), x, -S(2)*log(x)/S(5) + S(19)*log(S(2)*x**S(6) + S(5))/S(60), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(3))/((x + S(-2))*(x + S(5))), x), x, log(-x + S(2)) + log(x + S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(x**S(4) + S(5)*x**S(2) + S(4)), x), x, x - S(8)*atan(x/S(2))/S(3) + atan(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))*(x + S(2))**S(2)*(x + S(3))**S(3)), x), x, log(x + S(1))/S(8) + S(2)*log(x + S(2)) - S(17)*log(x + S(3))/S(8) + S(5)/(S(4)*(x + S(3))) + S(1)/(S(4)*(x + S(3))**S(2)) + S(1)/(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(2) + S(-1)), x), x, log(-x**S(2) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))**(S(-2)), x), x, x/(S(2)*(-x**S(2) + S(1))) + atanh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(2) + S(1))**S(2), x), x, -x/(S(2)*(x**S(2) + S(1))) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(3)*x + S(2)), x), x, log(S(3)*x + S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a**S(2) + x**S(2)), x), x, atan(x/a)/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x**S(2)), x), x, atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2) - x + S(2)), x), x, -S(2)*sqrt(S(7))*atan(sqrt(S(7))*(-S(2)*x + S(1))/S(7))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(-x**S(2) + S(4))**S(2), x), x, x**S(7)/S(7) - S(8)*x**S(5)/S(5) + S(16)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(-x**S(3) + S(1))**S(2), x), x, x**S(8)/S(8) - S(2)*x**S(5)/S(5) + x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(5)*x**S(2) + S(-4))/x**S(2), x), x, x**S(2)/S(2) + S(5)*x + S(4)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-1))/(S(3)*x**S(2) - S(4)*x + S(3)), x), x, log(S(3)*x**S(2) - S(4)*x + S(3))/S(6) + sqrt(S(5))*atan(sqrt(S(5))*(-S(3)*x + S(2))/S(5))/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(2))**S(2), x), x, x**S(7)/S(7) + x**S(4) + S(4)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-4))/(x + S(2)), x), x, x**S(2)/S(2) - S(2)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(2))*(x**S(2) + S(1))), x), x, log(x + S(2))/S(5) - log(x**S(2) + S(1))/S(10) + S(2)*atan(x)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))*(x**S(2) + S(1))), x), x, log(x + S(1))/S(2) - log(x**S(2) + S(1))/S(4) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(1))*(x**S(2) + S(1))), x), x, -log(x + S(1))/S(2) + log(x**S(2) + S(1))/S(4) + atan(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2)*x)/(x + S(1))**S(2), x), x, (x + S(2))**S(2)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-10))/(S(2)*x**S(4) + S(9)*x**S(2) + S(4)), x), x, atan(x/S(2)) - S(3)*sqrt(S(2))*atan(sqrt(S(2))*x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x + S(31))/(S(3)*x**S(2) - S(4)*x + S(11)), x), x, S(5)*log(S(3)*x**S(2) - S(4)*x + S(11))/S(6) - S(103)*sqrt(S(29))*atan(sqrt(S(29))*(-S(3)*x + S(2))/S(29))/S(87), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**S(2) + S(-2))/x**S(4), x), x, log(x) - S(1)/x + S(2)/(S(3)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x + S(1))/x**S(2), x), x, x**S(2)/S(2) + log(x) - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-2))/(x*(x**S(2) + S(2))), x), x, -log(x) + log(x**S(2) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-3))*(S(4)*x**S(2) + S(-7)), x), x, x**S(4) - S(4)*x**S(3) - S(7)*x**S(2)/S(2) + S(21)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(7)*x + S(-2))**S(3), x), x, (-S(7)*x + S(2))**S(4)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(2) + S(-7))/(S(2)*x + S(3)), x), x, x**S(2) - S(3)*x + log(S(2)*x + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))/(x**S(2)*(x + S(-1))), x), x, -S(2)*log(x) + S(2)*log(-x + S(1)) + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4) + S(4)*x**S(3) + S(4)*x**S(2)), x), x, atanh(x + S(1))/S(2) - S(1)/(S(4)*(x + S(2))) - S(1)/(S(4)*x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(4) + S(4)*x**S(3) + S(4)*x**S(2)), x), x, -log(x)/S(4) + log(x + S(2))/S(4) - S(1)/(S(4)*(x + S(2))) - S(1)/(S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(1))/(x + S(1)), x), x, x**S(2)/S(2) - x + S(2)*log(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(3)*x**S(2) + S(3)*x + S(-1))/x**S(2), x), x, x**S(2)/S(2) - S(3)*x + S(3)*log(x) + S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(3)/2 + sqrt(S(37))/S(2))*(x - sqrt(S(37))/S(2) + S(3)/2), x), x, x**S(3)/S(3) + S(3)*x**S(2)/S(2) - S(7)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(3) + S(3)*x**S(2) + S(4))/(x + S(1))**S(4), x), x, S(2)*log(x + S(1)) + S(3)/(x + S(1)) - S(5)/(S(3)*(x + S(1))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(1))**S(2)*(x**S(2) + S(1))), x), x, atan(x)/S(2) + S(1)/(S(2)*(x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) - x**S(3) + S(3)*x**S(2) - S(2)*x + S(7))/(x + S(2)), x), x, x**S(4)/S(4) - x**S(3) + S(9)*x**S(2)/S(2) - S(20)*x + S(47)*log(x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(-1))/(x + S(-1)), x), x, x**S(3)/S(3) + x**S(2)/S(2) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(2))/((x + S(-1))**S(3)*(x**S(2) + S(1))), x), x, atan(x) + S(1)/(x + S(-1)) - S(1)/(-x + S(1))**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(b*x + c*(d + e*x)**S(2)), x), x, -S(2)*atanh((b + S(2)*c*d*e + S(2)*c*e**S(2)*x)/(sqrt(b)*sqrt(b + S(4)*c*d*e)))/(sqrt(b)*sqrt(b + S(4)*c*d*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*x + c*(d + e*x)**S(2)), x), x, -S(2)*atanh((b + S(2)*c*d*e + S(2)*c*e**S(2)*x)/sqrt(-S(4)*a*c*e**S(2) + b**S(2) + S(4)*b*c*d*e))/sqrt(-S(4)*a*c*e**S(2) + b**S(2) + S(4)*b*c*d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((x**S(2) + S(-1))**S(2) + S(1)), x), x, log(x**S(2) - x*sqrt(S(2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(2) + S(2)*sqrt(S(2)))) - log(x**S(2) + x*sqrt(S(2) + S(2)*sqrt(S(2))) + sqrt(S(2)))/(S(4)*sqrt(S(2) + S(2)*sqrt(S(2)))) - sqrt(S(1)/2 + sqrt(S(2))/S(2))*atan((-S(2)*x + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2))))/S(2) + sqrt(S(1)/2 + sqrt(S(2))/S(2))*atan((S(2)*x + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2))))/S(2), expand=True, _diff=True, _numerical=True) def test_2(): assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x**S(6)*sqrt(-c + d*x)*sqrt(c + d*x)/(S(7)*d**S(2)) + S(8)*c**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(7)*a*d**S(2) + S(6)*b*c**S(2))/(S(105)*d**S(8)) + S(4)*c**S(2)*x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(7)*a*d**S(2) + S(6)*b*c**S(2))/(S(105)*d**S(6)) + x**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(7)*a*d**S(2) + S(6)*b*c**S(2))/(S(35)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x**S(5)*sqrt(-c + d*x)*sqrt(c + d*x)/(S(6)*d**S(2)) + c**S(4)*(S(6)*a*d**S(2) + S(5)*b*c**S(2))*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/(S(8)*d**S(7)) + c**S(2)*x*sqrt(-c + d*x)*sqrt(c + d*x)*(S(6)*a*d**S(2) + S(5)*b*c**S(2))/(S(16)*d**S(6)) + x**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(6)*a*d**S(2) + S(5)*b*c**S(2))/(S(24)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)/(S(5)*d**S(2)) + S(2)*c**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(5)*a*d**S(2) + S(4)*b*c**S(2))/(S(15)*d**S(6)) + x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(5)*a*d**S(2) + S(4)*b*c**S(2))/(S(15)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)/(S(4)*d**S(2)) + c**S(2)*(S(4)*a*d**S(2) + S(3)*b*c**S(2))*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/(S(4)*d**S(5)) + x*sqrt(-c + d*x)*sqrt(c + d*x)*(S(4)*a*d**S(2) + S(3)*b*c**S(2))/(S(8)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)/(S(3)*d**S(2)) + sqrt(-c + d*x)*sqrt(c + d*x)*(S(3)*a*d**S(2) + S(2)*b*c**S(2))/(S(3)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, b*x*sqrt(-c + d*x)*sqrt(c + d*x)/(S(2)*d**S(2)) + (S(2)*a*d**S(2) + b*c**S(2))*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d**S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), x), x, S(2)*a*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d + b*c**S(2)*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d**S(3) + b*x*sqrt(-c + d*x)*sqrt(c + d*x)/(S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/c + b*sqrt(-c + d*x)*sqrt(c + d*x)/d**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*sqrt(-c + d*x)*sqrt(c + d*x)/(c**S(2)*x) + S(2)*b*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*sqrt(-c + d*x)*sqrt(c + d*x)/(S(2)*c**S(2)*x**S(2)) + (a*d**S(2) + S(2)*b*c**S(2))*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/(S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*sqrt(-c + d*x)*sqrt(c + d*x)/(S(3)*c**S(2)*x**S(3)) + sqrt(-c + d*x)*sqrt(c + d*x)*(S(2)*a*d**S(2) + S(3)*b*c**S(2))/(S(3)*c**S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(5)*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*sqrt(-c + d*x)*sqrt(c + d*x)/(S(4)*c**S(2)*x**S(4)) + sqrt(-c + d*x)*sqrt(c + d*x)*(S(3)*a*d**S(2) + S(4)*b*c**S(2))/(S(8)*c**S(4)*x**S(2)) + d**S(2)*(S(3)*a*d**S(2) + S(4)*b*c**S(2))*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/(S(8)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(6)*sqrt(-c + d*x)*sqrt(c + d*x)), x), x, a*sqrt(-c + d*x)*sqrt(c + d*x)/(S(5)*c**S(2)*x**S(5)) + sqrt(-c + d*x)*sqrt(c + d*x)*(S(4)*a*d**S(2) + S(5)*b*c**S(2))/(S(15)*c**S(4)*x**S(3)) + S(2)*d**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(4)*a*d**S(2) + S(5)*b*c**S(2))/(S(15)*c**S(6)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, b*x**S(6)/(S(5)*d**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) + S(8)*c**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(5)*a*d**S(2) + S(6)*b*c**S(2))/(S(15)*d**S(8)) - x**S(4)*(S(5)*a*d**S(2) + S(6)*b*c**S(2))/(S(5)*d**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)) + x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)*(S(20)*a*d**S(2) + S(24)*b*c**S(2))/(S(15)*d**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, b*x**S(5)/(S(4)*d**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) + S(3)*c**S(2)*(S(4)*a*d**S(2) + S(5)*b*c**S(2))*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/(S(4)*d**S(7)) - x**S(3)*(S(4)*a*d**S(2) + S(5)*b*c**S(2))/(S(4)*d**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)) + x*sqrt(-c + d*x)*sqrt(c + d*x)*(S(12)*a*d**S(2) + S(15)*b*c**S(2))/(S(8)*d**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, b*x**S(4)/(S(3)*d**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) - x**S(2)*(S(3)*a*d**S(2) + S(4)*b*c**S(2))/(S(3)*d**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)) + sqrt(-c + d*x)*sqrt(c + d*x)*(S(6)*a*d**S(2) + S(8)*b*c**S(2))/(S(3)*d**S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, b*x**S(3)/(S(2)*d**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) - c*(S(2)*a*d**S(2) + S(3)*b*c**S(2))/(S(2)*d**S(5)*sqrt(-c + d*x)*sqrt(c + d*x)) - sqrt(-c + d*x)*(S(2)*a*d**S(2) + S(3)*b*c**S(2))/(S(2)*d**S(5)*sqrt(c + d*x)) + (S(2)*a*d**S(2) + S(3)*b*c**S(2))*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, -x**S(2)*(a/c**S(2) + b/d**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)) + sqrt(-c + d*x)*sqrt(c + d*x)*(a*d**S(2) + S(2)*b*c**S(2))/(c**S(2)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/((-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, -a*x/(c**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) - b*c/(d**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)) - b*sqrt(-c + d*x)/(d**S(3)*sqrt(c + d*x)) + S(2)*b*atanh(sqrt(-c + d*x)/sqrt(c + d*x))/d**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, -a*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/c**S(3) - (a/c**S(2) + b/d**S(2))/(sqrt(-c + d*x)*sqrt(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(2)*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, a/(c**S(2)*x*sqrt(-c + d*x)*sqrt(c + d*x)) - x*(S(2)*a*d**S(2) + b*c**S(2))/(c**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(3)*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, a/(S(2)*c**S(2)*x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) - (S(3)*a*d**S(2) + S(2)*b*c**S(2))/(S(2)*c**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)) - (S(3)*a*d**S(2) + S(2)*b*c**S(2))*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/(S(2)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(4)*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, a/(S(3)*c**S(2)*x**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)) + (S(4)*a*d**S(2) + S(3)*b*c**S(2))/(S(3)*c**S(4)*x*sqrt(-c + d*x)*sqrt(c + d*x)) - S(2)*d**S(2)*x*(S(4)*a*d**S(2) + S(3)*b*c**S(2))/(S(3)*c**S(6)*sqrt(-c + d*x)*sqrt(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(5)*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, a/(S(4)*c**S(2)*x**S(4)*sqrt(-c + d*x)*sqrt(c + d*x)) + (S(5)*a*d**S(2) + S(4)*b*c**S(2))/(S(8)*c**S(4)*x**S(2)*sqrt(-c + d*x)*sqrt(c + d*x)) - S(3)*d**S(2)*(S(5)*a*d**S(2) + S(4)*b*c**S(2))/(S(8)*c**S(6)*sqrt(-c + d*x)*sqrt(c + d*x)) - S(3)*d**S(2)*(S(5)*a*d**S(2) + S(4)*b*c**S(2))*atan(sqrt(-c + d*x)*sqrt(c + d*x)/c)/(S(8)*c**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))/(x**S(6)*(-c + d*x)**(S(3)/2)*(c + d*x)**(S(3)/2)), x), x, a/(S(5)*c**S(2)*x**S(5)*sqrt(-c + d*x)*sqrt(c + d*x)) + (S(6)*a*d**S(2) + S(5)*b*c**S(2))/(S(15)*c**S(4)*x**S(3)*sqrt(-c + d*x)*sqrt(c + d*x)) + S(4)*d**S(2)*(S(6)*a*d**S(2) + S(5)*b*c**S(2))/(S(15)*c**S(6)*x*sqrt(-c + d*x)*sqrt(c + d*x)) - S(8)*d**S(4)*x*(S(6)*a*d**S(2) + S(5)*b*c**S(2))/(S(15)*c**S(8)*sqrt(-c + d*x)*sqrt(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c**S(2)*x**S(2) + S(1))/(x*sqrt(c*x + S(-1))*sqrt(c*x + S(1))), x), x, sqrt(c*x + S(-1))*sqrt(c*x + S(1)) + atan(sqrt(c*x + S(-1))*sqrt(c*x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n*(c + d*x**S(3)), x), x, S(10)*a**S(2)*d*(a + b*x)**(n + S(4))/(b**S(6)*(n + S(4))) + a**S(2)*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)/(b**S(6)*(n + S(1))) - S(5)*a*d*(a + b*x)**(n + S(5))/(b**S(6)*(n + S(5))) - a*(a + b*x)**(n + S(2))*(-S(5)*a**S(3)*d + S(2)*b**S(3)*c)/(b**S(6)*(n + S(2))) + d*(a + b*x)**(n + S(6))/(b**S(6)*(n + S(6))) + (a + b*x)**(n + S(3))*(-S(10)*a**S(3)*d + b**S(3)*c)/(b**S(6)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n*(c + d*x**S(3)), x), x, S(6)*a**S(2)*d*(a + b*x)**(n + S(3))/(b**S(5)*(n + S(3))) - S(4)*a*d*(a + b*x)**(n + S(4))/(b**S(5)*(n + S(4))) - a*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)/(b**S(5)*(n + S(1))) + d*(a + b*x)**(n + S(5))/(b**S(5)*(n + S(5))) + (a + b*x)**(n + S(2))*(-S(4)*a**S(3)*d + b**S(3)*c)/(b**S(5)*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3)), x), x, S(3)*a**S(2)*d*(a + b*x)**(n + S(2))/(b**S(4)*(n + S(2))) - S(3)*a*d*(a + b*x)**(n + S(3))/(b**S(4)*(n + S(3))) + d*(a + b*x)**(n + S(4))/(b**S(4)*(n + S(4))) + (a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)/(b**S(4)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3))/x, x), x, a**S(2)*d*(a + b*x)**(n + S(1))/(b**S(3)*(n + S(1))) - S(2)*a*d*(a + b*x)**(n + S(2))/(b**S(3)*(n + S(2))) + d*(a + b*x)**(n + S(3))/(b**S(3)*(n + S(3))) - c*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n*(c + d*x**S(3))**S(2), x), x, S(28)*a**S(2)*d**S(2)*(a + b*x)**(n + S(7))/(b**S(9)*(n + S(7))) + S(4)*a**S(2)*d*(a + b*x)**(n + S(4))*(-S(14)*a**S(3)*d + S(5)*b**S(3)*c)/(b**S(9)*(n + S(4))) + a**S(2)*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(9)*(n + S(1))) - S(8)*a*d**S(2)*(a + b*x)**(n + S(8))/(b**S(9)*(n + S(8))) - S(10)*a*d*(a + b*x)**(n + S(5))*(-S(7)*a**S(3)*d + b**S(3)*c)/(b**S(9)*(n + S(5))) - S(2)*a*(a + b*x)**(n + S(2))*(-S(4)*a**S(3)*d + b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)/(b**S(9)*(n + S(2))) + d**S(2)*(a + b*x)**(n + S(9))/(b**S(9)*(n + S(9))) + S(2)*d*(a + b*x)**(n + S(6))*(-S(28)*a**S(3)*d + b**S(3)*c)/(b**S(9)*(n + S(6))) + (a + b*x)**(n + S(3))*(S(28)*a**S(6)*d**S(2) - S(20)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(9)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n*(c + d*x**S(3))**S(2), x), x, S(21)*a**S(2)*d**S(2)*(a + b*x)**(n + S(6))/(b**S(8)*(n + S(6))) + S(3)*a**S(2)*d*(a + b*x)**(n + S(3))*(-S(7)*a**S(3)*d + S(4)*b**S(3)*c)/(b**S(8)*(n + S(3))) - S(7)*a*d**S(2)*(a + b*x)**(n + S(7))/(b**S(8)*(n + S(7))) - a*d*(a + b*x)**(n + S(4))*(-S(35)*a**S(3)*d + S(8)*b**S(3)*c)/(b**S(8)*(n + S(4))) - a*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(8)*(n + S(1))) + d**S(2)*(a + b*x)**(n + S(8))/(b**S(8)*(n + S(8))) + d*(a + b*x)**(n + S(5))*(-S(35)*a**S(3)*d + S(2)*b**S(3)*c)/(b**S(8)*(n + S(5))) + (a + b*x)**(n + S(2))*(-S(7)*a**S(3)*d + b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)/(b**S(8)*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3))**S(2), x), x, S(15)*a**S(2)*d**S(2)*(a + b*x)**(n + S(5))/(b**S(7)*(n + S(5))) + S(6)*a**S(2)*d*(a + b*x)**(n + S(2))*(-a**S(3)*d + b**S(3)*c)/(b**S(7)*(n + S(2))) - S(6)*a*d**S(2)*(a + b*x)**(n + S(6))/(b**S(7)*(n + S(6))) - S(3)*a*d*(a + b*x)**(n + S(3))*(-S(5)*a**S(3)*d + S(2)*b**S(3)*c)/(b**S(7)*(n + S(3))) + d**S(2)*(a + b*x)**(n + S(7))/(b**S(7)*(n + S(7))) + S(2)*d*(a + b*x)**(n + S(4))*(-S(10)*a**S(3)*d + b**S(3)*c)/(b**S(7)*(n + S(4))) + (a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(7)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3))**S(2)/x, x), x, S(10)*a**S(2)*d**S(2)*(a + b*x)**(n + S(4))/(b**S(6)*(n + S(4))) + a**S(2)*d*(a + b*x)**(n + S(1))*(-a**S(3)*d + S(2)*b**S(3)*c)/(b**S(6)*(n + S(1))) - S(5)*a*d**S(2)*(a + b*x)**(n + S(5))/(b**S(6)*(n + S(5))) - a*d*(a + b*x)**(n + S(2))*(-S(5)*a**S(3)*d + S(4)*b**S(3)*c)/(b**S(6)*(n + S(2))) + d**S(2)*(a + b*x)**(n + S(6))/(b**S(6)*(n + S(6))) + S(2)*d*(a + b*x)**(n + S(3))*(-S(5)*a**S(3)*d + b**S(3)*c)/(b**S(6)*(n + S(3))) - c**S(2)*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n*(c + d*x**S(3))**S(3), x), x, S(55)*a**S(2)*d**S(3)*(a + b*x)**(n + S(10))/(b**S(12)*(n + S(10))) + S(42)*a**S(2)*d**S(2)*(a + b*x)**(n + S(7))*(-S(11)*a**S(3)*d + S(2)*b**S(3)*c)/(b**S(12)*(n + S(7))) + S(3)*a**S(2)*d*(a + b*x)**(n + S(4))*(S(55)*a**S(6)*d**S(2) - S(56)*a**S(3)*b**S(3)*c*d + S(10)*b**S(6)*c**S(2))/(b**S(12)*(n + S(4))) + a**S(2)*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(3)/(b**S(12)*(n + S(1))) - S(11)*a*d**S(3)*(a + b*x)**(n + S(11))/(b**S(12)*(n + S(11))) - S(6)*a*d**S(2)*(a + b*x)**(n + S(8))*(-S(55)*a**S(3)*d + S(4)*b**S(3)*c)/(b**S(12)*(n + S(8))) - S(15)*a*d*(a + b*x)**(n + S(5))*(S(22)*a**S(6)*d**S(2) - S(14)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(12)*(n + S(5))) - a*(a + b*x)**(n + S(2))*(-S(11)*a**S(3)*d + S(2)*b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(12)*(n + S(2))) + d**S(3)*(a + b*x)**(n + S(12))/(b**S(12)*(n + S(12))) + S(3)*d**S(2)*(a + b*x)**(n + S(9))*(-S(55)*a**S(3)*d + b**S(3)*c)/(b**S(12)*(n + S(9))) + S(3)*d*(a + b*x)**(n + S(6))*(S(154)*a**S(6)*d**S(2) - S(56)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(12)*(n + S(6))) + (a + b*x)**(n + S(3))*(-a**S(3)*d + b**S(3)*c)*(S(55)*a**S(6)*d**S(2) - S(29)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(12)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n*(c + d*x**S(3))**S(3), x), x, S(45)*a**S(2)*d**S(3)*(a + b*x)**(n + S(9))/(b**S(11)*(n + S(9))) + S(63)*a**S(2)*d**S(2)*(a + b*x)**(n + S(6))*(-S(4)*a**S(3)*d + b**S(3)*c)/(b**S(11)*(n + S(6))) + S(9)*a**S(2)*d*(a + b*x)**(n + S(3))*(-S(5)*a**S(3)*d + S(2)*b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)/(b**S(11)*(n + S(3))) - S(10)*a*d**S(3)*(a + b*x)**(n + S(10))/(b**S(11)*(n + S(10))) - S(21)*a*d**S(2)*(a + b*x)**(n + S(7))*(-S(10)*a**S(3)*d + b**S(3)*c)/(b**S(11)*(n + S(7))) - S(3)*a*d*(a + b*x)**(n + S(4))*(S(40)*a**S(6)*d**S(2) - S(35)*a**S(3)*b**S(3)*c*d + S(4)*b**S(6)*c**S(2))/(b**S(11)*(n + S(4))) - a*(a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(3)/(b**S(11)*(n + S(1))) + d**S(3)*(a + b*x)**(n + S(11))/(b**S(11)*(n + S(11))) + S(3)*d**S(2)*(a + b*x)**(n + S(8))*(-S(40)*a**S(3)*d + b**S(3)*c)/(b**S(11)*(n + S(8))) + S(3)*d*(a + b*x)**(n + S(5))*(S(70)*a**S(6)*d**S(2) - S(35)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(11)*(n + S(5))) + (a + b*x)**(n + S(2))*(-S(10)*a**S(3)*d + b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(11)*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3))**S(3), x), x, S(36)*a**S(2)*d**S(3)*(a + b*x)**(n + S(8))/(b**S(10)*(n + S(8))) + S(9)*a**S(2)*d**S(2)*(a + b*x)**(n + S(5))*(-S(14)*a**S(3)*d + S(5)*b**S(3)*c)/(b**S(10)*(n + S(5))) + S(9)*a**S(2)*d*(a + b*x)**(n + S(2))*(-a**S(3)*d + b**S(3)*c)**S(2)/(b**S(10)*(n + S(2))) - S(9)*a*d**S(3)*(a + b*x)**(n + S(9))/(b**S(10)*(n + S(9))) - S(18)*a*d**S(2)*(a + b*x)**(n + S(6))*(-S(7)*a**S(3)*d + b**S(3)*c)/(b**S(10)*(n + S(6))) - S(9)*a*d*(a + b*x)**(n + S(3))*(-S(4)*a**S(3)*d + b**S(3)*c)*(-a**S(3)*d + b**S(3)*c)/(b**S(10)*(n + S(3))) + d**S(3)*(a + b*x)**(n + S(10))/(b**S(10)*(n + S(10))) + S(3)*d**S(2)*(a + b*x)**(n + S(7))*(-S(28)*a**S(3)*d + b**S(3)*c)/(b**S(10)*(n + S(7))) + S(3)*d*(a + b*x)**(n + S(4))*(S(28)*a**S(6)*d**S(2) - S(20)*a**S(3)*b**S(3)*c*d + b**S(6)*c**S(2))/(b**S(10)*(n + S(4))) + (a + b*x)**(n + S(1))*(-a**S(3)*d + b**S(3)*c)**S(3)/(b**S(10)*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n*(c + d*x**S(3))**S(3)/x, x), x, S(28)*a**S(2)*d**S(3)*(a + b*x)**(n + S(7))/(b**S(9)*(n + S(7))) + S(2)*a**S(2)*d**S(2)*(a + b*x)**(n + S(4))*(-S(28)*a**S(3)*d + S(15)*b**S(3)*c)/(b**S(9)*(n + S(4))) + a**S(2)*d*(a + b*x)**(n + S(1))*(a**S(6)*d**S(2) - S(3)*a**S(3)*b**S(3)*c*d + S(3)*b**S(6)*c**S(2))/(b**S(9)*(n + S(1))) - S(8)*a*d**S(3)*(a + b*x)**(n + S(8))/(b**S(9)*(n + S(8))) - S(5)*a*d**S(2)*(a + b*x)**(n + S(5))*(-S(14)*a**S(3)*d + S(3)*b**S(3)*c)/(b**S(9)*(n + S(5))) - a*d*(a + b*x)**(n + S(2))*(S(8)*a**S(6)*d**S(2) - S(15)*a**S(3)*b**S(3)*c*d + S(6)*b**S(6)*c**S(2))/(b**S(9)*(n + S(2))) + d**S(3)*(a + b*x)**(n + S(9))/(b**S(9)*(n + S(9))) + d**S(2)*(a + b*x)**(n + S(6))*(-S(56)*a**S(3)*d + S(3)*b**S(3)*c)/(b**S(9)*(n + S(6))) + d*(a + b*x)**(n + S(3))*(S(28)*a**S(6)*d**S(2) - S(30)*a**S(3)*b**S(3)*c*d + S(3)*b**S(6)*c**S(2))/(b**S(9)*(n + S(3))) - c**S(3)*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e + f*x)**n/(a + b*x**S(3)), x), x, x**(m + S(1))*(S(1) + f*x/e)**(-n)*(e + f*x)**n*AppellF1(m + S(1), -n, S(1), m + S(2), -f*x/e, -b**(S(1)/3)*x/a**(S(1)/3))/(S(3)*a*(m + S(1))) + x**(m + S(1))*(S(1) + f*x/e)**(-n)*(e + f*x)**n*AppellF1(m + S(1), -n, S(1), m + S(2), -f*x/e, (S(-1))**(S(1)/3)*b**(S(1)/3)*x/a**(S(1)/3))/(S(3)*a*(m + S(1))) + x**(m + S(1))*(S(1) + f*x/e)**(-n)*(e + f*x)**n*AppellF1(m + S(1), -n, S(1), m + S(2), -f*x/e, -(S(-1))**(S(2)/3)*b**(S(1)/3)*x/a**(S(1)/3))/(S(3)*a*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(e + f*x)**n/(a + b*x**S(3)), x), x, a*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(5)/3)*(n + S(1))*(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) + a*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(5)/3)*(n + S(1))*((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) + a*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(5)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)) + e**S(2)*(e + f*x)**(n + S(1))/(b*f**S(3)*(n + S(1))) - S(2)*e*(e + f*x)**(n + S(2))/(b*f**S(3)*(n + S(2))) + (e + f*x)**(n + S(3))/(b*f**S(3)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(e + f*x)**n/(a + b*x**S(3)), x), x, (S(-1))**(S(2)/3)*a**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(1)/3)*b**(S(1)/3)*(e + f*x)/(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/(S(3)*b**(S(4)/3)*(n + S(1))*(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e)) + (S(-1))**(S(1)/3)*a**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(2)/3)*b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/(S(3)*b**(S(4)/3)*(n + S(1))*(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e)) - a**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(4)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)) - e*(e + f*x)**(n + S(1))/(b*f**S(2)*(n + S(1))) + (e + f*x)**(n + S(2))/(b*f**S(2)*(n + S(2))), expand=True, _diff=True, _numerical=True) # difference in simplify assert rubi_test(rubi_integrate(x**S(3)*(e + f*x)**n/(a + b*x**S(3)), x), x, -a**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(1)/3)*b**(S(1)/3)*(e + f*x)/(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/(S(3)*b*(n + S(1))*(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e)) + a**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(2)/3)*b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/(S(3)*b*(n + S(1))*(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e)) + a**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)) + (e + f*x)**(n + S(1))/(b*f*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(e + f*x)**n/(a + b*x**S(3)), x), x, -(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(2)/3)*(n + S(1))*(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) - (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(2)/3)*(n + S(1))*((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) - (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*b**(S(2)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(e + f*x)**n/(a + b*x**S(3)), x), x, -(S(-1))**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(1)/3)*b**(S(1)/3)*(e + f*x)/(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(1)/3)*b**(S(1)/3)*(n + S(1))*(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e)) - (S(-1))**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(2)/3)*b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(1)/3)*b**(S(1)/3)*(n + S(1))*(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e)) + (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a**(S(1)/3)*b**(S(1)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e + f*x)**n/(a + b*x**S(3)), x), x, (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(1)/3)*b**(S(1)/3)*(e + f*x)/(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(2)/3)*(n + S(1))*(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e)) - (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(2)/3)*b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(2)/3)*(n + S(1))*(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e)) - (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a**(S(2)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e + f*x)**n/(x*(a + b*x**S(3))), x), x, b**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a*(n + S(1))*(-(S(-1))**(S(2)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) + b**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a*(n + S(1))*((S(-1))**(S(1)/3)*a**(S(1)/3)*f + b**(S(1)/3)*e)) + b**(S(1)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)) - (e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + f*x/e)/(a*e*(n + S(1))), expand=True, _diff=True, _numerical=True) # large time in rubi_test assert rubi_test(rubi_integrate((e + f*x)**n/(x**S(2)*(a + b*x**S(3))), x), x, f*(e + f*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + f*x/e)/(a*e**S(2)*(n + S(1))) + (S(-1))**(S(2)/3)*b**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(1)/3)*b**(S(1)/3)*(e + f*x)/(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(4)/3)*(n + S(1))*(a**(S(1)/3)*f + (S(-1))**(S(1)/3)*b**(S(1)/3)*e)) + (S(-1))**(S(1)/3)*b**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), (S(-1))**(S(2)/3)*b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e))/(S(3)*a**(S(4)/3)*(n + S(1))*(-a**(S(1)/3)*f + (S(-1))**(S(2)/3)*b**(S(1)/3)*e)) - b**(S(2)/3)*(e + f*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/3)*(e + f*x)/(-a**(S(1)/3)*f + b**(S(1)/3)*e))/(S(3)*a**(S(4)/3)*(n + S(1))*(-a**(S(1)/3)*f + b**(S(1)/3)*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c + d*x)**(n + S(1))/(a + b*x**S(3)), x), x, -(c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/3)*(c + d*x)/(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**(S(2)/3)*(n + S(2))*(-(S(-1))**(S(2)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c)) - (c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/3)*(c + d*x)/((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**(S(2)/3)*(n + S(2))*((S(-1))**(S(1)/3)*a**(S(1)/3)*d + b**(S(1)/3)*c)) - (c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/3)*(c + d*x)/(-a**(S(1)/3)*d + b**(S(1)/3)*c))/(S(3)*b**(S(2)/3)*(n + S(2))*(-a**(S(1)/3)*d + b**(S(1)/3)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c + d*x)**n/(a + b*x**S(4)), x), x, -(c + d*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(1))*(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(1))*(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(1))*(b**(S(1)/4)*c + d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(1))*(b**(S(1)/4)*c - d*(-a)**(S(1)/4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c + d*x)**(n + S(1))/(a + b*x**S(4)), x), x, -(c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(2))*(b**(S(1)/4)*c + I*d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(2))*(b**(S(1)/4)*c - I*d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c + d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(2))*(b**(S(1)/4)*c + d*(-a)**(S(1)/4))) - (c + d*x)**(n + S(2))*hyper((S(1), n + S(2)), (n + S(3),), b**(S(1)/4)*(c + d*x)/(b**(S(1)/4)*c - d*(-a)**(S(1)/4)))/(S(4)*b**(S(3)/4)*(n + S(2))*(b**(S(1)/4)*c - d*(-a)**(S(1)/4))), expand=True, _diff=True, _numerical=True) # large time in rubi_test assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*x**S(4))*(c + d*x + e*x**S(2))), x), x, sqrt(S(2))*e**S(2)*atanh(sqrt(S(2))*(S(4)*a*e**S(2) + b*x**S(2)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2))/(S(4)*sqrt(a + b*x**S(4))*sqrt(S(2)*a*e**S(4) + S(2)*b*c**S(2)*e**S(2) - S(4)*b*c*d**S(2)*e + b*d**S(4) + b*d*sqrt(-S(4)*c*e + d**S(2))*(-S(2)*c*e + d**S(2)))))/(S(2)*sqrt(-S(4)*c*e + d**S(2))*sqrt(S(2)*a*e**S(4) + S(2)*b*c**S(2)*e**S(2) - S(4)*b*c*d**S(2)*e + b*d**S(4) + b*d*sqrt(-S(4)*c*e + d**S(2))*(-S(2)*c*e + d**S(2)))) - sqrt(S(2))*e**S(2)*atanh(sqrt(S(2))*(S(4)*a*e**S(2) + b*x**S(2)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2))/(S(4)*sqrt(a + b*x**S(4))*sqrt(S(2)*a*e**S(4) + S(2)*b*c**S(2)*e**S(2) - S(4)*b*c*d**S(2)*e + b*d**S(4) - b*d*sqrt(-S(4)*c*e + d**S(2))*(-S(2)*c*e + d**S(2)))))/(S(2)*sqrt(-S(4)*c*e + d**S(2))*sqrt(S(2)*a*e**S(4) + S(2)*b*c**S(2)*e**S(2) - S(4)*b*c*d**S(2)*e + b*d**S(4) - b*d*sqrt(-S(4)*c*e + d**S(2))*(-S(2)*c*e + d**S(2)))) - S(2)*e*atan(x*sqrt(-(S(16)*a*e**S(4) + b*(d + sqrt(-S(4)*c*e + d**S(2)))**S(4))/(e**S(2)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)))/(S(2)*sqrt(a + b*x**S(4))))/(sqrt(-(S(16)*a*e**S(4) + b*(d + sqrt(-S(4)*c*e + d**S(2)))**S(4))/(e**S(2)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)))*(d + sqrt(-S(4)*c*e + d**S(2)))*sqrt(-S(4)*c*e + d**S(2))) + S(2)*e*atan(x*sqrt(-(S(16)*a*e**S(4) + b*(d - sqrt(-S(4)*c*e + d**S(2)))**S(4))/(e**S(2)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)))/(S(2)*sqrt(a + b*x**S(4))))/(sqrt(-(S(16)*a*e**S(4) + b*(d - sqrt(-S(4)*c*e + d**S(2)))**S(4))/(e**S(2)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)))*(d - sqrt(-S(4)*c*e + d**S(2)))*sqrt(-S(4)*c*e + d**S(2))) - e*sqrt((a + b*x**S(4))/(sqrt(a) + sqrt(b)*x**S(2))**S(2))*(sqrt(a) + sqrt(b)*x**S(2))*(S(4)*e**S(2) - sqrt(b)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*elliptic_pi(sqrt(a)*(S(4)*e**S(2) + sqrt(b)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))**S(2)/(S(16)*sqrt(b)*e**S(2)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)), S(2)*atan(b**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*b**(S(1)/4)*sqrt(a + b*x**S(4))*(d + sqrt(-S(4)*c*e + d**S(2)))*(S(4)*e**S(2) + sqrt(b)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*sqrt(-S(4)*c*e + d**S(2))) + e*sqrt((a + b*x**S(4))/(sqrt(a) + sqrt(b)*x**S(2))**S(2))*(sqrt(a) + sqrt(b)*x**S(2))*(S(4)*e**S(2) - sqrt(b)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*elliptic_pi(sqrt(a)*(S(4)*e**S(2) + sqrt(b)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))**S(2)/(S(16)*sqrt(b)*e**S(2)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)), S(2)*atan(b**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*b**(S(1)/4)*sqrt(a + b*x**S(4))*(d - sqrt(-S(4)*c*e + d**S(2)))*(S(4)*e**S(2) + sqrt(b)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*sqrt(-S(4)*c*e + d**S(2))) + b**(S(1)/4)*e*sqrt((a + b*x**S(4))/(sqrt(a) + sqrt(b)*x**S(2))**S(2))*(sqrt(a) + sqrt(b)*x**S(2))*(d - sqrt(-S(4)*c*e + d**S(2)))*elliptic_f(S(2)*atan(b**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(a**(S(3)/4)*sqrt(a + b*x**S(4))*(S(4)*e**S(2) + sqrt(b)*(d - sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*sqrt(-S(4)*c*e + d**S(2))) - b**(S(1)/4)*e*sqrt((a + b*x**S(4))/(sqrt(a) + sqrt(b)*x**S(2))**S(2))*(sqrt(a) + sqrt(b)*x**S(2))*(d + sqrt(-S(4)*c*e + d**S(2)))*elliptic_f(S(2)*atan(b**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(a**(S(3)/4)*sqrt(a + b*x**S(4))*(S(4)*e**S(2) + sqrt(b)*(d + sqrt(-S(4)*c*e + d**S(2)))**S(2)/sqrt(a))*sqrt(-S(4)*c*e + d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**p, x), x, x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**S(3), x), x, x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(4)/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**S(2), x), x, x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(3)/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*(c*x**n)**(S(1)/n), x), x, a*x + b*x*(c*x**n)**(S(1)/n)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c*x**n)**(S(1)/n)), x), x, x*(c*x**n)**(-S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**(S(-2)), x), x, x/(a**S(2) + a*b*(c*x**n)**(S(1)/n)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**(S(-2)), x), x, -x*(c*x**n)**(-S(1)/n)/(b*(a + b*(c*x**n)**(S(1)/n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**(S(-3)), x), x, -x*(c*x**n)**(-S(1)/n)/(S(2)*b*(a + b*(c*x**n)**(S(1)/n))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(2)/n))**S(3), x), x, a**S(3)*x + a**S(2)*b*x*(c*x**n)**(S(2)/n) + S(3)*a*b**S(2)*x*(c*x**n)**(S(4)/n)/S(5) + b**S(3)*x*(c*x**n)**(S(6)/n)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(2)/n))**S(2), x), x, a**S(2)*x + S(2)*a*b*x*(c*x**n)**(S(2)/n)/S(3) + b**S(2)*x*(c*x**n)**(S(4)/n)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*(c*x**n)**(S(2)/n), x), x, a*x + b*x*(c*x**n)**(S(2)/n)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c*x**n)**(S(2)/n)), x), x, x*(c*x**n)**(-S(1)/n)*atan(sqrt(b)*(c*x**n)**(S(1)/n)/sqrt(a))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(2)/n))**(S(-2)), x), x, x/(S(2)*a*(a + b*(c*x**n)**(S(2)/n))) + x*(c*x**n)**(-S(1)/n)*atan(sqrt(b)*(c*x**n)**(S(1)/n)/sqrt(a))/(S(2)*a**(S(3)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(2)/n))**(S(-3)), x), x, x/(S(4)*a*(a + b*(c*x**n)**(S(2)/n))**S(2)) + S(3)*x/(S(8)*a**S(2)*(a + b*(c*x**n)**(S(2)/n))) + S(3)*x*(c*x**n)**(-S(1)/n)*atan(sqrt(b)*(c*x**n)**(S(1)/n)/sqrt(a))/(S(8)*a**(S(5)/2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(3)/n))**S(3), x), x, a**S(3)*x + S(3)*a**S(2)*b*x*(c*x**n)**(S(3)/n)/S(4) + S(3)*a*b**S(2)*x*(c*x**n)**(S(6)/n)/S(7) + b**S(3)*x*(c*x**n)**(S(9)/n)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(3)/n))**S(2), x), x, a**S(2)*x + a*b*x*(c*x**n)**(S(3)/n)/S(2) + b**S(2)*x*(c*x**n)**(S(6)/n)/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a + b*(c*x**n)**(S(3)/n), x), x, a*x + b*x*(c*x**n)**(S(3)/n)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c*x**n)**(S(3)/n)), x), x, x*(c*x**n)**(-S(1)/n)*log(a**(S(1)/3) + b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(3)*a**(S(2)/3)*b**(S(1)/3)) - x*(c*x**n)**(-S(1)/n)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c*x**n)**(S(1)/n) + b**(S(2)/3)*(c*x**n)**(S(2)/n))/(S(6)*a**(S(2)/3)*b**(S(1)/3)) - sqrt(S(3))*x*(c*x**n)**(-S(1)/n)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(3)/n))**(S(-2)), x), x, x/(S(3)*a*(a + b*(c*x**n)**(S(3)/n))) + S(2)*x*(c*x**n)**(-S(1)/n)*log(a**(S(1)/3) + b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(9)*a**(S(5)/3)*b**(S(1)/3)) - x*(c*x**n)**(-S(1)/n)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c*x**n)**(S(1)/n) + b**(S(2)/3)*(c*x**n)**(S(2)/n))/(S(9)*a**(S(5)/3)*b**(S(1)/3)) - S(2)*sqrt(S(3))*x*(c*x**n)**(-S(1)/n)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(3)*a**(S(1)/3)))/(S(9)*a**(S(5)/3)*b**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(3)/n))**(S(-3)), x), x, x/(S(6)*a*(a + b*(c*x**n)**(S(3)/n))**S(2)) + S(5)*x/(S(18)*a**S(2)*(a + b*(c*x**n)**(S(3)/n))) + S(5)*x*(c*x**n)**(-S(1)/n)*log(a**(S(1)/3) + b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(27)*a**(S(8)/3)*b**(S(1)/3)) - S(5)*x*(c*x**n)**(-S(1)/n)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c*x**n)**(S(1)/n) + b**(S(2)/3)*(c*x**n)**(S(2)/n))/(S(54)*a**(S(8)/3)*b**(S(1)/3)) - S(5)*sqrt(S(3))*x*(c*x**n)**(-S(1)/n)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c*x**n)**(S(1)/n))/(S(3)*a**(S(1)/3)))/(S(27)*a**(S(8)/3)*b**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(3))**(S(2)/3) + S(1)), x), x, x*atan((x**S(3))**(S(1)/3))/(x**S(3))**(S(1)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(2))**(S(3)/2) + S(1)), x), x, x*log(sqrt(x**S(2)) + S(1))/(S(3)*sqrt(x**S(2))) - x*log(x**S(2) - sqrt(x**S(2)) + S(1))/(S(6)*sqrt(x**S(2))) - sqrt(S(3))*x*atan(sqrt(S(3))*(-S(2)*sqrt(x**S(2)) + S(1))/S(3))/(S(3)*sqrt(x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*sqrt(x**S(4)) + S(1)), x), x, x*atan(S(2)*(x**S(4))**(S(1)/4))/(S(2)*(x**S(4))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-S(4)*sqrt(x**S(4)) + S(1)), x), x, x*atanh(S(2)*(x**S(4))**(S(1)/4))/(S(2)*(x**S(4))**(S(1)/4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*(x**S(6))**(S(1)/3) + S(1)), x), x, x*atan(S(2)*(x**S(6))**(S(1)/6))/(S(2)*(x**S(6))**(S(1)/6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-S(4)*(x**S(6))**(S(1)/3) + S(1)), x), x, x*atanh(S(2)*(x**S(6))**(S(1)/6))/(S(2)*(x**S(6))**(S(1)/6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*(x**(S(2)*n))**(S(1)/n) + S(1)), x), x, x*(x**(S(2)*n))**(-S(1)/(S(2)*n))*atan(S(2)*(x**(S(2)*n))**(S(1)/(S(2)*n)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-S(4)*(x**(S(2)*n))**(S(1)/n) + S(1)), x), x, x*(x**(S(2)*n))**(-S(1)/(S(2)*n))*atanh(S(2)*(x**(S(2)*n))**(S(1)/(S(2)*n)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*(c*x**n)**(S(1)/n)), x), x, -a**S(3)*x**S(4)*(c*x**n)**(-S(4)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(4) + a**S(2)*x**S(4)*(c*x**n)**(-S(3)/n)/b**S(3) - a*x**S(4)*(c*x**n)**(-S(2)/n)/(S(2)*b**S(2)) + x**S(4)*(c*x**n)**(-S(1)/n)/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*(c*x**n)**(S(1)/n)), x), x, a**S(2)*x**S(3)*(c*x**n)**(-S(3)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(3) - a*x**S(3)*(c*x**n)**(-S(2)/n)/b**S(2) + x**S(3)*(c*x**n)**(-S(1)/n)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*(c*x**n)**(S(1)/n)), x), x, -a*x**S(2)*(c*x**n)**(-S(2)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(2) + x**S(2)*(c*x**n)**(-S(1)/n)/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c*x**n)**(S(1)/n)), x), x, x*(c*x**n)**(-S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c*x**n)**(S(1)/n))), x), x, log(x)/a - log(a + b*(c*x**n)**(S(1)/n))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*(c*x**n)**(S(1)/n))), x), x, -S(1)/(a*x) - b*(c*x**n)**(S(1)/n)*log(x)/(a**S(2)*x) + b*(c*x**n)**(S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*(c*x**n)**(S(1)/n))), x), x, -S(1)/(S(2)*a*x**S(2)) + b*(c*x**n)**(S(1)/n)/(a**S(2)*x**S(2)) + b**S(2)*(c*x**n)**(S(2)/n)*log(x)/(a**S(3)*x**S(2)) - b**S(2)*(c*x**n)**(S(2)/n)*log(a + b*(c*x**n)**(S(1)/n))/(a**S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*(c*x**n)**(S(1)/n))**S(2), x), x, a**S(3)*x**S(4)*(c*x**n)**(-S(4)/n)/(b**S(4)*(a + b*(c*x**n)**(S(1)/n))) + S(3)*a**S(2)*x**S(4)*(c*x**n)**(-S(4)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(4) - S(2)*a*x**S(4)*(c*x**n)**(-S(3)/n)/b**S(3) + x**S(4)*(c*x**n)**(-S(2)/n)/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*(c*x**n)**(S(1)/n))**S(2), x), x, -a**S(2)*x**S(3)*(c*x**n)**(-S(3)/n)/(b**S(3)*(a + b*(c*x**n)**(S(1)/n))) - S(2)*a*x**S(3)*(c*x**n)**(-S(3)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(3) + x**S(3)*(c*x**n)**(-S(2)/n)/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*(c*x**n)**(S(1)/n))**S(2), x), x, a*x**S(2)*(c*x**n)**(-S(2)/n)/(b**S(2)*(a + b*(c*x**n)**(S(1)/n))) + x**S(2)*(c*x**n)**(-S(2)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**(S(-2)), x), x, -x*(c*x**n)**(-S(1)/n)/(b*(a + b*(c*x**n)**(S(1)/n))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c*x**n)**(S(1)/n))**S(2)), x), x, S(1)/(a*(a + b*(c*x**n)**(S(1)/n))) + log(x)/a**S(2) - log(a + b*(c*x**n)**(S(1)/n))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*(c*x**n)**(S(1)/n))**S(2)), x), x, -b*(c*x**n)**(S(1)/n)/(a**S(2)*x*(a + b*(c*x**n)**(S(1)/n))) - S(1)/(a**S(2)*x) - S(2)*b*(c*x**n)**(S(1)/n)*log(x)/(a**S(3)*x) + S(2)*b*(c*x**n)**(S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/(a**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*(c*x**n)**(S(1)/n))**S(2)), x), x, -S(1)/(S(2)*a**S(2)*x**S(2)) + b**S(2)*(c*x**n)**(S(2)/n)/(a**S(3)*x**S(2)*(a + b*(c*x**n)**(S(1)/n))) + S(2)*b*(c*x**n)**(S(1)/n)/(a**S(3)*x**S(2)) + S(3)*b**S(2)*(c*x**n)**(S(2)/n)*log(x)/(a**S(4)*x**S(2)) - S(3)*b**S(2)*(c*x**n)**(S(2)/n)*log(a + b*(c*x**n)**(S(1)/n))/(a**S(4)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*(c*x**n)**(S(1)/n))**p, x), x, -a**S(3)*x**S(4)*(c*x**n)**(-S(4)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b**S(4)*(p + S(1))) + S(3)*a**S(2)*x**S(4)*(c*x**n)**(-S(4)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(2))/(b**S(4)*(p + S(2))) - S(3)*a*x**S(4)*(c*x**n)**(-S(4)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(3))/(b**S(4)*(p + S(3))) + x**S(4)*(c*x**n)**(-S(4)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(4))/(b**S(4)*(p + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*(c*x**n)**(S(1)/n))**p, x), x, a**S(2)*x**S(3)*(c*x**n)**(-S(3)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b**S(3)*(p + S(1))) - S(2)*a*x**S(3)*(c*x**n)**(-S(3)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(2))/(b**S(3)*(p + S(2))) + x**S(3)*(c*x**n)**(-S(3)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(3))/(b**S(3)*(p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*(c*x**n)**(S(1)/n))**p, x), x, -a*x**S(2)*(c*x**n)**(-S(2)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b**S(2)*(p + S(1))) + x**S(2)*(c*x**n)**(-S(2)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(2))/(b**S(2)*(p + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**p, x), x, x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x**n)**(S(1)/n))**p/x, x), x, -(a + b*(c*x**n)**(S(1)/n))**(p + S(1))*hyper((S(1), p + S(1)), (p + S(2),), S(1) + b*(c*x**n)**(S(1)/n)/a)/(a*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x**n)**(S(1)/n) + S(1))**S(2), x), x, x**S(2)*(x**n)**(-S(2)/n)*log((x**n)**(S(1)/n) + S(1)) + x**S(2)*(x**n)**(-S(2)/n)/((x**n)**(S(1)/n) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a*(b*x**n)**p)**q, x), x, x**(m + S(1))*(a*(b*x**n)**p)**q/(m + n*p*q + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a*(b*x**n)**p)**q, x), x, x**S(3)*(a*(b*x**n)**p)**q/(n*p*q + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*(b*x**n)**p)**q, x), x, x**S(2)*(a*(b*x**n)**p)**q/(n*p*q + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**n)**p)**q, x), x, x*(a*(b*x**n)**p)**q/(n*p*q + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**n)**p)**q/x, x), x, (a*(b*x**n)**p)**q/(n*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**n)**p)**q/x**S(2), x), x, -(a*(b*x**n)**p)**q/(x*(-n*p*q + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**n)**p)**q/x**S(3), x), x, -(a*(b*x**n)**p)**q/(x**S(2)*(-n*p*q + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a*(b*x**m)**n)**(-S(1)/(m*n)), x), x, x**S(3)*(a*(b*x**m)**n)**(-S(1)/(m*n))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a*(b*x**m)**n)**(-S(1)/(m*n)), x), x, x**S(2)*(a*(b*x**m)**n)**(-S(1)/(m*n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**m)**n)**(-S(1)/(m*n)), x), x, x*(a*(b*x**m)**n)**(-S(1)/(m*n))*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**m)**n)**(-S(1)/(m*n))/x, x), x, -(a*(b*x**m)**n)**(-S(1)/(m*n)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*(b*x**m)**n)**(-S(1)/(m*n))/x**S(2), x), x, -(a*(b*x**m)**n)**(-S(1)/(m*n))/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*p*q + S(2))*(a*(b*x**n)**p)**q, x), x, x**(-n*p*q + S(3))*(a*(b*x**n)**p)**q/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*p*q + S(1))*(a*(b*x**n)**p)**q, x), x, x**(-n*p*q + S(2))*(a*(b*x**n)**p)**q/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*p*q)*(a*(b*x**n)**p)**q, x), x, x**(-n*p*q + S(1))*(a*(b*x**n)**p)**q, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*p*q + S(-1))*(a*(b*x**n)**p)**q, x), x, x**(-n*p*q)*(a*(b*x**n)**p)**q*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n*p*q + S(-2))*(a*(b*x**n)**p)**q, x), x, -x**(-n*p*q + S(-1))*(a*(b*x**n)**p)**q, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c*x**S(2))*(a + b*x)**n, x), x, -a**S(3)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(4)*x*(n + S(1))) + S(3)*a**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(4)*x*(n + S(2))) - S(3)*a*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(4)*x*(n + S(3))) + sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(4)*x*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c*x**S(2))*(a + b*x)**n, x), x, a**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(3)*x*(n + S(1))) - S(2)*a*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(3)*x*(n + S(2))) + sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(3)*x*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**n, x), x, -a*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(2)*x*(n + S(1))) + sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(2)*x*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**n/x, x), x, sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**n/x**S(2), x), x, -sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**n/x**S(3), x), x, b*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**n/x**S(4), x), x, -b**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(3), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(3)*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(3)/2)*(a + b*x)**n, x), x, a**S(4)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(5)*x*(n + S(1))) - S(4)*a**S(3)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(5)*x*(n + S(2))) + S(6)*a**S(2)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(5)*x*(n + S(3))) - S(4)*a*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(5)*x*(n + S(4))) + c*sqrt(c*x**S(2))*(a + b*x)**(n + S(5))/(b**S(5)*x*(n + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n, x), x, -a**S(3)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(4)*x*(n + S(1))) + S(3)*a**S(2)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(4)*x*(n + S(2))) - S(3)*a*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(4)*x*(n + S(3))) + c*sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(4)*x*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x, x), x, a**S(2)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(3)*x*(n + S(1))) - S(2)*a*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(3)*x*(n + S(2))) + c*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(3)*x*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x**S(2), x), x, -a*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(2)*x*(n + S(1))) + c*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(2)*x*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x**S(3), x), x, c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x**S(4), x), x, -c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x**S(5), x), x, b*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**n/x**S(6), x), x, -b**S(2)*c*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(3), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(3)*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n, x), x, -a**S(5)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(6)*x*(n + S(1))) + S(5)*a**S(4)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(6)*x*(n + S(2))) - S(10)*a**S(3)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(6)*x*(n + S(3))) + S(10)*a**S(2)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(6)*x*(n + S(4))) - S(5)*a*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(5))/(b**S(6)*x*(n + S(5))) + c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(6))/(b**S(6)*x*(n + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x, x), x, a**S(4)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(5)*x*(n + S(1))) - S(4)*a**S(3)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(5)*x*(n + S(2))) + S(6)*a**S(2)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(5)*x*(n + S(3))) - S(4)*a*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(5)*x*(n + S(4))) + c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(5))/(b**S(5)*x*(n + S(5))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(2), x), x, -a**S(3)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(4)*x*(n + S(1))) + S(3)*a**S(2)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(4)*x*(n + S(2))) - S(3)*a*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(4)*x*(n + S(3))) + c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(4))/(b**S(4)*x*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(3), x), x, a**S(2)*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(3)*x*(n + S(1))) - S(2)*a*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(3)*x*(n + S(2))) + c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(3))/(b**S(3)*x*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(4), x), x, -a*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(2)*x*(n + S(1))) + c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(2)*x*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(5), x), x, c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(6), x), x, -c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**n/x**S(7), x), x, b*c**S(2)*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*x*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x)**n/sqrt(c*x**S(2)), x), x, -a**S(3)*x*(a + b*x)**(n + S(1))/(b**S(4)*sqrt(c*x**S(2))*(n + S(1))) + S(3)*a**S(2)*x*(a + b*x)**(n + S(2))/(b**S(4)*sqrt(c*x**S(2))*(n + S(2))) - S(3)*a*x*(a + b*x)**(n + S(3))/(b**S(4)*sqrt(c*x**S(2))*(n + S(3))) + x*(a + b*x)**(n + S(4))/(b**S(4)*sqrt(c*x**S(2))*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**n/sqrt(c*x**S(2)), x), x, a**S(2)*x*(a + b*x)**(n + S(1))/(b**S(3)*sqrt(c*x**S(2))*(n + S(1))) - S(2)*a*x*(a + b*x)**(n + S(2))/(b**S(3)*sqrt(c*x**S(2))*(n + S(2))) + x*(a + b*x)**(n + S(3))/(b**S(3)*sqrt(c*x**S(2))*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n/sqrt(c*x**S(2)), x), x, -a*sqrt(c*x**S(2))*(a + b*x)**(n + S(1))/(b**S(2)*c*x*(n + S(1))) + sqrt(c*x**S(2))*(a + b*x)**(n + S(2))/(b**S(2)*c*x*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n/sqrt(c*x**S(2)), x), x, x*(a + b*x)**(n + S(1))/(b*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/sqrt(c*x**S(2)), x), x, -x*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/(x*sqrt(c*x**S(2))), x), x, b*x*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/(x**S(2)*sqrt(c*x**S(2))), x), x, -b**S(2)*x*(a + b*x)**(n + S(1))*hyper((S(3), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(3)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/(x**S(3)*sqrt(c*x**S(2))), x), x, b**S(3)*x*(a + b*x)**(n + S(1))*hyper((S(4), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(4)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, -a**S(3)*x*(a + b*x)**(n + S(1))/(b**S(4)*c*sqrt(c*x**S(2))*(n + S(1))) + S(3)*a**S(2)*x*(a + b*x)**(n + S(2))/(b**S(4)*c*sqrt(c*x**S(2))*(n + S(2))) - S(3)*a*x*(a + b*x)**(n + S(3))/(b**S(4)*c*sqrt(c*x**S(2))*(n + S(3))) + x*(a + b*x)**(n + S(4))/(b**S(4)*c*sqrt(c*x**S(2))*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, a**S(2)*x*(a + b*x)**(n + S(1))/(b**S(3)*c*sqrt(c*x**S(2))*(n + S(1))) - S(2)*a*x*(a + b*x)**(n + S(2))/(b**S(3)*c*sqrt(c*x**S(2))*(n + S(2))) + x*(a + b*x)**(n + S(3))/(b**S(3)*c*sqrt(c*x**S(2))*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, -a*x*(a + b*x)**(n + S(1))/(b**S(2)*c*sqrt(c*x**S(2))*(n + S(1))) + x*(a + b*x)**(n + S(2))/(b**S(2)*c*sqrt(c*x**S(2))*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, x*(a + b*x)**(n + S(1))/(b*c*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, -x*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*c*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, b*x*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*c*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/(c*x**S(2))**(S(3)/2), x), x, -b**S(2)*x*(a + b*x)**(n + S(1))*hyper((S(3), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(3)*c*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**n/(x*(c*x**S(2))**(S(3)/2)), x), x, b**S(3)*x*(a + b*x)**(n + S(1))*hyper((S(4), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(4)*c*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, -a**S(3)*x*(a + b*x)**(n + S(1))/(b**S(4)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))) + S(3)*a**S(2)*x*(a + b*x)**(n + S(2))/(b**S(4)*c**S(2)*sqrt(c*x**S(2))*(n + S(2))) - S(3)*a*x*(a + b*x)**(n + S(3))/(b**S(4)*c**S(2)*sqrt(c*x**S(2))*(n + S(3))) + x*(a + b*x)**(n + S(4))/(b**S(4)*c**S(2)*sqrt(c*x**S(2))*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, a**S(2)*x*(a + b*x)**(n + S(1))/(b**S(3)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))) - S(2)*a*x*(a + b*x)**(n + S(2))/(b**S(3)*c**S(2)*sqrt(c*x**S(2))*(n + S(2))) + x*(a + b*x)**(n + S(3))/(b**S(3)*c**S(2)*sqrt(c*x**S(2))*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, -a*x*(a + b*x)**(n + S(1))/(b**S(2)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))) + x*(a + b*x)**(n + S(2))/(b**S(2)*c**S(2)*sqrt(c*x**S(2))*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, x*(a + b*x)**(n + S(1))/(b*c**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, -x*(a + b*x)**(n + S(1))*hyper((S(1), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a*c**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, b*x*(a + b*x)**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(2)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, -b**S(2)*x*(a + b*x)**(n + S(1))*hyper((S(3), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(3)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**n/(c*x**S(2))**(S(5)/2), x), x, b**S(3)*x*(a + b*x)**(n + S(1))*hyper((S(4), n + S(1)), (n + S(2),), S(1) + b*x/a)/(a**S(4)*c**S(2)*sqrt(c*x**S(2))*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(c*x**S(2))*(a + b*x), x), x, a*x**(m + S(1))*sqrt(c*x**S(2))/(m + S(2)) + b*x**(m + S(2))*sqrt(c*x**S(2))/(m + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(c*x**S(2))*(a + b*x), x), x, a*x**S(4)*sqrt(c*x**S(2))/S(5) + b*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c*x**S(2))*(a + b*x), x), x, a*x**S(3)*sqrt(c*x**S(2))/S(4) + b*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c*x**S(2))*(a + b*x), x), x, a*x**S(2)*sqrt(c*x**S(2))/S(3) + b*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x), x), x, a*x*sqrt(c*x**S(2))/S(2) + b*x**S(2)*sqrt(c*x**S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)/x, x), x, a*sqrt(c*x**S(2)) + b*x*sqrt(c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)/x**S(2), x), x, a*sqrt(c*x**S(2))*log(x)/x + b*sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)/x**S(3), x), x, -a*sqrt(c*x**S(2))/x**S(2) + b*sqrt(c*x**S(2))*log(x)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)/x**S(4), x), x, -a*sqrt(c*x**S(2))/(S(2)*x**S(3)) - b*sqrt(c*x**S(2))/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(c*x**S(2))**(S(3)/2)*(a + b*x), x), x, a*c*x**(m + S(3))*sqrt(c*x**S(2))/(m + S(4)) + b*c*x**(m + S(4))*sqrt(c*x**S(2))/(m + S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c*x**S(2))**(S(3)/2)*(a + b*x), x), x, a*c*x**S(6)*sqrt(c*x**S(2))/S(7) + b*c*x**S(7)*sqrt(c*x**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*x**S(2))**(S(3)/2)*(a + b*x), x), x, a*c*x**S(5)*sqrt(c*x**S(2))/S(6) + b*c*x**S(6)*sqrt(c*x**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(3)/2)*(a + b*x), x), x, a*c*x**S(4)*sqrt(c*x**S(2))/S(5) + b*c*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x), x), x, a*c*x**S(3)*sqrt(c*x**S(2))/S(4) + b*c*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)/x, x), x, a*c*x**S(2)*sqrt(c*x**S(2))/S(3) + b*c*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)/x**S(2), x), x, a*c*x*sqrt(c*x**S(2))/S(2) + b*c*x**S(2)*sqrt(c*x**S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)/x**S(3), x), x, a*c*sqrt(c*x**S(2)) + b*c*x*sqrt(c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)/x**S(4), x), x, a*c*sqrt(c*x**S(2))*log(x)/x + b*c*sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(c*x**S(2))**(S(5)/2)*(a + b*x), x), x, a*c**S(2)*x**(m + S(5))*sqrt(c*x**S(2))/(m + S(6)) + b*c**S(2)*x**(m + S(6))*sqrt(c*x**S(2))/(m + S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c*x**S(2))**(S(5)/2)*(a + b*x), x), x, a*c**S(2)*x**S(8)*sqrt(c*x**S(2))/S(9) + b*c**S(2)*x**S(9)*sqrt(c*x**S(2))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*x**S(2))**(S(5)/2)*(a + b*x), x), x, a*c**S(2)*x**S(7)*sqrt(c*x**S(2))/S(8) + b*c**S(2)*x**S(8)*sqrt(c*x**S(2))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(5)/2)*(a + b*x), x), x, a*c**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7) + b*c**S(2)*x**S(7)*sqrt(c*x**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x), x), x, a*c**S(2)*x**S(5)*sqrt(c*x**S(2))/S(6) + b*c**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)/x, x), x, a*c**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5) + b*c**S(2)*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)/x**S(2), x), x, a*c**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4) + b*c**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)/x**S(3), x), x, a*c**S(2)*x**S(2)*sqrt(c*x**S(2))/S(3) + b*c**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)/x**S(4), x), x, a*c**S(2)*x*sqrt(c*x**S(2))/S(2) + b*c**S(2)*x**S(2)*sqrt(c*x**S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)/sqrt(c*x**S(2)), x), x, a*x**(m + S(1))/(m*sqrt(c*x**S(2))) + b*x**(m + S(2))/(sqrt(c*x**S(2))*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)/sqrt(c*x**S(2)), x), x, a*x**S(4)/(S(3)*sqrt(c*x**S(2))) + b*x**S(5)/(S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)/sqrt(c*x**S(2)), x), x, a*x*sqrt(c*x**S(2))/(S(2)*c) + b*x**S(2)*sqrt(c*x**S(2))/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)/sqrt(c*x**S(2)), x), x, a*x**S(2)/sqrt(c*x**S(2)) + b*x**S(3)/(S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/sqrt(c*x**S(2)), x), x, a*x*log(x)/sqrt(c*x**S(2)) + b*x**S(2)/sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x*sqrt(c*x**S(2))), x), x, -a/sqrt(c*x**S(2)) + b*x*log(x)/sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(2)*sqrt(c*x**S(2))), x), x, -a/(S(2)*x*sqrt(c*x**S(2))) - b/sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(3)*sqrt(c*x**S(2))), x), x, -a/(S(3)*x**S(2)*sqrt(c*x**S(2))) - b/(S(2)*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(4)*sqrt(c*x**S(2))), x), x, -a/(S(4)*x**S(3)*sqrt(c*x**S(2))) - b/(S(3)*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)/(c*x**S(2))**(S(3)/2), x), x, -a*x**(m + S(-1))/(c*sqrt(c*x**S(2))*(-m + S(2))) - b*x**m/(c*sqrt(c*x**S(2))*(-m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)/(c*x**S(2))**(S(3)/2), x), x, a*x**S(2)/(c*sqrt(c*x**S(2))) + b*x**S(3)/(S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)/(c*x**S(2))**(S(3)/2), x), x, a*x*log(x)/(c*sqrt(c*x**S(2))) + b*x**S(2)/(c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)/(c*x**S(2))**(S(3)/2), x), x, -a/(c*sqrt(c*x**S(2))) + b*x*log(x)/(c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(c*x**S(2))**(S(3)/2), x), x, -a/(S(2)*c*x*sqrt(c*x**S(2))) - b/(c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x*(c*x**S(2))**(S(3)/2)), x), x, -a/(S(3)*c*x**S(2)*sqrt(c*x**S(2))) - b/(S(2)*c*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(2)*(c*x**S(2))**(S(3)/2)), x), x, -a/(S(4)*c*x**S(3)*sqrt(c*x**S(2))) - b/(S(3)*c*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(3)*(c*x**S(2))**(S(3)/2)), x), x, -a/(S(5)*c*x**S(4)*sqrt(c*x**S(2))) - b/(S(4)*c*x**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(4)*(c*x**S(2))**(S(3)/2)), x), x, -a/(S(6)*c*x**S(5)*sqrt(c*x**S(2))) - b/(S(5)*c*x**S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)/(c*x**S(2))**(S(5)/2), x), x, -a*x**(m + S(-3))/(c**S(2)*sqrt(c*x**S(2))*(-m + S(4))) - b*x**(m + S(-2))/(c**S(2)*sqrt(c*x**S(2))*(-m + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)/(c*x**S(2))**(S(5)/2), x), x, -a/(c**S(2)*sqrt(c*x**S(2))) + b*x*log(x)/(c**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)/(c*x**S(2))**(S(5)/2), x), x, -a/(S(2)*c**S(2)*x*sqrt(c*x**S(2))) - b/(c**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)/(c*x**S(2))**(S(5)/2), x), x, -a/(S(3)*c**S(2)*x**S(2)*sqrt(c*x**S(2))) - b/(S(2)*c**S(2)*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(c*x**S(2))**(S(5)/2), x), x, -a/(S(4)*c**S(2)*x**S(3)*sqrt(c*x**S(2))) - b/(S(3)*c**S(2)*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x*(c*x**S(2))**(S(5)/2)), x), x, -a/(S(5)*c**S(2)*x**S(4)*sqrt(c*x**S(2))) - b/(S(4)*c**S(2)*x**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(2)*(c*x**S(2))**(S(5)/2)), x), x, -a/(S(6)*c**S(2)*x**S(5)*sqrt(c*x**S(2))) - b/(S(5)*c**S(2)*x**S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(3)*(c*x**S(2))**(S(5)/2)), x), x, -a/(S(7)*c**S(2)*x**S(6)*sqrt(c*x**S(2))) - b/(S(6)*c**S(2)*x**S(5)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)/(x**S(4)*(c*x**S(2))**(S(5)/2)), x), x, -a/(S(8)*c**S(2)*x**S(7)*sqrt(c*x**S(2))) - b/(S(7)*c**S(2)*x**S(6)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(c*x**S(2))*(a + b*x)**S(2), x), x, a**S(2)*x**(m + S(1))*sqrt(c*x**S(2))/(m + S(2)) + S(2)*a*b*x**(m + S(2))*sqrt(c*x**S(2))/(m + S(3)) + b**S(2)*x**(m + S(3))*sqrt(c*x**S(2))/(m + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(c*x**S(2))*(a + b*x)**S(2), x), x, a**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5) + a*b*x**S(5)*sqrt(c*x**S(2))/S(3) + b**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c*x**S(2))*(a + b*x)**S(2), x), x, a**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4) + S(2)*a*b*x**S(4)*sqrt(c*x**S(2))/S(5) + b**S(2)*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c*x**S(2))*(a + b*x)**S(2), x), x, a**S(2)*x**S(2)*sqrt(c*x**S(2))/S(3) + a*b*x**S(3)*sqrt(c*x**S(2))/S(2) + b**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**S(2), x), x, a**S(2)*x*sqrt(c*x**S(2))/S(2) + S(2)*a*b*x**S(2)*sqrt(c*x**S(2))/S(3) + b**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**S(2)/x, x), x, sqrt(c*x**S(2))*(a + b*x)**S(3)/(S(3)*b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**S(2)/x**S(2), x), x, a**S(2)*sqrt(c*x**S(2))*log(x)/x + S(2)*a*b*sqrt(c*x**S(2)) + b**S(2)*x*sqrt(c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**S(2)/x**S(3), x), x, -a**S(2)*sqrt(c*x**S(2))/x**S(2) + S(2)*a*b*sqrt(c*x**S(2))*log(x)/x + b**S(2)*sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))*(a + b*x)**S(2)/x**S(4), x), x, -a**S(2)*sqrt(c*x**S(2))/(S(2)*x**S(3)) - S(2)*a*b*sqrt(c*x**S(2))/x**S(2) + b**S(2)*sqrt(c*x**S(2))*log(x)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(c*x**S(2))**(S(3)/2)*(a + b*x)**S(2), x), x, a**S(2)*c*x**(m + S(3))*sqrt(c*x**S(2))/(m + S(4)) + S(2)*a*b*c*x**(m + S(4))*sqrt(c*x**S(2))/(m + S(5)) + b**S(2)*c*x**(m + S(5))*sqrt(c*x**S(2))/(m + S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c*x**S(2))**(S(3)/2)*(a + b*x)**S(2), x), x, a**S(2)*c*x**S(6)*sqrt(c*x**S(2))/S(7) + a*b*c*x**S(7)*sqrt(c*x**S(2))/S(4) + b**S(2)*c*x**S(8)*sqrt(c*x**S(2))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*x**S(2))**(S(3)/2)*(a + b*x)**S(2), x), x, a**S(2)*c*x**S(5)*sqrt(c*x**S(2))/S(6) + S(2)*a*b*c*x**S(6)*sqrt(c*x**S(2))/S(7) + b**S(2)*c*x**S(7)*sqrt(c*x**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(3)/2)*(a + b*x)**S(2), x), x, a**S(2)*c*x**S(4)*sqrt(c*x**S(2))/S(5) + a*b*c*x**S(5)*sqrt(c*x**S(2))/S(3) + b**S(2)*c*x**S(6)*sqrt(c*x**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2), x), x, a**S(2)*c*x**S(3)*sqrt(c*x**S(2))/S(4) + S(2)*a*b*c*x**S(4)*sqrt(c*x**S(2))/S(5) + b**S(2)*c*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)/x, x), x, a**S(2)*c*x**S(2)*sqrt(c*x**S(2))/S(3) + a*b*c*x**S(3)*sqrt(c*x**S(2))/S(2) + b**S(2)*c*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)/x**S(2), x), x, a**S(2)*c*x*sqrt(c*x**S(2))/S(2) + S(2)*a*b*c*x**S(2)*sqrt(c*x**S(2))/S(3) + b**S(2)*c*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)/x**S(3), x), x, c*sqrt(c*x**S(2))*(a + b*x)**S(3)/(S(3)*b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)/x**S(4), x), x, a**S(2)*c*sqrt(c*x**S(2))*log(x)/x + S(2)*a*b*c*sqrt(c*x**S(2)) + b**S(2)*c*x*sqrt(c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(c*x**S(2))**(S(5)/2)*(a + b*x)**S(2), x), x, a**S(2)*c**S(2)*x**(m + S(5))*sqrt(c*x**S(2))/(m + S(6)) + S(2)*a*b*c**S(2)*x**(m + S(6))*sqrt(c*x**S(2))/(m + S(7)) + b**S(2)*c**S(2)*x**(m + S(7))*sqrt(c*x**S(2))/(m + S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c*x**S(2))**(S(5)/2)*(a + b*x)**S(2), x), x, a**S(2)*c**S(2)*x**S(8)*sqrt(c*x**S(2))/S(9) + a*b*c**S(2)*x**S(9)*sqrt(c*x**S(2))/S(5) + b**S(2)*c**S(2)*x**S(10)*sqrt(c*x**S(2))/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*x**S(2))**(S(5)/2)*(a + b*x)**S(2), x), x, a**S(2)*c**S(2)*x**S(7)*sqrt(c*x**S(2))/S(8) + S(2)*a*b*c**S(2)*x**S(8)*sqrt(c*x**S(2))/S(9) + b**S(2)*c**S(2)*x**S(9)*sqrt(c*x**S(2))/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(5)/2)*(a + b*x)**S(2), x), x, a**S(2)*c**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7) + a*b*c**S(2)*x**S(7)*sqrt(c*x**S(2))/S(4) + b**S(2)*c**S(2)*x**S(8)*sqrt(c*x**S(2))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**S(2), x), x, a**S(2)*c**S(2)*x**S(5)*sqrt(c*x**S(2))/S(6) + S(2)*a*b*c**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7) + b**S(2)*c**S(2)*x**S(7)*sqrt(c*x**S(2))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**S(2)/x, x), x, a**S(2)*c**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5) + a*b*c**S(2)*x**S(5)*sqrt(c*x**S(2))/S(3) + b**S(2)*c**S(2)*x**S(6)*sqrt(c*x**S(2))/S(7), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**S(2)/x**S(2), x), x, a**S(2)*c**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4) + S(2)*a*b*c**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5) + b**S(2)*c**S(2)*x**S(5)*sqrt(c*x**S(2))/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**S(2)/x**S(3), x), x, a**S(2)*c**S(2)*x**S(2)*sqrt(c*x**S(2))/S(3) + a*b*c**S(2)*x**S(3)*sqrt(c*x**S(2))/S(2) + b**S(2)*c**S(2)*x**S(4)*sqrt(c*x**S(2))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)*(a + b*x)**S(2)/x**S(4), x), x, a**S(2)*c**S(2)*x*sqrt(c*x**S(2))/S(2) + S(2)*a*b*c**S(2)*x**S(2)*sqrt(c*x**S(2))/S(3) + b**S(2)*c**S(2)*x**S(3)*sqrt(c*x**S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)**S(2)/sqrt(c*x**S(2)), x), x, a**S(2)*x**(m + S(1))/(m*sqrt(c*x**S(2))) + S(2)*a*b*x**(m + S(2))/(sqrt(c*x**S(2))*(m + S(1))) + b**S(2)*x**(m + S(3))/(sqrt(c*x**S(2))*(m + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**S(2)/sqrt(c*x**S(2)), x), x, a**S(2)*x**S(4)/(S(3)*sqrt(c*x**S(2))) + a*b*x**S(5)/(S(2)*sqrt(c*x**S(2))) + b**S(2)*x**S(6)/(S(5)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**S(2)/sqrt(c*x**S(2)), x), x, a**S(2)*x*sqrt(c*x**S(2))/(S(2)*c) + S(2)*a*b*x**S(2)*sqrt(c*x**S(2))/(S(3)*c) + b**S(2)*x**S(3)*sqrt(c*x**S(2))/(S(4)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**S(2)/sqrt(c*x**S(2)), x), x, x*(a + b*x)**S(3)/(S(3)*b*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/sqrt(c*x**S(2)), x), x, a**S(2)*x*log(x)/sqrt(c*x**S(2)) + S(2)*a*b*x**S(2)/sqrt(c*x**S(2)) + b**S(2)*x**S(3)/(S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x*sqrt(c*x**S(2))), x), x, -a**S(2)/sqrt(c*x**S(2)) + S(2)*a*b*x*log(x)/sqrt(c*x**S(2)) + b**S(2)*x**S(2)/sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(2)*sqrt(c*x**S(2))), x), x, -a**S(2)/(S(2)*x*sqrt(c*x**S(2))) - S(2)*a*b/sqrt(c*x**S(2)) + b**S(2)*x*log(x)/sqrt(c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(3)*sqrt(c*x**S(2))), x), x, -(a + b*x)**S(3)/(S(3)*a*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(4)*sqrt(c*x**S(2))), x), x, -a**S(2)/(S(4)*x**S(3)*sqrt(c*x**S(2))) - S(2)*a*b/(S(3)*x**S(2)*sqrt(c*x**S(2))) - b**S(2)/(S(2)*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)**S(2)/(c*x**S(2))**(S(3)/2), x), x, -a**S(2)*x**(m + S(-1))/(c*sqrt(c*x**S(2))*(-m + S(2))) - S(2)*a*b*x**m/(c*sqrt(c*x**S(2))*(-m + S(1))) + b**S(2)*x**(m + S(1))/(c*m*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**S(2)/(c*x**S(2))**(S(3)/2), x), x, x*(a + b*x)**S(3)/(S(3)*b*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**S(2)/(c*x**S(2))**(S(3)/2), x), x, a**S(2)*x*log(x)/(c*sqrt(c*x**S(2))) + S(2)*a*b*x**S(2)/(c*sqrt(c*x**S(2))) + b**S(2)*x**S(3)/(S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**S(2)/(c*x**S(2))**(S(3)/2), x), x, -a**S(2)/(c*sqrt(c*x**S(2))) + S(2)*a*b*x*log(x)/(c*sqrt(c*x**S(2))) + b**S(2)*x**S(2)/(c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(c*x**S(2))**(S(3)/2), x), x, -a**S(2)/(S(2)*c*x*sqrt(c*x**S(2))) - S(2)*a*b/(c*sqrt(c*x**S(2))) + b**S(2)*x*log(x)/(c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x*(c*x**S(2))**(S(3)/2)), x), x, -(a + b*x)**S(3)/(S(3)*a*c*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(2)*(c*x**S(2))**(S(3)/2)), x), x, -a**S(2)/(S(4)*c*x**S(3)*sqrt(c*x**S(2))) - S(2)*a*b/(S(3)*c*x**S(2)*sqrt(c*x**S(2))) - b**S(2)/(S(2)*c*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(3)*(c*x**S(2))**(S(3)/2)), x), x, -a**S(2)/(S(5)*c*x**S(4)*sqrt(c*x**S(2))) - a*b/(S(2)*c*x**S(3)*sqrt(c*x**S(2))) - b**S(2)/(S(3)*c*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(4)*(c*x**S(2))**(S(3)/2)), x), x, -a**S(2)/(S(6)*c*x**S(5)*sqrt(c*x**S(2))) - S(2)*a*b/(S(5)*c*x**S(4)*sqrt(c*x**S(2))) - b**S(2)/(S(4)*c*x**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(a + b*x)**S(2)/(c*x**S(2))**(S(5)/2), x), x, -a**S(2)*x**(m + S(-3))/(c**S(2)*sqrt(c*x**S(2))*(-m + S(4))) - S(2)*a*b*x**(m + S(-2))/(c**S(2)*sqrt(c*x**S(2))*(-m + S(3))) - b**S(2)*x**(m + S(-1))/(c**S(2)*sqrt(c*x**S(2))*(-m + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*x)**S(2)/(c*x**S(2))**(S(5)/2), x), x, -a**S(2)/(c**S(2)*sqrt(c*x**S(2))) + S(2)*a*b*x*log(x)/(c**S(2)*sqrt(c*x**S(2))) + b**S(2)*x**S(2)/(c**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*x)**S(2)/(c*x**S(2))**(S(5)/2), x), x, -a**S(2)/(S(2)*c**S(2)*x*sqrt(c*x**S(2))) - S(2)*a*b/(c**S(2)*sqrt(c*x**S(2))) + b**S(2)*x*log(x)/(c**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x)**S(2)/(c*x**S(2))**(S(5)/2), x), x, -(a + b*x)**S(3)/(S(3)*a*c**S(2)*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(c*x**S(2))**(S(5)/2), x), x, -a**S(2)/(S(4)*c**S(2)*x**S(3)*sqrt(c*x**S(2))) - S(2)*a*b/(S(3)*c**S(2)*x**S(2)*sqrt(c*x**S(2))) - b**S(2)/(S(2)*c**S(2)*x*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x*(c*x**S(2))**(S(5)/2)), x), x, -a**S(2)/(S(5)*c**S(2)*x**S(4)*sqrt(c*x**S(2))) - a*b/(S(2)*c**S(2)*x**S(3)*sqrt(c*x**S(2))) - b**S(2)/(S(3)*c**S(2)*x**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(2)*(c*x**S(2))**(S(5)/2)), x), x, -a**S(2)/(S(6)*c**S(2)*x**S(5)*sqrt(c*x**S(2))) - S(2)*a*b/(S(5)*c**S(2)*x**S(4)*sqrt(c*x**S(2))) - b**S(2)/(S(4)*c**S(2)*x**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(3)*(c*x**S(2))**(S(5)/2)), x), x, -a**S(2)/(S(7)*c**S(2)*x**S(6)*sqrt(c*x**S(2))) - a*b/(S(3)*c**S(2)*x**S(5)*sqrt(c*x**S(2))) - b**S(2)/(S(5)*c**S(2)*x**S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)**S(2)/(x**S(4)*(c*x**S(2))**(S(5)/2)), x), x, -a**S(2)/(S(8)*c**S(2)*x**S(7)*sqrt(c*x**S(2))) - S(2)*a*b/(S(7)*c**S(2)*x**S(6)*sqrt(c*x**S(2))) - b**S(2)/(S(6)*c**S(2)*x**S(5)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(c*x**S(2))/(a + b*x), x), x, a**S(4)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(5)*x) - a**S(3)*sqrt(c*x**S(2))/b**S(4) + a**S(2)*x*sqrt(c*x**S(2))/(S(2)*b**S(3)) - a*x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(2)) + x**S(3)*sqrt(c*x**S(2))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c*x**S(2))/(a + b*x), x), x, -a**S(3)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(4)*x) + a**S(2)*sqrt(c*x**S(2))/b**S(3) - a*x*sqrt(c*x**S(2))/(S(2)*b**S(2)) + x**S(2)*sqrt(c*x**S(2))/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c*x**S(2))/(a + b*x), x), x, a**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(3)*x) - a*sqrt(c*x**S(2))/b**S(2) + x*sqrt(c*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(a + b*x), x), x, -a*sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*x) + sqrt(c*x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x*(a + b*x)), x), x, sqrt(c*x**S(2))*log(a + b*x)/(b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(2)*(a + b*x)), x), x, sqrt(c*x**S(2))*log(x)/(a*x) - sqrt(c*x**S(2))*log(a + b*x)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(3)*(a + b*x)), x), x, -sqrt(c*x**S(2))/(a*x**S(2)) - b*sqrt(c*x**S(2))*log(x)/(a**S(2)*x) + b*sqrt(c*x**S(2))*log(a + b*x)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(4)*(a + b*x)), x), x, -sqrt(c*x**S(2))/(S(2)*a*x**S(3)) + b*sqrt(c*x**S(2))/(a**S(2)*x**S(2)) + b**S(2)*sqrt(c*x**S(2))*log(x)/(a**S(3)*x) - b**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(a**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(3)/2)/(a + b*x), x), x, a**S(4)*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(5)*x) - a**S(3)*c*sqrt(c*x**S(2))/b**S(4) + a**S(2)*c*x*sqrt(c*x**S(2))/(S(2)*b**S(3)) - a*c*x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(2)) + c*x**S(3)*sqrt(c*x**S(2))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(a + b*x), x), x, -a**S(3)*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(4)*x) + a**S(2)*c*sqrt(c*x**S(2))/b**S(3) - a*c*x*sqrt(c*x**S(2))/(S(2)*b**S(2)) + c*x**S(2)*sqrt(c*x**S(2))/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x*(a + b*x)), x), x, a**S(2)*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(3)*x) - a*c*sqrt(c*x**S(2))/b**S(2) + c*x*sqrt(c*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(2)*(a + b*x)), x), x, -a*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*x) + c*sqrt(c*x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(3)*(a + b*x)), x), x, c*sqrt(c*x**S(2))*log(a + b*x)/(b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(4)*(a + b*x)), x), x, c*sqrt(c*x**S(2))*log(x)/(a*x) - c*sqrt(c*x**S(2))*log(a + b*x)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(5)*(a + b*x)), x), x, -c*sqrt(c*x**S(2))/(a*x**S(2)) - b*c*sqrt(c*x**S(2))*log(x)/(a**S(2)*x) + b*c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(6)*(a + b*x)), x), x, -c*sqrt(c*x**S(2))/(S(2)*a*x**S(3)) + b*c*sqrt(c*x**S(2))/(a**S(2)*x**S(2)) + b**S(2)*c*sqrt(c*x**S(2))*log(x)/(a**S(3)*x) - b**S(2)*c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(7)*(a + b*x)), x), x, -c*sqrt(c*x**S(2))/(S(3)*a*x**S(4)) + b*c*sqrt(c*x**S(2))/(S(2)*a**S(2)*x**S(3)) - b**S(2)*c*sqrt(c*x**S(2))/(a**S(3)*x**S(2)) - b**S(3)*c*sqrt(c*x**S(2))*log(x)/(a**S(4)*x) + b**S(3)*c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(a + b*x), x), x, -a**S(5)*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(6)*x) + a**S(4)*c**S(2)*sqrt(c*x**S(2))/b**S(5) - a**S(3)*c**S(2)*x*sqrt(c*x**S(2))/(S(2)*b**S(4)) + a**S(2)*c**S(2)*x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(3)) - a*c**S(2)*x**S(3)*sqrt(c*x**S(2))/(S(4)*b**S(2)) + c**S(2)*x**S(4)*sqrt(c*x**S(2))/(S(5)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x*(a + b*x)), x), x, a**S(4)*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(5)*x) - a**S(3)*c**S(2)*sqrt(c*x**S(2))/b**S(4) + a**S(2)*c**S(2)*x*sqrt(c*x**S(2))/(S(2)*b**S(3)) - a*c**S(2)*x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(2)) + c**S(2)*x**S(3)*sqrt(c*x**S(2))/(S(4)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(2)*(a + b*x)), x), x, -a**S(3)*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(4)*x) + a**S(2)*c**S(2)*sqrt(c*x**S(2))/b**S(3) - a*c**S(2)*x*sqrt(c*x**S(2))/(S(2)*b**S(2)) + c**S(2)*x**S(2)*sqrt(c*x**S(2))/(S(3)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(3)*(a + b*x)), x), x, a**S(2)*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(3)*x) - a*c**S(2)*sqrt(c*x**S(2))/b**S(2) + c**S(2)*x*sqrt(c*x**S(2))/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(4)*(a + b*x)), x), x, -a*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*x) + c**S(2)*sqrt(c*x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(5)*(a + b*x)), x), x, c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(6)*(a + b*x)), x), x, c**S(2)*sqrt(c*x**S(2))*log(x)/(a*x) - c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(a*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(5)/2)/(x**S(7)*(a + b*x)), x), x, -c**S(2)*sqrt(c*x**S(2))/(a*x**S(2)) - b*c**S(2)*sqrt(c*x**S(2))*log(x)/(a**S(2)*x) + b*c**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(sqrt(c*x**S(2))*(a + b*x)), x), x, -a**S(3)*x*log(a + b*x)/(b**S(4)*sqrt(c*x**S(2))) + a**S(2)*x**S(2)/(b**S(3)*sqrt(c*x**S(2))) - a*x**S(3)/(S(2)*b**S(2)*sqrt(c*x**S(2))) + x**S(4)/(S(3)*b*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(sqrt(c*x**S(2))*(a + b*x)), x), x, a**S(2)*x*log(a + b*x)/(b**S(3)*sqrt(c*x**S(2))) - a*x**S(2)/(b**S(2)*sqrt(c*x**S(2))) + x**S(3)/(S(2)*b*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(c*x**S(2))*(a + b*x)), x), x, -a*sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*c*x) + sqrt(c*x**S(2))/(b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(c*x**S(2))*(a + b*x)), x), x, x*log(a + b*x)/(b*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(c*x**S(2))*(a + b*x)), x), x, x*log(x)/(a*sqrt(c*x**S(2))) - x*log(a + b*x)/(a*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(c*x**S(2))*(a + b*x)), x), x, -S(1)/(a*sqrt(c*x**S(2))) - b*x*log(x)/(a**S(2)*sqrt(c*x**S(2))) + b*x*log(a + b*x)/(a**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(c*x**S(2))*(a + b*x)), x), x, -S(1)/(S(2)*a*x*sqrt(c*x**S(2))) + b/(a**S(2)*sqrt(c*x**S(2))) + b**S(2)*x*log(x)/(a**S(3)*sqrt(c*x**S(2))) - b**S(2)*x*log(a + b*x)/(a**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(c*x**S(2))*(a + b*x)), x), x, -S(1)/(S(3)*a*x**S(2)*sqrt(c*x**S(2))) + b/(S(2)*a**S(2)*x*sqrt(c*x**S(2))) - b**S(2)/(a**S(3)*sqrt(c*x**S(2))) - b**S(3)*x*log(x)/(a**S(4)*sqrt(c*x**S(2))) + b**S(3)*x*log(a + b*x)/(a**S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(6)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, -a**S(3)*x*log(a + b*x)/(b**S(4)*c*sqrt(c*x**S(2))) + a**S(2)*x**S(2)/(b**S(3)*c*sqrt(c*x**S(2))) - a*x**S(3)/(S(2)*b**S(2)*c*sqrt(c*x**S(2))) + x**S(4)/(S(3)*b*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, a**S(2)*x*log(a + b*x)/(b**S(3)*c*sqrt(c*x**S(2))) - a*x**S(2)/(b**S(2)*c*sqrt(c*x**S(2))) + x**S(3)/(S(2)*b*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, -a*x*log(a + b*x)/(b**S(2)*c*sqrt(c*x**S(2))) + x**S(2)/(b*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, x*log(a + b*x)/(b*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, x*log(x)/(a*c*sqrt(c*x**S(2))) - x*log(a + b*x)/(a*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, -S(1)/(a*c*sqrt(c*x**S(2))) - b*x*log(x)/(a**S(2)*c*sqrt(c*x**S(2))) + b*x*log(a + b*x)/(a**S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, -S(1)/(S(2)*a*c*x*sqrt(c*x**S(2))) + b/(a**S(2)*c*sqrt(c*x**S(2))) + b**S(2)*x*log(x)/(a**S(3)*c*sqrt(c*x**S(2))) - b**S(2)*x*log(a + b*x)/(a**S(3)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(c*x**S(2))**(S(3)/2)*(a + b*x)), x), x, -S(1)/(S(3)*a*c*x**S(2)*sqrt(c*x**S(2))) + b/(S(2)*a**S(2)*c*x*sqrt(c*x**S(2))) - b**S(2)/(a**S(3)*c*sqrt(c*x**S(2))) - b**S(3)*x*log(x)/(a**S(4)*c*sqrt(c*x**S(2))) + b**S(3)*x*log(a + b*x)/(a**S(4)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(c*x**S(2))/(a + b*x)**S(2), x), x, -a**S(4)*sqrt(c*x**S(2))/(b**S(5)*x*(a + b*x)) - S(4)*a**S(3)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(5)*x) + S(3)*a**S(2)*sqrt(c*x**S(2))/b**S(4) - a*x*sqrt(c*x**S(2))/b**S(3) + x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(c*x**S(2))/(a + b*x)**S(2), x), x, a**S(3)*sqrt(c*x**S(2))/(b**S(4)*x*(a + b*x)) + S(3)*a**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(b**S(4)*x) - S(2)*a*sqrt(c*x**S(2))/b**S(3) + x*sqrt(c*x**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(c*x**S(2))/(a + b*x)**S(2), x), x, -a**S(2)*sqrt(c*x**S(2))/(b**S(3)*x*(a + b*x)) - S(2)*a*sqrt(c*x**S(2))*log(a + b*x)/(b**S(3)*x) + sqrt(c*x**S(2))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(a + b*x)**S(2), x), x, a*sqrt(c*x**S(2))/(b**S(2)*x*(a + b*x)) + sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x*(a + b*x)**S(2)), x), x, -sqrt(c*x**S(2))/(b*x*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(2)*(a + b*x)**S(2)), x), x, sqrt(c*x**S(2))/(a*x*(a + b*x)) + sqrt(c*x**S(2))*log(x)/(a**S(2)*x) - sqrt(c*x**S(2))*log(a + b*x)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(3)*(a + b*x)**S(2)), x), x, -b*sqrt(c*x**S(2))/(a**S(2)*x*(a + b*x)) - sqrt(c*x**S(2))/(a**S(2)*x**S(2)) - S(2)*b*sqrt(c*x**S(2))*log(x)/(a**S(3)*x) + S(2)*b*sqrt(c*x**S(2))*log(a + b*x)/(a**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(c*x**S(2))/(x**S(4)*(a + b*x)**S(2)), x), x, -sqrt(c*x**S(2))/(S(2)*a**S(2)*x**S(3)) + b**S(2)*sqrt(c*x**S(2))/(a**S(3)*x*(a + b*x)) + S(2)*b*sqrt(c*x**S(2))/(a**S(3)*x**S(2)) + S(3)*b**S(2)*sqrt(c*x**S(2))*log(x)/(a**S(4)*x) - S(3)*b**S(2)*sqrt(c*x**S(2))*log(a + b*x)/(a**S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**(S(3)/2)/(a + b*x)**S(2), x), x, -a**S(4)*c*sqrt(c*x**S(2))/(b**S(5)*x*(a + b*x)) - S(4)*a**S(3)*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(5)*x) + S(3)*a**S(2)*c*sqrt(c*x**S(2))/b**S(4) - a*c*x*sqrt(c*x**S(2))/b**S(3) + c*x**S(2)*sqrt(c*x**S(2))/(S(3)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(a + b*x)**S(2), x), x, a**S(3)*c*sqrt(c*x**S(2))/(b**S(4)*x*(a + b*x)) + S(3)*a**S(2)*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(4)*x) - S(2)*a*c*sqrt(c*x**S(2))/b**S(3) + c*x*sqrt(c*x**S(2))/(S(2)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x*(a + b*x)**S(2)), x), x, -a**S(2)*c*sqrt(c*x**S(2))/(b**S(3)*x*(a + b*x)) - S(2)*a*c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(3)*x) + c*sqrt(c*x**S(2))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(2)*(a + b*x)**S(2)), x), x, a*c*sqrt(c*x**S(2))/(b**S(2)*x*(a + b*x)) + c*sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(3)*(a + b*x)**S(2)), x), x, -c*sqrt(c*x**S(2))/(b*x*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(4)*(a + b*x)**S(2)), x), x, c*sqrt(c*x**S(2))/(a*x*(a + b*x)) + c*sqrt(c*x**S(2))*log(x)/(a**S(2)*x) - c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(5)*(a + b*x)**S(2)), x), x, -b*c*sqrt(c*x**S(2))/(a**S(2)*x*(a + b*x)) - c*sqrt(c*x**S(2))/(a**S(2)*x**S(2)) - S(2)*b*c*sqrt(c*x**S(2))*log(x)/(a**S(3)*x) + S(2)*b*c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**(S(3)/2)/(x**S(6)*(a + b*x)**S(2)), x), x, -c*sqrt(c*x**S(2))/(S(2)*a**S(2)*x**S(3)) + b**S(2)*c*sqrt(c*x**S(2))/(a**S(3)*x*(a + b*x)) + S(2)*b*c*sqrt(c*x**S(2))/(a**S(3)*x**S(2)) + S(3)*b**S(2)*c*sqrt(c*x**S(2))*log(x)/(a**S(4)*x) - S(3)*b**S(2)*c*sqrt(c*x**S(2))*log(a + b*x)/(a**S(4)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, -a**S(4)*x/(b**S(5)*sqrt(c*x**S(2))*(a + b*x)) - S(4)*a**S(3)*x*log(a + b*x)/(b**S(5)*sqrt(c*x**S(2))) + S(3)*a**S(2)*x**S(2)/(b**S(4)*sqrt(c*x**S(2))) - a*x**S(3)/(b**S(3)*sqrt(c*x**S(2))) + x**S(4)/(S(3)*b**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, a**S(3)*x/(b**S(4)*sqrt(c*x**S(2))*(a + b*x)) + S(3)*a**S(2)*x*log(a + b*x)/(b**S(4)*sqrt(c*x**S(2))) - S(2)*a*x**S(2)/(b**S(3)*sqrt(c*x**S(2))) + x**S(3)/(S(2)*b**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, -a**S(2)*x/(b**S(3)*sqrt(c*x**S(2))*(a + b*x)) - S(2)*a*x*log(a + b*x)/(b**S(3)*sqrt(c*x**S(2))) + x**S(2)/(b**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, a*sqrt(c*x**S(2))/(b**S(2)*c*x*(a + b*x)) + sqrt(c*x**S(2))*log(a + b*x)/(b**S(2)*c*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, -x/(b*sqrt(c*x**S(2))*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, x/(a*sqrt(c*x**S(2))*(a + b*x)) + x*log(x)/(a**S(2)*sqrt(c*x**S(2))) - x*log(a + b*x)/(a**S(2)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, -b*x/(a**S(2)*sqrt(c*x**S(2))*(a + b*x)) - S(1)/(a**S(2)*sqrt(c*x**S(2))) - S(2)*b*x*log(x)/(a**S(3)*sqrt(c*x**S(2))) + S(2)*b*x*log(a + b*x)/(a**S(3)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(c*x**S(2))*(a + b*x)**S(2)), x), x, -S(1)/(S(2)*a**S(2)*x*sqrt(c*x**S(2))) + b**S(2)*x/(a**S(3)*sqrt(c*x**S(2))*(a + b*x)) + S(2)*b/(a**S(3)*sqrt(c*x**S(2))) + S(3)*b**S(2)*x*log(x)/(a**S(4)*sqrt(c*x**S(2))) - S(3)*b**S(2)*x*log(a + b*x)/(a**S(4)*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, -a**S(2)*x/(b**S(3)*c*sqrt(c*x**S(2))*(a + b*x)) - S(2)*a*x*log(a + b*x)/(b**S(3)*c*sqrt(c*x**S(2))) + x**S(2)/(b**S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, a*x/(b**S(2)*c*sqrt(c*x**S(2))*(a + b*x)) + x*log(a + b*x)/(b**S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, -x/(b*c*sqrt(c*x**S(2))*(a + b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, x/(a*c*sqrt(c*x**S(2))*(a + b*x)) + x*log(x)/(a**S(2)*c*sqrt(c*x**S(2))) - x*log(a + b*x)/(a**S(2)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, -b*x/(a**S(2)*c*sqrt(c*x**S(2))*(a + b*x)) - S(1)/(a**S(2)*c*sqrt(c*x**S(2))) - S(2)*b*x*log(x)/(a**S(3)*c*sqrt(c*x**S(2))) + S(2)*b*x*log(a + b*x)/(a**S(3)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((c*x**S(2))**(S(3)/2)*(a + b*x)**S(2)), x), x, -S(1)/(S(2)*a**S(2)*c*x*sqrt(c*x**S(2))) + b**S(2)*x/(a**S(3)*c*sqrt(c*x**S(2))*(a + b*x)) + S(2)*b/(a**S(3)*c*sqrt(c*x**S(2))) + S(3)*b**S(2)*x*log(x)/(a**S(4)*c*sqrt(c*x**S(2))) - S(3)*b**S(2)*x*log(a + b*x)/(a**S(4)*c*sqrt(c*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(c*x**S(2))**p*(a + b*x)**(-m - S(2)*p + S(-2)), x), x, x**(m + S(1))*(c*x**S(2))**p*(a + b*x)**(-m - S(2)*p + S(-1))/(a*(m + S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-5)), x), x, x**S(4)*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-4))/(S(2)*a*(p + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-4)), x), x, x**S(3)*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-3))/(a*(S(2)*p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-3)), x), x, x**S(2)*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-2))/(S(2)*a*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-2)), x), x, x*(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-1))/(a*(S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(-1))/x, x), x, (c*x**S(2))**p*(a + b*x)**(-S(2)*p)/(S(2)*a*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**p*(a + b*x)**(-S(2)*p)/x**S(2), x), x, -(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(1))/(a*x*(-S(2)*p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(1))/x**S(3), x), x, -(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(2))/(S(2)*a*x**S(2)*(-p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(2))/x**S(4), x), x, -(c*x**S(2))**p*(a + b*x)**(-S(2)*p + S(3))/(a*x**S(3)*(-S(2)*p + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(23))/sqrt(x**S(5) + S(1)), x), x, sqrt(a*x**S(23))*sqrt(x**S(5) + S(1))/(S(10)*x**S(4)) - S(3)*sqrt(a*x**S(23))*sqrt(x**S(5) + S(1))/(S(20)*x**S(9)) + S(3)*sqrt(a*x**S(23))*asinh(x**(S(5)/2))/(S(20)*x**(S(23)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(13))/sqrt(x**S(5) + S(1)), x), x, sqrt(a*x**S(13))*sqrt(x**S(5) + S(1))/(S(5)*x**S(4)) - sqrt(a*x**S(13))*asinh(x**(S(5)/2))/(S(5)*x**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(3))/sqrt(x**S(5) + S(1)), x), x, S(2)*sqrt(a*x**S(3))*asinh(x**(S(5)/2))/(S(5)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(7))/sqrt(x**S(5) + S(1)), x), x, -S(2)*x*sqrt(a/x**S(7))*sqrt(x**S(5) + S(1))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(17))/sqrt(x**S(5) + S(1)), x), x, S(4)*x**S(6)*sqrt(a/x**S(17))*sqrt(x**S(5) + S(1))/S(15) - S(2)*x*sqrt(a/x**S(17))*sqrt(x**S(5) + S(1))/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(6))/(x*(-x**S(4) + S(1))), x), x, -sqrt(a*x**S(6))*atan(x)/(S(2)*x**S(3)) + sqrt(a*x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(6))/(-x**S(5) + x), x), x, -sqrt(a*x**S(6))*atan(x)/(S(2)*x**S(3)) + sqrt(a*x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**S(6))**(S(3)/2)/(x*(-x**S(4) + S(1))), x), x, -a*x**S(2)*sqrt(a*x**S(6))/S(5) - a*sqrt(a*x**S(6))/x**S(2) + a*sqrt(a*x**S(6))*atan(x)/(S(2)*x**S(3)) + a*sqrt(a*x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-x**S(4) + S(1)) - sqrt(a*x**S(6))/(x*(-x**S(4) + S(1))), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(a*x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(a*x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-sqrt(a*x**S(6))/(-x**S(5) + x) + S(1)/(-x**S(4) + S(1)), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(a*x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(a*x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(3))/(-x**S(3) + x), x), x, -sqrt(a*x**S(3))*atan(sqrt(x))/x**(S(3)/2) + sqrt(a*x**S(3))*atanh(sqrt(x))/x**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(4))/sqrt(x**S(2) + S(1)), x), x, sqrt(a*x**S(4))*sqrt(x**S(2) + S(1))/(S(2)*x) - sqrt(a*x**S(4))*asinh(x)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(3))/sqrt(x**S(2) + S(1)), x), x, S(2)*sqrt(a*x**S(3))*sqrt(x**S(2) + S(1))/(S(3)*x) - sqrt(a*x**S(3))*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_f(S(2)*atan(sqrt(x)), S(1)/2)/(S(3)*x**(S(3)/2)*sqrt(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2))/sqrt(x**S(2) + S(1)), x), x, sqrt(a*x**S(2))*sqrt(x**S(2) + S(1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x)/sqrt(x**S(2) + S(1)), x), x, -S(2)*sqrt(a)*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_e(S(2)*atan(sqrt(a*x)/sqrt(a)), S(1)/2)/sqrt(x**S(2) + S(1)) + sqrt(a)*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_f(S(2)*atan(sqrt(a*x)/sqrt(a)), S(1)/2)/sqrt(x**S(2) + S(1)) + S(2)*sqrt(a*x)*sqrt(x**S(2) + S(1))/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x)/sqrt(x**S(2) + S(1)), x), x, sqrt(x)*sqrt(a/x)*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_f(S(2)*atan(sqrt(x)), S(1)/2)/sqrt(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(2))/sqrt(x**S(2) + S(1)), x), x, -x*sqrt(a/x**S(2))*atanh(sqrt(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(3))/sqrt(x**S(2) + S(1)), x), x, -S(2)*x**(S(3)/2)*sqrt(a/x**S(3))*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_e(S(2)*atan(sqrt(x)), S(1)/2)/sqrt(x**S(2) + S(1)) + x**(S(3)/2)*sqrt(a/x**S(3))*sqrt((x**S(2) + S(1))/(x + S(1))**S(2))*(x + S(1))*elliptic_f(S(2)*atan(sqrt(x)), S(1)/2)/sqrt(x**S(2) + S(1)) + S(2)*x**S(2)*sqrt(a/x**S(3))*sqrt(x**S(2) + S(1))/(x + S(1)) - S(2)*x*sqrt(a/x**S(3))*sqrt(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(4))/sqrt(x**S(2) + S(1)), x), x, -x*sqrt(a/x**S(4))*sqrt(x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(4))/sqrt(x**S(3) + S(1)), x), x, S(2)*sqrt(a*x**S(4))*sqrt(x**S(3) + S(1))/(S(3)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(3))/sqrt(x**S(3) + S(1)), x), x, -S(3)**(S(1)/4)*sqrt(a*x**S(3))*sqrt((x**S(2) - x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*(x + S(1))*elliptic_e(acos((x*(-sqrt(S(3)) + S(1)) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))), sqrt(S(3))/S(4) + S(1)/2)/(x*sqrt(x*(x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*sqrt(x**S(3) + S(1))) - S(3)**(S(3)/4)*sqrt(a*x**S(3))*sqrt((x**S(2) - x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*(-sqrt(S(3)) + S(1))*(x + S(1))*elliptic_f(acos((x*(-sqrt(S(3)) + S(1)) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))), sqrt(S(3))/S(4) + S(1)/2)/(S(6)*x*sqrt(x*(x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*sqrt(x**S(3) + S(1))) + sqrt(a*x**S(3))*(S(1) + sqrt(S(3)))*sqrt(x**S(3) + S(1))/(x*(x*(S(1) + sqrt(S(3))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2))/sqrt(x**S(3) + S(1)), x), x, S(2)*sqrt(a*x**S(2))*sqrt(x**S(3) + S(1))/(x*(x + S(1) + sqrt(S(3)))) - S(3)**(S(1)/4)*sqrt(a*x**S(2))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(x + S(1))*elliptic_e(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(x*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) + S(2)*sqrt(S(2))*S(3)**(S(3)/4)*sqrt(a*x**S(2))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*elliptic_f(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*x*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x)/sqrt(x**S(3) + S(1)), x), x, S(2)*sqrt(a)*asinh((a*x)**(S(3)/2)/a**(S(3)/2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x)/sqrt(x**S(3) + S(1)), x), x, S(3)**(S(3)/4)*x*sqrt(a/x)*sqrt((x**S(2) - x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*(x + S(1))*elliptic_f(acos((x*(-sqrt(S(3)) + S(1)) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))), sqrt(S(3))/S(4) + S(1)/2)/(S(3)*sqrt(x*(x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*sqrt(x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(2))/sqrt(x**S(3) + S(1)), x), x, -S(2)*x*sqrt(a/x**S(2))*atanh(sqrt(x**S(3) + S(1)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(3))/sqrt(x**S(3) + S(1)), x), x, -S(2)*S(3)**(S(1)/4)*x**S(2)*sqrt(a/x**S(3))*sqrt((x**S(2) - x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*(x + S(1))*elliptic_e(acos((x*(-sqrt(S(3)) + S(1)) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))), sqrt(S(3))/S(4) + S(1)/2)/(sqrt(x*(x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*sqrt(x**S(3) + S(1))) - S(3)**(S(3)/4)*x**S(2)*sqrt(a/x**S(3))*sqrt((x**S(2) - x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*(-sqrt(S(3)) + S(1))*(x + S(1))*elliptic_f(acos((x*(-sqrt(S(3)) + S(1)) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))), sqrt(S(3))/S(4) + S(1)/2)/(S(3)*sqrt(x*(x + S(1))/(x*(S(1) + sqrt(S(3))) + S(1))**S(2))*sqrt(x**S(3) + S(1))) + x**S(2)*sqrt(a/x**S(3))*(S(2) + S(2)*sqrt(S(3)))*sqrt(x**S(3) + S(1))/(x*(S(1) + sqrt(S(3))) + S(1)) - S(2)*x*sqrt(a/x**S(3))*sqrt(x**S(3) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a/x**S(4))/sqrt(x**S(3) + S(1)), x), x, x**S(2)*sqrt(a/x**S(4))*sqrt(x**S(3) + S(1))/(x + S(1) + sqrt(S(3))) - S(3)**(S(1)/4)*x**S(2)*sqrt(a/x**S(4))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(x + S(1))*elliptic_e(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(2)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) + sqrt(S(2))*S(3)**(S(3)/4)*x**S(2)*sqrt(a/x**S(4))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*elliptic_f(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) - x*sqrt(a/x**S(4))*sqrt(x**S(3) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**(S(2)*n))/sqrt(x**n + S(1)), x), x, x*sqrt(a*x**(S(2)*n))*hyper((S(1)/2, S(1) + S(1)/n), (S(2) + S(1)/n,), -x**n)/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**n)/sqrt(x**n + S(1)), x), x, S(2)*x*sqrt(a*x**n)*hyper((S(1)/2, S(1)/2 + S(1)/n), (S(3)/2 + S(1)/n,), -x**n)/(n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**(n/S(2)))/sqrt(x**n + S(1)), x), x, S(4)*x*sqrt(a*x**(n/S(2)))*hyper((S(1)/2, S(1)/4 + S(1)/n), (S(5)/4 + S(1)/n,), -x**n)/(n + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**(S(2)*n))/sqrt(x**n + S(1)) + S(2)*x**(-n)*sqrt(a*x**(S(2)*n))/((n + S(2))*sqrt(x**n + S(1))), x), x, S(2)*x**(-n + S(1))*sqrt(a*x**(S(2)*n))*sqrt(x**n + S(1))/(n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x)/(sqrt(d + e*x)*sqrt(e + f*x)), x), x, S(2)*sqrt(a*x)*sqrt(e*(e + f*x)/(-d*f + e**S(2)))*sqrt(d*f - e**S(2))*elliptic_e(asin(sqrt(f)*sqrt(d + e*x)/sqrt(d*f - e**S(2))), S(1) - e**S(2)/(d*f))/(e*sqrt(f)*sqrt(-e*x/d)*sqrt(e + f*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**m)**r, x), x, x*(a*x**m)**r/(m*r + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**m)**r*(b*x**n)**s, x), x, x*(a*x**m)**r*(b*x**n)**s/(m*r + n*s + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x**m)**r*(b*x**n)**s*(c*x**p)**t, x), x, x*(a*x**m)**r*(b*x**n)**s*(c*x**p)**t/(m*r + n*s + p*t + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**p, x), x, -a*x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(1))/(b**S(2)*(p + S(1))) + x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**(p + S(2))/(b**S(2)*(p + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(3), x), x, -a*x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(4)/(S(4)*b**S(2)) + x*(c*x**n)**(-S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(5)/(S(5)*b**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)*(a + b*(c*x**n)**(S(1)/n))**S(2), x), x, a**S(2)*x*(c*x**n)**(S(1)/n)/S(2) + S(2)*a*b*x*(c*x**n)**(S(2)/n)/S(3) + b**S(2)*x*(c*x**n)**(S(3)/n)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)*(a + b*(c*x**n)**(S(1)/n)), x), x, a*x*(c*x**n)**(S(1)/n)/S(2) + b*x*(c*x**n)**(S(2)/n)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)/(a + b*(c*x**n)**(S(1)/n)), x), x, -a*x*(c*x**n)**(-S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(2) + x/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)/(a + b*(c*x**n)**(S(1)/n))**S(2), x), x, a*x*(c*x**n)**(-S(1)/n)/(b**S(2)*(a + b*(c*x**n)**(S(1)/n))) + x*(c*x**n)**(-S(1)/n)*log(a + b*(c*x**n)**(S(1)/n))/b**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)/(a + b*(c*x**n)**(S(1)/n))**S(3), x), x, x*(c*x**n)**(S(1)/n)/(S(2)*a*(a + b*(c*x**n)**(S(1)/n))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)/(a + b*(c*x**n)**(S(1)/n))**S(4), x), x, a*x*(c*x**n)**(-S(1)/n)/(S(3)*b**S(2)*(a + b*(c*x**n)**(S(1)/n))**S(3)) - x*(c*x**n)**(-S(1)/n)/(S(2)*b**S(2)*(a + b*(c*x**n)**(S(1)/n))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*x**n)**(S(1)/n)/(a + b*(c*x**n)**(S(1)/n))**S(5), x), x, a*x*(c*x**n)**(-S(1)/n)/(S(4)*b**S(2)*(a + b*(c*x**n)**(S(1)/n))**S(4)) - x*(c*x**n)**(-S(1)/n)/(S(3)*b**S(2)*(a + b*(c*x**n)**(S(1)/n))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(b*x + c)), x), x, S(2)*a**S(2)*(a + b*x)**(S(3)/2)/(S(3)*b**S(3)*(a - c)) - S(4)*a*(a + b*x)**(S(5)/2)/(S(5)*b**S(3)*(a - c)) - S(2)*c**S(2)*(b*x + c)**(S(3)/2)/(S(3)*b**S(3)*(a - c)) + S(4)*c*(b*x + c)**(S(5)/2)/(S(5)*b**S(3)*(a - c)) + S(2)*(a + b*x)**(S(7)/2)/(S(7)*b**S(3)*(a - c)) - S(2)*(b*x + c)**(S(7)/2)/(S(7)*b**S(3)*(a - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(b*x + c)), x), x, -S(2)*a*(a + b*x)**(S(3)/2)/(S(3)*b**S(2)*(a - c)) + S(2)*c*(b*x + c)**(S(3)/2)/(S(3)*b**S(2)*(a - c)) + S(2)*(a + b*x)**(S(5)/2)/(S(5)*b**S(2)*(a - c)) - S(2)*(b*x + c)**(S(5)/2)/(S(5)*b**S(2)*(a - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*x) + sqrt(b*x + c)), x), x, S(2)*(a + b*x)**(S(3)/2)/(S(3)*b*(a - c)) - S(2)*(b*x + c)**(S(3)/2)/(S(3)*b*(a - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(sqrt(a + b*x) + sqrt(b*x + c))), x), x, -S(2)*sqrt(a)*atanh(sqrt(a + b*x)/sqrt(a))/(a - c) + S(2)*sqrt(c)*atanh(sqrt(b*x + c)/sqrt(c))/(a - c) + S(2)*sqrt(a + b*x)/(a - c) - S(2)*sqrt(b*x + c)/(a - c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(b*x + c))), x), x, b*atanh(sqrt(b*x + c)/sqrt(c))/(sqrt(c)*(a - c)) - sqrt(a + b*x)/(x*(a - c)) + sqrt(b*x + c)/(x*(a - c)) - b*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(a - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(b*x + c))**S(2), x), x, b*x**S(4)/(S(2)*(a - c)**S(2)) + x**S(3)*(a + c)/(S(3)*(a - c)**S(2)) - x*(a + b*x)**(S(3)/2)*(b*x + c)**(S(3)/2)/(S(2)*b**S(2)*(a - c)**S(2)) - (S(4)*a*c - S(5)*(a + c)**S(2))*atanh(sqrt(a + b*x)/sqrt(b*x + c))/(S(32)*b**S(3)) - sqrt(a + b*x)*(S(4)*a*c - S(5)*(a + c)**S(2))*sqrt(b*x + c)/(S(32)*b**S(3)*(a - c)) + (a + b*x)**(S(3)/2)*(S(5)*a + S(5)*c)*(b*x + c)**(S(3)/2)/(S(12)*b**S(3)*(a - c)**S(2)) + (a + b*x)**(S(3)/2)*(S(4)*a*c - S(5)*(a + c)**S(2))*sqrt(b*x + c)/(S(16)*b**S(3)*(a - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(b*x + c))**S(2), x), x, S(2)*b*x**S(3)/(S(3)*(a - c)**S(2)) + x**S(2)*(a + c)/(S(2)*(a - c)**S(2)) - (a + c)*atanh(sqrt(a + b*x)/sqrt(b*x + c))/(S(4)*b**S(2)) - (a + c)*sqrt(a + b*x)*sqrt(b*x + c)/(S(4)*b**S(2)*(a - c)) + (a + c)*(a + b*x)**(S(3)/2)*sqrt(b*x + c)/(S(2)*b**S(2)*(a - c)**S(2)) - S(2)*(a + b*x)**(S(3)/2)*(b*x + c)**(S(3)/2)/(S(3)*b**S(2)*(a - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(b*x + c))**(S(-2)), x), x, (a - c)**S(2)/(S(8)*b*(sqrt(a + b*x) + sqrt(b*x + c))**S(4)) + atanh(sqrt(a + b*x)/sqrt(b*x + c))/(S(2)*b), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(b*x + c))**(S(-2)), x), x, b*x**S(2)/(a - c)**S(2) + x*(a + c)/(a - c)**S(2) + atanh(sqrt(a + b*x)/sqrt(b*x + c))/(S(2)*b) + sqrt(a + b*x)*sqrt(b*x + c)/(S(2)*b*(a - c)) - (a + b*x)**(S(3)/2)*sqrt(b*x + c)/(b*(a - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(sqrt(a + b*x) + sqrt(b*x + c))**S(2)), x), x, S(4)*sqrt(a)*sqrt(c)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(a)*sqrt(b*x + c)))/(a - c)**S(2) + S(2)*b*x/(a - c)**S(2) + (a + c)*log(x)/(a - c)**S(2) - S(2)*sqrt(a + b*x)*sqrt(b*x + c)/(a - c)**S(2) - (S(2)*a + S(2)*c)*atanh(sqrt(a + b*x)/sqrt(b*x + c))/(a - c)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(b*x + c))**S(2)), x), x, S(2)*b*log(x)/(a - c)**S(2) - S(4)*b*atanh(sqrt(a + b*x)/sqrt(b*x + c))/(a - c)**S(2) - (a + c)/(x*(a - c)**S(2)) + S(2)*sqrt(a + b*x)*sqrt(b*x + c)/(x*(a - c)**S(2)) + S(2)*b*(a + c)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(a)*sqrt(b*x + c)))/(sqrt(a)*sqrt(c)*(a - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(b*x + c))**S(3), x), x, -S(8)*a**S(3)*(a + b*x)**(S(3)/2)/(S(3)*b**S(3)*(a - c)**S(3)) + S(2)*a**S(2)*(a + S(3)*c)*(a + b*x)**(S(3)/2)/(S(3)*b**S(3)*(a - c)**S(3)) + S(24)*a**S(2)*(a + b*x)**(S(5)/2)/(S(5)*b**S(3)*(a - c)**S(3)) - S(4)*a*(a + S(3)*c)*(a + b*x)**(S(5)/2)/(S(5)*b**S(3)*(a - c)**S(3)) - S(24)*a*(a + b*x)**(S(7)/2)/(S(7)*b**S(3)*(a - c)**S(3)) + S(8)*c**S(3)*(b*x + c)**(S(3)/2)/(S(3)*b**S(3)*(a - c)**S(3)) - S(2)*c**S(2)*(S(3)*a + c)*(b*x + c)**(S(3)/2)/(S(3)*b**S(3)*(a - c)**S(3)) - S(24)*c**S(2)*(b*x + c)**(S(5)/2)/(S(5)*b**S(3)*(a - c)**S(3)) + S(4)*c*(S(3)*a + c)*(b*x + c)**(S(5)/2)/(S(5)*b**S(3)*(a - c)**S(3)) + S(24)*c*(b*x + c)**(S(7)/2)/(S(7)*b**S(3)*(a - c)**S(3)) + S(8)*(a + b*x)**(S(9)/2)/(S(9)*b**S(3)*(a - c)**S(3)) + (a + b*x)**(S(7)/2)*(S(2)*a + S(6)*c)/(S(7)*b**S(3)*(a - c)**S(3)) - (S(6)*a + S(2)*c)*(b*x + c)**(S(7)/2)/(S(7)*b**S(3)*(a - c)**S(3)) - S(8)*(b*x + c)**(S(9)/2)/(S(9)*b**S(3)*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(b*x + c))**S(3), x), x, S(8)*a**S(2)*(a + b*x)**(S(3)/2)/(S(3)*b**S(2)*(a - c)**S(3)) - S(2)*a*(a + S(3)*c)*(a + b*x)**(S(3)/2)/(S(3)*b**S(2)*(a - c)**S(3)) - S(16)*a*(a + b*x)**(S(5)/2)/(S(5)*b**S(2)*(a - c)**S(3)) - S(8)*c**S(2)*(b*x + c)**(S(3)/2)/(S(3)*b**S(2)*(a - c)**S(3)) + S(2)*c*(S(3)*a + c)*(b*x + c)**(S(3)/2)/(S(3)*b**S(2)*(a - c)**S(3)) + S(16)*c*(b*x + c)**(S(5)/2)/(S(5)*b**S(2)*(a - c)**S(3)) + S(8)*(a + b*x)**(S(7)/2)/(S(7)*b**S(2)*(a - c)**S(3)) + (a + b*x)**(S(5)/2)*(S(2)*a + S(6)*c)/(S(5)*b**S(2)*(a - c)**S(3)) - (S(6)*a + S(2)*c)*(b*x + c)**(S(5)/2)/(S(5)*b**S(2)*(a - c)**S(3)) - S(8)*(b*x + c)**(S(7)/2)/(S(7)*b**S(2)*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(b*x + c))**(S(-3)), x), x, (a - c)**S(2)/(S(10)*b*(sqrt(a + b*x) + sqrt(b*x + c))**S(5)) - S(1)/(S(2)*b*(sqrt(a + b*x) + sqrt(b*x + c))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(b*x + c))**(S(-3)), x), x, -S(8)*a*(a + b*x)**(S(3)/2)/(S(3)*b*(a - c)**S(3)) + S(8)*c*(b*x + c)**(S(3)/2)/(S(3)*b*(a - c)**S(3)) + S(8)*(a + b*x)**(S(5)/2)/(S(5)*b*(a - c)**S(3)) + (a + b*x)**(S(3)/2)*(S(2)*a + S(6)*c)/(S(3)*b*(a - c)**S(3)) - (S(6)*a + S(2)*c)*(b*x + c)**(S(3)/2)/(S(3)*b*(a - c)**S(3)) - S(8)*(b*x + c)**(S(5)/2)/(S(5)*b*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(sqrt(a + b*x) + sqrt(b*x + c))**S(3)), x), x, -S(2)*sqrt(a)*(a + S(3)*c)*atanh(sqrt(a + b*x)/sqrt(a))/(a - c)**S(3) + S(2)*sqrt(c)*(S(3)*a + c)*atanh(sqrt(b*x + c)/sqrt(c))/(a - c)**S(3) + S(8)*(a + b*x)**(S(3)/2)/(S(3)*(a - c)**S(3)) + sqrt(a + b*x)*(S(2)*a + S(6)*c)/(a - c)**S(3) - (S(6)*a + S(2)*c)*sqrt(b*x + c)/(a - c)**S(3) - S(8)*(b*x + c)**(S(3)/2)/(S(3)*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(b*x + c))**S(3)), x), x, S(8)*b*sqrt(a + b*x)/(a - c)**S(3) - S(8)*b*sqrt(b*x + c)/(a - c)**S(3) - S(3)*b*(a + S(3)*c)*atanh(sqrt(b*x + c)/sqrt(c))/(sqrt(c)*(-a + c)**S(3)) - (a + S(3)*c)*sqrt(a + b*x)/(x*(a - c)**S(3)) + (S(3)*a + c)*sqrt(b*x + c)/(x*(a - c)**S(3)) - S(3)*b*(S(3)*a + c)*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(b*x + c))**S(3)), x), x, -S(8)*sqrt(a)*b*atanh(sqrt(a + b*x)/sqrt(a))/(a - c)**S(3) + S(8)*b*sqrt(c)*atanh(sqrt(b*x + c)/sqrt(c))/(a - c)**S(3) + S(8)*b*sqrt(a + b*x)/(a - c)**S(3) - S(8)*b*sqrt(b*x + c)/(a - c)**S(3) + b*(S(3)*a + c)*atanh(sqrt(b*x + c)/sqrt(c))/(sqrt(c)*(a - c)**S(3)) - (a + S(3)*c)*sqrt(a + b*x)/(x*(a - c)**S(3)) + (S(3)*a + c)*sqrt(b*x + c)/(x*(a - c)**S(3)) - b*(a + S(3)*c)*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(a - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x) + sqrt(x + S(1))), x), x, -S(2)*x**(S(3)/2)/S(3) + S(2)*(x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x) + sqrt(x + S(-1))), x), x, S(2)*x**(S(3)/2)/S(3) - S(2)*(x + S(-1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x + S(-1)) + sqrt(x + S(1))), x), x, -(x + S(-1))**(S(3)/2)/S(3) + (x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2), x), x, x**S(4)/S(2) + S(2)*(-x**S(2) + S(1))**(S(5)/2)/S(5) - S(2)*(-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2), x), x, x**S(3)*sqrt(-x**S(2) + S(1))/S(2) + S(2)*x**S(3)/S(3) - x*sqrt(-x**S(2) + S(1))/S(4) + asin(x)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2), x), x, x**S(2) - S(2)*(-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2), x), x, x*sqrt(-x**S(2) + S(1)) + S(2)*x + asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2)/x, x), x, S(2)*sqrt(-x**S(2) + S(1)) + S(2)*log(x) - S(2)*atanh(sqrt(-x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2)/x**S(2), x), x, -S(2)*asin(x) - S(2)*sqrt(-x**S(2) + S(1))/x - S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x + S(1)) + sqrt(x + S(1)))**S(2)/x**S(3), x), x, atanh(sqrt(-x**S(2) + S(1))) - sqrt(-x**S(2) + S(1))/x**S(2) - S(1)/x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(sqrt(a + b*x) + sqrt(a + c*x)), x), x, -S(2)*a**S(2)*(a + c*x)**(S(3)/2)/(c**S(3)*(S(3)*b - S(3)*c)) + S(2)*a**S(2)*(a + b*x)**(S(3)/2)/(S(3)*b**S(3)*(b - c)) + S(4)*a*(a + c*x)**(S(5)/2)/(c**S(3)*(S(5)*b - S(5)*c)) - S(4)*a*(a + b*x)**(S(5)/2)/(S(5)*b**S(3)*(b - c)) - S(2)*(a + c*x)**(S(7)/2)/(c**S(3)*(S(7)*b - S(7)*c)) + S(2)*(a + b*x)**(S(7)/2)/(S(7)*b**S(3)*(b - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(a + c*x)), x), x, S(2)*a*(a + c*x)**(S(3)/2)/(c**S(2)*(S(3)*b - S(3)*c)) - S(2)*a*(a + b*x)**(S(3)/2)/(S(3)*b**S(2)*(b - c)) - S(2)*(a + c*x)**(S(5)/2)/(c**S(2)*(S(5)*b - S(5)*c)) + S(2)*(a + b*x)**(S(5)/2)/(S(5)*b**S(2)*(b - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(a + c*x)), x), x, -S(2)*(a + c*x)**(S(3)/2)/(c*(S(3)*b - S(3)*c)) + S(2)*(a + b*x)**(S(3)/2)/(S(3)*b*(b - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*x) + sqrt(a + c*x)), x), x, -S(2)*sqrt(a)*atanh(sqrt(a + b*x)/sqrt(a))/(b - c) + S(2)*sqrt(a)*atanh(sqrt(a + c*x)/sqrt(a))/(b - c) + S(2)*sqrt(a + b*x)/(b - c) - S(2)*sqrt(a + c*x)/(b - c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(sqrt(a + b*x) + sqrt(a + c*x))), x), x, -sqrt(a + b*x)/(x*(b - c)) + sqrt(a + c*x)/(x*(b - c)) - b*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(b - c)) + c*atanh(sqrt(a + c*x)/sqrt(a))/(sqrt(a)*(b - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(a + c*x))), x), x, -sqrt(a + b*x)/(x**S(2)*(S(2)*b - S(2)*c)) + sqrt(a + c*x)/(x**S(2)*(S(2)*b - S(2)*c)) - b*sqrt(a + b*x)/(S(4)*a*x*(b - c)) + c*sqrt(a + c*x)/(S(4)*a*x*(b - c)) + b**S(2)*atanh(sqrt(a + b*x)/sqrt(a))/(S(4)*a**(S(3)/2)*(b - c)) - c**S(2)*atanh(sqrt(a + c*x)/sqrt(a))/(S(4)*a**(S(3)/2)*(b - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(sqrt(a + b*x) + sqrt(a + c*x))**S(2), x), x, -a**S(3)*(b + c)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(b)*sqrt(a + c*x)))/(S(4)*b**(S(5)/2)*c**(S(5)/2)) + a**S(2)*sqrt(a + b*x)*sqrt(a + c*x)*(b + c)/(S(4)*b**S(2)*c**S(2)*(b - c)) + a*x**S(2)/(b - c)**S(2) + a*(a + b*x)**(S(3)/2)*sqrt(a + c*x)*(b + c)/(S(2)*b**S(2)*c*(b - c)**S(2)) + x**S(3)*(b + c)/(S(3)*(b - c)**S(2)) - S(2)*(a + b*x)**(S(3)/2)*(a + c*x)**(S(3)/2)/(S(3)*b*c*(b - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(a + c*x))**S(2), x), x, a**S(2)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(b)*sqrt(a + c*x)))/(S(2)*b**(S(3)/2)*c**(S(3)/2)) + S(2)*a*x/(b - c)**S(2) - a*sqrt(a + b*x)*sqrt(a + c*x)/(S(2)*b*c*(b - c)) + x**S(2)*(b + c)/(S(2)*(b - c)**S(2)) - (a + b*x)**(S(3)/2)*sqrt(a + c*x)/(b*(b - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(a + c*x))**S(2), x), x, S(2)*a*log(x)/(b - c)**S(2) + S(4)*a*atanh(sqrt(a + b*x)/sqrt(a + c*x))/(b - c)**S(2) - S(2)*a*(b + c)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(b)*sqrt(a + c*x)))/(sqrt(b)*sqrt(c)*(b - c)**S(2)) + x*(b + c)/(b - c)**S(2) - S(2)*sqrt(a + b*x)*sqrt(a + c*x)/(b - c)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(a + c*x))**(S(-2)), x), x, -S(2)*a/(x*(b - c)**S(2)) - S(4)*sqrt(b)*sqrt(c)*atanh(sqrt(c)*sqrt(a + b*x)/(sqrt(b)*sqrt(a + c*x)))/(b - c)**S(2) + (b + c)*log(x)/(b - c)**S(2) + (S(2)*b + S(2)*c)*atanh(sqrt(a + b*x)/sqrt(a + c*x))/(b - c)**S(2) + S(2)*sqrt(a + b*x)*sqrt(a + c*x)/(x*(b - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(sqrt(a + b*x) + sqrt(a + c*x))**S(2)), x), x, -a/(x**S(2)*(b - c)**S(2)) - (b + c)/(x*(b - c)**S(2)) - atanh(sqrt(a + b*x)/sqrt(a + c*x))/(S(2)*a) + sqrt(a + b*x)*sqrt(a + c*x)/(S(2)*a*x*(b - c)) + sqrt(a + b*x)*(a + c*x)**(S(3)/2)/(a*x**S(2)*(b - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(sqrt(a + b*x) + sqrt(a + c*x))**S(2)), x), x, -S(2)*a/(S(3)*x**S(3)*(b - c)**S(2)) - (b + c)/(S(2)*x**S(2)*(b - c)**S(2)) + (b + c)*atanh(sqrt(a + b*x)/sqrt(a + c*x))/(S(4)*a**S(2)) - sqrt(a + b*x)*sqrt(a + c*x)*(b + c)/(S(4)*a**S(2)*x*(b - c)) - sqrt(a + b*x)*(a + c*x)**(S(3)/2)*(b + c)/(S(2)*a**S(2)*x**S(2)*(b - c)**S(2)) + S(2)*(a + b*x)**(S(3)/2)*(a + c*x)**(S(3)/2)/(S(3)*a**S(2)*x**S(3)*(b - c)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(4)/(sqrt(a + b*x) + sqrt(a + c*x))**S(3), x), x, S(8)*a**S(2)*(a + c*x)**(S(3)/2)/(S(3)*c**S(2)*(b - c)**S(3)) - S(2)*a**S(2)*(a + c*x)**(S(3)/2)*(S(3)*b + c)/(S(3)*c**S(3)*(b - c)**S(3)) - S(8)*a**S(2)*(a + b*x)**(S(3)/2)/(S(3)*b**S(2)*(b - c)**S(3)) + S(2)*a**S(2)*(a + b*x)**(S(3)/2)*(b + S(3)*c)/(S(3)*b**S(3)*(b - c)**S(3)) - S(8)*a*(a + c*x)**(S(5)/2)/(S(5)*c**S(2)*(b - c)**S(3)) + S(4)*a*(a + c*x)**(S(5)/2)*(S(3)*b + c)/(S(5)*c**S(3)*(b - c)**S(3)) + S(8)*a*(a + b*x)**(S(5)/2)/(S(5)*b**S(2)*(b - c)**S(3)) - S(4)*a*(a + b*x)**(S(5)/2)*(b + S(3)*c)/(S(5)*b**S(3)*(b - c)**S(3)) - (a + c*x)**(S(7)/2)*(S(6)*b + S(2)*c)/(S(7)*c**S(3)*(b - c)**S(3)) + (a + b*x)**(S(7)/2)*(S(2)*b + S(6)*c)/(S(7)*b**S(3)*(b - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(sqrt(a + b*x) + sqrt(a + c*x))**S(3), x), x, -S(8)*a*(a + c*x)**(S(3)/2)/(S(3)*c*(b - c)**S(3)) + S(2)*a*(a + c*x)**(S(3)/2)*(S(3)*b + c)/(S(3)*c**S(2)*(b - c)**S(3)) + S(8)*a*(a + b*x)**(S(3)/2)/(S(3)*b*(b - c)**S(3)) - S(2)*a*(a + b*x)**(S(3)/2)*(b + S(3)*c)/(S(3)*b**S(2)*(b - c)**S(3)) - (a + c*x)**(S(5)/2)*(S(6)*b + S(2)*c)/(S(5)*c**S(2)*(b - c)**S(3)) + (a + b*x)**(S(5)/2)*(S(2)*b + S(6)*c)/(S(5)*b**S(2)*(b - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(a + b*x) + sqrt(a + c*x))**S(3), x), x, -S(8)*a**(S(3)/2)*atanh(sqrt(a + b*x)/sqrt(a))/(b - c)**S(3) + S(8)*a**(S(3)/2)*atanh(sqrt(a + c*x)/sqrt(a))/(b - c)**S(3) + S(8)*a*sqrt(a + b*x)/(b - c)**S(3) - S(8)*a*sqrt(a + c*x)/(b - c)**S(3) - (a + c*x)**(S(3)/2)*(S(6)*b + S(2)*c)/(S(3)*c*(b - c)**S(3)) + (a + b*x)**(S(3)/2)*(S(2)*b + S(6)*c)/(S(3)*b*(b - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(a + c*x))**S(3), x), x, -S(6)*sqrt(a)*(b + c)*atanh(sqrt(a + b*x)/sqrt(a))/(b - c)**S(3) + S(6)*sqrt(a)*(b + c)*atanh(sqrt(a + c*x)/sqrt(a))/(b - c)**S(3) - S(4)*a*sqrt(a + b*x)/(x*(b - c)**S(3)) + S(4)*a*sqrt(a + c*x)/(x*(b - c)**S(3)) + sqrt(a + b*x)*(S(2)*b + S(6)*c)/(b - c)**S(3) - sqrt(a + c*x)*(S(6)*b + S(2)*c)/(b - c)**S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x/(sqrt(a + b*x) + sqrt(a + c*x))**S(3), x), x, -S(4)*sqrt(a)*b*atanh(sqrt(a + b*x)/sqrt(a))/(b - c)**S(3) + S(4)*sqrt(a)*c*atanh(sqrt(a + c*x)/sqrt(a))/(b - c)**S(3) - S(2)*sqrt(a)*(b + S(3)*c)*atanh(sqrt(a + b*x)/sqrt(a))/(b - c)**S(3) + S(2)*sqrt(a)*(S(3)*b + c)*atanh(sqrt(a + c*x)/sqrt(a))/(b - c)**S(3) - S(4)*a*sqrt(a + b*x)/(x*(b - c)**S(3)) + S(4)*a*sqrt(a + c*x)/(x*(b - c)**S(3)) + sqrt(a + b*x)*(S(2)*b + S(6)*c)/(b - c)**S(3) - sqrt(a + c*x)*(S(6)*b + S(2)*c)/(b - c)**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(a + c*x))**(S(-3)), x), x, -S(2)*a*sqrt(a + b*x)/(x**S(2)*(b - c)**S(3)) + S(2)*a*sqrt(a + c*x)/(x**S(2)*(b - c)**S(3)) - sqrt(a + b*x)*(S(2)*b + S(3)*c)/(x*(b - c)**S(3)) + sqrt(a + c*x)*(S(3)*b + S(2)*c)/(x*(b - c)**S(3)) - S(3)*b*c*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)) + S(3)*b*c*atanh(sqrt(a + c*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((sqrt(a + b*x) + sqrt(a + c*x))**(S(-3)), x), x, -S(2)*a*sqrt(a + b*x)/(x**S(2)*(b - c)**S(3)) + S(2)*a*sqrt(a + c*x)/(x**S(2)*(b - c)**S(3)) - b*sqrt(a + b*x)/(x*(b - c)**S(3)) + c*sqrt(a + c*x)/(x*(b - c)**S(3)) - sqrt(a + b*x)*(b + S(3)*c)/(x*(b - c)**S(3)) + sqrt(a + c*x)*(S(3)*b + c)/(x*(b - c)**S(3)) + b**S(2)*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)) - b*(b + S(3)*c)*atanh(sqrt(a + b*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)) - c**S(2)*atanh(sqrt(a + c*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)) + c*(S(3)*b + c)*atanh(sqrt(a + c*x)/sqrt(a))/(sqrt(a)*(b - c)**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1))*(sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, -x**S(2)/S(2) + x*sqrt(-x**S(2) + S(1))/S(2) + x + asin(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, -x**S(4)/S(2) - S(2)*(-x**S(2) + S(1))**(S(5)/2)/S(5) + S(2)*(-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, -x**S(3)*sqrt(-x**S(2) + S(1))/S(2) - S(2)*x**S(3)/S(3) + x*sqrt(-x**S(2) + S(1))/S(4) - asin(x)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, -x**S(2) + S(2)*(-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, -x*sqrt(-x**S(2) + S(1)) - S(2)*x - asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1)))/x, x), x, -S(2)*sqrt(-x**S(2) + S(1)) - S(2)*log(x) + S(2)*atanh(sqrt(-x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1)))/x**S(2), x), x, S(2)*asin(x) + S(2)*sqrt(-x**S(2) + S(1))/x + S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(-x + S(1)) - sqrt(x + S(1)))*(sqrt(-x + S(1)) + sqrt(x + S(1)))/x**S(3), x), x, -atanh(sqrt(-x**S(2) + S(1))) + sqrt(-x**S(2) + S(1))/x**S(2) + x**(S(-2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x + S(1)) + sqrt(x + S(1)))/(-sqrt(-x + S(1)) + sqrt(x + S(1))), x), x, sqrt(-x**S(2) + S(1)) + log(x) - atanh(sqrt(-x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(x + S(-1)) + sqrt(x + S(1)))/(sqrt(x + S(-1)) + sqrt(x + S(1))), x), x, x**S(2)/S(2) - x*sqrt(x + S(-1))*sqrt(x + S(1))/S(2) + acosh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**n, x), x, a*f**S(2)*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/d)/(S(2)*d**S(2)*e*(n + S(1))) + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(2)*e*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(3), x), x, -a*d**S(3)*f**S(2)/(S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + S(3)*a*d**S(2)*f**S(2)*log(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e) + a*d*f**S(2)*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/e + a*f**S(2)*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(2)/(S(4)*e) + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(4)/(S(8)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(2), x), x, -a*d**S(2)*f**S(2)/(S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + a*d*f**S(2)*log(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/e + a*f**S(2)*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e) + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(3)/(S(6)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)), x), x, a*f**S(2)*atanh(e*x/(f*sqrt(a + e**S(2)*x**S(2)/f**S(2))))/(S(2)*e) + d*x + e*x**S(2)/S(2) + f*x*sqrt(a + e**S(2)*x**S(2)/f**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2))), x), x, -a*f**S(2)/(S(2)*d*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - a*f**S(2)*log(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d**S(2)*e) + (a*f**S(2)/d**S(2) + S(1))*log(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(-2)), x), x, -a*f**S(2)/(S(2)*d**S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - a*f**S(2)*log(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(d**S(3)*e) + a*f**S(2)*log(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(d**S(3)*e) - (a*f**S(2)/d**S(2) + S(1))/(S(2)*e*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(-3)), x), x, -a*f**S(2)/(d**S(3)*e*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - a*f**S(2)/(S(2)*d**S(3)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - S(3)*a*f**S(2)*log(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d**S(4)*e) + S(3)*a*f**S(2)*log(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d**S(4)*e) - (a*f**S(2)/d**S(2) + S(1))/(S(4)*e*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(5)/2), x), x, -S(5)*a*d**(S(3)/2)*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*e) - a*d**S(2)*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + S(2)*a*d*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/e + a*f**S(2)*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)/(S(3)*e) + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(7)/2)/(S(7)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2), x), x, -S(3)*a*sqrt(d)*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*e) - a*d*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + a*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/e + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(5)/2)/(S(5)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2))), x), x, -a*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - a*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*sqrt(d)*e) + (d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)/(S(3)*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2))), x), x, -a*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + a*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*d**(S(3)/2)*e) + sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/e, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(-3)/2), x), x, -a*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d**S(2)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + S(3)*a*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*d**(S(5)/2)*e) - (a*f**S(2)/d**S(2) + S(1))/(e*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(-5)/2), x), x, -S(2)*a*f**S(2)/(d**S(3)*e*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) - a*f**S(2)*sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/(S(2)*d**S(3)*e*(e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))) + S(5)*a*f**S(2)*atanh(sqrt(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))/sqrt(d))/(S(2)*d**(S(7)/2)*e) - (a*f**S(2)/d**S(2) + S(1))/(S(3)*e*(d + e*x + f*sqrt(a + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x - sqrt(x**S(2) + S(-4))), x), x, (x - sqrt(x**S(2) + S(-4)))**(S(3)/2)/S(3) + S(4)/sqrt(x - sqrt(x**S(2) + S(-4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) + c)), x), x, -b**S(2)*c/(a*sqrt(a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) + c))) + (a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) + c))**(S(3)/2)/(S(3)*a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(-x**S(2) + S(1)) + S(1)), x), x, -S(2)*x**S(3)/(S(3)*(sqrt(-x**S(2) + S(1)) + S(1))**(S(3)/2)) + S(2)*x/sqrt(sqrt(-x**S(2) + S(1)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(x**S(2) + S(1)) + S(1)), x), x, S(2)*x**S(3)/(S(3)*(sqrt(x**S(2) + S(1)) + S(1))**(S(3)/2)) + S(2)*x/sqrt(sqrt(x**S(2) + S(1)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(x**S(2) + S(25)) + S(5)), x), x, S(2)*x**S(3)/(S(3)*(sqrt(x**S(2) + S(25)) + S(5))**(S(3)/2)) + S(10)*x/sqrt(sqrt(x**S(2) + S(25)) + S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(a**S(2)/b**S(2) + c*x**S(2))), x), x, S(2)*a*x/sqrt(a + b*sqrt(a**S(2)/b**S(2) + c*x**S(2))) + S(2)*b**S(2)*c*x**S(3)/(S(3)*(a + b*sqrt(a**S(2)/b**S(2) + c*x**S(2)))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**n, x), x, f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))*hyper((S(2), n + S(1)), (n + S(2),), S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(-b*f**S(2) + S(2)*d*e))/(S(2)*e*(n + S(1))*(-b*f**S(2) + S(2)*d*e)**S(2)) + (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(2)*e*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(3), x), x, (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(4)/(S(8)*e) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(2)/(S(16)*e**S(3)) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)*(e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(8)*e**S(4)) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)**S(3)/(S(32)*e**S(5)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + S(3)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)**S(2)*log(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(S(32)*e**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(2), x), x, (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(3)/(S(6)*e) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(8)*e**S(3)) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)**S(2)/(S(16)*e**S(4)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)*log(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(S(8)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)), x), x, d*x + e*x**S(2)/S(2) + f*(b*f**S(2) + S(2)*e**S(2)*x)*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))/(S(4)*e**S(2)) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*atanh((b*f**S(2) + S(2)*e**S(2)*x)/(S(2)*e*f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(S(8)*e**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))), x), x, (S(2)*a*e*f**S(2) - S(2)*b*d*f**S(2) + S(2)*d**S(2)*e)*log(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(-b*f**S(2) + S(2)*d*e)**S(2) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))/(S(2)*e*(-b*f**S(2) + S(2)*d*e)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) - f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*log(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(S(2)*e*(-b*f**S(2) + S(2)*d*e)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(-2)), x), x, f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))/((-b*f**S(2) + S(2)*d*e)**S(2)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + S(2)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*log(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(-b*f**S(2) + S(2)*d*e)**S(3) - S(2)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*log(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(-b*f**S(2) + S(2)*d*e)**S(3) - (S(2)*a*e*f**S(2) - S(2)*b*d*f**S(2) + S(2)*d**S(2)*e)/((-b*f**S(2) + S(2)*d*e)**S(2)*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(-3)), x), x, S(2)*e*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))/((-b*f**S(2) + S(2)*d*e)**S(3)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + S(6)*e*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*log(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(-b*f**S(2) + S(2)*d*e)**S(4) - S(6)*e*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*log(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))/(-b*f**S(2) + S(2)*d*e)**S(4) - S(2)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))/((-b*f**S(2) + S(2)*d*e)**S(3)*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))) - (a*e*f**S(2) - b*d*f**S(2) + d**S(2)*e)/((-b*f**S(2) + S(2)*d*e)**S(2)*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(5)/2), x), x, (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(7)/2)/(S(7)*e) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)/(S(12)*e**S(3)) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)**S(2)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(16)*e**S(4)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(4)*e**S(4)) - S(5)*sqrt(S(2))*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)**(S(3)/2)*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(S(32)*e**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2), x), x, (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(5)/2)/(S(5)*e) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*(-b*f**S(2) + S(2)*d*e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(8)*e**S(3)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(4)*e**S(3)) - S(3)*sqrt(S(2))*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*sqrt(-b*f**S(2) + S(2)*d*e)*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(S(16)*e**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))), x), x, f**S(2)*(S(4)*a - b**S(2)*f**S(2)/e**S(2))*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(-S(4)*b*f**S(2) + S(8)*d*e - S(8)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))) + (d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)/(S(3)*e) - sqrt(S(2))*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(S(8)*e**(S(5)/2)*sqrt(-b*f**S(2) + S(2)*d*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))), x), x, f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/(S(2)*e*(-b*f**S(2) + S(2)*d*e)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) + sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/e + sqrt(S(2))*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(S(4)*e**(S(3)/2)*(-b*f**S(2) + S(2)*d*e)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(-3)/2), x), x, f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/((-b*f**S(2) + S(2)*d*e)**S(2)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) - (S(4)*a*e*f**S(2) - S(4)*b*d*f**S(2) + S(4)*d**S(2)*e)/((-b*f**S(2) + S(2)*d*e)**S(2)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))) + S(3)*sqrt(S(2))*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(S(2)*sqrt(e)*(-b*f**S(2) + S(2)*d*e)**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(-5)/2), x), x, S(5)*sqrt(S(2))*sqrt(e)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*atanh(sqrt(S(2))*sqrt(e)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/sqrt(-b*f**S(2) + S(2)*d*e))/(-b*f**S(2) + S(2)*d*e)**(S(7)/2) + S(2)*e*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))/((-b*f**S(2) + S(2)*d*e)**S(3)*(-b*f**S(2) + S(2)*d*e - S(2)*e*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2))))) - S(4)*f**S(2)*(S(4)*a*e**S(2) - b**S(2)*f**S(2))/((-b*f**S(2) + S(2)*d*e)**S(3)*sqrt(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))) - (S(4)*a*e*f**S(2) - S(4)*b*d*f**S(2) + S(4)*d**S(2)*e)/(S(3)*(-b*f**S(2) + S(2)*d*e)**S(2)*(d + e*x + f*sqrt(a + b*x + e**S(2)*x**S(2)/f**S(2)))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**S(2)*(x + sqrt(a + x**S(2)))**n, x), x, -a**S(5)*(x + sqrt(a + x**S(2)))**(n + S(-5))/(-S(32)*n + S(160)) - S(5)*a**S(4)*(x + sqrt(a + x**S(2)))**(n + S(-3))/(-S(32)*n + S(96)) - S(5)*a**S(3)*(x + sqrt(a + x**S(2)))**(n + S(-1))/(-S(16)*n + S(16)) + S(5)*a**S(2)*(x + sqrt(a + x**S(2)))**(n + S(1))/(S(16)*n + S(16)) + S(5)*a*(x + sqrt(a + x**S(2)))**(n + S(3))/(S(32)*n + S(96)) + (x + sqrt(a + x**S(2)))**(n + S(5))/(S(32)*n + S(160)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))*(x + sqrt(a + x**S(2)))**n, x), x, -a**S(3)*(x + sqrt(a + x**S(2)))**(n + S(-3))/(-S(8)*n + S(24)) - S(3)*a**S(2)*(x + sqrt(a + x**S(2)))**(n + S(-1))/(-S(8)*n + S(8)) + S(3)*a*(x + sqrt(a + x**S(2)))**(n + S(1))/(S(8)*n + S(8)) + (x + sqrt(a + x**S(2)))**(n + S(3))/(S(8)*n + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n, x), x, -a*(x + sqrt(a + x**S(2)))**(n + S(-1))/(-S(2)*n + S(2)) + (x + sqrt(a + x**S(2)))**(n + S(1))/(S(2)*n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n/(a + x**S(2)), x), x, S(2)*(x + sqrt(a + x**S(2)))**(n + S(1))*hyper((S(1), n/S(2) + S(1)/2), (n/S(2) + S(3)/2,), -(x + sqrt(a + x**S(2)))**S(2)/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n/(a + x**S(2))**S(2), x), x, S(8)*(x + sqrt(a + x**S(2)))**(n + S(3))*hyper((S(3), n/S(2) + S(3)/2), (n/S(2) + S(5)/2,), -(x + sqrt(a + x**S(2)))**S(2)/a)/(a**S(3)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**S(2)*(x - sqrt(a + x**S(2)))**n, x), x, -a**S(5)*(x - sqrt(a + x**S(2)))**(n + S(-5))/(-S(32)*n + S(160)) - S(5)*a**S(4)*(x - sqrt(a + x**S(2)))**(n + S(-3))/(-S(32)*n + S(96)) - S(5)*a**S(3)*(x - sqrt(a + x**S(2)))**(n + S(-1))/(-S(16)*n + S(16)) + S(5)*a**S(2)*(x - sqrt(a + x**S(2)))**(n + S(1))/(S(16)*n + S(16)) + S(5)*a*(x - sqrt(a + x**S(2)))**(n + S(3))/(S(32)*n + S(96)) + (x - sqrt(a + x**S(2)))**(n + S(5))/(S(32)*n + S(160)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))*(x - sqrt(a + x**S(2)))**n, x), x, -a**S(3)*(x - sqrt(a + x**S(2)))**(n + S(-3))/(-S(8)*n + S(24)) - S(3)*a**S(2)*(x - sqrt(a + x**S(2)))**(n + S(-1))/(-S(8)*n + S(8)) + S(3)*a*(x - sqrt(a + x**S(2)))**(n + S(1))/(S(8)*n + S(8)) + (x - sqrt(a + x**S(2)))**(n + S(3))/(S(8)*n + S(24)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n, x), x, -a*(x - sqrt(a + x**S(2)))**(n + S(-1))/(-S(2)*n + S(2)) + (x - sqrt(a + x**S(2)))**(n + S(1))/(S(2)*n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n/(a + x**S(2)), x), x, S(2)*(x - sqrt(a + x**S(2)))**(n + S(1))*hyper((S(1), n/S(2) + S(1)/2), (n/S(2) + S(3)/2,), -(x - sqrt(a + x**S(2)))**S(2)/a)/(a*(n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n/(a + x**S(2))**S(2), x), x, S(8)*(x - sqrt(a + x**S(2)))**(n + S(3))*hyper((S(3), n/S(2) + S(3)/2), (n/S(2) + S(5)/2,), -(x - sqrt(a + x**S(2)))**S(2)/a)/(a**S(3)*(n + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**(S(5)/2)*(x + sqrt(a + x**S(2)))**n, x), x, -a**S(6)*(x + sqrt(a + x**S(2)))**(n + S(-6))/(-S(64)*n + S(384)) - S(3)*a**S(5)*(x + sqrt(a + x**S(2)))**(n + S(-4))/(-S(32)*n + S(128)) - S(15)*a**S(4)*(x + sqrt(a + x**S(2)))**(n + S(-2))/(-S(64)*n + S(128)) + S(5)*a**S(3)*(x + sqrt(a + x**S(2)))**n/(S(16)*n) + S(15)*a**S(2)*(x + sqrt(a + x**S(2)))**(n + S(2))/(S(64)*n + S(128)) + S(3)*a*(x + sqrt(a + x**S(2)))**(n + S(4))/(S(32)*n + S(128)) + (x + sqrt(a + x**S(2)))**(n + S(6))/(S(64)*n + S(384)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**(S(3)/2)*(x + sqrt(a + x**S(2)))**n, x), x, -a**S(4)*(x + sqrt(a + x**S(2)))**(n + S(-4))/(-S(16)*n + S(64)) - a**S(3)*(x + sqrt(a + x**S(2)))**(n + S(-2))/(-S(4)*n + S(8)) + S(3)*a**S(2)*(x + sqrt(a + x**S(2)))**n/(S(8)*n) + a*(x + sqrt(a + x**S(2)))**(n + S(2))/(S(4)*n + S(8)) + (x + sqrt(a + x**S(2)))**(n + S(4))/(S(16)*n + S(64)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + x**S(2))*(x + sqrt(a + x**S(2)))**n, x), x, -a**S(2)*(x + sqrt(a + x**S(2)))**(n + S(-2))/(-S(4)*n + S(8)) + a*(x + sqrt(a + x**S(2)))**n/(S(2)*n) + (x + sqrt(a + x**S(2)))**(n + S(2))/(S(4)*n + S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n/sqrt(a + x**S(2)), x), x, (x + sqrt(a + x**S(2)))**n/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n/(a + x**S(2))**(S(3)/2), x), x, S(4)*(x + sqrt(a + x**S(2)))**(n + S(2))*hyper((S(2), n/S(2) + S(1)), (n/S(2) + S(2),), -(x + sqrt(a + x**S(2)))**S(2)/a)/(a**S(2)*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(a + x**S(2)))**n/(a + x**S(2))**(S(5)/2), x), x, S(16)*(x + sqrt(a + x**S(2)))**(n + S(4))*hyper((S(4), n/S(2) + S(2)), (n/S(2) + S(3),), -(x + sqrt(a + x**S(2)))**S(2)/a)/(a**S(4)*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**(S(5)/2)*(x - sqrt(a + x**S(2)))**n, x), x, a**S(6)*(x - sqrt(a + x**S(2)))**(n + S(-6))/(-S(64)*n + S(384)) + S(3)*a**S(5)*(x - sqrt(a + x**S(2)))**(n + S(-4))/(-S(32)*n + S(128)) + S(15)*a**S(4)*(x - sqrt(a + x**S(2)))**(n + S(-2))/(-S(64)*n + S(128)) - S(5)*a**S(3)*(x - sqrt(a + x**S(2)))**n/(S(16)*n) - S(15)*a**S(2)*(x - sqrt(a + x**S(2)))**(n + S(2))/(S(64)*n + S(128)) - S(3)*a*(x - sqrt(a + x**S(2)))**(n + S(4))/(S(32)*n + S(128)) - (x - sqrt(a + x**S(2)))**(n + S(6))/(S(64)*n + S(384)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + x**S(2))**(S(3)/2)*(x - sqrt(a + x**S(2)))**n, x), x, a**S(4)*(x - sqrt(a + x**S(2)))**(n + S(-4))/(-S(16)*n + S(64)) + a**S(3)*(x - sqrt(a + x**S(2)))**(n + S(-2))/(-S(4)*n + S(8)) - S(3)*a**S(2)*(x - sqrt(a + x**S(2)))**n/(S(8)*n) - a*(x - sqrt(a + x**S(2)))**(n + S(2))/(S(4)*n + S(8)) - (x - sqrt(a + x**S(2)))**(n + S(4))/(S(16)*n + S(64)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + x**S(2))*(x - sqrt(a + x**S(2)))**n, x), x, a**S(2)*(x - sqrt(a + x**S(2)))**(n + S(-2))/(-S(4)*n + S(8)) - a*(x - sqrt(a + x**S(2)))**n/(S(2)*n) - (x - sqrt(a + x**S(2)))**(n + S(2))/(S(4)*n + S(8)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n/sqrt(a + x**S(2)), x), x, -(x - sqrt(a + x**S(2)))**n/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n/(a + x**S(2))**(S(3)/2), x), x, -S(4)*(x - sqrt(a + x**S(2)))**(n + S(2))*hyper((S(2), n/S(2) + S(1)), (n/S(2) + S(2),), -(x - sqrt(a + x**S(2)))**S(2)/a)/(a**S(2)*(n + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(a + x**S(2)))**n/(a + x**S(2))**(S(5)/2), x), x, -S(16)*(x - sqrt(a + x**S(2)))**(n + S(4))*hyper((S(4), n/S(2) + S(2)), (n/S(2) + S(3),), -(x - sqrt(a + x**S(2)))**S(2)/a)/(a**S(4)*(n + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(5))/(S(32)*e*f**S(4)*(n + S(5))) - (-S(5)*a*f**S(2) + S(5)*d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(3))/(S(32)*e*f**S(4)*(n + S(3))) + S(5)*(-a*f**S(2) + d**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(16)*e*f**S(4)*(n + S(1))) + (-a*f**S(2) + d**S(2))**S(5)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-5))/(S(32)*e*f**S(4)*(-n + S(5))) - S(5)*(-a*f**S(2) + d**S(2))**S(4)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-3))/(S(32)*e*f**S(4)*(-n + S(3))) + S(5)*(-a*f**S(2) + d**S(2))**S(3)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-1))/(S(16)*e*f**S(4)*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(3))/(S(8)*e*f**S(2)*(n + S(3))) - (-S(3)*a*f**S(2) + S(3)*d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(8)*e*f**S(2)*(n + S(1))) + (-a*f**S(2) + d**S(2))**S(3)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-3))/(S(8)*e*f**S(2)*(-n + S(3))) - S(3)*(-a*f**S(2) + d**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-1))/(S(8)*e*f**S(2)*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(2)*e*(n + S(1))) + (-a*f**S(2) + d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-1))/(S(2)*e*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)), x), x, -S(2)*f**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))*hyper((S(1), n/S(2) + S(1)/2), (n/S(2) + S(3)/2,), (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**S(2)/(-a*f**S(2) + d**S(2)))/(e*(n + S(1))*(-a*f**S(2) + d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))**S(2), x), x, -S(8)*f**S(4)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(3))*hyper((S(3), n/S(2) + S(3)/2), (n/S(2) + S(5)/2,), (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**S(2)/(-a*f**S(2) + d**S(2)))/(e*(n + S(3))*(-a*f**S(2) + d**S(2))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt((a*f**S(2) + e*x*(S(2)*d + e*x))/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))/(S(2)*e*(n + S(1))) + (-a*f**S(2) + d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-1))/(S(2)*e*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt((a*f**S(2) + e*x*(S(2)*d + e*x))/f**S(2)))**n/(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)), x), x, -S(2)*f**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(1))*hyper((S(1), n/S(2) + S(1)/2), (n/S(2) + S(3)/2,), (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**S(2)/(-a*f**S(2) + d**S(2)))/(e*(n + S(1))*(-a*f**S(2) + d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))**(S(3)/2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(4))/(S(16)*e*f**S(3)*(n + S(4))) - (-a*f**S(2) + d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(2))/(S(4)*e*f**S(3)*(n + S(2))) - (-a*f**S(2) + d**S(2))**S(4)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-4))/(S(16)*e*f**S(3)*(-n + S(4))) + (-a*f**S(2) + d**S(2))**S(3)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-2))/(S(4)*e*f**S(3)*(-n + S(2))) + S(3)*(-a*f**S(2) + d**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(S(8)*e*f**S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n, x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(2))/(S(4)*e*f*(n + S(2))) - (-a*f**S(2) + d**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-2))/(S(4)*e*f*(-n + S(2))) - (-a*f**S(2) + d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(S(2)*e*f*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)), x), x, f*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(e*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))**(S(3)/2), x), x, S(4)*f**S(3)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(2))*hyper((S(2), n/S(2) + S(1)), (n/S(2) + S(2),), (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**S(2)/(-a*f**S(2) + d**S(2)))/(e*(n + S(2))*(-a*f**S(2) + d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt((a*f**S(2) + e*x*(S(2)*d + e*x))/f**S(2)))**n/sqrt((a*f**S(2) + e*x*(S(2)*d + e*x))/f**S(2)), x), x, f*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(e*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2)), x), x, (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(2))*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))/(S(4)*e*f*(n + S(2))*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))) - (-a*f**S(2) + d**S(2))**S(2)*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(-2))*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))/(S(4)*e*f*(-n + S(2))*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))) - (-a*f**S(2) + d**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))/(S(2)*e*f*n*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2)), x), x, f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(e*n*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))**(S(3)/2), x), x, S(4)*f**S(3)*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**(n + S(2))*hyper((S(2), n/S(2) + S(1)), (n/S(2) + S(2),), (d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**S(2)/(-a*f**S(2) + d**S(2)))/(e*g*(n + S(2))*(-a*f**S(2) + d**S(2))**S(2)*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x + f*sqrt((a*f**S(2) + e*x*(S(2)*d + e*x))/f**S(2)))**n/sqrt((a*f**S(2)*g + e*g*x*(S(2)*d + e*x))/f**S(2)), x), x, f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2))*(d + e*x + f*sqrt(a + S(2)*d*e*x/f**S(2) + e**S(2)*x**S(2)/f**S(2)))**n/(e*n*sqrt(a*g + S(2)*d*e*g*x/f**S(2) + e**S(2)*g*x**S(2)/f**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + c*x**S(4))*(d + e*x)), x), x, -e*atanh((a*e**S(2) + c*d**S(2)*x**S(2))/(sqrt(a + c*x**S(4))*sqrt(a*e**S(4) + c*d**S(4))))/(S(2)*sqrt(a*e**S(4) + c*d**S(4))) + atan(x*sqrt(-(a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))/sqrt(a + c*x**S(4)))/(S(2)*d*sqrt(-(a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))) + c**(S(1)/4)*d*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*sqrt(a + c*x**S(4))*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))) - sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*elliptic_pi((sqrt(a)*e**S(2) + sqrt(c)*d**S(2))**S(2)/(S(4)*sqrt(a)*sqrt(c)*d**S(2)*e**S(2)), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*sqrt(a + c*x**S(4))*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + c*x**S(4))*(d + e*x)**S(2)), x), x, -a**(S(1)/4)*c**(S(1)/4)*e**S(2)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(sqrt(a + c*x**S(4))*(a*e**S(4) + c*d**S(4))) - a**(S(1)/4)*c**(S(1)/4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-e**S(2) + sqrt(c)*d**S(2)/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(sqrt(a + c*x**S(4))*(S(2)*a*e**S(4) + S(2)*c*d**S(4))) + sqrt(c)*e**S(2)*x*sqrt(a + c*x**S(4))/((sqrt(a) + sqrt(c)*x**S(2))*(a*e**S(4) + c*d**S(4))) - c*d**S(3)*e*atanh((a*e**S(2) + c*d**S(2)*x**S(2))/(sqrt(a + c*x**S(4))*sqrt(a*e**S(4) + c*d**S(4))))/(a*e**S(4) + c*d**S(4))**(S(3)/2) - c*atan(x*sqrt(-(a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))/sqrt(a + c*x**S(4)))/(e**S(2)*(-(a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))**(S(3)/2)) - e**S(3)*sqrt(a + c*x**S(4))/((d + e*x)*(a*e**S(4) + c*d**S(4))) + c**(S(5)/4)*d**S(4)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(a**(S(1)/4)*sqrt(a + c*x**S(4))*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*(a*e**S(4) + c*d**S(4))) - c**(S(3)/4)*d**S(2)*sqrt((a + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*elliptic_pi((sqrt(a)*e**S(2) + sqrt(c)*d**S(2))**S(2)/(S(4)*sqrt(a)*sqrt(c)*d**S(2)*e**S(2)), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*sqrt(a + c*x**S(4))*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*(a*e**S(4) + c*d**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -e*atanh((S(2)*a*e**S(2) + b*d**S(2) + x**S(2)*(b*e**S(2) + S(2)*c*d**S(2)))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))))/(S(2)*sqrt(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))) + atan(x*sqrt(-b - (a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(2)*d*sqrt(-b - (a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))) + c**(S(1)/4)*d*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))) - sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*elliptic_pi((sqrt(a)*e**S(2) + sqrt(c)*d**S(2))**S(2)/(S(4)*sqrt(a)*sqrt(c)*d**S(2)*e**S(2)), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*a**(S(1)/4)*c**(S(1)/4)*d*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((d + e*x)**S(2)*sqrt(a + b*x**S(2) + c*x**S(4))), x), x, -a**(S(1)/4)*c**(S(1)/4)*e**S(2)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*elliptic_e(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))) - a**(S(1)/4)*c**(S(1)/4)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-e**S(2) + sqrt(c)*d**S(2)/sqrt(a))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(sqrt(a + b*x**S(2) + c*x**S(4))*(S(2)*a*e**S(4) + S(2)*b*d**S(2)*e**S(2) + S(2)*c*d**S(4))) + sqrt(c)*e**S(2)*x*sqrt(a + b*x**S(2) + c*x**S(4))/((sqrt(a) + sqrt(c)*x**S(2))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))) - d*e*(b*e**S(2) + S(2)*c*d**S(2))*atanh((S(2)*a*e**S(2) + b*d**S(2) + x**S(2)*(b*e**S(2) + S(2)*c*d**S(2)))/(S(2)*sqrt(a + b*x**S(2) + c*x**S(4))*sqrt(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))))/(S(2)*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))**(S(3)/2)) - e**S(3)*sqrt(a + b*x**S(2) + c*x**S(4))/((d + e*x)*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))) - (b*e**S(2) + S(2)*c*d**S(2))*atan(x*sqrt(-b - (a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(2)*d**S(2)*e**S(2)*(-b - (a*e**S(4) + c*d**S(4))/(d**S(2)*e**S(2)))**(S(3)/2)) + c**(S(1)/4)*d**S(2)*sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(b*e**S(2) + S(2)*c*d**S(2))*elliptic_f(S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(2)*a**(S(1)/4)*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))) - sqrt((a + b*x**S(2) + c*x**S(4))/(sqrt(a) + sqrt(c)*x**S(2))**S(2))*(sqrt(a) + sqrt(c)*x**S(2))*(-sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*(b*e**S(2) + S(2)*c*d**S(2))*elliptic_pi((sqrt(a)*e**S(2) + sqrt(c)*d**S(2))**S(2)/(S(4)*sqrt(a)*sqrt(c)*d**S(2)*e**S(2)), S(2)*atan(c**(S(1)/4)*x/a**(S(1)/4)), S(1)/2 - b/(S(4)*sqrt(a)*sqrt(c)))/(S(4)*a**(S(1)/4)*c**(S(1)/4)*(sqrt(a)*e**S(2) + sqrt(c)*d**S(2))*sqrt(a + b*x**S(2) + c*x**S(4))*(a*e**S(4) + b*d**S(2)*e**S(2) + c*d**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) + c*x**S(4))/(a*d - c*d*x**S(4)), x), x, -sqrt(-S(2)*sqrt(a)*sqrt(c) + b)*atanh(x*sqrt(-S(2)*sqrt(a)*sqrt(c) + b)/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(4)*sqrt(a)*sqrt(c)*d) + sqrt(S(2)*sqrt(a)*sqrt(c) + b)*atanh(x*sqrt(S(2)*sqrt(a)*sqrt(c) + b)/sqrt(a + b*x**S(2) + c*x**S(4)))/(S(4)*sqrt(a)*sqrt(c)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2) - c*x**S(4))/(a*d + c*d*x**S(4)), x), x, sqrt(S(2))*sqrt(-b + sqrt(S(4)*a*c + b**S(2)))*atanh(sqrt(S(2))*x*sqrt(-b + sqrt(S(4)*a*c + b**S(2)))*(b - S(2)*c*x**S(2) + sqrt(S(4)*a*c + b**S(2)))/(S(4)*sqrt(a)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(4)*sqrt(a)*sqrt(c)*d) - sqrt(S(2))*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*x*sqrt(b + sqrt(S(4)*a*c + b**S(2)))*(b - S(2)*c*x**S(2) - sqrt(S(4)*a*c + b**S(2)))/(S(4)*sqrt(a)*sqrt(c)*sqrt(a + b*x**S(2) - c*x**S(4))))/(S(4)*sqrt(a)*sqrt(c)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x), x), x, b*x**S(2)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(S(5)*d*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)*(-S(80)*a*d**S(2) + S(32)*b*c*d + S(42)*b*d*e*x - S(35)*b*e**S(2))/(S(240)*d**S(3)*(a + b*x**S(2))) + e*(S(2)*d*x + e)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)*(-S(16)*a*d**S(2) + S(12)*b*c*d - S(7)*b*e**S(2))/(S(128)*d**S(4)*(a + b*x**S(2))) + e*(S(4)*c*d - e**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(-S(16)*a*d**S(2) + S(12)*b*c*d - S(7)*b*e**S(2))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(S(256)*d**(S(9)/2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x), x), x, -b*(-S(6)*d*x + S(5)*e)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(S(24)*d**S(2)*(a + b*x**S(2))) - (S(2)*d*x + e)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)*(-S(16)*a*d**S(2) + S(4)*b*c*d - S(5)*b*e**S(2))/(S(64)*d**S(3)*(a + b*x**S(2))) - (S(4)*c*d - e**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(-S(16)*a*d**S(2) + S(4)*b*c*d - S(5)*b*e**S(2))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(S(128)*d**(S(7)/2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/x, x), x, -a*sqrt(c)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*c + e*x)/(S(2)*sqrt(c)*sqrt(c + d*x**S(2) + e*x)))/(a + b*x**S(2)) + b*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(S(3)*d*(a + b*x**S(2))) + sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)*(S(8)*a*d**S(2) - S(2)*b*d*e*x - b*e**S(2))/(S(8)*d**S(2)*(a + b*x**S(2))) + e*(S(8)*a*d**S(2) - b*(S(4)*c*d - e**S(2)))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(S(16)*d**(S(5)/2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/x**S(2), x), x, -a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(c*x*(a + b*x**S(2))) - a*e*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*c + e*x)/(S(2)*sqrt(c)*sqrt(c + d*x**S(2) + e*x)))/(S(2)*sqrt(c)*(a + b*x**S(2))) + sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(S(8)*a*d**S(2) + S(4)*b*c*d - b*e**S(2))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(S(8)*d**(S(3)/2)*(a + b*x**S(2))) + (S(2)*d*x*(S(2)*a*d + b*c) + e*(S(4)*a*d + b*c))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/(S(4)*c*d*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/x**S(3), x), x, -a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(S(2)*c*x**S(2)*(a + b*x**S(2))) + b*e*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(S(2)*sqrt(d)*(a + b*x**S(2))) + (a*e + x*(S(2)*a*d + S(4)*b*c))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/(S(4)*c*x*(a + b*x**S(2))) - sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(S(4)*a*c*d - a*e**S(2) + S(8)*b*c**S(2))*atanh((S(2)*c + e*x)/(S(2)*sqrt(c)*sqrt(c + d*x**S(2) + e*x)))/(S(8)*c**(S(3)/2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/x**S(4), x), x, -a*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*(c + d*x**S(2) + e*x)**(S(3)/2)/(S(3)*c*x**S(3)*(a + b*x**S(2))) + b*sqrt(d)*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*d*x + e)/(S(2)*sqrt(d)*sqrt(c + d*x**S(2) + e*x)))/(a + b*x**S(2)) + (S(2)*a*c*e - x*(-a*e**S(2) + S(8)*b*c**S(2)))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*sqrt(c + d*x**S(2) + e*x)/(S(8)*c**S(2)*x**S(2)*(a + b*x**S(2))) - e*(-a*(S(4)*c*d - e**S(2)) + S(8)*b*c**S(2))*sqrt(a**S(2) + S(2)*a*b*x**S(2) + b**S(2)*x**S(4))*atanh((S(2)*c + e*x)/(S(2)*sqrt(c)*sqrt(c + d*x**S(2) + e*x)))/(S(16)*c**(S(5)/2)*(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(3))*sqrt(x**S(3) + S(1))), x), x, sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*atan(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(1) - (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(13)*sqrt(S(3)) + S(26))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))))/(S(26)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) + S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(S(15)*sqrt(S(3)) + S(26))*(x + S(1))*elliptic_f(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) - S(4)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*elliptic_pi(-S(56)*sqrt(S(3)) + S(97), asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-sqrt(S(3)) + S(2))*sqrt(x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(3))*sqrt(-x**S(3) + S(1))), x), x, -sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*(-x + S(1))*atanh(S(3)**(S(3)/4)*sqrt(S(1) - (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(7)*sqrt(S(3)) + S(14))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))))/(S(14)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))) - S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_f(asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*(sqrt(S(3)) + S(4))*sqrt(-x**S(3) + S(1))) - S(4)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(13)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(3))*sqrt(x**S(3) + S(-1))), x), x, -sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*(-x + S(1))*atan(S(3)**(S(3)/4)*sqrt(S(7)*sqrt(S(3)) + S(14))*sqrt(-(-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(14)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) - S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(3)*sqrt(S(3)) + S(14))*(-x + S(1))*elliptic_f(asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(39)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) + S(4)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(-S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(13)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(3))*sqrt(-x**S(3) + S(-1))), x), x, sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(x + S(1))*atanh(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(13)*sqrt(S(3)) + S(26))*sqrt(-(x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(26)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))) + S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(15)*sqrt(S(3)) + S(26))*(x + S(1))*elliptic_f(asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(3)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))) + S(4)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(x + S(1))*elliptic_pi(S(56)*sqrt(S(3)) + S(97), asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(sqrt(S(3)) + S(2))*sqrt(-x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(3))*sqrt(x**S(3) + S(1))), x), x, -S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(S(112)*sqrt(S(3)) + S(194))*(x + S(1))*elliptic_f(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) + S(12)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*elliptic_pi(-S(56)*sqrt(S(3)) + S(97), asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-sqrt(S(3)) + S(2))*sqrt(x**S(3) + S(1))) - sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(S(3)*x + S(3))*atan(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(1) - (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(13)*sqrt(S(3)) + S(26))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))))/(S(26)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(3))*sqrt(-x**S(3) + S(1))), x), x, sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*(-S(3)*x + S(3))*atanh(S(3)**(S(3)/4)*sqrt(S(1) - (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(7)*sqrt(S(3)) + S(14))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))))/(S(14)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))) - S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(S(40)*sqrt(S(3)) + S(74))*(-x + S(1))*elliptic_f(asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(39)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))) + S(12)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(13)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(3))*sqrt(x**S(3) + S(-1))), x), x, sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*(-S(3)*x + S(3))*atan(S(3)**(S(3)/4)*sqrt(S(7)*sqrt(S(3)) + S(14))*sqrt(-(-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(14)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) + S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(40)*sqrt(S(3)) + S(74))*(-x + S(1))*elliptic_f(asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(39)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) - S(12)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(-S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(13)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((x + S(3))*sqrt(-x**S(3) + S(-1))), x), x, S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(112)*sqrt(S(3)) + S(194))*(x + S(1))*elliptic_f(asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(3)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))) - S(12)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(x + S(1))*elliptic_pi(S(56)*sqrt(S(3)) + S(97), asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(sqrt(S(3)) + S(2))*sqrt(-x**S(3) + S(-1))) - sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(S(3)*x + S(3))*atanh(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(13)*sqrt(S(3)) + S(26))*sqrt(-(x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(26)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x + S(2))/((x + S(3))*sqrt(x**S(3) + S(1))), x), x, S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(S(1560)*sqrt(S(3)) + S(2702))*(x + S(1))*elliptic_f(asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(3)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))) - S(44)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(x + S(1))*elliptic_pi(-S(56)*sqrt(S(3)) + S(97), asin((x - sqrt(S(3)) + S(1))/(x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-sqrt(S(3)) + S(2))*sqrt(x**S(3) + S(1))) + sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*(S(11)*x + S(11))*atan(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(1) - (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(13)*sqrt(S(3)) + S(26))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (x - sqrt(S(3)) + S(1))**S(2)/(x + S(1) + sqrt(S(3)))**S(2))))/(S(26)*sqrt((x + S(1))/(x + S(1) + sqrt(S(3)))**S(2))*sqrt(x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x + S(2))/((x + S(3))*sqrt(-x**S(3) + S(1))), x), x, -sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*(-S(11)*x + S(11))*atanh(S(3)**(S(3)/4)*sqrt(S(1) - (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-S(7)*sqrt(S(3)) + S(14))/(S(6)*sqrt(-S(4)*sqrt(S(3)) + S(7) + (-x - sqrt(S(3)) + S(1))**S(2)/(-x + S(1) + sqrt(S(3)))**S(2))))/(S(14)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))) + S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(S(168)*sqrt(S(3)) + S(446))*(-x + S(1))*elliptic_f(asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(39)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))) - S(44)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x - sqrt(S(3)) + S(1))/(-x + S(1) + sqrt(S(3)))), S(-7) - S(4)*sqrt(S(3)))/(S(13)*sqrt((-x + S(1))/(-x + S(1) + sqrt(S(3)))**S(2))*sqrt(-x**S(3) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x + S(2))/((x + S(3))*sqrt(x**S(3) + S(-1))), x), x, -sqrt(S(7))*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*(-S(11)*x + S(11))*atan(S(3)**(S(3)/4)*sqrt(S(7)*sqrt(S(3)) + S(14))*sqrt(-(-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((-x + S(1) + sqrt(S(3)))**S(2)/(-x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(14)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) - S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(168)*sqrt(S(3)) + S(446))*(-x + S(1))*elliptic_f(asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(39)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))) + S(44)*S(3)**(S(1)/4)*sqrt((x**S(2) + x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(-sqrt(S(3)) + S(2))*(-x + S(1))*elliptic_pi(-S(304)*sqrt(S(3))/S(169) + S(553)/169, asin((-x + S(1) + sqrt(S(3)))/(-x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(13)*sqrt(-(-x + S(1))/(-x - sqrt(S(3)) + S(1))**S(2))*sqrt(x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*x + S(2))/((x + S(3))*sqrt(-x**S(3) + S(-1))), x), x, -S(2)*S(3)**(S(3)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-S(1560)*sqrt(S(3)) + S(2702))*(x + S(1))*elliptic_f(asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(S(3)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))) + S(44)*S(3)**(S(1)/4)*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(x + S(1))*elliptic_pi(S(56)*sqrt(S(3)) + S(97), asin((x + S(1) + sqrt(S(3)))/(x - sqrt(S(3)) + S(1))), S(-7) + S(4)*sqrt(S(3)))/(sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(sqrt(S(3)) + S(2))*sqrt(-x**S(3) + S(-1))) + sqrt(S(26))*sqrt((x**S(2) - x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*(S(11)*x + S(11))*atanh(sqrt(S(2))*S(3)**(S(3)/4)*sqrt(S(13)*sqrt(S(3)) + S(26))*sqrt(-(x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(1))/(S(6)*sqrt((x + S(1) + sqrt(S(3)))**S(2)/(x - sqrt(S(3)) + S(1))**S(2) + S(4)*sqrt(S(3)) + S(7))))/(S(26)*sqrt(-(x + S(1))/(x - sqrt(S(3)) + S(1))**S(2))*sqrt(-x**S(3) + S(-1))), expand=True, _diff=True, _numerical=True) # sympy and mathematica assert rubi_test(rubi_integrate((d**S(3) + e**S(3)*x**S(3))**p/(d + e*x), x), x, (S(1) + (S(2)*d + S(2)*e*x)/(d*(S(-3) + sqrt(S(3))*I)))**(-p)*(S(1) - (S(2)*d + S(2)*e*x)/(d*(S(3) + sqrt(S(3))*I)))**(-p)*(d**S(3) + e**S(3)*x**S(3))**p*AppellF1(p, -p, -p, p + S(1), -(S(2)*d + S(2)*e*x)/(d*(S(-3) + sqrt(S(3))*I)), (S(2)*d + S(2)*e*x)/(d*(S(3) + sqrt(S(3))*I)))/(e*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x)*sqrt(c + d*x**S(2))*sqrt(e + f*x**S(2))), x), x, a*sqrt(e)*sqrt(f)*sqrt(c + d*x**S(2))*elliptic_f(atan(sqrt(f)*x/sqrt(e)), S(1) - d*e/(c*f))/(c*sqrt(e*(c + d*x**S(2))/(c*(e + f*x**S(2))))*sqrt(e + f*x**S(2))*(a**S(2)*f + b**S(2)*e)) - b*atanh(sqrt(c + d*x**S(2))*sqrt(a**S(2)*f + b**S(2)*e)/(sqrt(e + f*x**S(2))*sqrt(a**S(2)*d + b**S(2)*c)))/(sqrt(a**S(2)*d + b**S(2)*c)*sqrt(a**S(2)*f + b**S(2)*e)) + b**S(2)*e**(S(3)/2)*sqrt(c + d*x**S(2))*elliptic_pi(S(1) + b**S(2)*e/(a**S(2)*f), atan(sqrt(f)*x/sqrt(e)), S(1) - d*e/(c*f))/(a*c*sqrt(f)*sqrt(e*(c + d*x**S(2))/(c*(e + f*x**S(2))))*sqrt(e + f*x**S(2))*(a**S(2)*f + b**S(2)*e)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(2)*f*x**S(2))/(S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, -log(e - S(2)*sqrt(f)*x*sqrt(-d) + S(2)*f*x**S(2))/(S(4)*sqrt(f)*sqrt(-d)) + log(e + S(2)*sqrt(f)*x*sqrt(-d) + S(2)*f*x**S(2))/(S(4)*sqrt(f)*sqrt(-d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(2)*f*x**S(2))/(-S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, -log(-S(2)*sqrt(d)*sqrt(f)*x + e + S(2)*f*x**S(2))/(S(4)*sqrt(d)*sqrt(f)) + log(S(2)*sqrt(d)*sqrt(f)*x + e + S(2)*f*x**S(2))/(S(4)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(4)*f*x**S(3))/(S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(4)*f*x**S(3))/(-S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(2)*f*x**n*(n + S(-1)))/(S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**n + S(4)*f**S(2)*x**(S(2)*n)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x/(e + S(2)*f*x**n))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((e - S(2)*f*x**n*(n + S(-1)))/(-S(4)*d*f*x**S(2) + e**S(2) + S(4)*e*f*x**n + S(4)*f**S(2)*x**(S(2)*n)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x/(e + S(2)*f*x**n))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(S(4)*d*f*x**S(4) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atan(sqrt(f)*(e + x**S(2)*(S(2)*d + S(2)*f))/(sqrt(d)*e))/(S(4)*sqrt(d)*e*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(-S(4)*d*f*x**S(4) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, -atanh(sqrt(f)*(e - x**S(2)*(S(2)*d - S(2)*f))/(sqrt(d)*e))/(S(4)*sqrt(d)*e*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(3)*e + S(2)*f*x**S(2))/(S(4)*d*f*x**S(6) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**S(3)/(e + S(2)*f*x**S(2)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(S(3)*e + S(2)*f*x**S(2))/(-S(4)*d*f*x**S(6) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**S(3)/(e + S(2)*f*x**S(2)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(2)*(m + S(-1)))/(S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**S(2)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(2)*(m + S(-1)))/(S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))*(-m**S(2) + S(1))/((e + S(2)*f*x**S(2))*(-m + S(1))*(m + S(1))))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(2)*(m + S(-1)))/(-S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**S(2)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(2)*(m + S(-1)))/(-S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(2) + S(4)*f**S(2)*x**S(4)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))*(-m**S(2) + S(1))/((e + S(2)*f*x**S(2))*(-m + S(1))*(m + S(1))))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*e - S(2)*f*x**S(3))/(S(4)*d*f*x**S(4) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**S(2)/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*e - S(2)*f*x**S(3))/(-S(4)*d*f*x**S(4) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**S(2)/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(S(4)*d*f*x**S(6) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atan(sqrt(f)*(e + x**S(3)*(S(2)*d + S(2)*f))/(sqrt(d)*e))/(S(6)*sqrt(d)*e*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(-S(4)*d*f*x**S(6) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, -atanh(sqrt(f)*(e - x**S(3)*(S(2)*d - S(2)*f))/(sqrt(d)*e))/(S(6)*sqrt(d)*e*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(3)*(m + S(-2)))/(S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**S(3)*(m + S(-2)))/(-S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**S(3) + S(4)*f**S(2)*x**S(6)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**S(3)))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**n*(m - n + S(1)))/(S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**n + S(4)*f**S(2)*x**(S(2)*n)), x), x, atan(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**n))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*(e*(m + S(1)) + S(2)*f*x**n*(m - n + S(1)))/(-S(4)*d*f*x**(S(2)*m + S(2)) + e**S(2) + S(4)*e*f*x**n + S(4)*f**S(2)*x**(S(2)*n)), x), x, atanh(S(2)*sqrt(d)*sqrt(f)*x**(m + S(1))/(e + S(2)*f*x**n))/(S(2)*sqrt(d)*sqrt(f)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2))), x), x, -x**S(2)*(S(2)*a*c**S(2) - d**S(2))/(S(2)*b**S(2)*c**S(3)) + (a + b*x**S(2))**S(2)/(S(4)*b**S(3)*c) - d*(a + b*x**S(2))**(S(3)/2)/(S(3)*b**S(3)*c**S(2)) + d*sqrt(a + b*x**S(2))*(S(2)*a*c**S(2) - d**S(2))/(b**S(3)*c**S(4)) + (a*c**S(2) - d**S(2))**S(2)*log(c*sqrt(a + b*x**S(2)) + d)/(b**S(3)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2))), x), x, x**S(2)/(S(2)*b*c) - d*sqrt(a + b*x**S(2))/(b**S(2)*c**S(2)) - (a*c**S(2) - d**S(2))*log(c*sqrt(a + b*x**S(2)) + d)/(b**S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2))), x), x, log(c*sqrt(a + b*x**S(2)) + d)/(b*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2)))), x), x, c*log(x)/(a*c**S(2) - d**S(2)) - c*log(c*sqrt(a + b*x**S(2)) + d)/(a*c**S(2) - d**S(2)) + d*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(sqrt(a)*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2)))), x), x, -b*c**S(3)*log(x)/(a*c**S(2) - d**S(2))**S(2) + b*c**S(3)*log(c*sqrt(a + b*x**S(2)) + d)/(a*c**S(2) - d**S(2))**S(2) - (a*c - d*sqrt(a + b*x**S(2)))/(S(2)*a*x**S(2)*(a*c**S(2) - d**S(2))) - b*d*(S(3)*a*c**S(2) - d**S(2))*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(S(2)*a**(S(3)/2)*(a*c**S(2) - d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2))), x), x, x/(b*c) - d*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(b**(S(3)/2)*c**S(2)) - sqrt(a*c**S(2) - d**S(2))*atan(sqrt(b)*c*x/sqrt(a*c**S(2) - d**S(2)))/(b**(S(3)/2)*c**S(2)) + sqrt(a*c**S(2) - d**S(2))*atan(sqrt(b)*d*x/(sqrt(a + b*x**S(2))*sqrt(a*c**S(2) - d**S(2))))/(b**(S(3)/2)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2))), x), x, atan(sqrt(b)*c*x/sqrt(a*c**S(2) - d**S(2)))/(sqrt(b)*sqrt(a*c**S(2) - d**S(2))) - atan(sqrt(b)*d*x/(sqrt(a + b*x**S(2))*sqrt(a*c**S(2) - d**S(2))))/(sqrt(b)*sqrt(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*c + b*c*x**S(2) + d*sqrt(a + b*x**S(2)))), x), x, -sqrt(b)*c**S(2)*atan(sqrt(b)*c*x/sqrt(a*c**S(2) - d**S(2)))/(a*c**S(2) - d**S(2))**(S(3)/2) + sqrt(b)*c**S(2)*atan(sqrt(b)*d*x/(sqrt(a + b*x**S(2))*sqrt(a*c**S(2) - d**S(2))))/(a*c**S(2) - d**S(2))**(S(3)/2) - c/(x*(a*c**S(2) - d**S(2))) + d*sqrt(a + b*x**S(2))/(a*x*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, -x**S(3)*(S(2)*a*c**S(2) - d**S(2))/(S(3)*b**S(2)*c**S(3)) + (a + b*x**S(3))**S(2)/(S(6)*b**S(3)*c) - S(2)*d*(a + b*x**S(3))**(S(3)/2)/(S(9)*b**S(3)*c**S(2)) + S(2)*d*sqrt(a + b*x**S(3))*(S(2)*a*c**S(2) - d**S(2))/(S(3)*b**S(3)*c**S(4)) + S(2)*(a*c**S(2) - d**S(2))**S(2)*log(c*sqrt(a + b*x**S(3)) + d)/(S(3)*b**S(3)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, x**S(3)/(S(3)*b*c) - S(2)*d*sqrt(a + b*x**S(3))/(S(3)*b**S(2)*c**S(2)) - (S(2)*a*c**S(2) - S(2)*d**S(2))*log(c*sqrt(a + b*x**S(3)) + d)/(S(3)*b**S(2)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, S(2)*log(c*sqrt(a + b*x**S(3)) + d)/(S(3)*b*c), expand=True, _diff=True, _numerical=True) # taking a long time assert rubi_test(rubi_integrate(S(1)/(x*(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3)))), x), x, -S(2)*c*log(c*sqrt(a + b*x**S(3)) + d)/(S(3)*a*c**S(2) - S(3)*d**S(2)) + c*log(x)/(a*c**S(2) - d**S(2)) + S(2)*d*atanh(sqrt(a + b*x**S(3))/sqrt(a))/(S(3)*sqrt(a)*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3)))), x), x, -b*c**S(3)*log(x)/(a*c**S(2) - d**S(2))**S(2) + S(2)*b*c**S(3)*log(c*sqrt(a + b*x**S(3)) + d)/(S(3)*(a*c**S(2) - d**S(2))**S(2)) - (a*c - d*sqrt(a + b*x**S(3)))/(S(3)*a*x**S(3)*(a*c**S(2) - d**S(2))) - b*d*(S(3)*a*c**S(2) - d**S(2))*atanh(sqrt(a + b*x**S(3))/sqrt(a))/(S(3)*a**(S(3)/2)*(a*c**S(2) - d**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, -d*x**S(4)*sqrt(S(1) + b*x**S(3)/a)*AppellF1(S(4)/3, S(1)/2, S(1), S(7)/3, -b*x**S(3)/a, -b*c**S(2)*x**S(3)/(a*c**S(2) - d**S(2)))/(sqrt(a + b*x**S(3))*(S(4)*a*c**S(2) - S(4)*d**S(2))) + x/(b*c) - (a*c**S(2) - d**S(2))**(S(1)/3)*log(b**(S(1)/3)*c**(S(2)/3)*x + (a*c**S(2) - d**S(2))**(S(1)/3))/(S(3)*b**(S(4)/3)*c**(S(5)/3)) + (a*c**S(2) - d**S(2))**(S(1)/3)*log(b**(S(2)/3)*c**(S(4)/3)*x**S(2) - b**(S(1)/3)*c**(S(2)/3)*x*(a*c**S(2) - d**S(2))**(S(1)/3) + (a*c**S(2) - d**S(2))**(S(2)/3))/(S(6)*b**(S(4)/3)*c**(S(5)/3)) + sqrt(S(3))*(a*c**S(2) - d**S(2))**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*c**(S(2)/3)*x/(a*c**S(2) - d**S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*b**(S(4)/3)*c**(S(5)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, -d*x**S(2)*sqrt(S(1) + b*x**S(3)/a)*AppellF1(S(2)/3, S(1)/2, S(1), S(5)/3, -b*x**S(3)/a, -b*c**S(2)*x**S(3)/(a*c**S(2) - d**S(2)))/(sqrt(a + b*x**S(3))*(S(2)*a*c**S(2) - S(2)*d**S(2))) - log(b**(S(1)/3)*c**(S(2)/3)*x + (a*c**S(2) - d**S(2))**(S(1)/3))/(S(3)*b**(S(2)/3)*c**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(1)/3)) + log(b**(S(2)/3)*c**(S(4)/3)*x**S(2) - b**(S(1)/3)*c**(S(2)/3)*x*(a*c**S(2) - d**S(2))**(S(1)/3) + (a*c**S(2) - d**S(2))**(S(2)/3))/(S(6)*b**(S(2)/3)*c**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(1)/3)) - sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*c**(S(2)/3)*x/(a*c**S(2) - d**S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*b**(S(2)/3)*c**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(1)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3))), x), x, -d*x*sqrt(S(1) + b*x**S(3)/a)*AppellF1(S(1)/3, S(1)/2, S(1), S(4)/3, -b*x**S(3)/a, -b*c**S(2)*x**S(3)/(a*c**S(2) - d**S(2)))/(sqrt(a + b*x**S(3))*(a*c**S(2) - d**S(2))) + c**(S(1)/3)*log(b**(S(1)/3)*c**(S(2)/3)*x + (a*c**S(2) - d**S(2))**(S(1)/3))/(S(3)*b**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(2)/3)) - c**(S(1)/3)*log(b**(S(2)/3)*c**(S(4)/3)*x**S(2) - b**(S(1)/3)*c**(S(2)/3)*x*(a*c**S(2) - d**S(2))**(S(1)/3) + (a*c**S(2) - d**S(2))**(S(2)/3))/(S(6)*b**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(2)/3)) - sqrt(S(3))*c**(S(1)/3)*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*c**(S(2)/3)*x/(a*c**S(2) - d**S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*b**(S(1)/3)*(a*c**S(2) - d**S(2))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3)))), x), x, b**(S(1)/3)*c**(S(5)/3)*log(b**(S(1)/3)*c**(S(2)/3)*x + (a*c**S(2) - d**S(2))**(S(1)/3))/(S(3)*(a*c**S(2) - d**S(2))**(S(4)/3)) - b**(S(1)/3)*c**(S(5)/3)*log(b**(S(2)/3)*c**(S(4)/3)*x**S(2) - b**(S(1)/3)*c**(S(2)/3)*x*(a*c**S(2) - d**S(2))**(S(1)/3) + (a*c**S(2) - d**S(2))**(S(2)/3))/(S(6)*(a*c**S(2) - d**S(2))**(S(4)/3)) + sqrt(S(3))*b**(S(1)/3)*c**(S(5)/3)*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*c**(S(2)/3)*x/(a*c**S(2) - d**S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(a*c**S(2) - d**S(2))**(S(4)/3)) - c/(x*(a*c**S(2) - d**S(2))) + d*sqrt(S(1) + b*x**S(3)/a)*AppellF1(S(-1)/3, S(1)/2, S(1), S(2)/3, -b*x**S(3)/a, -b*c**S(2)*x**S(3)/(a*c**S(2) - d**S(2)))/(x*sqrt(a + b*x**S(3))*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a*c + b*c*x**S(3) + d*sqrt(a + b*x**S(3)))), x), x, -b**(S(2)/3)*c**(S(7)/3)*log(b**(S(1)/3)*c**(S(2)/3)*x + (a*c**S(2) - d**S(2))**(S(1)/3))/(S(3)*(a*c**S(2) - d**S(2))**(S(5)/3)) + b**(S(2)/3)*c**(S(7)/3)*log(b**(S(2)/3)*c**(S(4)/3)*x**S(2) - b**(S(1)/3)*c**(S(2)/3)*x*(a*c**S(2) - d**S(2))**(S(1)/3) + (a*c**S(2) - d**S(2))**(S(2)/3))/(S(6)*(a*c**S(2) - d**S(2))**(S(5)/3)) + sqrt(S(3))*b**(S(2)/3)*c**(S(7)/3)*atan(sqrt(S(3))*(-S(2)*b**(S(1)/3)*c**(S(2)/3)*x/(a*c**S(2) - d**S(2))**(S(1)/3) + S(1))/S(3))/(S(3)*(a*c**S(2) - d**S(2))**(S(5)/3)) - c/(x**S(2)*(S(2)*a*c**S(2) - S(2)*d**S(2))) + d*sqrt(S(1) + b*x**S(3)/a)*AppellF1(S(-2)/3, S(1)/2, S(1), S(1)/3, -b*x**S(3)/a, -b*c**S(2)*x**S(3)/(a*c**S(2) - d**S(2)))/(x**S(2)*sqrt(a + b*x**S(3))*(S(2)*a*c**S(2) - S(2)*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a*c + b*c*x**n + d*sqrt(a + b*x**n)), x), x, c*x*hyper((S(1), S(1)/n), (S(1) + S(1)/n,), -b*c**S(2)*x**n/(a*c**S(2) - d**S(2)))/(a*c**S(2) - d**S(2)) - d*x*sqrt(S(1) + b*x**n/a)*AppellF1(S(1)/n, S(1)/2, S(1), S(1) + S(1)/n, -b*x**n/a, -b*c**S(2)*x**n/(a*c**S(2) - d**S(2)))/(sqrt(a + b*x**n)*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/(a*c + b*c*x**n + d*sqrt(a + b*x**n)), x), x, c*x**(m + S(1))*hyper((S(1), (m + S(1))/n), ((m + n + S(1))/n,), -b*c**S(2)*x**n/(a*c**S(2) - d**S(2)))/((m + S(1))*(a*c**S(2) - d**S(2))) - d*x**(m + S(1))*sqrt(S(1) + b*x**n/a)*AppellF1((m + S(1))/n, S(1)/2, S(1), (m + n + S(1))/n, -b*x**n/a, -b*c**S(2)*x**n/(a*c**S(2) - d**S(2)))/(sqrt(a + b*x**n)*(m + S(1))*(a*c**S(2) - d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(n + S(-1))/(a*c + b*c*x**n + d*sqrt(a + b*x**n)), x), x, S(2)*log(c*sqrt(a + b*x**n) + d)/(b*c*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*x**(S(3)/2) + sqrt(x)), x), x, atan(S(2)*sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-x**(S(5)/2) + sqrt(x)), x), x, atan(sqrt(x)) + atanh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-x**(S(1)/4) + sqrt(x)), x), x, S(4)*x**(S(1)/4) + S(2)*sqrt(x) + S(4)*log(-x**(S(1)/4) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(1)/3) + sqrt(x)), x), x, S(6)*x**(S(1)/6) - S(3)*x**(S(1)/3) + S(2)*sqrt(x) - S(6)*log(x**(S(1)/6) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(1)/4) + sqrt(x)), x), x, -S(4)*x**(S(1)/4) + S(2)*sqrt(x) + S(4)*log(x**(S(1)/4) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(2)/3) - x**(S(1)/3)), x), x, S(3)*x**(S(1)/3) + S(3)*log(-x**(S(1)/3) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x) + x**(S(-1)/4)), x), x, S(2)*sqrt(x) + S(4)*log(x**(S(1)/4) + S(1))/S(3) - S(2)*log(-x**(S(1)/4) + sqrt(x) + S(1))/S(3) + S(4)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**(S(1)/4) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(1)/4) + x**(S(1)/3)), x), x, -S(12)*x**(S(7)/12)/S(7) - S(12)*x**(S(5)/12)/S(5) - S(12)*x**(S(1)/12) + S(6)*x**(S(1)/6) - S(4)*x**(S(1)/4) + S(3)*x**(S(2)/3)/S(2) + S(3)*x**(S(1)/3) + S(2)*sqrt(x) + S(12)*log(x**(S(1)/12) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**(S(-1)/3) + x**(S(-1)/4)), x), x, S(12)*x**(S(13)/12)/S(13) + S(12)*x**(S(11)/12)/S(11) + S(12)*x**(S(7)/12)/S(7) + S(12)*x**(S(5)/12)/S(5) + S(12)*x**(S(1)/12) - S(6)*x**(S(7)/6)/S(7) - S(6)*x**(S(5)/6)/S(5) - S(6)*x**(S(1)/6) + S(4)*x**(S(5)/4)/S(5) + S(4)*x**(S(3)/4)/S(3) + S(4)*x**(S(1)/4) - S(3)*x**(S(2)/3)/S(2) - S(3)*x**(S(1)/3) - S(2)*sqrt(x) - x - S(12)*log(x**(S(1)/12) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x) - S(1)/x**(S(1)/3)), x), x, S(2)*sqrt(x) + S(6)*log(-x**(S(1)/6) + S(1))/S(5) - (-S(3)*sqrt(S(5))/S(10) + S(3)/10)*log(x**(S(1)/6) + sqrt(S(5))*x**(S(1)/6) + S(2)*x**(S(1)/3) + S(2)) - (S(3)/10 + S(3)*sqrt(S(5))/S(10))*log(-sqrt(S(5))*x**(S(1)/6) + x**(S(1)/6) + S(2)*x**(S(1)/3) + S(2)) - S(3)*sqrt(S(2)*sqrt(S(5)) + S(10))*atan(sqrt(sqrt(S(5))/S(10) + S(1)/2)*(S(4)*x**(S(1)/6) + S(1) + sqrt(S(5)))/S(2))/S(5) + S(3)*sqrt(-S(2)*sqrt(S(5)) + S(10))*atan((S(4)*x**(S(1)/6) - sqrt(S(5)) + S(1))/sqrt(S(2)*sqrt(S(5)) + S(10)))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(x**S(2) + x), x), x, S(2)*atan(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(S(4)*sqrt(x) + x), x), x, -S(8)*sqrt(x) + x + S(32)*log(sqrt(x) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(x**(S(1)/3) + x), x), x, S(2)*sqrt(x) - S(3)*sqrt(S(2))*log(-sqrt(S(2))*x**(S(1)/6) + x**(S(1)/3) + S(1))/S(4) + S(3)*sqrt(S(2))*log(sqrt(S(2))*x**(S(1)/6) + x**(S(1)/3) + S(1))/S(4) - S(3)*sqrt(S(2))*atan(sqrt(S(2))*x**(S(1)/6) + S(-1))/S(2) - S(3)*sqrt(S(2))*atan(sqrt(S(2))*x**(S(1)/6) + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(1)/3)/(x**(S(1)/4) + sqrt(x)), x), x, -S(12)*x**(S(7)/12)/S(7) - S(12)*x**(S(1)/12) + S(6)*x**(S(5)/6)/S(5) + S(3)*x**(S(1)/3) + S(6)*log(x**(S(1)/12) + S(1)) - S(2)*log(x**(S(1)/4) + S(1)) - S(4)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**(S(1)/12) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(x**(S(1)/4) + x**(S(1)/3)), x), x, -S(12)*x**(S(13)/12)/S(13) - S(12)*x**(S(11)/12)/S(11) - S(12)*x**(S(7)/12)/S(7) - S(12)*x**(S(5)/12)/S(5) - S(12)*x**(S(1)/12) + S(6)*x**(S(7)/6)/S(7) + S(6)*x**(S(5)/6)/S(5) + S(6)*x**(S(1)/6) - S(4)*x**(S(3)/4)/S(3) - S(4)*x**(S(1)/4) + S(3)*x**(S(2)/3)/S(2) + S(3)*x**(S(1)/3) + S(2)*sqrt(x) + x + S(12)*log(x**(S(1)/12) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(sqrt(x) - S(1)/x**(S(1)/3)), x), x, S(6)*x**(S(1)/6) + x + S(6)*log(-x**(S(1)/6) + S(1))/S(5) - (S(3)/10 + S(3)*sqrt(S(5))/S(10))*log(x**(S(1)/6) + sqrt(S(5))*x**(S(1)/6) + S(2)*x**(S(1)/3) + S(2)) - (-S(3)*sqrt(S(5))/S(10) + S(3)/10)*log(-sqrt(S(5))*x**(S(1)/6) + x**(S(1)/6) + S(2)*x**(S(1)/3) + S(2)) - S(3)*sqrt(-S(2)*sqrt(S(5)) + S(10))*atan(sqrt(sqrt(S(5))/S(10) + S(1)/2)*(S(4)*x**(S(1)/6) + S(1) + sqrt(S(5)))/S(2))/S(5) - S(3)*sqrt(S(2)*sqrt(S(5)) + S(10))*atan((S(4)*x**(S(1)/6) - sqrt(S(5)) + S(1))/sqrt(S(2)*sqrt(S(5)) + S(10)))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b*x**S(2) + sqrt(a + b**S(2)*x**S(4)))/sqrt(a + b**S(2)*x**S(4)), x), x, sqrt(S(2))*atanh(sqrt(S(2))*sqrt(b)*x/sqrt(b*x**S(2) + sqrt(a + b**S(2)*x**S(4))))/(S(2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-b*x**S(2) + sqrt(a + b**S(2)*x**S(4)))/sqrt(a + b**S(2)*x**S(4)), x), x, sqrt(S(2))*atan(sqrt(S(2))*sqrt(b)*x/sqrt(-b*x**S(2) + sqrt(a + b**S(2)*x**S(4))))/(S(2)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(2) + sqrt(S(4)*x**S(4) + S(3)))/((c + d*x)*sqrt(S(4)*x**S(4) + S(3))), x), x, -(S(1)/2 + I/S(2))*atanh((-S(2)*I*c*x + sqrt(S(3))*d)/(sqrt(S(2)*I*c**S(2) + sqrt(S(3))*d**S(2))*sqrt(S(2)*I*x**S(2) + sqrt(S(3)))))/sqrt(S(2)*I*c**S(2) + sqrt(S(3))*d**S(2)) + (S(1)/2 - I/S(2))*atan((S(2)*I*c*x + sqrt(S(3))*d)/(sqrt(S(2)*I*c**S(2) - sqrt(S(3))*d**S(2))*sqrt(-S(2)*I*x**S(2) + sqrt(S(3)))))/sqrt(S(2)*I*c**S(2) - sqrt(S(3))*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(2) + sqrt(S(4)*x**S(4) + S(3)))/((c + d*x)**S(2)*sqrt(S(4)*x**S(4) + S(3))), x), x, c*(S(1) - I)*atanh((-S(2)*I*c*x + sqrt(S(3))*d)/(sqrt(S(2)*I*c**S(2) + sqrt(S(3))*d**S(2))*sqrt(S(2)*I*x**S(2) + sqrt(S(3)))))/(S(2)*I*c**S(2) + sqrt(S(3))*d**S(2))**(S(3)/2) + c*(S(1) + I)*atan((S(2)*I*c*x + sqrt(S(3))*d)/(sqrt(S(2)*I*c**S(2) - sqrt(S(3))*d**S(2))*sqrt(-S(2)*I*x**S(2) + sqrt(S(3)))))/(S(2)*I*c**S(2) - sqrt(S(3))*d**S(2))**(S(3)/2) - d*(S(1)/2 + I/S(2))*sqrt(S(2)*I*x**S(2) + sqrt(S(3)))/((c + d*x)*(S(2)*I*c**S(2) + sqrt(S(3))*d**S(2))) + d*(S(1)/2 - I/S(2))*sqrt(-S(2)*I*x**S(2) + sqrt(S(3)))/((c + d*x)*(S(2)*I*c**S(2) - sqrt(S(3))*d**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-4))/(sqrt(x)*(x**(S(1)/3) + S(1))), x), x, S(6)*x**(S(7)/6)/S(7) - S(6)*x**(S(5)/6)/S(5) - S(30)*x**(S(1)/6) + S(2)*sqrt(x) + S(30)*atan(x**(S(1)/6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x) + S(1))/(x**(S(7)/6) + x**(S(5)/6)), x), x, S(3)*x**(S(1)/3) - S(3)*log(x**(S(1)/3) + S(1)) + S(6)*atan(x**(S(1)/6)), expand=True, _diff=True, _numerical=True) # difference in simplify assert rubi_test(rubi_integrate((sqrt(x) + S(1))/(sqrt(x)*(x**(S(1)/3) + S(1))), x), x, S(6)*x**(S(1)/6) + S(3)*x**(S(2)/3)/S(2) - S(3)*x**(S(1)/3) + S(3)*log(x**(S(1)/3) + S(1)) - S(6)*atan(x**(S(1)/6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(b/x**S(2) + S(2))/(b + S(2)*x**S(2)), x), x, -acsch(sqrt(S(2))*x/sqrt(b))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-b/x**S(2) + S(2))/(-b + S(2)*x**S(2)), x), x, -acsc(sqrt(S(2))*x/sqrt(b))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + c/x**S(2))/(d + e*x), x), x, sqrt(a)*atanh(sqrt(a + c/x**S(2))/sqrt(a))/e - sqrt(c)*atanh(sqrt(c)/(x*sqrt(a + c/x**S(2))))/d - sqrt(a*d**S(2) + c*e**S(2))*atanh((a*d - c*e/x)/(sqrt(a + c/x**S(2))*sqrt(a*d**S(2) + c*e**S(2))))/(d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b/x + c/x**S(2))/(d + e*x), x), x, sqrt(a)*atanh((S(2)*a + b/x)/(S(2)*sqrt(a)*sqrt(a + b/x + c/x**S(2))))/e - sqrt(c)*atanh((b + S(2)*c/x)/(S(2)*sqrt(c)*sqrt(a + b/x + c/x**S(2))))/d - sqrt(a*d**S(2) - e*(b*d - c*e))*atanh((S(2)*a*d - b*e + (b*d - S(2)*c*e)/x)/(S(2)*sqrt(a*d**S(2) - e*(b*d - c*e))*sqrt(a + b/x + c/x**S(2))))/(d*e), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**(S(1)/6) + (x**S(3))**(S(1)/5))/sqrt(x), x), x, S(3)*x**(S(2)/3)/S(2) + S(10)*sqrt(x)*(x**S(3))**(S(1)/5)/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))/sqrt(-x**S(2) + S(4)*x), x), x, -sqrt(-x**S(2) + S(4)*x) + S(4)*asin(x/S(2) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(3))/(x**S(2) + S(6)*x)**(S(1)/3), x), x, S(3)*(x**S(2) + S(6)*x)**(S(2)/3)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(4))/(-x**S(2) + S(6)*x)**(S(3)/2), x), x, -(-S(7)*x + S(12))/(S(9)*sqrt(-x**S(2) + S(6)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))*sqrt(x**S(2) + S(2)*x)), x), x, atan(sqrt(x**S(2) + S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((S(2)*x + S(1))*sqrt(x**S(2) + x)), x), x, atan(S(2)*sqrt(x**S(2) + x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-1))/sqrt(-x**S(2) + S(2)*x), x), x, -sqrt(-x**S(2) + S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + x)/(x + S(1)), x), x, sqrt(-x**S(2) + x) + S(3)*asin(S(2)*x + S(-1))/S(2) + sqrt(S(2))*atan(sqrt(S(2))*(-S(3)*x + S(1))/(S(4)*sqrt(-x**S(2) + x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**(S(1)/4) + x), x), x, x**(S(1)/4)*sqrt(x**(S(1)/4) + x)/S(3) + S(2)*x*sqrt(x**(S(1)/4) + x)/S(3) - atanh(sqrt(x)/sqrt(x**(S(1)/4) + x))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**(S(3)/2) + x), x), x, -S(16)*(x**(S(3)/2) + x)**(S(3)/2)/(S(35)*x) + S(4)*(x**(S(3)/2) + x)**(S(3)/2)/(S(7)*sqrt(x)) + S(32)*(x**(S(3)/2) + x)**(S(3)/2)/(S(105)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(x**(S(3)/2) + x), x), x, S(4)*sqrt(x)*(x**(S(3)/2) + x)**(S(3)/2)/S(11) - S(32)*(x**(S(3)/2) + x)**(S(3)/2)/S(99) - S(256)*(x**(S(3)/2) + x)**(S(3)/2)/(S(1155)*x) + S(64)*(x**(S(3)/2) + x)**(S(3)/2)/(S(231)*sqrt(x)) + S(512)*(x**(S(3)/2) + x)**(S(3)/2)/(S(3465)*x**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))*sqrt(S(1)/(-x**S(2) + S(2))), x), x, x/(S(2)*sqrt(S(1)/(-x**S(2) + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(4) + x**S(3) + x**S(2)), x), x, -(-S(2)*x + S(1))*sqrt(-x**S(4) + x**S(3) + x**S(2))/(S(8)*x) - (-x**S(2) + x + S(1))*sqrt(-x**S(4) + x**S(3) + x**S(2))/(S(3)*x) - S(5)*sqrt(-x**S(4) + x**S(3) + x**S(2))*asin(sqrt(S(5))*(-S(2)*x + S(1))/S(5))/(S(16)*x*sqrt(-x**S(2) + x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((a**S(2) + x**S(2))**S(3)), x), x, x*(a**S(2) + x**S(2))/(a**S(2)*sqrt((a**S(2) + x**S(2))**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(sqrt(x) + x + S(1)), x), x, S(2)*sqrt(x) - log(sqrt(x) + x + S(1)) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*sqrt(x) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(x) + x + S(1)), x), x, -S(2)*sqrt(x) + x + S(4)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*sqrt(x) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(sqrt(x) + x + S(1))**(S(7)/2)), x), x, (S(8)*sqrt(x) + S(4))/(S(15)*(sqrt(x) + x + S(1))**(S(5)/2)) + (S(128)*sqrt(x) + S(64))/(S(135)*(sqrt(x) + x + S(1))**(S(3)/2)) + (S(1024)*sqrt(x) + S(512))/(S(405)*sqrt(sqrt(x) + x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(-1))/(sqrt(x**S(2) + S(1)) + S(1)), x), x, sqrt(x**S(2) + S(1)) - log(sqrt(x**S(2) + S(1)) + S(1)) - asinh(x) + sqrt(x**S(2) + S(1))/x - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))**(S(2)/3)*(x**S(2) + S(-1))**(S(2)/3)), x), x, S(3)*(x**S(2) + S(-1))**(S(1)/3)/(S(2)*(x + S(1))**(S(2)/3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-x**S(2) + S(1))/(x + S(1)), x), x, -sqrt(-x**S(2) + S(1))/S(2) - asin(x)/S(2) - (-x**S(2) + S(1))**(S(3)/2)/(S(2)*x + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(6) + S(1))**(S(2)/3) + (-x**S(6) + S(1))**(S(2)/3)/x**S(6), x), x, x*(-x**S(6) + S(1))**(S(2)/3)/S(5) - (-x**S(6) + S(1))**(S(2)/3)/(S(5)*x**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(m + S(-1))*(S(2)*a*m + b*x**n*(S(2)*m - n))/(S(2)*(a + b*x**n)**(S(3)/2)), x), x, x**m/sqrt(a + b*x**n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(2)*x**S(3) + x)/sqrt(S(3)*x + S(2)), x), x, -S(4)*(S(3)*x + S(2))**(S(7)/2)/S(567) + S(8)*(S(3)*x + S(2))**(S(5)/2)/S(135) - S(10)*(S(3)*x + S(2))**(S(3)/2)/S(81) - S(4)*sqrt(S(3)*x + S(2))/S(81), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))**(S(1)/4) + sqrt(x + S(1))), x), x, -S(4)*(x + S(1))**(S(1)/4) + S(2)*sqrt(x + S(1)) + S(4)*log((x + S(1))**(S(1)/4) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(1))/sqrt(x**S(2) + x), x), x, S(2)*sqrt(x**S(2) + x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(2)*sqrt(x)*(x + S(1))), x), x, atan(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(-x**S(2) + S(6)*x)), x), x, -sqrt(-x**S(2) + S(6)*x)/(S(3)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*(sqrt(x) + S(1)), x), x, S(2)*x**(S(3)/2)/S(3) + x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(x) + S(1))/x**(S(1)/3), x), x, -S(6)*x**(S(7)/6)/S(7) + S(3)*x**(S(2)/3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(x**(S(1)/3) + S(1)), x), x, S(6)*x**(S(7)/6)/S(7) - S(6)*x**(S(5)/6)/S(5) - S(6)*x**(S(1)/6) + S(2)*sqrt(x) + S(6)*atan(x**(S(1)/6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x) + S(1))**(S(1)/3)/x, x), x, S(6)*(sqrt(x) + S(1))**(S(1)/3) - log(x)/S(2) + S(3)*log(-(sqrt(x) + S(1))**(S(1)/3) + S(1)) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(S(2)*(sqrt(x) + S(1))**(S(1)/3) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-sqrt(x) + S(1), x), x, -S(2)*x**(S(3)/2)/S(3) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-x**(S(1)/4) + S(1), x), x, -S(4)*x**(S(5)/4)/S(5) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(x) + S(1))/(x**(S(1)/4) + S(1)), x), x, -S(4)*x**(S(5)/4)/S(5) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((a + b*x)*(c + d*x)), x), x, atanh((a*d + b*c + S(2)*b*d*x)/(S(2)*sqrt(b)*sqrt(d)*sqrt(a*c + b*d*x**S(2) + x*(a*d + b*c))))/(sqrt(b)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((a + b*x)*(c - d*x)), x), x, -atan((-a*d + b*c - S(2)*b*d*x)/(S(2)*sqrt(b)*sqrt(d)*sqrt(a*c - b*d*x**S(2) + x*(-a*d + b*c))))/(sqrt(b)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*(-x**S(2) + S(1))), x), x, atan(sqrt(x)) + atanh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(-x**S(3) + x), x), x, atan(sqrt(x)) + atanh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(2) + x*(S(1) + sqrt(S(3))) - sqrt(S(3)) + S(2)), x), x, log(x**S(2) + x*(S(1) + sqrt(S(3))) - sqrt(S(3)) + S(2))/S(2) + sqrt(S(13)/23 + S(8)*sqrt(S(3))/S(23))*atanh((S(2)*x + S(1) + sqrt(S(3)))/sqrt(S(-4) + S(6)*sqrt(S(3)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(3) + x**S(2)), x), x, S(2)*(x**S(3) + x**S(2))**(S(3)/2)/(S(5)*x**S(2)) - S(4)*(x**S(3) + x**S(2))**(S(3)/2)/(S(15)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x + S(1))*sqrt(x**S(2) + S(2)*x)), x), x, atan(sqrt(x**S(2) + S(2)*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*sqrt(-sqrt(x) - x + S(1)), x), x, -sqrt(x)*(-sqrt(x) - x + S(1))**(S(3)/2)/S(2) + (S(9)*sqrt(x)/S(16) + S(9)/32)*sqrt(-sqrt(x) - x + S(1)) + S(5)*(-sqrt(x) - x + S(1))**(S(3)/2)/S(12) + S(45)*asin(sqrt(S(5))*(S(2)*sqrt(x) + S(1))/S(5))/S(64), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x + S(-3)) + S(1))**(S(1)/3), x), x, S(6)*(sqrt(x + S(-3)) + S(1))**(S(7)/3)/S(7) - S(3)*(sqrt(x + S(-3)) + S(1))**(S(4)/3)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(sqrt(S(2)*x + S(-1)) + S(3)), x), x, S(2)*(sqrt(S(2)*x + S(-1)) + S(3))**(S(3)/2)/S(3) - S(6)*sqrt(sqrt(S(2)*x + S(-1)) + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1))/(sqrt(x) + S(1)), x), x, -sqrt(-x + S(1)) - asin(sqrt(x)) - (-x + S(1))**(S(3)/2)/(sqrt(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1))/(-sqrt(x) + S(1)), x), x, -sqrt(-x + S(1)) + asin(sqrt(x)) - (-x + S(1))**(S(3)/2)/(-sqrt(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x - sqrt(x**S(2) + S(1))), x), x, -x**S(3)/S(3) - (x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x - sqrt(-x**S(2) + S(1))), x), x, x/S(2) + sqrt(-x**S(2) + S(1))/S(2) - sqrt(S(2))*atanh(sqrt(S(2))*x)/S(4) - sqrt(S(2))*atanh(sqrt(S(2))*sqrt(-x**S(2) + S(1)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x - sqrt(S(2)*x**S(2) + S(1))), x), x, -x - sqrt(S(2)*x**S(2) + S(1)) + atan(x) + atan(sqrt(S(2)*x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)*sqrt(sqrt(x) + x), x), x, sqrt(x)*(sqrt(x) + x)**(S(3)/2)/S(2) + (S(5)*sqrt(x)/S(16) + S(5)/32)*sqrt(sqrt(x) + x) - S(5)*(sqrt(x) + x)**(S(3)/2)/S(12) - S(5)*atanh(sqrt(x)/sqrt(sqrt(x) + x))/S(32), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**(S(1)/3) + S(1))/(sqrt(x) + S(1)), x), x, S(6)*x**(S(5)/6)/S(5) - S(3)*x**(S(1)/3) + S(2)*sqrt(x) - S(4)*log(x**(S(1)/6) + S(1)) - log(-x**(S(1)/6) + x**(S(1)/3) + S(1)) - S(2)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**(S(1)/6) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**(S(1)/3) + S(1))/(x**(S(1)/4) + S(1)), x), x, S(12)*x**(S(13)/12)/S(13) + S(12)*x**(S(7)/12)/S(7) + S(12)*x**(S(1)/12) - S(6)*x**(S(5)/6)/S(5) + S(4)*x**(S(3)/4)/S(3) + S(4)*x**(S(1)/4) - S(3)*x**(S(1)/3) - S(2)*sqrt(x) - S(8)*log(x**(S(1)/12) + S(1)) - S(2)*log(-x**(S(1)/12) + x**(S(1)/6) + S(1)) + S(4)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x**(S(1)/12) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(x**S(2) + sqrt(-x**S(2) + S(1)) + S(-1)), x), x, x + asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x + S(1))/x), x), x, x*sqrt(S(1) + S(1)/x) + atanh(sqrt(S(1) + S(1)/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-x + S(1))/x), x), x, x*sqrt(S(-1) + S(1)/x) - atan(sqrt(S(-1) + S(1)/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x + S(-1))/x), x), x, sqrt(x)*sqrt(x + S(-1)) - asinh(sqrt(x + S(-1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt((x + S(-1))/x), x), x, x*sqrt(S(1) - S(1)/x) - atanh(sqrt(S(1) - S(1)/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x + S(1))/x)/x, x), x, -S(2)*sqrt(S(1) + S(1)/x) + S(2)*atanh(sqrt(S(1) + S(1)/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x/(x + S(1))), x), x, sqrt(x)*sqrt(x + S(1)) - asinh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-x + S(-1))/x), x), x, -x*sqrt(S(-1) - S(1)/x) + atan(sqrt(S(-1) - S(1)/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x*(-x + S(4))), x), x, (x/S(2) + S(-1))*sqrt(-x**S(2) + S(4)*x) + S(2)*asin(x/S(2) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x*(-x + S(1))), x), x, asin(S(2)*x + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x*(x + S(2)))**(S(3)/2), x), x, x/sqrt(x**S(2) + S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1) + S(1)/x)/(-x**S(2) + S(1)), x), x, sqrt(S(2))*atanh(sqrt(S(2))*sqrt(S(1) + S(1)/x)/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-x**S(2) + sqrt(S(5))*x**S(2) + S(1) + sqrt(S(5))), x), x, atan(x*sqrt(-sqrt(S(5))/S(2) + S(3)/2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-a + x)*(b - x)), x), x, -(a - b)**S(2)*atan((a + b - S(2)*x)/(S(2)*sqrt(-a*b - x**S(2) + x*(a + b))))/S(8) + (-a/S(4) - b/S(4) + x/S(2))*sqrt(-a*b - x**S(2) + x*(a + b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-a + x)*(b - x)), x), x, -atan((a + b - S(2)*x)/(S(2)*sqrt(-a*b - x**S(2) + x*(a + b)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-x**S(2) + S(1))*(x**S(2) + S(3))), x), x, x*sqrt(-x**S(4) - S(2)*x**S(2) + S(3))/S(3) - S(2)*sqrt(S(3))*elliptic_e(asin(x), S(-1)/3)/S(3) + S(4)*sqrt(S(3))*elliptic_f(asin(x), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-x**S(2) + S(1))*(x**S(2) + S(3))), x), x, sqrt(S(3))*elliptic_f(asin(x), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a*x + b*x**S(2)), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x*(a + b*x)), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x**S(2)*(a/x + b)), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x**S(3)*(a/x**S(2) + b/x)), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((a*x**S(2) + b*x**S(3))/x), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((a*x**S(3) + b*x**S(4))/x**S(2)), x), x, S(2)*atanh(sqrt(b)*x/sqrt(a*x + b*x**S(2)))/sqrt(b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a*c*x + b*c*x**S(2)), x), x, S(2)*atanh(sqrt(b)*sqrt(c)*x/sqrt(a*c*x + b*c*x**S(2)))/(sqrt(b)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(c*(a*x + b*x**S(2))), x), x, S(2)*atanh(sqrt(b)*sqrt(c)*x/sqrt(a*c*x + b*c*x**S(2)))/(sqrt(b)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(c*x*(a + b*x)), x), x, S(2)*atanh(sqrt(b)*sqrt(c)*x/sqrt(a*c*x + b*c*x**S(2)))/(sqrt(b)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(c*x**S(2)*(a/x + b)), x), x, S(2)*atanh(sqrt(b)*sqrt(c)*x/sqrt(a*c*x + b*c*x**S(2)))/(sqrt(b)*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + x*sqrt(x**S(2) + S(-1)) + S(1)), x), x, (S(3)*x/S(4) + sqrt(x**S(2) + S(-1))/S(4))*sqrt(-x**S(2) + x*sqrt(x**S(2) + S(-1)) + S(1)) + S(3)*sqrt(S(2))*asin(x - sqrt(x**S(2) + S(-1)))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(x)*sqrt(x + S(1)) - x)/sqrt(x + S(1)), x), x, (sqrt(x)/S(2) + S(3)*sqrt(x + S(1))/S(2))*sqrt(sqrt(x)*sqrt(x + S(1)) - x) - S(3)*sqrt(S(2))*asin(sqrt(x) - sqrt(x + S(1)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-(x + S(2)*sqrt(x**S(2) + S(1)))/(x**S(3) + x + sqrt(x**S(2) + S(1))), x), x, -sqrt(S(2) + S(2)*sqrt(S(5)))*atan(sqrt(S(-2) + sqrt(S(5)))*(x + sqrt(x**S(2) + S(1)))) + sqrt(S(-2) + S(2)*sqrt(S(5)))*atanh(sqrt(S(2) + sqrt(S(5)))*(x + sqrt(x**S(2) + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(1))/((x**S(2) + S(1))*sqrt(x**S(2) + S(2)*x + S(2))), x), x, -sqrt(S(1)/2 + sqrt(S(5))/S(2))*atan((-x*(sqrt(S(5)) + S(5)) + S(2)*sqrt(S(5)))/(sqrt(S(10) + S(10)*sqrt(S(5)))*sqrt(x**S(2) + S(2)*x + S(2)))) - sqrt(S(-1)/2 + sqrt(S(5))/S(2))*atanh((x*(-sqrt(S(5)) + S(5)) + S(2)*sqrt(S(5)))/(sqrt(S(-10) + S(10)*sqrt(S(5)))*sqrt(x**S(2) + S(2)*x + S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-x**S(2) + sqrt(x**S(4) + S(1)))*(x**S(4) + S(1))), x), x, atan(x/sqrt(-x**S(2) + sqrt(x**S(4) + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(4))*sqrt(c*x**S(2) + d*sqrt(a + b*x**S(4)))), x), x, atanh(sqrt(c)*x/sqrt(c*x**S(2) + d*sqrt(a + b*x**S(4))))/(a*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(4))*sqrt(-c*x**S(2) + d*sqrt(a + b*x**S(4)))), x), x, atan(sqrt(c)*x/sqrt(-c*x**S(2) + d*sqrt(a + b*x**S(4))))/(a*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*c**S(4) + S(4)*b*c**S(3)*d*x + S(6)*b*c**S(2)*d**S(2)*x**S(2) + S(4)*b*c*d**S(3)*x**S(3) + b*d**S(4)*x**S(4)), x), x, atanh(sqrt(b)*d**S(2)*(c/d + x)**S(2)/sqrt(a + b*d**S(4)*(c/d + x)**S(4)))/(S(2)*sqrt(b)*d**S(2)) - c*sqrt((a + b*d**S(4)*(c/d + x)**S(4))/(sqrt(a) + sqrt(b)*d**S(2)*(c/d + x)**S(2))**S(2))*(sqrt(a) + sqrt(b)*d**S(2)*(c/d + x)**S(2))*elliptic_f(S(2)*atan(b**(S(1)/4)*d*(c/d + x)/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*b**(S(1)/4)*d**S(2)*sqrt(a + b*d**S(4)*(c/d + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*c**S(4) + S(4)*b*c**S(3)*d*x + S(6)*b*c**S(2)*d**S(2)*x**S(2) + S(4)*b*c*d**S(3)*x**S(3) + b*d**S(4)*x**S(4)), x), x, sqrt((a + b*d**S(4)*(c/d + x)**S(4))/(sqrt(a) + sqrt(b)*d**S(2)*(c/d + x)**S(2))**S(2))*(sqrt(a) + sqrt(b)*d**S(2)*(c/d + x)**S(2))*elliptic_f(S(2)*atan(b**(S(1)/4)*d*(c/d + x)/a**(S(1)/4)), S(1)/2)/(S(2)*a**(S(1)/4)*b**(S(1)/4)*d*sqrt(a + b*d**S(4)*(c/d + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - c*x**S(4))/(sqrt(a + b*x**S(2) + c*x**S(4))*(a*d + a*e*x**S(2) + c*d*x**S(4))), x), x, atanh(x*sqrt(-a*e + b*d)/(sqrt(d)*sqrt(a + b*x**S(2) + c*x**S(4))))/(sqrt(d)*sqrt(-a*e + b*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - c*x**S(4))/(sqrt(a - b*x**S(2) + c*x**S(4))*(a*d + a*e*x**S(2) + c*d*x**S(4))), x), x, atan(x*sqrt(a*e + b*d)/(sqrt(d)*sqrt(a - b*x**S(2) + c*x**S(4))))/(sqrt(d)*sqrt(a*e + b*d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((x**S(3) + S(8))*sqrt(x**S(2) - S(2)*x + S(5))), x), x, -sqrt(S(3))*atan(sqrt(S(3))*(-x + S(1))/(S(3)*sqrt(x**S(2) - S(2)*x + S(5))))/S(12) - sqrt(S(13))*atanh(sqrt(S(13))*(-S(3)*x + S(7))/(S(13)*sqrt(x**S(2) - S(2)*x + S(5))))/S(156) + atanh(sqrt(x**S(2) - S(2)*x + S(5)))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2)/(x**S(2) + S(1))), x), x, sqrt(x**S(2) + S(1))*sqrt(x**S(2))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**n/(x**n + S(1))), x), x, S(2)*x*sqrt(x**n)*hyper((S(1)/2, S(1)/2 + S(1)/n), (S(3)/2 + S(1)/n,), -x**n)/(n + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-e*f*x**S(2) + e*f)/((a*d*x**S(2) + a*d + b*d*x)*sqrt(a*x**S(4) + a + b*x**S(3) + b*x + c*x**S(2))), x), x, e*f*atan((a*b*x**S(2) + a*b + x*(S(4)*a**S(2) - S(2)*a*c + b**S(2)))/(S(2)*a*sqrt(S(2)*a - c)*sqrt(a*x**S(4) + a + b*x**S(3) + b*x + c*x**S(2))))/(a*d*sqrt(S(2)*a - c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-e*f*x**S(2) + e*f)/((-a*d*x**S(2) - a*d + b*d*x)*sqrt(-a*x**S(4) - a + b*x**S(3) + b*x + c*x**S(2))), x), x, e*f*atanh((a*b*x**S(2) + a*b - x*(S(4)*a**S(2) + S(2)*a*c + b**S(2)))/(S(2)*a*sqrt(S(2)*a + c)*sqrt(-a*x**S(4) - a + b*x**S(3) + b*x + c*x**S(2))))/(a*d*sqrt(S(2)*a + c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a*x**S(2) + b*x*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2)))/(x*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2))), x), x, sqrt(S(2))*b*asinh((a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2)))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a*x**S(2) + b*x*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2)))/(x*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2))), x), x, sqrt(S(2))*b*asin((a*x - b*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2)))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x*(a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2))))/(x*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2))), x), x, sqrt(S(2))*b*asinh((a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) - a/b**S(2)))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x*(-a*x + b*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2))))/(x*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2))), x), x, sqrt(S(2))*b*asin((a*x - b*sqrt(a**S(2)*x**S(2)/b**S(2) + a/b**S(2)))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x*sqrt(x + S(-4)) + x*sqrt(x + S(-1)) - sqrt(x + S(-4)) - S(4)*sqrt(x + S(-1)))/((x**S(2) - S(5)*x + S(4))*(sqrt(x + S(-4)) + sqrt(x + S(-1)) + S(1))), x), x, S(2)*log(sqrt(x + S(-4)) + sqrt(x + S(-1)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(x**S(2) + S(3)*x + S(3))*(x**S(3) + S(3)*x**S(2) + S(3)*x + S(3))**(S(1)/3)), x), x, S(3)**(S(2)/3)*log(-S(3)**(S(1)/3)*(x + S(1))/((x + S(1))**S(3) + S(2))**(S(1)/3) + S(1))/S(9) - S(3)**(S(2)/3)*log(S(3)**(S(2)/3)*(x + S(1))**S(2)/((x + S(1))**S(3) + S(2))**(S(2)/3) + S(3)**(S(1)/3)*(x + S(1))/((x + S(1))**S(3) + S(2))**(S(1)/3) + S(1))/S(18) - S(3)**(S(1)/6)*atan(sqrt(S(3))*(S(2)*S(3)**(S(1)/3)*(x + S(1))/((x + S(1))**S(3) + S(2))**(S(1)/3) + S(1))/S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(1))/((-x**S(3) + S(1))**(S(2)/3)*(x**S(2) - x + S(1))), x), x, S(3)*S(2)**(S(1)/3)*log(S(2)**(S(1)/3)*(-x + S(1)) + (-x**S(3) + S(1))**(S(1)/3))/S(4) - S(2)**(S(1)/3)*log(-x**S(3) + S(2)*(-x + S(1))**S(3) + S(1))/S(4) + S(2)**(S(1)/3)*sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*S(2)**(S(1)/3)*(-x + S(1))/(-x**S(3) + S(1))**(S(1)/3) + S(1))/S(3))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(sqrt(x**S(4) + S(-1))*(x**S(4) + S(1))), x), x, -atan((x**S(2) + S(1))/(x*sqrt(x**S(4) + S(-1))))/S(4) - atanh((-x**S(2) + S(1))/(x*sqrt(x**S(4) + S(-1))))/S(4), expand=True, _diff=True, _numerical=True) def test_3(): assert rubi_test(rubi_integrate(sqrt(x**S(2) + S(-1))/sqrt(x**S(4) + S(-1)), x), x, sqrt(x**S(2) + S(-1))*sqrt(x**S(2) + S(1))*asinh(x)/sqrt(x**S(4) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2) + S(1))/sqrt(x**S(4) + S(-1)), x), x, -sqrt(x**S(4) + S(-1))*asin(x)/sqrt(-x**S(4) + S(1)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(x**S(2) + S(1))/sqrt(x**S(4) + S(-1)), x), x, sqrt(x**S(2) + S(-1))*sqrt(x**S(2) + S(1))*atanh(x/sqrt(x**S(2) + S(-1)))/sqrt(x**S(4) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(x**S(2) + S(-1)) + sqrt(x**S(2) + S(1)))/sqrt(x**S(4) + S(-1)), x), x, sqrt(x**S(2) + S(-1))*sqrt(x**S(4) + S(-1))*asinh(x)/((-x**S(2) + S(1))*sqrt(x**S(2) + S(1))) - sqrt(x**S(4) + S(-1))*asin(x)/(sqrt(-x**S(2) + S(1))*sqrt(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((-sqrt(x**S(2) + S(-1)) + sqrt(x**S(2) + S(1)))/sqrt(x**S(4) + S(-1)), x), x, -sqrt(x**S(2) + S(-1))*sqrt(x**S(2) + S(1))*asinh(x)/sqrt(x**S(4) + S(-1)) + sqrt(x**S(2) + S(-1))*sqrt(x**S(2) + S(1))*atanh(x/sqrt(x**S(2) + S(-1)))/sqrt(x**S(4) + S(-1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(-x**S(2) + S(1))**S(5), x), x, S(1)/(S(8)*(-x**S(2) + S(1))**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-S(5)/(S(256)*(x + S(1))**S(2)) - S(5)/(S(128)*(x + S(1))**S(3)) - S(3)/(S(64)*(x + S(1))**S(4)) - S(1)/(S(32)*(x + S(1))**S(5)) + S(5)/(S(256)*(x + S(-1))**S(2)) - S(5)/(S(128)*(x + S(-1))**S(3)) + S(3)/(S(64)*(x + S(-1))**S(4)) - S(1)/(S(32)*(x + S(-1))**S(5)), x), x, S(1)/(S(8)*(-x**S(2) + S(1))**S(4)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(-S(5)/(S(256)*(x + S(1))**S(2)) - S(5)/(S(128)*(x + S(1))**S(3)) - S(3)/(S(64)*(x + S(1))**S(4)) - S(1)/(S(32)*(x + S(1))**S(5)) + S(5)/(S(256)*(x + S(-1))**S(2)) - S(5)/(S(128)*(x + S(-1))**S(3)) + S(3)/(S(64)*(x + S(-1))**S(4)) - S(1)/(S(32)*(x + S(-1))**S(5)), x), x, S(5)/(S(256)*(x + S(1))) + S(5)/(S(256)*(x + S(1))**S(2)) + S(1)/(S(64)*(x + S(1))**S(3)) + S(1)/(S(128)*(x + S(1))**S(4)) + S(5)/(S(256)*(-x + S(1))) + S(5)/(S(256)*(-x + S(1))**S(2)) + S(1)/(S(64)*(-x + S(1))**S(3)) + S(1)/(S(128)*(-x + S(1))**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2))/(x**S(2) + S(2)*x + S(-1)), x), x, (-sqrt(S(2)) + S(2))*log(x + S(1) + sqrt(S(2)))/S(4) + (sqrt(S(2)) + S(2))*log(x - sqrt(S(2)) + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-4))/(x**S(3) - S(5)*x + S(2)), x), x, (-sqrt(S(2)) + S(2))*log(x + S(1) + sqrt(S(2)))/S(4) + (sqrt(S(2)) + S(2))*log(x - sqrt(S(2)) + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x**S(8) + S(1))/(x*(x**S(8) + S(1))**(S(3)/2)), x), x, -atanh(sqrt(x**S(8) + S(1)))/S(4) - S(1)/(S(4)*sqrt(x**S(8) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(8) + S(1))*(S(2)*x**S(8) + S(1))/(x**S(17) + S(2)*x**S(9) + x), x), x, -atanh(sqrt(x**S(8) + S(1)))/S(4) - S(1)/(S(4)*sqrt(x**S(8) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-S(9)*x**S(2) + x/sqrt(-S(9)*x**S(2) + S(1)) + S(1), x), x, -S(3)*x**S(3) + x - sqrt(-S(9)*x**S(2) + S(1))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + (-S(9)*x**S(2) + S(1))**(S(3)/2))/sqrt(-S(9)*x**S(2) + S(1)), x), x, -S(3)*x**S(3) + x - sqrt(-S(9)*x**S(2) + S(1))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(3)*sqrt(x) + x)**(S(2)/3)*(S(2)*sqrt(x) + S(-3))/sqrt(x), x), x, S(6)*(-S(3)*sqrt(x) + x)**(S(5)/3)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(9)*sqrt(x) + S(2)*x + S(9))/(-S(3)*sqrt(x) + x)**(S(1)/3), x), x, S(6)*(-S(3)*sqrt(x) + x)**(S(5)/3)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(2)/(S(4)*x**S(2) + S(-1)), x), x, -atanh(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-S(1)/(S(2)*x + S(1)) + S(1)/(S(2)*x + S(-1)), x), x, log(-S(2)*x + S(1))/S(2) - log(S(2)*x + S(1))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-S(9)*x**S(2) + S(4)), x), x, asin(S(3)*x/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-S(3)*x + S(2))*sqrt(S(3)*x + S(2))), x), x, asin(S(3)*x/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-S(3)*x + S(2))*(S(3)*x + S(2))), x), x, asin(S(3)*x/S(2))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(2) - S(2)*x + S(15)), x), x, asin(x/S(4) + S(1)/4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-x + S(3))*sqrt(x + S(5))), x), x, asin(x/S(4) + S(1)/4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-x + S(3))*(x + S(5))), x), x, asin(x/S(4) + S(1)/4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(2) - S(8)*x + S(-15)), x), x, asin(x + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(-x + S(-3))*sqrt(x + S(5))), x), x, asin(x + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt((-x + S(-3))*(x + S(5))), x), x, asin(x + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(-sqrt(x) + S(1), x), x, -S(2)*x**(S(3)/2)/S(3) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x + S(1))/(sqrt(x) + S(1)), x), x, -S(2)*x**(S(3)/2)/S(3) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1)/(-x**S(2) + S(1))), x), x, sqrt(-x**S(2) + S(1))*sqrt(S(1)/(-x**S(2) + S(1)))*asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x**S(2) + S(1))/(-x**S(4) + S(1))), x), x, sqrt(-x**S(2) + S(1))*sqrt(S(1)/(-x**S(2) + S(1)))*asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1)/(x**S(2) + S(-1))), x), x, sqrt(x**S(2) + S(-1))*sqrt(S(1)/(x**S(2) + S(-1)))*atanh(x/sqrt(x**S(2) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x**S(2) + S(1))/(x**S(4) + S(-1))), x), x, sqrt(x**S(2) + S(-1))*sqrt(S(1)/(x**S(2) + S(-1)))*atanh(x/sqrt(x**S(2) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(6) + S(1))/(x**S(6) + S(-1)), x), x, x + log(x**S(2) - x + S(1))/S(6) - log(x**S(2) + x + S(1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3) - S(2)*atanh(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x**(S(-3)))/(x**S(3) - S(1)/x**S(3)), x), x, x + log(x**S(2) - x + S(1))/S(6) - log(x**S(2) + x + S(1))/S(6) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(3) - sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(3) - S(2)*atanh(x)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x + S(1)), x), x, -S(2)*sqrt(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + S(1))/sqrt(-x**S(2) + S(1)), x), x, -S(2)*sqrt(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x + S(1)), x), x, S(2)*sqrt(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1))/sqrt(-x**S(2) + S(1)), x), x, S(2)*sqrt(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1)), x), x, -S(2)*(-x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/sqrt(x + S(1)), x), x, -S(2)*(-x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + S(1)), x), x, S(2)*(x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/sqrt(-x + S(1)), x), x, S(2)*(x + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(3)*x + S(2))/sqrt(x + S(1)), x), x, sqrt(x + S(1))*sqrt(S(3)*x + S(2)) - sqrt(S(3))*asinh(sqrt(S(3)*x + S(2)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x + S(1))*sqrt(S(3)*x + S(2))/sqrt(-x**S(2) + S(1)), x), x, sqrt(x + S(1))*sqrt(S(3)*x + S(2)) - sqrt(S(3))*asinh(sqrt(S(3)*x + S(2)))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))**(S(3)/2)/(x*(-x + S(1))**(S(3)/2)), x), x, -asin(x) - atanh(sqrt(-x + S(1))*sqrt(x + S(1))) + S(4)*sqrt(x + S(1))/sqrt(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))**S(3)/(x*(-x**S(2) + S(1))**(S(3)/2)), x), x, -asin(x) - atanh(sqrt(-x**S(2) + S(1))) + S(4)*sqrt(-x**S(2) + S(1))/(-x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + S(1))**(S(3)/2)/(x*(-a*x + S(1))**(S(3)/2)), x), x, -asin(a*x) - atanh(sqrt(-a*x + S(1))*sqrt(a*x + S(1))) + S(4)*sqrt(a*x + S(1))/sqrt(-a*x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a*x + S(1))**S(3)/(x*(-a**S(2)*x**S(2) + S(1))**(S(3)/2)), x), x, -asin(a*x) - atanh(sqrt(-a**S(2)*x**S(2) + S(1))) + S(4)*sqrt(-a**S(2)*x**S(2) + S(1))/(-a*x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(2) + S(1)), x), x, asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2) + S(1))/sqrt(-x**S(4) + S(1)), x), x, asin(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x**S(2) + S(1)), x), x, asinh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1))/sqrt(-x**S(4) + S(1)), x), x, asinh(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(2) + S(1)), x), x, x*sqrt(-x**S(2) + S(1))/S(2) + asin(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(4) + S(1))/sqrt(x**S(2) + S(1)), x), x, x*sqrt(-x**S(2) + S(1))/S(2) + asin(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2) + S(1)), x), x, x*sqrt(x**S(2) + S(1))/S(2) + asinh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(4) + S(1))/sqrt(-x**S(2) + S(1)), x), x, x*sqrt(x**S(2) + S(1))/S(2) + asinh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2)*c + a**S(2)*d*x + S(2)*a*b*c*x**S(2) + S(2)*a*b*d*x**S(3) + b**S(2)*c*x**S(4) + b**S(2)*d*x**S(5))/(c + d*x), x), x, a**S(2)*x + S(2)*a*b*x**S(3)/S(3) + b**S(2)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2)*c + a**S(2)*d*x + S(2)*a*b*c*x**S(2) + S(2)*a*b*d*x**S(3) + b**S(2)*c*x**S(4) + b**S(2)*d*x**S(5))/(c + d*x)**S(2), x), x, -b**S(2)*c*x**S(3)/(S(3)*d**S(2)) + b**S(2)*x**S(4)/(S(4)*d) - b*c*x*(S(2)*a*d**S(2) + b*c**S(2))/d**S(4) + b*x**S(2)*(S(2)*a*d**S(2) + b*c**S(2))/(S(2)*d**S(3)) + (a*d**S(2) + b*c**S(2))**S(2)*log(c + d*x)/d**S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2)*c + a**S(2)*d*x + S(2)*a*b*c*x**S(2) + S(2)*a*b*d*x**S(3) + b**S(2)*c*x**S(4) + b**S(2)*d*x**S(5))/(a + b*x**S(2)), x), x, a*c*x + a*d*x**S(2)/S(2) + b*c*x**S(3)/S(3) + b*d*x**S(4)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2)*c + a**S(2)*d*x + S(2)*a*b*c*x**S(2) + S(2)*a*b*d*x**S(3) + b**S(2)*c*x**S(4) + b**S(2)*d*x**S(5))/(a + b*x**S(2))**S(2), x), x, c*x + d*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a**S(2)*c + a**S(2)*d*x + S(2)*a*b*c*x**S(2) + S(2)*a*b*d*x**S(3) + b**S(2)*c*x**S(4) + b**S(2)*d*x**S(5))/(a + b*x**S(2))**S(3), x), x, d*log(a + b*x**S(2))/(S(2)*b) + c*atan(sqrt(b)*x/sqrt(a))/(sqrt(a)*sqrt(b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((a + b + c*x**S(2))/d)**m, x), x, d*x*(c*x**S(2)/d + (a + b)/d)**(m + S(1))*hyper((S(1), m + S(3)/2), (S(3)/2,), -c*x**S(2)/(a + b))/(a + b), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(((a + b + c*x**S(2))/d)**m, x), x, x*(c*x**S(2)/d + (a + b)/d)**m*(c*x**S(2)/(a + b) + S(1))**(-m)*hyper((S(1)/2, -m), (S(3)/2,), -c*x**S(2)/(a + b)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(x**S(2) + S(1))), x), x, -x**S(2)/S(2) - x*sqrt(x**S(2) + S(1))/S(2) - asinh(x)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(-x**S(2) + S(1))), x), x, log(-S(2)*x**S(2) + S(1))/S(4) - asin(x)/S(2) - atanh(x/sqrt(-x**S(2) + S(1)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(S(2)*x**S(2) + S(1))), x), x, -log(x**S(2) + S(1))/S(2) - sqrt(S(2))*asinh(sqrt(S(2))*x) + atanh(x/sqrt(S(2)*x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(3) + x**S(2)*sqrt(-x**S(2) + S(2)) + S(2)*x)/(S(2)*x**S(2) + S(-2)), x), x, -x**S(2)/S(4) + x*sqrt(-x**S(2) + S(2))/S(4) + log(-x**S(2) + S(1))/S(4) - atanh(x/sqrt(-x**S(2) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-x**S(2) + S(2))/(x - sqrt(-x**S(2) + S(2))), x), x, -x**S(2)/S(4) + x*sqrt(-x**S(2) + S(2))/S(4) + log(-x + S(1))/S(4) + log(x + S(1))/S(4) - atanh(x/sqrt(-x**S(2) + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(-x + sqrt(-x**S(2) + S(2)*x)), x), x, -x/S(2) - sqrt(-x**S(2) + S(2)*x)/S(2) - log(-x + S(1))/S(2) + atanh(sqrt(-x**S(2) + S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(-x**S(2) + S(2)*x))/(-S(2)*x + S(2)), x), x, -x/S(2) - sqrt(-x**S(2) + S(2)*x)/S(2) - log(-x + S(1))/S(2) + atanh(sqrt(-x**S(2) + S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x)*sqrt(-x + S(2)) + x)/(-S(2)*x + S(2)), x), x, -x/S(2) - sqrt(-x**S(2) + S(2)*x)/S(2) - log(-x + S(1))/S(2) + atanh(sqrt(-x**S(2) + S(2)*x))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/(-sqrt(x) + sqrt(-x + S(2))), x), x, -sqrt(x)*sqrt(-x + S(2))/S(2) - x/S(2) - log(-x + S(1))/S(2) + atanh(sqrt(x)*sqrt(-x + S(2)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*sqrt(-x + S(3)) + S(3)/sqrt(x + S(1)))**S(2)/x, x), x, -S(4)*x + S(21)*log(x) - S(9)*log(x + S(1)) - S(12)*asin(x/S(2) + S(-1)/2) - S(24)*sqrt(S(3))*atanh(sqrt(S(3))*sqrt(x + S(1))/sqrt(-x + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x + S(-1))/(sqrt(x**S(2) + S(1)) + S(1)), x), x, x*sqrt(x**S(2) + S(1))/S(2) - x + sqrt(x**S(2) + S(1)) - log(sqrt(x**S(2) + S(1)) + S(1)) - asinh(x)/S(2) + sqrt(x**S(2) + S(1))/x - S(1)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + x + S(-1))/(x + sqrt(x**S(2) + S(1)) + S(1)), x), x, x**S(3)/S(6) + x**S(2)/S(2) + sqrt(x**S(2) + S(1))*(-S(2)*x**S(2) - S(3)*x + S(4))/S(12) - log(sqrt(x**S(2) + S(1)) + S(1))/S(2) - asinh(x)/S(4), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((x**S(2) + x + S(-1))/(x + sqrt(x**S(2) + S(1)) + S(1)), x), x, x**S(3)/S(6) + x**S(2)/S(2) - x*sqrt(x**S(2) + S(1))/S(4) + x/S(2) - (x**S(2) + S(1))**(S(3)/2)/S(6) + log(x + sqrt(x**S(2) + S(1)))/S(2) - log(x + sqrt(x**S(2) + S(1)) + S(1)) - asinh(x)/S(4) + S(1)/(S(2)*(x + sqrt(x**S(2) + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(2)*sqrt(x + S(-1)))/(x*sqrt(x + S(-1))), x), x, S(2)*sqrt(x + S(-1)) + S(2)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**(S(2)/3) + c*sqrt(x))**S(2), x), x, a**S(2)*x + S(6)*a*b*x**(S(5)/3)/S(5) + S(4)*a*c*x**(S(3)/2)/S(3) + S(3)*b**S(2)*x**(S(7)/3)/S(7) + S(12)*b*c*x**(S(13)/6)/S(13) + c**S(2)*x**S(2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**(S(2)/3) + c*sqrt(x))**S(3), x), x, a**S(3)*x + S(9)*a**S(2)*b*x**(S(5)/3)/S(5) + S(2)*a**S(2)*c*x**(S(3)/2) + S(9)*a*b**S(2)*x**(S(7)/3)/S(7) + S(36)*a*b*c*x**(S(13)/6)/S(13) + S(3)*a*c**S(2)*x**S(2)/S(2) + b**S(3)*x**S(3)/S(3) + S(18)*b**S(2)*c*x**(S(17)/6)/S(17) + S(9)*b*c**S(2)*x**(S(8)/3)/S(8) + S(2)*c**S(3)*x**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/(x**S(3)*sqrt(a - b + b/x**S(2))), x), x, atanh(sqrt(a - b + b/x**S(2))/sqrt(a - b))/sqrt(a - b) + sqrt(a - b + b/x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/(x**S(3)*sqrt(a + b*(S(-1) + x**(S(-2))))), x), x, atanh(sqrt(a - b + b/x**S(2))/sqrt(a - b))/sqrt(a - b) + sqrt(a - b + b/x**S(2))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c + d*x)**S(2)/(a + b*x**S(3)), x), x, -a**(S(1)/3)*d*(-a**(S(1)/3)*d + S(2)*b**(S(1)/3)*c)*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*b**(S(5)/3)) + a**(S(1)/3)*d*(-a**(S(1)/3)*d + S(2)*b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*b**(S(5)/3)) + sqrt(S(3))*a**(S(1)/3)*d*(a**(S(1)/3)*d + S(2)*b**(S(1)/3)*c)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*b**(S(5)/3)) + c**S(2)*log(a + b*x**S(3))/(S(3)*b) + S(2)*c*d*x/b + d**S(2)*x**S(2)/(S(2)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))/((x**S(2) + S(4))*sqrt(x**S(2) + S(9))), x), x, sqrt(S(5))*atan(sqrt(S(5))*x/(S(2)*sqrt(x**S(2) + S(9))))/S(10) - sqrt(S(5))*atanh(sqrt(S(5))*sqrt(x**S(2) + S(9))/S(5))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(sqrt(-x**S(2) + S(1)) + S(1)), x), x, x**S(2)/S(2) - (-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(sqrt(-x + S(1))*sqrt(x + S(1)) + S(1)), x), x, x**S(2)/S(2) - (-x**S(2) + S(1))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(1) + S(1)/(sqrt(x + S(2))*sqrt(x + S(3)))), x), x, x**S(2)/S(2) + sqrt(x + S(2))*sqrt(x + S(3)) - S(5)*asinh(sqrt(x + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(x**S(6)))/(x*(-x**S(4) + S(1))), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(1) - sqrt(x**S(6))/x)/(-x**S(4) + S(1)), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x - sqrt(x**S(6)))/(-x**S(5) + x), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x + sqrt(x**S(6))), x), x, atan(x)/S(2) + atanh(x)/S(2) + sqrt(x**S(6))*atan(x)/(S(2)*x**S(3)) - sqrt(x**S(6))*atanh(x)/(S(2)*x**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x) - sqrt(x**S(3)))/(-x**S(3) + x), x), x, atan(sqrt(x)) + atanh(sqrt(x)) + sqrt(x**S(3))*atan(sqrt(x))/x**(S(3)/2) - sqrt(x**S(3))*atanh(sqrt(x))/x**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x) + sqrt(x**S(3))), x), x, atan(sqrt(x)) + atanh(sqrt(x)) + sqrt(x**S(3))*atan(sqrt(x))/x**(S(3)/2) - sqrt(x**S(3))*atanh(sqrt(x))/x**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x + S(-1)) + sqrt((x + S(-1))**S(3))), x), x, atan(sqrt(x + S(-1))) + atanh(sqrt(x + S(-1))) + sqrt((x + S(-1))**S(3))*atan(sqrt(x + S(-1)))/(x + S(-1))**(S(3)/2) - sqrt((x + S(-1))**S(3))*atanh(sqrt(x + S(-1)))/(x + S(-1))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(4)*x + S(-5))/((S(5)*x + S(4))**S(2)*sqrt(-x**S(2) + S(1))) - S(3)/(S(5)*x + S(4))**S(2), x), x, sqrt(-x**S(2) + S(1))/(S(5)*x + S(4)) + S(3)/(S(5)*(S(5)*x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(4)*x - S(3)*sqrt(-x**S(2) + S(1)) + S(-5))/((S(5)*x + S(4))**S(2)*sqrt(-x**S(2) + S(1))), x), x, sqrt(-x**S(2) + S(1))/(S(5)*x + S(4)) + S(3)/(S(5)*(S(5)*x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-S(3)*x**S(2) + (-S(4)*x + S(-5))*sqrt(-x**S(2) + S(1)) + S(3)), x), x, sqrt(-x**S(2) + S(1))/(S(5)*x + S(4)) + S(3)/(S(5)*(S(5)*x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-S(3)*x**S(2) - S(4)*x*sqrt(-x**S(2) + S(1)) - S(5)*sqrt(-x**S(2) + S(1)) + S(3)), x), x, sqrt(-x**S(2) + S(1))/(S(5)*x + S(4)) + S(3)/(S(5)*(S(5)*x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(-x**S(2) + S(1)) + S(-1))/(sqrt(-x**S(2) + S(1))*(x - S(2)*sqrt(-x**S(2) + S(1)) + S(2))**S(2)), x), x, sqrt(-x**S(2) + S(1))/(S(5)*x + S(4)) + S(3)/(S(5)*(S(5)*x + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**(n + S(-1)))/(c*x + d*x**n), x), x, b*log(x)/d - (-a*d + b*c)*log(c*x**(-n + S(1)) + d)/(c*d*(-n + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(5) + S(2)*x**S(3) - x)/(x**S(4) + S(2)*x**S(2) + S(3))**S(2), x), x, (-S(7)*x**S(2)/S(8) + S(5)/8)/(x**S(4) + S(2)*x**S(2) + S(3)) + S(9)*sqrt(S(2))*atan(sqrt(S(2))*(x**S(2) + S(1))/S(2))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(5) + x)/(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**S(3), x), x, (x**S(2)/S(4) + S(3)/16)/(S(2)*x**S(4) + S(2)*x**S(2) + S(1))**S(2) + (x**S(2) + S(1)/2)/(S(2)*x**S(4) + S(2)*x**S(2) + S(1)) + atan(S(2)*x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x + c*x**S(2))/(d + e*x**S(2) + f*x**S(4)), x), x, -b*atanh((e + S(2)*f*x**S(2))/sqrt(-S(4)*d*f + e**S(2)))/sqrt(-S(4)*d*f + e**S(2)) + sqrt(S(2))*(c + (-S(2)*a*f + c*e)/sqrt(-S(4)*d*f + e**S(2)))*atan(sqrt(S(2))*sqrt(f)*x/sqrt(e + sqrt(-S(4)*d*f + e**S(2))))/(S(2)*sqrt(f)*sqrt(e + sqrt(-S(4)*d*f + e**S(2)))) + sqrt(S(2))*(c + (S(2)*a*f - c*e)/sqrt(-S(4)*d*f + e**S(2)))*atan(sqrt(S(2))*sqrt(f)*x/sqrt(e - sqrt(-S(4)*d*f + e**S(2))))/(S(2)*sqrt(f)*sqrt(e - sqrt(-S(4)*d*f + e**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((d + e*x)**S(2)/(a + b*x**S(2) + c*x**S(4)), x), x, -S(2)*d*e*atanh((b + S(2)*c*x**S(2))/sqrt(-S(4)*a*c + b**S(2)))/sqrt(-S(4)*a*c + b**S(2)) + sqrt(S(2))*(e**S(2) + (b*e**S(2) - S(2)*c*d**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b + sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b + sqrt(-S(4)*a*c + b**S(2)))) + sqrt(S(2))*(e**S(2) + (-b*e**S(2) + S(2)*c*d**S(2))/sqrt(-S(4)*a*c + b**S(2)))*atan(sqrt(S(2))*sqrt(c)*x/sqrt(b - sqrt(-S(4)*a*c + b**S(2))))/(S(2)*sqrt(c)*sqrt(b - sqrt(-S(4)*a*c + b**S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x**S(2) + S(1))/(sqrt(S(2)*x**S(2) + S(1)) + S(1)), x), x, x - sqrt(S(2))*asinh(sqrt(S(2))*x)/S(2) + sqrt(S(2)*x**S(2) + S(1))/(S(2)*x) - S(1)/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(4)*x**S(2) + S(-1))/(x + sqrt(S(4)*x**S(2) + S(-1))), x), x, S(4)*x/S(3) - sqrt(S(4)*x**S(2) + S(-1))/S(3) - sqrt(S(3))*atanh(sqrt(S(3))*x)/S(9) + sqrt(S(3))*atanh(sqrt(S(3))*sqrt(S(4)*x**S(2) + S(-1)))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((a + b*x)*(c + d*x)), x), x, a**S(2)*log(a + b*x)/(b**S(2)*(-a*d + b*c)) - c**S(2)*log(c + d*x)/(d**S(2)*(-a*d + b*c)) + x/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((a + b*x**S(2))*(c + d*x)), x), x, -sqrt(a)*c*atan(sqrt(b)*x/sqrt(a))/(sqrt(b)*(a*d**S(2) + b*c**S(2))) + a*d*log(a + b*x**S(2))/(S(2)*b*(a*d**S(2) + b*c**S(2))) + c**S(2)*log(c + d*x)/(d*(a*d**S(2) + b*c**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((a + b*x**S(3))*(c + d*x)), x), x, a**(S(1)/3)*d*(a**(S(1)/3)*d + b**(S(1)/3)*c)*log(a**(S(1)/3) + b**(S(1)/3)*x)/(S(3)*b**(S(2)/3)*(-a*d**S(3) + b*c**S(3))) - a**(S(1)/3)*d*(a**(S(1)/3)*d + b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*x + b**(S(2)/3)*x**S(2))/(S(6)*b**(S(2)/3)*(-a*d**S(3) + b*c**S(3))) - sqrt(S(3))*a**(S(1)/3)*d*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*x)/(S(3)*a**(S(1)/3)))/(S(3)*b**(S(2)/3)*(a**(S(2)/3)*d**S(2) + a**(S(1)/3)*b**(S(1)/3)*c*d + b**(S(2)/3)*c**S(2))) + c**S(2)*log(a + b*x**S(3))/(S(3)*(-a*d**S(3) + b*c**S(3))) - c**S(2)*log(c + d*x)/(-a*d**S(3) + b*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((a + b*x**S(4))*(c + d*x)), x), x, sqrt(a)*d**S(3)*atan(sqrt(b)*x**S(2)/sqrt(a))/(S(2)*sqrt(b)*(a*d**S(4) + b*c**S(4))) - c**S(2)*d*log(a + b*x**S(4))/(S(4)*(a*d**S(4) + b*c**S(4))) + c**S(2)*d*log(c + d*x)/(a*d**S(4) + b*c**S(4)) - sqrt(S(2))*c*(-sqrt(a)*d**S(2) + sqrt(b)*c**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(1)/4)*b**(S(1)/4)*(a*d**S(4) + b*c**S(4))) + sqrt(S(2))*c*(-sqrt(a)*d**S(2) + sqrt(b)*c**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*x/a**(S(1)/4))/(S(4)*a**(S(1)/4)*b**(S(1)/4)*(a*d**S(4) + b*c**S(4))) + sqrt(S(2))*c*(sqrt(a)*d**S(2) + sqrt(b)*c**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(1)/4)*b**(S(1)/4)*(a*d**S(4) + b*c**S(4))) - sqrt(S(2))*c*(sqrt(a)*d**S(2) + sqrt(b)*c**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*x + sqrt(a) + sqrt(b)*x**S(2))/(S(8)*a**(S(1)/4)*b**(S(1)/4)*(a*d**S(4) + b*c**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/((-x + S(1))*(x + S(1))**S(2)), x), x, atanh(x)/S(2) + S(1)/(S(2)*(x + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/((-x**S(2) + S(1))*(x**S(2) + S(1))**S(2)), x), x, -x/(S(4)*(x**S(2) + S(1))) + atanh(x)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/((-x**S(3) + S(1))*(x**S(3) + S(1))**S(2)), x), x, -x/(S(6)*(x**S(3) + S(1))) - log(-x + S(1))/S(12) - log(x + S(1))/S(36) + log(x**S(2) - x + S(1))/S(72) + log(x**S(2) + x + S(1))/S(24) + sqrt(S(3))*atan(sqrt(S(3))*(-S(2)*x + S(1))/S(3))/S(36) + sqrt(S(3))*atan(sqrt(S(3))*(S(2)*x + S(1))/S(3))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x + c*x**S(2))/((d + e*x)**S(3)*sqrt(x**S(2) + S(-1))), x), x, (a*(S(2)*d**S(2) + e**S(2))/S(2) - S(3)*b*d*e/S(2) + c*(d**S(2) + S(2)*e**S(2))/S(2))*atanh((d*x + e)/(sqrt(d**S(2) - e**S(2))*sqrt(x**S(2) + S(-1))))/(d**S(2) - e**S(2))**(S(5)/2) + sqrt(x**S(2) + S(-1))*(c*(d**S(3) - S(4)*d*e**S(2))/S(2) - e*(S(3)*a*d*e - b*(d**S(2) + S(2)*e**S(2)))/S(2))/(e*(d + e*x)*(d**S(2) - e**S(2))**S(2)) - sqrt(x**S(2) + S(-1))*(a*e**S(2)/S(2) - b*d*e/S(2) + c*d**S(2)/S(2))/(e*(d + e*x)**S(2)*(d**S(2) - e**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x + c*x**S(2))/((d + e*x)**S(3)*sqrt(x + S(-1))*sqrt(x + S(1))), x), x, (-S(3)*b*d*e + d**S(2)*(S(2)*a + c) + e**S(2)*(a + S(2)*c))*atanh(sqrt(d + e)*sqrt(x + S(1))/(sqrt(d - e)*sqrt(x + S(-1))))/((d - e)**(S(5)/2)*(d + e)**(S(5)/2)) + sqrt(x + S(-1))*sqrt(x + S(1))*(b*d**S(2)*e/S(2) + b*e**S(3) + c*d**S(3)/S(2) - d*e**S(2)*(S(3)*a + S(4)*c)/S(2))/(e*(d + e*x)*(d**S(2) - e**S(2))**S(2)) - sqrt(x + S(-1))*sqrt(x + S(1))*(a*e**S(2)/S(2) - b*d*e/S(2) + c*d**S(2)/S(2))/(e*(d + e*x)**S(2)*(d**S(2) - e**S(2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*x + c*x**S(2))/((d + e*x)**S(3)*sqrt(x + S(-1))*sqrt(x + S(1))), x), x, S(2)*c*atanh(sqrt(d + e)*sqrt(x + S(1))/(sqrt(d - e)*sqrt(x + S(-1))))/(e**S(2)*sqrt(d - e)*sqrt(d + e)) - S(3)*d*sqrt(x + S(-1))*sqrt(x + S(1))*(a*e**S(2) - b*d*e + c*d**S(2))/(S(2)*e*(d + e*x)*(d**S(2) - e**S(2))**S(2)) - S(2)*d*(-b*e + S(2)*c*d)*atanh(sqrt(d + e)*sqrt(x + S(1))/(sqrt(d - e)*sqrt(x + S(-1))))/(e**S(2)*(d - e)**(S(3)/2)*(d + e)**(S(3)/2)) + sqrt(x + S(-1))*sqrt(x + S(1))*(-b*e + S(2)*c*d)/(e*(d + e*x)*(d**S(2) - e**S(2))) - sqrt(x + S(-1))*sqrt(x + S(1))*(a*e**S(2)/S(2) - b*d*e/S(2) + c*d**S(2)/S(2))/(e*(d + e*x)**S(2)*(d**S(2) - e**S(2))) + (S(2)*d**S(2) + e**S(2))*(a*e**S(2) - b*d*e + c*d**S(2))*atanh(sqrt(d + e)*sqrt(x + S(1))/(sqrt(d - e)*sqrt(x + S(-1))))/(e**S(2)*(d - e)**(S(5)/2)*(d + e)**(S(5)/2)), expand=True, _diff=True, _numerical=True) def test_4(): assert rubi_test(rubi_integrate((b + S(2)*c*x + S(3)*d*x**S(2))*(a + b*x + c*x**S(2) + d*x**S(3))**n, x), x, (a + b*x + c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x + S(3)*d*x**S(2))*(b*x + c*x**S(2) + d*x**S(3))**n, x), x, (b*x + c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**n*(b + c*x + d*x**S(2))**n*(b + S(2)*c*x + S(3)*d*x**S(2)), x), x, x**(n + S(1))*(b + c*x + d*x**S(2))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(3)*d*x**S(2))*(a + b*x + d*x**S(3))**n, x), x, (a + b*x + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(3)*d*x**S(2))*(b*x + d*x**S(3))**n, x), x, (b*x + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**n*(b + d*x**S(2))**n*(b + S(3)*d*x**S(2)), x), x, x**(n + S(1))*(b + d*x**S(2))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*c*x + S(3)*d*x**S(2))*(a + c*x**S(2) + d*x**S(3))**n, x), x, (a + c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*c*x + S(3)*d*x**S(2))*(c*x**S(2) + d*x**S(3))**n, x), x, (c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**n*(c*x + d*x**S(2))**n*(S(2)*c*x + S(3)*d*x**S(2)), x), x, x**(n + S(1))*(c*x + d*x**S(2))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*n)*(c + d*x)**n*(S(2)*c*x + S(3)*d*x**S(2)), x), x, x**(S(2)*n + S(2))*(c + d*x)**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*c + S(3)*d*x)*(a + c*x**S(2) + d*x**S(3))**n, x), x, (a + c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*c + S(3)*d*x)*(c*x**S(2) + d*x**S(3))**n, x), x, (c*x**S(2) + d*x**S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x + S(3)*d*x**S(2))*(a + b*x + c*x**S(2) + d*x**S(3))**S(7), x), x, (a + b*x + c*x**S(2) + d*x**S(3))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x + S(3)*d*x**S(2))*(b*x + c*x**S(2) + d*x**S(3))**S(7), x), x, x**S(8)*(b + c*x + d*x**S(2))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(b + c*x + d*x**S(2))**S(7)*(b + S(2)*c*x + S(3)*d*x**S(2)), x), x, x**S(8)*(b + c*x + d*x**S(2))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(3)*d*x**S(2))*(a + b*x + d*x**S(3))**S(7), x), x, (a + b*x + d*x**S(3))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(b + d*x**S(2))**S(7)*(b + S(3)*d*x**S(2)), x), x, x**S(8)*(b + d*x**S(2))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(3)*d*x**S(2))*(b*x + d*x**S(3))**S(7), x), x, x**S(8)*(b + d*x**S(2))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*c*x + S(3)*d*x**S(2))*(a + c*x**S(2) + d*x**S(3))**S(7), x), x, (a + c*x**S(2) + d*x**S(3))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*c*x + S(3)*d*x**S(2))*(c*x**S(2) + d*x**S(3))**S(7), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(7)*(c*x + d*x**S(2))**S(7)*(S(2)*c*x + S(3)*d*x**S(2)), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)*(c + d*x)**S(7)*(S(2)*c*x + S(3)*d*x**S(2)), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*c + S(3)*d*x)*(a + c*x**S(2) + d*x**S(3))**S(7), x), x, (a + c*x**S(2) + d*x**S(3))**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(S(2)*c + S(3)*d*x)*(c*x**S(2) + d*x**S(3))**S(7), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*(S(2)*c + S(3)*d*x)*(c*x + d*x**S(2))**S(7), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(15)*(c + d*x)**S(7)*(S(2)*c + S(3)*d*x), x), x, x**S(16)*(c + d*x)**S(8)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*((a*x + b*x**S(2)/S(2))**S(4) + S(1)), x), x, a*x + b*x**S(2)/S(2) + (a*x + b*x**S(2)/S(2))**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*((a*x + b*x**S(2)/S(2) + c)**S(4) + S(1)), x), x, a*x + b*x**S(2)/S(2) + (a*x + b*x**S(2)/S(2) + c)**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*((a*x + b*x**S(2)/S(2))**n + S(1)), x), x, a*x + b*x**S(2)/S(2) + (a*x + b*x**S(2)/S(2))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x)*((a*x + b*x**S(2)/S(2) + c)**n + S(1)), x), x, a*x + b*x**S(2)/S(2) + (a*x + b*x**S(2)/S(2) + c)**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(2))*((a*x + c*x**S(3)/S(3))**S(5) + S(1)), x), x, a*x + c*x**S(3)/S(3) + (a*x + c*x**S(3)/S(3))**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(2))*((a*x + c*x**S(3)/S(3) + d)**S(5) + S(1)), x), x, a*x + c*x**S(3)/S(3) + (a*x + c*x**S(3)/S(3) + d)**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x + c*x**S(2))*((b*x**S(2)/S(2) + c*x**S(3)/S(3))**S(5) + S(1)), x), x, b*x**S(2)/S(2) + c*x**S(3)/S(3) + (b*x**S(2)/S(2) + c*x**S(3)/S(3))**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x + c*x**S(2))*((b*x**S(2)/S(2) + c*x**S(3)/S(3) + d)**S(5) + S(1)), x), x, b*x**S(2)/S(2) + c*x**S(3)/S(3) + (b*x**S(2)/S(2) + c*x**S(3)/S(3) + d)**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3))**S(5) + S(1))*(a + b*x + c*x**S(2)), x), x, a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3) + (a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3))**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3) + d)**S(5) + S(1))*(a + b*x + c*x**S(2)), x), x, a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3) + (a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3) + d)**S(6)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + c*x**S(2))*((a*x + c*x**S(3)/S(3))**n + S(1)), x), x, a*x + c*x**S(3)/S(3) + (a*x + c*x**S(3)/S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b*x + c*x**S(2))*((b*x**S(2)/S(2) + c*x**S(3)/S(3))**n + S(1)), x), x, b*x**S(2)/S(2) + c*x**S(3)/S(3) + (b*x**S(2)/S(2) + c*x**S(3)/S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3))**n + S(1))*(a + b*x + c*x**S(2)), x), x, a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3) + (a*x + b*x**S(2)/S(2) + c*x**S(3)/S(3))**(n + S(1))/(n + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(b*x + c*x**S(2))**S(13), x), x, (b*x + c*x**S(2))**S(14)/S(14), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(14)*(b + S(2)*c*x**S(2))*(b*x + c*x**S(3))**S(13), x), x, x**S(28)*(b + c*x**S(2))**S(14)/S(28), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(28)*(b + S(2)*c*x**S(3))*(b*x + c*x**S(4))**S(13), x), x, x**S(42)*(b + c*x**S(3))**S(14)/S(42), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(14)*n + S(-14))*(b + S(2)*c*x**n)*(b*x + c*x**(n + S(1)))**S(13), x), x, x**(S(14)*n)*(b + c*x**n)**S(14)/(S(14)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(b*x + c*x**S(2)), x), x, log(b*x + c*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**S(2))/(b*x + c*x**S(3)), x), x, log(x) + log(b + c*x**S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**S(3))/(b*x + c*x**S(4)), x), x, log(x) + log(b + c*x**S(3))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**n)/(b*x + c*x**(n + S(1))), x), x, log(x) + log(b + c*x**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)/(b*x + c*x**S(2))**S(8), x), x, -S(1)/(S(7)*(b*x + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**S(2))/(x**S(7)*(b*x + c*x**S(3))**S(8)), x), x, -S(1)/(S(14)*x**S(14)*(b + c*x**S(2))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x**S(3))/(x**S(14)*(b*x + c*x**S(4))**S(8)), x), x, -S(1)/(S(21)*x**S(21)*(b + c*x**S(3))**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-S(7)*n + S(7))*(b + S(2)*c*x**n)/(b*x + c*x**(n + S(1)))**S(8), x), x, -x**(-S(7)*n)/(S(7)*n*(b + c*x**n)**S(7)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((b + S(2)*c*x)*(b*x + c*x**S(2))**p, x), x, (b*x + c*x**S(2))**(p + S(1))/(p + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(p + S(1))*(b + S(2)*c*x**S(2))*(b*x + c*x**S(3))**p, x), x, x**(p + S(1))*(b*x + c*x**S(3))**(p + S(1))/(S(2)*p + S(2)), expand=True, _diff=True, _numerical=True) # fails in mathematica too assert rubi_test(rubi_integrate(b*x**(p + S(1))*(b*x + c*x**S(3))**p + S(2)*c*x**(p + S(3))*(b*x + c*x**S(3))**p, x), x, x**(p + S(1))*(b*x + c*x**S(3))**(p + S(1))/(S(2)*p + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(S(2)*p + S(2))*(b + S(2)*c*x**S(3))*(b*x + c*x**S(4))**p, x), x, x**(S(2)*p + S(2))*(b*x + c*x**S(4))**(p + S(1))/(S(3)*p + S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**((n + S(-1))*(p + S(1)))*(b + S(2)*c*x**n)*(b*x + c*x**(n + S(1)))**p, x), x, x**(-(-n + S(1))*(p + S(1)))*(b*x + c*x**(n + S(1)))**(p + S(1))/(n*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(4)*x + S(-4))*(x**S(3) + S(6)*x**S(2) - S(12)*x + S(5)), x), x, (x**S(3) + S(6)*x**S(2) - S(12)*x + S(5))**S(2)/S(6), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(2)*x)*(x**S(4) + S(4)*x**S(2) + S(1)), x), x, (x**S(4) + S(4)*x**S(2) + S(1))**S(2)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(1))*(x**S(2) + x)**S(3)*(S(7)*(x**S(2) + x)**S(3) + S(-18))**S(2), x), x, S(49)*x**S(10)*(x + S(1))**S(10)/S(10) - S(36)*x**S(7)*(x + S(1))**S(7) + S(81)*x**S(4)*(x + S(1))**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(x + S(1))**S(3)*(S(2)*x + S(1))*(S(7)*x**S(3)*(x + S(1))**S(3) + S(-18))**S(2), x), x, S(49)*x**S(10)*(x + S(1))**S(10)/S(10) - S(36)*x**S(7)*(x + S(1))**S(7) + S(81)*x**S(4)*(x + S(1))**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(2))/(x**S(3) - S(6)*x + S(1))**S(5), x), x, S(1)/(S(12)*(x**S(3) - S(6)*x + S(1))**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(2)*x)/(x**S(3) + S(3)*x**S(2) + S(4)), x), x, log(x**S(3) + S(3)*x**S(2) + S(4))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + x + S(1))/(x**S(4) + S(2)*x**S(2) + S(4)*x), x), x, log(x*(x**S(3) + S(2)*x + S(4)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(-1))/(x**S(4) - S(4)*x)**(S(2)/3), x), x, S(3)*(x**S(4) - S(4)*x)**(S(1)/3)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(2) + S(2))*(-x**S(3) + S(6)*x)**(S(1)/4), x), x, S(4)*(-x**S(3) + S(6)*x)**(S(5)/4)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(4) + S(1))*sqrt(x**S(5) + S(5)*x), x), x, S(2)*(x**S(5) + S(5)*x)**(S(3)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(5)*x**S(4) + S(2))*sqrt(x**S(5) + S(2)*x), x), x, S(2)*(x**S(5) + S(2)*x)**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(2) + x)/sqrt(S(2)*x**S(3) + x**S(2)), x), x, sqrt(S(2)*x**S(3) + x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((-S(5)*x + S(1))**(S(1)/3) + S(2))/((-S(5)*x + S(1))**(S(1)/3) + S(3)), x), x, x + S(3)*(-S(5)*x + S(1))**(S(2)/3)/S(10) - S(9)*(-S(5)*x + S(1))**(S(1)/3)/S(5) + S(27)*log((-S(5)*x + S(1))**(S(1)/3) + S(3))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(x) + S(1))/(sqrt(x) + S(-1)), x), x, S(4)*sqrt(x) + x + S(4)*log(-sqrt(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-sqrt(S(3)*x + S(2)) + S(1))/(sqrt(S(3)*x + S(2)) + S(1)), x), x, -x + S(4)*sqrt(S(3)*x + S(2))/S(3) - S(4)*log(sqrt(S(3)*x + S(2)) + S(1))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((sqrt(a + b*x) + S(-1))/(sqrt(a + b*x) + S(1)), x), x, x - S(4)*sqrt(a + b*x)/b + S(4)*log(sqrt(a + b*x) + S(1))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*n*x**(n + S(-1)))/(a*x + b*x**n), x), x, log(a*x + b*x**n), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((a + b*n*x**(n + S(-1)))/(a*x + b*x**n), x), x, n*log(x) + log(a*x**(-n + S(1)) + b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**(-n)*(a + b*n*x**(n + S(-1)))/(a*x**(-n + S(1)) + b), x), x, n*log(x) + log(a*x**(-n + S(1)) + b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*(c + d*x)**S(3)), x), x, -c*log(a + b*(c + d*x)**S(3))/(b*d**S(4)) + x/(b*d**S(3)) + sqrt(S(3))*(-S(3)*a**(S(1)/3)*b**(S(2)/3)*c**S(2) + a + b*c**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(4)/3)*d**S(4)) - (S(3)*a**(S(1)/3)*b**(S(2)/3)*c**S(2) + a + b*c**S(3))*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*b**(S(4)/3)*d**S(4)) + (S(3)*a**(S(1)/3)*b**(S(2)/3)*c**S(2) + a + b*c**S(3))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*b**(S(4)/3)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*(c + d*x)**S(3)), x), x, log(a + b*(c + d*x)**S(3))/(S(3)*b*d**S(3)) + sqrt(S(3))*c*(S(2)*a**(S(1)/3) - b**(S(1)/3)*c)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(2)/3)*d**S(3)) + c*(S(2)*a**(S(1)/3) + b**(S(1)/3)*c)*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*b**(S(2)/3)*d**S(3)) - c*(S(2)*a**(S(1)/3) + b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*b**(S(2)/3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*(c + d*x)**S(3)), x), x, -sqrt(S(3))*(a**(S(1)/3) - b**(S(1)/3)*c)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(2)/3)*d**S(2)) - (a**(S(1)/3) + b**(S(1)/3)*c)*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*b**(S(2)/3)*d**S(2)) + (a**(S(1)/3) + b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*b**(S(2)/3)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c + d*x)**S(3)), x), x, log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*b**(S(1)/3)*d) - log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*b**(S(1)/3)*d) - sqrt(S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*b**(S(1)/3)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c + d*x)**S(3))), x), x, log(x)/(a + b*c**S(3)) + sqrt(S(3))*b**(S(1)/3)*c*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*c + b**(S(2)/3)*c**S(2))) - (S(2)*a**(S(1)/3) - b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*c + b**(S(2)/3)*c**S(2))) - log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*(a**(S(1)/3) + b**(S(1)/3)*c)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/(x*(a + b*(c + d*x)**S(3))), x), x, -log(a + b*(c + d*x)**S(3))/(S(3)*a + S(3)*b*c**S(3)) + log(x)/(a + b*c**S(3)) + b**(S(1)/3)*c*(a**(S(1)/3) - b**(S(1)/3)*c)*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))) - b**(S(1)/3)*c*(a**(S(1)/3) - b**(S(1)/3)*c)*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*(a + b*c**S(3))) + sqrt(S(3))*b**(S(1)/3)*c*(a**(S(1)/3) + b**(S(1)/3)*c)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*(c + d*x)**S(3))), x), x, -S(3)*b*c**S(2)*d*log(x)/(a + b*c**S(3))**S(2) + b*c**S(2)*d*log(a + b*(c + d*x)**S(3))/(a + b*c**S(3))**S(2) - S(1)/(x*(a + b*c**S(3))) + sqrt(S(3))*b**(S(1)/3)*d*(a**(S(1)/3) - b**(S(1)/3)*c)*(a**(S(1)/3) + b**(S(1)/3)*c)**S(3)*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))**S(2)) + b**(S(1)/3)*d*(a**(S(1)/3)*(a - S(2)*b*c**S(3)) - b**(S(1)/3)*(S(2)*a*c - b*c**S(4)))*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))**S(2)) - b**(S(1)/3)*d*(a**(S(1)/3)*(a - S(2)*b*c**S(3)) - b**(S(1)/3)*(S(2)*a*c - b*c**S(4)))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*(a + b*c**S(3))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*(c + d*x)**S(3))), x), x, S(3)*b*c**S(2)*d/(x*(a + b*c**S(3))**S(2)) - S(3)*b*c*d**S(2)*(a - S(2)*b*c**S(3))*log(x)/(a + b*c**S(3))**S(3) + b*c*d**S(2)*(a - S(2)*b*c**S(3))*log(a + b*(c + d*x)**S(3))/(a + b*c**S(3))**S(3) - S(1)/(x**S(2)*(S(2)*a + S(2)*b*c**S(3))) + sqrt(S(3))*b**(S(2)/3)*d**S(2)*(a**(S(1)/3) + b**(S(1)/3)*c)**S(3)*(-S(3)*a**(S(2)/3)*b**(S(1)/3)*c + a + b*c**S(3))*atan(sqrt(S(3))*(a**(S(1)/3) - S(2)*b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(1)/3)))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))**S(3)) - b**(S(2)/3)*d**S(2)*(S(6)*a**(S(4)/3)*b**(S(2)/3)*c**S(2) - S(3)*a**(S(1)/3)*b**(S(5)/3)*c**S(5) + a**S(2) - S(7)*a*b*c**S(3) + b**S(2)*c**S(6))*log(a**(S(1)/3) + b**(S(1)/3)*(c + d*x))/(S(3)*a**(S(2)/3)*(a + b*c**S(3))**S(3)) + b**(S(2)/3)*d**S(2)*(S(6)*a**(S(4)/3)*b**(S(2)/3)*c**S(2) - S(3)*a**(S(1)/3)*b**(S(5)/3)*c**S(5) + a**S(2) - S(7)*a*b*c**S(3) + b**S(2)*c**S(6))*log(a**(S(2)/3) - a**(S(1)/3)*b**(S(1)/3)*(c + d*x) + b**(S(2)/3)*(c + d*x)**S(2))/(S(6)*a**(S(2)/3)*(a + b*c**S(3))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*(c + d*x)**S(4)), x), x, log(a + b*(c + d*x)**S(4))/(S(4)*b*d**S(4)) + S(3)*c**S(2)*atan(sqrt(b)*(c + d*x)**S(2)/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*d**S(4)) - sqrt(S(2))*c*(S(3)*sqrt(a) - sqrt(b)*c**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)*d**S(4)) + sqrt(S(2))*c*(S(3)*sqrt(a) - sqrt(b)*c**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)*d**S(4)) + sqrt(S(2))*c*(S(3)*sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)*d**S(4)) - sqrt(S(2))*c*(S(3)*sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*(c + d*x)**S(4)), x), x, -c*atan(sqrt(b)*(c + d*x)**S(2)/sqrt(a))/(sqrt(a)*sqrt(b)*d**S(3)) + sqrt(S(2))*(sqrt(a) - sqrt(b)*c**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)*d**S(3)) - sqrt(S(2))*(sqrt(a) - sqrt(b)*c**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(3)/4)*d**S(3)) - sqrt(S(2))*(sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)*d**S(3)) + sqrt(S(2))*(sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(3)/4)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*(c + d*x)**S(4)), x), x, atan(sqrt(b)*(c + d*x)**S(2)/sqrt(a))/(S(2)*sqrt(a)*sqrt(b)*d**S(2)) + sqrt(S(2))*c*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*d**S(2)) - sqrt(S(2))*c*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*d**S(2)) + sqrt(S(2))*c*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*d**S(2)) - sqrt(S(2))*c*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*(c + d*x)**S(4)), x), x, -sqrt(S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*d) + sqrt(S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*b**(S(1)/4)*d) - sqrt(S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*d) + sqrt(S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*b**(S(1)/4)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c + d*x)**S(4))), x), x, -log(a + b*(c + d*x)**S(4))/(S(4)*a + S(4)*b*c**S(4)) + log(x)/(a + b*c**S(4)) - sqrt(b)*c**S(2)*atan(sqrt(b)*(c + d*x)**S(2)/sqrt(a))/(S(2)*sqrt(a)*(a + b*c**S(4))) - sqrt(S(2))*b**(S(1)/4)*c*(sqrt(a) - sqrt(b)*c**S(2))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*(a + b*c**S(4))) + sqrt(S(2))*b**(S(1)/4)*c*(sqrt(a) - sqrt(b)*c**S(2))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*(a + b*c**S(4))) + sqrt(S(2))*b**(S(1)/4)*c*(sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*(a + b*c**S(4))) - sqrt(S(2))*b**(S(1)/4)*c*(sqrt(a) + sqrt(b)*c**S(2))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*(a + b*c**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*(c + d*x)**S(4))), x), x, -S(4)*b*c**S(3)*d*log(x)/(a + b*c**S(4))**S(2) + b*c**S(3)*d*log(a + b*(c + d*x)**S(4))/(a + b*c**S(4))**S(2) - S(1)/(x*(a + b*c**S(4))) - sqrt(b)*c*d*(a - b*c**S(4))*atan(sqrt(b)*(c + d*x)**S(2)/sqrt(a))/(sqrt(a)*(a + b*c**S(4))**S(2)) + sqrt(S(2))*b**(S(1)/4)*d*(sqrt(a)*(a - S(3)*b*c**S(4)) + sqrt(b)*c**S(2)*(S(3)*a - b*c**S(4)))*atan(S(1) - sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*(a + b*c**S(4))**S(2)) - sqrt(S(2))*b**(S(1)/4)*d*(sqrt(a)*(a - S(3)*b*c**S(4)) + sqrt(b)*c**S(2)*(S(3)*a - b*c**S(4)))*atan(S(1) + sqrt(S(2))*b**(S(1)/4)*(c + d*x)/a**(S(1)/4))/(S(4)*a**(S(3)/4)*(a + b*c**S(4))**S(2)) - sqrt(S(2))*b**(S(1)/4)*d*(a**(S(3)/2) - S(3)*sqrt(a)*b*c**S(4) - S(3)*a*sqrt(b)*c**S(2) + b**(S(3)/2)*c**S(6))*log(-sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*(a + b*c**S(4))**S(2)) + sqrt(S(2))*b**(S(1)/4)*d*(a**(S(3)/2) - S(3)*sqrt(a)*b*c**S(4) - S(3)*a*sqrt(b)*c**S(2) + b**(S(3)/2)*c**S(6))*log(sqrt(S(2))*a**(S(1)/4)*b**(S(1)/4)*(c + d*x) + sqrt(a) + sqrt(b)*(c + d*x)**S(2))/(S(8)*a**(S(3)/4)*(a + b*c**S(4))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*sqrt(c + d*x))**S(2), x), x, -a**S(2)*c**S(3)*x/d**S(3) - S(4)*a*b*c**S(3)*(c + d*x)**(S(3)/2)/(S(3)*d**S(4)) + S(12)*a*b*c**S(2)*(c + d*x)**(S(5)/2)/(S(5)*d**S(4)) - S(12)*a*b*c*(c + d*x)**(S(7)/2)/(S(7)*d**S(4)) + S(4)*a*b*(c + d*x)**(S(9)/2)/(S(9)*d**S(4)) + b**S(2)*(c + d*x)**S(5)/(S(5)*d**S(4)) + c**S(2)*(S(3)*a**S(2) - b**S(2)*c)*(c + d*x)**S(2)/(S(2)*d**S(4)) - c*(a**S(2) - b**S(2)*c)*(c + d*x)**S(3)/d**S(4) + (a**S(2) - S(3)*b**S(2)*c)*(c + d*x)**S(4)/(S(4)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*sqrt(c + d*x))**S(2), x), x, a**S(2)*c**S(2)*x/d**S(2) + S(4)*a*b*c**S(2)*(c + d*x)**(S(3)/2)/(S(3)*d**S(3)) - S(8)*a*b*c*(c + d*x)**(S(5)/2)/(S(5)*d**S(3)) + S(4)*a*b*(c + d*x)**(S(7)/2)/(S(7)*d**S(3)) + b**S(2)*(c + d*x)**S(4)/(S(4)*d**S(3)) - c*(S(2)*a**S(2) - b**S(2)*c)*(c + d*x)**S(2)/(S(2)*d**S(3)) + (a**S(2) - S(2)*b**S(2)*c)*(c + d*x)**S(3)/(S(3)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*sqrt(c + d*x))**S(2), x), x, -a**S(2)*c*x/d - S(4)*a*b*c*(c + d*x)**(S(3)/2)/(S(3)*d**S(2)) + S(4)*a*b*(c + d*x)**(S(5)/2)/(S(5)*d**S(2)) + b**S(2)*(c + d*x)**S(3)/(S(3)*d**S(2)) + (a**S(2) - b**S(2)*c)*(c + d*x)**S(2)/(S(2)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**S(2), x), x, a**S(2)*x + S(4)*a*b*(c + d*x)**(S(3)/2)/(S(3)*d) + b**S(2)*(c + d*x)**S(2)/(S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**S(2)/x, x), x, -S(4)*a*b*sqrt(c)*atanh(sqrt(c + d*x)/sqrt(c)) + S(4)*a*b*sqrt(c + d*x) + b**S(2)*d*x + (a**S(2) + b**S(2)*c)*log(x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**S(2)/x**S(2), x), x, -S(2)*a*b*d*atanh(sqrt(c + d*x)/sqrt(c))/sqrt(c) + b**S(2)*d*log(x) - (a + b*sqrt(c + d*x))**S(2)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**S(2)/x**S(3), x), x, a*b*d**S(2)*atanh(sqrt(c + d*x)/sqrt(c))/(S(2)*c**(S(3)/2)) - b*d*(a*sqrt(c + d*x) + b*c)/(S(2)*c*x) - (a + b*sqrt(c + d*x))**S(2)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(a + b*sqrt(c + d*x)), x), x, -S(28)*a*(a + b*sqrt(c + d*x))**(S(15)/2)/(S(15)*b**S(8)*d**S(4)) - S(20)*a*(a + b*sqrt(c + d*x))**(S(11)/2)*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(S(11)*b**S(8)*d**S(4)) - S(12)*a*(a + b*sqrt(c + d*x))**(S(7)/2)*(a**S(2) - b**S(2)*c)*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(S(7)*b**S(8)*d**S(4)) - S(4)*a*(a + b*sqrt(c + d*x))**(S(3)/2)*(a**S(2) - b**S(2)*c)**S(3)/(S(3)*b**S(8)*d**S(4)) + S(4)*(a + b*sqrt(c + d*x))**(S(17)/2)/(S(17)*b**S(8)*d**S(4)) + (a + b*sqrt(c + d*x))**(S(13)/2)*(S(84)*a**S(2) - S(12)*b**S(2)*c)/(S(13)*b**S(8)*d**S(4)) + (a + b*sqrt(c + d*x))**(S(9)/2)*(S(140)*a**S(4) - S(120)*a**S(2)*b**S(2)*c + S(12)*b**S(4)*c**S(2))/(S(9)*b**S(8)*d**S(4)) + S(4)*(a + b*sqrt(c + d*x))**(S(5)/2)*(a**S(2) - b**S(2)*c)**S(2)*(S(7)*a**S(2) - b**S(2)*c)/(S(5)*b**S(8)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a + b*sqrt(c + d*x)), x), x, -S(20)*a*(a + b*sqrt(c + d*x))**(S(11)/2)/(S(11)*b**S(6)*d**S(3)) - S(8)*a*(a + b*sqrt(c + d*x))**(S(7)/2)*(S(5)*a**S(2) - S(3)*b**S(2)*c)/(S(7)*b**S(6)*d**S(3)) - S(4)*a*(a + b*sqrt(c + d*x))**(S(3)/2)*(a**S(2) - b**S(2)*c)**S(2)/(S(3)*b**S(6)*d**S(3)) + S(4)*(a + b*sqrt(c + d*x))**(S(13)/2)/(S(13)*b**S(6)*d**S(3)) + (a + b*sqrt(c + d*x))**(S(9)/2)*(S(40)*a**S(2) - S(8)*b**S(2)*c)/(S(9)*b**S(6)*d**S(3)) + (a + b*sqrt(c + d*x))**(S(5)/2)*(S(20)*a**S(4) - S(24)*a**S(2)*b**S(2)*c + S(4)*b**S(4)*c**S(2))/(S(5)*b**S(6)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*sqrt(c + d*x)), x), x, -S(12)*a*(a + b*sqrt(c + d*x))**(S(7)/2)/(S(7)*b**S(4)*d**S(2)) - S(4)*a*(a + b*sqrt(c + d*x))**(S(3)/2)*(a**S(2) - b**S(2)*c)/(S(3)*b**S(4)*d**S(2)) + S(4)*(a + b*sqrt(c + d*x))**(S(9)/2)/(S(9)*b**S(4)*d**S(2)) + (a + b*sqrt(c + d*x))**(S(5)/2)*(S(12)*a**S(2) - S(4)*b**S(2)*c)/(S(5)*b**S(4)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c + d*x)), x), x, -S(4)*a*(a + b*sqrt(c + d*x))**(S(3)/2)/(S(3)*b**S(2)*d) + S(4)*(a + b*sqrt(c + d*x))**(S(5)/2)/(S(5)*b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c + d*x))/x, x), x, -S(2)*sqrt(a - b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c))) - S(2)*sqrt(a + b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c))) + S(4)*sqrt(a + b*sqrt(c + d*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c + d*x))/x**S(2), x), x, -b*d*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c)))/(S(2)*sqrt(c)*sqrt(a + b*sqrt(c))) + b*d*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c)))/(S(2)*sqrt(c)*sqrt(a - b*sqrt(c))) - sqrt(a + b*sqrt(c + d*x))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c + d*x))/x**S(3), x), x, b*d*sqrt(a + b*sqrt(c + d*x))*(-a*sqrt(c + d*x) + b*c)/(S(8)*c*x*(a**S(2) - b**S(2)*c)) + b*d**S(2)*(S(2)*a + S(3)*b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c)))/(S(16)*c**(S(3)/2)*(a + b*sqrt(c))**(S(3)/2)) - b*d**S(2)*(S(2)*a - S(3)*b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c)))/(S(16)*c**(S(3)/2)*(a - b*sqrt(c))**(S(3)/2)) - sqrt(a + b*sqrt(c + d*x))/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*sqrt(c + d*x)), x), x, -a*(c + d*x)**S(3)/(S(3)*b**S(2)*d**S(4)) - a*(a**S(2) - S(3)*b**S(2)*c)*(c + d*x)**S(2)/(S(2)*b**S(4)*d**S(4)) - a*x*(a**S(4) - S(3)*a**S(2)*b**S(2)*c + S(3)*b**S(4)*c**S(2))/(b**S(6)*d**S(3)) - S(2)*a*(a**S(2) - b**S(2)*c)**S(3)*log(a + b*sqrt(c + d*x))/(b**S(8)*d**S(4)) + S(2)*(c + d*x)**(S(7)/2)/(S(7)*b*d**S(4)) + (S(2)*a**S(2) - S(6)*b**S(2)*c)*(c + d*x)**(S(5)/2)/(S(5)*b**S(3)*d**S(4)) + (c + d*x)**(S(3)/2)*(S(2)*a**S(4) - S(6)*a**S(2)*b**S(2)*c + S(6)*b**S(4)*c**S(2))/(S(3)*b**S(5)*d**S(4)) + S(2)*(a**S(2) - b**S(2)*c)**S(3)*sqrt(c + d*x)/(b**S(7)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*sqrt(c + d*x)), x), x, -a*(c + d*x)**S(2)/(S(2)*b**S(2)*d**S(3)) - a*x*(a**S(2) - S(2)*b**S(2)*c)/(b**S(4)*d**S(2)) - S(2)*a*(a**S(2) - b**S(2)*c)**S(2)*log(a + b*sqrt(c + d*x))/(b**S(6)*d**S(3)) + S(2)*(c + d*x)**(S(5)/2)/(S(5)*b*d**S(3)) + (S(2)*a**S(2) - S(4)*b**S(2)*c)*(c + d*x)**(S(3)/2)/(S(3)*b**S(3)*d**S(3)) + S(2)*(a**S(2) - b**S(2)*c)**S(2)*sqrt(c + d*x)/(b**S(5)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*sqrt(c + d*x)), x), x, -a*x/(b**S(2)*d) - S(2)*a*(a**S(2) - b**S(2)*c)*log(a + b*sqrt(c + d*x))/(b**S(4)*d**S(2)) + S(2)*(c + d*x)**(S(3)/2)/(S(3)*b*d**S(2)) + (S(2)*a**S(2) - S(2)*b**S(2)*c)*sqrt(c + d*x)/(b**S(3)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a + b*sqrt(c + d*x)), x), x, -S(2)*a*log(a + b*sqrt(c + d*x))/(b**S(2)*d) + S(2)*sqrt(c + d*x)/(b*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*sqrt(c + d*x))), x), x, a*log(x)/(a**S(2) - b**S(2)*c) - S(2)*a*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c) + S(2)*b*sqrt(c)*atanh(sqrt(c + d*x)/sqrt(c))/(a**S(2) - b**S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*sqrt(c + d*x))), x), x, a*b**S(2)*d*log(x)/(a**S(2) - b**S(2)*c)**S(2) - S(2)*a*b**S(2)*d*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c)**S(2) + b*d*(a**S(2) + b**S(2)*c)*atanh(sqrt(c + d*x)/sqrt(c))/(sqrt(c)*(a**S(2) - b**S(2)*c)**S(2)) - (a - b*sqrt(c + d*x))/(x*(a**S(2) - b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*sqrt(c + d*x))), x), x, a*b**S(4)*d**S(2)*log(x)/(a**S(2) - b**S(2)*c)**S(3) - S(2)*a*b**S(4)*d**S(2)*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c)**S(3) - b*d*(S(4)*a*b*c - (a**S(2) + S(3)*b**S(2)*c)*sqrt(c + d*x))/(S(4)*c*x*(a**S(2) - b**S(2)*c)**S(2)) - b*d**S(2)*(a**S(4) - S(6)*a**S(2)*b**S(2)*c - S(3)*b**S(4)*c**S(2))*atanh(sqrt(c + d*x)/sqrt(c))/(S(4)*c**(S(3)/2)*(a**S(2) - b**S(2)*c)**S(3)) - (a - b*sqrt(c + d*x))/(x**S(2)*(S(2)*a**S(2) - S(2)*b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/(a + b*sqrt(c + d*x))**S(2), x), x, -S(4)*a*(c + d*x)**(S(5)/2)/(S(5)*b**S(3)*d**S(4)) - S(4)*a*(S(2)*a**S(2) - S(3)*b**S(2)*c)*(c + d*x)**(S(3)/2)/(S(3)*b**S(5)*d**S(4)) - S(12)*a*(a**S(2) - b**S(2)*c)**S(2)*sqrt(c + d*x)/(b**S(7)*d**S(4)) + S(2)*a*(a**S(2) - b**S(2)*c)**S(3)/(b**S(8)*d**S(4)*(a + b*sqrt(c + d*x))) + (c + d*x)**S(3)/(S(3)*b**S(2)*d**S(4)) + (S(3)*a**S(2) - S(3)*b**S(2)*c)*(c + d*x)**S(2)/(S(2)*b**S(4)*d**S(4)) + x*(S(5)*a**S(4) - S(9)*a**S(2)*b**S(2)*c + S(3)*b**S(4)*c**S(2))/(b**S(6)*d**S(3)) + S(2)*(a**S(2) - b**S(2)*c)**S(2)*(S(7)*a**S(2) - b**S(2)*c)*log(a + b*sqrt(c + d*x))/(b**S(8)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a + b*sqrt(c + d*x))**S(2), x), x, -S(4)*a*(c + d*x)**(S(3)/2)/(S(3)*b**S(3)*d**S(3)) - S(8)*a*(a**S(2) - b**S(2)*c)*sqrt(c + d*x)/(b**S(5)*d**S(3)) + S(2)*a*(a**S(2) - b**S(2)*c)**S(2)/(b**S(6)*d**S(3)*(a + b*sqrt(c + d*x))) + (c + d*x)**S(2)/(S(2)*b**S(2)*d**S(3)) + x*(S(3)*a**S(2) - S(2)*b**S(2)*c)/(b**S(4)*d**S(2)) + (S(10)*a**S(4) - S(12)*a**S(2)*b**S(2)*c + S(2)*b**S(4)*c**S(2))*log(a + b*sqrt(c + d*x))/(b**S(6)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*sqrt(c + d*x))**S(2), x), x, -S(4)*a*sqrt(c + d*x)/(b**S(3)*d**S(2)) + S(2)*a*(a**S(2) - b**S(2)*c)/(b**S(4)*d**S(2)*(a + b*sqrt(c + d*x))) + x/(b**S(2)*d) + (S(6)*a**S(2) - S(2)*b**S(2)*c)*log(a + b*sqrt(c + d*x))/(b**S(4)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**(S(-2)), x), x, S(2)*a/(b**S(2)*d*(a + b*sqrt(c + d*x))) + S(2)*log(a + b*sqrt(c + d*x))/(b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*sqrt(c + d*x))**S(2)), x), x, S(4)*a*b*sqrt(c)*atanh(sqrt(c + d*x)/sqrt(c))/(a**S(2) - b**S(2)*c)**S(2) + S(2)*a/((a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)) + (a**S(2) + b**S(2)*c)*log(x)/(a**S(2) - b**S(2)*c)**S(2) - (S(2)*a**S(2) + S(2)*b**S(2)*c)*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c)**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*(a + b*sqrt(c + d*x))**S(2)), x), x, S(4)*a*b**S(2)*d/((a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)**S(2)) + S(2)*a*b*d*(a**S(2) + S(3)*b**S(2)*c)*atanh(sqrt(c + d*x)/sqrt(c))/(sqrt(c)*(a**S(2) - b**S(2)*c)**S(3)) + b**S(2)*d*(S(3)*a**S(2) + b**S(2)*c)*log(x)/(a**S(2) - b**S(2)*c)**S(3) - S(2)*b**S(2)*d*(S(3)*a**S(2) + b**S(2)*c)*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c)**S(3) - (a - b*sqrt(c + d*x))/(x*(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*(a + b*sqrt(c + d*x))**S(2)), x), x, a*b**S(2)*d**S(2)*(a**S(2) + S(11)*b**S(2)*c)/(S(2)*c*(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)**S(3)) - a*b*d**S(2)*(a**S(4) - S(10)*a**S(2)*b**S(2)*c - S(15)*b**S(4)*c**S(2))*atanh(sqrt(c + d*x)/sqrt(c))/(S(2)*c**(S(3)/2)*(a**S(2) - b**S(2)*c)**S(4)) + b**S(4)*d**S(2)*(S(5)*a**S(2) + b**S(2)*c)*log(x)/(a**S(2) - b**S(2)*c)**S(4) - S(2)*b**S(4)*d**S(2)*(S(5)*a**S(2) + b**S(2)*c)*log(a + b*sqrt(c + d*x))/(a**S(2) - b**S(2)*c)**S(4) - b*d*(S(3)*a*b*c - (a**S(2) + S(2)*b**S(2)*c)*sqrt(c + d*x))/(S(2)*c*x*(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)**S(2)) - (a - b*sqrt(c + d*x))/(x**S(2)*(a + b*sqrt(c + d*x))*(S(2)*a**S(2) - S(2)*b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)/sqrt(a + b*sqrt(c + d*x)), x), x, -S(28)*a*(a + b*sqrt(c + d*x))**(S(13)/2)/(S(13)*b**S(8)*d**S(4)) - S(20)*a*(a + b*sqrt(c + d*x))**(S(9)/2)*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(S(9)*b**S(8)*d**S(4)) - S(12)*a*(a + b*sqrt(c + d*x))**(S(5)/2)*(a**S(2) - b**S(2)*c)*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(S(5)*b**S(8)*d**S(4)) - S(4)*a*sqrt(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)**S(3)/(b**S(8)*d**S(4)) + S(4)*(a + b*sqrt(c + d*x))**(S(15)/2)/(S(15)*b**S(8)*d**S(4)) + (a + b*sqrt(c + d*x))**(S(11)/2)*(S(84)*a**S(2) - S(12)*b**S(2)*c)/(S(11)*b**S(8)*d**S(4)) + (a + b*sqrt(c + d*x))**(S(7)/2)*(S(140)*a**S(4) - S(120)*a**S(2)*b**S(2)*c + S(12)*b**S(4)*c**S(2))/(S(7)*b**S(8)*d**S(4)) + S(4)*(a + b*sqrt(c + d*x))**(S(3)/2)*(a**S(2) - b**S(2)*c)**S(2)*(S(7)*a**S(2) - b**S(2)*c)/(S(3)*b**S(8)*d**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*sqrt(c + d*x)), x), x, -S(20)*a*(a + b*sqrt(c + d*x))**(S(9)/2)/(S(9)*b**S(6)*d**S(3)) - S(8)*a*(a + b*sqrt(c + d*x))**(S(5)/2)*(S(5)*a**S(2) - S(3)*b**S(2)*c)/(S(5)*b**S(6)*d**S(3)) - S(4)*a*sqrt(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)**S(2)/(b**S(6)*d**S(3)) + S(4)*(a + b*sqrt(c + d*x))**(S(11)/2)/(S(11)*b**S(6)*d**S(3)) + (a + b*sqrt(c + d*x))**(S(7)/2)*(S(40)*a**S(2) - S(8)*b**S(2)*c)/(S(7)*b**S(6)*d**S(3)) + (a + b*sqrt(c + d*x))**(S(3)/2)*(S(20)*a**S(4) - S(24)*a**S(2)*b**S(2)*c + S(4)*b**S(4)*c**S(2))/(S(3)*b**S(6)*d**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*sqrt(c + d*x)), x), x, -S(12)*a*(a + b*sqrt(c + d*x))**(S(5)/2)/(S(5)*b**S(4)*d**S(2)) - S(4)*a*sqrt(a + b*sqrt(c + d*x))*(a**S(2) - b**S(2)*c)/(b**S(4)*d**S(2)) + S(4)*(a + b*sqrt(c + d*x))**(S(7)/2)/(S(7)*b**S(4)*d**S(2)) + (a + b*sqrt(c + d*x))**(S(3)/2)*(S(12)*a**S(2) - S(4)*b**S(2)*c)/(S(3)*b**S(4)*d**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*sqrt(c + d*x)), x), x, -S(4)*a*sqrt(a + b*sqrt(c + d*x))/(b**S(2)*d) + S(4)*(a + b*sqrt(c + d*x))**(S(3)/2)/(S(3)*b**S(2)*d), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*sqrt(c + d*x))), x), x, -S(2)*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c)))/sqrt(a + b*sqrt(c)) - S(2)*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c)))/sqrt(a - b*sqrt(c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*sqrt(c + d*x))), x), x, b*d*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c)))/(S(2)*sqrt(c)*(a + b*sqrt(c))**(S(3)/2)) - b*d*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c)))/(S(2)*sqrt(c)*(a - b*sqrt(c))**(S(3)/2)) - (a - b*sqrt(c + d*x))*sqrt(a + b*sqrt(c + d*x))/(x*(a**S(2) - b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*sqrt(c + d*x))), x), x, -b*d*sqrt(a + b*sqrt(c + d*x))*(S(6)*a*b*c - (a**S(2) + S(5)*b**S(2)*c)*sqrt(c + d*x))/(S(8)*c*x*(a**S(2) - b**S(2)*c)**S(2)) - b*d**S(2)*(S(2)*a + S(5)*b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a + b*sqrt(c)))/(S(16)*c**(S(3)/2)*(a + b*sqrt(c))**(S(5)/2)) + b*d**S(2)*(S(2)*a - S(5)*b*sqrt(c))*atanh(sqrt(a + b*sqrt(c + d*x))/sqrt(a - b*sqrt(c)))/(S(16)*c**(S(3)/2)*(a - b*sqrt(c))**(S(5)/2)) - (a - b*sqrt(c + d*x))*sqrt(a + b*sqrt(c + d*x))/(x**S(2)*(S(2)*a**S(2) - S(2)*b**S(2)*c)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(a + b*sqrt(c + d*x))**p, x), x, -S(2)*a*(a + b*sqrt(c + d*x))**(p + S(1))*(a**S(2) - b**S(2)*c)**S(3)/(b**S(8)*d**S(4)*(p + S(1))) - S(6)*a*(a + b*sqrt(c + d*x))**(p + S(3))*(a**S(2) - b**S(2)*c)*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(b**S(8)*d**S(4)*(p + S(3))) - S(10)*a*(a + b*sqrt(c + d*x))**(p + S(5))*(S(7)*a**S(2) - S(3)*b**S(2)*c)/(b**S(8)*d**S(4)*(p + S(5))) - S(14)*a*(a + b*sqrt(c + d*x))**(p + S(7))/(b**S(8)*d**S(4)*(p + S(7))) + S(2)*(a + b*sqrt(c + d*x))**(p + S(2))*(a**S(2) - b**S(2)*c)**S(2)*(S(7)*a**S(2) - b**S(2)*c)/(b**S(8)*d**S(4)*(p + S(2))) + (a + b*sqrt(c + d*x))**(p + S(4))*(S(70)*a**S(4) - S(60)*a**S(2)*b**S(2)*c + S(6)*b**S(4)*c**S(2))/(b**S(8)*d**S(4)*(p + S(4))) + (a + b*sqrt(c + d*x))**(p + S(6))*(S(42)*a**S(2) - S(6)*b**S(2)*c)/(b**S(8)*d**S(4)*(p + S(6))) + S(2)*(a + b*sqrt(c + d*x))**(p + S(8))/(b**S(8)*d**S(4)*(p + S(8))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a + b*sqrt(c + d*x))**p, x), x, -S(2)*a*(a + b*sqrt(c + d*x))**(p + S(1))*(a**S(2) - b**S(2)*c)**S(2)/(b**S(6)*d**S(3)*(p + S(1))) - S(4)*a*(a + b*sqrt(c + d*x))**(p + S(3))*(S(5)*a**S(2) - S(3)*b**S(2)*c)/(b**S(6)*d**S(3)*(p + S(3))) - S(10)*a*(a + b*sqrt(c + d*x))**(p + S(5))/(b**S(6)*d**S(3)*(p + S(5))) + (a + b*sqrt(c + d*x))**(p + S(2))*(S(10)*a**S(4) - S(12)*a**S(2)*b**S(2)*c + S(2)*b**S(4)*c**S(2))/(b**S(6)*d**S(3)*(p + S(2))) + (a + b*sqrt(c + d*x))**(p + S(4))*(S(20)*a**S(2) - S(4)*b**S(2)*c)/(b**S(6)*d**S(3)*(p + S(4))) + S(2)*(a + b*sqrt(c + d*x))**(p + S(6))/(b**S(6)*d**S(3)*(p + S(6))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*sqrt(c + d*x))**p, x), x, -S(2)*a*(a + b*sqrt(c + d*x))**(p + S(1))*(a**S(2) - b**S(2)*c)/(b**S(4)*d**S(2)*(p + S(1))) - S(6)*a*(a + b*sqrt(c + d*x))**(p + S(3))/(b**S(4)*d**S(2)*(p + S(3))) + (a + b*sqrt(c + d*x))**(p + S(2))*(S(6)*a**S(2) - S(2)*b**S(2)*c)/(b**S(4)*d**S(2)*(p + S(2))) + S(2)*(a + b*sqrt(c + d*x))**(p + S(4))/(b**S(4)*d**S(2)*(p + S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**p, x), x, -S(2)*a*(a + b*sqrt(c + d*x))**(p + S(1))/(b**S(2)*d*(p + S(1))) + S(2)*(a + b*sqrt(c + d*x))**(p + S(2))/(b**S(2)*d*(p + S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*sqrt(c + d*x))**p/x, x), x, -(a + b*sqrt(c + d*x))**(p + S(1))*hyper((S(1), p + S(1)), (p + S(2),), (a + b*sqrt(c + d*x))/(a + b*sqrt(c)))/((a + b*sqrt(c))*(p + S(1))) - (a + b*sqrt(c + d*x))**(p + S(1))*hyper((S(1), p + S(1)), (p + S(2),), (a + b*sqrt(c + d*x))/(a - b*sqrt(c)))/((a - b*sqrt(c))*(p + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x)**n)**(S(5)/2)/x, x), x, -S(2)*a**(S(5)/2)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/n + S(2)*a**S(2)*sqrt(a + b*(c*x)**n)/n + S(2)*a*(a + b*(c*x)**n)**(S(3)/2)/(S(3)*n) + S(2)*(a + b*(c*x)**n)**(S(5)/2)/(S(5)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*(c*x)**n)**(S(3)/2)/x, x), x, -S(2)*a**(S(3)/2)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/n + S(2)*a*sqrt(a + b*(c*x)**n)/n + S(2)*(a + b*(c*x)**n)**(S(3)/2)/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*(c*x)**n)/x, x), x, -S(2)*sqrt(a)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/n + S(2)*sqrt(a + b*(c*x)**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*(c*x)**n)), x), x, -S(2)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/(sqrt(a)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c*x)**n)**(S(3)/2)), x), x, S(2)/(a*n*sqrt(a + b*(c*x)**n)) - S(2)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/(a**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(a + b*(c*x)**n)**(S(5)/2)), x), x, S(2)/(S(3)*a*n*(a + b*(c*x)**n)**(S(3)/2)) + S(2)/(a**S(2)*n*sqrt(a + b*(c*x)**n)) - S(2)*atanh(sqrt(a + b*(c*x)**n)/sqrt(a))/(a**(S(5)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-a + b*(c*x)**n)**(S(5)/2)/x, x), x, -S(2)*a**(S(5)/2)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/n + S(2)*a**S(2)*sqrt(-a + b*(c*x)**n)/n - S(2)*a*(-a + b*(c*x)**n)**(S(3)/2)/(S(3)*n) + S(2)*(-a + b*(c*x)**n)**(S(5)/2)/(S(5)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-a + b*(c*x)**n)**(S(3)/2)/x, x), x, S(2)*a**(S(3)/2)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/n - S(2)*a*sqrt(-a + b*(c*x)**n)/n + S(2)*(-a + b*(c*x)**n)**(S(3)/2)/(S(3)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a + b*(c*x)**n)/x, x), x, -S(2)*sqrt(a)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/n + S(2)*sqrt(-a + b*(c*x)**n)/n, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(-a + b*(c*x)**n)), x), x, S(2)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/(sqrt(a)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(-a + b*(c*x)**n)**(S(3)/2)), x), x, -S(2)/(a*n*sqrt(-a + b*(c*x)**n)) - S(2)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/(a**(S(3)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*(-a + b*(c*x)**n)**(S(5)/2)), x), x, -S(2)/(S(3)*a*n*(-a + b*(c*x)**n)**(S(3)/2)) + S(2)/(a**S(2)*n*sqrt(-a + b*(c*x)**n)) + S(2)*atan(sqrt(-a + b*(c*x)**n)/sqrt(a))/(a**(S(5)/2)*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*x)), x), x, -S(2)*atanh(sqrt(a + b*x)/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*(c*x)**m)), x), x, -S(2)*atanh(sqrt(a + b*(c*x)**m)/sqrt(a))/(sqrt(a)*m), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*(c*(d*x)**m)**n)), x), x, -S(2)*atanh(sqrt(a + b*(c*(d*x)**m)**n)/sqrt(a))/(sqrt(a)*m*n), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*(c*(d*(e*x)**m)**n)**p)), x), x, -S(2)*atanh(sqrt(a + b*(c*(d*(e*x)**m)**n)**p)/sqrt(a))/(sqrt(a)*m*n*p), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*(c*(d*(e*(f*x)**m)**n)**p)**q)), x), x, -S(2)*atanh(sqrt(a + b*(c*(d*(e*(f*x)**m)**n)**p)**q)/sqrt(a))/(sqrt(a)*m*n*p*q), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))*(x**S(2) + S(-1))**S(3)/x, x), x, -x**S(6)*(S(-1) + x**(S(-2)))**(S(7)/2)/S(6) - S(7)*x**S(4)*(S(-1) + x**(S(-2)))**(S(5)/2)/S(24) - S(35)*x**S(2)*(S(-1) + x**(S(-2)))**(S(3)/2)/S(48) + S(35)*sqrt(S(-1) + x**(S(-2)))/S(16) - S(35)*atan(sqrt(S(-1) + x**(S(-2))))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))*(x**S(2) + S(-1))**S(2)/x, x), x, x**S(4)*(S(-1) + x**(S(-2)))**(S(5)/2)/S(4) + S(5)*x**S(2)*(S(-1) + x**(S(-2)))**(S(3)/2)/S(8) - S(15)*sqrt(S(-1) + x**(S(-2)))/S(8) + S(15)*atan(sqrt(S(-1) + x**(S(-2))))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))*(x**S(2) + S(-1))/x, x), x, -x**S(2)*(S(-1) + x**(S(-2)))**(S(3)/2)/S(2) + S(3)*sqrt(S(-1) + x**(S(-2)))/S(2) - S(3)*atan(sqrt(S(-1) + x**(S(-2))))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))/(x*(x**S(2) + S(-1))), x), x, sqrt(S(-1) + x**(S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))/(x*(x**S(2) + S(-1))**S(2)), x), x, -sqrt(S(-1) + x**(S(-2))) + S(1)/sqrt(S(-1) + x**(S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(-1) + x**(S(-2)))/(x*(x**S(2) + S(-1))**S(3)), x), x, sqrt(S(-1) + x**(S(-2))) - S(2)/sqrt(S(-1) + x**(S(-2))) - S(1)/(S(3)*(S(-1) + x**(S(-2)))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(S(1) + x**(S(-2)))/(x**S(2) + S(1))**S(2), x), x, S(1)/sqrt(S(1) + x**(S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(S(1) + x**(S(-2)))*(x**S(2) + S(1))), x), x, S(1)/sqrt(S(1) + x**(S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a + b*x**S(2) + sqrt(a + b*x**S(2))), x), x, log(sqrt(a + b*x**S(2)) + S(1))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(x**S(2) - (x**S(2))**(S(1)/3)), x), x, S(3)*log(-(x**S(2))**(S(2)/3) + S(1))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(x**S(2) + S(1))**S(3)*sqrt(x**S(4) + S(2)*x**S(2) + S(2)), x), x, (x**S(2) + S(1))**S(2)*(x**S(4) + S(2)*x**S(2) + S(2))**(S(3)/2)/S(10) - (x**S(4) + S(2)*x**S(2) + S(2))**(S(3)/2)/S(15), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt((-x**S(2) + S(1))/(x**S(2) + S(1))), x), x, sqrt((-x**S(2) + S(1))/(x**S(2) + S(1)))*(x**S(2) + S(1))/S(2) - atan(sqrt((-x**S(2) + S(1))/(x**S(2) + S(1)))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x*sqrt((-x**S(2) + S(1))/(x**S(2) + S(1))), x), x, sqrt((-x**S(2) + S(1))/(x**S(2) + S(1)))/((-x**S(2) + S(1))/(x**S(2) + S(1)) + S(1)) - atan(sqrt((-x**S(2) + S(1))/(x**S(2) + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7))), x), x, sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7)))*(S(5)*x**S(2) + S(7))/S(10) - S(37)*sqrt(S(35))*atan(sqrt(S(35))*sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7)))/S(7))/S(175), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x*sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7))), x), x, S(37)*sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7)))/(S(5)*(-S(35)*x**S(2) + S(25))/(S(5)*x**S(2) + S(7)) + S(35)) - S(37)*sqrt(S(35))*atan(sqrt(S(35))*sqrt((-S(7)*x**S(2) + S(5))/(S(5)*x**S(2) + S(7)))/S(7))/S(175), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))), x), x, sqrt((-x**S(3) + S(1))/(x**S(3) + S(1)))*(x**S(3) + S(1))/S(3) - S(2)*atan(sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))))/S(3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(2)*sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))), x), x, S(2)*sqrt((-x**S(3) + S(1))/(x**S(3) + S(1)))/(S(3)*(-x**S(3) + S(1))/(x**S(3) + S(1)) + S(3)) - S(2)*atan(sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(5)*sqrt(-x**S(3) + S(1))*(x**S(9) + S(1))**S(2), x), x, S(2)*(-x**S(3) + S(1))**(S(17)/2)/S(51) - S(14)*(-x**S(3) + S(1))**(S(15)/2)/S(45) + S(14)*(-x**S(3) + S(1))**(S(13)/2)/S(13) - S(74)*(-x**S(3) + S(1))**(S(11)/2)/S(33) + S(86)*(-x**S(3) + S(1))**(S(9)/2)/S(27) - S(22)*(-x**S(3) + S(1))**(S(7)/2)/S(7) + S(32)*(-x**S(3) + S(1))**(S(5)/2)/S(15) - S(8)*(-x**S(3) + S(1))**(S(3)/2)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(8)*sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))), x), x, -S(8)*((-x**S(3) + S(1))/(x**S(3) + S(1)))**(S(3)/2)/(S(9)*((-x**S(3) + S(1))/(x**S(3) + S(1)) + S(1))**S(3)) + sqrt((-x**S(3) + S(1))/(x**S(3) + S(1)))/((-x**S(3) + S(1))/(x**S(3) + S(1)) + S(1)) - S(2)*sqrt((-x**S(3) + S(1))/(x**S(3) + S(1)))/(S(3)*((-x**S(3) + S(1))/(x**S(3) + S(1)) + S(1))**S(2)) - atan(sqrt((-x**S(3) + S(1))/(x**S(3) + S(1))))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(9)*sqrt((-S(7)*x**S(5) + S(5))/(S(5)*x**S(5) + S(7))), x), x, -S(999)*sqrt((-S(7)*x**S(5) + S(5))/(S(5)*x**S(5) + S(7)))/(S(175)*(-S(35)*x**S(5) + S(25))/(S(5)*x**S(5) + S(7)) + S(1225)) + S(2738)*sqrt((-S(7)*x**S(5) + S(5))/(S(5)*x**S(5) + S(7)))/(S(125)*((-S(35)*x**S(5) + S(25))/(S(5)*x**S(5) + S(7)) + S(7))**S(2)) + S(2257)*sqrt(S(35))*atan(sqrt(S(35))*sqrt((-S(7)*x**S(5) + S(5))/(S(5)*x**S(5) + S(7)))/S(7))/S(30625), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x**S(2))*(x**S(2) + S(1))) + x/(a + b*x**S(2))**(S(3)/2), x), x, -atanh(sqrt(a + b*x**S(2))/sqrt(a - b))/sqrt(a - b) - S(1)/(b*sqrt(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a + b*x**S(2) + x**S(2) + S(1))/((a + b*x**S(2))**(S(3)/2)*(x**S(2) + S(1))), x), x, -atanh(sqrt(a + b*x**S(2))/sqrt(a - b))/sqrt(a - b) - S(1)/(b*sqrt(a + b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(a + b*x**S(2))*(x**S(2) + S(1))) + x/(a + b*x**S(2))**(S(3)/2) + x/(a + b*x**S(2))**(S(5)/2), x), x, -atanh(sqrt(a + b*x**S(2))/sqrt(a - b))/sqrt(a - b) - S(1)/(b*sqrt(a + b*x**S(2))) - S(1)/(S(3)*b*(a + b*x**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a**S(2) + S(2)*a*b*x**S(2) + a*x**S(2) + a + b**S(2)*x**S(4) + b*x**S(4) + b*x**S(2) + x**S(2) + S(1))/((a + b*x**S(2))**(S(5)/2)*(x**S(2) + S(1))), x), x, -atanh(sqrt(a + b*x**S(2))/sqrt(a - b))/sqrt(a - b) - S(1)/(b*sqrt(a + b*x**S(2))) - S(1)/(S(3)*b*(a + b*x**S(2))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(sqrt(x) + x), x), x, S(2)*sqrt(sqrt(x) + x) - S(2)*atanh(sqrt(x)/sqrt(sqrt(x) + x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(x) + x), x), x, sqrt(x)*sqrt(sqrt(x) + x)/S(6) + S(2)*x*sqrt(sqrt(x) + x)/S(3) - sqrt(sqrt(x) + x)/S(4) + atanh(sqrt(x)/sqrt(sqrt(x) + x))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x)*(x + sqrt(-x)), x), x, -x**S(2)/S(2) + S(2)*(-x)**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**(S(1)/4) + S(5))/(x + S(-6)), x), x, S(4)*x**(S(1)/4) + S(5)*log(-x + S(6)) - S(2)*S(6)**(S(1)/4)*atan(S(6)**(S(3)/4)*x**(S(1)/4)/S(6)) - S(2)*S(6)**(S(1)/4)*atanh(S(6)**(S(3)/4)*x**(S(1)/4)/S(6)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(-x + sqrt(-x + S(4)) + S(4)), x), x, -S(2)*log(sqrt(-x + S(4)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(x + S(2)) + S(1)), x), x, (sqrt(S(5))/S(5) + S(1))*log(-S(2)*sqrt(x + S(2)) + S(1) + sqrt(S(5))) + (-sqrt(S(5))/S(5) + S(1))*log(-S(2)*sqrt(x + S(2)) - sqrt(S(5)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x + sqrt(x + S(1)) + S(4)), x), x, log(x + sqrt(x + S(1)) + S(4)) - S(2)*sqrt(S(11))*atan(sqrt(S(11))*(S(2)*sqrt(x + S(1)) + S(1))/S(11))/S(11), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(x + S(1))), x), x, (sqrt(S(5))/S(5) + S(1))*log(-S(2)*sqrt(x + S(1)) + S(1) + sqrt(S(5))) + (-sqrt(S(5))/S(5) + S(1))*log(-S(2)*sqrt(x + S(1)) - sqrt(S(5)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(x + S(2))), x), x, S(4)*log(-sqrt(x + S(2)) + S(2))/S(3) + S(2)*log(sqrt(x + S(2)) + S(1))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x - sqrt(-x + S(1))), x), x, (sqrt(S(5))/S(5) + S(1))*log(S(2)*sqrt(-x + S(1)) + S(1) + sqrt(S(5))) + (-sqrt(S(5))/S(5) + S(1))*log(S(2)*sqrt(-x + S(1)) - sqrt(S(5)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(x) + x + S(1)), x), x, (-sqrt(x)/S(2) + S(-1)/4)*sqrt(sqrt(x) + x + S(1)) + S(2)*(sqrt(x) + x + S(1))**(S(3)/2)/S(3) - S(3)*asinh(sqrt(S(3))*(S(2)*sqrt(x) + S(1))/S(3))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + sqrt(x + S(1)) + S(1)), x), x, -(S(2)*sqrt(x + S(1)) + S(1))*sqrt(x + sqrt(x + S(1)) + S(1))/S(4) + S(2)*(x + sqrt(x + S(1)) + S(1))**(S(3)/2)/S(3) + atanh(sqrt(x + S(1))/sqrt(x + sqrt(x + S(1)) + S(1)))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + sqrt(x + S(-1))), x), x, S(2)*(x + sqrt(x + S(-1)))**(S(3)/2)/S(3) + sqrt(x + sqrt(x + S(-1)))*(-sqrt(x + S(-1))/S(2) + S(-1)/4) - S(3)*asinh(sqrt(S(3))*(S(2)*sqrt(x + S(-1)) + S(1))/S(3))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x + sqrt(S(2)*x + S(-1))), x), x, (S(2)*x + sqrt(S(2)*x + S(-1)))**(S(3)/2)/S(3) - sqrt(S(2)*x + sqrt(S(2)*x + S(-1)))*(S(2)*sqrt(S(2)*x + S(-1)) + S(1))/S(8) - S(3)*asinh(sqrt(S(3))*(S(2)*sqrt(S(2)*x + S(-1)) + S(1))/S(3))/S(16), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(3)*x + sqrt(S(8)*x + S(-7))), x), x, sqrt(S(2))*(S(24)*x + S(8)*sqrt(S(8)*x + S(-7)))**(S(3)/2)/S(144) - sqrt(S(2))*sqrt(S(24)*x + S(8)*sqrt(S(8)*x + S(-7)))*(S(3)*sqrt(S(8)*x + S(-7)) + S(4))/S(72) - S(47)*sqrt(S(6))*asinh(sqrt(S(47))*(S(3)*sqrt(S(8)*x + S(-7)) + S(4))/S(47))/S(216), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x + sqrt(x + S(1))), x), x, S(2)*sqrt(x + sqrt(x + S(1))) - atanh((S(2)*sqrt(x + S(1)) + S(1))/(S(2)*sqrt(x + sqrt(x + S(1))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + S(1))/(x + sqrt(S(6)*x + S(-9)) + S(4)), x), x, x - S(2)*sqrt(S(3))*sqrt(S(2)*x + S(-3)) + S(3)*log(x + sqrt(S(3))*sqrt(S(2)*x + S(-3)) + S(4)) + S(4)*sqrt(S(6))*atan(sqrt(S(6))*(sqrt(S(6)*x + S(-9)) + S(3))/S(12)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x + S(12))/(x + sqrt(S(6)*x + S(-9)) + S(4)), x), x, -x + S(2)*sqrt(S(3))*sqrt(S(2)*x + S(-3)) + S(10)*log(x + sqrt(S(3))*sqrt(S(2)*x + S(-3)) + S(4)) - S(21)*sqrt(S(6))*atan(sqrt(S(6))*(sqrt(S(6)*x + S(-9)) + S(3))/S(12))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(-1))/(sqrt(x)*(x**S(2) + S(1))), x), x, S(2)*x**(S(3)/2)/S(3) - sqrt(S(2))*atan(sqrt(S(2))*sqrt(x) + S(-1)) - sqrt(S(2))*atan(sqrt(S(2))*sqrt(x) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(2)*sqrt(x + S(-1))*sqrt(x - sqrt(x + S(-1)))), x), x, -asinh(sqrt(S(3))*(-S(2)*sqrt(x + S(-1)) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**(S(7)/2) + S(1))/(-x**S(2) + S(1)), x), x, -S(2)*x**(S(5)/2)/S(5) - S(2)*sqrt(x) - log(-sqrt(x) + S(1)) + log(x + S(1))/S(2) + atan(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(4))/((S(2)*x + S(-1))**(S(1)/3) + sqrt(S(2)*x + S(-1))), x), x, -x + S(3)*(S(2)*x + S(-1))**(S(7)/6)/S(7) + S(3)*(S(2)*x + S(-1))**(S(5)/6)/S(5) + S(18)*(S(2)*x + S(-1))**(S(1)/6) - S(3)*(S(2)*x + S(-1))**(S(4)/3)/S(8) - S(3)*(S(2)*x + S(-1))**(S(2)/3)/S(4) - S(9)*(S(2)*x + S(-1))**(S(1)/3) + (S(2)*x + S(-1))**(S(3)/2)/S(3) + S(6)*sqrt(S(2)*x + S(-1)) - S(18)*log((S(2)*x + S(-1))**(S(1)/6) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(sqrt(sqrt(x) + S(1)) + S(2)), x), x, S(8)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(7)/2)/S(7) - S(48)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(5)/2)/S(5) + S(88)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(3)/2)/S(3) - S(48)*sqrt(sqrt(sqrt(x) + S(1)) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(sqrt(x) + S(4)) + S(2)), x), x, S(8)*(sqrt(sqrt(x) + S(4)) + S(2))**(S(9)/2)/S(9) - S(48)*(sqrt(sqrt(x) + S(4)) + S(2))**(S(7)/2)/S(7) + S(64)*(sqrt(sqrt(x) + S(4)) + S(2))**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-sqrt(sqrt(S(5)*x + S(-9)) + S(4)) + S(2)), x), x, S(8)*(-sqrt(sqrt(S(5)*x + S(-9)) + S(4)) + S(2))**(S(9)/2)/S(45) - S(48)*(-sqrt(sqrt(S(5)*x + S(-9)) + S(4)) + S(2))**(S(7)/2)/S(35) + S(64)*(-sqrt(sqrt(S(5)*x + S(-9)) + S(4)) + S(2))**(S(5)/2)/S(25), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(sqrt(sqrt(x) + S(1)) + S(2)), x), x, S(8)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(7)/2)/S(7) - S(48)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(5)/2)/S(5) + S(88)*(sqrt(sqrt(x) + S(1)) + S(2))**(S(3)/2)/S(3) - S(48)*sqrt(sqrt(sqrt(x) + S(1)) + S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1)), x), x, S(16)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(17)/2)/S(17) - S(112)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(15)/2)/S(15) + S(288)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(13)/2)/S(13) - S(320)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(11)/2)/S(11) + S(112)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(9)/2)/S(9) + S(48)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(7)/2)/S(7) - S(32)*(sqrt(sqrt(sqrt(x) + S(1)) + S(1)) + S(1))**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2)), x), x, S(4)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(17)/2)/S(17) - S(56)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(15)/2)/S(15) + S(300)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(13)/2)/S(13) - S(760)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(11)/2)/S(11) + S(304)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(9)/2)/S(3) - S(480)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(7)/2)/S(7) + S(136)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(5)/2)/S(5) - S(16)*(sqrt(sqrt(S(2)*sqrt(x) + S(-1)) + S(3)) + S(2))**(S(3)/2)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(sqrt(sqrt(x + S(-1)) + S(1)) + S(1)), x), x, S(8)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(17)/2)/S(17) - S(56)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(15)/2)/S(15) + S(144)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(13)/2)/S(13) - S(160)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(11)/2)/S(11) + S(8)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(9)/2) - S(24)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(7)/2)/S(7) + S(16)*(sqrt(sqrt(x + S(-1)) + S(1)) + S(1))**(S(5)/2)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x + S(-1))*sqrt(x - sqrt(x + S(-1)))), x), x, -S(2)*asinh(sqrt(S(3))*(-S(2)*sqrt(x + S(-1)) + S(1))/S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x + sqrt(S(2)*x + S(-1)) + S(1)), x), x, S(2)*sqrt(x + sqrt(S(2)*x + S(-1)) + S(1)) - sqrt(S(2))*asinh(sqrt(S(2))*(sqrt(S(2)*x + S(-1)) + S(1))/S(2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(S(1)/sqrt(x + sqrt(S(2)*x + S(-1)) + S(1)), x), x, sqrt(S(2))*sqrt(S(2)*x + S(2)*sqrt(S(2)*x + S(-1)) + S(2)) - sqrt(S(2))*asinh(sqrt(S(2))*(sqrt(S(2)*x + S(-1)) + S(1))/S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((p*x + q)/((f + sqrt(a*x + b))*sqrt(a*x + b)), x), x, p*x/a - S(2)*f*p*sqrt(a*x + b)/a**S(2) - (-S(2)*a*q + S(2)*b*p - S(2)*f**S(2)*p)*log(f + sqrt(a*x + b))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-sqrt(x) - x + S(1)), x), x, (-sqrt(x)/S(2) + S(-1)/4)*sqrt(-sqrt(x) - x + S(1)) - S(2)*(-sqrt(x) - x + S(1))**(S(3)/2)/S(3) - S(5)*asin(sqrt(S(5))*(S(2)*sqrt(x) + S(1))/S(5))/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(6)*sqrt(x) + x + S(9))/(S(4)*sqrt(x) + x), x), x, S(4)*sqrt(x) + x + S(2)*log(sqrt(x) + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-S(8)*x**(S(7)/2) + S(6))/(-S(9)*sqrt(x) + S(5)), x), x, S(80)*x**(S(7)/2)/S(567) + S(400)*x**(S(5)/2)/S(6561) + S(50000)*x**(S(3)/2)/S(1594323) - S(56145628)*sqrt(x)/S(43046721) + S(2)*x**S(4)/S(9) + S(200)*x**S(3)/S(2187) + S(2500)*x**S(2)/S(59049) + S(125000)*x/S(4782969) - S(280728140)*log(-S(9)*sqrt(x) + S(5))/S(387420489), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + S(1))*(x**S(3) + S(1))/(x**S(2) + S(1)), x), x, S(2)*(x + S(1))**(S(5)/2)/S(5) - S(2)*(x + S(1))**(S(3)/2)/S(3) - S(2)*sqrt(x + S(1)) + (S(1) - I)**(S(3)/2)*atanh(sqrt(x + S(1))/sqrt(S(1) - I)) + (S(1) + I)**(S(3)/2)*atanh(sqrt(x + S(1))/sqrt(S(1) + I)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(x + S(1))*(x**S(3) + S(1))/(x**S(2) + S(1)), x), x, S(2)*(x + S(1))**(S(5)/2)/S(5) - S(2)*(x + S(1))**(S(3)/2)/S(3) - S(2)*sqrt(x + S(1)) - log(x - sqrt(S(2) + S(2)*sqrt(S(2)))*sqrt(x + S(1)) + S(1) + sqrt(S(2)))/(S(2)*sqrt(S(1) + sqrt(S(2)))) + log(x + sqrt(S(2) + S(2)*sqrt(S(2)))*sqrt(x + S(1)) + S(1) + sqrt(S(2)))/(S(2)*sqrt(S(1) + sqrt(S(2)))) - sqrt(S(1) + sqrt(S(2)))*atan((-S(2)*sqrt(x + S(1)) + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2)))) + sqrt(S(1) + sqrt(S(2)))*atan((S(2)*sqrt(x + S(1)) + sqrt(S(2) + S(2)*sqrt(S(2))))/sqrt(S(-2) + S(2)*sqrt(S(2)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-sqrt(x) + x + S(-1))/(sqrt(x)*(x + S(-1))), x), x, atan((-sqrt(x) + S(3))/(S(2)*sqrt(-sqrt(x) + x + S(-1)))) - S(2)*atanh((-S(2)*sqrt(x) + S(1))/(S(2)*sqrt(-sqrt(x) + x + S(-1)))) - atanh((S(3)*sqrt(x) + S(1))/(S(2)*sqrt(-sqrt(x) + x + S(-1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*sqrt(x + S(1)) + S(1))/(x*sqrt(x + S(1))*sqrt(x + sqrt(x + S(1)))), x), x, -atan((sqrt(x + S(1)) + S(3))/(S(2)*sqrt(x + sqrt(x + S(1))))) + S(3)*atanh((-S(3)*sqrt(x + S(1)) + S(1))/(S(2)*sqrt(x + sqrt(x + S(1))))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(x)*sqrt(x + S(1))), x), x, S(2)*asinh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x/(x + S(1)))/x, x), x, S(2)*asinh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x)/sqrt(x + S(1)), x), x, sqrt(x)*sqrt(x + S(1)) - asinh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x/(x + S(1))), x), x, sqrt(x)*sqrt(x + S(1)) - asinh(sqrt(x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x + S(-1))/(x**S(2)*sqrt(x + S(1))), x), x, atan(sqrt(x + S(-1))*sqrt(x + S(1))) - sqrt(x + S(-1))*sqrt(x + S(1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x + S(-1))/(x + S(1)))/x**S(2), x), x, atan(sqrt(x + S(-1))*sqrt(x + S(1))) - sqrt(x + S(-1))*sqrt(x + S(1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt(x + S(-1))/sqrt(x + S(1)), x), x, x**S(2)*(x + S(-1))**(S(3)/2)*sqrt(x + S(1))/S(4) + (-x/S(12) + S(7)/24)*(x + S(-1))**(S(3)/2)*sqrt(x + S(1)) - S(3)*sqrt(x + S(-1))*sqrt(x + S(1))/S(8) + S(3)*acosh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*sqrt((x + S(-1))/(x + S(1))), x), x, x**S(2)*(x + S(-1))**(S(3)/2)*sqrt(x + S(1))/S(4) + (-x/S(12) + S(7)/24)*(x + S(-1))**(S(3)/2)*sqrt(x + S(1)) - S(3)*sqrt(x + S(-1))*sqrt(x + S(1))/S(8) + S(3)*acosh(x)/S(8), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x/(x + S(1)))/x, x), x, S(2)*atan(sqrt(-x/(x + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-x + S(1))/(x + S(1)))/(x + S(-1)), x), x, S(2)*atan(sqrt((-x + S(1))/(x + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((a + b*x)/(-b*x + c))/(a + b*x), x), x, S(2)*atan(sqrt((a + b*x)/(-b*x + c)))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((a + b*x)/(c + d*x))/(a + b*x), x), x, S(2)*atanh(sqrt(d)*sqrt((a + b*x)/(c + d*x))/sqrt(b))/(sqrt(b)*sqrt(d)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x/(x + S(1))), x), x, sqrt(-x/(x + S(1)))*(x + S(1)) - atan(sqrt(-x/(x + S(1)))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(-x/(x + S(1))), x), x, sqrt(-x/(x + S(1)))/(-x/(x + S(1)) + S(1)) - atan(sqrt(-x/(x + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-x + S(1))/(x + S(1))), x), x, sqrt((-x + S(1))/(x + S(1)))*(x + S(1)) - S(2)*atan(sqrt((-x + S(1))/(x + S(1)))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt((-x + S(1))/(x + S(1))), x), x, S(2)*sqrt((-x + S(1))/(x + S(1)))/((-x + S(1))/(x + S(1)) + S(1)) - S(2)*atan(sqrt((-x + S(1))/(x + S(1)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((a + x)/(a - x)), x), x, S(2)*a*atan(sqrt((a + x)/(a - x))) - sqrt((a + x)/(a - x))*(a - x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt((a + x)/(a - x)), x), x, -S(2)*a*sqrt((a + x)/(a - x))/(S(1) + (a + x)/(a - x)) + S(2)*a*atan(sqrt((a + x)/(a - x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((-a + x)/(a + x)), x), x, -S(2)*a*atanh(sqrt(-(a - x)/(a + x))) + sqrt(-(a - x)/(a + x))*(a + x), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt((-a + x)/(a + x)), x), x, S(2)*a*sqrt(-(a - x)/(a + x))/((a - x)/(a + x) + S(1)) - S(2)*a*atanh(sqrt(-(a - x)/(a + x))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((a + b*x)/(c + d*x)), x), x, sqrt((a + b*x)/(c + d*x))*(c + d*x)/d - (-a*d + b*c)*atanh(sqrt(d)*sqrt((a + b*x)/(c + d*x))/sqrt(b))/(sqrt(b)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt((a + b*x)/(c + d*x)), x), x, sqrt((a + b*x)/(c + d*x))*(-a*d + b*c)/(d*(b - d*(a + b*x)/(c + d*x))) - (-a*d + b*c)*atanh(sqrt(d)*sqrt((a + b*x)/(c + d*x))/sqrt(b))/(sqrt(b)*d**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x + S(-1))/(S(3)*x + S(5))), x), x, sqrt(x + S(-1))*sqrt(S(3)*x + S(5))/S(3) - S(8)*sqrt(S(3))*asinh(sqrt(S(6))*sqrt(x + S(-1))/S(4))/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((S(5)*x + S(-1))/(S(7)*x + S(1)))/x**S(2), x), x, -S(12)*atan(sqrt(S(7)*x + S(1))/sqrt(S(5)*x + S(-1))) - sqrt(S(5)*x + S(-1))*sqrt(S(7)*x + S(1))/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt((-x + S(1))/(x + S(1)))*(x + S(1))), x), x, -(-x + S(1))/sqrt((-x + S(1))/(x + S(1))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x/(sqrt((-x + S(1))/(x + S(1)))*(x + S(1))), x), x, -S(2)*sqrt((-x + S(1))/(x + S(1)))/((-x + S(1))/(x + S(1)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt(S(-1) + S(2)/(x + S(1)))*(x + S(1))), x), x, -sqrt(S(-1) + S(2)/(x + S(1)))*(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(sqrt((x + S(2))/(x + S(3)))*(x + S(1))), x), x, sqrt(x + S(2))*sqrt(x + S(3)) - asinh(sqrt(x + S(2))) + S(2)*sqrt(S(2))*atanh(sqrt(S(2))*sqrt(x + S(2))/sqrt(x + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1) + S(1)/x)/(x + S(1))**S(2), x), x, S(2)/sqrt(S(1) + S(1)/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1) + S(1)/x)/sqrt(-x**S(2) + S(1)), x), x, sqrt(x)*sqrt(S(1) + S(1)/x)*asin(S(2)*x + S(-1))/sqrt(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(a + b*sqrt(c/x)), x), x, S(4)*x**(m + S(1))*(a + b*sqrt(c/x))**(S(3)/2)*hyper((S(1), -S(2)*m + S(-1)/2), (S(5)/2,), (a + b*sqrt(c/x))/a)/(S(3)*a), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**m*sqrt(a + b*sqrt(c/x)), x), x, S(4)*b**S(2)*c*x**m*(-b*sqrt(c/x)/a)**(S(2)*m)*(a + b*sqrt(c/x))**(S(3)/2)*hyper((S(3)/2, S(2)*m + S(3)), (S(5)/2,), S(1) + b*sqrt(c/x)/a)/(S(3)*a**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*sqrt(c/x)), x), x, x**S(2)*sqrt(a + b*sqrt(c/x))/S(2) + b*c**S(2)*sqrt(a + b*sqrt(c/x))/(S(12)*a*(c/x)**(S(3)/2)) - S(5)*b**S(2)*c*x*sqrt(a + b*sqrt(c/x))/(S(48)*a**S(2)) + S(5)*b**S(3)*c**S(2)*sqrt(a + b*sqrt(c/x))/(S(32)*a**S(3)*sqrt(c/x)) - S(5)*b**S(4)*c**S(2)*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a))/(S(32)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c/x)), x), x, x*sqrt(a + b*sqrt(c/x)) + b*c*sqrt(a + b*sqrt(c/x))/(S(2)*a*sqrt(c/x)) - b**S(2)*c*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a))/(S(2)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c/x))/x, x), x, S(4)*sqrt(a)*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a)) - S(4)*sqrt(a + b*sqrt(c/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c/x))/x**S(2), x), x, S(4)*a*(a + b*sqrt(c/x))**(S(3)/2)/(S(3)*b**S(2)*c) - S(4)*(a + b*sqrt(c/x))**(S(5)/2)/(S(5)*b**S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c/x))/x**S(3), x), x, S(4)*a**S(3)*(a + b*sqrt(c/x))**(S(3)/2)/(S(3)*b**S(4)*c**S(2)) - S(12)*a**S(2)*(a + b*sqrt(c/x))**(S(5)/2)/(S(5)*b**S(4)*c**S(2)) + S(12)*a*(a + b*sqrt(c/x))**(S(7)/2)/(S(7)*b**S(4)*c**S(2)) - S(4)*(a + b*sqrt(c/x))**(S(9)/2)/(S(9)*b**S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(c/x))/x**S(4), x), x, S(4)*a**S(5)*(a + b*sqrt(c/x))**(S(3)/2)/(S(3)*b**S(6)*c**S(3)) - S(4)*a**S(4)*(a + b*sqrt(c/x))**(S(5)/2)/(b**S(6)*c**S(3)) + S(40)*a**S(3)*(a + b*sqrt(c/x))**(S(7)/2)/(S(7)*b**S(6)*c**S(3)) - S(40)*a**S(2)*(a + b*sqrt(c/x))**(S(9)/2)/(S(9)*b**S(6)*c**S(3)) + S(20)*a*(a + b*sqrt(c/x))**(S(11)/2)/(S(11)*b**S(6)*c**S(3)) - S(4)*(a + b*sqrt(c/x))**(S(13)/2)/(S(13)*b**S(6)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/sqrt(a + b*sqrt(c/x)), x), x, S(4)*x**(m + S(1))*sqrt(a + b*sqrt(c/x))*hyper((S(1), -S(2)*m + S(-3)/2), (S(3)/2,), (a + b*sqrt(c/x))/a)/a, expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**m/sqrt(a + b*sqrt(c/x)), x), x, S(4)*b**S(2)*c*x**m*(-b*sqrt(c/x)/a)**(S(2)*m)*sqrt(a + b*sqrt(c/x))*hyper((S(1)/2, S(2)*m + S(3)), (S(3)/2,), S(1) + b*sqrt(c/x)/a)/a**S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*sqrt(c/x)), x), x, x**S(2)*sqrt(a + b*sqrt(c/x))/(S(2)*a) - S(7)*b*c**S(2)*sqrt(a + b*sqrt(c/x))/(S(12)*a**S(2)*(c/x)**(S(3)/2)) + S(35)*b**S(2)*c*x*sqrt(a + b*sqrt(c/x))/(S(48)*a**S(3)) - S(35)*b**S(3)*c**S(2)*sqrt(a + b*sqrt(c/x))/(S(32)*a**S(4)*sqrt(c/x)) + S(35)*b**S(4)*c**S(2)*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a))/(S(32)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*sqrt(c/x)), x), x, x*sqrt(a + b*sqrt(c/x))/a - S(3)*b*c*sqrt(a + b*sqrt(c/x))/(S(2)*a**S(2)*sqrt(c/x)) + S(3)*b**S(2)*c*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a))/(S(2)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*sqrt(c/x))), x), x, S(4)*atanh(sqrt(a + b*sqrt(c/x))/sqrt(a))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*sqrt(c/x))), x), x, S(4)*a*sqrt(a + b*sqrt(c/x))/(b**S(2)*c) - S(4)*(a + b*sqrt(c/x))**(S(3)/2)/(S(3)*b**S(2)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*sqrt(c/x))), x), x, S(4)*a**S(3)*sqrt(a + b*sqrt(c/x))/(b**S(4)*c**S(2)) - S(4)*a**S(2)*(a + b*sqrt(c/x))**(S(3)/2)/(b**S(4)*c**S(2)) + S(12)*a*(a + b*sqrt(c/x))**(S(5)/2)/(S(5)*b**S(4)*c**S(2)) - S(4)*(a + b*sqrt(c/x))**(S(7)/2)/(S(7)*b**S(4)*c**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*sqrt(c/x))), x), x, S(4)*a**S(5)*sqrt(a + b*sqrt(c/x))/(b**S(6)*c**S(3)) - S(20)*a**S(4)*(a + b*sqrt(c/x))**(S(3)/2)/(S(3)*b**S(6)*c**S(3)) + S(8)*a**S(3)*(a + b*sqrt(c/x))**(S(5)/2)/(b**S(6)*c**S(3)) - S(40)*a**S(2)*(a + b*sqrt(c/x))**(S(7)/2)/(S(7)*b**S(6)*c**S(3)) + S(20)*a*(a + b*sqrt(c/x))**(S(9)/2)/(S(9)*b**S(6)*c**S(3)) - S(4)*(a + b*sqrt(c/x))**(S(11)/2)/(S(11)*b**S(6)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(sqrt(S(1)/x) + S(1)), x), x, x*sqrt(sqrt(S(1)/x) + S(1)) - S(3)*sqrt(sqrt(S(1)/x) + S(1))/(S(2)*sqrt(S(1)/x)) + S(3)*atanh(sqrt(sqrt(S(1)/x) + S(1)))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(a + b*sqrt(d/x) + c/x), x), x, x**(m + S(1))*sqrt(a + b*sqrt(d/x) + c/x)*AppellF1(-S(2)*m + S(-2), S(-1)/2, S(-1)/2, -S(2)*m + S(-1), -S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) - sqrt(-S(4)*a*c + b**S(2)*d))), -S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) + sqrt(-S(4)*a*c + b**S(2)*d))))/((m + S(1))*sqrt(S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) - sqrt(-S(4)*a*c + b**S(2)*d))) + S(1))*sqrt(S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) + sqrt(-S(4)*a*c + b**S(2)*d))) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a + b*sqrt(d/x) + c/x), x), x, x**S(3)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(3)*a) - S(3)*b*d**S(3)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(10)*a**S(2)*(d/x)**(S(5)/2)) - x**S(2)*(S(20)*a*c - S(21)*b**S(2)*d)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(80)*a**S(3)) + S(7)*b*d**S(2)*(S(28)*a*c - S(15)*b**S(2)*d)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(480)*a**S(4)*(d/x)**(S(3)/2)) + x*(S(2)*a + b*sqrt(d/x))*sqrt(a + b*sqrt(d/x) + c/x)*(S(16)*a**S(2)*c**S(2) - S(56)*a*b**S(2)*c*d + S(21)*b**S(4)*d**S(2))/(S(256)*a**S(5)) + (S(4)*a*c - b**S(2)*d)*(S(16)*a**S(2)*c**S(2) - S(56)*a*b**S(2)*c*d + S(21)*b**S(4)*d**S(2))*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(512)*a**(S(11)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a + b*sqrt(d/x) + c/x), x), x, x**S(2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(2)*a) - S(5)*b*d**S(2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(12)*a**S(2)*(d/x)**(S(3)/2)) - x*(S(2)*a + b*sqrt(d/x))*(S(4)*a*c - S(5)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(32)*a**S(3)) - (S(4)*a*c - S(5)*b**S(2)*d)*(S(4)*a*c - b**S(2)*d)*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(64)*a**(S(7)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(d/x) + c/x), x), x, x*(S(2)*a + b*sqrt(d/x))*sqrt(a + b*sqrt(d/x) + c/x)/(S(2)*a) + (S(4)*a*c - b**S(2)*d)*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(4)*a**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(d/x) + c/x)/x, x), x, S(2)*sqrt(a)*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x))) - b*sqrt(d)*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/sqrt(c) - S(2)*sqrt(a + b*sqrt(d/x) + c/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(d/x) + c/x)/x**S(2), x), x, b*(b*d + S(2)*c*sqrt(d/x))*sqrt(a + b*sqrt(d/x) + c/x)/(S(4)*c**S(2)) + b*sqrt(d)*(S(4)*a*c - b**S(2)*d)*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(8)*c**(S(5)/2)) - S(2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(3)*c), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(d/x) + c/x)/x**S(3), x), x, -b*(S(12)*a*c - S(7)*b**S(2)*d)*(b*d + S(2)*c*sqrt(d/x))*sqrt(a + b*sqrt(d/x) + c/x)/(S(64)*c**S(4)) - b*sqrt(d)*(S(4)*a*c - b**S(2)*d)*(S(12)*a*c - S(7)*b**S(2)*d)*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(128)*c**(S(9)/2)) - S(2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(5)*c*x) + (a + b*sqrt(d/x) + c/x)**(S(3)/2)*(S(32)*a*c - S(35)*b**S(2)*d + S(42)*b*c*sqrt(d/x))/(S(120)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*sqrt(d/x) + c/x)/x**S(4), x), x, S(11)*b*(d/x)**(S(3)/2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(42)*c**S(2)*d) + b*(b*d + S(2)*c*sqrt(d/x))*sqrt(a + b*sqrt(d/x) + c/x)*(S(80)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c*d + S(33)*b**S(4)*d**S(2))/(S(512)*c**S(6)) + b*sqrt(d)*(S(4)*a*c - b**S(2)*d)*(S(80)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c*d + S(33)*b**S(4)*d**S(2))*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(1024)*c**(S(13)/2)) - S(2)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(7)*c*x**S(2)) + (S(32)*a*c - S(33)*b**S(2)*d)*(a + b*sqrt(d/x) + c/x)**(S(3)/2)/(S(140)*c**S(3)*x) - (a + b*sqrt(d/x) + c/x)**(S(3)/2)*(S(1024)*a**S(2)*c**S(2) - S(3276)*a*b**S(2)*c*d + S(1155)*b**S(4)*d**S(2) + S(18)*b*c*sqrt(d/x)*(S(148)*a*c - S(77)*b**S(2)*d))/(S(6720)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m/sqrt(a + b*sqrt(d/x) + c/x), x), x, x**(m + S(1))*sqrt(S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) - sqrt(-S(4)*a*c + b**S(2)*d))) + S(1))*sqrt(S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) + sqrt(-S(4)*a*c + b**S(2)*d))) + S(1))*AppellF1(-S(2)*m + S(-2), S(1)/2, S(1)/2, -S(2)*m + S(-1), -S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) - sqrt(-S(4)*a*c + b**S(2)*d))), -S(2)*c*sqrt(d/x)/(sqrt(d)*(b*sqrt(d) + sqrt(-S(4)*a*c + b**S(2)*d))))/((m + S(1))*sqrt(a + b*sqrt(d/x) + c/x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a + b*sqrt(d/x) + c/x), x), x, x**S(3)*sqrt(a + b*sqrt(d/x) + c/x)/(S(3)*a) - S(11)*b*d**S(3)*sqrt(a + b*sqrt(d/x) + c/x)/(S(30)*a**S(2)*(d/x)**(S(5)/2)) - x**S(2)*(S(100)*a*c - S(99)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(240)*a**S(3)) + b*d**S(2)*(S(156)*a*c - S(77)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(160)*a**S(4)*(d/x)**(S(3)/2)) + x*sqrt(a + b*sqrt(d/x) + c/x)*(S(400)*a**S(2)*c**S(2) - S(1176)*a*b**S(2)*c*d + S(385)*b**S(4)*d**S(2))/(S(640)*a**S(5)) - S(7)*b*d*sqrt(a + b*sqrt(d/x) + c/x)*(S(528)*a**S(2)*c**S(2) - S(680)*a*b**S(2)*c*d + S(165)*b**S(4)*d**S(2))/(S(1280)*a**S(6)*sqrt(d/x)) - (S(320)*a**S(3)*c**S(3) - S(1680)*a**S(2)*b**S(2)*c**S(2)*d + S(1260)*a*b**S(4)*c*d**S(2) - S(231)*b**S(6)*d**S(3))*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(512)*a**(S(13)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a + b*sqrt(d/x) + c/x), x), x, x**S(2)*sqrt(a + b*sqrt(d/x) + c/x)/(S(2)*a) - S(7)*b*d**S(2)*sqrt(a + b*sqrt(d/x) + c/x)/(S(12)*a**S(2)*(d/x)**(S(3)/2)) - x*(S(36)*a*c - S(35)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(48)*a**S(3)) + S(5)*b*d*(S(44)*a*c - S(21)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(96)*a**S(4)*sqrt(d/x)) + (S(48)*a**S(2)*c**S(2) - S(120)*a*b**S(2)*c*d + S(35)*b**S(4)*d**S(2))*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(64)*a**(S(9)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a + b*sqrt(d/x) + c/x), x), x, x*sqrt(a + b*sqrt(d/x) + c/x)/a - S(3)*b*d*sqrt(a + b*sqrt(d/x) + c/x)/(S(2)*a**S(2)*sqrt(d/x)) - (S(4)*a*c - S(3)*b**S(2)*d)*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(4)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x*sqrt(a + b*sqrt(d/x) + c/x)), x), x, S(2)*atanh((S(2)*a + b*sqrt(d/x))/(S(2)*sqrt(a)*sqrt(a + b*sqrt(d/x) + c/x)))/sqrt(a), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(2)*sqrt(a + b*sqrt(d/x) + c/x)), x), x, b*sqrt(d)*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/c**(S(3)/2) - S(2)*sqrt(a + b*sqrt(d/x) + c/x)/c, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(3)*sqrt(a + b*sqrt(d/x) + c/x)), x), x, -b*sqrt(d)*(S(12)*a*c - S(5)*b**S(2)*d)*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(8)*c**(S(7)/2)) - S(2)*sqrt(a + b*sqrt(d/x) + c/x)/(S(3)*c*x) + sqrt(a + b*sqrt(d/x) + c/x)*(S(16)*a*c - S(15)*b**S(2)*d + S(10)*b*c*sqrt(d/x))/(S(12)*c**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x**S(4)*sqrt(a + b*sqrt(d/x) + c/x)), x), x, S(9)*b*(d/x)**(S(3)/2)*sqrt(a + b*sqrt(d/x) + c/x)/(S(20)*c**S(2)*d) + b*sqrt(d)*(S(240)*a**S(2)*c**S(2) - S(280)*a*b**S(2)*c*d + S(63)*b**S(4)*d**S(2))*atanh((b*d + S(2)*c*sqrt(d/x))/(S(2)*sqrt(c)*sqrt(d)*sqrt(a + b*sqrt(d/x) + c/x)))/(S(128)*c**(S(11)/2)) - S(2)*sqrt(a + b*sqrt(d/x) + c/x)/(S(5)*c*x**S(2)) + (S(64)*a*c - S(63)*b**S(2)*d)*sqrt(a + b*sqrt(d/x) + c/x)/(S(120)*c**S(3)*x) - sqrt(a + b*sqrt(d/x) + c/x)*(S(1024)*a**S(2)*c**S(2) - S(2940)*a*b**S(2)*c*d + S(945)*b**S(4)*d**S(2) + S(14)*b*c*sqrt(d/x)*(S(92)*a*c - S(45)*b**S(2)*d))/(S(960)*c**S(5)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(S(1)/x) + S(1)/x), x), x, S(4)*(sqrt(S(1)/x) + S(1)/x)**(S(3)/2)/(S(3)*(S(1)/x)**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(sqrt(S(1)/x) + S(2) + S(1)/x), x), x, x*(sqrt(S(1)/x)/S(4) + S(1))*sqrt(sqrt(S(1)/x) + S(2) + S(1)/x) + S(7)*sqrt(S(2))*atanh(sqrt(S(2))*(sqrt(S(1)/x) + S(4))/(S(4)*sqrt(sqrt(S(1)/x) + S(2) + S(1)/x)))/S(16), expand=True, _diff=True, _numerical=True) # difference in simplify assert rubi_test(rubi_integrate(S(1)/(x + sqrt(-x**S(2) - S(2)*x + S(3))), x), x, -log(-(-x - sqrt(S(3))*sqrt(-x**S(2) - S(2)*x + S(3)) + S(3))/x**S(2))/S(2) + (-sqrt(S(7))/S(14) + S(1)/2)*log(S(1) + sqrt(S(3)) + sqrt(S(7)) - sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x) + (sqrt(S(7))/S(14) + S(1)/2)*log(-sqrt(S(7)) + S(1) + sqrt(S(3)) - sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x) + atan((-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(-x**S(2) - S(2)*x + S(3)))**(S(-2)), x), x, (-S(2)*sqrt(S(3)) + S(8) + S(2)*(-S(3)*sqrt(-x**S(2) - S(2)*x + S(3)) + S(3)*sqrt(S(3)))/x)/(-S(7)*sqrt(S(3)) + S(14) - S(7)*(S(2) + S(2)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x + S(7)*sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/x**S(2)) - S(8)*sqrt(S(7))*atanh(sqrt(S(7))*(S(1) + sqrt(S(3)) - sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x)/S(7))/S(49), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(-x**S(2) - S(2)*x + S(3)))**(S(-3)), x), x, S(4)*sqrt(S(3))*(S(1) + sqrt(S(3)) - sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x)/(-S(49)*sqrt(S(3)) + S(98) - S(49)*(S(2) + S(2)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x + S(49)*sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/x**S(2)) - sqrt(S(3))*(-S(2)*sqrt(S(3)) + S(8) + S(2)*(-S(7)*sqrt(S(3)) + S(10))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x)/(S(21)*(-sqrt(S(3)) + S(2) - (S(2) + S(2)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x + sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/x**S(2))**S(2)) - S(12)*sqrt(S(7))*atanh(sqrt(S(7))*(S(1) + sqrt(S(3)) - sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x)/S(7))/S(343) + (S(6) + S(4)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/(S(3)*x**S(2)*(-sqrt(S(3)) + S(2) - (S(2) + S(2)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x + sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/x**S(2))**S(2)) - S(2)*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(3)/(x**S(3)*(-sqrt(S(3)) + S(2) - (S(2) + S(2)*sqrt(S(3)))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))/x + sqrt(S(3))*(-sqrt(-x**S(2) - S(2)*x + S(3)) + sqrt(S(3)))**S(2)/x**S(2))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x + sqrt(x**S(2) - S(2)*x + S(-3))), x), x, -S(3)*log(x + sqrt(x**S(2) - S(2)*x + S(-3)))/S(2) + S(2)*log(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)) - S(2)/(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(x**S(2) - S(2)*x + S(-3)))**(S(-2)), x), x, -S(4)*log(x + sqrt(x**S(2) - S(2)*x + S(-3))) + S(4)*log(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)) - S(2)/(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)) + S(3)/(S(2)*x + S(2)*sqrt(x**S(2) - S(2)*x + S(-3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(x**S(2) - S(2)*x + S(-3)))**(S(-3)), x), x, -S(6)*log(x + sqrt(x**S(2) - S(2)*x + S(-3))) + S(6)*log(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)) - S(2)/(-x - sqrt(x**S(2) - S(2)*x + S(-3)) + S(1)) + S(4)/(x + sqrt(x**S(2) - S(2)*x + S(-3))) + S(3)/(S(4)*(x + sqrt(x**S(2) - S(2)*x + S(-3)))**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(x + sqrt(-x**S(2) - S(4)*x + S(-3))), x), x, log((x*sqrt(-x + S(-1)) + x*sqrt(x + S(3)) + S(3)*sqrt(-x + S(-1)))/(x + S(3))**(S(3)/2))/S(2) - log(S(1)/(x + S(3)))/S(2) - sqrt(S(2))*atan(sqrt(S(2))*(-S(3)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1))/S(2)) - atan(sqrt(-x + S(-1))/sqrt(x + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(-x**S(2) - S(4)*x + S(-3)))**(S(-2)), x), x, (-sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1))/(-S(2)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1) - (S(3)*x + S(3))/(x + S(3))) + sqrt(S(2))*atan(sqrt(S(2))*(-S(3)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1))/S(2))/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x + sqrt(-x**S(2) - S(4)*x + S(-3)))**(S(-3)), x), x, -(-S(9)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(5))/(-S(18)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(9) - S(9)*(S(3)*x + S(3))/(x + S(3))) - (-S(3)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1))/(-S(12)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(6) - S(6)*(S(3)*x + S(3))/(x + S(3))) - (-S(2)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(4))/(S(9)*(-S(2)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1) - (S(3)*x + S(3))/(x + S(3)))**S(2)) - S(3)*sqrt(S(2))*atan(sqrt(S(2))*(-S(3)*sqrt(-x + S(-1))/sqrt(x + S(3)) + S(1))/S(2))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(3)*(x + S(1))**S(3)*(S(2)*x + S(1))*sqrt(-x**S(4) - S(2)*x**S(3) - x**S(2) + S(1)), x), x, -(-x**S(4) - S(2)*x**S(3) - x**S(2) + S(1))**(S(3)/2)*(S(3)*x**S(4) + S(6)*x**S(3) + S(3)*x**S(2) + S(2))/S(15), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(x**S(3)*(x + S(1))**S(3)*(S(2)*x + S(1))*sqrt(-x**S(4) - S(2)*x**S(3) - x**S(2) + S(1)), x), x, -(-S(4)*(x + S(1)/2)**S(2) + S(1))**S(2)*(-S(16)*(x + S(1)/2)**S(4) + S(8)*(x + S(1)/2)**S(2) + S(15))**(S(3)/2)/S(5120) - (-S(16)*(x + S(1)/2)**S(4) + S(8)*(x + S(1)/2)**S(2) + S(15))**(S(3)/2)/S(480), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x + S(1))*(x**S(2) + x)**S(3)*sqrt(-(x**S(2) + x)**S(2) + S(1)), x), x, -(-x**S(4) - S(2)*x**S(3) - x**S(2) + S(1))**(S(3)/2)*(S(3)*x**S(4) + S(6)*x**S(3) + S(3)*x**S(2) + S(2))/S(15), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate((S(2)*x + S(1))*(x**S(2) + x)**S(3)*sqrt(-(x**S(2) + x)**S(2) + S(1)), x), x, -(-S(4)*(x + S(1)/2)**S(2) + S(1))**S(2)*(-S(16)*(x + S(1)/2)**S(4) + S(8)*(x + S(1)/2)**S(2) + S(15))**(S(3)/2)/S(5120) - (-S(16)*(x + S(1)/2)**S(4) + S(8)*(x + S(1)/2)**S(2) + S(15))**(S(3)/2)/S(480), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) + S(3)*x**S(2) + S(3)*x)/(x**S(4) + S(4)*x**S(3) + S(6)*x**S(2) + S(4)*x + S(1)), x), x, log(x + S(1)) + S(1)/(S(3)*(x + S(1))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(3) - S(3)*x**S(2) + S(3)*x + S(-1))/(x**S(4) + S(4)*x**S(3) + S(6)*x**S(2) + S(4)*x + S(1)), x), x, log(x + S(1)) + S(6)/(x + S(1)) - S(6)/(x + S(1))**S(2) + S(8)/(S(3)*(x + S(1))**S(3)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(3)/2), x), x, (x + S(-1))*(-S(6)*(x + S(-1))**S(2)/S(35) + S(26)/35)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + (x + S(-1))*(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)/S(7) - S(16)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(5) + S(176)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, (x + S(-1))*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))/S(3) - S(2)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(3) + S(4)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(-x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(-3)/2), x), x, (x + S(-1))*((x + S(-1))**S(2) + S(5))/(S(24)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(24) + sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((-x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(-5)/2), x), x, (x + S(-1))*((x + S(-1))**S(2) + S(5))/(S(72)*(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)) + (x + S(-1))*(S(7)*(x + S(-1))**S(2) + S(26))/(S(432)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - S(7)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(432) + S(11)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(432), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x*(-x + S(2))*(x**S(2) - S(2)*x + S(4)))**(S(3)/2), x), x, (x + S(-1))*(-S(6)*(x + S(-1))**S(2)/S(35) + S(26)/35)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + (x + S(-1))*(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)/S(7) - S(16)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(5) + S(176)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(35), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x*(-x + S(2))*(x**S(2) - S(2)*x + S(4))), x), x, (x + S(-1))*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))/S(3) - S(2)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(3) + S(4)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(x*(-x + S(2))*(x**S(2) - S(2)*x + S(4))), x), x, sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x*(-x + S(2))*(x**S(2) - S(2)*x + S(4)))**(S(-3)/2), x), x, (x + S(-1))*((x + S(-1))**S(2) + S(5))/(S(24)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(24) + sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x*(-x + S(2))*(x**S(2) - S(2)*x + S(4)))**(S(-5)/2), x), x, (x + S(-1))*((x + S(-1))**S(2) + S(5))/(S(72)*(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)) + (x + S(-1))*(S(7)*(x + S(-1))**S(2) + S(26))/(S(432)*sqrt(-(x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - S(7)*sqrt(S(3))*elliptic_e(asin(x + S(-1)), S(-1)/3)/S(432) + S(11)*sqrt(S(3))*elliptic_f(asin(x + S(-1)), S(-1)/3)/S(432), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**S(4), x), x, -S(8)*c**S(5)*(S(4)*a*d**S(2) + c**S(3))**S(3)*(c/d + x)**S(3)/(S(3)*d**S(6)) - S(8)*c**S(4)*(S(4)*a*d**S(2) + c**S(3))*(S(12)*a*d**S(2) + S(7)*c**S(3))*(c/d + x)**S(7)/(S(7)*d**S(2)) + c**S(4)*x*(S(4)*a*d**S(2) + c**S(3))**S(4)/d**S(8) - S(8)*c**S(3)*d**S(2)*(S(12)*a*d**S(2) + S(7)*c**S(3))*(c/d + x)**S(11)/S(11) + S(4)*c**S(3)*(S(4)*a*d**S(2) + c**S(3))**S(2)*(S(4)*a*d**S(2) + S(7)*c**S(3))*(c/d + x)**S(5)/(S(5)*d**S(4)) - S(8)*c**S(2)*d**S(6)*(c/d + x)**S(15)/S(15) + S(2)*c**S(2)*(c/d + x)**S(9)*(S(48)*a**S(2)*d**S(4) + S(120)*a*c**S(3)*d**S(2) + S(35)*c**S(6))/S(9) + S(4)*c*d**S(4)*(S(4)*a*d**S(2) + S(7)*c**S(3))*(c/d + x)**S(13)/S(13) + d**S(8)*(c/d + x)**S(17)/S(17), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**S(3), x), x, S(64)*a**S(3)*c**S(3)*x + S(64)*a**S(2)*c**S(4)*x**S(3) + S(48)*a**S(2)*c**S(3)*d*x**S(4) + S(64)*a*c**S(4)*d*x**S(6) + S(48)*a*c**S(2)*x**S(5)*(a*d**S(2) + S(4)*c**S(3))/S(5) + S(16)*c**S(3)*d**S(3)*x**S(10) + S(32)*c**S(3)*x**S(7)*(S(9)*a*d**S(2) + S(2)*c**S(3))/S(7) + S(60)*c**S(2)*d**S(4)*x**S(11)/S(11) + S(12)*c**S(2)*d*x**S(8)*(a*d**S(2) + S(2)*c**S(3)) + c*d**S(5)*x**S(12) + S(4)*c*d**S(2)*x**S(9)*(a*d**S(2) + S(20)*c**S(3))/S(3) + d**S(6)*x**S(13)/S(13), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**S(2), x), x, S(16)*a**S(2)*c**S(2)*x + S(32)*a*c**S(3)*x**S(3)/S(3) + S(8)*a*c**S(2)*d*x**S(4) + S(16)*c**S(3)*d*x**S(6)/S(3) + S(24)*c**S(2)*d**S(2)*x**S(7)/S(7) + c*d**S(3)*x**S(8) + S(8)*c*x**S(5)*(a*d**S(2) + S(2)*c**S(3))/S(5) + d**S(4)*x**S(9)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4), x), x, S(4)*a*c*x + S(4)*c**S(2)*x**S(3)/S(3) + c*d*x**S(4) + d**S(2)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4)), x), x, -atanh(d*(c/d + x)/(c**(S(1)/4)*sqrt(c**(S(3)/2) + S(2)*d*sqrt(-a))))/(S(4)*c**(S(3)/4)*sqrt(-a)*sqrt(c**(S(3)/2) + S(2)*d*sqrt(-a))) + atanh(d*(c/d + x)/(c**(S(1)/4)*sqrt(c**(S(3)/2) - S(2)*d*sqrt(-a))))/(S(4)*c**(S(3)/4)*sqrt(-a)*sqrt(c**(S(3)/2) - S(2)*d*sqrt(-a))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**(S(-2)), x), x, (S(6)*a*d**S(2) + c**(S(3)/2)*d*sqrt(-a) + c**S(3))*atanh(d*(c/d + x)/(c**(S(1)/4)*sqrt(c**(S(3)/2) + S(2)*d*sqrt(-a))))/(S(32)*c**(S(7)/4)*(-a)**(S(3)/2)*sqrt(c**(S(3)/2) + S(2)*d*sqrt(-a))*(S(4)*a*d**S(2) + c**S(3))) - (S(6)*a*d**S(2) - c**(S(3)/2)*d*sqrt(-a) + c**S(3))*atanh(d*(c/d + x)/(c**(S(1)/4)*sqrt(c**(S(3)/2) - S(2)*d*sqrt(-a))))/(S(32)*c**(S(7)/4)*(-a)**(S(3)/2)*sqrt(c**(S(3)/2) - S(2)*d*sqrt(-a))*(S(4)*a*d**S(2) + c**S(3))) - (c/d + x)*(-S(4)*a*d**S(2) + c**S(3) - c*d**S(2)*(c/d + x)**S(2))/(S(16)*a*c*(S(4)*a*d**S(2) + c**S(3))*(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**(S(3)/2), x), x, S(16)*c**(S(13)/4)*sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(3)/4)*(S(8)*a*d**S(2) + c**S(3))*elliptic_e(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(35)*d**S(5)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) + S(8)*c**(S(7)/4)*sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(3)/4)*(-c**(S(3)/2)*(S(8)*a*d**S(2) + c**S(3)) + sqrt(S(4)*a*d**S(2) + c**S(3))*(S(5)*a*d**S(2) + c**S(3)))*elliptic_f(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(35)*d**S(5)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) - S(16)*c**S(3)*(S(8)*a*d**S(2) + c**S(3))*(c/d + x)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/(S(35)*d**S(2)*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(2)*c*(c/d + x)*(S(20)*a*d**S(2) + S(7)*c**S(3) - S(3)*c*d**S(2)*(c/d + x)**S(2))*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/(S(35)*d**S(2)) + (c/(S(7)*d) + x/S(7))*(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4)), x), x, S(2)*c**(S(9)/4)*sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(3)/4)*elliptic_e(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(3)*d**S(3)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) + c**(S(3)/4)*sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4)*(S(4)*a*d**S(2) - c**(S(3)/2)*sqrt(S(4)*a*d**S(2) + c**S(3)) + c**S(3))*elliptic_f(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(3)*d**S(3)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) - S(2)*c**S(2)*(c/d + x)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/(S(3)*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*sqrt(S(4)*a*d**S(2) + c**S(3))) + (c/(S(3)*d) + x/S(3))*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4)), x), x, sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4)*elliptic_f(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(2)*c**(S(1)/4)*d*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*a*c + S(4)*c**S(2)*x**S(2) + S(4)*c*d*x**S(3) + d**S(2)*x**S(4))**(S(-3)/2), x), x, c**(S(1)/4)*sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*elliptic_e(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(8)*a*d*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) - d**S(2)*(c/d + x)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/(S(8)*a*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) + c**S(3))**(S(3)/2)) - (c/d + x)*(-S(4)*a*d**S(2) + c**S(3) - c*d**S(2)*(c/d + x)**S(2))/(S(8)*a*c*(S(4)*a*d**S(2) + c**S(3))*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))) + sqrt((-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))/((S(4)*a + c**S(3)/d**S(2))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))**S(2)))*(sqrt(c) + d**S(2)*(c/d + x)**S(2)/sqrt(S(4)*a*d**S(2) + c**S(3)))*(S(4)*a*d**S(2) - c**(S(3)/2)*sqrt(S(4)*a*d**S(2) + c**S(3)) + c**S(3))*elliptic_f(S(2)*atan(d*(c/d + x)/(c**(S(1)/4)*(S(4)*a*d**S(2) + c**S(3))**(S(1)/4))), c**(S(3)/2)/(S(2)*sqrt(S(4)*a*d**S(2) + c**S(3))) + S(1)/2)/(S(16)*a*c**(S(5)/4)*d*(S(4)*a*d**S(2) + c**S(3))**(S(3)/4)*sqrt(-S(2)*c**S(2)*(c/d + x)**S(2) + c*(S(4)*a + c**S(3)/d**S(2)) + d**S(2)*(c/d + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4))**S(4), x), x, -S(2048)*d**S(2)*e**S(10)*(d/(S(4)*e) + x)**S(15)/S(5) - S(72)*d**S(2)*e**S(6)*(S(256)*a*e**S(3) + S(17)*d**S(4))*(d/(S(4)*e) + x)**S(11)/S(11) - S(9)*d**S(2)*e**S(2)*(d/(S(4)*e) + x)**S(7)*(S(65536)*a**S(2)*e**S(6) + S(5632)*a*d**S(4)*e**S(3) + S(85)*d**S(8))/S(224) - d**S(2)*(S(256)*a*e**S(3) + S(5)*d**S(4))**S(3)*(d/(S(4)*e) + x)**S(3)/(S(8192)*e**S(2)) + S(4096)*e**S(12)*(d/(S(4)*e) + x)**S(17)/S(17) + S(64)*e**S(8)*(S(256)*a*e**S(3) + S(59)*d**S(4))*(d/(S(4)*e) + x)**S(13)/S(13) + e**S(4)*(d/(S(4)*e) + x)**S(9)*(S(65536)*a**S(2)*e**S(6) + S(20992)*a*d**S(4)*e**S(3) + S(601)*d**S(8))/S(24) + (S(256)*a*e**S(3) + S(5)*d**S(4))**S(2)*(S(256)*a*e**S(3) + S(59)*d**S(4))*(d/(S(4)*e) + x)**S(5)/S(5120) + x*(S(256)*a*e**S(3) + S(5)*d**S(4))**S(4)/(S(1048576)*e**S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4))**S(3), x), x, S(512)*a**S(3)*e**S(6)*x - S(96)*a**S(2)*d**S(3)*e**S(4)*x**S(2) + S(8)*a*d**S(6)*e**S(2)*x**S(3) - S(384)*a*e**S(4)*x**S(5)*(-S(4)*a*e**S(3) + d**S(4))/S(5) + S(32)*d**S(3)*e**S(6)*x**S(10) + S(4)*d**S(3)*e**S(2)*x**S(6)*(-S(16)*a*e**S(3) + d**S(4)) + S(1536)*d**S(2)*e**S(7)*x**S(11)/S(11) + S(24)*d**S(2)*e**S(3)*x**S(7)*(S(64)*a*e**S(3) + d**S(4))/S(7) + S(128)*d*e**S(8)*x**S(12) - S(24)*d*e**S(4)*x**S(8)*(-S(16)*a*e**S(3) + d**S(4)) - d*x**S(4)*(-S(1536)*a**S(2)*e**S(6) + d**S(8))/S(4) + S(512)*e**S(9)*x**S(13)/S(13) - S(128)*e**S(5)*x**S(9)*(-S(4)*a*e**S(3) + d**S(4))/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4))**S(2), x), x, S(64)*a**S(2)*e**S(4)*x - S(8)*a*d**S(3)*e**S(2)*x**S(2) + S(32)*a*d*e**S(4)*x**S(4) + d**S(6)*x**S(3)/S(3) - S(8)*d**S(3)*e**S(3)*x**S(6)/S(3) + S(64)*d**S(2)*e**S(4)*x**S(7)/S(7) + S(16)*d*e**S(5)*x**S(8) + S(64)*e**S(6)*x**S(9)/S(9) - S(16)*e**S(2)*x**S(5)*(-S(8)*a*e**S(3) + d**S(4))/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4), x), x, S(8)*a*e**S(2)*x - d**S(3)*x**S(2)/S(2) + S(2)*d*e**S(2)*x**S(4) + S(8)*e**S(3)*x**S(5)/S(5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4)), x), x, -S(2)*atanh(S(4)*e*(d/(S(4)*e) + x)/sqrt(S(3)*d**S(2) + S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4))))/(sqrt(S(3)*d**S(2) + S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*sqrt(-S(64)*a*e**S(3) + d**S(4))) + S(2)*atanh(S(4)*e*(d/(S(4)*e) + x)/sqrt(S(3)*d**S(2) - S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4))))/(sqrt(S(3)*d**S(2) - S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*sqrt(-S(64)*a*e**S(3) + d**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4))**(S(-2)), x), x, S(64)*e*(d/(S(4)*e) + x)*(-S(256)*a*e**S(3) + S(13)*d**S(4) - S(48)*d**S(2)*e**S(2)*(d/(S(4)*e) + x)**S(2))/((-S(16384)*a**S(2)*e**S(6) - S(64)*a*d**S(4)*e**S(3) + S(5)*d**S(8))*(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))) + S(24)*e*(S(128)*a*e**S(3) + d**S(4) + d**S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*atanh(S(4)*e*(d/(S(4)*e) + x)/sqrt(S(3)*d**S(2) + S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4))))/(sqrt(S(3)*d**S(2) + S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*(-S(64)*a*e**S(3) + d**S(4))**(S(3)/2)*(S(256)*a*e**S(3) + S(5)*d**S(4))) - S(24)*e*(S(128)*a*e**S(3) + d**S(4) - d**S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*atanh(S(4)*e*(d/(S(4)*e) + x)/sqrt(S(3)*d**S(2) - S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4))))/(sqrt(S(3)*d**S(2) - S(2)*sqrt(-S(64)*a*e**S(3) + d**S(4)))*(-S(64)*a*e**S(3) + d**S(4))**(S(3)/2)*(S(256)*a*e**S(3) + S(5)*d**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4)), x), x, -sqrt(S(2))*d**S(2)*(d/(S(4)*e) + x)*sqrt(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))/(S(4)*sqrt(S(256)*a*e**S(3) + S(5)*d**S(4))*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))) + sqrt(S(2))*d**S(2)*sqrt((S(256)*a*e**S(3) + S(5)*d**S(4) - S(96)*d**S(2)*e**S(2)*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(4)*(d/(S(4)*e) + x)**S(4))/((S(256)*a*e**S(3) + S(5)*d**S(4))*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))**S(2)))*(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(3)/4)*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))*elliptic_e(S(2)*atan(S(4)*e*(d/(S(4)*e) + x)/(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(1)/4)), S(3)*d**S(2)/(S(2)*sqrt(S(256)*a*e**S(3) + S(5)*d**S(4))) + S(1)/2)/(S(16)*e**S(2)*sqrt(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))) + sqrt(S(2))*(d/(S(4)*e) + x)*sqrt(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))/S(24) + sqrt(S(2))*sqrt((S(256)*a*e**S(3) + S(5)*d**S(4) - S(96)*d**S(2)*e**S(2)*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(4)*(d/(S(4)*e) + x)**S(4))/((S(256)*a*e**S(3) + S(5)*d**S(4))*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))**S(2)))*(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(1)/4)*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))*(S(256)*a*e**S(3) + S(5)*d**S(4) - S(3)*d**S(2)*sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)))*elliptic_f(S(2)*atan(S(4)*e*(d/(S(4)*e) + x)/(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(1)/4)), S(3)*d**S(2)/(S(2)*sqrt(S(256)*a*e**S(3) + S(5)*d**S(4))) + S(1)/2)/(S(96)*e**S(2)*sqrt(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(8)*a*e**S(2) - d**S(3)*x + S(8)*d*e**S(2)*x**S(3) + S(8)*e**S(3)*x**S(4)), x), x, sqrt(S(2))*sqrt((S(256)*a*e**S(3) + S(5)*d**S(4) - S(96)*d**S(2)*e**S(2)*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(4)*(d/(S(4)*e) + x)**S(4))/((S(256)*a*e**S(3) + S(5)*d**S(4))*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))**S(2)))*(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(1)/4)*(S(16)*e**S(2)*(d/(S(4)*e) + x)**S(2)/sqrt(S(256)*a*e**S(3) + S(5)*d**S(4)) + S(1))*elliptic_f(S(2)*atan(S(4)*e*(d/(S(4)*e) + x)/(S(256)*a*e**S(3) + S(5)*d**S(4))**(S(1)/4)), S(3)*d**S(2)/(S(2)*sqrt(S(256)*a*e**S(3) + S(5)*d**S(4))) + S(1)/2)/(S(2)*e*sqrt(S(256)*a*e**S(2) + S(5)*d**S(4)/e - S(96)*d**S(2)*e*(d/(S(4)*e) + x)**S(2) + S(256)*e**S(3)*(d/(S(4)*e) + x)**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(4), x), x, x*(a + S(3))**S(4) + (-S(4)*a/S(5) + S(12)/5)*(a + S(3))**S(2)*(x + S(-1))**S(5) + (-S(4)*a/S(13) + S(12)/13)*(x + S(-1))**S(13) - S(8)*(a + S(3))**S(3)*(x + S(-1))**S(3)/S(3) + (S(8)*a/S(7) + S(24)/7)*(S(3)*a + S(5))*(x + S(-1))**S(7) - (S(24)*a/S(11) + S(40)/11)*(x + S(-1))**S(11) + (x + S(-1))**S(17)/S(17) + S(8)*(x + S(-1))**S(15)/S(15) - (x + S(-1))**S(9)*(-S(2)*a**S(2)/S(3) + S(4)*a/S(3) + S(74)/9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(3), x), x, a**S(3)*x + S(12)*a**S(2)*x**S(2) + a*x**S(3)*(-S(8)*a + S(64)) - x**S(13)/S(13) + x**S(12) - S(72)*x**S(11)/S(11) + S(28)*x**S(10) - x**S(9)*(-a/S(3) + S(256)/3) + x**S(8)*(-S(3)*a + S(192)) - x**S(7)*(-S(96)*a/S(7) + S(320)) + x**S(6)*(-S(40)*a + S(384)) - x**S(5)*(S(3)*a**S(2)/S(5) - S(384)*a/S(5) + S(1536)/5) + x**S(4)*(S(3)*a**S(2) - S(96)*a + S(128)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(2), x), x, a**S(2)*x + S(8)*a*x**S(2) + x**S(9)/S(9) - x**S(8) + S(32)*x**S(7)/S(7) - S(40)*x**S(6)/S(3) + x**S(5)*(-S(2)*a/S(5) + S(128)/5) - x**S(4)*(-S(2)*a + S(32)) + x**S(3)*(-S(16)*a/S(3) + S(64)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x, x), x, a*x - x**S(5)/S(5) + x**S(4) - S(8)*x**S(3)/S(3) + S(4)*x**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(a + S(4))*sqrt(sqrt(a + S(4)) + S(1))) - atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(a + S(4))*sqrt(-sqrt(a + S(4)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(-2)), x), x, (x + S(-1))*(a + (x + S(-1))**S(2) + S(5))/((S(4)*a**S(2) + S(28)*a + S(48))*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (S(3)*a - sqrt(a + S(4)) + S(10))*atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/((a + S(4))**(S(3)/2)*(S(8)*a + S(24))*sqrt(sqrt(a + S(4)) + S(1))) - (S(3)*a + sqrt(a + S(4)) + S(10))*atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/((a + S(4))**(S(3)/2)*(S(8)*a + S(24))*sqrt(-sqrt(a + S(4)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(4), x), x, a**S(4)*x**S(2)/S(2) + S(32)*a**S(3)*x**S(3)/S(3) + a**S(2)*x**S(4)*(-S(8)*a + S(96)) + S(16)*a*x**S(5)*(a**S(2) - S(48)*a + S(128))/S(5) + x**S(18)/S(18) - S(16)*x**S(17)/S(17) + S(8)*x**S(16) - S(224)*x**S(15)/S(5) + x**S(14)*(-S(2)*a/S(7) + S(1280)/7) - x**S(13)*(-S(48)*a/S(13) + S(7424)/13) + x**S(12)*(-S(24)*a + S(4192)/3) - x**S(11)*(-S(1120)*a/S(11) + S(29696)/11) + x**S(10)*(S(3)*a**S(2)/S(5) - S(1536)*a/S(5) + S(4096)) - x**S(9)*(S(16)*a**S(2)/S(3) - S(2048)*a/S(3) + S(14336)/3) + x**S(8)*(-S(24)*a + S(1024))*(-a + S(4)) - x**S(7)*(S(480)*a**S(2)/S(7) - S(9216)*a/S(7) + S(16384)/7) + x**S(6)*(-S(2)*a**S(3)/S(3) + S(128)*a**S(2) - S(1024)*a + S(2048)/3), expand=True, _diff=True, _numerical=True) # long time in rubi_int assert rubi_test(rubi_integrate(x*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(3), x), x, a**S(3)*x**S(2)/S(2) + S(8)*a**S(2)*x**S(3) + a*x**S(4)*(-S(6)*a + S(48)) - x**S(14)/S(14) + S(12)*x**S(13)/S(13) - S(6)*x**S(12) + S(280)*x**S(11)/S(11) - x**S(10)*(-S(3)*a/S(10) + S(384)/5) + x**S(9)*(-S(8)*a/S(3) + S(512)/3) - x**S(8)*(-S(12)*a + S(280)) + x**S(7)*(-S(240)*a/S(7) + S(2304)/7) - x**S(6)*(a**S(2)/S(2) - S(64)*a + S(256)) + x**S(5)*(S(12)*a**S(2)/S(5) - S(384)*a/S(5) + S(512)/5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(2), x), x, a**S(2)*x**S(2)/S(2) + S(16)*a*x**S(3)/S(3) + x**S(10)/S(10) - S(8)*x**S(9)/S(9) + S(4)*x**S(8) - S(80)*x**S(7)/S(7) + x**S(6)*(-a/S(3) + S(64)/3) - x**S(5)*(-S(8)*a/S(5) + S(128)/5) + x**S(4)*(-S(4)*a + S(16)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, a*x**S(2)/S(2) - x**S(6)/S(6) + S(4)*x**S(5)/S(5) - S(2)*x**S(4) + S(8)*x**S(3)/S(3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, atanh(((x + S(-1))**S(2) + S(1))/sqrt(a + S(4)))/(S(2)*sqrt(a + S(4))) + atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(a + S(4))*sqrt(sqrt(a + S(4)) + S(1))) - atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(a + S(4))*sqrt(-sqrt(a + S(4)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(2), x), x, (x + S(-1))*(a + (a + S(5))*(x + S(-1)) + (x + S(-1))**S(3) + (x + S(-1))**S(2) + S(5))/((S(4)*a**S(2) + S(28)*a + S(48))*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + atanh(((x + S(-1))**S(2) + S(1))/sqrt(a + S(4)))/(S(4)*(a + S(4))**(S(3)/2)) + (S(3)*a - sqrt(a + S(4)) + S(10))*atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/((a + S(4))**(S(3)/2)*(S(8)*a + S(24))*sqrt(sqrt(a + S(4)) + S(1))) - (S(3)*a + sqrt(a + S(4)) + S(10))*atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/((a + S(4))**(S(3)/2)*(S(8)*a + S(24))*sqrt(-sqrt(a + S(4)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(4), x), x, a**S(4)*x**S(3)/S(3) + S(8)*a**S(3)*x**S(4) + a**S(2)*x**S(5)*(-S(32)*a/S(5) + S(384)/5) + S(8)*a*x**S(6)*(a**S(2) - S(48)*a + S(128))/S(3) + x**S(19)/S(19) - S(8)*x**S(18)/S(9) + S(128)*x**S(17)/S(17) - S(42)*x**S(16) + x**S(15)*(-S(4)*a/S(15) + S(512)/3) - x**S(14)*(-S(24)*a/S(7) + S(3712)/7) + x**S(13)*(-S(288)*a/S(13) + S(16768)/13) - x**S(12)*(-S(280)*a/S(3) + S(7424)/3) + x**S(11)*(S(6)*a**S(2)/S(11) - S(3072)*a/S(11) + S(40960)/11) - x**S(10)*(S(24)*a**S(2)/S(5) - S(3072)*a/S(5) + S(21504)/5) + x**S(9)*(-S(64)*a/S(3) + S(8192)/9)*(-a + S(4)) - x**S(8)*(S(60)*a**S(2) - S(1152)*a + S(2048)) + x**S(7)*(-S(4)*a**S(3)/S(7) + S(768)*a**S(2)/S(7) - S(6144)*a/S(7) + S(4096)/7), expand=True, _diff=True, _numerical=True) # long time in rubi_int assert rubi_test(rubi_integrate(x**S(2)*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(3), x), x, a**S(3)*x**S(3)/S(3) + S(6)*a**S(2)*x**S(4) + a*x**S(5)*(-S(24)*a/S(5) + S(192)/5) - x**S(15)/S(15) + S(6)*x**S(14)/S(7) - S(72)*x**S(13)/S(13) + S(70)*x**S(12)/S(3) - x**S(11)*(-S(3)*a/S(11) + S(768)/11) + x**S(10)*(-S(12)*a/S(5) + S(768)/5) - x**S(9)*(-S(32)*a/S(3) + S(2240)/9) + x**S(8)*(-S(30)*a + S(288)) - x**S(7)*(S(3)*a**S(2)/S(7) - S(384)*a/S(7) + S(1536)/7) + x**S(6)*(S(2)*a**S(2) - S(64)*a + S(256)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(2), x), x, a**S(2)*x**S(3)/S(3) + S(4)*a*x**S(4) + x**S(11)/S(11) - S(4)*x**S(10)/S(5) + S(32)*x**S(9)/S(9) - S(10)*x**S(8) + x**S(7)*(-S(2)*a/S(7) + S(128)/7) - x**S(6)*(-S(4)*a/S(3) + S(64)/3) + x**S(5)*(-S(16)*a/S(5) + S(64)/5), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, a*x**S(3)/S(3) - x**S(7)/S(7) + S(2)*x**S(6)/S(3) - S(8)*x**S(5)/S(5) + S(2)*x**S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, -atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(sqrt(a + S(4)) + S(1))) - atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/(S(2)*sqrt(-sqrt(a + S(4)) + S(1))) + atanh(((x + S(-1))**S(2) + S(1))/sqrt(a + S(4)))/sqrt(a + S(4)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**S(2), x), x, (x + S(-1))*(S(2)*a + (a + S(4))*(x + S(-1))**S(2) + (S(2)*a + S(10))*(x + S(-1)) + S(2)*(x + S(-1))**S(3) + S(8))/((S(4)*a**S(2) + S(28)*a + S(48))*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (-sqrt(a + S(4)) + S(1))*atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1)))/(sqrt(a + S(4))*(S(8)*a + S(24))*sqrt(sqrt(a + S(4)) + S(1))) - (sqrt(a + S(4)) + S(1))*atan((x + S(-1))/sqrt(-sqrt(a + S(4)) + S(1)))/(sqrt(a + S(4))*(S(8)*a + S(24))*sqrt(-sqrt(a + S(4)) + S(1))) + atanh(((x + S(-1))**S(2) + S(1))/sqrt(a + S(4)))/(S(2)*(a + S(4))**(S(3)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(3)/2), x), x, -(S(32)*a + S(112))*(x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))/(S(35)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*(S(2)*a/S(7) - S(6)*(x + S(-1))**S(2)/S(35) + S(26)/35)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + (x + S(-1))*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)/S(7) + (S(4)*a + S(12))*(S(5)*a + S(16))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(35)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (S(32)*a + S(112))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(35)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, -(x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-S(2)*sqrt(a + S(4)) + S(2))/(S(3)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))/S(3) + (S(2)*a + S(6))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(3)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-S(2)*sqrt(a + S(4)) + S(2))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(3)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(3)/2), x), x, (S(3)*a/S(16) + S(3)/4)*((x + S(-1))**S(2) + S(1))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + S(3)*(a + S(4))**S(2)*atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)))/S(16) - (S(32)*a + S(112))*(x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))/(S(35)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*(S(2)*a/S(7) - S(6)*(x + S(-1))**S(2)/S(35) + S(26)/35)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + (x + S(-1))*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2)/S(7) + ((x + S(-1))**S(2)/S(8) + S(1)/8)*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2) + (S(4)*a + S(12))*(S(5)*a + S(16))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(35)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (S(32)*a + S(112))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(35)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, (a/S(4) + S(1))*atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - (x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-S(2)*sqrt(a + S(4)) + S(2))/(S(3)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))/S(3) + ((x + S(-1))**S(2)/S(4) + S(1)/4)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + (S(2)*a + S(6))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(3)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-S(2)*sqrt(a + S(4)) + S(2))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(3)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x/sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)))/S(2) + ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(3)/2), x), x, (S(3)*a/S(8) + S(3)/2)*((x + S(-1))**S(2) + S(1))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + S(3)*(a + S(4))**S(2)*atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)))/S(8) + (x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*(S(84)*a**S(2) + S(444)*a + S(560))/(S(315)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*((x + S(-1))**S(2)/S(9) + S(5)/21)*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2) + (x + S(-1))*(S(12)*a/S(35) + S(2)*(S(21)*a + S(60))*(x + S(-1))**S(2)/S(315) + S(64)/63)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + ((x + S(-1))**S(2)/S(4) + S(1)/4)*(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))**(S(3)/2) + (S(4)*a + S(12))*(S(33)*a + S(100))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(315)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*(S(84)*a**S(2) + S(444)*a + S(560))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(315)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, (a/S(2) + S(2))*atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (S(6)*a + S(16))*(x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))/(S(15)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (x + S(-1))*((x + S(-1))**S(2)/S(5) + S(7)/15)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + ((x + S(-1))**S(2)/S(2) + S(1)/2)*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) - (S(6)*a + S(16))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(15)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + (S(8)*a + S(24))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(S(15)*sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/sqrt(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x), x), x, (x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3)) + atan(((x + S(-1))**S(2) + S(1))/sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) - ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_f(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)/(a - x**S(4) + S(4)*x**S(3) - S(8)*x**S(2) + S(8)*x)**(S(3)/2), x), x, (x + S(-1))*(S(2)*a + (a + S(4))*(x + S(-1))**S(2) + (S(2)*a + S(10))*(x + S(-1)) + S(2)*(x + S(-1))**S(3) + S(8))/((S(2)*a**S(2) + S(14)*a + S(24))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))/(a**S(2) + S(7)*a + S(12)) - (x + S(-1))*((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))/((S(2)*a + S(6))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))) + ((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))*(-sqrt(a + S(4)) + S(1))*sqrt(sqrt(a + S(4)) + S(1))*elliptic_e(atan((x + S(-1))/sqrt(sqrt(a + S(4)) + S(1))), -S(2)*sqrt(a + S(4))/(-sqrt(a + S(4)) + S(1)))/(sqrt(((x + S(-1))**S(2)/(-sqrt(a + S(4)) + S(1)) + S(1))/((x + S(-1))**S(2)/(sqrt(a + S(4)) + S(1)) + S(1)))*(S(2)*a + S(6))*sqrt(a - (x + S(-1))**S(4) - S(2)*(x + S(-1))**S(2) + S(3))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - x**S(3) + S(8)*x + S(8))**S(4), x), x, S(4096)*x**S(17)/S(17) - S(128)*x**S(16) + S(128)*x**S(15)/S(5) + S(1168)*x**S(14) + S(10241)*x**S(13)/S(13) - S(448)*x**S(12) + S(25312)*x**S(11)/S(11) + S(21488)*x**S(10)/S(5) + S(1408)*x**S(9) + S(1376)*x**S(8) + S(6784)*x**S(7) + S(7168)*x**S(6) + S(14336)*x**S(5)/S(5) + S(3584)*x**S(4) + S(8192)*x**S(3) + S(8192)*x**S(2) + S(4096)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - x**S(3) + S(8)*x + S(8))**S(3), x), x, S(512)*x**S(13)/S(13) - S(16)*x**S(12) + S(24)*x**S(11)/S(11) + S(307)*x**S(10)/S(2) + S(128)*x**S(9) - S(45)*x**S(8) + S(1560)*x**S(7)/S(7) + S(480)*x**S(6) + S(1152)*x**S(5)/S(5) + S(80)*x**S(4) + S(512)*x**S(3) + S(768)*x**S(2) + S(512)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - x**S(3) + S(8)*x + S(8))**S(2), x), x, S(64)*x**S(9)/S(9) - S(2)*x**S(8) + x**S(7)/S(7) + S(64)*x**S(6)/S(3) + S(112)*x**S(5)/S(5) - S(4)*x**S(4) + S(64)*x**S(3)/S(3) + S(64)*x**S(2) + S(64)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(8)*x**S(4) - x**S(3) + S(8)*x + S(8), x), x, S(8)*x**S(5)/S(5) - x**S(4)/S(4) + S(4)*x**S(2) + S(8)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(8)*x**S(4) - x**S(3) + S(8)*x + S(8)), x), x, -sqrt(S(-109)/1218 + S(67)*sqrt(S(29))/S(1218))*log((S(1) + S(4)/x)**S(2) - (S(1) + S(4)/x)*sqrt(S(6) + S(6)*sqrt(S(29))) + S(3)*sqrt(S(29)))/S(24) + sqrt(S(-109)/1218 + S(67)*sqrt(S(29))/S(1218))*log((S(1) + S(4)/x)**S(2) + (S(1) + S(4)/x)*sqrt(S(6) + S(6)*sqrt(S(29))) + S(3)*sqrt(S(29)))/S(24) - sqrt(S(7))*atan(sqrt(S(7))*(-(S(1) + S(4)/x)**S(2) + S(3))/S(42))/S(84) + sqrt(S(109)/1218 + S(67)*sqrt(S(29))/S(1218))*atan((S(-2) + sqrt(S(6) + S(6)*sqrt(S(29))) - S(8)/x)/sqrt(S(-6) + S(6)*sqrt(S(29))))/S(12) - sqrt(S(109)/1218 + S(67)*sqrt(S(29))/S(1218))*atan((S(2) + sqrt(S(6) + S(6)*sqrt(S(29))) + S(8)/x)/sqrt(S(-6) + S(6)*sqrt(S(29))))/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - x**S(3) + S(8)*x + S(8))**(S(-2)), x), x, (S(1) + S(4)/x)*(S(207)*(S(1) + S(4)/x)**S(3) + S(995)*(S(1) + S(4)/x)**S(2) + S(16974) - S(35244)/x)/(S(87696)*(S(1) + S(4)/x)**S(4) - S(526176)*(S(1) + S(4)/x)**S(2) + S(22888656)) - sqrt(S(-180983329)/1218 + S(1583563)*sqrt(S(29))/S(42))*log((S(1) + S(4)/x)**S(2) - (S(1) + S(4)/x)*sqrt(S(6) + S(6)*sqrt(S(29))) + S(3)*sqrt(S(29)))/S(175392) + sqrt(S(-180983329)/1218 + S(1583563)*sqrt(S(29))/S(42))*log((S(1) + S(4)/x)**S(2) + (S(1) + S(4)/x)*sqrt(S(6) + S(6)*sqrt(S(29))) + S(3)*sqrt(S(29)))/S(175392) - S(17)*sqrt(S(7))*atan(sqrt(S(7))*(-(S(1) + S(4)/x)**S(2) + S(3))/S(42))/S(7056) + sqrt(S(180983329)/1218 + S(1583563)*sqrt(S(29))/S(42))*atan((S(-2) + sqrt(S(6) + S(6)*sqrt(S(29))) - S(8)/x)/sqrt(S(-6) + S(6)*sqrt(S(29))))/S(87696) - sqrt(S(180983329)/1218 + S(1583563)*sqrt(S(29))/S(42))*atan((S(2) + sqrt(S(6) + S(6)*sqrt(S(29))) + S(8)/x)/sqrt(S(-6) + S(6)*sqrt(S(29))))/S(87696), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1))**S(4), x), x, S(256)*x**S(17)/S(17) + S(1024)*x**S(15)/S(15) + S(512)*x**S(14)/S(7) + S(1792)*x**S(13)/S(13) + S(256)*x**S(12) + S(3328)*x**S(11)/S(11) + S(384)*x**S(10) + S(4192)*x**S(9)/S(9) + S(448)*x**S(8) + S(2752)*x**S(7)/S(7) + S(992)*x**S(6)/S(3) + S(1136)*x**S(5)/S(5) + S(112)*x**S(4) + S(112)*x**S(3)/S(3) + S(8)*x**S(2) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1))**S(3), x), x, S(64)*x**S(13)/S(13) + S(192)*x**S(11)/S(11) + S(96)*x**S(10)/S(5) + S(80)*x**S(9)/S(3) + S(48)*x**S(8) + S(352)*x**S(7)/S(7) + S(48)*x**S(6) + S(252)*x**S(5)/S(5) + S(40)*x**S(4) + S(20)*x**S(3) + S(6)*x**S(2) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1))**S(2), x), x, S(16)*x**S(9)/S(9) + S(32)*x**S(7)/S(7) + S(16)*x**S(6)/S(3) + S(24)*x**S(5)/S(5) + S(8)*x**S(4) + S(8)*x**S(3) + S(4)*x**S(2) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1), x), x, S(4)*x**S(5)/S(5) + S(4)*x**S(3)/S(3) + S(2)*x**S(2) + x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1)), x), x, -sqrt(S(-2)/5 + sqrt(S(5))/S(5))*log((S(1) + S(1)/x)**S(2) - (S(1) + S(1)/x)*sqrt(S(2) + S(2)*sqrt(S(5))) + sqrt(S(5)))/S(4) + sqrt(S(-2)/5 + sqrt(S(5))/S(5))*log((S(1) + S(1)/x)**S(2) + (S(1) + S(1)/x)*sqrt(S(2) + S(2)*sqrt(S(5))) + sqrt(S(5)))/S(4) + sqrt(S(2)/5 + sqrt(S(5))/S(5))*atan((S(-2) + sqrt(S(2) + S(2)*sqrt(S(5))) - S(2)/x)/sqrt(S(-2) + S(2)*sqrt(S(5))))/S(2) - sqrt(S(2)/5 + sqrt(S(5))/S(5))*atan((S(2) + sqrt(S(2) + S(2)*sqrt(S(5))) + S(2)/x)/sqrt(S(-2) + S(2)*sqrt(S(5))))/S(2) + atan((S(1) + S(1)/x)**S(2)/S(2) + S(-1)/2)/S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1))**(S(-2)), x), x, (S(1) + S(1)/x)*(S(17)*(S(1) + S(1)/x)**S(3) - S(17)*(S(1) + S(1)/x)**S(2) + S(30) - S(29)/x)/(S(10)*(S(1) + S(1)/x)**S(4) - S(20)*(S(1) + S(1)/x)**S(2) + S(50)) + sqrt(S(-5959)/10 + S(533)*sqrt(S(5))/S(2))*log((S(1) + S(1)/x)**S(2) - (S(1) + S(1)/x)*sqrt(S(2) + S(2)*sqrt(S(5))) + sqrt(S(5)))/S(40) - sqrt(S(-5959)/10 + S(533)*sqrt(S(5))/S(2))*log((S(1) + S(1)/x)**S(2) + (S(1) + S(1)/x)*sqrt(S(2) + S(2)*sqrt(S(5))) + sqrt(S(5)))/S(40) + sqrt(S(5959)/10 + S(533)*sqrt(S(5))/S(2))*atan((S(-2) + sqrt(S(2) + S(2)*sqrt(S(5))) - S(2)/x)/sqrt(S(-2) + S(2)*sqrt(S(5))))/S(20) - sqrt(S(5959)/10 + S(533)*sqrt(S(5))/S(2))*atan((S(2) + sqrt(S(2) + S(2)*sqrt(S(5))) + S(2)/x)/sqrt(S(-2) + S(2)*sqrt(S(5))))/S(20) + S(7)*atan((S(1) + S(1)/x)**S(2)/S(2) + S(-1)/2)/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**S(4), x), x, S(4096)*x**S(17)/S(17) - S(1920)*x**S(16) + S(102784)*x**S(15)/S(15) - S(75504)*x**S(14)/S(7) - S(12095)*x**S(13)/S(13) + S(31128)*x**S(12) - S(331040)*x**S(11)/S(11) - S(169584)*x**S(10)/S(5) + S(641152)*x**S(9)/S(9) + S(36384)*x**S(8) - S(566912)*x**S(7)/S(7) - S(30720)*x**S(6) + S(538624)*x**S(5)/S(5) + S(139776)*x**S(4) + S(237568)*x**S(3)/S(3) + S(24576)*x**S(2) + S(4096)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**S(3), x), x, S(512)*x**S(13)/S(13) - S(240)*x**S(12) + S(6936)*x**S(11)/S(11) - S(4527)*x**S(10)/S(10) - S(2936)*x**S(9)/S(3) + S(2097)*x**S(8) + S(5528)*x**S(7)/S(7) - S(2976)*x**S(6) - S(384)*x**S(5)/S(5) + S(5040)*x**S(4) + S(5120)*x**S(3) + S(2304)*x**S(2) + S(512)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**S(2), x), x, S(64)*x**S(9)/S(9) - S(30)*x**S(8) + S(353)*x**S(7)/S(7) + S(24)*x**S(6) - S(528)*x**S(5)/S(5) + S(36)*x**S(4) + S(704)*x**S(3)/S(3) + S(192)*x**S(2) + S(64)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8), x), x, S(8)*x**S(5)/S(5) - S(15)*x**S(4)/S(4) + S(8)*x**S(3)/S(3) + S(12)*x**S(2) + S(8)*x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8)), x), x, -sqrt(S(-5167)/40326 + S(5)*sqrt(S(517))/S(858))*log((S(3) + S(4)/x)**S(2) - (S(3) + S(4)/x)*sqrt(S(38) + S(2)*sqrt(S(517))) + sqrt(S(517)))/S(8) + sqrt(S(-5167)/40326 + S(5)*sqrt(S(517))/S(858))*log((S(3) + S(4)/x)**S(2) + (S(3) + S(4)/x)*sqrt(S(38) + S(2)*sqrt(S(517))) + sqrt(S(517)))/S(8) - sqrt(S(39))*atan(sqrt(S(39))*(-(S(3) + S(4)/x)**S(2) + S(19))/S(78))/S(52) + sqrt(S(5167)/40326 + S(5)*sqrt(S(517))/S(858))*atan((S(-6) + sqrt(S(38) + S(2)*sqrt(S(517))) - S(8)/x)/sqrt(S(-38) + S(2)*sqrt(S(517))))/S(4) - sqrt(S(5167)/40326 + S(5)*sqrt(S(517))/S(858))*atan((S(6) + sqrt(S(38) + S(2)*sqrt(S(517))) + S(8)/x)/sqrt(S(-38) + S(2)*sqrt(S(517))))/S(4), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**(S(-2)), x), x, (S(3) + S(4)/x)*(S(30231)*(S(3) + S(4)/x)**S(3) - S(129631)*(S(3) + S(4)/x)**S(2) + S(1375210) - S(2603628)/x)/(S(322608)*(S(3) + S(4)/x)**S(4) - S(12259104)*(S(3) + S(4)/x)**S(2) + S(166788336)) - sqrt(S(-59644114671451)/40326 + S(5073830635)*sqrt(S(517))/S(78))*log((S(3) + S(4)/x)**S(2) - (S(3) + S(4)/x)*sqrt(S(38) + S(2)*sqrt(S(517))) + sqrt(S(517)))/S(645216) + sqrt(S(-59644114671451)/40326 + S(5073830635)*sqrt(S(517))/S(78))*log((S(3) + S(4)/x)**S(2) + (S(3) + S(4)/x)*sqrt(S(38) + S(2)*sqrt(S(517))) + sqrt(S(517)))/S(645216) - S(73)*sqrt(S(39))*atan(sqrt(S(39))*(-(S(3) + S(4)/x)**S(2) + S(19))/S(78))/S(2704) + sqrt(S(19)/40326 + sqrt(S(517))/S(40326))*(S(1678181) + S(74897)*sqrt(S(517)))*atan((S(-6) + sqrt(S(38) + S(2)*sqrt(S(517))) - S(8)/x)/sqrt(S(-38) + S(2)*sqrt(S(517))))/S(645216) - sqrt(S(19)/40326 + sqrt(S(517))/S(40326))*(S(1678181) + S(74897)*sqrt(S(517)))*atan((S(6) + sqrt(S(38) + S(2)*sqrt(S(517))) + S(8)/x)/sqrt(S(-38) + S(2)*sqrt(S(517))))/S(645216), expand=True, _diff=True, _numerical=True) '''Takes a long time in rubi test, final results contain subs with Integral assert rubi_test(rubi_integrate(S(1)/sqrt(S(8)*x**S(4) - x**S(3) + S(8)*x + S(8)), x), x, -S(29)**(S(3)/4)*sqrt(S(6))*x**S(2)*sqrt(((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261))/(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))**S(2))*(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))*elliptic_f(S(2)*atan(S(29)**(S(3)/4)*sqrt(S(3))*(S(1) + S(4)/x)/S(87)), sqrt(S(29))/S(58) + S(1)/2)/(S(174)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - x**S(3) + S(8)*x + S(8))**(S(-3)/2), x), x, S(29)**(S(1)/4)*sqrt(S(6))*x**S(2)*sqrt(((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261))/(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))**S(2))*(-S(5)*sqrt(S(29)) + S(14))*(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))*elliptic_f(S(2)*atan(S(29)**(S(3)/4)*sqrt(S(3))*(S(1) + S(4)/x)/S(87)), sqrt(S(29))/S(58) + S(1)/2)/(S(12528)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))) - S(29)**(S(1)/4)*sqrt(S(6))*x**S(2)*sqrt(((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261))/(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))**S(2))*(S(7)*sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(609))*elliptic_e(S(2)*atan(S(29)**(S(3)/4)*sqrt(S(3))*(S(1) + S(4)/x)/S(87)), sqrt(S(29))/S(58) + S(1)/2)/(S(3132)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))) + sqrt(S(2))*x**S(2)*(S(1) + S(4)/x)*(S(22)*(S(1) + S(4)/x)**S(3) - S(49)*(S(1) + S(4)/x)**S(2) + S(1467) - S(180)/x)/(S(21924)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))) + sqrt(S(58))*x**S(2)*(S(1) + S(4)/x)*(S(7)*(S(1) + S(4)/x)**S(4) - S(42)*(S(1) + S(4)/x)**S(2) + S(1827))/(S(3132)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))*(sqrt(S(29))*(S(1) + S(4)/x)**S(2) + S(87))) - sqrt(S(2))*x**S(2)*(S(11)*(S(1) + S(4)/x)**S(4) - S(66)*(S(1) + S(4)/x)**S(2) + S(2871))/(S(10962)*sqrt(x**S(4)*((S(1) + S(4)/x)**S(4) - S(6)*(S(1) + S(4)/x)**S(2) + S(261)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1)), x), x, -S(5)**(S(3)/4)*x**S(2)*sqrt(((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5))/((S(1) + S(1)/x)**S(2) + sqrt(S(5)))**S(2))*((S(1) + S(1)/x)**S(2) + sqrt(S(5)))*elliptic_f(S(2)*atan(S(5)**(S(3)/4)*(S(1) + S(1)/x)/S(5)), sqrt(S(5))/S(10) + S(1)/2)/(S(10)*sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(4)*x**S(4) + S(4)*x**S(2) + S(4)*x + S(1))**(S(-3)/2), x), x, S(5)**(S(1)/4)*x**S(2)*sqrt(((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5))/((S(1) + S(1)/x)**S(2) + sqrt(S(5)))**S(2))*(-S(3)*sqrt(S(5)) + S(9))*((S(1) + S(1)/x)**S(2) + sqrt(S(5)))*elliptic_f(S(2)*atan(S(5)**(S(3)/4)*(S(1) + S(1)/x)/S(5)), sqrt(S(5))/S(10) + S(1)/2)/(S(20)*sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))) - S(5)**(S(1)/4)*x**S(2)*sqrt(((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5))/((S(1) + S(1)/x)**S(2) + sqrt(S(5)))**S(2))*(S(9)*(S(1) + S(1)/x)**S(2) + S(9)*sqrt(S(5)))*elliptic_e(S(2)*atan(S(5)**(S(3)/4)*(S(1) + S(1)/x)/S(5)), sqrt(S(5))/S(10) + S(1)/2)/(S(10)*sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))) + x**S(2)*(S(1) + S(1)/x)*(S(6)*(S(1) + S(1)/x)**S(3) - S(9)*(S(1) + S(1)/x)**S(2) + S(11) - S(2)/x)/(S(10)*sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))) + x**S(2)*(S(1) + S(1)/x)*(S(9)*(S(1) + S(1)/x)**S(4) - S(18)*(S(1) + S(1)/x)**S(2) + S(45))/(sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))*(S(10)*(S(1) + S(1)/x)**S(2) + S(10)*sqrt(S(5)))) - x**S(2)*(S(3)*(S(1) + S(1)/x)**S(4) - S(6)*(S(1) + S(1)/x)**S(2) + S(15))/(S(5)*sqrt(x**S(4)*((S(1) + S(1)/x)**S(4) - S(2)*(S(1) + S(1)/x)**S(2) + S(5)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8)), x), x, -sqrt(S(2))*S(517)**(S(3)/4)*x**S(2)*sqrt(((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/((S(3) + S(4)/x)**S(2) + sqrt(S(517)))**S(2))*((S(3) + S(4)/x)**S(2) + sqrt(S(517)))*elliptic_f(S(2)*atan(S(517)**(S(3)/4)*(S(3) + S(4)/x)/S(517)), S(19)*sqrt(S(517))/S(1034) + S(1)/2)/(S(1034)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**(S(-3)/2), x), x, sqrt(S(2))*S(517)**(S(1)/4)*x**S(2)*sqrt(((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/((S(3) + S(4)/x)**S(2) + sqrt(S(517)))**S(2))*(-S(203)*sqrt(S(517)) + S(4910))*((S(3) + S(4)/x)**S(2) + sqrt(S(517)))*elliptic_f(S(2)*atan(S(517)**(S(3)/4)*(S(3) + S(4)/x)/S(517)), S(19)*sqrt(S(517))/S(1034) + S(1)/2)/(S(322608)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) - sqrt(S(2))*S(517)**(S(1)/4)*x**S(2)*sqrt(((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/((S(3) + S(4)/x)**S(2) + sqrt(S(517)))**S(2))*(S(2455)*(S(3) + S(4)/x)**S(2) + S(2455)*sqrt(S(517)))*elliptic_e(S(2)*atan(S(517)**(S(3)/4)*(S(3) + S(4)/x)/S(517)), S(19)*sqrt(S(517))/S(1034) + S(1)/2)/(S(80652)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) + sqrt(S(2))*x**S(2)*(S(3) + S(4)/x)*(S(516)*(S(3) + S(4)/x)**S(3) - S(2455)*(S(3) + S(4)/x)**S(2) + S(24643) - S(35004)/x)/(S(80652)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) + sqrt(S(2))*x**S(2)*(S(3) + S(4)/x)*(S(2455)*(S(3) + S(4)/x)**S(4) - S(93290)*(S(3) + S(4)/x)**S(2) + S(1269235))/(S(80652)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))*((S(3) + S(4)/x)**S(2) + sqrt(S(517)))) - S(43)*sqrt(S(2))*x**S(2)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/(S(6721)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(8)*x**S(4) - S(15)*x**S(3) + S(8)*x**S(2) + S(24)*x + S(8))**(S(-5)/2), x), x, sqrt(S(2))*S(517)**(S(1)/4)*x**S(2)*sqrt(((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/((S(3) + S(4)/x)**S(2) + sqrt(S(517)))**S(2))*(-S(175318963)*sqrt(S(517)) + S(4346103976))*((S(3) + S(4)/x)**S(2) + sqrt(S(517)))*elliptic_f(S(2)*atan(S(517)**(S(3)/4)*(S(3) + S(4)/x)/S(517)), S(19)*sqrt(S(517))/S(1034) + S(1)/2)/(S(156113882496)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) - sqrt(S(2))*S(517)**(S(1)/4)*x**S(2)*sqrt(((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))/((S(3) + S(4)/x)**S(2) + sqrt(S(517)))**S(2))*(S(543262997)*(S(3) + S(4)/x)**S(2) + S(543262997)*sqrt(S(517)))*elliptic_e(S(2)*atan(S(517)**(S(3)/4)*(S(3) + S(4)/x)/S(517)), S(19)*sqrt(S(517))/S(1034) + S(1)/2)/(S(9757117656)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) + sqrt(S(2))*x**S(2)*(S(3) + S(4)/x)*(S(223148517)*(S(3) + S(4)/x)**S(3) - S(1086525994)*(S(3) + S(4)/x)**S(2) + S(8668521901) - S(13685866440)/x)/(S(19514235312)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))) + sqrt(S(2))*x**S(2)*(S(3) + S(4)/x)*(S(193467)*(S(3) + S(4)/x)**S(3) - S(718994)*(S(3) + S(4)/x)**S(2) + S(8297705) - S(20727588)/x)/(S(241956)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517))) + sqrt(S(2))*x**S(2)*(S(3) + S(4)/x)*(S(543262997)*(S(3) + S(4)/x)**S(4) - S(20643993886)*(S(3) + S(4)/x)**S(2) + S(280866969449))/(S(9757117656)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))*((S(3) + S(4)/x)**S(2) + sqrt(S(517)))) - sqrt(S(2))*x**S(2)*(S(74382839)*(S(3) + S(4)/x)**S(4) - S(2826547882)*(S(3) + S(4)/x)**S(2) + S(38455927763))/(S(6504745104)*sqrt(x**S(4)*((S(3) + S(4)/x)**S(4) - S(38)*(S(3) + S(4)/x)**S(2) + S(517)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(3)*x**S(4) + S(15)*x**S(3) - S(44)*x**S(2) - S(6)*x + S(9)), x), x, S(613)**(S(3)/4)*x**S(2)*sqrt(((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613))/((S(-1) + S(6)/x)**S(2) + sqrt(S(613)))**S(2))*((S(-1) + S(6)/x)**S(2) + sqrt(S(613)))*elliptic_f(S(2)*atan(S(613)**(S(3)/4)*(S(1) - S(6)/x)/S(613)), S(1)/2 + S(91)*sqrt(S(613))/S(1226))/(S(613)*sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(3)*x**S(4) + S(15)*x**S(3) - S(44)*x**S(2) - S(6)*x + S(9))**(S(-3)/2), x), x, S(613)**(S(1)/4)*x**S(2)*sqrt(((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613))/((S(-1) + S(6)/x)**S(2) + sqrt(S(613)))**S(2))*(-S(145)*sqrt(S(613)) + S(7444))*((S(-1) + S(6)/x)**S(2) + sqrt(S(613)))*elliptic_f(S(2)*atan(S(613)**(S(3)/4)*(S(1) - S(6)/x)/S(613)), S(1)/2 + S(91)*sqrt(S(613))/S(1226))/(S(10576089)*sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))) - S(613)**(S(1)/4)*x**S(2)*sqrt(((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613))/((S(-1) + S(6)/x)**S(2) + sqrt(S(613)))**S(2))*(S(14888)*(S(-1) + S(6)/x)**S(2) + S(14888)*sqrt(S(613)))*elliptic_e(S(2)*atan(S(613)**(S(3)/4)*(S(1) - S(6)/x)/S(613)), S(1)/2 + S(91)*sqrt(S(613))/S(1226))/(S(10576089)*sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))) + x**S(2)*(S(1) - S(6)/x)*(S(704)*(S(1) - S(6)/x)**S(3) - S(14888)*(S(1) - S(6)/x)**S(2) + S(109872) + S(430392)/x)/(S(10576089)*sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))) + x**S(2)*(S(1) - S(6)/x)*(S(14888)*(S(-1) + S(6)/x)**S(4) - S(2709616)*(S(1) - S(6)/x)**S(2) + S(9126344))/(sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))*(S(10576089)*(S(-1) + S(6)/x)**S(2) + S(10576089)*sqrt(S(613)))) - x**S(2)*(S(704)*(S(-1) + S(6)/x)**S(4) - S(128128)*(S(1) - S(6)/x)**S(2) + S(431552))/(S(10576089)*sqrt(x**S(4)*((S(-1) + S(6)/x)**S(4) - S(182)*(S(1) - S(6)/x)**S(2) + S(613)))), expand=True, _diff=True, _numerical=True) ''' def test_5(): assert rubi_test(rubi_integrate(x**m*sqrt(-a/x + b)/sqrt(a - b*x), x), x, S(2)*x**(m + S(1))*sqrt(-a/x + b)/(sqrt(a - b*x)*(S(2)*m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(-a/x + b)/sqrt(a - b*x), x), x, S(2)*x**S(3)*sqrt(-a/x + b)/(S(5)*sqrt(a - b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-a/x + b)/sqrt(a - b*x), x), x, S(2)*x**S(2)*sqrt(-a/x + b)/(S(3)*sqrt(a - b*x)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x + b)/sqrt(a - b*x), x), x, S(2)*x*sqrt(-a/x + b)/sqrt(a - b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x + b)/(x*sqrt(a - b*x)), x), x, -S(2)*sqrt(-a/x + b)/sqrt(a - b*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x + b)/(x**S(2)*sqrt(a - b*x)), x), x, -S(2)*sqrt(-a/x + b)/(S(3)*x*sqrt(a - b*x)), expand=True, _diff=True, _numerical=True) # appellf1 assert rubi_test(rubi_integrate((a + b/x)**m*(c + d*x)**n, x), x, x*(S(1) + d*x/c)**(-n)*(a + b/x)**m*(c + d*x)**n*(a*x/b + S(1))**(-m)*AppellF1(-m + S(1), -m, -n, -m + S(2), -a*x/b, -d*x/c)/(-m + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m*(c + d*x)**S(2), x), x, d**S(2)*x**S(3)*(a + b/x)**(m + S(1))/(S(3)*a) + d*x**S(2)*(a + b/x)**(m + S(1))*(S(6)*a*c - b*d*(-m + S(2)))/(S(6)*a**S(2)) - b*(a + b/x)**(m + S(1))*(S(6)*a**S(2)*c**S(2) - S(6)*a*b*c*d*(-m + S(1)) + b**S(2)*d**S(2)*(m**S(2) - S(3)*m + S(2)))*hyper((S(2), m + S(1)), (m + S(2),), S(1) + b/(a*x))/(S(6)*a**S(4)*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m*(c + d*x), x), x, d*x**S(2)*(a + b/x)**(m + S(1))/(S(2)*a) - b*(a + b/x)**(m + S(1))*(S(2)*a*c - b*d*(-m + S(1)))*hyper((S(2), m + S(1)), (m + S(2),), S(1) + b/(a*x))/(S(2)*a**S(3)*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m, x), x, -b*(a + b/x)**(m + S(1))*hyper((S(2), m + S(1)), (m + S(2),), S(1) + b/(a*x))/(a**S(2)*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m/(c + d*x), x), x, -c*(a + b/x)**(m + S(1))*hyper((S(1), m + S(1)), (m + S(2),), c*(a + b/x)/(a*c - b*d))/(d*(m + S(1))*(a*c - b*d)) + (a + b/x)**(m + S(1))*hyper((S(1), m + S(1)), (m + S(2),), S(1) + b/(a*x))/(a*d*(m + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m/(c + d*x)**S(2), x), x, -b*(a + b/x)**(m + S(1))*hyper((S(2), m + S(1)), (m + S(2),), c*(a + b/x)/(a*c - b*d))/((m + S(1))*(a*c - b*d)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m/(c + d*x)**S(3), x), x, -b*(a + b/x)**(m + S(1))*(S(2)*a*c - b*d*(m + S(1)))*hyper((S(2), m + S(1)), (m + S(2),), c*(a + b/x)/(a*c - b*d))/(S(2)*c*(m + S(1))*(a*c - b*d)**S(3)) - d*(a + b/x)**(m + S(1))/(S(2)*c*(a*c - b*d)*(c/x + d)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b/x)**m/(c + d*x)**S(4), x), x, -b*(a + b/x)**(m + S(1))*(S(6)*a**S(2)*c**S(2) - S(6)*a*b*c*d*(m + S(1)) + b**S(2)*d**S(2)*(m**S(2) + S(3)*m + S(2)))*hyper((S(2), m + S(1)), (m + S(2),), c*(a + b/x)/(a*c - b*d))/(S(6)*c**S(2)*(m + S(1))*(a*c - b*d)**S(4)) + d**S(2)*(a + b/x)**(m + S(1))/(S(3)*c**S(2)*(a*c - b*d)*(c/x + d)**S(3)) - d*(a + b/x)**(m + S(1))*(S(6)*a*c - b*d*(m + S(4)))/(S(6)*c**S(2)*(a*c - b*d)**S(2)*(c/x + d)**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**m*sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), x), x, x**(m + S(1))*sqrt(-a/x**S(2) + b)/(m*sqrt(a - b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), x), x, x**S(3)*sqrt(-a/x**S(2) + b)/(S(2)*sqrt(a - b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), x), x, x**S(2)*sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), x), x, x*sqrt(-a/x**S(2) + b)*log(x)/sqrt(a - b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x**S(2) + b)/(x*sqrt(a - b*x**S(2))), x), x, -sqrt(-a/x**S(2) + b)/sqrt(a - b*x**S(2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(-a/x**S(2) + b)/(x**S(2)*sqrt(a - b*x**S(2))), x), x, -sqrt(-a/x**S(2) + b)/(S(2)*x*sqrt(a - b*x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c + d*x)**(S(3)/2)/sqrt(a + b/x**S(2)), x), x, -2*sqrt(b)*c*sqrt(a*(c + d*x)/(a*c - sqrt(b)*d*sqrt(-a)))*(a*c**2 + b*d**2)*sqrt(a*x**2/b + 1)*EllipticF(asin(sqrt(2)*sqrt(1 - x*sqrt(-a)/sqrt(b))/2), -2*sqrt(b)*d*sqrt(-a)/(a*c - sqrt(b)*d*sqrt(-a)))/(5*d*x*(-a)**(3/2)*sqrt(a + b/x**2)*sqrt(c + d*x)) + 2*sqrt(b)*sqrt(c + d*x)*(a*c**2 - 3*b*d**2)*sqrt(a*x**2/b + 1)*EllipticE(asin(sqrt(2)*sqrt(1 - x*sqrt(-a)/sqrt(b))/2), -2*sqrt(b)*d*sqrt(-a)/(a*c - sqrt(b)*d*sqrt(-a)))/(5*d*x*(-a)**(3/2)*sqrt(a*(c + d*x)/(a*c - sqrt(b)*d*sqrt(-a)))*sqrt(a + b/x**2)) + 2*c*sqrt(c + d*x)*(a*x**2 + b)/(5*a*x*sqrt(a + b/x**2)) + 2*(c + d*x)**(3/2)*(a*x**2 + b)/(5*a*x*sqrt(a + b/x**2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))**(S(5)/2)/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, S(19)*a**S(2)*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a - b*x**S(2)))/(S(8)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))) - S(9)*a*x*(a - b*x**S(2))*sqrt(a + b*x**S(2))/(S(8)*sqrt(a**S(2) - b**S(2)*x**S(4))) - x*(a - b*x**S(2))*(a + b*x**S(2))**(S(3)/2)/(S(4)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a + b*x**S(2))**(S(3)/2)/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, S(3)*a*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a - b*x**S(2)))/(S(2)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))) - x*(a - b*x**S(2))*sqrt(a + b*x**S(2))/(S(2)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a + b*x**S(2))/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(b)*x/sqrt(a - b*x**S(2)))/(sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(S(2))*sqrt(b)*x/sqrt(a - b*x**S(2)))/(S(2)*a*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))**(S(3)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, x*(a - b*x**S(2))/(S(4)*a**S(2)*sqrt(a + b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(S(2))*sqrt(b)*x/sqrt(a - b*x**S(2)))/(S(8)*a**S(2)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a + b*x**S(2))**(S(5)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, x*(a - b*x**S(2))/(S(8)*a**S(2)*(a + b*x**S(2))**(S(3)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(9)*x*(a - b*x**S(2))/(S(32)*a**S(3)*sqrt(a + b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(19)*sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atan(sqrt(S(2))*sqrt(b)*x/sqrt(a - b*x**S(2)))/(S(64)*a**S(3)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - b*x**S(2))**(S(5)/2)/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, S(19)*a**S(2)*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(8)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))) - S(9)*a*x*sqrt(a - b*x**S(2))*(a + b*x**S(2))/(S(8)*sqrt(a**S(2) - b**S(2)*x**S(4))) - x*(a - b*x**S(2))**(S(3)/2)*(a + b*x**S(2))/(S(4)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((a - b*x**S(2))**(S(3)/2)/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, S(3)*a*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(2)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))) - x*sqrt(a - b*x**S(2))*(a + b*x**S(2))/(S(2)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(a - b*x**S(2))/sqrt(a**S(2) - b**S(2)*x**S(4)), x), x, sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a - b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(S(2))*sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(2)*a*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a - b*x**S(2))**(S(3)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, x*(a + b*x**S(2))/(S(4)*a**S(2)*sqrt(a - b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(3)*sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(S(2))*sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(8)*a**S(2)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/((a - b*x**S(2))**(S(5)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))), x), x, x*(a + b*x**S(2))/(S(8)*a**S(2)*(a - b*x**S(2))**(S(3)/2)*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(9)*x*(a + b*x**S(2))/(S(32)*a**S(3)*sqrt(a - b*x**S(2))*sqrt(a**S(2) - b**S(2)*x**S(4))) + S(19)*sqrt(S(2))*sqrt(a - b*x**S(2))*sqrt(a + b*x**S(2))*atanh(sqrt(S(2))*sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(64)*a**S(3)*sqrt(b)*sqrt(a**S(2) - b**S(2)*x**S(4))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2)/(x**S(2) + S(-1)))/(x**S(2) + S(1)), x), x, sqrt(S(2))*sqrt(-x**S(2)/(-x**S(2) + S(1)))*sqrt(x**S(2) + S(-1))*atan(sqrt(S(2))*sqrt(x**S(2) + S(-1))/S(2))/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(2)/(a + x**S(2)*(a + S(1)) + S(-1)))/(x**S(2) + S(1)), x), x, sqrt(S(2))*sqrt(-x**S(2)/(-a - x**S(2)*(a + S(1)) + S(1)))*sqrt(a + x**S(2)*(a + S(1)) + S(-1))*atan(sqrt(S(2))*sqrt(a + x**S(2)*(a + S(1)) + S(-1))/S(2))/(S(2)*x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(((x + S(1))*(x**S(2) + S(-1)))**(S(-2)/3), x), x, (S(3)*x**S(2)/S(2) + S(-3)/2)/((-x + S(-1))*(-x**S(2) + S(1)))**(S(2)/3), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(((x + S(1))*(x**S(2) + S(-1)))**(S(-2)/3), x), x, (x + S(1))*(S(3)*x/S(2) + S(-3)/2)/(x**S(3) + x**S(2) - x + S(-1))**(S(2)/3), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/(sqrt(x*(x**S(2) + S(1)))*(x**S(2) + S(1))), x), x, -S(2)*x/sqrt(x*(x**S(2) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((x**S(2) + S(-1))/((x**S(2) + S(1))*sqrt(x**S(3) + x)), x), x, -S(2)*x/sqrt(x**S(3) + x), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x**S(2) + S(-1))**S(2)/(x*(x**S(2) + S(1))))/(x**S(2) + S(1)), x), x, S(2)*x*sqrt((-x**S(2) + S(1))**S(2)/(x*(x**S(2) + S(1))))/(-x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x**S(2) + S(-1))**S(2)/(x**S(3) + x))/(x**S(2) + S(1)), x), x, S(2)*x*sqrt((-x**S(2) + S(1))**S(2)/(x**S(3) + x))/(-x**S(2) + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/(sqrt(a + b/x**S(2))*sqrt(c + d*x**S(2))), x), x, sqrt(a*x**S(2) + b)*atanh(sqrt(d)*sqrt(a*x**S(2) + b)/(sqrt(a)*sqrt(c + d*x**S(2))))/(sqrt(a)*sqrt(d)*x*sqrt(a + b/x**S(2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(x**S(4) - S(2)*x**S(2))/((x**S(2) + S(-1))*(x**S(2) + S(2))), x), x, S(2)*sqrt(x**S(4) - S(2)*x**S(2))*atan(sqrt(x**S(2) + S(-2))/S(2))/(S(3)*x*sqrt(x**S(2) + S(-2))) - sqrt(x**S(4) - S(2)*x**S(2))*atan(sqrt(x**S(2) + S(-2)))/(S(3)*x*sqrt(x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(1) - S(1)/(x**S(2) + S(-1))**S(2))/(-x**S(2) + S(2)), x), x, sqrt(S(1) - S(1)/(-x**S(2) + S(1))**S(2))*(-x**S(2) + S(1))*atan(sqrt(x**S(2) + S(-2)))/(x*sqrt(x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) or rubi_test(rubi_integrate(sqrt(S(1) - S(1)/(x**S(2) + S(-1))**S(2))/(-x**S(2) + S(2)), x), x, sqrt(S(1) - S(1)/(-x**S(2) + S(1))**S(2))*(-x**S(2) + S(1))*sqrt(x**S(4) - S(2)*x**S(2))*atan(sqrt(x**S(2) + S(-2)))/(x*sqrt(x**S(2) + S(-2))*sqrt((x**S(2) + S(-1))**S(2) + S(-1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt((x**S(4) - S(2)*x**S(2))/(x**S(2) + S(-1))**S(2))/(x**S(2) + S(2)), x), x, sqrt((x**S(4) - S(2)*x**S(2))/(-x**S(2) + S(1))**S(2))*(-x**S(2)/S(3) + S(1)/3)*atan(sqrt(x**S(2) + S(-2)))/(x*sqrt(x**S(2) + S(-2))) + sqrt((x**S(4) - S(2)*x**S(2))/(-x**S(2) + S(1))**S(2))*(S(2)*x**S(2)/S(3) + S(-2)/3)*atan(sqrt(x**S(2) + S(-2))/S(2))/(x*sqrt(x**S(2) + S(-2))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x/(x**S(2) + S(1)) + S(1))**(S(5)/2), x), x, -(-x/S(3) + S(1)/3)*(x + S(1))**S(3)*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x**S(2) + S(1)) + (x + S(1))*(S(8)*x/S(3) + S(-4)/3)*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)) - (S(3)*x + S(4))*(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x + S(1)) + S(5)*sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))*asinh(x)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x/(x**S(2) + S(1)) + S(1))**(S(3)/2), x), x, -x*(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x + S(1)) + (x + S(-1))*(x + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)) + S(3)*sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))*asinh(x)/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)), x), x, sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))*asinh(x)/(x + S(1)) + (x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(S(1)/sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)), x), x, (x + S(1))/sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)) - (x + S(1))*asinh(x)/(sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))) - sqrt(S(2))*(x + S(1))*atanh(sqrt(S(2))*(-x + S(1))/(S(2)*sqrt(x**S(2) + S(1))))/(sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((S(2)*x/(x**S(2) + S(1)) + S(1))**(S(-3)/2), x), x, (S(3)*x/S(2) + S(3))/sqrt(S(2)*x/(x**S(2) + S(1)) + S(1)) - (S(3)*x + S(3))*asinh(x)/(sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))) - sqrt(S(2))*(S(9)*x/S(2) + S(9)/2)*atanh(sqrt(S(2))*(-x + S(1))/(S(2)*sqrt(x**S(2) + S(1))))/(S(2)*sqrt(x**S(2) + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))) + (-x**S(2)/S(2) + S(-1)/2)/((x + S(1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x**S(2) + S(1)), x), x, (x + S(-1))*sqrt(S(2)*x/(x**S(2) + S(1)) + S(1))/(x + S(1)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c/(a + b*x**S(2)))**(S(3)/2), x), x, -c*x*sqrt(c/(a + b*x**S(2)))/b + c*sqrt(c/(a + b*x**S(2)))*sqrt(a + b*x**S(2))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/b**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c/(a + b*x**S(2)))**(S(3)/2), x), x, -c*sqrt(c/(a + b*x**S(2)))/b, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c/(a + b*x**S(2)))**(S(3)/2), x), x, c*x*sqrt(c/(a + b*x**S(2)))/a, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c/(a + b*x**S(2)))**(S(3)/2)/x, x), x, c*sqrt(c/(a + b*x**S(2)))/a - c*sqrt(c/(a + b*x**S(2)))*sqrt(a + b*x**S(2))*atanh(sqrt(a + b*x**S(2))/sqrt(a))/a**(S(3)/2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c/(a + b*x**S(2)))**(S(3)/2)/x**S(2), x), x, -c*sqrt(c/(a + b*x**S(2)))/(a*x) - S(2)*b*c*x*sqrt(c/(a + b*x**S(2)))/a**S(2), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c/(a + b*x**S(2)))**(S(3)/2)/x**S(3), x), x, c*sqrt(c/(a + b*x**S(2)))/(a*x**S(2)) - S(3)*c*sqrt(c/(a + b*x**S(2)))*(a + b*x**S(2))/(S(2)*a**S(2)*x**S(2)) + S(3)*b*c*sqrt(c/(a + b*x**S(2)))*sqrt(a + b*x**S(2))*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(S(2)*a**(S(5)/2)), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x**S(2)*(c*(a + b*x**S(2))**S(3))**(S(3)/2), x), x, -S(21)*a**S(6)*c*sqrt(c*(a + b*x**S(2))**S(3))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(1024)*b**(S(3)/2)*(a + b*x**S(2))**(S(3)/2)) + S(21)*a**S(5)*c*x*sqrt(c*(a + b*x**S(2))**S(3))/(S(1024)*b*(a + b*x**S(2))) + S(21)*a**S(4)*c*x**S(3)*sqrt(c*(a + b*x**S(2))**S(3))/(S(512)*(a + b*x**S(2))) + S(7)*a**S(3)*c*x**S(3)*sqrt(c*(a + b*x**S(2))**S(3))/S(128) + S(21)*a**S(2)*c*x**S(3)*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))/S(320) + S(3)*a*c*x**S(3)*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(2)/S(40) + c*x**S(3)*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(3)/S(12), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate(x*(c*(a + b*x**S(2))**S(3))**(S(3)/2), x), x, c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(4)/(S(11)*b), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*(a + b*x**S(2))**S(3))**(S(3)/2), x), x, S(63)*a**S(5)*c*sqrt(c*(a + b*x**S(2))**S(3))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(256)*sqrt(b)*(a + b*x**S(2))**(S(3)/2)) + S(63)*a**S(4)*c*x*sqrt(c*(a + b*x**S(2))**S(3))/(S(256)*(a + b*x**S(2))) + S(21)*a**S(3)*c*x*sqrt(c*(a + b*x**S(2))**S(3))/S(128) + S(21)*a**S(2)*c*x*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))/S(160) + S(9)*a*c*x*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(2)/S(80) + c*x*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(3)/S(10), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*(a + b*x**S(2))**S(3))**(S(3)/2)/x, x), x, -a**(S(9)/2)*c*sqrt(c*(a + b*x**S(2))**S(3))*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(a + b*x**S(2))**(S(3)/2) + a**S(4)*c*sqrt(c*(a + b*x**S(2))**S(3))/(a + b*x**S(2)) + a**S(3)*c*sqrt(c*(a + b*x**S(2))**S(3))/S(3) + a**S(2)*c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))/S(5) + a*c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(2)/S(7) + c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(3)/S(9), expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*(a + b*x**S(2))**S(3))**(S(3)/2)/x**S(2), x), x, S(315)*a**S(4)*sqrt(b)*c*sqrt(c*(a + b*x**S(2))**S(3))*atanh(sqrt(b)*x/sqrt(a + b*x**S(2)))/(S(128)*(a + b*x**S(2))**(S(3)/2)) + S(315)*a**S(3)*b*c*x*sqrt(c*(a + b*x**S(2))**S(3))/(S(128)*(a + b*x**S(2))) + S(105)*a**S(2)*b*c*x*sqrt(c*(a + b*x**S(2))**S(3))/S(64) + S(21)*a*b*c*x*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))/S(16) + S(9)*b*c*x*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(2)/S(8) - c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(3)/x, expand=True, _diff=True, _numerical=True) assert rubi_test(rubi_integrate((c*(a + b*x**S(2))**S(3))**(S(3)/2)/x**S(3), x), x, -S(9)*a**(S(7)/2)*b*c*sqrt(c*(a + b*x**S(2))**S(3))*atanh(sqrt(a + b*x**S(2))/sqrt(a))/(S(2)*(a + b*x**S(2))**(S(3)/2)) + S(9)*a**S(3)*b*c*sqrt(c*(a + b*x**S(2))**S(3))/(S(2)*(a + b*x**S(2))) + S(3)*a**S(2)*b*c*sqrt(c*(a + b*x**S(2))**S(3))/S(2) + S(9)*a*b*c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))/S(10) + S(9)*b*c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(2)/S(14) - c*sqrt(c*(a + b*x**S(2))**S(3))*(a + b*x**S(2))**S(3)/(S(2)*x**S(2)), expand=True, _diff=True, _numerical=True)
c68b37ac433987be3696c89c8ef041705f7f01909e33c6346190a09668717512
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot from sympy.functions.elementary.hyperbolic import atanh as arctanh from sympy.functions.elementary.hyperbolic import asinh as arcsinh from sympy.functions.elementary.hyperbolic import acosh as arccosh from sympy.functions.elementary.trigonometric import atan as arctan from sympy.functions.elementary.trigonometric import asin as arcsin from sympy.functions.elementary.trigonometric import acos as arccos from sympy.integrals.rubi.utility_function import EllipticE, EllipticF, EllipticPi, hypergeom, rubi_test, AppellF1 from sympy import pi as Pi from sympy import S, hyper, I, simplify, exp_polar, symbols, Integral from sympy.testing.pytest import XFAIL A, B, C, D, a, b, c, d, e, f, g, h, i, m, n, p, x, u = symbols('A B C D a b c d e f g h i m n p x u') def test_1(): ''' Tests for Rubi Algebraic 1.2 rules. Parsed from Maple syntax All tests: http://www.apmaths.uwo.ca/~arich/IntegrationProblems/MapleSyntaxFiles/MapleSyntaxFiles.html Note: Some tests are commented since they depend rules other than Algebraic1.2. ''' test = [ [(a + b*x)**S(2)*(e + f*x)*sqrt(c + d*x)/x, x, S(5), S(2)/S(7)*f*(a + b*x)**S(2)*(c + d*x)**(S(3)/S(2))/d + S(2)/S(105)*(c + d*x)**(S(3)/S(2))*(S(2)*(S(10)*a**S(2)*d**S(2)*f - b**S(2)*c*(S(7)*d*e - S(4)*c*f) + S(7)*a*b*d*(S(5)*d*e - S(2)*c*f)) + S(3)*b*d*(S(7)*b*d*e - S(4)*b*c*f + S(4)*a*d*f)*x)/d**S(3) - S(2)*a**S(2)*e*arctanh(sqrt(c + d*x)/sqrt(c))*sqrt(c) + S(2)*a**S(2)*e*sqrt(c + d*x)], [(a + b*x)*(e + f*x)*sqrt(c + d*x)/x, x, S(4), - S(2)/S(15)*(c + d*x)**(S(3)/S(2))*(S(2)*b*c*f - S(5)*d*(b*e + a*f) - S(3)*b*d*f*x)/d**S(2) - S(2)*a*e*arctanh(sqrt(c + d*x)/sqrt(c))*sqrt(c) + S(2)*a*e*sqrt(c + d*x)], [(c + d*x)**S(2)*(e + f*x)*sqrt(a + b*x)/x, x, S(5), S(2)/S(7)*f*(a + b*x)**(S(3)/S(2))*(c + d*x)**S(2)/b + S(2)/S(105)*(a + b*x)**(S(3)/S(2))*(S(2)*(S(4)*a**S(2)*d**S(2)*f - S(7)*a*b*d*(d*e + S(2)*c*f) + S(5)*b**S(2)*c*(S(7)*d*e + S(2)*c*f)) + S(3)*b*d*(S(7)*b*d*e + S(4)*b*c*f - S(4)*a*d*f)*x)/b**S(3) - S(2)*c**S(2)*e*arctanh(sqrt(a + b*x)/sqrt(a))*sqrt(a) + S(2)*c**S(2)*e*sqrt(a + b*x)], [(c + d*x)*(e + f*x)*sqrt(a + b*x)/x, x, S(4), - S(2)/S(15)*(a + b*x)**(S(3)/S(2))*(S(2)*a*d*f - S(5)*b*(d*e + c*f) - S(3)*b*d*f*x)/b**S(2) - S(2)*c*e*arctanh(sqrt(a + b*x)/sqrt(a))*sqrt(a) + S(2)*c*e*sqrt(a + b*x)], [x**S(4)*(e + f*x)**n/((a + b*x)*(c + d*x)), x, S(8), e**S(2)*(e + f*x)**(S(1) + n)/(b*d*f**S(3)*(S(1) + n)) + (b*c + a*d)*e*(e + f*x)**(S(1) + n)/(b**S(2)*d**S(2)*f**S(2)*(S(1) + n)) + (b**S(2)*c**S(2) + a*b*c*d + a**S(2)*d**S(2))*(e + f*x)**(S(1) + n)/(b**S(3)*d**S(3)*f*(S(1) + n)) - S(2)*e*(e + f*x)**(S(2) + n)/(b*d*f**S(3)*(S(2) + n)) - (b*c + a*d)*(e + f*x)**(S(2) + n)/(b**S(2)*d**S(2)*f**S(2)*(S(2) + n)) + (e + f*x)**(S(3) + n)/(b*d*f**S(3)*(S(3) + n)) - a**S(4)*(e + f*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], b*(e + f*x)/(b*e - a*f))/(b**S(3)*(b*c - a*d)*(b*e - a*f)*(S(1) + n)) + c**S(4)*(e + f*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], d*(e + f*x)/(d*e - c*f))/(d**S(3)*(b*c - a*d)*(d*e - c*f)*(S(1) + n))], [(a + b*x)*(c + d*x)*(e + f*x)*(g + h*x), x, S(2), a*c*e*g*x + S(1)/S(2)*(b*c*e*g + a*(d*e*g + c*f*g + c*e*h))*x**S(2) + S(1)/S(3)*(b*(d*e*g + c*f*g + c*e*h) + a*(d*f*g + d*e*h + c*f*h))*x**S(3) + S(1)/S(4)*(a*d*f*h + b*(d*f*g + d*e*h + c*f*h))*x**S(4) + S(1)/S(5)*b*d*f*h*x**S(5)], [(a + b*x)*(c + d*x)*(e + f*x)/(g + h*x), x, S(2), (b*(d*g - c*h)*(f*g - e*h) - a*h*(d*f*g - d*e*h - c*f*h))*x/h**S(3) + S(1)/S(2)*(a*d*f*h - b*(d*f*g - d*e*h - c*f*h))*x**S(2)/h**S(2) + S(1)/S(3)*b*d*f*x**S(3)/h - (b*g - a*h)*(d*g - c*h)*(f*g - e*h)*log(g + h*x)/h**S(4)], [(a + b*x)**m*(c + d*x)*(e + f*x)*(g + h*x), x, S(2), (b*c - a*d)*(b*e - a*f)*(b*g - a*h)*(a + b*x)**(S(1) + m)/(b**S(4)*(S(1) + m)) + (S(3)*a**S(2)*d*f*h + b**S(2)*(d*e*g + c*f*g + c*e*h) - S(2)*a*b*(d*f*g + d*e*h + c*f*h))*(a + b*x)**(S(2) + m)/(b**S(4)*(S(2) + m)) - (S(3)*a*d*f*h - b*(d*f*g + d*e*h + c*f*h))*(a + b*x)**(S(3) + m)/(b**S(4)*(S(3) + m)) + d*f*h*(a + b*x)**(S(4) + m)/(b**S(4)*(S(4) + m))], [(c + d*x)**( - S(4) - m)*(e + f*x)**m*(g + h*x), x, S(3), - (d*g - c*h)*(c + d*x)**( - S(3) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)*(S(3) + m)) + (c*f*h*(S(1) + m) + d*(S(2)*f*g - e*h*(S(3) + m)))*(c + d*x)**( - S(2) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)**S(2)*(S(2) + m)*(S(3) + m)) - f*(c*f*h*(S(1) + m) + d*(S(2)*f*g - e*h*(S(3) + m)))*(c + d*x)**( - S(1) - m)*(e + f*x)**(S(1) + m)/(d*(d*e - c*f)**S(3)*(S(1) + m)*(S(2) + m)*(S(3) + m))], ] for i in test: r = rubi_integrate(i[0], i[1]) if len(i) == 5: assert rubi_test(r, i[1], i[3], expand=True, _diff=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True) else: assert rubi_test(r, i[1], i[3], expand=True, _diff=True) @XFAIL def test_2(): test = [ [x**m*(e + f*x)**n/((a + b*x)*(c + d*x)), x, S(6), b*x**(S(1) + m)*(e + f*x)**n*AppellF1(S(1) + m, - n, S(1), S(2) + m, - f*x/e, - b*x/a)/(a*(b*c - a*d)*(S(1) + m)*(S(1) + f*x/e)**n) - d*x**(S(1) + m)*(e + f*x)**n*AppellF1(S(1) + m, - n, S(1), S(2) + m, - f*x/e, - d*x/c)/(c*(b*c - a*d)*(S(1) + m)*(S(1) + f*x/e)**n)], [(a + b*x)**m*(c + d*x)**n*(e + f*x)*(g + h*x), x, S(3), - (a + b*x)**(S(1) + m)*(c + d*x)**(S(1) + n)*(b*c*f*h*(S(2) + m) + a*d*f*h*(S(2) + n) - b*d*(f*g + e*h)*(S(3) + m + n) - b*d*f*h*(S(2) + m + n)*x)/(b**S(2)*d**S(2)*(S(2) + m + n)*(S(3) + m + n)) + (a**S(2)*d**S(2)*f*h*(S(1) + n)*(S(2) + n) + a*b*d*(S(1) + n)*(S(2)*c*f*h*(S(1) + m) - d*(f*g + e*h)*(S(3) + m + n)) + b**S(2)*(c**S(2)*f*h*(S(1) + m)*(S(2) + m) - c*d*(f*g + e*h)*(S(1) + m)*(S(3) + m + n) + d**S(2)*e*g*(S(2) + m + n)*(S(3) + m + n)))*(a + b*x)**(S(1) + m)*(c + d*x)**n*hypergeom([S(1) + m, - n], [S(2) + m], - d*(a + b*x)/(b*c - a*d))/(b**S(3)*d**S(2)*(S(1) + m)*(S(2) + m + n)*(S(3) + m + n)*(b*(c + d*x)/(b*c - a*d))**n)], [(a + b*x)**m*(A + B*x)*(c + d*x)**n*(e + f*x)**p, x, S(7), (A*b - a*B)*(a + b*x)**(S(1) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(1) + m, - n, - p, S(2) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b**S(2)*(S(1) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p) + B*(a + b*x)**(S(2) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(2) + m, - n, - p, S(3) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b**S(2)*(S(2) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p)], [(A + B*x)*(c + d*x)**n*(e + f*x)**p/(a + b*x), x, S(5), - (A*b - a*B)*(c + d*x)**(S(1) + n)*(e + f*x)**p*AppellF1(S(1) + n, S(1), - p, S(2) + n, b*(c + d*x)/(b*c - a*d), - f*(c + d*x)/(d*e - c*f))/(b*(b*c - a*d)*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p) - B*(c + d*x)**(S(1) + n)*(e + f*x)**(S(1) + p)*hypergeom([S(1), S(2) + n + p], [S(2) + p], d*(e + f*x)/(d*e - c*f))/(b*(d*e - c*f)*(S(1) + p)), - (A*b - a*B)*(c + d*x)**(S(1) + n)*(e + f*x)**p*AppellF1(S(1) + n, - p, S(1), S(2) + n, - f*(c + d*x)/(d*e - c*f), b*(c + d*x)/(b*c - a*d))/(b*(b*c - a*d)*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p) + B*(c + d*x)**(S(1) + n)*(e + f*x)**p*hypergeom([S(1) + n, - p], [S(2) + n], - f*(c + d*x)/(d*e - c*f))/(b*d*(S(1) + n)*(d*(e + f*x)/(d*e - c*f))**p)], [(c*i + d*i*x)/(sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(3), S(2)*i*EllipticE(sqrt(h)*sqrt(e + f*x)/sqrt( - f*g + e*h), sqrt( - d*(f*g - e*h)/((d*e - c*f)*h)))*sqrt( - f*g + e*h)*sqrt(c + d*x)*sqrt(f*(g + h*x)/(f*g - e*h))/(f*sqrt(h)*sqrt( - f*(c + d*x)/(d*e - c*f))*sqrt(g + h*x))], [(a + b*x)**m*(c + d*x)**n*(e + f*x)**p, x, S(3), (a + b*x)**(S(1) + m)*(c + d*x)**n*(e + f*x)**p*AppellF1(S(1) + m, - n, - p, S(2) + m, - d*(a + b*x)/(b*c - a*d), - f*(a + b*x)/(b*e - a*f))/(b*(S(1) + m)*(b*(c + d*x)/(b*c - a*d))**n*(b*(e + f*x)/(b*e - a*f))**p)], [(a + b*x)**m*(c + d*x)**n*(e + f*x)**p/(g + h*x), x, S(0), Integral((a + b*x)**m*(c + d*x)**n*(e + f*x)**p/(g + h*x), x)], [x**S(3)*(S(1) + a*x)/(sqrt(a*x)*sqrt(S(1) - a*x)), x, S(8), - S(75)/S(128)*arcsin(S(1) - S(2)*a*x)/a**S(4) - S(25)/S(32)*(a*x)**(S(3)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(5)/S(8)*(a*x)**(S(5)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(1)/S(4)*(a*x)**(S(7)/S(2))*sqrt(S(1) - a*x)/a**S(4) - S(75)/S(64)*sqrt(a*x)*sqrt(S(1) - a*x)/a**S(4)], ] for index in test: r = rubi_integrate(index[0], index[1]) if len(index) == 5: assert rubi_test(r, index[1], index[3], expand=True, _diff=True) or rubi_test(r, index[1], index[4], expand=True, _diff=True) else: assert rubi_test(r, index[1], index[3], expand=True, _diff=True) @XFAIL def test_numerical(): test = [ #[S(1)/((a + b*x)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(1), - S(2)*EllipticPi(sqrt( - f/(d*e - c*f))*sqrt(c + d*x), - b*(d*e - c*f)/((b*c - a*d)*f), sqrt((d*e - c*f)*h/(f*(d*g - c*h))))*sqrt(d*(e + f*x)/(d*e - c*f))*sqrt(d*(g + h*x)/(d*g - c*h))/((b*c - a*d)*sqrt( - f/(d*e - c*f))*sqrt(e + f*x)*sqrt(g + h*x))], #[S(1)/(sqrt(a + b*x)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt(g + h*x)), x, S(2), - S(2)*(a + b*x)*sqrt(cos(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x))))**S(2))/cos(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x))))*EllipticF(sin(arctan(sqrt(b*e - a*f)*sqrt(g + h*x)/(sqrt(f*g - e*h)*sqrt(a + b*x)))), sqrt((d*e - c*f)*(b*g - a*h)/((b*e - a*f)*(d*g - c*h))))*sqrt(f*g - e*h)*sqrt((b*g - a*h)*(c + d*x)/((d*g - c*h)*(a + b*x)))*sqrt((b*g - a*h)*(e + f*x)/((f*g - e*h)*(a + b*x)))*sqrt(S(1) + (b*c - a*d)*(g + h*x)/((d*g - c*h)*(a + b*x)))/((b*g - a*h)*sqrt(b*e - a*f)*sqrt(c + d*x)*sqrt(e + f*x)*sqrt((S(1) + (b*c - a*d)*(g + h*x)/((d*g - c*h)*(a + b*x)))/(S(1) + (b*e - a*f)*(g + h*x)/((f*g - e*h)*(a + b*x))))*sqrt(S(1) + (b*e - a*f)*(g + h*x)/((f*g - e*h)*(a + b*x))))], ] for i in test: r = rubi_integrate(i[0], i[1]) if len(i) == 5: assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True, _numerical=True) else: assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True)
4393fd19207db53aff21c3eb8d4039ae128f357e9c7a1d1979253d331e7ffad4
import sys from sympy.external import import_module matchpy = import_module("matchpy") if not matchpy: #bin/test will not execute any tests now disabled = True if sys.version_info[:2] < (3, 6): disabled = True from sympy.integrals.rubi.rubi import rubi_integrate from sympy.functions import log, sqrt, exp, cos, sin, tan, sec, csc, cot from sympy.functions.elementary.hyperbolic import atanh as arctanh from sympy.functions.elementary.hyperbolic import asinh as arcsinh from sympy.functions.elementary.hyperbolic import acosh as arccosh from sympy.functions.elementary.trigonometric import atan as arctan from sympy.functions.elementary.trigonometric import asin as arcsin from sympy.functions.elementary.trigonometric import acos as arccos from sympy.integrals.rubi.utility_function import EllipticE, EllipticF, hypergeom, rubi_test from sympy import pi as Pi from sympy import S, hyper, I, simplify, exp_polar, symbols from sympy.testing.pytest import slow, skip, ON_TRAVIS A, B, C, D, a, b, c, d, e, f, m, n, p, x, u = symbols('A B C D a b c d e f m n p x u', real=True, imaginary=False) @slow def test_1(): if ON_TRAVIS: skip('Too slow for travis.') test = [ [x**S(2)*(a + b*x)*(a*c - b*c*x)**S(3), x, S(2), S(1)/S(3)*a**S(4)*c**S(3)*x**S(3) - S(1)/S(2)*a**S(3)*b*c**S(3)*x**S(4) + S(1)/S(3)*a*b**S(3)*c**S(3)*x**S(6) - S(1)/S(7)*b**S(4)*c**S(3)*x**S(7)], [x*(a + b*x)*(a*c - b*c*x)**S(3), x, S(2), S(1)/S(2)*a**S(4)*c**S(3)*x**S(2) - S(2)/S(3)*a**S(3)*b*c**S(3)*x**S(3) + S(2)/S(5)*a*b**S(3)*c**S(3)*x**S(5) - S(1)/S(6)*b**S(4)*c**S(3)*x**S(6)], [x**S(3)*(a + b*x)*(A + B*x), x, S(2), S(1)/S(4)*a*A*x**S(4) + S(1)/S(5)*(A*b + a*B)*x**S(5) + S(1)/S(6)*b*B*x**S(6)], [x**S(4)*(A + B*x)/(a + b*x), x, S(2), - a**S(3)*(A*b - a*B)*x/b**S(5) + S(1)/S(2)*a**S(2)*(A*b - a*B)*x**S(2)/b**S(4) - S(1)/S(3)*a*(A*b - a*B)*x**S(3)/b**S(3) + S(1)/S(4)*(A*b - a*B)*x**S(4)/b**S(2) + S(1)/S(5)*B*x**S(5)/b + a**S(4)*(A*b - a*B)*log(a + b*x)/b**S(6)], [x**S(2)*(c + d*x)/(a + b*x), x, S(2), - a*(b*c - a*d)*x/b**S(3) + S(1)/S(2)*(b*c - a*d)*x**S(2)/b**S(2) + S(1)/S(3)*d*x**S(3)/b + a**S(2)*(b*c - a*d)*log(a + b*x)/b**S(4)], [x**S(3)*(c + d*x)**S(2)/(a + b*x)**S(2), x, S(2), - S(2)*a*(b*c - S(2)*a*d)*(b*c - a*d)*x/b**S(5) + S(1)/S(2)*(b*c - S(3)*a*d)*(b*c - a*d)*x**S(2)/b**S(4) + S(2)/S(3)*d*(b*c - a*d)*x**S(3)/b**S(3) + S(1)/S(4)*d**S(2)*x**S(4)/b**S(2) + a**S(3)*(b*c - a*d)**S(2)/(b**S(6)*(a + b*x)) + a**S(2)*(S(3)*b*c - S(5)*a*d)*(b*c - a*d)*log(a + b*x)/b**S(6)], [x**S(2)*(c + d*x)**S(3)/(a + b*x)**S(3), x, S(2), S(3)*d*(b*c - S(2)*a*d)*(b*c - a*d)*x/b**S(5) + S(3)/S(2)*d**S(2)*(b*c - a*d)*x**S(2)/b**S(4) + S(1)/S(3)*d**S(3)*x**S(3)/b**S(3) - S(1)/S(2)*a**S(2)*(b*c - a*d)**S(3)/(b**S(6)*(a + b*x)**S(2)) + a*(S(2)*b*c - S(5)*a*d)*(b*c - a*d)**S(2)/(b**S(6)*(a + b*x)) + (b*c - a*d)*(b**S(2)*c**S(2) - S(8)*a*b*c*d + S(10)*a**S(2)*d**S(2))*log(a + b*x)/b**S(6)], [x**(S(5)/S(2))*(A + B*x)/(a + b*x), x, S(6), - S(2)/S(3)*a*(A*b - a*B)*x**(S(3)/S(2))/b**S(3) + S(2)/S(5)*(A*b - a*B)*x**(S(5)/S(2))/b**S(2) + S(2)/S(7)*B*x**(S(7)/S(2))/b - S(2)*a**(S(5)/S(2))*(A*b - a*B)*arctan(sqrt(b)*sqrt(x)/sqrt(a))/b**(S(9)/S(2)) + S(2)*a**S(2)*(A*b - a*B)*sqrt(x)/b**S(4)], [x**m*(a + b*x)**S(3)*(A + B*x), x, S(2), a**S(3)*A*x**(S(1) + m)/(S(1) + m) + a**S(2)*(S(3)*A*b + a*B)*x**(S(2) + m)/(S(2) + m) + S(3)*a*b*(A*b + a*B)*x**(S(3) + m)/(S(3) + m) + b**S(2)*(A*b + S(3)*a*B)*x**(S(4) + m)/(S(4) + m) + b**S(3)*B*x**(S(5) + m)/(S(5) + m)], [x**m*(c + d*x)**S(3)/(a + b*x), x, S(7), d*(S(3)*b**S(2)*c**S(2) - S(3)*a*b*c*d + a**S(2)*d**S(2))*x**(S(1) + m)/(b**S(3)*(S(1) + m)) + d**S(2)*(S(3)*b*c - a*d)*x**(S(2) + m)/(b**S(2)*(S(2) + m)) + d**S(3)*x**(S(3) + m)/(b*(S(3) + m)) + (b*c - a*d)**S(3)*x**(S(1) + m)*hypergeom([S(1), S(1)], [S(1) - m], a/(a + b*x))/(b**S(3)*m*(a + b*x)), c**S(2)*d*x**(S(1) + m)/(b*(S(1) + m)) + c*d*(b*c - a*d)*x**(S(1) + m)/(b**S(2)*(S(1) + m)) + d*(b*c - a*d)**S(2)*x**(S(1) + m)/(b**S(3)*(S(1) + m)) + S(2)*c*d**S(2)*x**(S(2) + m)/(b*(S(2) + m)) + d**S(2)*(b*c - a*d)*x**(S(2) + m)/(b**S(2)*(S(2) + m)) + d**S(3)*x**(S(3) + m)/(b*(S(3) + m)) + (b*c - a*d)**S(3)*x**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], - b*x/a)/(a*b**S(3)*(S(1) + m))], [x**m*(c + d*x)**S(2)/(a + b*x), x, S(5), c*d*x**(S(1) + m)/(b*(S(1) + m)) + d*(b*c - a*d)*x**(S(1) + m)/(b**S(2)*(S(1) + m)) + d**S(2)*x**(S(2) + m)/(b*(S(2) + m)) + (b*c - a*d)**S(2)*x**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], - b*x/a)/(a*b**S(2)*(S(1) + m))], [b**S(2)*x**m/(b + a*x**S(2))**S(2), x, S(2), x**(S(1) + m)*hypergeom([S(2), S(1)/S(2)*(S(1) + m)], [S(1)/S(2)*(S(3) + m)], - a*x**S(2)/b)/(S(1) + m)], [x**m/((S(1) - x*sqrt(a)/sqrt( - b))**S(2)*(S(1) + x*sqrt(a)/sqrt( - b))**S(2)), x, S(2), x**(S(1) + m)*hypergeom([S(2), S(1)/S(2)*(S(1) + m)], [S(1)/S(2)*(S(3) + m)], - a*x**S(2)/b)/(S(1) + m)], [x**S(3)*(A + B*x)*sqrt(a + b*x), x, S(2), - S(2)/S(3)*a**S(3)*(A*b - a*B)*(a + b*x)**(S(3)/S(2))/b**S(5) + S(2)/S(5)*a**S(2)*(S(3)*A*b - S(4)*a*B)*(a + b*x)**(S(5)/S(2))/b**S(5) - S(6)/S(7)*a*(A*b - S(2)*a*B)*(a + b*x)**(S(7)/S(2))/b**S(5) + S(2)/S(9)*(A*b - S(4)*a*B)*(a + b*x)**(S(9)/S(2))/b**S(5) + S(2)/S(11)*B*(a + b*x)**(S(11)/S(2))/b**S(5)], [x**S(3)*(A + B*x)/sqrt(a + b*x), x, S(2), S(2)/S(3)*a**S(2)*(S(3)*A*b - S(4)*a*B)*(a + b*x)**(S(3)/S(2))/b**S(5) - S(6)/S(5)*a*(A*b - S(2)*a*B)*(a + b*x)**(S(5)/S(2))/b**S(5) + S(2)/S(7)*(A*b - S(4)*a*B)*(a + b*x)**(S(7)/S(2))/b**S(5) + S(2)/S(9)*B*(a + b*x)**(S(9)/S(2))/b**S(5) - S(2)*a**S(3)*(A*b - a*B)*sqrt(a + b*x)/b**S(5)], [x**(S(5)/S(2))*(A + B*x)*sqrt(a + b*x), x, S(7), S(1)/S(5)*B*x**(S(7)/S(2))*(a + b*x)**(S(3)/S(2))/b - S(1)/S(128)*a**S(4)*(S(10)*A*b - S(7)*a*B)*arctanh(sqrt(b)*sqrt(x)/sqrt(a + b*x))/b**(S(9)/S(2)) - S(1)/S(192)*a**S(2)*(S(10)*A*b - S(7)*a*B)*x**(S(3)/S(2))*sqrt(a + b*x)/b**S(3) + S(1)/S(240)*a*(S(10)*A*b - S(7)*a*B)*x**(S(5)/S(2))*sqrt(a + b*x)/b**S(2) + S(1)/S(40)*(S(10)*A*b - S(7)*a*B)*x**(S(7)/S(2))*sqrt(a + b*x)/b + S(1)/S(128)*a**S(3)*(S(10)*A*b - S(7)*a*B)*sqrt(x)*sqrt(a + b*x)/b**S(4)], [x**(S(3)/S(2))*(A + B*x)*sqrt(a + b*x), x, S(6), S(1)/S(4)*B*x**(S(5)/S(2))*(a + b*x)**(S(3)/S(2))/b + S(1)/S(64)*a**S(3)*(S(8)*A*b - S(5)*a*B)*arctanh(sqrt(b)*sqrt(x)/sqrt(a + b*x))/b**(S(7)/S(2)) + S(1)/S(96)*a*(S(8)*A*b - S(5)*a*B)*x**(S(3)/S(2))*sqrt(a + b*x)/b**S(2) + S(1)/S(24)*(S(8)*A*b - S(5)*a*B)*x**(S(5)/S(2))*sqrt(a + b*x)/b - S(1)/S(64)*a**S(2)*(S(8)*A*b - S(5)*a*B)*sqrt(x)*sqrt(a + b*x)/b**S(3)], [x**(S(7)/S(2))*(A + B*x)/sqrt(a + b*x), x, S(7), S(7)/S(128)*a**S(4)*(S(10)*A*b - S(9)*a*B)*arctanh(sqrt(b)*sqrt(x)/sqrt(a + b*x))/b**(S(11)/S(2)) + S(7)/S(192)*a**S(2)*(S(10)*A*b - S(9)*a*B)*x**(S(3)/S(2))*sqrt(a + b*x)/b**S(4) - S(7)/S(240)*a*(S(10)*A*b - S(9)*a*B)*x**(S(5)/S(2))*sqrt(a + b*x)/b**S(3) + S(1)/S(40)*(S(10)*A*b - S(9)*a*B)*x**(S(7)/S(2))*sqrt(a + b*x)/b**S(2) + S(1)/S(5)*B*x**(S(9)/S(2))*sqrt(a + b*x)/b - S(7)/S(128)*a**S(3)*(S(10)*A*b - S(9)*a*B)*sqrt(x)*sqrt(a + b*x)/b**S(5)], [x**(S(5)/S(2))*(A + B*x)/sqrt(a + b*x), x, S(6), - S(5)/S(64)*a**S(3)*(S(8)*A*b - S(7)*a*B)*arctanh(sqrt(b)*sqrt(x)/sqrt(a + b*x))/b**(S(9)/S(2)) - S(5)/S(96)*a*(S(8)*A*b - S(7)*a*B)*x**(S(3)/S(2))*sqrt(a + b*x)/b**S(3) + S(1)/S(24)*(S(8)*A*b - S(7)*a*B)*x**(S(5)/S(2))*sqrt(a + b*x)/b**S(2) + S(1)/S(4)*B*x**(S(7)/S(2))*sqrt(a + b*x)/b + S(5)/S(64)*a**S(2)*(S(8)*A*b - S(7)*a*B)*sqrt(x)*sqrt(a + b*x)/b**S(4)], [x**S(3)*sqrt(a + b*x)*sqrt(c + d*x), x, S(6), S(1)/S(5)*x**S(2)*(a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) + S(1)/S(240)*(a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))*(S(35)*b**S(2)*c**S(2) + S(38)*a*b*c*d + S(35)*a**S(2)*d**S(2) - S(42)*b*d*(b*c + a*d)*x)/(b**S(3)*d**S(3)) + S(1)/S(128)*(b*c - a*d)**S(2)*(b*c + a*d)*(S(7)*b**S(2)*c**S(2) + S(2)*a*b*c*d + S(7)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(9)/S(2))*d**(S(9)/S(2))) - S(1)/S(64)*(b*c + a*d)*(S(7)*b**S(2)*c**S(2) + S(2)*a*b*c*d + S(7)*a**S(2)*d**S(2))*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(4)*d**S(3)) - S(1)/S(128)*(S(7)*b**S(4)*c**S(4) + S(2)*a*b**S(3)*c**S(3)*d - S(2)*a**S(3)*b*c*d**S(3) - S(7)*a**S(4)*d**S(4))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(4)*d**S(4))], [x**S(2)*sqrt(a + b*x)*sqrt(c + d*x), x, S(6), - S(5)/S(24)*(b*c + a*d)*(a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))/(b**S(2)*d**S(2)) + S(1)/S(4)*x*(a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) + S(1)/S(64)*(b*c - a*d)**S(2)*(S(4)*a*b*c*d - S(5)*(b*c + a*d)**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(7)/S(2))) - S(1)/S(32)*(S(4)*a*b*c*d - S(5)*(b*c + a*d)**S(2))*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(2)) - S(1)/S(64)*(b*c - a*d)*(S(4)*a*b*c*d - S(5)*(b*c + a*d)**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(3))], [x**S(3)*sqrt(a + b*x)/sqrt(c + d*x), x, S(5), S(1)/S(64)*(b*c - a*d)*(S(35)*b**S(3)*c**S(3) + S(15)*a*b**S(2)*c**S(2)*d + S(9)*a**S(2)*b*c*d**S(2) + S(5)*a**S(3)*d**S(3))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(9)/S(2))) + S(1)/S(4)*x**S(2)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b*d) + S(1)/S(96)*(a + b*x)**(S(3)/S(2))*(S(35)*b**S(2)*c**S(2) + S(22)*a*b*c*d + S(15)*a**S(2)*d**S(2) - S(4)*b*d*(S(7)*b*c + S(5)*a*d)*x)*sqrt(c + d*x)/(b**S(3)*d**S(3)) - S(1)/S(64)*(S(35)*b**S(3)*c**S(3) + S(15)*a*b**S(2)*c**S(2)*d + S(9)*a**S(2)*b*c*d**S(2) + S(5)*a**S(3)*d**S(3))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(4))], [x**S(2)*sqrt(a + b*x)/sqrt(c + d*x), x, S(5), - S(1)/S(8)*(b*c - a*d)*(S(5)*b**S(2)*c**S(2) + S(2)*a*b*c*d + a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(7)/S(2))) - S(1)/S(12)*(S(5)*b*c + S(3)*a*d)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(2)) + S(1)/S(3)*x*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b*d) + S(1)/S(8)*(S(5)*b**S(2)*c**S(2) + S(2)*a*b*c*d + a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d**S(3))], [x**S(2)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x), x, S(7), - S(1)/S(40)*(S(7)*b*c + S(5)*a*d)*(a + b*x)**(S(5)/S(2))*(c + d*x)**(S(3)/S(2))/(b**S(2)*d**S(2)) + S(1)/S(5)*x*(a + b*x)**(S(5)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) + S(1)/S(128)*(b*c - a*d)**S(3)*(S(7)*b**S(2)*c**S(2) + S(6)*a*b*c*d + S(3)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(9)/S(2))) + S(1)/S(192)*(b*c - a*d)*(S(7)*b**S(2)*c**S(2) + S(6)*a*b*c*d + S(3)*a**S(2)*d**S(2))*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(3)) + S(1)/S(48)*(S(7)*b**S(2)*c**S(2) + S(6)*a*b*c*d + S(3)*a**S(2)*d**S(2))*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(2)) - S(1)/S(128)*(b*c - a*d)**S(2)*(S(7)*b**S(2)*c**S(2) + S(6)*a*b*c*d + S(3)*a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(4))], [x*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x), x, S(6), S(1)/S(4)*(a + b*x)**(S(5)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) - S(1)/S(64)*(b*c - a*d)**S(3)*(S(5)*b*c + S(3)*a*d)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(7)/S(2))) - S(1)/S(96)*(b*c - a*d)*(S(5)*b*c + S(3)*a*d)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(2)) - S(1)/S(24)*(S(5)*b*c + S(3)*a*d)*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b**S(2)*d) + S(1)/S(64)*(b*c - a*d)**S(2)*(S(5)*b*c + S(3)*a*d)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d**S(3))], [x**S(2)*(a + b*x)**(S(3)/S(2))/sqrt(c + d*x), x, S(6), S(1)/S(64)*(b*c - a*d)**S(2)*(S(35)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(3)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(9)/S(2))) + S(1)/S(96)*(S(35)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(3)*a**S(2)*d**S(2))*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(3)) - S(1)/S(24)*(S(7)*b*c + S(3)*a*d)*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(2)) + S(1)/S(4)*x*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b*d) - S(1)/S(64)*(b*c - a*d)*(S(35)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(3)*a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d**S(4))], [x*(a + b*x)**(S(3)/S(2))/sqrt(c + d*x), x, S(5), - S(1)/S(8)*(b*c - a*d)**S(2)*(S(5)*b*c + a*d)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(3)/S(2))*d**(S(7)/S(2))) - S(1)/S(12)*(S(5)*b*c + a*d)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b*d**S(2)) + S(1)/S(3)*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b*d) + S(1)/S(8)*(b*c - a*d)*(S(5)*b*c + a*d)*sqrt(a + b*x)*sqrt(c + d*x)/(b*d**S(3))], [x**S(2)*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x), x, S(8), - S(1)/S(60)*(S(9)*b*c + S(5)*a*d)*(a + b*x)**(S(7)/S(2))*(c + d*x)**(S(3)/S(2))/(b**S(2)*d**S(2)) + S(1)/S(6)*x*(a + b*x)**(S(7)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) - S(1)/S(512)*(b*c - a*d)**S(4)*(S(21)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(5)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(11)/S(2))) - S(1)/S(768)*(b*c - a*d)**S(2)*(S(21)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(5)*a**S(2)*d**S(2))*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(4)) + S(1)/S(960)*(b*c - a*d)*(S(21)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(5)*a**S(2)*d**S(2))*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(3)) + S(1)/S(160)*(S(21)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(5)*a**S(2)*d**S(2))*(a + b*x)**(S(7)/S(2))*sqrt(c + d*x)/(b**S(3)*d**S(2)) + S(1)/S(512)*(b*c - a*d)**S(3)*(S(21)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(5)*a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(5))], [x*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x), x, S(7), S(1)/S(5)*(a + b*x)**(S(7)/S(2))*(c + d*x)**(S(3)/S(2))/(b*d) + S(1)/S(128)*(b*c - a*d)**S(4)*(S(7)*b*c + S(3)*a*d)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(9)/S(2))) + S(1)/S(192)*(b*c - a*d)**S(2)*(S(7)*b*c + S(3)*a*d)*(a + b*x)**(S(3)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(3)) - S(1)/S(240)*(b*c - a*d)*(S(7)*b*c + S(3)*a*d)*(a + b*x)**(S(5)/S(2))*sqrt(c + d*x)/(b**S(2)*d**S(2)) - S(1)/S(40)*(S(7)*b*c + S(3)*a*d)*(a + b*x)**(S(7)/S(2))*sqrt(c + d*x)/(b**S(2)*d) - S(1)/S(128)*(b*c - a*d)**S(3)*(S(7)*b*c + S(3)*a*d)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d**S(4))], [x**S(2)*sqrt(c + d*x)/sqrt(a + b*x), x, S(5), S(1)/S(8)*(b*c - a*d)*(b**S(2)*c**S(2) + S(2)*a*b*c*d + S(5)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(5)/S(2))) - S(1)/S(12)*(S(3)*b*c + S(5)*a*d)*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/(b**S(2)*d**S(2)) + S(1)/S(3)*x*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/(b*d) + S(1)/S(8)*(b**S(2)*c**S(2) + S(2)*a*b*c*d + S(5)*a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(2))], [x*sqrt(c + d*x)/sqrt(a + b*x), x, S(4), - S(1)/S(4)*(b*c - a*d)*(b*c + S(3)*a*d)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(3)/S(2))) + S(1)/S(2)*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/(b*d) - S(1)/S(4)*(b*c + S(3)*a*d)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d)], [x**S(3)/(sqrt(a + b*x)*sqrt(c + d*x)), x, S(4), - S(1)/S(8)*(b*c + a*d)*(S(5)*b**S(2)*c**S(2) - S(2)*a*b*c*d + S(5)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(7)/S(2))) + S(1)/S(3)*x**S(2)*sqrt(a + b*x)*sqrt(c + d*x)/(b*d) + S(1)/S(24)*(S(15)*b**S(2)*c**S(2) + S(14)*a*b*c*d + S(15)*a**S(2)*d**S(2) - S(10)*b*d*(b*c + a*d)*x)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(3))], [x**S(2)/(sqrt(a + b*x)*sqrt(c + d*x)), x, S(4), - S(1)/S(4)*(S(4)*a*b*c*d - S(3)*(b*c + a*d)**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(5)/S(2))) - S(3)/S(4)*(b*c + a*d)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(2)*d**S(2)) + S(1)/S(2)*x*sqrt(a + b*x)*sqrt(c + d*x)/(b*d)], [x**S(4)/((a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))), x, S(5), S(3)/S(4)*(S(5)*b**S(2)*c**S(2) + S(6)*a*b*c*d + S(5)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(7)/S(2))*d**(S(7)/S(2))) + S(2)*a*x**S(3)/(b*(b*c - a*d)*sqrt(a + b*x)*sqrt(c + d*x)) - S(2)*c*(b*c + a*d)*x**S(2)*sqrt(a + b*x)/(b*d*(b*c - a*d)**S(2)*sqrt(c + d*x)) - S(1)/S(4)*((b*c + a*d)*(S(15)*b**S(2)*c**S(2) - S(22)*a*b*c*d + S(15)*a**S(2)*d**S(2)) - S(2)*b*d*(S(5)*b**S(2)*c**S(2) - S(2)*a*b*c*d + S(5)*a**S(2)*d**S(2))*x)*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(3)*d**S(3)*(b*c - a*d)**S(2))], [x**S(3)/((a + b*x)**(S(3)/S(2))*(c + d*x)**(S(3)/S(2))), x, S(4), - S(3)*(b*c + a*d)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*d**(S(5)/S(2))) + S(2)*a*x**S(2)/(b*(b*c - a*d)*sqrt(a + b*x)*sqrt(c + d*x)) + (c*(S(3)*b**S(2)*c**S(2) - S(2)*a*b*c*d + S(3)*a**S(2)*d**S(2)) + d*(b*c - S(3)*a*d)*(b*c - a*d)*x)*sqrt(a + b*x)/(b**S(2)*d**S(2)*(b*c - a*d)**S(2)*sqrt(c + d*x))], [x**S(3)*(a + b*x)**(S(1)/S(4))/(c + d*x)**(S(1)/S(4)), x, S(7), - S(1)/S(512)*(S(195)*b**S(3)*c**S(3) + S(135)*a*b**S(2)*c**S(2)*d + S(105)*a**S(2)*b*c*d**S(2) + S(77)*a**S(3)*d**S(3))*(a + b*x)**(S(1)/S(4))*(c + d*x)**(S(3)/S(4))/(b**S(3)*d**S(4)) + S(1)/S(4)*x**S(2)*(a + b*x)**(S(5)/S(4))*(c + d*x)**(S(3)/S(4))/(b*d) + S(1)/S(384)*(a + b*x)**(S(5)/S(4))*(c + d*x)**(S(3)/S(4))*(S(117)*b**S(2)*c**S(2) + S(94)*a*b*c*d + S(77)*a**S(2)*d**S(2) - S(8)*b*d*(S(13)*b*c + S(11)*a*d)*x)/(b**S(3)*d**S(3)) + S(1)/S(1024)*(b*c - a*d)*(S(195)*b**S(3)*c**S(3) + S(135)*a*b**S(2)*c**S(2)*d + S(105)*a**S(2)*b*c*d**S(2) + S(77)*a**S(3)*d**S(3))*arctan(d**(S(1)/S(4))*(a + b*x)**(S(1)/S(4))/(b**(S(1)/S(4))*(c + d*x)**(S(1)/S(4))))/(b**(S(15)/S(4))*d**(S(17)/S(4))) + S(1)/S(1024)*(b*c - a*d)*(S(195)*b**S(3)*c**S(3) + S(135)*a*b**S(2)*c**S(2)*d + S(105)*a**S(2)*b*c*d**S(2) + S(77)*a**S(3)*d**S(3))*arctanh(d**(S(1)/S(4))*(a + b*x)**(S(1)/S(4))/(b**(S(1)/S(4))*(c + d*x)**(S(1)/S(4))))/(b**(S(15)/S(4))*d**(S(17)/S(4)))], [x**S(2)*(a + b*x)**(S(1)/S(4))/(c + d*x)**(S(1)/S(4)), x, S(7), S(1)/S(32)*(S(15)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(7)*a**S(2)*d**S(2))*(a + b*x)**(S(1)/S(4))*(c + d*x)**(S(3)/S(4))/(b**S(2)*d**S(3)) - S(1)/S(24)*(S(9)*b*c + S(7)*a*d)*(a + b*x)**(S(5)/S(4))*(c + d*x)**(S(3)/S(4))/(b**S(2)*d**S(2)) + S(1)/S(3)*x*(a + b*x)**(S(5)/S(4))*(c + d*x)**(S(3)/S(4))/(b*d) - S(1)/S(64)*(b*c - a*d)*(S(15)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(7)*a**S(2)*d**S(2))*arctan(d**(S(1)/S(4))*(a + b*x)**(S(1)/S(4))/(b**(S(1)/S(4))*(c + d*x)**(S(1)/S(4))))/(b**(S(11)/S(4))*d**(S(13)/S(4))) - S(1)/S(64)*(b*c - a*d)*(S(15)*b**S(2)*c**S(2) + S(10)*a*b*c*d + S(7)*a**S(2)*d**S(2))*arctanh(d**(S(1)/S(4))*(a + b*x)**(S(1)/S(4))/(b**(S(1)/S(4))*(c + d*x)**(S(1)/S(4))))/(b**(S(11)/S(4))*d**(S(13)/S(4)))], [x*(a + b*x)**n*(c + d*x), x, S(2), - a*(b*c - a*d)*(a + b*x)**(S(1) + n)/(b**S(3)*(S(1) + n)) + (b*c - S(2)*a*d)*(a + b*x)**(S(2) + n)/(b**S(3)*(S(2) + n)) + d*(a + b*x)**(S(3) + n)/(b**S(3)*(S(3) + n))], [x**S(2)*(a + b*x)**n/(c + d*x), x, S(3), - (b*c + a*d)*(a + b*x)**(S(1) + n)/(b**S(2)*d**S(2)*(S(1) + n)) + (a + b*x)**(S(2) + n)/(b**S(2)*d*(S(2) + n)) + c**S(2)*(a + b*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], - d*(a + b*x)/(b*c - a*d))/(d**S(2)*(b*c - a*d)*(S(1) + n))], [x*(a + b*x)**n/(c + d*x), x, S(2), (a + b*x)**(S(1) + n)/(b*d*(S(1) + n)) - c*(a + b*x)**(S(1) + n)*hypergeom([S(1), S(1) + n], [S(2) + n], - d*(a + b*x)/(b*c - a*d))/(d*(b*c - a*d)*(S(1) + n))], [x**m*(S(3) - S(2)*a*x)**(S(2) + n)*(S(6) + S(4)*a*x)**n, x, S(8), S(2)**n*S(9)**(S(1) + n)*x**(S(1) + m)*hypergeom([S(1)/S(2)*(S(1) + m), - n], [S(1)/S(2)*(S(3) + m)], S(4)/S(9)*a**S(2)*x**S(2))/(S(1) + m) - S(2)**(S(2) + n)*S(3)**(S(1) + S(2)*n)*a*x**(S(2) + m)*hypergeom([S(1)/S(2)*(S(2) + m), - n], [S(1)/S(2)*(S(4) + m)], S(4)/S(9)*a**S(2)*x**S(2))/(S(2) + m) + S(2)**(S(2) + n)*S(9)**n*a**S(2)*x**(S(3) + m)*hypergeom([S(1)/S(2)*(S(3) + m), - n], [S(1)/S(2)*(S(5) + m)], S(4)/S(9)*a**S(2)*x**S(2))/(S(3) + m)], [x**m*(S(3) - S(2)*a*x)**(S(1) + n)*(S(6) + S(4)*a*x)**n, x, S(5), S(2)**n*S(3)**(S(1) + S(2)*n)*x**(S(1) + m)*hypergeom([S(1)/S(2)*(S(1) + m), - n], [S(1)/S(2)*(S(3) + m)], S(4)/S(9)*a**S(2)*x**S(2))/(S(1) + m) - S(2)**(S(1) + n)*S(9)**n*a*x**(S(2) + m)*hypergeom([S(1)/S(2)*(S(2) + m), - n], [S(1)/S(2)*(S(4) + m)], S(4)/S(9)*a**S(2)*x**S(2))/(S(2) + m)], [(a + b*x)*(A + B*x)*(d + e*x)**m, x, S(2), (b*d - a*e)*(B*d - A*e)*(d + e*x)**(S(1) + m)/(e**S(3)*(S(1) + m)) - (S(2)*b*B*d - A*b*e - a*B*e)*(d + e*x)**(S(2) + m)/(e**S(3)*(S(2) + m)) + b*B*(d + e*x)**(S(3) + m)/(e**S(3)*(S(3) + m))], [(A + B*x)*(d + e*x)**S(5)/(a + b*x), x, S(2), (A*b - a*B)*e*(b*d - a*e)**S(4)*x/b**S(6) + S(1)/S(2)*(A*b - a*B)*(b*d - a*e)**S(3)*(d + e*x)**S(2)/b**S(5) + S(1)/S(3)*(A*b - a*B)*(b*d - a*e)**S(2)*(d + e*x)**S(3)/b**S(4) + S(1)/S(4)*(A*b - a*B)*(b*d - a*e)*(d + e*x)**S(4)/b**S(3) + S(1)/S(5)*(A*b - a*B)*(d + e*x)**S(5)/b**S(2) + S(1)/S(6)*B*(d + e*x)**S(6)/(b*e) + (A*b - a*B)*(b*d - a*e)**S(5)*log(a + b*x)/b**S(7)], [(S(1) - S(2)*x)*(S(2) + S(3)*x)**m*(S(3) + S(5)*x), x, S(2), - S(7)/S(27)*(S(2) + S(3)*x)**(S(1) + m)/(S(1) + m) + S(37)/S(27)*(S(2) + S(3)*x)**(S(2) + m)/(S(2) + m) - S(10)/S(27)*(S(2) + S(3)*x)**(S(3) + m)/(S(3) + m)], [(S(1) - S(2)*x)*(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x), x, S(2), - S(7)/S(243)*(S(2) + S(3)*x)**S(9) + S(37)/S(270)*(S(2) + S(3)*x)**S(10) - S(10)/S(297)*(S(2) + S(3)*x)**S(11)], [(S(1) - S(2)*x)*(S(2) + S(3)*x)**m/(S(3) + S(5)*x), x, S(2), - S(2)/S(15)*(S(2) + S(3)*x)**(S(1) + m)/(S(1) + m) - S(11)/S(5)*(S(2) + S(3)*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], S(5)*(S(2) + S(3)*x))/(S(1) + m)], [(S(1) - S(2)*x)*(S(2) + S(3)*x)**S(6)/(S(3) + S(5)*x), x, S(2), S(1666663)/S(78125)*x + S(1777779)/S(31250)*x**S(2) + S(152469)/S(3125)*x**S(3) - S(152469)/S(2500)*x**S(4) - S(106677)/S(625)*x**S(5) - S(7047)/S(50)*x**S(6) - S(1458)/S(35)*x**S(7) + S(11)/S(390625)*log(S(3) + S(5)*x)], [(S(1) - S(2)*x)**S(2)*(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x), x, S(2), - S(49)/S(729)*(S(2) + S(3)*x)**S(9) + S(91)/S(270)*(S(2) + S(3)*x)**S(10) - S(16)/S(99)*(S(2) + S(3)*x)**S(11) + S(5)/S(243)*(S(2) + S(3)*x)**S(12)], [(S(1) - S(2)*x)**S(2)*(S(2) + S(3)*x)**S(7)*(S(3) + S(5)*x), x, S(2), - S(49)/S(648)*(S(2) + S(3)*x)**S(8) + S(91)/S(243)*(S(2) + S(3)*x)**S(9) - S(8)/S(45)*(S(2) + S(3)*x)**S(10) + S(20)/S(891)*(S(2) + S(3)*x)**S(11)], [(S(1) - S(2)*x)**S(2)*(S(2) + S(3)*x)**S(7)/(S(3) + S(5)*x), x, S(2), S(83333293)/S(1953125)*x + S(80555569)/S(781250)*x**S(2) + S(1327159)/S(78125)*x**S(3) - S(20577159)/S(62500)*x**S(4) - S(7315947)/S(15625)*x**S(5) + S(130383)/S(1250)*x**S(6) + S(672867)/S(875)*x**S(7) + S(16767)/S(25)*x**S(8) + S(972)/S(5)*x**S(9) + S(121)/S(9765625)*log(S(3) + S(5)*x)], [(S(1) - S(2)*x)**S(2)*(S(2) + S(3)*x)**S(6)/(S(3) + S(5)*x), x, S(2), S(8333293)/S(390625)*x + S(5555569)/S(156250)*x**S(2) - S(422841)/S(15625)*x**S(3) - S(1677159)/S(12500)*x**S(4) - S(228447)/S(3125)*x**S(5) + S(35883)/S(250)*x**S(6) + S(34992)/S(175)*x**S(7) + S(729)/S(10)*x**S(8) + S(121)/S(1953125)*log(S(3) + S(5)*x)], [(S(1) - S(2)*x)**S(3)*(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x), x, S(2), - S(343)/S(2187)*(S(2) + S(3)*x)**S(9) + S(2009)/S(2430)*(S(2) + S(3)*x)**S(10) - S(518)/S(891)*(S(2) + S(3)*x)**S(11) + S(107)/S(729)*(S(2) + S(3)*x)**S(12) - S(40)/S(3159)*(S(2) + S(3)*x)**S(13)], [(S(1) - S(2)*x)**S(3)*(S(2) + S(3)*x)**S(7)*(S(3) + S(5)*x), x, S(2), S(384)*x + S(1184)*x**S(2) + S(480)*x**S(3) - S(5148)*x**S(4) - S(48968)/S(5)*x**S(5) + S(3514)*x**S(6) + S(29106)*x**S(7) + S(208035)/S(8)*x**S(8) - S(15507)*x**S(9) - S(217971)/S(5)*x**S(10) - S(329508)/S(11)*x**S(11) - S(7290)*x**S(12)], [(S(1) - S(2)*x)**S(3)*(S(2) + S(3)*x)**S(6)/(S(3) + S(5)*x), x, S(2), S(41666223)/S(1953125)*x + S(11111259)/S(781250)*x**S(2) - S(17453753)/S(234375)*x**S(3) - S(5848749)/S(62500)*x**S(4) + S(2212083)/S(15625)*x**S(5) + S(331713)/S(1250)*x**S(6) - S(40338)/S(875)*x**S(7) - S(13851)/S(50)*x**S(8) - S(648)/S(5)*x**S(9) + S(1331)/S(9765625)*log(S(3) + S(5)*x)], [(S(1) - S(2)*x)**S(3)*(S(2) + S(3)*x)**S(5)/(S(3) + S(5)*x), x, S(2), S(4166223)/S(390625)*x - S(138741)/S(156250)*x**S(2) - S(1703753)/S(46875)*x**S(3) - S(73749)/S(12500)*x**S(4) + S(243333)/S(3125)*x**S(5) + S(4419)/S(125)*x**S(6) - S(11988)/S(175)*x**S(7) - S(243)/S(5)*x**S(8) + S(1331)/S(1953125)*log(S(3) + S(5)*x)], [(S(2) + S(3)*x)**m*(S(3) + S(5)*x)/(S(1) - S(2)*x), x, S(2), - S(5)/S(6)*(S(2) + S(3)*x)**(S(1) + m)/(S(1) + m) + S(11)/S(14)*(S(2) + S(3)*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], S(2)/S(7)*(S(2) + S(3)*x))/(S(1) + m)], [(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x)/(S(1) - S(2)*x), x, S(2), - S(63019595)/S(512)*x - S(60332619)/S(512)*x**S(2) - S(17391129)/S(128)*x**S(3) - S(37722699)/S(256)*x**S(4) - S(21272139)/S(160)*x**S(5) - S(2929689)/S(32)*x**S(6) - S(353565)/S(8)*x**S(7) - S(422091)/S(32)*x**S(8) - S(3645)/S(2)*x**S(9) - S(63412811)/S(1024)*log(S(1) - S(2)*x)], [(S(2) + S(3)*x)**m/((S(1) - S(2)*x)*(S(3) + S(5)*x)), x, S(3), S(2)/S(77)*(S(2) + S(3)*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], S(2)/S(7)*(S(2) + S(3)*x))/(S(1) + m) - S(5)/S(11)*(S(2) + S(3)*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], S(5)*(S(2) + S(3)*x))/(S(1) + m)], [(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**S(2), x, S(2), S(63412811)/S(1024)/(S(1) - S(2)*x) + S(91609881)/S(256)*x + S(122887143)/S(512)*x**S(2) + S(5892813)/S(32)*x**S(3) + S(32991057)/S(256)*x**S(4) + S(5859459)/S(80)*x**S(5) + S(976617)/S(32)*x**S(6) + S(56862)/S(7)*x**S(7) + S(32805)/S(32)*x**S(8) + S(246239357)/S(1024)*log(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(7)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**S(2), x, S(2), S(9058973)/S(512)/(S(1) - S(2)*x) + S(22333965)/S(256)*x + S(873207)/S(16)*x**S(2) + S(2399985)/S(64)*x**S(3) + S(1423899)/S(64)*x**S(4) + S(793881)/S(80)*x**S(5) + S(11421)/S(4)*x**S(6) + S(10935)/S(28)*x**S(7) + S(15647317)/S(256)*log(S(1) - S(2)*x)], [(a + b*x)**m/(e + f*x)**S(2), x, S(1), b*(a + b*x)**(S(1) + m)*hypergeom([S(2), S(1) + m], [S(2) + m], - f*(a + b*x)/(b*e - a*f))/((b*e - a*f)**S(2)*(S(1) + m))], [(a + b*x)**m/((c + d*x)*(e + f*x)**S(2)), x, S(4), - f*(a + b*x)**(S(1) + m)/((b*e - a*f)*(d*e - c*f)*(e + f*x)) + d**S(2)*(a + b*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], - d*(a + b*x)/(b*c - a*d))/((b*c - a*d)*(d*e - c*f)**S(2)*(S(1) + m)) + f*(a*d*f - b*(d*e*(S(1) - m) + c*f*m))*(a + b*x)**(S(1) + m)*hypergeom([S(1), S(1) + m], [S(2) + m], - f*(a + b*x)/(b*e - a*f))/((b*e - a*f)**S(2)*(d*e - c*f)**S(2)*(S(1) + m))], [(S(2) + S(3)*x)**S(7)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**S(3), x, S(2), S(9058973)/S(1024)/(S(1) - S(2)*x)**S(2) + ( - S(15647317)/S(256))/(S(1) - S(2)*x) - S(24960933)/S(256)*x - S(10989621)/S(256)*x**S(2) - S(631611)/S(32)*x**S(3) - S(235467)/S(32)*x**S(4) - S(147987)/S(80)*x**S(5) - S(3645)/S(16)*x**S(6) - S(23647449)/S(256)*log(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(8)/((S(1) - S(2)*x)**S(3)*(S(3) + S(5)*x)), x, S(2), S(5764801)/S(5632)/(S(1) - S(2)*x)**S(2) + ( - S(188591347)/S(30976))/(S(1) - S(2)*x) - S(2941619571)/S(400000)*x - S(110180817)/S(40000)*x**S(2) - S(124416)/S(125)*x**S(3) - S(408969)/S(1600)*x**S(4) - S(6561)/S(200)*x**S(5) - S(2644396573)/S(340736)*log(S(1) - S(2)*x) + S(1)/S(20796875)*log(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(7)/((S(1) - S(2)*x)**S(3)*(S(3) + S(5)*x)), x, S(2), S(823543)/S(2816)/(S(1) - S(2)*x)**S(2) + ( - S(5764801)/S(3872))/(S(1) - S(2)*x) - S(26161299)/S(20000)*x - S(792423)/S(2000)*x**S(2) - S(40581)/S(400)*x**S(3) - S(2187)/S(160)*x**S(4) - S(269063263)/S(170368)*log(S(1) - S(2)*x) + S(1)/S(4159375)*log(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(6)*(S(3) + S(5)*x)*sqrt(S(1) - S(2)*x), x, S(2), - S(1294139)/S(384)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(3916031)/S(640)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(725445)/S(128)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(406455)/S(128)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(1580985)/S(1408)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(409941)/S(1664)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(19683)/S(640)*(S(1) - S(2)*x)**(S(15)/S(2)) + S(3645)/S(2176)*(S(1) - S(2)*x)**(S(17)/S(2))], [(S(2) + S(3)*x)**S(5)*(S(3) + S(5)*x)*sqrt(S(1) - S(2)*x), x, S(2), - S(184877)/S(192)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(12005)/S(8)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(74235)/S(64)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(4165)/S(8)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(97335)/S(704)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(81)/S(4)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(81)/S(64)*(S(1) - S(2)*x)**(S(15)/S(2))], [(S(2) + S(3)*x)**S(4)*sqrt(S(1) - S(2)*x)/(S(3) + S(5)*x), x, S(5), - S(45473)/S(5000)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(34371)/S(5000)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(2889)/S(1400)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(9)/S(40)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(2)/S(3125)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(2)/S(3125)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)/(S(3) + S(5)*x), x, S(5), - S(1299)/S(500)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(162)/S(125)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(27)/S(140)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(2)/S(625)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(2)/S(625)*sqrt(S(1) - S(2)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(6)*(S(3) + S(5)*x), x, S(2), - S(1294139)/S(640)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(559433)/S(128)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(564235)/S(128)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(3658095)/S(1408)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(1580985)/S(1664)*(S(1) - S(2)*x)**(S(13)/S(2)) + S(136647)/S(640)*(S(1) - S(2)*x)**(S(15)/S(2)) - S(59049)/S(2176)*(S(1) - S(2)*x)**(S(17)/S(2)) + S(3645)/S(2432)*(S(1) - S(2)*x)**(S(19)/S(2))], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(5)*(S(3) + S(5)*x), x, S(2), - S(184877)/S(320)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(8575)/S(8)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(173215)/S(192)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(37485)/S(88)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(97335)/S(832)*(S(1) - S(2)*x)**(S(13)/S(2)) + S(351)/S(20)*(S(1) - S(2)*x)**(S(15)/S(2)) - S(1215)/S(1088)*(S(1) - S(2)*x)**(S(17)/S(2))], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(6)/(S(3) + S(5)*x), x, S(6), S(2)/S(234375)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(167115051)/S(2500000)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(70752609)/S(700000)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(665817)/S(10000)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(507627)/S(22000)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(43011)/S(10400)*(S(1) - S(2)*x)**(S(13)/S(2)) + S(243)/S(800)*(S(1) - S(2)*x)**(S(15)/S(2)) - S(22)/S(390625)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(22)/S(390625)*sqrt(S(1) - S(2)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(5)/(S(3) + S(5)*x), x, S(6), S(2)/S(46875)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(4774713)/S(250000)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(806121)/S(35000)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(5673)/S(500)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(5751)/S(2200)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(243)/S(1040)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(22)/S(78125)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(22)/S(78125)*sqrt(S(1) - S(2)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(6)*(S(3) + S(5)*x), x, S(2), - S(184877)/S(128)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(3916031)/S(1152)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(5078115)/S(1408)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(3658095)/S(1664)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(105399)/S(128)*(S(1) - S(2)*x)**(S(15)/S(2)) + S(409941)/S(2176)*(S(1) - S(2)*x)**(S(17)/S(2)) - S(59049)/S(2432)*(S(1) - S(2)*x)**(S(19)/S(2)) + S(1215)/S(896)*(S(1) - S(2)*x)**(S(21)/S(2))], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(5)*(S(3) + S(5)*x), x, S(2), - S(26411)/S(64)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(60025)/S(72)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(519645)/S(704)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(37485)/S(104)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(6489)/S(64)*(S(1) - S(2)*x)**(S(15)/S(2)) + S(1053)/S(68)*(S(1) - S(2)*x)**(S(17)/S(2)) - S(1215)/S(1216)*(S(1) - S(2)*x)**(S(19)/S(2))], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(4)/(S(3) + S(5)*x), x, S(7), S(22)/S(46875)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(2)/S(15625)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(136419)/S(35000)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(3819)/S(1000)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(2889)/S(2200)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(81)/S(520)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(242)/S(78125)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(242)/S(78125)*sqrt(S(1) - S(2)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(3)/(S(3) + S(5)*x), x, S(7), S(22)/S(9375)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(2)/S(3125)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(3897)/S(3500)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(18)/S(25)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(27)/S(220)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(242)/S(15625)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))*sqrt(S(11)/S(5)) + S(242)/S(15625)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(5)*(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x), x, S(2), S(60025)/S(24)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(103929)/S(64)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(5355)/S(8)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(10815)/S(64)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(1053)/S(44)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(1215)/S(832)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(184877)/S(64)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(4)*(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x), x, S(2), S(57281)/S(96)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(24843)/S(80)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(1539)/S(16)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(519)/S(32)*(S(1) - S(2)*x)**(S(9)/S(2)) + S(405)/S(352)*(S(1) - S(2)*x)**(S(11)/S(2)) - S(26411)/S(32)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(5)/((S(3) + S(5)*x)*sqrt(S(1) - S(2)*x)), x, S(4), S(268707)/S(5000)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(51057)/S(2500)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(5751)/S(1400)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(27)/S(80)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(2)/S(3125)*arctanh(sqrt(S(5)/S(11))*sqrt(S(1) - S(2)*x))/sqrt(S(55)) - S(4774713)/S(50000)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(7)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)), x, S(2), - S(7882483)/S(128)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(4084101)/S(128)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(787185)/S(64)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(422919)/S(128)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(821583)/S(1408)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(101331)/S(1664)*(S(1) - S(2)*x)**(S(13)/S(2)) - S(729)/S(256)*(S(1) - S(2)*x)**(S(15)/S(2)) + S(9058973)/S(256)/sqrt(S(1) - S(2)*x) + S(15647317)/S(128)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(6)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)), x, S(2), - S(1692705)/S(128)*(S(1) - S(2)*x)**(S(3)/S(2)) + S(731619)/S(128)*(S(1) - S(2)*x)**(S(5)/S(2)) - S(225855)/S(128)*(S(1) - S(2)*x)**(S(7)/S(2)) + S(45549)/S(128)*(S(1) - S(2)*x)**(S(9)/S(2)) - S(59049)/S(1408)*(S(1) - S(2)*x)**(S(11)/S(2)) + S(3645)/S(1664)*(S(1) - S(2)*x)**(S(13)/S(2)) + S(1294139)/S(128)/sqrt(S(1) - S(2)*x) + S(3916031)/S(128)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(5)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(5)/S(2)), x, S(2), S(184877)/S(192)/(S(1) - S(2)*x)**(S(3)/S(2)) + S(12495)/S(8)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(19467)/S(64)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(1053)/S(28)*(S(1) - S(2)*x)**(S(7)/S(2)) - S(135)/S(64)*(S(1) - S(2)*x)**(S(9)/S(2)) + ( - S(60025)/S(8))/sqrt(S(1) - S(2)*x) - S(519645)/S(64)*sqrt(S(1) - S(2)*x)], [(S(2) + S(3)*x)**S(4)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(5)/S(2)), x, S(2), S(26411)/S(96)/(S(1) - S(2)*x)**(S(3)/S(2)) + S(3591)/S(16)*(S(1) - S(2)*x)**(S(3)/S(2)) - S(4671)/S(160)*(S(1) - S(2)*x)**(S(5)/S(2)) + S(405)/S(224)*(S(1) - S(2)*x)**(S(7)/S(2)) + ( - S(57281)/S(32))/sqrt(S(1) - S(2)*x) - S(24843)/S(16)*sqrt(S(1) - S(2)*x)], [(A + B*x)*(d + e*x)**(S(5)/S(2))*sqrt(a + b*x), x, S(7), - S(1)/S(48)*(b*d - a*e)*(S(3)*b*B*d - S(10)*A*b*e + S(7)*a*B*e)*(a + b*x)**(S(3)/S(2))*(d + e*x)**(S(3)/S(2))/(b**S(3)*e) - S(1)/S(40)*(S(3)*b*B*d - S(10)*A*b*e + S(7)*a*B*e)*(a + b*x)**(S(3)/S(2))*(d + e*x)**(S(5)/S(2))/(b**S(2)*e) + S(1)/S(5)*B*(a + b*x)**(S(3)/S(2))*(d + e*x)**(S(7)/S(2))/(b*e) + S(1)/S(128)*(b*d - a*e)**S(4)*(S(3)*b*B*d - S(10)*A*b*e + S(7)*a*B*e)*arctanh(sqrt(e)*sqrt(a + b*x)/(sqrt(b)*sqrt(d + e*x)))/(b**(S(9)/S(2))*e**(S(5)/S(2))) - S(1)/S(64)*(b*d - a*e)**S(2)*(S(3)*b*B*d - S(10)*A*b*e + S(7)*a*B*e)*(a + b*x)**(S(3)/S(2))*sqrt(d + e*x)/(b**S(4)*e) - S(1)/S(128)*(b*d - a*e)**S(3)*(S(3)*b*B*d - S(10)*A*b*e + S(7)*a*B*e)*sqrt(a + b*x)*sqrt(d + e*x)/(b**S(4)*e**S(2))], [(A + B*x)*(d + e*x)**(S(3)/S(2))*sqrt(a + b*x), x, S(6), - S(1)/S(24)*(S(3)*b*B*d - S(8)*A*b*e + S(5)*a*B*e)*(a + b*x)**(S(3)/S(2))*(d + e*x)**(S(3)/S(2))/(b**S(2)*e) + S(1)/S(4)*B*(a + b*x)**(S(3)/S(2))*(d + e*x)**(S(5)/S(2))/(b*e) + S(1)/S(64)*(b*d - a*e)**S(3)*(S(3)*b*B*d - S(8)*A*b*e + S(5)*a*B*e)*arctanh(sqrt(e)*sqrt(a + b*x)/(sqrt(b)*sqrt(d + e*x)))/(b**(S(7)/S(2))*e**(S(5)/S(2))) - S(1)/S(32)*(b*d - a*e)*(S(3)*b*B*d - S(8)*A*b*e + S(5)*a*B*e)*(a + b*x)**(S(3)/S(2))*sqrt(d + e*x)/(b**S(3)*e) - S(1)/S(64)*(b*d - a*e)**S(2)*(S(3)*b*B*d - S(8)*A*b*e + S(5)*a*B*e)*sqrt(a + b*x)*sqrt(d + e*x)/(b**S(3)*e**S(2))], [(A + B*x)*(d + e*x)**(S(5)/S(2))/sqrt(a + b*x), x, S(6), - S(5)/S(64)*(b*d - a*e)**S(3)*(b*B*d - S(8)*A*b*e + S(7)*a*B*e)*arctanh(sqrt(e)*sqrt(a + b*x)/(sqrt(b)*sqrt(d + e*x)))/(b**(S(9)/S(2))*e**(S(3)/S(2))) - S(5)/S(96)*(b*d - a*e)*(b*B*d - S(8)*A*b*e + S(7)*a*B*e)*(d + e*x)**(S(3)/S(2))*sqrt(a + b*x)/(b**S(3)*e) - S(1)/S(24)*(b*B*d - S(8)*A*b*e + S(7)*a*B*e)*(d + e*x)**(S(5)/S(2))*sqrt(a + b*x)/(b**S(2)*e) + S(1)/S(4)*B*(d + e*x)**(S(7)/S(2))*sqrt(a + b*x)/(b*e) - S(5)/S(64)*(b*d - a*e)**S(2)*(b*B*d - S(8)*A*b*e + S(7)*a*B*e)*sqrt(a + b*x)*sqrt(d + e*x)/(b**S(4)*e)], [(A + B*x)*(d + e*x)**(S(3)/S(2))/sqrt(a + b*x), x, S(5), - S(1)/S(8)*(b*d - a*e)**S(2)*(b*B*d - S(6)*A*b*e + S(5)*a*B*e)*arctanh(sqrt(e)*sqrt(a + b*x)/(sqrt(b)*sqrt(d + e*x)))/(b**(S(7)/S(2))*e**(S(3)/S(2))) - S(1)/S(12)*(b*B*d - S(6)*A*b*e + S(5)*a*B*e)*(d + e*x)**(S(3)/S(2))*sqrt(a + b*x)/(b**S(2)*e) + S(1)/S(3)*B*(d + e*x)**(S(5)/S(2))*sqrt(a + b*x)/(b*e) - S(1)/S(8)*(b*d - a*e)*(b*B*d - S(6)*A*b*e + S(5)*a*B*e)*sqrt(a + b*x)*sqrt(d + e*x)/(b**S(3)*e)], [(S(2) + S(3)*x)**S(4)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x), x, S(7), - S(333)/S(2000)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2)) - S(1)/S(20)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(3)*(S(3) + S(5)*x)**(S(3)/S(2)) - S(7)/S(640000)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2))*(S(231223) + S(140652)*x) + S(4122385421)/S(51200000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(34069301)/S(5120000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(374762311)/S(51200000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x), x, S(6), - S(3)/S(50)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2)) - S(21)/S(16000)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2))*(S(731) + S(444)*x) + S(39142411)/S(1280000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(323491)/S(128000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(3558401)/S(1280000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)/sqrt(S(3) + S(5)*x), x, S(5), S(525371)/S(64000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(3)/S(40)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x) - S(21)/S(6400)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(335) + S(216)*x)*sqrt(S(3) + S(5)*x) + S(47761)/S(64000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)/sqrt(S(3) + S(5)*x), x, S(5), S(3047)/S(800)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(23)/S(80)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) - S(1)/S(10)*(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)*sqrt(S(3) + S(5)*x) + S(277)/S(800)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x), x, S(7), - S(1)/S(20)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2)) - S(1)/S(160000)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2))*(S(88987) + S(63120)*x) + S(452517373)/S(25600000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(3739813)/S(7680000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) - S(339983)/S(384000)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) + S(41137943)/S(25600000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x), x, S(7), - S(567)/S(4000)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2)) - S(3)/S(50)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)*(S(3) + S(5)*x)**(S(3)/S(2)) + S(5487713)/S(640000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(45353)/S(192000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) - S(4123)/S(9600)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) + S(498883)/S(640000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(3)/sqrt(S(3) + S(5)*x), x, S(6), S(18648399)/S(3200000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(51373)/S(320000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) - S(3)/S(50)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x) - S(3)/S(80000)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(14629) + S(11580)*x)*sqrt(S(3) + S(5)*x) + S(1695309)/S(3200000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(3)/S(2))*(S(2) + S(3)*x)**S(2)/sqrt(S(3) + S(5)*x), x, S(6), S(109263)/S(32000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(301)/S(3200)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) - S(119)/S(800)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) - S(3)/S(40)*(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)*sqrt(S(3) + S(5)*x) + S(9933)/S(32000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x), x, S(8), - S(3)/S(70)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2)) - S(3)/S(280000)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2))*(S(33857) + S(26700)*x) + S(3735929329)/S(256000000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(30875449)/S(76800000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(2806859)/S(19200000)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) - S(255169)/S(640000)*(S(1) - S(2)*x)**(S(7)/S(2))*sqrt(S(3) + S(5)*x) + S(339629939)/S(256000000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x), x, S(8), - S(193)/S(2000)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(3) + S(5)*x)**(S(3)/S(2)) - S(1)/S(20)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(2) + S(3)*x)*(S(3) + S(5)*x)**(S(3)/S(2)) + S(105254149)/S(12800000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(869869)/S(3840000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(79079)/S(960000)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) - S(7189)/S(32000)*(S(1) - S(2)*x)**(S(7)/S(2))*sqrt(S(3) + S(5)*x) + S(9568559)/S(12800000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(4)/sqrt(S(3) + S(5)*x), x, S(8), S(12679836719)/S(1280000000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(104792039)/S(384000000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(9526549)/S(96000000)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) - S(271)/S(2800)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x) - S(3)/S(70)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x) - S(1)/S(22400000)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(12923401) + S(11603280)*x)*sqrt(S(3) + S(5)*x) + S(1152712429)/S(1280000000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(1) - S(2)*x)**(S(5)/S(2))*(S(2) + S(3)*x)**S(3)/sqrt(S(3) + S(5)*x), x, S(7), S(368012183)/S(64000000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(3041423)/S(19200000)*(S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x) + S(276493)/S(4800000)*(S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x) - S(1)/S(20)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x) - S(1)/S(160000)*(S(1) - S(2)*x)**(S(7)/S(2))*(S(52951) + S(47280)*x)*sqrt(S(3) + S(5)*x) + S(33455653)/S(64000000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x), x, S(6), S(1067352517)/S(2560000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(987)/S(4000)*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2))*sqrt(S(1) - S(2)*x) - S(3)/S(50)*(S(2) + S(3)*x)**S(3)*(S(3) + S(5)*x)**(S(3)/S(2))*sqrt(S(1) - S(2)*x) - S(21)/S(640000)*(S(3) + S(5)*x)**(S(3)/S(2))*(S(194923) + S(92040)*x)*sqrt(S(1) - S(2)*x) - S(97032047)/S(2560000)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x), x, S(5), S(677017)/S(5120)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(3)/S(40)*(S(2) + S(3)*x)**S(2)*(S(3) + S(5)*x)**(S(3)/S(2))*sqrt(S(1) - S(2)*x) - S(3)/S(1280)*(S(3) + S(5)*x)**(S(3)/S(2))*(S(865) + S(408)*x)*sqrt(S(1) - S(2)*x) - S(61547)/S(5120)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)/(sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)), x, S(5), S(10866247)/S(128000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(259)/S(800)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) - S(3)/S(40)*(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) - S(7)/S(128000)*(S(187559) + S(77820)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(3)/(sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)), x, S(4), S(44437)/S(1600)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) - S(1)/S(10)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) - S(1)/S(1600)*(S(5363) + S(2220)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(5)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)), x, S(7), - S(35439958001)/S(5120000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + (S(2) + S(3)*x)**S(5)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) + S(847637)/S(32000)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(10389)/S(1600)*(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(33)/S(20)*(S(2) + S(3)*x)**S(4)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(49)/S(5120000)*(S(87394471) + S(36265980)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)), x, S(6), - S(92108287)/S(51200)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + (S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) + S(2203)/S(320)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(27)/S(16)*(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(1)/S(51200)*(S(11129753) + S(4618500)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(5)/((S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x)), x, S(6), - S(291096141)/S(256000)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(7)/S(11)*(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) + S(76587)/S(17600)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(939)/S(880)*(S(2) + S(3)*x)**S(3)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(21)/S(2816000)*(S(18424549) + S(7645620)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)/((S(1) - S(2)*x)**(S(3)/S(2))*sqrt(S(3) + S(5)*x)), x, S(5), - S(184641)/S(640)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(7)/S(11)*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) + S(243)/S(220)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) + S(9)/S(7040)*(S(27269) + S(11316)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(5)/S(2)), x, S(6), S(13246251)/S(6400)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(1)/S(3)*(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)) - S(299)/S(66)*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) - S(697)/S(88)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) - S(1)/S(70400)*(S(17606479) + S(7306140)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(5)/S(2)), x, S(5), S(126513)/S(320)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(1)/S(3)*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)) - S(233)/S(66)*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) - S(1)/S(3520)*(S(168157) + S(69780)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(5)/((S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x)), x, S(6), S(8261577)/S(6400)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(7)/S(33)*(S(2) + S(3)*x)**S(4)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)) - S(2051)/S(726)*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) - S(23909)/S(4840)*(S(2) + S(3)*x)**S(2)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x) - S(1)/S(774400)*(S(120791143) + S(50124540)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(S(2) + S(3)*x)**S(4)/((S(1) - S(2)*x)**(S(5)/S(2))*sqrt(S(3) + S(5)*x)), x, S(5), S(392283)/S(1600)*arcsin(sqrt(S(2)/S(11))*sqrt(S(3) + S(5)*x))/sqrt(S(10)) + S(7)/S(33)*(S(2) + S(3)*x)**S(3)*sqrt(S(3) + S(5)*x)/(S(1) - S(2)*x)**(S(3)/S(2)) - S(1589)/S(726)*(S(2) + S(3)*x)**S(2)*sqrt(S(3) + S(5)*x)/sqrt(S(1) - S(2)*x) - S(1)/S(193600)*(S(5735477) + S(2380020)*x)*sqrt(S(1) - S(2)*x)*sqrt(S(3) + S(5)*x)], [(c + d*x)**(S(1)/S(2))/(x**S(2)*(a + b*x)**S(2)), x, S(7), (S(4)*b*c - a*d)*arctanh(sqrt(c + d*x)/sqrt(c))/(a**S(3)*sqrt(c)) - (S(4)*b*c - S(3)*a*d)*arctanh(sqrt(b)*sqrt(c + d*x)/sqrt(b*c - a*d))*sqrt(b)/(a**S(3)*sqrt(b*c - a*d)) - S(2)*b*sqrt(c + d*x)/(a**S(2)*(a + b*x)) - sqrt(c + d*x)/(a*x*(a + b*x))], [S(1)/(x**S(2)*(a + b*x)**S(2)*(c + d*x)**(S(1)/S(2))), x, S(7), (S(4)*b*c + a*d)*arctanh(sqrt(c + d*x)/sqrt(c))/(a**S(3)*c**(S(3)/S(2))) - b**(S(3)/S(2))*(S(4)*b*c - S(5)*a*d)*arctanh(sqrt(b)*sqrt(c + d*x)/sqrt(b*c - a*d))/(a**S(3)*(b*c - a*d)**(S(3)/S(2))) - b*(S(2)*b*c - a*d)*sqrt(c + d*x)/(a**S(2)*c*(b*c - a*d)*(a + b*x)) - sqrt(c + d*x)/(a*c*x*(a + b*x))], [S(1)/(x**S(2)*(a + b*x)**S(2)*(c + d*x)**(S(3)/S(2))), x, S(8), (S(4)*b*c + S(3)*a*d)*arctanh(sqrt(c + d*x)/sqrt(c))/(a**S(3)*c**(S(5)/S(2))) - b**(S(5)/S(2))*(S(4)*b*c - S(7)*a*d)*arctanh(sqrt(b)*sqrt(c + d*x)/sqrt(b*c - a*d))/(a**S(3)*(b*c - a*d)**(S(5)/S(2))) - d*(S(2)*b**S(2)*c**S(2) - S(2)*a*b*c*d + S(3)*a**S(2)*d**S(2))/(a**S(2)*c**S(2)*(b*c - a*d)**S(2)*sqrt(c + d*x)) - b*(S(2)*b*c - a*d)/(a**S(2)*c*(b*c - a*d)*(a + b*x)*sqrt(c + d*x)) + ( - S(1))/(a*c*x*(a + b*x)*sqrt(c + d*x))], [x**S(3)*(c + d*x)**(S(3)/S(2))/(a + b*x)**(S(3)/S(2)), x, S(6), S(3)/S(64)*(b*c - a*d)*(b**S(3)*c**S(3) + S(5)*a*b**S(2)*c**S(2)*d + S(35)*a**S(2)*b*c*d**S(2) - S(105)*a**S(3)*d**S(3))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(11)/S(2))*d**(S(5)/S(2))) - S(2)*x**S(3)*(c + d*x)**(S(3)/S(2))/(b*sqrt(a + b*x)) + S(9)/S(4)*x**S(2)*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/b**S(2) - S(1)/S(32)*(c + d*x)**(S(3)/S(2))*(S(3)*b**S(2)*c**S(2) + S(14)*a*b*c*d - S(105)*a**S(2)*d**S(2) - S(4)*b*d*(b*c - S(21)*a*d)*x)*sqrt(a + b*x)/(b**S(4)*d**S(2)) + S(3)/S(64)*(b**S(3)*c**S(3) + S(5)*a*b**S(2)*c**S(2)*d + S(35)*a**S(2)*b*c*d**S(2) - S(105)*a**S(3)*d**S(3))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(5)*d**S(2))], [x**S(2)*(c + d*x)**(S(3)/S(2))/(a + b*x)**(S(3)/S(2)), x, S(6), - S(1)/S(8)*(b*c - a*d)*(b**S(2)*c**S(2) + S(10)*a*b*c*d - S(35)*a**S(2)*d**S(2))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(9)/S(2))*d**(S(3)/S(2))) - S(2)*a**S(2)*(c + d*x)**(S(5)/S(2))/(b**S(2)*(b*c - a*d)*sqrt(a + b*x)) - S(1)/S(12)*(S(10)*a*c + b*c**S(2)/d - S(35)*a**S(2)*d/b)*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/(b**S(2)*(b*c - a*d)) + S(1)/S(3)*(c + d*x)**(S(5)/S(2))*sqrt(a + b*x)/(b**S(2)*d) - S(1)/S(8)*(b**S(2)*c**S(2) + S(10)*a*b*c*d - S(35)*a**S(2)*d**S(2))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(4)*d)], [x**S(3)*(c + d*x)**(S(5)/S(2))/(a + b*x)**(S(5)/S(2)), x, S(7), - S(2)/S(3)*x**S(3)*(c + d*x)**(S(5)/S(2))/(b*(a + b*x)**(S(3)/S(2))) - S(5)/S(64)*(b*c - a*d)*(b**S(3)*c**S(3) + S(21)*a*b**S(2)*c**S(2)*d - S(189)*a**S(2)*b*c*d**S(2) + S(231)*a**S(3)*d**S(3))*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(13)/S(2))*d**(S(3)/S(2))) - S(2)/S(3)*(S(6)*b*c - S(11)*a*d)*x**S(2)*(c + d*x)**(S(5)/S(2))/(b**S(2)*(b*c - a*d)*sqrt(a + b*x)) - S(5)/S(96)*(b**S(3)*c**S(3) + S(21)*a*b**S(2)*c**S(2)*d - S(189)*a**S(2)*b*c*d**S(2) + S(231)*a**S(3)*d**S(3))*(c + d*x)**(S(3)/S(2))*sqrt(a + b*x)/(b**S(5)*d*(b*c - a*d)) + S(1)/S(24)*(c + d*x)**(S(5)/S(2))*(S(5)*b**S(2)*c**S(2) - S(156)*a*b*c*d + S(231)*a**S(2)*d**S(2) + S(2)*b*d*(S(59)*b*c - S(99)*a*d)*x)*sqrt(a + b*x)/(b**S(4)*d*(b*c - a*d)) - S(5)/S(64)*(b**S(3)*c**S(3) + S(21)*a*b**S(2)*c**S(2)*d - S(189)*a**S(2)*b*c*d**S(2) + S(231)*a**S(3)*d**S(3))*sqrt(a + b*x)*sqrt(c + d*x)/(b**S(6)*d)], [x**S(2)/((a + b*x)**(S(5)/S(2))*(c + d*x)**(S(1)/S(2))), x, S(4), S(2)*arctanh(sqrt(d)*sqrt(a + b*x)/(sqrt(b)*sqrt(c + d*x)))/(b**(S(5)/S(2))*sqrt(d)) - S(2)/S(3)*a**S(2)*sqrt(c + d*x)/(b**S(2)*(b*c - a*d)*(a + b*x)**(S(3)/S(2))) + S(4)/S(3)*a*(S(3)*b*c - S(2)*a*d)*sqrt(c + d*x)/(b**S(2)*(b*c - a*d)**S(2)*sqrt(a + b*x))], [x*sqrt(a + b*x)/sqrt( - a - b*x), x, S(2), S(1)/S(2)*x**S(2)*sqrt(a + b*x)/sqrt( - a - b*x)], [(c + d*x)**(S(3)/S(2))/(x*(a + b*x)**S(2)), x, S(6), - S(2)*c**(S(3)/S(2))*arctanh(sqrt(c + d*x)/sqrt(c))/a**S(2) + (S(2)*b*c + a*d)*arctanh(sqrt(b)*sqrt(c + d*x)/sqrt(b*c - a*d))*sqrt(b*c - a*d)/(a**S(2)*b**(S(3)/S(2))) + (b*c - a*d)*sqrt(c + d*x)/(a*b*(a + b*x))], ] for i in test: r = rubi_integrate(i[0], i[1]) if len(i) == 5: assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True, _numerical=True) else: assert rubi_test(r, i[1], i[3], expand=True, _diff=True, _numerical=True) def test_simplify(): test = [ [x**S(3)*(a + b*x)**S(2)*(c + d*x)**S(16), x, S(2), - S(1)/S(17)*c**S(3)*(b*c - a*d)**S(2)*(c + d*x)**S(17)/d**S(6) + S(1)/S(18)*c**S(2)*(S(5)*b*c - S(3)*a*d)*(b*c - a*d)*(c + d*x)**S(18)/d**S(6) - S(1)/S(19)*c*(S(10)*b**S(2)*c**S(2) - S(12)*a*b*c*d + S(3)*a**S(2)*d**S(2))*(c + d*x)**S(19)/d**S(6) + S(1)/S(20)*(S(10)*b**S(2)*c**S(2) - S(8)*a*b*c*d + a**S(2)*d**S(2))*(c + d*x)**S(20)/d**S(6) - S(1)/S(21)*b*(S(5)*b*c - S(2)*a*d)*(c + d*x)**S(21)/d**S(6) + S(1)/S(22)*b**S(2)*(c + d*x)**S(22)/d**S(6)], [x**S(5)/((a + b*x)**S(2)*(c + d*x)**S(2)), x, S(2), - S(2)*(b*c + a*d)*x/(b**S(3)*d**S(3)) + S(1)/S(2)*x**S(2)/(b**S(2)*d**S(2)) + a**S(5)/(b**S(4)*(b*c - a*d)**S(2)*(a + b*x)) + c**S(5)/(d**S(4)*(b*c - a*d)**S(2)*(c + d*x)) + a**S(4)*(S(5)*b*c - S(3)*a*d)*log(a + b*x)/(b**S(4)*(b*c - a*d)**S(3)) + c**S(4)*(S(3)*b*c - S(5)*a*d)*log(c + d*x)/(d**S(4)*(b*c - a*d)**S(3))], [x**S(5)/((a + b*x)**S(2)*(c + d*x)**S(2)), x, S(2), - S(2)*(b*c + a*d)*x/(b**S(3)*d**S(3)) + S(1)/S(2)*x**S(2)/(b**S(2)*d**S(2)) + a**S(5)/(b**S(4)*(b*c - a*d)**S(2)*(a + b*x)) + c**S(5)/(d**S(4)*(b*c - a*d)**S(2)*(c + d*x)) + a**S(4)*(S(5)*b*c - S(3)*a*d)*log(a + b*x)/(b**S(4)*(b*c - a*d)**S(3)) + c**S(4)*(S(3)*b*c - S(5)*a*d)*log(c + d*x)/(d**S(4)*(b*c - a*d)**S(3))], [x**S(4)/((a + b*x)*(c + d*x)), x, S(2), (b**S(2)*c**S(2) + a*b*c*d + a**S(2)*d**S(2))*x/(b**S(3)*d**S(3)) - S(1)/S(2)*(b*c + a*d)*x**S(2)/(b**S(2)*d**S(2)) + S(1)/S(3)*x**S(3)/(b*d) + a**S(4)*log(a + b*x)/(b**S(4)*(b*c - a*d)) - c**S(4)*log(c + d*x)/(d**S(4)*(b*c - a*d))], [(a + b*x)*(A + B*x)*(d + e*x)**S(4), x, S(2), S(1)/S(5)*(b*d - a*e)*(B*d - A*e)*(d + e*x)**S(5)/e**S(3) - S(1)/S(6)*(S(2)*b*B*d - A*b*e - a*B*e)*(d + e*x)**S(6)/e**S(3) + S(1)/S(7)*b*B*(d + e*x)**S(7)/e**S(3)], [(a + b*x)**S(3)*(c + d*x)**S(3)*(e + f*x)**S(3), x, S(2), S(1)/S(4)*(b*c - a*d)**S(3)*(b*e - a*f)**S(3)*(a + b*x)**S(4)/b**S(7) + S(3)/S(5)*(b*c - a*d)**S(2)*(b*e - a*f)**S(2)*(b*d*e + b*c*f - S(2)*a*d*f)*(a + b*x)**S(5)/b**S(7) + S(1)/S(2)*(b*c - a*d)*(b*e - a*f)*(S(5)*a**S(2)*d**S(2)*f**S(2) - S(5)*a*b*d*f*(d*e + c*f) + b**S(2)*(d**S(2)*e**S(2) + S(3)*c*d*e*f + c**S(2)*f**S(2)))*(a + b*x)**S(6)/b**S(7) + S(1)/S(7)*(b*d*e + b*c*f - S(2)*a*d*f)*(S(10)*a**S(2)*d**S(2)*f**S(2) - S(10)*a*b*d*f*(d*e + c*f) + b**S(2)*(d**S(2)*e**S(2) + S(8)*c*d*e*f + c**S(2)*f**S(2)))*(a + b*x)**S(7)/b**S(7) + S(3)/S(8)*d*f*(S(5)*a**S(2)*d**S(2)*f**S(2) - S(5)*a*b*d*f*(d*e + c*f) + b**S(2)*(d**S(2)*e**S(2) + S(3)*c*d*e*f + c**S(2)*f**S(2)))*(a + b*x)**S(8)/b**S(7) + S(1)/S(3)*d**S(2)*f**S(2)*(b*d*e + b*c*f - S(2)*a*d*f)*(a + b*x)**S(9)/b**S(7) + S(1)/S(10)*d**S(3)*f**S(3)*(a + b*x)**S(10)/b**S(7)], [(a + b*x)*(A + B*x)*(d + e*x)**(S(5)/S(2)), x, S(2), S(2)/S(7)*(b*d - a*e)*(B*d - A*e)*(d + e*x)**(S(7)/S(2))/e**S(3) - S(2)/S(9)*(S(2)*b*B*d - A*b*e - a*B*e)*(d + e*x)**(S(9)/S(2))/e**S(3) + S(2)/S(11)*b*B*(d + e*x)**(S(11)/S(2))/e**S(3)], [(S(5) - S(4)*x)**S(4)*(S(2) + S(3)*x)**m/(S(1) + S(2)*x)**m, x, S(4), - S(1)/S(45)*(S(88) - m)*(S(5) - S(4)*x)**S(2)*(S(1) + S(2)*x)**(S(1) - m)*(S(2) + S(3)*x)**(S(1) + m) - S(2)/S(15)*(S(5) - S(4)*x)**S(3)*(S(1) + S(2)*x)**(S(1) - m)*(S(2) + S(3)*x)**(S(1) + m) - S(1)/S(1215)*(S(1) + S(2)*x)**(S(1) - m)*(S(2) + S(3)*x)**(S(1) + m)*(S(386850) - S(25441)*m + S(426)*m**S(2) - S(2)*m**S(3) - S(24)*(S(4359) - S(154)*m + m**S(2))*x) + S(1)/S(1215)*S(2)**( - S(1) - m)*(S(3528363) - S(639760)*m + S(29050)*m**S(2) - S(440)*m**S(3) + S(2)*m**S(4))*(S(1) + S(2)*x)**(S(1) - m)*hypergeom([S(1) - m, - m], [S(2) - m], - S(3)*(S(1) + S(2)*x))/(S(1) - m)], [(S(5) - S(4)*x)**S(3)*(S(1) + S(2)*x)**( - S(1) - m)*(S(2) + S(3)*x)**m, x, S(3), - S(2)/S(9)*(S(5) - S(4)*x)**S(2)*(S(2) + S(3)*x)**(S(1) + m)/(S(1) + S(2)*x)**m - S(1)/S(27)*(S(2) + S(3)*x)**(S(1) + m)*(S(9261) - S(512)*m + S(4)*m**S(2) - S(4)*(S(109) - S(2)*m)*m*x)/(m*(S(1) + S(2)*x)**m) + S(1)/S(27)*S(2)**( - S(1) - m)*(S(27783) - S(8324)*m + S(390)*m**S(2) - S(4)*m**S(3))*(S(1) + S(2)*x)**(S(1) - m)*hypergeom([S(1) - m, - m], [S(2) - m], - S(3)*(S(1) + S(2)*x))/((S(1) - m)*m)], [(a + b*x)**m*(c + d*x)**n*((b*c*f + a*d*f + a*d*f*m + b*c*f*n)/(b*d*(S(2) + m + n)) + f*x)**( - S(3) - m - n), x, S(1), b*d*(S(2) + m + n)*(a + b*x)**(S(1) + m)*(c + d*x)**(S(1) + n)*(f*(a*d*(S(1) + m) + b*c*(S(1) + n))/(b*d*(S(2) + m + n)) + f*x)**( - S(2) - m - n)/((b*c - a*d)**S(2)*f*(S(1) + m)*(S(1) + n))], [x**S(3)*(c + d*x)**S(3)/(a + b*x)**S(3), x, S(2), (b*c - a*d)*(b**S(2)*c**S(2) - S(8)*a*b*c*d + S(10)*a**S(2)*d**S(2))*x/b**S(6) + S(3)/S(2)*d*(b*c - S(2)*a*d)*(b*c - a*d)*x**S(2)/b**S(5) + d**S(2)*(b*c - a*d)*x**S(3)/b**S(4) + S(1)/S(4)*d**S(3)*x**S(4)/b**S(3) + S(1)/S(2)*a**S(3)*(b*c - a*d)**S(3)/(b**S(7)*(a + b*x)**S(2)) - S(3)*a**S(2)*(b*c - S(2)*a*d)*(b*c - a*d)**S(2)/(b**S(7)*(a + b*x)) - S(3)*a*(b*c - a*d)*(b**S(2)*c**S(2) - S(5)*a*b*c*d + S(5)*a**S(2)*d**S(2))*log(a + b*x)/b**S(7)], [(S(2) + S(3)*x)**S(8)*(S(3) + S(5)*x)/(S(1) - S(2)*x)**S(3), x, S(2), S(63412811)/S(2048)/(S(1) - S(2)*x)**S(2) + ( - S(246239357)/S(1024))/(S(1) - S(2)*x) - S(120864213)/S(256)*x - S(118841283)/S(512)*x**S(2) - S(16042509)/S(128)*x**S(3) - S(7568235)/S(128)*x**S(4) - S(213597)/S(10)*x**S(5) - S(162567)/S(32)*x**S(6) - S(32805)/S(56)*x**S(7) - S(106237047)/S(256)*log(S(1) - S(2)*x)], ] for i in test: r = rubi_integrate(i[0], i[1]) if len(i) == 5: assert rubi_test(r, i[1], i[3], expand=True) or rubi_test(r, i[1], i[4], expand=True) else: assert rubi_test(r, i[1], i[3], expand=True) def test_diff(): test = [ [(a + b*x)*(e + f*x)**(S(3)/S(2))/(c + d*x), x, S(5), - S(2)/S(3)*(b*c - a*d)*(e + f*x)**(S(3)/S(2))/d**S(2) + S(2)/S(5)*b*(e + f*x)**(S(5)/S(2))/(d*f) + S(2)*(b*c - a*d)*(d*e - c*f)**(S(3)/S(2))*arctanh(sqrt(d)*sqrt(e + f*x)/sqrt(d*e - c*f))/d**(S(7)/S(2)) - S(2)*(b*c - a*d)*(d*e - c*f)*sqrt(e + f*x)/d**S(3)], [x**(S(5)/S(2))*(A + B*x)/(a + b*x), x, S(6), - S(2)/S(3)*a*(A*b - a*B)*x**(S(3)/S(2))/b**S(3) + S(2)/S(5)*(A*b - a*B)*x**(S(5)/S(2))/b**S(2) + S(2)/S(7)*B*x**(S(7)/S(2))/b - S(2)*a**(S(5)/S(2))*(A*b - a*B)*arctan(sqrt(b)*sqrt(x)/sqrt(a))/b**(S(9)/S(2)) + S(2)*a**S(2)*(A*b - a*B)*sqrt(x)/b**S(4)], [(a + b*x)**S(2)/((c + d*x)**S(2)*sqrt(e + f*x)), x, S(4), (b*c - a*d)*(S(4)*b*d*e - S(3)*b*c*f - a*d*f)*arctanh(sqrt(d)*sqrt(e + f*x)/sqrt(d*e - c*f))/(d**(S(5)/S(2))*(d*e - c*f)**(S(3)/S(2))) + S(2)*b**S(2)*sqrt(e + f*x)/(d**S(2)*f) - (b*c - a*d)**S(2)*sqrt(e + f*x)/(d**S(2)*(d*e - c*f)*(c + d*x))], ] for i in test: r = rubi_integrate(i[0], i[1]) if len(i) == 5: assert rubi_test(r, i[1], i[3], expand=True, _diff=True) or rubi_test(r, i[1], i[4], expand=True, _diff=True) else: assert rubi_test(r, i[1], i[3], expand=True, _diff=True)
b493fa49248087703d442f82eec8d52c58d79669654265f6e2a2091113dabbba
from sympy import ( Symbol, Wild, sin, cos, exp, sqrt, pi, Function, Derivative, Integer, Eq, symbols, Add, I, Float, log, Rational, Lambda, atan2, cse, cot, tan, S, Tuple, Basic, Dict, Piecewise, oo, Mul, factor, nsimplify, zoo, Subs, RootOf, AccumBounds, Matrix, zeros, ZeroMatrix) from sympy.core.basic import _aresame from sympy.testing.pytest import XFAIL from sympy.abc import a, x, y, z, t def test_subs(): n3 = Rational(3) e = x e = e.subs(x, n3) assert e == Rational(3) e = 2*x assert e == 2*x e = e.subs(x, n3) assert e == Rational(6) def test_subs_Matrix(): z = zeros(2) z1 = ZeroMatrix(2, 2) assert (x*y).subs({x:z, y:0}) in [z, z1] assert (x*y).subs({y:z, x:0}) == 0 assert (x*y).subs({y:z, x:0}, simultaneous=True) in [z, z1] assert (x + y).subs({x: z, y: z}, simultaneous=True) in [z, z1] assert (x + y).subs({x: z, y: z}) in [z, z1] # Issue #15528 assert Mul(Matrix([[3]]), x).subs(x, 2.0) == Matrix([[6.0]]) # Does not raise a TypeError, see comment on the MatAdd postprocessor assert Add(Matrix([[3]]), x).subs(x, 2.0) == Add(Matrix([[3]]), 2.0) def test_subs_AccumBounds(): e = x e = e.subs(x, AccumBounds(1, 3)) assert e == AccumBounds(1, 3) e = 2*x e = e.subs(x, AccumBounds(1, 3)) assert e == AccumBounds(2, 6) e = x + x**2 e = e.subs(x, AccumBounds(-1, 1)) assert e == AccumBounds(-1, 2) def test_trigonometric(): n3 = Rational(3) e = (sin(x)**2).diff(x) assert e == 2*sin(x)*cos(x) e = e.subs(x, n3) assert e == 2*cos(n3)*sin(n3) e = (sin(x)**2).diff(x) assert e == 2*sin(x)*cos(x) e = e.subs(sin(x), cos(x)) assert e == 2*cos(x)**2 assert exp(pi).subs(exp, sin) == 0 assert cos(exp(pi)).subs(exp, sin) == 1 i = Symbol('i', integer=True) zoo = S.ComplexInfinity assert tan(x).subs(x, pi/2) is zoo assert cot(x).subs(x, pi) is zoo assert cot(i*x).subs(x, pi) is zoo assert tan(i*x).subs(x, pi/2) == tan(i*pi/2) assert tan(i*x).subs(x, pi/2).subs(i, 1) is zoo o = Symbol('o', odd=True) assert tan(o*x).subs(x, pi/2) == tan(o*pi/2) def test_powers(): assert sqrt(1 - sqrt(x)).subs(x, 4) == I assert (sqrt(1 - x**2)**3).subs(x, 2) == - 3*I*sqrt(3) assert (x**Rational(1, 3)).subs(x, 27) == 3 assert (x**Rational(1, 3)).subs(x, -27) == 3*(-1)**Rational(1, 3) assert ((-x)**Rational(1, 3)).subs(x, 27) == 3*(-1)**Rational(1, 3) n = Symbol('n', negative=True) assert (x**n).subs(x, 0) is S.ComplexInfinity assert exp(-1).subs(S.Exp1, 0) is S.ComplexInfinity assert (x**(4.0*y)).subs(x**(2.0*y), n) == n**2.0 assert (2**(x + 2)).subs(2, 3) == 3**(x + 3) def test_logexppow(): # no eval() x = Symbol('x', real=True) w = Symbol('w') e = (3**(1 + x) + 2**(1 + x))/(3**x + 2**x) assert e.subs(2**x, w) != e assert e.subs(exp(x*log(Rational(2))), w) != e def test_bug(): x1 = Symbol('x1') x2 = Symbol('x2') y = x1*x2 assert y.subs(x1, Float(3.0)) == Float(3.0)*x2 def test_subbug1(): # see that they don't fail (x**x).subs(x, 1) (x**x).subs(x, 1.0) def test_subbug2(): # Ensure this does not cause infinite recursion assert Float(7.7).epsilon_eq(abs(x).subs(x, -7.7)) def test_dict_set(): a, b, c = map(Wild, 'abc') f = 3*cos(4*x) r = f.match(a*cos(b*x)) assert r == {a: 3, b: 4} e = a/b*sin(b*x) assert e.subs(r) == r[a]/r[b]*sin(r[b]*x) assert e.subs(r) == 3*sin(4*x) / 4 s = set(r.items()) assert e.subs(s) == r[a]/r[b]*sin(r[b]*x) assert e.subs(s) == 3*sin(4*x) / 4 assert e.subs(r) == r[a]/r[b]*sin(r[b]*x) assert e.subs(r) == 3*sin(4*x) / 4 assert x.subs(Dict((x, 1))) == 1 def test_dict_ambigous(): # see issue 3566 f = x*exp(x) g = z*exp(z) df = {x: y, exp(x): y} dg = {z: y, exp(z): y} assert f.subs(df) == y**2 assert g.subs(dg) == y**2 # and this is how order can affect the result assert f.subs(x, y).subs(exp(x), y) == y*exp(y) assert f.subs(exp(x), y).subs(x, y) == y**2 # length of args and count_ops are the same so # default_sort_key resolves ordering...if one # doesn't want this result then an unordered # sequence should not be used. e = 1 + x*y assert e.subs({x: y, y: 2}) == 5 # here, there are no obviously clashing keys or values # but the results depend on the order assert exp(x/2 + y).subs({exp(y + 1): 2, x: 2}) == exp(y + 1) def test_deriv_sub_bug3(): f = Function('f') pat = Derivative(f(x), x, x) assert pat.subs(y, y**2) == Derivative(f(x), x, x) assert pat.subs(y, y**2) != Derivative(f(x), x) def test_equality_subs1(): f = Function('f') eq = Eq(f(x)**2, x) res = Eq(Integer(16), x) assert eq.subs(f(x), 4) == res def test_equality_subs2(): f = Function('f') eq = Eq(f(x)**2, 16) assert bool(eq.subs(f(x), 3)) is False assert bool(eq.subs(f(x), 4)) is True def test_issue_3742(): e = sqrt(x)*exp(y) assert e.subs(sqrt(x), 1) == exp(y) def test_subs_dict1(): assert (1 + x*y).subs(x, pi) == 1 + pi*y assert (1 + x*y).subs({x: pi, y: 2}) == 1 + 2*pi c2, c3, q1p, q2p, c1, s1, s2, s3 = symbols('c2 c3 q1p q2p c1 s1 s2 s3') test = (c2**2*q2p*c3 + c1**2*s2**2*q2p*c3 + s1**2*s2**2*q2p*c3 - c1**2*q1p*c2*s3 - s1**2*q1p*c2*s3) assert (test.subs({c1**2: 1 - s1**2, c2**2: 1 - s2**2, c3**3: 1 - s3**2}) == c3*q2p*(1 - s2**2) + c3*q2p*s2**2*(1 - s1**2) - c2*q1p*s3*(1 - s1**2) + c3*q2p*s1**2*s2**2 - c2*q1p*s3*s1**2) def test_mul(): x, y, z, a, b, c = symbols('x y z a b c') A, B, C = symbols('A B C', commutative=0) assert (x*y*z).subs(z*x, y) == y**2 assert (z*x).subs(1/x, z) == 1 assert (x*y/z).subs(1/z, a) == a*x*y assert (x*y/z).subs(x/z, a) == a*y assert (x*y/z).subs(y/z, a) == a*x assert (x*y/z).subs(x/z, 1/a) == y/a assert (x*y/z).subs(x, 1/a) == y/(z*a) assert (2*x*y).subs(5*x*y, z) != z*Rational(2, 5) assert (x*y*A).subs(x*y, a) == a*A assert (x**2*y**(x*Rational(3, 2))).subs(x*y**(x/2), 2) == 4*y**(x/2) assert (x*exp(x*2)).subs(x*exp(x), 2) == 2*exp(x) assert ((x**(2*y))**3).subs(x**y, 2) == 64 assert (x*A*B).subs(x*A, y) == y*B assert (x*y*(1 + x)*(1 + x*y)).subs(x*y, 2) == 6*(1 + x) assert ((1 + A*B)*A*B).subs(A*B, x*A*B) assert (x*a/z).subs(x/z, A) == a*A assert (x**3*A).subs(x**2*A, a) == a*x assert (x**2*A*B).subs(x**2*B, a) == a*A assert (x**2*A*B).subs(x**2*A, a) == a*B assert (b*A**3/(a**3*c**3)).subs(a**4*c**3*A**3/b**4, z) == \ b*A**3/(a**3*c**3) assert (6*x).subs(2*x, y) == 3*y assert (y*exp(x*Rational(3, 2))).subs(y*exp(x), 2) == 2*exp(x/2) assert (y*exp(x*Rational(3, 2))).subs(y*exp(x), 2) == 2*exp(x/2) assert (A**2*B*A**2*B*A**2).subs(A*B*A, C) == A*C**2*A assert (x*A**3).subs(x*A, y) == y*A**2 assert (x**2*A**3).subs(x*A, y) == y**2*A assert (x*A**3).subs(x*A, B) == B*A**2 assert (x*A*B*A*exp(x*A*B)).subs(x*A, B) == B**2*A*exp(B*B) assert (x**2*A*B*A*exp(x*A*B)).subs(x*A, B) == B**3*exp(B**2) assert (x**3*A*exp(x*A*B)*A*exp(x*A*B)).subs(x*A, B) == \ x*B*exp(B**2)*B*exp(B**2) assert (x*A*B*C*A*B).subs(x*A*B, C) == C**2*A*B assert (-I*a*b).subs(a*b, 2) == -2*I # issue 6361 assert (-8*I*a).subs(-2*a, 1) == 4*I assert (-I*a).subs(-a, 1) == I # issue 6441 assert (4*x**2).subs(2*x, y) == y**2 assert (2*4*x**2).subs(2*x, y) == 2*y**2 assert (-x**3/9).subs(-x/3, z) == -z**2*x assert (-x**3/9).subs(x/3, z) == -z**2*x assert (-2*x**3/9).subs(x/3, z) == -2*x*z**2 assert (-2*x**3/9).subs(-x/3, z) == -2*x*z**2 assert (-2*x**3/9).subs(-2*x, z) == z*x**2/9 assert (-2*x**3/9).subs(2*x, z) == -z*x**2/9 assert (2*(3*x/5/7)**2).subs(3*x/5, z) == 2*(Rational(1, 7))**2*z**2 assert (4*x).subs(-2*x, z) == 4*x # try keep subs literal def test_subs_simple(): a = symbols('a', commutative=True) x = symbols('x', commutative=False) assert (2*a).subs(1, 3) == 2*a assert (2*a).subs(2, 3) == 3*a assert (2*a).subs(a, 3) == 6 assert sin(2).subs(1, 3) == sin(2) assert sin(2).subs(2, 3) == sin(3) assert sin(a).subs(a, 3) == sin(3) assert (2*x).subs(1, 3) == 2*x assert (2*x).subs(2, 3) == 3*x assert (2*x).subs(x, 3) == 6 assert sin(x).subs(x, 3) == sin(3) def test_subs_constants(): a, b = symbols('a b', commutative=True) x, y = symbols('x y', commutative=False) assert (a*b).subs(2*a, 1) == a*b assert (1.5*a*b).subs(a, 1) == 1.5*b assert (2*a*b).subs(2*a, 1) == b assert (2*a*b).subs(4*a, 1) == 2*a*b assert (x*y).subs(2*x, 1) == x*y assert (1.5*x*y).subs(x, 1) == 1.5*y assert (2*x*y).subs(2*x, 1) == y assert (2*x*y).subs(4*x, 1) == 2*x*y def test_subs_commutative(): a, b, c, d, K = symbols('a b c d K', commutative=True) assert (a*b).subs(a*b, K) == K assert (a*b*a*b).subs(a*b, K) == K**2 assert (a*a*b*b).subs(a*b, K) == K**2 assert (a*b*c*d).subs(a*b*c, K) == d*K assert (a*b**c).subs(a, K) == K*b**c assert (a*b**c).subs(b, K) == a*K**c assert (a*b**c).subs(c, K) == a*b**K assert (a*b*c*b*a).subs(a*b, K) == c*K**2 assert (a**3*b**2*a).subs(a*b, K) == a**2*K**2 def test_subs_noncommutative(): w, x, y, z, L = symbols('w x y z L', commutative=False) alpha = symbols('alpha', commutative=True) someint = symbols('someint', commutative=True, integer=True) assert (x*y).subs(x*y, L) == L assert (w*y*x).subs(x*y, L) == w*y*x assert (w*x*y*z).subs(x*y, L) == w*L*z assert (x*y*x*y).subs(x*y, L) == L**2 assert (x*x*y).subs(x*y, L) == x*L assert (x*x*y*y).subs(x*y, L) == x*L*y assert (w*x*y).subs(x*y*z, L) == w*x*y assert (x*y**z).subs(x, L) == L*y**z assert (x*y**z).subs(y, L) == x*L**z assert (x*y**z).subs(z, L) == x*y**L assert (w*x*y*z*x*y).subs(x*y*z, L) == w*L*x*y assert (w*x*y*y*w*x*x*y*x*y*y*x*y).subs(x*y, L) == w*L*y*w*x*L**2*y*L # Check fractional power substitutions. It should not do # substitutions that choose a value for noncommutative log, # or inverses that don't already appear in the expressions. assert (x*x*x).subs(x*x, L) == L*x assert (x*x*x*y*x*x*x*x).subs(x*x, L) == L*x*y*L**2 for p in range(1, 5): for k in range(10): assert (y * x**k).subs(x**p, L) == y * L**(k//p) * x**(k % p) assert (x**Rational(3, 2)).subs(x**S.Half, L) == x**Rational(3, 2) assert (x**S.Half).subs(x**S.Half, L) == L assert (x**Rational(-1, 2)).subs(x**S.Half, L) == x**Rational(-1, 2) assert (x**Rational(-1, 2)).subs(x**Rational(-1, 2), L) == L assert (x**(2*someint)).subs(x**someint, L) == L**2 assert (x**(2*someint + 3)).subs(x**someint, L) == L**2*x**3 assert (x**(3*someint + 3)).subs(x**someint, L) == L**3*x**3 assert (x**(3*someint)).subs(x**(2*someint), L) == L * x**someint assert (x**(4*someint)).subs(x**(2*someint), L) == L**2 assert (x**(4*someint + 1)).subs(x**(2*someint), L) == L**2 * x assert (x**(4*someint)).subs(x**(3*someint), L) == L * x**someint assert (x**(4*someint + 1)).subs(x**(3*someint), L) == L * x**(someint + 1) assert (x**(2*alpha)).subs(x**alpha, L) == x**(2*alpha) assert (x**(2*alpha + 2)).subs(x**2, L) == x**(2*alpha + 2) assert ((2*z)**alpha).subs(z**alpha, y) == (2*z)**alpha assert (x**(2*someint*alpha)).subs(x**someint, L) == x**(2*someint*alpha) assert (x**(2*someint + alpha)).subs(x**someint, L) == x**(2*someint + alpha) # This could in principle be substituted, but is not currently # because it requires recognizing that someint**2 is divisible by # someint. assert (x**(someint**2 + 3)).subs(x**someint, L) == x**(someint**2 + 3) # alpha**z := exp(log(alpha) z) is usually well-defined assert (4**z).subs(2**z, y) == y**2 # Negative powers assert (x**(-1)).subs(x**3, L) == x**(-1) assert (x**(-2)).subs(x**3, L) == x**(-2) assert (x**(-3)).subs(x**3, L) == L**(-1) assert (x**(-4)).subs(x**3, L) == L**(-1) * x**(-1) assert (x**(-5)).subs(x**3, L) == L**(-1) * x**(-2) assert (x**(-1)).subs(x**(-3), L) == x**(-1) assert (x**(-2)).subs(x**(-3), L) == x**(-2) assert (x**(-3)).subs(x**(-3), L) == L assert (x**(-4)).subs(x**(-3), L) == L * x**(-1) assert (x**(-5)).subs(x**(-3), L) == L * x**(-2) assert (x**1).subs(x**(-3), L) == x assert (x**2).subs(x**(-3), L) == x**2 assert (x**3).subs(x**(-3), L) == L**(-1) assert (x**4).subs(x**(-3), L) == L**(-1) * x assert (x**5).subs(x**(-3), L) == L**(-1) * x**2 def test_subs_basic_funcs(): a, b, c, d, K = symbols('a b c d K', commutative=True) w, x, y, z, L = symbols('w x y z L', commutative=False) assert (x + y).subs(x + y, L) == L assert (x - y).subs(x - y, L) == L assert (x/y).subs(x, L) == L/y assert (x**y).subs(x, L) == L**y assert (x**y).subs(y, L) == x**L assert ((a - c)/b).subs(b, K) == (a - c)/K assert (exp(x*y - z)).subs(x*y, L) == exp(L - z) assert (a*exp(x*y - w*z) + b*exp(x*y + w*z)).subs(z, 0) == \ a*exp(x*y) + b*exp(x*y) assert ((a - b)/(c*d - a*b)).subs(c*d - a*b, K) == (a - b)/K assert (w*exp(a*b - c)*x*y/4).subs(x*y, L) == w*exp(a*b - c)*L/4 def test_subs_wild(): R, S, T, U = symbols('R S T U', cls=Wild) assert (R*S).subs(R*S, T) == T assert (S*R).subs(R*S, T) == T assert (R + S).subs(R + S, T) == T assert (R**S).subs(R, T) == T**S assert (R**S).subs(S, T) == R**T assert (R*S**T).subs(R, U) == U*S**T assert (R*S**T).subs(S, U) == R*U**T assert (R*S**T).subs(T, U) == R*S**U def test_subs_mixed(): a, b, c, d, K = symbols('a b c d K', commutative=True) w, x, y, z, L = symbols('w x y z L', commutative=False) R, S, T, U = symbols('R S T U', cls=Wild) assert (a*x*y).subs(x*y, L) == a*L assert (a*b*x*y*x).subs(x*y, L) == a*b*L*x assert (R*x*y*exp(x*y)).subs(x*y, L) == R*L*exp(L) assert (a*x*y*y*x - x*y*z*exp(a*b)).subs(x*y, L) == a*L*y*x - L*z*exp(a*b) e = c*y*x*y*x**(R*S - a*b) - T*(a*R*b*S) assert e.subs(x*y, L).subs(a*b, K).subs(R*S, U) == \ c*y*L*x**(U - K) - T*(U*K) def test_division(): a, b, c = symbols('a b c', commutative=True) x, y, z = symbols('x y z', commutative=True) assert (1/a).subs(a, c) == 1/c assert (1/a**2).subs(a, c) == 1/c**2 assert (1/a**2).subs(a, -2) == Rational(1, 4) assert (-(1/a**2)).subs(a, -2) == Rational(-1, 4) assert (1/x).subs(x, z) == 1/z assert (1/x**2).subs(x, z) == 1/z**2 assert (1/x**2).subs(x, -2) == Rational(1, 4) assert (-(1/x**2)).subs(x, -2) == Rational(-1, 4) #issue 5360 assert (1/x).subs(x, 0) == 1/S.Zero def test_add(): a, b, c, d, x, y, t = symbols('a b c d x y t') assert (a**2 - b - c).subs(a**2 - b, d) in [d - c, a**2 - b - c] assert (a**2 - c).subs(a**2 - c, d) == d assert (a**2 - b - c).subs(a**2 - c, d) in [d - b, a**2 - b - c] assert (a**2 - x - c).subs(a**2 - c, d) in [d - x, a**2 - x - c] assert (a**2 - b - sqrt(a)).subs(a**2 - sqrt(a), c) == c - b assert (a + b + exp(a + b)).subs(a + b, c) == c + exp(c) assert (c + b + exp(c + b)).subs(c + b, a) == a + exp(a) assert (a + b + c + d).subs(b + c, x) == a + d + x assert (a + b + c + d).subs(-b - c, x) == a + d - x assert ((x + 1)*y).subs(x + 1, t) == t*y assert ((-x - 1)*y).subs(x + 1, t) == -t*y assert ((x - 1)*y).subs(x + 1, t) == y*(t - 2) assert ((-x + 1)*y).subs(x + 1, t) == y*(-t + 2) # this should work every time: e = a**2 - b - c assert e.subs(Add(*e.args[:2]), d) == d + e.args[2] assert e.subs(a**2 - c, d) == d - b # the fallback should recognize when a change has # been made; while .1 == Rational(1, 10) they are not the same # and the change should be made assert (0.1 + a).subs(0.1, Rational(1, 10)) == Rational(1, 10) + a e = (-x*(-y + 1) - y*(y - 1)) ans = (-x*(x) - y*(-x)).expand() assert e.subs(-y + 1, x) == ans #Test issue 18747 assert (exp(x) + cos(x)).subs(x, oo) == oo assert Add(*[AccumBounds(-1, 1), oo]) == oo assert Add(*[oo, AccumBounds(-1, 1)]) == oo def test_subs_issue_4009(): assert (I*Symbol('a')).subs(1, 2) == I*Symbol('a') def test_functions_subs(): f, g = symbols('f g', cls=Function) l = Lambda((x, y), sin(x) + y) assert (g(y, x) + cos(x)).subs(g, l) == sin(y) + x + cos(x) assert (f(x)**2).subs(f, sin) == sin(x)**2 assert (f(x, y)).subs(f, log) == log(x, y) assert (f(x, y)).subs(f, sin) == f(x, y) assert (sin(x) + atan2(x, y)).subs([[atan2, f], [sin, g]]) == \ f(x, y) + g(x) assert (g(f(x + y, x))).subs([[f, l], [g, exp]]) == exp(x + sin(x + y)) def test_derivative_subs(): f = Function('f') g = Function('g') assert Derivative(f(x), x).subs(f(x), y) != 0 # need xreplace to put the function back, see #13803 assert Derivative(f(x), x).subs(f(x), y).xreplace({y: f(x)}) == \ Derivative(f(x), x) # issues 5085, 5037 assert cse(Derivative(f(x), x) + f(x))[1][0].has(Derivative) assert cse(Derivative(f(x, y), x) + Derivative(f(x, y), y))[1][0].has(Derivative) eq = Derivative(g(x), g(x)) assert eq.subs(g, f) == Derivative(f(x), f(x)) assert eq.subs(g(x), f(x)) == Derivative(f(x), f(x)) assert eq.subs(g, cos) == Subs(Derivative(y, y), y, cos(x)) def test_derivative_subs2(): f_func, g_func = symbols('f g', cls=Function) f, g = f_func(x, y, z), g_func(x, y, z) assert Derivative(f, x, y).subs(Derivative(f, x, y), g) == g assert Derivative(f, y, x).subs(Derivative(f, x, y), g) == g assert Derivative(f, x, y).subs(Derivative(f, x), g) == Derivative(g, y) assert Derivative(f, x, y).subs(Derivative(f, y), g) == Derivative(g, x) assert (Derivative(f, x, y, z).subs( Derivative(f, x, z), g) == Derivative(g, y)) assert (Derivative(f, x, y, z).subs( Derivative(f, z, y), g) == Derivative(g, x)) assert (Derivative(f, x, y, z).subs( Derivative(f, z, y, x), g) == g) # Issue 9135 assert (Derivative(f, x, x, y).subs( Derivative(f, y, y), g) == Derivative(f, x, x, y)) assert (Derivative(f, x, y, y, z).subs( Derivative(f, x, y, y, y), g) == Derivative(f, x, y, y, z)) assert Derivative(f, x, y).subs(Derivative(f_func(x), x, y), g) == Derivative(f, x, y) def test_derivative_subs3(): dex = Derivative(exp(x), x) assert Derivative(dex, x).subs(dex, exp(x)) == dex assert dex.subs(exp(x), dex) == Derivative(exp(x), x, x) def test_issue_5284(): A, B = symbols('A B', commutative=False) assert (x*A).subs(x**2*A, B) == x*A assert (A**2).subs(A**3, B) == A**2 assert (A**6).subs(A**3, B) == B**2 def test_subs_iter(): assert x.subs(reversed([[x, y]])) == y it = iter([[x, y]]) assert x.subs(it) == y assert x.subs(Tuple((x, y))) == y def test_subs_dict(): a, b, c, d, e = symbols('a b c d e') assert (2*x + y + z).subs(dict(x=1, y=2)) == 4 + z l = [(sin(x), 2), (x, 1)] assert (sin(x)).subs(l) == \ (sin(x)).subs(dict(l)) == 2 assert sin(x).subs(reversed(l)) == sin(1) expr = sin(2*x) + sqrt(sin(2*x))*cos(2*x)*sin(exp(x)*x) reps = dict([ (sin(2*x), c), (sqrt(sin(2*x)), a), (cos(2*x), b), (exp(x), e), (x, d), ]) assert expr.subs(reps) == c + a*b*sin(d*e) l = [(x, 3), (y, x**2)] assert (x + y).subs(l) == 3 + x**2 assert (x + y).subs(reversed(l)) == 12 # If changes are made to convert lists into dictionaries and do # a dictionary-lookup replacement, these tests will help to catch # some logical errors that might occur l = [(y, z + 2), (1 + z, 5), (z, 2)] assert (y - 1 + 3*x).subs(l) == 5 + 3*x l = [(y, z + 2), (z, 3)] assert (y - 2).subs(l) == 3 def test_no_arith_subs_on_floats(): assert (x + 3).subs(x + 3, a) == a assert (x + 3).subs(x + 2, a) == a + 1 assert (x + y + 3).subs(x + 3, a) == a + y assert (x + y + 3).subs(x + 2, a) == a + y + 1 assert (x + 3.0).subs(x + 3.0, a) == a assert (x + 3.0).subs(x + 2.0, a) == x + 3.0 assert (x + y + 3.0).subs(x + 3.0, a) == a + y assert (x + y + 3.0).subs(x + 2.0, a) == x + y + 3.0 def test_issue_5651(): a, b, c, K = symbols('a b c K', commutative=True) assert (a/(b*c)).subs(b*c, K) == a/K assert (a/(b**2*c**3)).subs(b*c, K) == a/(c*K**2) assert (1/(x*y)).subs(x*y, 2) == S.Half assert ((1 + x*y)/(x*y)).subs(x*y, 1) == 2 assert (x*y*z).subs(x*y, 2) == 2*z assert ((1 + x*y)/(x*y)/z).subs(x*y, 1) == 2/z def test_issue_6075(): assert Tuple(1, True).subs(1, 2) == Tuple(2, True) def test_issue_6079(): # since x + 2.0 == x + 2 we can't do a simple equality test assert _aresame((x + 2.0).subs(2, 3), x + 2.0) assert _aresame((x + 2.0).subs(2.0, 3), x + 3) assert not _aresame(x + 2, x + 2.0) assert not _aresame(Basic(cos, 1), Basic(cos, 1.)) assert _aresame(cos, cos) assert not _aresame(1, S.One) assert not _aresame(x, symbols('x', positive=True)) def test_issue_4680(): N = Symbol('N') assert N.subs(dict(N=3)) == 3 def test_issue_6158(): assert (x - 1).subs(1, y) == x - y assert (x - 1).subs(-1, y) == x + y assert (x - oo).subs(oo, y) == x - y assert (x - oo).subs(-oo, y) == x + y def test_Function_subs(): f, g, h, i = symbols('f g h i', cls=Function) p = Piecewise((g(f(x, y)), x < -1), (g(x), x <= 1)) assert p.subs(g, h) == Piecewise((h(f(x, y)), x < -1), (h(x), x <= 1)) assert (f(y) + g(x)).subs({f: h, g: i}) == i(x) + h(y) def test_simultaneous_subs(): reps = {x: 0, y: 0} assert (x/y).subs(reps) != (y/x).subs(reps) assert (x/y).subs(reps, simultaneous=True) == \ (y/x).subs(reps, simultaneous=True) reps = reps.items() assert (x/y).subs(reps) != (y/x).subs(reps) assert (x/y).subs(reps, simultaneous=True) == \ (y/x).subs(reps, simultaneous=True) assert Derivative(x, y, z).subs(reps, simultaneous=True) == \ Subs(Derivative(0, y, z), y, 0) def test_issue_6419_6421(): assert (1/(1 + x/y)).subs(x/y, x) == 1/(1 + x) assert (-2*I).subs(2*I, x) == -x assert (-I*x).subs(I*x, x) == -x assert (-3*I*y**4).subs(3*I*y**2, x) == -x*y**2 def test_issue_6559(): assert (-12*x + y).subs(-x, 1) == 12 + y # though this involves cse it generated a failure in Mul._eval_subs x0, x1 = symbols('x0 x1') e = -log(-12*sqrt(2) + 17)/24 - log(-2*sqrt(2) + 3)/12 + sqrt(2)/3 # XXX modify cse so x1 is eliminated and x0 = -sqrt(2)? assert cse(e) == ( [(x0, sqrt(2))], [x0/3 - log(-12*x0 + 17)/24 - log(-2*x0 + 3)/12]) def test_issue_5261(): x = symbols('x', real=True) e = I*x assert exp(e).subs(exp(x), y) == y**I assert (2**e).subs(2**x, y) == y**I eq = (-2)**e assert eq.subs((-2)**x, y) == eq def test_issue_6923(): assert (-2*x*sqrt(2)).subs(2*x, y) == -sqrt(2)*y def test_2arg_hack(): N = Symbol('N', commutative=False) ans = Mul(2, y + 1, evaluate=False) assert (2*x*(y + 1)).subs(x, 1, hack2=True) == ans assert (2*(y + 1 + N)).subs(N, 0, hack2=True) == ans @XFAIL def test_mul2(): """When this fails, remove things labelled "2-arg hack" 1) remove special handling in the fallback of subs that was added in the same commit as this test 2) remove the special handling in Mul.flatten """ assert (2*(x + 1)).is_Mul def test_noncommutative_subs(): x,y = symbols('x,y', commutative=False) assert (x*y*x).subs([(x, x*y), (y, x)], simultaneous=True) == (x*y*x**2*y) def test_issue_2877(): f = Float(2.0) assert (x + f).subs({f: 2}) == x + 2 def r(a, b, c): return factor(a*x**2 + b*x + c) e = r(5.0/6, 10, 5) assert nsimplify(e) == 5*x**2/6 + 10*x + 5 def test_issue_5910(): t = Symbol('t') assert (1/(1 - t)).subs(t, 1) is zoo n = t d = t - 1 assert (n/d).subs(t, 1) is zoo assert (-n/-d).subs(t, 1) is zoo def test_issue_5217(): s = Symbol('s') z = (1 - 2*x*x) w = (1 + 2*x*x) q = 2*x*x*2*y*y sub = {2*x*x: s} assert w.subs(sub) == 1 + s assert z.subs(sub) == 1 - s assert q == 4*x**2*y**2 assert q.subs(sub) == 2*y**2*s def test_issue_10829(): assert (4**x).subs(2**x, y) == y**2 assert (9**x).subs(3**x, y) == y**2 def test_pow_eval_subs_no_cache(): # Tests pull request 9376 is working from sympy.core.cache import clear_cache s = 1/sqrt(x**2) # This bug only appeared when the cache was turned off. # We need to approximate running this test without the cache. # This creates approximately the same situation. clear_cache() # This used to fail with a wrong result. # It incorrectly returned 1/sqrt(x**2) before this pull request. result = s.subs(sqrt(x**2), y) assert result == 1/y def test_RootOf_issue_10092(): x = Symbol('x', real=True) eq = x**3 - 17*x**2 + 81*x - 118 r = RootOf(eq, 0) assert (x < r).subs(x, r) is S.false def test_issue_8886(): from sympy.physics.mechanics import ReferenceFrame as R # if something can't be sympified we assume that it # doesn't play well with SymPy and disallow the # substitution v = R('A').x assert x.subs(x, v) == x assert v.subs(v, x) == v assert v.__eq__(x) is False def test_issue_12657(): # treat -oo like the atom that it is reps = [(-oo, 1), (oo, 2)] assert (x < -oo).subs(reps) == (x < 1) assert (x < -oo).subs(list(reversed(reps))) == (x < 1) reps = [(-oo, 2), (oo, 1)] assert (x < oo).subs(reps) == (x < 1) assert (x < oo).subs(list(reversed(reps))) == (x < 1) def test_recurse_Application_args(): F = Lambda((x, y), exp(2*x + 3*y)) f = Function('f') A = f(x, f(x, x)) C = F(x, F(x, x)) assert A.subs(f, F) == A.replace(f, F) == C def test_Subs_subs(): assert Subs(x*y, x, x).subs(x, y) == Subs(x*y, x, y) assert Subs(x*y, x, x + 1).subs(x, y) == \ Subs(x*y, x, y + 1) assert Subs(x*y, y, x + 1).subs(x, y) == \ Subs(y**2, y, y + 1) a = Subs(x*y*z, (y, x, z), (x + 1, x + z, x)) b = Subs(x*y*z, (y, x, z), (x + 1, y + z, y)) assert a.subs(x, y) == b and \ a.doit().subs(x, y) == a.subs(x, y).doit() f = Function('f') g = Function('g') assert Subs(2*f(x, y) + g(x), f(x, y), 1).subs(y, 2) == Subs( 2*f(x, y) + g(x), (f(x, y), y), (1, 2)) def test_issue_13333(): eq = 1/x assert eq.subs(dict(x='1/2')) == 2 assert eq.subs(dict(x='(1/2)')) == 2 def test_issue_15234(): x, y = symbols('x y', real=True) p = 6*x**5 + x**4 - 4*x**3 + 4*x**2 - 2*x + 3 p_subbed = 6*x**5 - 4*x**3 - 2*x + y**4 + 4*y**2 + 3 assert p.subs([(x**i, y**i) for i in [2, 4]]) == p_subbed x, y = symbols('x y', complex=True) p = 6*x**5 + x**4 - 4*x**3 + 4*x**2 - 2*x + 3 p_subbed = 6*x**5 - 4*x**3 - 2*x + y**4 + 4*y**2 + 3 assert p.subs([(x**i, y**i) for i in [2, 4]]) == p_subbed def test_issue_6976(): x, y = symbols('x y') assert (sqrt(x)**3 + sqrt(x) + x + x**2).subs(sqrt(x), y) == \ y**4 + y**3 + y**2 + y assert (x**4 + x**3 + x**2 + x + sqrt(x)).subs(x**2, y) == \ sqrt(x) + x**3 + x + y**2 + y assert x.subs(x**3, y) == x assert x.subs(x**Rational(1, 3), y) == y**3 # More substitutions are possible with nonnegative symbols x, y = symbols('x y', nonnegative=True) assert (x**4 + x**3 + x**2 + x + sqrt(x)).subs(x**2, y) == \ y**Rational(1, 4) + y**Rational(3, 2) + sqrt(y) + y**2 + y assert x.subs(x**3, y) == y**Rational(1, 3) def test_issue_11746(): assert (1/x).subs(x**2, 1) == 1/x assert (1/(x**3)).subs(x**2, 1) == x**(-3) assert (1/(x**4)).subs(x**2, 1) == 1 assert (1/(x**3)).subs(x**4, 1) == x**(-3) assert (1/(y**5)).subs(x**5, 1) == y**(-5) def test_issue_17823(): from sympy.physics.mechanics import dynamicsymbols q1, q2 = dynamicsymbols('q1, q2') expr = q1.diff().diff()**2*q1 + q1.diff()*q2.diff() reps={q1: a, q1.diff(): a*x*y, q1.diff().diff(): z} assert expr.subs(reps) == a*x*y*Derivative(q2, t) + a*z**2
fca7bc302408abf97fb69e11b85f5082d98687f2989c32854bba015e1c5fcacd
from sympy import (Add, Basic, Expr, S, Symbol, Wild, Float, Integer, Rational, I, sin, cos, tan, exp, log, nan, oo, sqrt, symbols, Integral, sympify, WildFunction, Poly, Function, Derivative, Number, pi, NumberSymbol, zoo, Piecewise, Mul, Pow, nsimplify, ratsimp, trigsimp, radsimp, powsimp, simplify, together, collect, factorial, apart, combsimp, factor, refine, cancel, Tuple, default_sort_key, DiracDelta, gamma, Dummy, Sum, E, exp_polar, expand, diff, O, Heaviside, Si, Max, UnevaluatedExpr, integrate, gammasimp, Gt) from sympy.core.expr import ExprBuilder, unchanged from sympy.core.function import AppliedUndef from sympy.physics.secondquant import FockState from sympy.physics.units import meter from sympy.testing.pytest import raises, XFAIL from sympy.abc import a, b, c, n, t, u, x, y, z class DummyNumber(object): """ Minimal implementation of a number that works with SymPy. If one has a Number class (e.g. Sage Integer, or some other custom class) that one wants to work well with SymPy, one has to implement at least the methods of this class DummyNumber, resp. its subclasses I5 and F1_1. Basically, one just needs to implement either __int__() or __float__() and then one needs to make sure that the class works with Python integers and with itself. """ def __radd__(self, a): if isinstance(a, (int, float)): return a + self.number return NotImplemented def __truediv__(a, b): return a.__div__(b) def __rtruediv__(a, b): return a.__rdiv__(b) def __add__(self, a): if isinstance(a, (int, float, DummyNumber)): return self.number + a return NotImplemented def __rsub__(self, a): if isinstance(a, (int, float)): return a - self.number return NotImplemented def __sub__(self, a): if isinstance(a, (int, float, DummyNumber)): return self.number - a return NotImplemented def __rmul__(self, a): if isinstance(a, (int, float)): return a * self.number return NotImplemented def __mul__(self, a): if isinstance(a, (int, float, DummyNumber)): return self.number * a return NotImplemented def __rdiv__(self, a): if isinstance(a, (int, float)): return a / self.number return NotImplemented def __div__(self, a): if isinstance(a, (int, float, DummyNumber)): return self.number / a return NotImplemented def __rpow__(self, a): if isinstance(a, (int, float)): return a ** self.number return NotImplemented def __pow__(self, a): if isinstance(a, (int, float, DummyNumber)): return self.number ** a return NotImplemented def __pos__(self): return self.number def __neg__(self): return - self.number class I5(DummyNumber): number = 5 def __int__(self): return self.number class F1_1(DummyNumber): number = 1.1 def __float__(self): return self.number i5 = I5() f1_1 = F1_1() # basic sympy objects basic_objs = [ Rational(2), Float("1.3"), x, y, pow(x, y)*y, ] # all supported objects all_objs = basic_objs + [ 5, 5.5, i5, f1_1 ] def dotest(s): for xo in all_objs: for yo in all_objs: s(xo, yo) return True def test_basic(): def j(a, b): x = a x = +a x = -a x = a + b x = a - b x = a*b x = a/b x = a**b del x assert dotest(j) def test_ibasic(): def s(a, b): x = a x += b x = a x -= b x = a x *= b x = a x /= b assert dotest(s) class NonBasic(object): '''This class represents an object that knows how to implement binary operations like +, -, etc with Expr but is not a subclass of Basic itself. The NonExpr subclass below does subclass Basic but not Expr. For both NonBasic and NonExpr it should be possible for them to override Expr.__add__ etc because Expr.__add__ should be returning NotImplemented for non Expr classes. Otherwise Expr.__add__ would create meaningless objects like Add(Integer(1), FiniteSet(2)) and it wouldn't be possible for other classes to override these operations when interacting with Expr. ''' def __add__(self, other): return SpecialOp('+', self, other) def __radd__(self, other): return SpecialOp('+', other, self) def __sub__(self, other): return SpecialOp('-', self, other) def __rsub__(self, other): return SpecialOp('-', other, self) def __mul__(self, other): return SpecialOp('*', self, other) def __rmul__(self, other): return SpecialOp('*', other, self) def __div__(self, other): return SpecialOp('/', self, other) def __rdiv__(self, other): return SpecialOp('/', other, self) __truediv__ = __div__ __rtruediv__ = __rdiv__ def __floordiv__(self, other): return SpecialOp('//', self, other) def __rfloordiv__(self, other): return SpecialOp('//', other, self) def __mod__(self, other): return SpecialOp('%', self, other) def __rmod__(self, other): return SpecialOp('%', other, self) def __divmod__(self, other): return SpecialOp('divmod', self, other) def __rdivmod__(self, other): return SpecialOp('divmod', other, self) def __pow__(self, other): return SpecialOp('**', self, other) def __rpow__(self, other): return SpecialOp('**', other, self) def __lt__(self, other): return SpecialOp('<', self, other) def __gt__(self, other): return SpecialOp('>', self, other) def __le__(self, other): return SpecialOp('<=', self, other) def __ge__(self, other): return SpecialOp('>=', self, other) class NonExpr(Basic, NonBasic): '''Like NonBasic above except this is a subclass of Basic but not Expr''' pass class SpecialOp(Basic): '''Represents the results of operations with NonBasic and NonExpr''' def __new__(cls, op, arg1, arg2): return Basic.__new__(cls, op, arg1, arg2) class NonArithmetic(Basic): '''Represents a Basic subclass that does not support arithmetic operations''' pass def test_cooperative_operations(): '''Tests that Expr uses binary operations cooperatively. In particular it should be possible for non-Expr classes to override binary operators like +, - etc when used with Expr instances. This should work for non-Expr classes whether they are Basic subclasses or not. Also non-Expr classes that do not define binary operators with Expr should give TypeError. ''' # A bunch of instances of Expr subclasses exprs = [ Expr(), S.Zero, S.One, S.Infinity, S.NegativeInfinity, S.ComplexInfinity, S.Half, Float(0.5), Integer(2), Symbol('x'), Mul(2, Symbol('x')), Add(2, Symbol('x')), Pow(2, Symbol('x')), ] for e in exprs: # Test that these classes can override arithmetic operations in # combination with various Expr types. for ne in [NonBasic(), NonExpr()]: results = [ (ne + e, ('+', ne, e)), (e + ne, ('+', e, ne)), (ne - e, ('-', ne, e)), (e - ne, ('-', e, ne)), (ne * e, ('*', ne, e)), (e * ne, ('*', e, ne)), (ne / e, ('/', ne, e)), (e / ne, ('/', e, ne)), (ne // e, ('//', ne, e)), (e // ne, ('//', e, ne)), (ne % e, ('%', ne, e)), (e % ne, ('%', e, ne)), (divmod(ne, e), ('divmod', ne, e)), (divmod(e, ne), ('divmod', e, ne)), (ne ** e, ('**', ne, e)), (e ** ne, ('**', e, ne)), (e < ne, ('>', ne, e)), (ne < e, ('<', ne, e)), (e > ne, ('<', ne, e)), (ne > e, ('>', ne, e)), (e <= ne, ('>=', ne, e)), (ne <= e, ('<=', ne, e)), (e >= ne, ('<=', ne, e)), (ne >= e, ('>=', ne, e)), ] for res, args in results: assert type(res) is SpecialOp and res.args == args # These classes do not support binary operators with Expr. Every # operation should raise in combination with any of the Expr types. for na in [NonArithmetic(), object()]: raises(TypeError, lambda : e + na) raises(TypeError, lambda : na + e) raises(TypeError, lambda : e - na) raises(TypeError, lambda : na - e) raises(TypeError, lambda : e * na) raises(TypeError, lambda : na * e) raises(TypeError, lambda : e / na) raises(TypeError, lambda : na / e) raises(TypeError, lambda : e // na) raises(TypeError, lambda : na // e) raises(TypeError, lambda : e % na) raises(TypeError, lambda : na % e) raises(TypeError, lambda : divmod(e, na)) raises(TypeError, lambda : divmod(na, e)) raises(TypeError, lambda : e ** na) raises(TypeError, lambda : na ** e) raises(TypeError, lambda : e > na) raises(TypeError, lambda : na > e) raises(TypeError, lambda : e < na) raises(TypeError, lambda : na < e) raises(TypeError, lambda : e >= na) raises(TypeError, lambda : na >= e) raises(TypeError, lambda : e <= na) raises(TypeError, lambda : na <= e) def test_relational(): from sympy import Lt assert (pi < 3) is S.false assert (pi <= 3) is S.false assert (pi > 3) is S.true assert (pi >= 3) is S.true assert (-pi < 3) is S.true assert (-pi <= 3) is S.true assert (-pi > 3) is S.false assert (-pi >= 3) is S.false r = Symbol('r', real=True) assert (r - 2 < r - 3) is S.false assert Lt(x + I, x + I + 2).func == Lt # issue 8288 def test_relational_assumptions(): from sympy import Lt, Gt, Le, Ge m1 = Symbol("m1", nonnegative=False) m2 = Symbol("m2", positive=False) m3 = Symbol("m3", nonpositive=False) m4 = Symbol("m4", negative=False) assert (m1 < 0) == Lt(m1, 0) assert (m2 <= 0) == Le(m2, 0) assert (m3 > 0) == Gt(m3, 0) assert (m4 >= 0) == Ge(m4, 0) m1 = Symbol("m1", nonnegative=False, real=True) m2 = Symbol("m2", positive=False, real=True) m3 = Symbol("m3", nonpositive=False, real=True) m4 = Symbol("m4", negative=False, real=True) assert (m1 < 0) is S.true assert (m2 <= 0) is S.true assert (m3 > 0) is S.true assert (m4 >= 0) is S.true m1 = Symbol("m1", negative=True) m2 = Symbol("m2", nonpositive=True) m3 = Symbol("m3", positive=True) m4 = Symbol("m4", nonnegative=True) assert (m1 < 0) is S.true assert (m2 <= 0) is S.true assert (m3 > 0) is S.true assert (m4 >= 0) is S.true m1 = Symbol("m1", negative=False, real=True) m2 = Symbol("m2", nonpositive=False, real=True) m3 = Symbol("m3", positive=False, real=True) m4 = Symbol("m4", nonnegative=False, real=True) assert (m1 < 0) is S.false assert (m2 <= 0) is S.false assert (m3 > 0) is S.false assert (m4 >= 0) is S.false # See https://github.com/sympy/sympy/issues/17708 #def test_relational_noncommutative(): # from sympy import Lt, Gt, Le, Ge # A, B = symbols('A,B', commutative=False) # assert (A < B) == Lt(A, B) # assert (A <= B) == Le(A, B) # assert (A > B) == Gt(A, B) # assert (A >= B) == Ge(A, B) def test_basic_nostr(): for obj in basic_objs: raises(TypeError, lambda: obj + '1') raises(TypeError, lambda: obj - '1') if obj == 2: assert obj * '1' == '11' else: raises(TypeError, lambda: obj * '1') raises(TypeError, lambda: obj / '1') raises(TypeError, lambda: obj ** '1') def test_series_expansion_for_uniform_order(): assert (1/x + y + x).series(x, 0, 0) == 1/x + O(1, x) assert (1/x + y + x).series(x, 0, 1) == 1/x + y + O(x) assert (1/x + 1 + x).series(x, 0, 0) == 1/x + O(1, x) assert (1/x + 1 + x).series(x, 0, 1) == 1/x + 1 + O(x) assert (1/x + x).series(x, 0, 0) == 1/x + O(1, x) assert (1/x + y + y*x + x).series(x, 0, 0) == 1/x + O(1, x) assert (1/x + y + y*x + x).series(x, 0, 1) == 1/x + y + O(x) def test_leadterm(): assert (3 + 2*x**(log(3)/log(2) - 1)).leadterm(x) == (3, 0) assert (1/x**2 + 1 + x + x**2).leadterm(x)[1] == -2 assert (1/x + 1 + x + x**2).leadterm(x)[1] == -1 assert (x**2 + 1/x).leadterm(x)[1] == -1 assert (1 + x**2).leadterm(x)[1] == 0 assert (x + 1).leadterm(x)[1] == 0 assert (x + x**2).leadterm(x)[1] == 1 assert (x**2).leadterm(x)[1] == 2 def test_as_leading_term(): assert (3 + 2*x**(log(3)/log(2) - 1)).as_leading_term(x) == 3 assert (1/x**2 + 1 + x + x**2).as_leading_term(x) == 1/x**2 assert (1/x + 1 + x + x**2).as_leading_term(x) == 1/x assert (x**2 + 1/x).as_leading_term(x) == 1/x assert (1 + x**2).as_leading_term(x) == 1 assert (x + 1).as_leading_term(x) == 1 assert (x + x**2).as_leading_term(x) == x assert (x**2).as_leading_term(x) == x**2 assert (x + oo).as_leading_term(x) is oo raises(ValueError, lambda: (x + 1).as_leading_term(1)) def test_leadterm2(): assert (x*cos(1)*cos(1 + sin(1)) + sin(1 + sin(1))).leadterm(x) == \ (sin(1 + sin(1)), 0) def test_leadterm3(): assert (y + z + x).leadterm(x) == (y + z, 0) def test_as_leading_term2(): assert (x*cos(1)*cos(1 + sin(1)) + sin(1 + sin(1))).as_leading_term(x) == \ sin(1 + sin(1)) def test_as_leading_term3(): assert (2 + pi + x).as_leading_term(x) == 2 + pi assert (2*x + pi*x + x**2).as_leading_term(x) == (2 + pi)*x def test_as_leading_term4(): # see issue 6843 n = Symbol('n', integer=True, positive=True) r = -n**3/(2*n**2 + 4*n + 2) - n**2/(n**2 + 2*n + 1) + \ n**2/(n + 1) - n/(2*n**2 + 4*n + 2) + n/(n*x + x) + 2*n/(n + 1) - \ 1 + 1/(n*x + x) + 1/(n + 1) - 1/x assert r.as_leading_term(x).cancel() == n/2 def test_as_leading_term_stub(): class foo(Function): pass assert foo(1/x).as_leading_term(x) == foo(1/x) assert foo(1).as_leading_term(x) == foo(1) raises(NotImplementedError, lambda: foo(x).as_leading_term(x)) def test_as_leading_term_deriv_integral(): # related to issue 11313 assert Derivative(x ** 3, x).as_leading_term(x) == 3*x**2 assert Derivative(x ** 3, y).as_leading_term(x) == 0 assert Integral(x ** 3, x).as_leading_term(x) == x**4/4 assert Integral(x ** 3, y).as_leading_term(x) == y*x**3 assert Derivative(exp(x), x).as_leading_term(x) == 1 assert Derivative(log(x), x).as_leading_term(x) == (1/x).as_leading_term(x) def test_atoms(): assert x.atoms() == {x} assert (1 + x).atoms() == {x, S.One} assert (1 + 2*cos(x)).atoms(Symbol) == {x} assert (1 + 2*cos(x)).atoms(Symbol, Number) == {S.One, S(2), x} assert (2*(x**(y**x))).atoms() == {S(2), x, y} assert S.Half.atoms() == {S.Half} assert S.Half.atoms(Symbol) == set([]) assert sin(oo).atoms(oo) == set() assert Poly(0, x).atoms() == {S.Zero, x} assert Poly(1, x).atoms() == {S.One, x} assert Poly(x, x).atoms() == {x} assert Poly(x, x, y).atoms() == {x, y} assert Poly(x + y, x, y).atoms() == {x, y} assert Poly(x + y, x, y, z).atoms() == {x, y, z} assert Poly(x + y*t, x, y, z).atoms() == {t, x, y, z} assert (I*pi).atoms(NumberSymbol) == {pi} assert (I*pi).atoms(NumberSymbol, I) == \ (I*pi).atoms(I, NumberSymbol) == {pi, I} assert exp(exp(x)).atoms(exp) == {exp(exp(x)), exp(x)} assert (1 + x*(2 + y) + exp(3 + z)).atoms(Add) == \ {1 + x*(2 + y) + exp(3 + z), 2 + y, 3 + z} # issue 6132 f = Function('f') e = (f(x) + sin(x) + 2) assert e.atoms(AppliedUndef) == \ {f(x)} assert e.atoms(AppliedUndef, Function) == \ {f(x), sin(x)} assert e.atoms(Function) == \ {f(x), sin(x)} assert e.atoms(AppliedUndef, Number) == \ {f(x), S(2)} assert e.atoms(Function, Number) == \ {S(2), sin(x), f(x)} def test_is_polynomial(): k = Symbol('k', nonnegative=True, integer=True) assert Rational(2).is_polynomial(x, y, z) is True assert (S.Pi).is_polynomial(x, y, z) is True assert x.is_polynomial(x) is True assert x.is_polynomial(y) is True assert (x**2).is_polynomial(x) is True assert (x**2).is_polynomial(y) is True assert (x**(-2)).is_polynomial(x) is False assert (x**(-2)).is_polynomial(y) is True assert (2**x).is_polynomial(x) is False assert (2**x).is_polynomial(y) is True assert (x**k).is_polynomial(x) is False assert (x**k).is_polynomial(k) is False assert (x**x).is_polynomial(x) is False assert (k**k).is_polynomial(k) is False assert (k**x).is_polynomial(k) is False assert (x**(-k)).is_polynomial(x) is False assert ((2*x)**k).is_polynomial(x) is False assert (x**2 + 3*x - 8).is_polynomial(x) is True assert (x**2 + 3*x - 8).is_polynomial(y) is True assert (x**2 + 3*x - 8).is_polynomial() is True assert sqrt(x).is_polynomial(x) is False assert (sqrt(x)**3).is_polynomial(x) is False assert (x**2 + 3*x*sqrt(y) - 8).is_polynomial(x) is True assert (x**2 + 3*x*sqrt(y) - 8).is_polynomial(y) is False assert ((x**2)*(y**2) + x*(y**2) + y*x + exp(2)).is_polynomial() is True assert ((x**2)*(y**2) + x*(y**2) + y*x + exp(x)).is_polynomial() is False assert ( (x**2)*(y**2) + x*(y**2) + y*x + exp(2)).is_polynomial(x, y) is True assert ( (x**2)*(y**2) + x*(y**2) + y*x + exp(x)).is_polynomial(x, y) is False def test_is_rational_function(): assert Integer(1).is_rational_function() is True assert Integer(1).is_rational_function(x) is True assert Rational(17, 54).is_rational_function() is True assert Rational(17, 54).is_rational_function(x) is True assert (12/x).is_rational_function() is True assert (12/x).is_rational_function(x) is True assert (x/y).is_rational_function() is True assert (x/y).is_rational_function(x) is True assert (x/y).is_rational_function(x, y) is True assert (x**2 + 1/x/y).is_rational_function() is True assert (x**2 + 1/x/y).is_rational_function(x) is True assert (x**2 + 1/x/y).is_rational_function(x, y) is True assert (sin(y)/x).is_rational_function() is False assert (sin(y)/x).is_rational_function(y) is False assert (sin(y)/x).is_rational_function(x) is True assert (sin(y)/x).is_rational_function(x, y) is False assert (S.NaN).is_rational_function() is False assert (S.Infinity).is_rational_function() is False assert (S.NegativeInfinity).is_rational_function() is False assert (S.ComplexInfinity).is_rational_function() is False def test_is_algebraic_expr(): assert sqrt(3).is_algebraic_expr(x) is True assert sqrt(3).is_algebraic_expr() is True eq = ((1 + x**2)/(1 - y**2))**(S.One/3) assert eq.is_algebraic_expr(x) is True assert eq.is_algebraic_expr(y) is True assert (sqrt(x) + y**(S(2)/3)).is_algebraic_expr(x) is True assert (sqrt(x) + y**(S(2)/3)).is_algebraic_expr(y) is True assert (sqrt(x) + y**(S(2)/3)).is_algebraic_expr() is True assert (cos(y)/sqrt(x)).is_algebraic_expr() is False assert (cos(y)/sqrt(x)).is_algebraic_expr(x) is True assert (cos(y)/sqrt(x)).is_algebraic_expr(y) is False assert (cos(y)/sqrt(x)).is_algebraic_expr(x, y) is False def test_SAGE1(): #see https://github.com/sympy/sympy/issues/3346 class MyInt: def _sympy_(self): return Integer(5) m = MyInt() e = Rational(2)*m assert e == 10 raises(TypeError, lambda: Rational(2)*MyInt) def test_SAGE2(): class MyInt(object): def __int__(self): return 5 assert sympify(MyInt()) == 5 e = Rational(2)*MyInt() assert e == 10 raises(TypeError, lambda: Rational(2)*MyInt) def test_SAGE3(): class MySymbol: def __rmul__(self, other): return ('mys', other, self) o = MySymbol() e = x*o assert e == ('mys', x, o) def test_len(): e = x*y assert len(e.args) == 2 e = x + y + z assert len(e.args) == 3 def test_doit(): a = Integral(x**2, x) assert isinstance(a.doit(), Integral) is False assert isinstance(a.doit(integrals=True), Integral) is False assert isinstance(a.doit(integrals=False), Integral) is True assert (2*Integral(x, x)).doit() == x**2 def test_attribute_error(): raises(AttributeError, lambda: x.cos()) raises(AttributeError, lambda: x.sin()) raises(AttributeError, lambda: x.exp()) def test_args(): assert (x*y).args in ((x, y), (y, x)) assert (x + y).args in ((x, y), (y, x)) assert (x*y + 1).args in ((x*y, 1), (1, x*y)) assert sin(x*y).args == (x*y,) assert sin(x*y).args[0] == x*y assert (x**y).args == (x, y) assert (x**y).args[0] == x assert (x**y).args[1] == y def test_noncommutative_expand_issue_3757(): A, B, C = symbols('A,B,C', commutative=False) assert A*B - B*A != 0 assert (A*(A + B)*B).expand() == A**2*B + A*B**2 assert (A*(A + B + C)*B).expand() == A**2*B + A*B**2 + A*C*B def test_as_numer_denom(): a, b, c = symbols('a, b, c') assert nan.as_numer_denom() == (nan, 1) assert oo.as_numer_denom() == (oo, 1) assert (-oo).as_numer_denom() == (-oo, 1) assert zoo.as_numer_denom() == (zoo, 1) assert (-zoo).as_numer_denom() == (zoo, 1) assert x.as_numer_denom() == (x, 1) assert (1/x).as_numer_denom() == (1, x) assert (x/y).as_numer_denom() == (x, y) assert (x/2).as_numer_denom() == (x, 2) assert (x*y/z).as_numer_denom() == (x*y, z) assert (x/(y*z)).as_numer_denom() == (x, y*z) assert S.Half.as_numer_denom() == (1, 2) assert (1/y**2).as_numer_denom() == (1, y**2) assert (x/y**2).as_numer_denom() == (x, y**2) assert ((x**2 + 1)/y).as_numer_denom() == (x**2 + 1, y) assert (x*(y + 1)/y**7).as_numer_denom() == (x*(y + 1), y**7) assert (x**-2).as_numer_denom() == (1, x**2) assert (a/x + b/2/x + c/3/x).as_numer_denom() == \ (6*a + 3*b + 2*c, 6*x) assert (a/x + b/2/x + c/3/y).as_numer_denom() == \ (2*c*x + y*(6*a + 3*b), 6*x*y) assert (a/x + b/2/x + c/.5/x).as_numer_denom() == \ (2*a + b + 4.0*c, 2*x) # this should take no more than a few seconds assert int(log(Add(*[Dummy()/i/x for i in range(1, 705)] ).as_numer_denom()[1]/x).n(4)) == 705 for i in [S.Infinity, S.NegativeInfinity, S.ComplexInfinity]: assert (i + x/3).as_numer_denom() == \ (x + i, 3) assert (S.Infinity + x/3 + y/4).as_numer_denom() == \ (4*x + 3*y + S.Infinity, 12) assert (oo*x + zoo*y).as_numer_denom() == \ (zoo*y + oo*x, 1) A, B, C = symbols('A,B,C', commutative=False) assert (A*B*C**-1).as_numer_denom() == (A*B*C**-1, 1) assert (A*B*C**-1/x).as_numer_denom() == (A*B*C**-1, x) assert (C**-1*A*B).as_numer_denom() == (C**-1*A*B, 1) assert (C**-1*A*B/x).as_numer_denom() == (C**-1*A*B, x) assert ((A*B*C)**-1).as_numer_denom() == ((A*B*C)**-1, 1) assert ((A*B*C)**-1/x).as_numer_denom() == ((A*B*C)**-1, x) def test_trunc(): import math x, y = symbols('x y') assert math.trunc(2) == 2 assert math.trunc(4.57) == 4 assert math.trunc(-5.79) == -5 assert math.trunc(pi) == 3 assert math.trunc(log(7)) == 1 assert math.trunc(exp(5)) == 148 assert math.trunc(cos(pi)) == -1 assert math.trunc(sin(5)) == 0 raises(TypeError, lambda: math.trunc(x)) raises(TypeError, lambda: math.trunc(x + y**2)) raises(TypeError, lambda: math.trunc(oo)) def test_as_independent(): assert S.Zero.as_independent(x, as_Add=True) == (0, 0) assert S.Zero.as_independent(x, as_Add=False) == (0, 0) assert (2*x*sin(x) + y + x).as_independent(x) == (y, x + 2*x*sin(x)) assert (2*x*sin(x) + y + x).as_independent(y) == (x + 2*x*sin(x), y) assert (2*x*sin(x) + y + x).as_independent(x, y) == (0, y + x + 2*x*sin(x)) assert (x*sin(x)*cos(y)).as_independent(x) == (cos(y), x*sin(x)) assert (x*sin(x)*cos(y)).as_independent(y) == (x*sin(x), cos(y)) assert (x*sin(x)*cos(y)).as_independent(x, y) == (1, x*sin(x)*cos(y)) assert (sin(x)).as_independent(x) == (1, sin(x)) assert (sin(x)).as_independent(y) == (sin(x), 1) assert (2*sin(x)).as_independent(x) == (2, sin(x)) assert (2*sin(x)).as_independent(y) == (2*sin(x), 1) # issue 4903 = 1766b n1, n2, n3 = symbols('n1 n2 n3', commutative=False) assert (n1 + n1*n2).as_independent(n2) == (n1, n1*n2) assert (n2*n1 + n1*n2).as_independent(n2) == (0, n1*n2 + n2*n1) assert (n1*n2*n1).as_independent(n2) == (n1, n2*n1) assert (n1*n2*n1).as_independent(n1) == (1, n1*n2*n1) assert (3*x).as_independent(x, as_Add=True) == (0, 3*x) assert (3*x).as_independent(x, as_Add=False) == (3, x) assert (3 + x).as_independent(x, as_Add=True) == (3, x) assert (3 + x).as_independent(x, as_Add=False) == (1, 3 + x) # issue 5479 assert (3*x).as_independent(Symbol) == (3, x) # issue 5648 assert (n1*x*y).as_independent(x) == (n1*y, x) assert ((x + n1)*(x - y)).as_independent(x) == (1, (x + n1)*(x - y)) assert ((x + n1)*(x - y)).as_independent(y) == (x + n1, x - y) assert (DiracDelta(x - n1)*DiracDelta(x - y)).as_independent(x) \ == (1, DiracDelta(x - n1)*DiracDelta(x - y)) assert (x*y*n1*n2*n3).as_independent(n2) == (x*y*n1, n2*n3) assert (x*y*n1*n2*n3).as_independent(n1) == (x*y, n1*n2*n3) assert (x*y*n1*n2*n3).as_independent(n3) == (x*y*n1*n2, n3) assert (DiracDelta(x - n1)*DiracDelta(y - n1)*DiracDelta(x - n2)).as_independent(y) == \ (DiracDelta(x - n1)*DiracDelta(x - n2), DiracDelta(y - n1)) # issue 5784 assert (x + Integral(x, (x, 1, 2))).as_independent(x, strict=True) == \ (Integral(x, (x, 1, 2)), x) eq = Add(x, -x, 2, -3, evaluate=False) assert eq.as_independent(x) == (-1, Add(x, -x, evaluate=False)) eq = Mul(x, 1/x, 2, -3, evaluate=False) eq.as_independent(x) == (-6, Mul(x, 1/x, evaluate=False)) assert (x*y).as_independent(z, as_Add=True) == (x*y, 0) @XFAIL def test_call_2(): # TODO UndefinedFunction does not subclass Expr f = Function('f') assert (2*f)(x) == 2*f(x) def test_replace(): f = log(sin(x)) + tan(sin(x**2)) assert f.replace(sin, cos) == log(cos(x)) + tan(cos(x**2)) assert f.replace( sin, lambda a: sin(2*a)) == log(sin(2*x)) + tan(sin(2*x**2)) a = Wild('a') b = Wild('b') assert f.replace(sin(a), cos(a)) == log(cos(x)) + tan(cos(x**2)) assert f.replace( sin(a), lambda a: sin(2*a)) == log(sin(2*x)) + tan(sin(2*x**2)) # test exact assert (2*x).replace(a*x + b, b - a, exact=True) == 2*x assert (2*x).replace(a*x + b, b - a) == 2*x assert (2*x).replace(a*x + b, b - a, exact=False) == 2/x assert (2*x).replace(a*x + b, lambda a, b: b - a, exact=True) == 2*x assert (2*x).replace(a*x + b, lambda a, b: b - a) == 2*x assert (2*x).replace(a*x + b, lambda a, b: b - a, exact=False) == 2/x g = 2*sin(x**3) assert g.replace( lambda expr: expr.is_Number, lambda expr: expr**2) == 4*sin(x**9) assert cos(x).replace(cos, sin, map=True) == (sin(x), {cos(x): sin(x)}) assert sin(x).replace(cos, sin) == sin(x) cond, func = lambda x: x.is_Mul, lambda x: 2*x assert (x*y).replace(cond, func, map=True) == (2*x*y, {x*y: 2*x*y}) assert (x*(1 + x*y)).replace(cond, func, map=True) == \ (2*x*(2*x*y + 1), {x*(2*x*y + 1): 2*x*(2*x*y + 1), x*y: 2*x*y}) assert (y*sin(x)).replace(sin, lambda expr: sin(expr)/y, map=True) == \ (sin(x), {sin(x): sin(x)/y}) # if not simultaneous then y*sin(x) -> y*sin(x)/y = sin(x) -> sin(x)/y assert (y*sin(x)).replace(sin, lambda expr: sin(expr)/y, simultaneous=False) == sin(x)/y assert (x**2 + O(x**3)).replace(Pow, lambda b, e: b**e/e) == O(1, x) assert (x**2 + O(x**3)).replace(Pow, lambda b, e: b**e/e, simultaneous=False) == x**2/2 + O(x**3) assert (x*(x*y + 3)).replace(lambda x: x.is_Mul, lambda x: 2 + x) == \ x*(x*y + 5) + 2 e = (x*y + 1)*(2*x*y + 1) + 1 assert e.replace(cond, func, map=True) == ( 2*((2*x*y + 1)*(4*x*y + 1)) + 1, {2*x*y: 4*x*y, x*y: 2*x*y, (2*x*y + 1)*(4*x*y + 1): 2*((2*x*y + 1)*(4*x*y + 1))}) assert x.replace(x, y) == y assert (x + 1).replace(1, 2) == x + 2 # https://groups.google.com/forum/#!topic/sympy/8wCgeC95tz0 n1, n2, n3 = symbols('n1:4', commutative=False) f = Function('f') assert (n1*f(n2)).replace(f, lambda x: x) == n1*n2 assert (n3*f(n2)).replace(f, lambda x: x) == n3*n2 # issue 16725 assert S.Zero.replace(Wild('x'), 1) == 1 # let the user override the default decision of False assert S.Zero.replace(Wild('x'), 1, exact=True) == 0 def test_find(): expr = (x + y + 2 + sin(3*x)) assert expr.find(lambda u: u.is_Integer) == {S(2), S(3)} assert expr.find(lambda u: u.is_Symbol) == {x, y} assert expr.find(lambda u: u.is_Integer, group=True) == {S(2): 1, S(3): 1} assert expr.find(lambda u: u.is_Symbol, group=True) == {x: 2, y: 1} assert expr.find(Integer) == {S(2), S(3)} assert expr.find(Symbol) == {x, y} assert expr.find(Integer, group=True) == {S(2): 1, S(3): 1} assert expr.find(Symbol, group=True) == {x: 2, y: 1} a = Wild('a') expr = sin(sin(x)) + sin(x) + cos(x) + x assert expr.find(lambda u: type(u) is sin) == {sin(x), sin(sin(x))} assert expr.find( lambda u: type(u) is sin, group=True) == {sin(x): 2, sin(sin(x)): 1} assert expr.find(sin(a)) == {sin(x), sin(sin(x))} assert expr.find(sin(a), group=True) == {sin(x): 2, sin(sin(x)): 1} assert expr.find(sin) == {sin(x), sin(sin(x))} assert expr.find(sin, group=True) == {sin(x): 2, sin(sin(x)): 1} def test_count(): expr = (x + y + 2 + sin(3*x)) assert expr.count(lambda u: u.is_Integer) == 2 assert expr.count(lambda u: u.is_Symbol) == 3 assert expr.count(Integer) == 2 assert expr.count(Symbol) == 3 assert expr.count(2) == 1 a = Wild('a') assert expr.count(sin) == 1 assert expr.count(sin(a)) == 1 assert expr.count(lambda u: type(u) is sin) == 1 f = Function('f') assert f(x).count(f(x)) == 1 assert f(x).diff(x).count(f(x)) == 1 assert f(x).diff(x).count(x) == 2 def test_has_basics(): f = Function('f') g = Function('g') p = Wild('p') assert sin(x).has(x) assert sin(x).has(sin) assert not sin(x).has(y) assert not sin(x).has(cos) assert f(x).has(x) assert f(x).has(f) assert not f(x).has(y) assert not f(x).has(g) assert f(x).diff(x).has(x) assert f(x).diff(x).has(f) assert f(x).diff(x).has(Derivative) assert not f(x).diff(x).has(y) assert not f(x).diff(x).has(g) assert not f(x).diff(x).has(sin) assert (x**2).has(Symbol) assert not (x**2).has(Wild) assert (2*p).has(Wild) assert not x.has() def test_has_multiple(): f = x**2*y + sin(2**t + log(z)) assert f.has(x) assert f.has(y) assert f.has(z) assert f.has(t) assert not f.has(u) assert f.has(x, y, z, t) assert f.has(x, y, z, t, u) i = Integer(4400) assert not i.has(x) assert (i*x**i).has(x) assert not (i*y**i).has(x) assert (i*y**i).has(x, y) assert not (i*y**i).has(x, z) def test_has_piecewise(): f = (x*y + 3/y)**(3 + 2) g = Function('g') h = Function('h') p = Piecewise((g(x), x < -1), (1, x <= 1), (f, True)) assert p.has(x) assert p.has(y) assert not p.has(z) assert p.has(1) assert p.has(3) assert not p.has(4) assert p.has(f) assert p.has(g) assert not p.has(h) def test_has_iterative(): A, B, C = symbols('A,B,C', commutative=False) f = x*gamma(x)*sin(x)*exp(x*y)*A*B*C*cos(x*A*B) assert f.has(x) assert f.has(x*y) assert f.has(x*sin(x)) assert not f.has(x*sin(y)) assert f.has(x*A) assert f.has(x*A*B) assert not f.has(x*A*C) assert f.has(x*A*B*C) assert not f.has(x*A*C*B) assert f.has(x*sin(x)*A*B*C) assert not f.has(x*sin(x)*A*C*B) assert not f.has(x*sin(y)*A*B*C) assert f.has(x*gamma(x)) assert not f.has(x + sin(x)) assert (x & y & z).has(x & z) def test_has_integrals(): f = Integral(x**2 + sin(x*y*z), (x, 0, x + y + z)) assert f.has(x + y) assert f.has(x + z) assert f.has(y + z) assert f.has(x*y) assert f.has(x*z) assert f.has(y*z) assert not f.has(2*x + y) assert not f.has(2*x*y) def test_has_tuple(): f = Function('f') g = Function('g') h = Function('h') assert Tuple(x, y).has(x) assert not Tuple(x, y).has(z) assert Tuple(f(x), g(x)).has(x) assert not Tuple(f(x), g(x)).has(y) assert Tuple(f(x), g(x)).has(f) assert Tuple(f(x), g(x)).has(f(x)) assert not Tuple(f, g).has(x) assert Tuple(f, g).has(f) assert not Tuple(f, g).has(h) assert Tuple(True).has(True) is True # .has(1) will also be True def test_has_units(): from sympy.physics.units import m, s assert (x*m/s).has(x) assert (x*m/s).has(y, z) is False def test_has_polys(): poly = Poly(x**2 + x*y*sin(z), x, y, t) assert poly.has(x) assert poly.has(x, y, z) assert poly.has(x, y, z, t) def test_has_physics(): assert FockState((x, y)).has(x) def test_as_poly_as_expr(): f = x**2 + 2*x*y assert f.as_poly().as_expr() == f assert f.as_poly(x, y).as_expr() == f assert (f + sin(x)).as_poly(x, y) is None p = Poly(f, x, y) assert p.as_poly() == p raises(AttributeError, lambda: Tuple(x, x).as_poly(x)) raises(AttributeError, lambda: Tuple(x ** 2, x, y).as_poly(x)) def test_nonzero(): assert bool(S.Zero) is False assert bool(S.One) is True assert bool(x) is True assert bool(x + y) is True assert bool(x - x) is False assert bool(x*y) is True assert bool(x*1) is True assert bool(x*0) is False def test_is_number(): assert Float(3.14).is_number is True assert Integer(737).is_number is True assert Rational(3, 2).is_number is True assert Rational(8).is_number is True assert x.is_number is False assert (2*x).is_number is False assert (x + y).is_number is False assert log(2).is_number is True assert log(x).is_number is False assert (2 + log(2)).is_number is True assert (8 + log(2)).is_number is True assert (2 + log(x)).is_number is False assert (8 + log(2) + x).is_number is False assert (1 + x**2/x - x).is_number is True assert Tuple(Integer(1)).is_number is False assert Add(2, x).is_number is False assert Mul(3, 4).is_number is True assert Pow(log(2), 2).is_number is True assert oo.is_number is True g = WildFunction('g') assert g.is_number is False assert (2*g).is_number is False assert (x**2).subs(x, 3).is_number is True # test extensibility of .is_number # on subinstances of Basic class A(Basic): pass a = A() assert a.is_number is False def test_as_coeff_add(): assert S(2).as_coeff_add() == (2, ()) assert S(3.0).as_coeff_add() == (0, (S(3.0),)) assert S(-3.0).as_coeff_add() == (0, (S(-3.0),)) assert x.as_coeff_add() == (0, (x,)) assert (x - 1).as_coeff_add() == (-1, (x,)) assert (x + 1).as_coeff_add() == (1, (x,)) assert (x + 2).as_coeff_add() == (2, (x,)) assert (x + y).as_coeff_add(y) == (x, (y,)) assert (3*x).as_coeff_add(y) == (3*x, ()) # don't do expansion e = (x + y)**2 assert e.as_coeff_add(y) == (0, (e,)) def test_as_coeff_mul(): assert S(2).as_coeff_mul() == (2, ()) assert S(3.0).as_coeff_mul() == (1, (S(3.0),)) assert S(-3.0).as_coeff_mul() == (-1, (S(3.0),)) assert S(-3.0).as_coeff_mul(rational=False) == (-S(3.0), ()) assert x.as_coeff_mul() == (1, (x,)) assert (-x).as_coeff_mul() == (-1, (x,)) assert (2*x).as_coeff_mul() == (2, (x,)) assert (x*y).as_coeff_mul(y) == (x, (y,)) assert (3 + x).as_coeff_mul() == (1, (3 + x,)) assert (3 + x).as_coeff_mul(y) == (3 + x, ()) # don't do expansion e = exp(x + y) assert e.as_coeff_mul(y) == (1, (e,)) e = 2**(x + y) assert e.as_coeff_mul(y) == (1, (e,)) assert (1.1*x).as_coeff_mul(rational=False) == (1.1, (x,)) assert (1.1*x).as_coeff_mul() == (1, (1.1, x)) assert (-oo*x).as_coeff_mul(rational=True) == (-1, (oo, x)) def test_as_coeff_exponent(): assert (3*x**4).as_coeff_exponent(x) == (3, 4) assert (2*x**3).as_coeff_exponent(x) == (2, 3) assert (4*x**2).as_coeff_exponent(x) == (4, 2) assert (6*x**1).as_coeff_exponent(x) == (6, 1) assert (3*x**0).as_coeff_exponent(x) == (3, 0) assert (2*x**0).as_coeff_exponent(x) == (2, 0) assert (1*x**0).as_coeff_exponent(x) == (1, 0) assert (0*x**0).as_coeff_exponent(x) == (0, 0) assert (-1*x**0).as_coeff_exponent(x) == (-1, 0) assert (-2*x**0).as_coeff_exponent(x) == (-2, 0) assert (2*x**3 + pi*x**3).as_coeff_exponent(x) == (2 + pi, 3) assert (x*log(2)/(2*x + pi*x)).as_coeff_exponent(x) == \ (log(2)/(2 + pi), 0) # issue 4784 D = Derivative f = Function('f') fx = D(f(x), x) assert fx.as_coeff_exponent(f(x)) == (fx, 0) def test_extractions(): assert ((x*y)**3).extract_multiplicatively(x**2 * y) == x*y**2 assert ((x*y)**3).extract_multiplicatively(x**4 * y) is None assert (2*x).extract_multiplicatively(2) == x assert (2*x).extract_multiplicatively(3) is None assert (2*x).extract_multiplicatively(-1) is None assert (S.Half*x).extract_multiplicatively(3) == x/6 assert (sqrt(x)).extract_multiplicatively(x) is None assert (sqrt(x)).extract_multiplicatively(1/x) is None assert x.extract_multiplicatively(-x) is None assert (-2 - 4*I).extract_multiplicatively(-2) == 1 + 2*I assert (-2 - 4*I).extract_multiplicatively(3) is None assert (-2*x - 4*y - 8).extract_multiplicatively(-2) == x + 2*y + 4 assert (-2*x*y - 4*x**2*y).extract_multiplicatively(-2*y) == 2*x**2 + x assert (2*x*y + 4*x**2*y).extract_multiplicatively(2*y) == 2*x**2 + x assert (-4*y**2*x).extract_multiplicatively(-3*y) is None assert (2*x).extract_multiplicatively(1) == 2*x assert (-oo).extract_multiplicatively(5) is -oo assert (oo).extract_multiplicatively(5) is oo assert ((x*y)**3).extract_additively(1) is None assert (x + 1).extract_additively(x) == 1 assert (x + 1).extract_additively(2*x) is None assert (x + 1).extract_additively(-x) is None assert (-x + 1).extract_additively(2*x) is None assert (2*x + 3).extract_additively(x) == x + 3 assert (2*x + 3).extract_additively(2) == 2*x + 1 assert (2*x + 3).extract_additively(3) == 2*x assert (2*x + 3).extract_additively(-2) is None assert (2*x + 3).extract_additively(3*x) is None assert (2*x + 3).extract_additively(2*x) == 3 assert x.extract_additively(0) == x assert S(2).extract_additively(x) is None assert S(2.).extract_additively(2) is S.Zero assert S(2*x + 3).extract_additively(x + 1) == x + 2 assert S(2*x + 3).extract_additively(y + 1) is None assert S(2*x - 3).extract_additively(x + 1) is None assert S(2*x - 3).extract_additively(y + z) is None assert ((a + 1)*x*4 + y).extract_additively(x).expand() == \ 4*a*x + 3*x + y assert ((a + 1)*x*4 + 3*y).extract_additively(x + 2*y).expand() == \ 4*a*x + 3*x + y assert (y*(x + 1)).extract_additively(x + 1) is None assert ((y + 1)*(x + 1) + 3).extract_additively(x + 1) == \ y*(x + 1) + 3 assert ((x + y)*(x + 1) + x + y + 3).extract_additively(x + y) == \ x*(x + y) + 3 assert (x + y + 2*((x + y)*(x + 1)) + 3).extract_additively((x + y)*(x + 1)) == \ x + y + (x + 1)*(x + y) + 3 assert ((y + 1)*(x + 2*y + 1) + 3).extract_additively(y + 1) == \ (x + 2*y)*(y + 1) + 3 n = Symbol("n", integer=True) assert (Integer(-3)).could_extract_minus_sign() is True assert (-n*x + x).could_extract_minus_sign() != \ (n*x - x).could_extract_minus_sign() assert (x - y).could_extract_minus_sign() != \ (-x + y).could_extract_minus_sign() assert (1 - x - y).could_extract_minus_sign() is True assert (1 - x + y).could_extract_minus_sign() is False assert ((-x - x*y)/y).could_extract_minus_sign() is True assert (-(x + x*y)/y).could_extract_minus_sign() is True assert ((x + x*y)/(-y)).could_extract_minus_sign() is True assert ((x + x*y)/y).could_extract_minus_sign() is False assert (x*(-x - x**3)).could_extract_minus_sign() is True assert ((-x - y)/(x + y)).could_extract_minus_sign() is True class sign_invariant(Function, Expr): nargs = 1 def __neg__(self): return self foo = sign_invariant(x) assert foo == -foo assert foo.could_extract_minus_sign() is False # The results of each of these will vary on different machines, e.g. # the first one might be False and the other (then) is true or vice versa, # so both are included. assert ((-x - y)/(x - y)).could_extract_minus_sign() is False or \ ((-x - y)/(y - x)).could_extract_minus_sign() is False assert (x - y).could_extract_minus_sign() is False assert (-x + y).could_extract_minus_sign() is True # check that result is canonical eq = (3*x + 15*y).extract_multiplicatively(3) assert eq.args == eq.func(*eq.args).args def test_nan_extractions(): for r in (1, 0, I, nan): assert nan.extract_additively(r) is None assert nan.extract_multiplicatively(r) is None def test_coeff(): assert (x + 1).coeff(x + 1) == 1 assert (3*x).coeff(0) == 0 assert (z*(1 + x)*x**2).coeff(1 + x) == z*x**2 assert (1 + 2*x*x**(1 + x)).coeff(x*x**(1 + x)) == 2 assert (1 + 2*x**(y + z)).coeff(x**(y + z)) == 2 assert (3 + 2*x + 4*x**2).coeff(1) == 0 assert (3 + 2*x + 4*x**2).coeff(-1) == 0 assert (3 + 2*x + 4*x**2).coeff(x) == 2 assert (3 + 2*x + 4*x**2).coeff(x**2) == 4 assert (3 + 2*x + 4*x**2).coeff(x**3) == 0 assert (-x/8 + x*y).coeff(x) == Rational(-1, 8) + y assert (-x/8 + x*y).coeff(-x) == S.One/8 assert (4*x).coeff(2*x) == 0 assert (2*x).coeff(2*x) == 1 assert (-oo*x).coeff(x*oo) == -1 assert (10*x).coeff(x, 0) == 0 assert (10*x).coeff(10*x, 0) == 0 n1, n2 = symbols('n1 n2', commutative=False) assert (n1*n2).coeff(n1) == 1 assert (n1*n2).coeff(n2) == n1 assert (n1*n2 + x*n1).coeff(n1) == 1 # 1*n1*(n2+x) assert (n2*n1 + x*n1).coeff(n1) == n2 + x assert (n2*n1 + x*n1**2).coeff(n1) == n2 assert (n1**x).coeff(n1) == 0 assert (n1*n2 + n2*n1).coeff(n1) == 0 assert (2*(n1 + n2)*n2).coeff(n1 + n2, right=1) == n2 assert (2*(n1 + n2)*n2).coeff(n1 + n2, right=0) == 2 f = Function('f') assert (2*f(x) + 3*f(x).diff(x)).coeff(f(x)) == 2 expr = z*(x + y)**2 expr2 = z*(x + y)**2 + z*(2*x + 2*y)**2 assert expr.coeff(z) == (x + y)**2 assert expr.coeff(x + y) == 0 assert expr2.coeff(z) == (x + y)**2 + (2*x + 2*y)**2 assert (x + y + 3*z).coeff(1) == x + y assert (-x + 2*y).coeff(-1) == x assert (x - 2*y).coeff(-1) == 2*y assert (3 + 2*x + 4*x**2).coeff(1) == 0 assert (-x - 2*y).coeff(2) == -y assert (x + sqrt(2)*x).coeff(sqrt(2)) == x assert (3 + 2*x + 4*x**2).coeff(x) == 2 assert (3 + 2*x + 4*x**2).coeff(x**2) == 4 assert (3 + 2*x + 4*x**2).coeff(x**3) == 0 assert (z*(x + y)**2).coeff((x + y)**2) == z assert (z*(x + y)**2).coeff(x + y) == 0 assert (2 + 2*x + (x + 1)*y).coeff(x + 1) == y assert (x + 2*y + 3).coeff(1) == x assert (x + 2*y + 3).coeff(x, 0) == 2*y + 3 assert (x**2 + 2*y + 3*x).coeff(x**2, 0) == 2*y + 3*x assert x.coeff(0, 0) == 0 assert x.coeff(x, 0) == 0 n, m, o, l = symbols('n m o l', commutative=False) assert n.coeff(n) == 1 assert y.coeff(n) == 0 assert (3*n).coeff(n) == 3 assert (2 + n).coeff(x*m) == 0 assert (2*x*n*m).coeff(x) == 2*n*m assert (2 + n).coeff(x*m*n + y) == 0 assert (2*x*n*m).coeff(3*n) == 0 assert (n*m + m*n*m).coeff(n) == 1 + m assert (n*m + m*n*m).coeff(n, right=True) == m # = (1 + m)*n*m assert (n*m + m*n).coeff(n) == 0 assert (n*m + o*m*n).coeff(m*n) == o assert (n*m + o*m*n).coeff(m*n, right=1) == 1 assert (n*m + n*m*n).coeff(n*m, right=1) == 1 + n # = n*m*(n + 1) assert (x*y).coeff(z, 0) == x*y def test_coeff2(): r, kappa = symbols('r, kappa') psi = Function("psi") g = 1/r**2 * (2*r*psi(r).diff(r, 1) + r**2 * psi(r).diff(r, 2)) g = g.expand() assert g.coeff((psi(r).diff(r))) == 2/r def test_coeff2_0(): r, kappa = symbols('r, kappa') psi = Function("psi") g = 1/r**2 * (2*r*psi(r).diff(r, 1) + r**2 * psi(r).diff(r, 2)) g = g.expand() assert g.coeff(psi(r).diff(r, 2)) == 1 def test_coeff_expand(): expr = z*(x + y)**2 expr2 = z*(x + y)**2 + z*(2*x + 2*y)**2 assert expr.coeff(z) == (x + y)**2 assert expr2.coeff(z) == (x + y)**2 + (2*x + 2*y)**2 def test_integrate(): assert x.integrate(x) == x**2/2 assert x.integrate((x, 0, 1)) == S.Half def test_as_base_exp(): assert x.as_base_exp() == (x, S.One) assert (x*y*z).as_base_exp() == (x*y*z, S.One) assert (x + y + z).as_base_exp() == (x + y + z, S.One) assert ((x + y)**z).as_base_exp() == (x + y, z) def test_issue_4963(): assert hasattr(Mul(x, y), "is_commutative") assert hasattr(Mul(x, y, evaluate=False), "is_commutative") assert hasattr(Pow(x, y), "is_commutative") assert hasattr(Pow(x, y, evaluate=False), "is_commutative") expr = Mul(Pow(2, 2, evaluate=False), 3, evaluate=False) + 1 assert hasattr(expr, "is_commutative") def test_action_verbs(): assert nsimplify((1/(exp(3*pi*x/5) + 1))) == \ (1/(exp(3*pi*x/5) + 1)).nsimplify() assert ratsimp(1/x + 1/y) == (1/x + 1/y).ratsimp() assert trigsimp(log(x), deep=True) == (log(x)).trigsimp(deep=True) assert radsimp(1/(2 + sqrt(2))) == (1/(2 + sqrt(2))).radsimp() assert radsimp(1/(a + b*sqrt(c)), symbolic=False) == \ (1/(a + b*sqrt(c))).radsimp(symbolic=False) assert powsimp(x**y*x**z*y**z, combine='all') == \ (x**y*x**z*y**z).powsimp(combine='all') assert (x**t*y**t).powsimp(force=True) == (x*y)**t assert simplify(x**y*x**z*y**z) == (x**y*x**z*y**z).simplify() assert together(1/x + 1/y) == (1/x + 1/y).together() assert collect(a*x**2 + b*x**2 + a*x - b*x + c, x) == \ (a*x**2 + b*x**2 + a*x - b*x + c).collect(x) assert apart(y/(y + 2)/(y + 1), y) == (y/(y + 2)/(y + 1)).apart(y) assert combsimp(y/(x + 2)/(x + 1)) == (y/(x + 2)/(x + 1)).combsimp() assert gammasimp(gamma(x)/gamma(x-5)) == (gamma(x)/gamma(x-5)).gammasimp() assert factor(x**2 + 5*x + 6) == (x**2 + 5*x + 6).factor() assert refine(sqrt(x**2)) == sqrt(x**2).refine() assert cancel((x**2 + 5*x + 6)/(x + 2)) == ((x**2 + 5*x + 6)/(x + 2)).cancel() def test_as_powers_dict(): assert x.as_powers_dict() == {x: 1} assert (x**y*z).as_powers_dict() == {x: y, z: 1} assert Mul(2, 2, evaluate=False).as_powers_dict() == {S(2): S(2)} assert (x*y).as_powers_dict()[z] == 0 assert (x + y).as_powers_dict()[z] == 0 def test_as_coefficients_dict(): check = [S.One, x, y, x*y, 1] assert [Add(3*x, 2*x, y, 3).as_coefficients_dict()[i] for i in check] == \ [3, 5, 1, 0, 3] assert [Add(3*x, 2*x, y, 3, evaluate=False).as_coefficients_dict()[i] for i in check] == [3, 5, 1, 0, 3] assert [(3*x*y).as_coefficients_dict()[i] for i in check] == \ [0, 0, 0, 3, 0] assert [(3.0*x*y).as_coefficients_dict()[i] for i in check] == \ [0, 0, 0, 3.0, 0] assert (3.0*x*y).as_coefficients_dict()[3.0*x*y] == 0 def test_args_cnc(): A = symbols('A', commutative=False) assert (x + A).args_cnc() == \ [[], [x + A]] assert (x + a).args_cnc() == \ [[a + x], []] assert (x*a).args_cnc() == \ [[a, x], []] assert (x*y*A*(A + 1)).args_cnc(cset=True) == \ [{x, y}, [A, 1 + A]] assert Mul(x, x, evaluate=False).args_cnc(cset=True, warn=False) == \ [{x}, []] assert Mul(x, x**2, evaluate=False).args_cnc(cset=True, warn=False) == \ [{x, x**2}, []] raises(ValueError, lambda: Mul(x, x, evaluate=False).args_cnc(cset=True)) assert Mul(x, y, x, evaluate=False).args_cnc() == \ [[x, y, x], []] # always split -1 from leading number assert (-1.*x).args_cnc() == [[-1, 1.0, x], []] def test_new_rawargs(): n = Symbol('n', commutative=False) a = x + n assert a.is_commutative is False assert a._new_rawargs(x).is_commutative assert a._new_rawargs(x, y).is_commutative assert a._new_rawargs(x, n).is_commutative is False assert a._new_rawargs(x, y, n).is_commutative is False m = x*n assert m.is_commutative is False assert m._new_rawargs(x).is_commutative assert m._new_rawargs(n).is_commutative is False assert m._new_rawargs(x, y).is_commutative assert m._new_rawargs(x, n).is_commutative is False assert m._new_rawargs(x, y, n).is_commutative is False assert m._new_rawargs(x, n, reeval=False).is_commutative is False assert m._new_rawargs(S.One) is S.One def test_issue_5226(): assert Add(evaluate=False) == 0 assert Mul(evaluate=False) == 1 assert Mul(x + y, evaluate=False).is_Add def test_free_symbols(): # free_symbols should return the free symbols of an object assert S.One.free_symbols == set() assert x.free_symbols == {x} assert Integral(x, (x, 1, y)).free_symbols == {y} assert (-Integral(x, (x, 1, y))).free_symbols == {y} assert meter.free_symbols == set() assert (meter**x).free_symbols == {x} def test_issue_5300(): x = Symbol('x', commutative=False) assert x*sqrt(2)/sqrt(6) == x*sqrt(3)/3 def test_floordiv(): from sympy.functions.elementary.integers import floor assert x // y == floor(x / y) def test_as_coeff_Mul(): assert S.Zero.as_coeff_Mul() == (S.One, S.Zero) assert Integer(3).as_coeff_Mul() == (Integer(3), Integer(1)) assert Rational(3, 4).as_coeff_Mul() == (Rational(3, 4), Integer(1)) assert Float(5.0).as_coeff_Mul() == (Float(5.0), Integer(1)) assert (Integer(3)*x).as_coeff_Mul() == (Integer(3), x) assert (Rational(3, 4)*x).as_coeff_Mul() == (Rational(3, 4), x) assert (Float(5.0)*x).as_coeff_Mul() == (Float(5.0), x) assert (Integer(3)*x*y).as_coeff_Mul() == (Integer(3), x*y) assert (Rational(3, 4)*x*y).as_coeff_Mul() == (Rational(3, 4), x*y) assert (Float(5.0)*x*y).as_coeff_Mul() == (Float(5.0), x*y) assert (x).as_coeff_Mul() == (S.One, x) assert (x*y).as_coeff_Mul() == (S.One, x*y) assert (-oo*x).as_coeff_Mul(rational=True) == (-1, oo*x) def test_as_coeff_Add(): assert Integer(3).as_coeff_Add() == (Integer(3), Integer(0)) assert Rational(3, 4).as_coeff_Add() == (Rational(3, 4), Integer(0)) assert Float(5.0).as_coeff_Add() == (Float(5.0), Integer(0)) assert (Integer(3) + x).as_coeff_Add() == (Integer(3), x) assert (Rational(3, 4) + x).as_coeff_Add() == (Rational(3, 4), x) assert (Float(5.0) + x).as_coeff_Add() == (Float(5.0), x) assert (Float(5.0) + x).as_coeff_Add(rational=True) == (0, Float(5.0) + x) assert (Integer(3) + x + y).as_coeff_Add() == (Integer(3), x + y) assert (Rational(3, 4) + x + y).as_coeff_Add() == (Rational(3, 4), x + y) assert (Float(5.0) + x + y).as_coeff_Add() == (Float(5.0), x + y) assert (x).as_coeff_Add() == (S.Zero, x) assert (x*y).as_coeff_Add() == (S.Zero, x*y) def test_expr_sorting(): f, g = symbols('f,g', cls=Function) exprs = [1/x**2, 1/x, sqrt(sqrt(x)), sqrt(x), x, sqrt(x)**3, x**2] assert sorted(exprs, key=default_sort_key) == exprs exprs = [x, 2*x, 2*x**2, 2*x**3, x**n, 2*x**n, sin(x), sin(x)**n, sin(x**2), cos(x), cos(x**2), tan(x)] assert sorted(exprs, key=default_sort_key) == exprs exprs = [x + 1, x**2 + x + 1, x**3 + x**2 + x + 1] assert sorted(exprs, key=default_sort_key) == exprs exprs = [S(4), x - 3*I/2, x + 3*I/2, x - 4*I + 1, x + 4*I + 1] assert sorted(exprs, key=default_sort_key) == exprs exprs = [f(1), f(2), f(3), f(1, 2, 3), g(1), g(2), g(3), g(1, 2, 3)] assert sorted(exprs, key=default_sort_key) == exprs exprs = [f(x), g(x), exp(x), sin(x), cos(x), factorial(x)] assert sorted(exprs, key=default_sort_key) == exprs exprs = [Tuple(x, y), Tuple(x, z), Tuple(x, y, z)] assert sorted(exprs, key=default_sort_key) == exprs exprs = [[3], [1, 2]] assert sorted(exprs, key=default_sort_key) == exprs exprs = [[1, 2], [2, 3]] assert sorted(exprs, key=default_sort_key) == exprs exprs = [[1, 2], [1, 2, 3]] assert sorted(exprs, key=default_sort_key) == exprs exprs = [{x: -y}, {x: y}] assert sorted(exprs, key=default_sort_key) == exprs exprs = [{1}, {1, 2}] assert sorted(exprs, key=default_sort_key) == exprs a, b = exprs = [Dummy('x'), Dummy('x')] assert sorted([b, a], key=default_sort_key) == exprs def test_as_ordered_factors(): f, g = symbols('f,g', cls=Function) assert x.as_ordered_factors() == [x] assert (2*x*x**n*sin(x)*cos(x)).as_ordered_factors() \ == [Integer(2), x, x**n, sin(x), cos(x)] args = [f(1), f(2), f(3), f(1, 2, 3), g(1), g(2), g(3), g(1, 2, 3)] expr = Mul(*args) assert expr.as_ordered_factors() == args A, B = symbols('A,B', commutative=False) assert (A*B).as_ordered_factors() == [A, B] assert (B*A).as_ordered_factors() == [B, A] def test_as_ordered_terms(): f, g = symbols('f,g', cls=Function) assert x.as_ordered_terms() == [x] assert (sin(x)**2*cos(x) + sin(x)*cos(x)**2 + 1).as_ordered_terms() \ == [sin(x)**2*cos(x), sin(x)*cos(x)**2, 1] args = [f(1), f(2), f(3), f(1, 2, 3), g(1), g(2), g(3), g(1, 2, 3)] expr = Add(*args) assert expr.as_ordered_terms() == args assert (1 + 4*sqrt(3)*pi*x).as_ordered_terms() == [4*pi*x*sqrt(3), 1] assert ( 2 + 3*I).as_ordered_terms() == [2, 3*I] assert (-2 + 3*I).as_ordered_terms() == [-2, 3*I] assert ( 2 - 3*I).as_ordered_terms() == [2, -3*I] assert (-2 - 3*I).as_ordered_terms() == [-2, -3*I] assert ( 4 + 3*I).as_ordered_terms() == [4, 3*I] assert (-4 + 3*I).as_ordered_terms() == [-4, 3*I] assert ( 4 - 3*I).as_ordered_terms() == [4, -3*I] assert (-4 - 3*I).as_ordered_terms() == [-4, -3*I] f = x**2*y**2 + x*y**4 + y + 2 assert f.as_ordered_terms(order="lex") == [x**2*y**2, x*y**4, y, 2] assert f.as_ordered_terms(order="grlex") == [x*y**4, x**2*y**2, y, 2] assert f.as_ordered_terms(order="rev-lex") == [2, y, x*y**4, x**2*y**2] assert f.as_ordered_terms(order="rev-grlex") == [2, y, x**2*y**2, x*y**4] k = symbols('k') assert k.as_ordered_terms(data=True) == ([(k, ((1.0, 0.0), (1,), ()))], [k]) def test_sort_key_atomic_expr(): from sympy.physics.units import m, s assert sorted([-m, s], key=lambda arg: arg.sort_key()) == [-m, s] def test_eval_interval(): assert exp(x)._eval_interval(*Tuple(x, 0, 1)) == exp(1) - exp(0) # issue 4199 # first subs and limit gives NaN a = x/y assert a._eval_interval(x, S.Zero, oo)._eval_interval(y, oo, S.Zero) is S.NaN # second subs and limit gives NaN assert a._eval_interval(x, S.Zero, oo)._eval_interval(y, S.Zero, oo) is S.NaN # difference gives S.NaN a = x - y assert a._eval_interval(x, S.One, oo)._eval_interval(y, oo, S.One) is S.NaN raises(ValueError, lambda: x._eval_interval(x, None, None)) a = -y*Heaviside(x - y) assert a._eval_interval(x, -oo, oo) == -y assert a._eval_interval(x, oo, -oo) == y def test_eval_interval_zoo(): # Test that limit is used when zoo is returned assert Si(1/x)._eval_interval(x, S.Zero, S.One) == -pi/2 + Si(1) def test_primitive(): assert (3*(x + 1)**2).primitive() == (3, (x + 1)**2) assert (6*x + 2).primitive() == (2, 3*x + 1) assert (x/2 + 3).primitive() == (S.Half, x + 6) eq = (6*x + 2)*(x/2 + 3) assert eq.primitive()[0] == 1 eq = (2 + 2*x)**2 assert eq.primitive()[0] == 1 assert (4.0*x).primitive() == (1, 4.0*x) assert (4.0*x + y/2).primitive() == (S.Half, 8.0*x + y) assert (-2*x).primitive() == (2, -x) assert Add(5*z/7, 0.5*x, 3*y/2, evaluate=False).primitive() == \ (S.One/14, 7.0*x + 21*y + 10*z) for i in [S.Infinity, S.NegativeInfinity, S.ComplexInfinity]: assert (i + x/3).primitive() == \ (S.One/3, i + x) assert (S.Infinity + 2*x/3 + 4*y/7).primitive() == \ (S.One/21, 14*x + 12*y + oo) assert S.Zero.primitive() == (S.One, S.Zero) def test_issue_5843(): a = 1 + x assert (2*a).extract_multiplicatively(a) == 2 assert (4*a).extract_multiplicatively(2*a) == 2 assert ((3*a)*(2*a)).extract_multiplicatively(a) == 6*a def test_is_constant(): from sympy.solvers.solvers import checksol Sum(x, (x, 1, 10)).is_constant() is True Sum(x, (x, 1, n)).is_constant() is False Sum(x, (x, 1, n)).is_constant(y) is True Sum(x, (x, 1, n)).is_constant(n) is False Sum(x, (x, 1, n)).is_constant(x) is True eq = a*cos(x)**2 + a*sin(x)**2 - a eq.is_constant() is True assert eq.subs({x: pi, a: 2}) == eq.subs({x: pi, a: 3}) == 0 assert x.is_constant() is False assert x.is_constant(y) is True assert checksol(x, x, Sum(x, (x, 1, n))) is False assert checksol(x, x, Sum(x, (x, 1, n))) is False f = Function('f') assert f(1).is_constant assert checksol(x, x, f(x)) is False assert Pow(x, S.Zero, evaluate=False).is_constant() is True # == 1 assert Pow(S.Zero, x, evaluate=False).is_constant() is False # == 0 or 1 assert (2**x).is_constant() is False assert Pow(S(2), S(3), evaluate=False).is_constant() is True z1, z2 = symbols('z1 z2', zero=True) assert (z1 + 2*z2).is_constant() is True assert meter.is_constant() is True assert (3*meter).is_constant() is True assert (x*meter).is_constant() is False def test_equals(): assert (-3 - sqrt(5) + (-sqrt(10)/2 - sqrt(2)/2)**2).equals(0) assert (x**2 - 1).equals((x + 1)*(x - 1)) assert (cos(x)**2 + sin(x)**2).equals(1) assert (a*cos(x)**2 + a*sin(x)**2).equals(a) r = sqrt(2) assert (-1/(r + r*x) + 1/r/(1 + x)).equals(0) assert factorial(x + 1).equals((x + 1)*factorial(x)) assert sqrt(3).equals(2*sqrt(3)) is False assert (sqrt(5)*sqrt(3)).equals(sqrt(3)) is False assert (sqrt(5) + sqrt(3)).equals(0) is False assert (sqrt(5) + pi).equals(0) is False assert meter.equals(0) is False assert (3*meter**2).equals(0) is False eq = -(-1)**(S(3)/4)*6**(S.One/4) + (-6)**(S.One/4)*I if eq != 0: # if canonicalization makes this zero, skip the test assert eq.equals(0) assert sqrt(x).equals(0) is False # from integrate(x*sqrt(1 + 2*x), x); # diff is zero only when assumptions allow i = 2*sqrt(2)*x**(S(5)/2)*(1 + 1/(2*x))**(S(5)/2)/5 + \ 2*sqrt(2)*x**(S(3)/2)*(1 + 1/(2*x))**(S(5)/2)/(-6 - 3/x) ans = sqrt(2*x + 1)*(6*x**2 + x - 1)/15 diff = i - ans assert diff.equals(0) is False assert diff.subs(x, Rational(-1, 2)/2) == 7*sqrt(2)/120 # there are regions for x for which the expression is True, for # example, when x < -1/2 or x > 0 the expression is zero p = Symbol('p', positive=True) assert diff.subs(x, p).equals(0) is True assert diff.subs(x, -1).equals(0) is True # prove via minimal_polynomial or self-consistency eq = sqrt(1 + sqrt(3)) + sqrt(3 + 3*sqrt(3)) - sqrt(10 + 6*sqrt(3)) assert eq.equals(0) q = 3**Rational(1, 3) + 3 p = expand(q**3)**Rational(1, 3) assert (p - q).equals(0) # issue 6829 # eq = q*x + q/4 + x**4 + x**3 + 2*x**2 - S.One/3 # z = eq.subs(x, solve(eq, x)[0]) q = symbols('q') z = (q*(-sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12)/2 - sqrt((2*q - S(7)/4)/sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12) + 2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/6)/2 - S.One/4) + q/4 + (-sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12)/2 - sqrt((2*q - S(7)/4)/sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12) + 2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/6)/2 - S.One/4)**4 + (-sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12)/2 - sqrt((2*q - S(7)/4)/sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12) + 2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/6)/2 - S.One/4)**3 + 2*(-sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12)/2 - sqrt((2*q - S(7)/4)/sqrt(-2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/12) + 2*(-(q - S(7)/8)**S(2)/8 - S(2197)/13824)**(S.One/3) - S(13)/6)/2 - S.One/4)**2 - Rational(1, 3)) assert z.equals(0) def test_random(): from sympy import posify, lucas assert posify(x)[0]._random() is not None assert lucas(n)._random(2, -2, 0, -1, 1) is None # issue 8662 assert Piecewise((Max(x, y), z))._random() is None def test_round(): from sympy.abc import x assert str(Float('0.1249999').round(2)) == '0.12' d20 = 12345678901234567890 ans = S(d20).round(2) assert ans.is_Integer and ans == d20 ans = S(d20).round(-2) assert ans.is_Integer and ans == 12345678901234567900 assert str(S('1/7').round(4)) == '0.1429' assert str(S('.[12345]').round(4)) == '0.1235' assert str(S('.1349').round(2)) == '0.13' n = S(12345) ans = n.round() assert ans.is_Integer assert ans == n ans = n.round(1) assert ans.is_Integer assert ans == n ans = n.round(4) assert ans.is_Integer assert ans == n assert n.round(-1) == 12340 r = Float(str(n)).round(-4) assert r == 10000 assert n.round(-5) == 0 assert str((pi + sqrt(2)).round(2)) == '4.56' assert (10*(pi + sqrt(2))).round(-1) == 50 raises(TypeError, lambda: round(x + 2, 2)) assert str(S(2.3).round(1)) == '2.3' # rounding in SymPy (as in Decimal) should be # exact for the given precision; we check here # that when a 5 follows the last digit that # the rounded digit will be even. for i in range(-99, 100): # construct a decimal that ends in 5, e.g. 123 -> 0.1235 s = str(abs(i)) p = len(s) # we are going to round to the last digit of i n = '0.%s5' % s # put a 5 after i's digits j = p + 2 # 2 for '0.' if i < 0: # 1 for '-' j += 1 n = '-' + n v = str(Float(n).round(p))[:j] # pertinent digits if v.endswith('.'): continue # it ends with 0 which is even L = int(v[-1]) # last digit assert L % 2 == 0, (n, '->', v) assert (Float(.3, 3) + 2*pi).round() == 7 assert (Float(.3, 3) + 2*pi*100).round() == 629 assert (pi + 2*E*I).round() == 3 + 5*I # don't let request for extra precision give more than # what is known (in this case, only 3 digits) assert str((Float(.03, 3) + 2*pi/100).round(5)) == '0.0928' assert str((Float(.03, 3) + 2*pi/100).round(4)) == '0.0928' assert S.Zero.round() == 0 a = (Add(1, Float('1.' + '9'*27, ''), evaluate=0)) assert a.round(10) == Float('3.0000000000', '') assert a.round(25) == Float('3.0000000000000000000000000', '') assert a.round(26) == Float('3.00000000000000000000000000', '') assert a.round(27) == Float('2.999999999999999999999999999', '') assert a.round(30) == Float('2.999999999999999999999999999', '') raises(TypeError, lambda: x.round()) f = Function('f') raises(TypeError, lambda: f(1).round()) # exact magnitude of 10 assert str(S.One.round()) == '1' assert str(S(100).round()) == '100' # applied to real and imaginary portions assert (2*pi + E*I).round() == 6 + 3*I assert (2*pi + I/10).round() == 6 assert (pi/10 + 2*I).round() == 2*I # the lhs re and im parts are Float with dps of 2 # and those on the right have dps of 15 so they won't compare # equal unless we use string or compare components (which will # then coerce the floats to the same precision) or re-create # the floats assert str((pi/10 + E*I).round(2)) == '0.31 + 2.72*I' assert str((pi/10 + E*I).round(2).as_real_imag()) == '(0.31, 2.72)' assert str((pi/10 + E*I).round(2)) == '0.31 + 2.72*I' # issue 6914 assert (I**(I + 3)).round(3) == Float('-0.208', '')*I # issue 8720 assert S(-123.6).round() == -124 assert S(-1.5).round() == -2 assert S(-100.5).round() == -100 assert S(-1.5 - 10.5*I).round() == -2 - 10*I # issue 7961 assert str(S(0.006).round(2)) == '0.01' assert str(S(0.00106).round(4)) == '0.0011' # issue 8147 assert S.NaN.round() is S.NaN assert S.Infinity.round() is S.Infinity assert S.NegativeInfinity.round() is S.NegativeInfinity assert S.ComplexInfinity.round() is S.ComplexInfinity # check that types match for i in range(2): f = float(i) # 2 args assert all(type(round(i, p)) is int for p in (-1, 0, 1)) assert all(S(i).round(p).is_Integer for p in (-1, 0, 1)) assert all(type(round(f, p)) is float for p in (-1, 0, 1)) assert all(S(f).round(p).is_Float for p in (-1, 0, 1)) # 1 arg (p is None) assert type(round(i)) is int assert S(i).round().is_Integer assert type(round(f)) is int assert S(f).round().is_Integer def test_held_expression_UnevaluatedExpr(): x = symbols("x") he = UnevaluatedExpr(1/x) e1 = x*he assert isinstance(e1, Mul) assert e1.args == (x, he) assert e1.doit() == 1 assert UnevaluatedExpr(Derivative(x, x)).doit(deep=False ) == Derivative(x, x) assert UnevaluatedExpr(Derivative(x, x)).doit() == 1 xx = Mul(x, x, evaluate=False) assert xx != x**2 ue2 = UnevaluatedExpr(xx) assert isinstance(ue2, UnevaluatedExpr) assert ue2.args == (xx,) assert ue2.doit() == x**2 assert ue2.doit(deep=False) == xx x2 = UnevaluatedExpr(2)*2 assert type(x2) is Mul assert x2.args == (2, UnevaluatedExpr(2)) def test_round_exception_nostr(): # Don't use the string form of the expression in the round exception, as # it's too slow s = Symbol('bad') try: s.round() except TypeError as e: assert 'bad' not in str(e) else: # Did not raise raise AssertionError("Did not raise") def test_extract_branch_factor(): assert exp_polar(2.0*I*pi).extract_branch_factor() == (1, 1) def test_identity_removal(): assert Add.make_args(x + 0) == (x,) assert Mul.make_args(x*1) == (x,) def test_float_0(): assert Float(0.0) + 1 == Float(1.0) @XFAIL def test_float_0_fail(): assert Float(0.0)*x == Float(0.0) assert (x + Float(0.0)).is_Add def test_issue_6325(): ans = (b**2 + z**2 - (b*(a + b*t) + z*(c + t*z))**2/( (a + b*t)**2 + (c + t*z)**2))/sqrt((a + b*t)**2 + (c + t*z)**2) e = sqrt((a + b*t)**2 + (c + z*t)**2) assert diff(e, t, 2) == ans e.diff(t, 2) == ans assert diff(e, t, 2, simplify=False) != ans def test_issue_7426(): f1 = a % c f2 = x % z assert f1.equals(f2) is None def test_issue_11122(): x = Symbol('x', extended_positive=False) assert unchanged(Gt, x, 0) # (x > 0) # (x > 0) should remain unevaluated after PR #16956 x = Symbol('x', positive=False, real=True) assert (x > 0) is S.false def test_issue_10651(): x = Symbol('x', real=True) e1 = (-1 + x)/(1 - x) e3 = (4*x**2 - 4)/((1 - x)*(1 + x)) e4 = 1/(cos(x)**2) - (tan(x))**2 x = Symbol('x', positive=True) e5 = (1 + x)/x assert e1.is_constant() is None assert e3.is_constant() is None assert e4.is_constant() is None assert e5.is_constant() is False def test_issue_10161(): x = symbols('x', real=True) assert x*abs(x)*abs(x) == x**3 def test_issue_10755(): x = symbols('x') raises(TypeError, lambda: int(log(x))) raises(TypeError, lambda: log(x).round(2)) def test_issue_11877(): x = symbols('x') assert integrate(log(S.Half - x), (x, 0, S.Half)) == Rational(-1, 2) -log(2)/2 def test_normal(): x = symbols('x') e = Mul(S.Half, 1 + x, evaluate=False) assert e.normal() == e def test_expr(): x = symbols('x') raises(TypeError, lambda: tan(x).series(x, 2, oo, "+")) def test_ExprBuilder(): eb = ExprBuilder(Mul) eb.args.extend([x, x]) assert eb.build() == x**2 def test_non_string_equality(): # Expressions should not compare equal to strings x = symbols('x') one = sympify(1) assert (x == 'x') is False assert (x != 'x') is True assert (one == '1') is False assert (one != '1') is True assert (x + 1 == 'x + 1') is False assert (x + 1 != 'x + 1') is True # Make sure == doesn't try to convert the resulting expression to a string # (e.g., by calling sympify() instead of _sympify()) class BadRepr(object): def __repr__(self): raise RuntimeError assert (x == BadRepr()) is False assert (x != BadRepr()) is True
303d4bc77d0761c3f0229e299370c4d5ba450dea27931c4c3a7e2ff53a5df065
from sympy.core.compatibility import (default_sort_key, as_int, ordered, iterable, NotIterable) from sympy.core.singleton import S from sympy.testing.pytest import raises from sympy.abc import x def test_default_sort_key(): func = lambda x: x assert sorted([func, x, func], key=default_sort_key) == [func, func, x] def test_as_int(): raises(ValueError, lambda : as_int(1.1)) raises(ValueError, lambda : as_int([])) raises(ValueError, lambda : as_int(S.NaN)) raises(ValueError, lambda : as_int(S.Infinity)) raises(ValueError, lambda : as_int(S.NegativeInfinity)) raises(ValueError, lambda : as_int(S.ComplexInfinity)) # for the following, limited precision makes int(arg) == arg # but the int value is not necessarily what a user might have # expected; Q.prime is more nuanced in its response for # expressions which might be complex representations of an # integer. This is not -- by design -- as_ints role. raises(ValueError, lambda : as_int(1e23)) raises(ValueError, lambda : as_int(S('1.'+'0'*20+'1'))) def test_iterable(): assert iterable(0) is False assert iterable(1) is False assert iterable(None) is False class Test1(NotIterable): pass assert iterable(Test1()) is False class Test2(NotIterable): _iterable = True assert iterable(Test2()) is True class Test3(object): pass assert iterable(Test3()) is False class Test4(object): _iterable = True assert iterable(Test4()) is True class Test5(object): def __iter__(self): yield 1 assert iterable(Test5()) is True class Test6(Test5): _iterable = False assert iterable(Test6()) is False def test_ordered(): # Issue 7210 - this had been failing with python2/3 problems assert (list(ordered([{1:3, 2:4, 9:10}, {1:3}])) == \ [{1: 3}, {1: 3, 2: 4, 9: 10}]) # warnings should not be raised for identical items l = [1, 1] assert list(ordered(l, warn=True)) == l l = [[1], [2], [1]] assert list(ordered(l, warn=True)) == [[1], [1], [2]] raises(ValueError, lambda: list(ordered(['a', 'ab'], keys=[lambda x: x[0]], default=False, warn=True)))
0ec387e3c2401313197dc43b6367d4ebc8c8ce3884f976db03ea1bdf1e4fe884
"""Test whether all elements of cls.args are instances of Basic. """ # NOTE: keep tests sorted by (module, class name) key. If a class can't # be instantiated, add it here anyway with @SKIP("abstract class) (see # e.g. Function). import os import re import io from sympy import (Basic, S, symbols, sqrt, sin, oo, Interval, exp, Lambda, pi, Eq, log, Function, Rational) from sympy.testing.pytest import XFAIL, SKIP x, y, z = symbols('x,y,z') def test_all_classes_are_tested(): this = os.path.split(__file__)[0] path = os.path.join(this, os.pardir, os.pardir) sympy_path = os.path.abspath(path) prefix = os.path.split(sympy_path)[0] + os.sep re_cls = re.compile(r"^class ([A-Za-z][A-Za-z0-9_]*)\s*\(", re.MULTILINE) modules = {} for root, dirs, files in os.walk(sympy_path): module = root.replace(prefix, "").replace(os.sep, ".") for file in files: if file.startswith(("_", "test_", "bench_")): continue if not file.endswith(".py"): continue with io.open(os.path.join(root, file), "r", encoding='utf-8') as f: text = f.read() submodule = module + '.' + file[:-3] names = re_cls.findall(text) if not names: continue try: mod = __import__(submodule, fromlist=names) except ImportError: continue def is_Basic(name): cls = getattr(mod, name) if hasattr(cls, '_sympy_deprecated_func'): cls = cls._sympy_deprecated_func return issubclass(cls, Basic) names = list(filter(is_Basic, names)) if names: modules[submodule] = names ns = globals() failed = [] for module, names in modules.items(): mod = module.replace('.', '__') for name in names: test = 'test_' + mod + '__' + name if test not in ns: failed.append(module + '.' + name) assert not failed, "Missing classes: %s. Please add tests for these to sympy/core/tests/test_args.py." % ", ".join(failed) def _test_args(obj): all_basic = all(isinstance(arg, Basic) for arg in obj.args) # Ideally obj.func(*obj.args) would always recreate the object, but for # now, we only require it for objects with non-empty .args recreatable = not obj.args or obj.func(*obj.args) == obj return all_basic and recreatable def test_sympy__assumptions__assume__AppliedPredicate(): from sympy.assumptions.assume import AppliedPredicate, Predicate from sympy import Q assert _test_args(AppliedPredicate(Predicate("test"), 2)) assert _test_args(Q.is_true(True)) def test_sympy__assumptions__assume__Predicate(): from sympy.assumptions.assume import Predicate assert _test_args(Predicate("test")) def test_sympy__assumptions__sathandlers__UnevaluatedOnFree(): from sympy.assumptions.sathandlers import UnevaluatedOnFree from sympy import Q assert _test_args(UnevaluatedOnFree(Q.positive)) def test_sympy__assumptions__sathandlers__AllArgs(): from sympy.assumptions.sathandlers import AllArgs from sympy import Q assert _test_args(AllArgs(Q.positive)) def test_sympy__assumptions__sathandlers__AnyArgs(): from sympy.assumptions.sathandlers import AnyArgs from sympy import Q assert _test_args(AnyArgs(Q.positive)) def test_sympy__assumptions__sathandlers__ExactlyOneArg(): from sympy.assumptions.sathandlers import ExactlyOneArg from sympy import Q assert _test_args(ExactlyOneArg(Q.positive)) def test_sympy__assumptions__sathandlers__CheckOldAssump(): from sympy.assumptions.sathandlers import CheckOldAssump from sympy import Q assert _test_args(CheckOldAssump(Q.positive)) def test_sympy__assumptions__sathandlers__CheckIsPrime(): from sympy.assumptions.sathandlers import CheckIsPrime from sympy import Q # Input must be a number assert _test_args(CheckIsPrime(Q.positive)) @SKIP("abstract Class") def test_sympy__codegen__ast__AssignmentBase(): from sympy.codegen.ast import AssignmentBase assert _test_args(AssignmentBase(x, 1)) @SKIP("abstract Class") def test_sympy__codegen__ast__AugmentedAssignment(): from sympy.codegen.ast import AugmentedAssignment assert _test_args(AugmentedAssignment(x, 1)) def test_sympy__codegen__ast__AddAugmentedAssignment(): from sympy.codegen.ast import AddAugmentedAssignment assert _test_args(AddAugmentedAssignment(x, 1)) def test_sympy__codegen__ast__SubAugmentedAssignment(): from sympy.codegen.ast import SubAugmentedAssignment assert _test_args(SubAugmentedAssignment(x, 1)) def test_sympy__codegen__ast__MulAugmentedAssignment(): from sympy.codegen.ast import MulAugmentedAssignment assert _test_args(MulAugmentedAssignment(x, 1)) def test_sympy__codegen__ast__DivAugmentedAssignment(): from sympy.codegen.ast import DivAugmentedAssignment assert _test_args(DivAugmentedAssignment(x, 1)) def test_sympy__codegen__ast__ModAugmentedAssignment(): from sympy.codegen.ast import ModAugmentedAssignment assert _test_args(ModAugmentedAssignment(x, 1)) def test_sympy__codegen__ast__CodeBlock(): from sympy.codegen.ast import CodeBlock, Assignment assert _test_args(CodeBlock(Assignment(x, 1), Assignment(y, 2))) def test_sympy__codegen__ast__For(): from sympy.codegen.ast import For, CodeBlock, AddAugmentedAssignment from sympy import Range assert _test_args(For(x, Range(10), CodeBlock(AddAugmentedAssignment(y, 1)))) def test_sympy__codegen__ast__Token(): from sympy.codegen.ast import Token assert _test_args(Token()) def test_sympy__codegen__ast__ContinueToken(): from sympy.codegen.ast import ContinueToken assert _test_args(ContinueToken()) def test_sympy__codegen__ast__BreakToken(): from sympy.codegen.ast import BreakToken assert _test_args(BreakToken()) def test_sympy__codegen__ast__NoneToken(): from sympy.codegen.ast import NoneToken assert _test_args(NoneToken()) def test_sympy__codegen__ast__String(): from sympy.codegen.ast import String assert _test_args(String('foobar')) def test_sympy__codegen__ast__QuotedString(): from sympy.codegen.ast import QuotedString assert _test_args(QuotedString('foobar')) def test_sympy__codegen__ast__Comment(): from sympy.codegen.ast import Comment assert _test_args(Comment('this is a comment')) def test_sympy__codegen__ast__Node(): from sympy.codegen.ast import Node assert _test_args(Node()) assert _test_args(Node(attrs={1, 2, 3})) def test_sympy__codegen__ast__Type(): from sympy.codegen.ast import Type assert _test_args(Type('float128')) def test_sympy__codegen__ast__IntBaseType(): from sympy.codegen.ast import IntBaseType assert _test_args(IntBaseType('bigint')) def test_sympy__codegen__ast___SizedIntType(): from sympy.codegen.ast import _SizedIntType assert _test_args(_SizedIntType('int128', 128)) def test_sympy__codegen__ast__SignedIntType(): from sympy.codegen.ast import SignedIntType assert _test_args(SignedIntType('int128_with_sign', 128)) def test_sympy__codegen__ast__UnsignedIntType(): from sympy.codegen.ast import UnsignedIntType assert _test_args(UnsignedIntType('unt128', 128)) def test_sympy__codegen__ast__FloatBaseType(): from sympy.codegen.ast import FloatBaseType assert _test_args(FloatBaseType('positive_real')) def test_sympy__codegen__ast__FloatType(): from sympy.codegen.ast import FloatType assert _test_args(FloatType('float242', 242, nmant=142, nexp=99)) def test_sympy__codegen__ast__ComplexBaseType(): from sympy.codegen.ast import ComplexBaseType assert _test_args(ComplexBaseType('positive_cmplx')) def test_sympy__codegen__ast__ComplexType(): from sympy.codegen.ast import ComplexType assert _test_args(ComplexType('complex42', 42, nmant=15, nexp=5)) def test_sympy__codegen__ast__Attribute(): from sympy.codegen.ast import Attribute assert _test_args(Attribute('noexcept')) def test_sympy__codegen__ast__Variable(): from sympy.codegen.ast import Variable, Type, value_const assert _test_args(Variable(x)) assert _test_args(Variable(y, Type('float32'), {value_const})) assert _test_args(Variable(z, type=Type('float64'))) def test_sympy__codegen__ast__Pointer(): from sympy.codegen.ast import Pointer, Type, pointer_const assert _test_args(Pointer(x)) assert _test_args(Pointer(y, type=Type('float32'))) assert _test_args(Pointer(z, Type('float64'), {pointer_const})) def test_sympy__codegen__ast__Declaration(): from sympy.codegen.ast import Declaration, Variable, Type vx = Variable(x, type=Type('float')) assert _test_args(Declaration(vx)) def test_sympy__codegen__ast__While(): from sympy.codegen.ast import While, AddAugmentedAssignment assert _test_args(While(abs(x) < 1, [AddAugmentedAssignment(x, -1)])) def test_sympy__codegen__ast__Scope(): from sympy.codegen.ast import Scope, AddAugmentedAssignment assert _test_args(Scope([AddAugmentedAssignment(x, -1)])) def test_sympy__codegen__ast__Stream(): from sympy.codegen.ast import Stream assert _test_args(Stream('stdin')) def test_sympy__codegen__ast__Print(): from sympy.codegen.ast import Print assert _test_args(Print([x, y])) assert _test_args(Print([x, y], "%d %d")) def test_sympy__codegen__ast__FunctionPrototype(): from sympy.codegen.ast import FunctionPrototype, real, Declaration, Variable inp_x = Declaration(Variable(x, type=real)) assert _test_args(FunctionPrototype(real, 'pwer', [inp_x])) def test_sympy__codegen__ast__FunctionDefinition(): from sympy.codegen.ast import FunctionDefinition, real, Declaration, Variable, Assignment inp_x = Declaration(Variable(x, type=real)) assert _test_args(FunctionDefinition(real, 'pwer', [inp_x], [Assignment(x, x**2)])) def test_sympy__codegen__ast__Return(): from sympy.codegen.ast import Return assert _test_args(Return(x)) def test_sympy__codegen__ast__FunctionCall(): from sympy.codegen.ast import FunctionCall assert _test_args(FunctionCall('pwer', [x])) def test_sympy__codegen__ast__Element(): from sympy.codegen.ast import Element assert _test_args(Element('x', range(3))) def test_sympy__codegen__cnodes__CommaOperator(): from sympy.codegen.cnodes import CommaOperator assert _test_args(CommaOperator(1, 2)) def test_sympy__codegen__cnodes__goto(): from sympy.codegen.cnodes import goto assert _test_args(goto('early_exit')) def test_sympy__codegen__cnodes__Label(): from sympy.codegen.cnodes import Label assert _test_args(Label('early_exit')) def test_sympy__codegen__cnodes__PreDecrement(): from sympy.codegen.cnodes import PreDecrement assert _test_args(PreDecrement(x)) def test_sympy__codegen__cnodes__PostDecrement(): from sympy.codegen.cnodes import PostDecrement assert _test_args(PostDecrement(x)) def test_sympy__codegen__cnodes__PreIncrement(): from sympy.codegen.cnodes import PreIncrement assert _test_args(PreIncrement(x)) def test_sympy__codegen__cnodes__PostIncrement(): from sympy.codegen.cnodes import PostIncrement assert _test_args(PostIncrement(x)) def test_sympy__codegen__cnodes__struct(): from sympy.codegen.ast import real, Variable from sympy.codegen.cnodes import struct assert _test_args(struct(declarations=[ Variable(x, type=real), Variable(y, type=real) ])) def test_sympy__codegen__cnodes__union(): from sympy.codegen.ast import float32, int32, Variable from sympy.codegen.cnodes import union assert _test_args(union(declarations=[ Variable(x, type=float32), Variable(y, type=int32) ])) def test_sympy__codegen__cxxnodes__using(): from sympy.codegen.cxxnodes import using assert _test_args(using('std::vector')) assert _test_args(using('std::vector', 'vec')) def test_sympy__codegen__fnodes__Program(): from sympy.codegen.fnodes import Program assert _test_args(Program('foobar', [])) def test_sympy__codegen__fnodes__Module(): from sympy.codegen.fnodes import Module assert _test_args(Module('foobar', [], [])) def test_sympy__codegen__fnodes__Subroutine(): from sympy.codegen.fnodes import Subroutine x = symbols('x', real=True) assert _test_args(Subroutine('foo', [x], [])) def test_sympy__codegen__fnodes__GoTo(): from sympy.codegen.fnodes import GoTo assert _test_args(GoTo([10])) assert _test_args(GoTo([10, 20], x > 1)) def test_sympy__codegen__fnodes__FortranReturn(): from sympy.codegen.fnodes import FortranReturn assert _test_args(FortranReturn(10)) def test_sympy__codegen__fnodes__Extent(): from sympy.codegen.fnodes import Extent assert _test_args(Extent()) assert _test_args(Extent(None)) assert _test_args(Extent(':')) assert _test_args(Extent(-3, 4)) assert _test_args(Extent(x, y)) def test_sympy__codegen__fnodes__use_rename(): from sympy.codegen.fnodes import use_rename assert _test_args(use_rename('loc', 'glob')) def test_sympy__codegen__fnodes__use(): from sympy.codegen.fnodes import use assert _test_args(use('modfoo', only='bar')) def test_sympy__codegen__fnodes__SubroutineCall(): from sympy.codegen.fnodes import SubroutineCall assert _test_args(SubroutineCall('foo', ['bar', 'baz'])) def test_sympy__codegen__fnodes__Do(): from sympy.codegen.fnodes import Do assert _test_args(Do([], 'i', 1, 42)) def test_sympy__codegen__fnodes__ImpliedDoLoop(): from sympy.codegen.fnodes import ImpliedDoLoop assert _test_args(ImpliedDoLoop('i', 'i', 1, 42)) def test_sympy__codegen__fnodes__ArrayConstructor(): from sympy.codegen.fnodes import ArrayConstructor assert _test_args(ArrayConstructor([1, 2, 3])) from sympy.codegen.fnodes import ImpliedDoLoop idl = ImpliedDoLoop('i', 'i', 1, 42) assert _test_args(ArrayConstructor([1, idl, 3])) def test_sympy__codegen__fnodes__sum_(): from sympy.codegen.fnodes import sum_ assert _test_args(sum_('arr')) def test_sympy__codegen__fnodes__product_(): from sympy.codegen.fnodes import product_ assert _test_args(product_('arr')) @XFAIL def test_sympy__combinatorics__graycode__GrayCode(): from sympy.combinatorics.graycode import GrayCode # an integer is given and returned from GrayCode as the arg assert _test_args(GrayCode(3, start='100')) assert _test_args(GrayCode(3, rank=1)) def test_sympy__combinatorics__subsets__Subset(): from sympy.combinatorics.subsets import Subset assert _test_args(Subset([0, 1], [0, 1, 2, 3])) assert _test_args(Subset(['c', 'd'], ['a', 'b', 'c', 'd'])) def test_sympy__combinatorics__permutations__Permutation(): from sympy.combinatorics.permutations import Permutation assert _test_args(Permutation([0, 1, 2, 3])) def test_sympy__combinatorics__permutations__AppliedPermutation(): from sympy.combinatorics.permutations import Permutation from sympy.combinatorics.permutations import AppliedPermutation p = Permutation([0, 1, 2, 3]) assert _test_args(AppliedPermutation(p, 1)) def test_sympy__combinatorics__perm_groups__PermutationGroup(): from sympy.combinatorics.permutations import Permutation from sympy.combinatorics.perm_groups import PermutationGroup assert _test_args(PermutationGroup([Permutation([0, 1])])) def test_sympy__combinatorics__polyhedron__Polyhedron(): from sympy.combinatorics.permutations import Permutation from sympy.combinatorics.polyhedron import Polyhedron from sympy.abc import w, x, y, z pgroup = [Permutation([[0, 1, 2], [3]]), Permutation([[0, 1, 3], [2]]), Permutation([[0, 2, 3], [1]]), Permutation([[1, 2, 3], [0]]), Permutation([[0, 1], [2, 3]]), Permutation([[0, 2], [1, 3]]), Permutation([[0, 3], [1, 2]]), Permutation([[0, 1, 2, 3]])] corners = [w, x, y, z] faces = [(w, x, y), (w, y, z), (w, z, x), (x, y, z)] assert _test_args(Polyhedron(corners, faces, pgroup)) @XFAIL def test_sympy__combinatorics__prufer__Prufer(): from sympy.combinatorics.prufer import Prufer assert _test_args(Prufer([[0, 1], [0, 2], [0, 3]], 4)) def test_sympy__combinatorics__partitions__Partition(): from sympy.combinatorics.partitions import Partition assert _test_args(Partition([1])) @XFAIL def test_sympy__combinatorics__partitions__IntegerPartition(): from sympy.combinatorics.partitions import IntegerPartition assert _test_args(IntegerPartition([1])) def test_sympy__concrete__products__Product(): from sympy.concrete.products import Product assert _test_args(Product(x, (x, 0, 10))) assert _test_args(Product(x, (x, 0, y), (y, 0, 10))) @SKIP("abstract Class") def test_sympy__concrete__expr_with_limits__ExprWithLimits(): from sympy.concrete.expr_with_limits import ExprWithLimits assert _test_args(ExprWithLimits(x, (x, 0, 10))) assert _test_args(ExprWithLimits(x*y, (x, 0, 10.),(y,1.,3))) @SKIP("abstract Class") def test_sympy__concrete__expr_with_limits__AddWithLimits(): from sympy.concrete.expr_with_limits import AddWithLimits assert _test_args(AddWithLimits(x, (x, 0, 10))) assert _test_args(AddWithLimits(x*y, (x, 0, 10),(y,1,3))) @SKIP("abstract Class") def test_sympy__concrete__expr_with_intlimits__ExprWithIntLimits(): from sympy.concrete.expr_with_intlimits import ExprWithIntLimits assert _test_args(ExprWithIntLimits(x, (x, 0, 10))) assert _test_args(ExprWithIntLimits(x*y, (x, 0, 10),(y,1,3))) def test_sympy__concrete__summations__Sum(): from sympy.concrete.summations import Sum assert _test_args(Sum(x, (x, 0, 10))) assert _test_args(Sum(x, (x, 0, y), (y, 0, 10))) def test_sympy__core__add__Add(): from sympy.core.add import Add assert _test_args(Add(x, y, z, 2)) def test_sympy__core__basic__Atom(): from sympy.core.basic import Atom assert _test_args(Atom()) def test_sympy__core__basic__Basic(): from sympy.core.basic import Basic assert _test_args(Basic()) def test_sympy__core__containers__Dict(): from sympy.core.containers import Dict assert _test_args(Dict({x: y, y: z})) def test_sympy__core__containers__Tuple(): from sympy.core.containers import Tuple assert _test_args(Tuple(x, y, z, 2)) def test_sympy__core__expr__AtomicExpr(): from sympy.core.expr import AtomicExpr assert _test_args(AtomicExpr()) def test_sympy__core__expr__Expr(): from sympy.core.expr import Expr assert _test_args(Expr()) def test_sympy__core__expr__UnevaluatedExpr(): from sympy.core.expr import UnevaluatedExpr from sympy.abc import x assert _test_args(UnevaluatedExpr(x)) def test_sympy__core__function__Application(): from sympy.core.function import Application assert _test_args(Application(1, 2, 3)) def test_sympy__core__function__AppliedUndef(): from sympy.core.function import AppliedUndef assert _test_args(AppliedUndef(1, 2, 3)) def test_sympy__core__function__Derivative(): from sympy.core.function import Derivative assert _test_args(Derivative(2, x, y, 3)) @SKIP("abstract class") def test_sympy__core__function__Function(): pass def test_sympy__core__function__Lambda(): assert _test_args(Lambda((x, y), x + y + z)) def test_sympy__core__function__Subs(): from sympy.core.function import Subs assert _test_args(Subs(x + y, x, 2)) def test_sympy__core__function__WildFunction(): from sympy.core.function import WildFunction assert _test_args(WildFunction('f')) def test_sympy__core__mod__Mod(): from sympy.core.mod import Mod assert _test_args(Mod(x, 2)) def test_sympy__core__mul__Mul(): from sympy.core.mul import Mul assert _test_args(Mul(2, x, y, z)) def test_sympy__core__numbers__Catalan(): from sympy.core.numbers import Catalan assert _test_args(Catalan()) def test_sympy__core__numbers__ComplexInfinity(): from sympy.core.numbers import ComplexInfinity assert _test_args(ComplexInfinity()) def test_sympy__core__numbers__EulerGamma(): from sympy.core.numbers import EulerGamma assert _test_args(EulerGamma()) def test_sympy__core__numbers__Exp1(): from sympy.core.numbers import Exp1 assert _test_args(Exp1()) def test_sympy__core__numbers__Float(): from sympy.core.numbers import Float assert _test_args(Float(1.23)) def test_sympy__core__numbers__GoldenRatio(): from sympy.core.numbers import GoldenRatio assert _test_args(GoldenRatio()) def test_sympy__core__numbers__TribonacciConstant(): from sympy.core.numbers import TribonacciConstant assert _test_args(TribonacciConstant()) def test_sympy__core__numbers__Half(): from sympy.core.numbers import Half assert _test_args(Half()) def test_sympy__core__numbers__ImaginaryUnit(): from sympy.core.numbers import ImaginaryUnit assert _test_args(ImaginaryUnit()) def test_sympy__core__numbers__Infinity(): from sympy.core.numbers import Infinity assert _test_args(Infinity()) def test_sympy__core__numbers__Integer(): from sympy.core.numbers import Integer assert _test_args(Integer(7)) @SKIP("abstract class") def test_sympy__core__numbers__IntegerConstant(): pass def test_sympy__core__numbers__NaN(): from sympy.core.numbers import NaN assert _test_args(NaN()) def test_sympy__core__numbers__NegativeInfinity(): from sympy.core.numbers import NegativeInfinity assert _test_args(NegativeInfinity()) def test_sympy__core__numbers__NegativeOne(): from sympy.core.numbers import NegativeOne assert _test_args(NegativeOne()) def test_sympy__core__numbers__Number(): from sympy.core.numbers import Number assert _test_args(Number(1, 7)) def test_sympy__core__numbers__NumberSymbol(): from sympy.core.numbers import NumberSymbol assert _test_args(NumberSymbol()) def test_sympy__core__numbers__One(): from sympy.core.numbers import One assert _test_args(One()) def test_sympy__core__numbers__Pi(): from sympy.core.numbers import Pi assert _test_args(Pi()) def test_sympy__core__numbers__Rational(): from sympy.core.numbers import Rational assert _test_args(Rational(1, 7)) @SKIP("abstract class") def test_sympy__core__numbers__RationalConstant(): pass def test_sympy__core__numbers__Zero(): from sympy.core.numbers import Zero assert _test_args(Zero()) @SKIP("abstract class") def test_sympy__core__operations__AssocOp(): pass @SKIP("abstract class") def test_sympy__core__operations__LatticeOp(): pass def test_sympy__core__power__Pow(): from sympy.core.power import Pow assert _test_args(Pow(x, 2)) def test_sympy__algebras__quaternion__Quaternion(): from sympy.algebras.quaternion import Quaternion assert _test_args(Quaternion(x, 1, 2, 3)) def test_sympy__core__relational__Equality(): from sympy.core.relational import Equality assert _test_args(Equality(x, 2)) def test_sympy__core__relational__GreaterThan(): from sympy.core.relational import GreaterThan assert _test_args(GreaterThan(x, 2)) def test_sympy__core__relational__LessThan(): from sympy.core.relational import LessThan assert _test_args(LessThan(x, 2)) @SKIP("abstract class") def test_sympy__core__relational__Relational(): pass def test_sympy__core__relational__StrictGreaterThan(): from sympy.core.relational import StrictGreaterThan assert _test_args(StrictGreaterThan(x, 2)) def test_sympy__core__relational__StrictLessThan(): from sympy.core.relational import StrictLessThan assert _test_args(StrictLessThan(x, 2)) def test_sympy__core__relational__Unequality(): from sympy.core.relational import Unequality assert _test_args(Unequality(x, 2)) def test_sympy__sandbox__indexed_integrals__IndexedIntegral(): from sympy.tensor import IndexedBase, Idx from sympy.sandbox.indexed_integrals import IndexedIntegral A = IndexedBase('A') i, j = symbols('i j', integer=True) a1, a2 = symbols('a1:3', cls=Idx) assert _test_args(IndexedIntegral(A[a1], A[a2])) assert _test_args(IndexedIntegral(A[i], A[j])) def test_sympy__calculus__util__AccumulationBounds(): from sympy.calculus.util import AccumulationBounds assert _test_args(AccumulationBounds(0, 1)) def test_sympy__sets__ordinals__OmegaPower(): from sympy.sets.ordinals import OmegaPower assert _test_args(OmegaPower(1, 1)) def test_sympy__sets__ordinals__Ordinal(): from sympy.sets.ordinals import Ordinal, OmegaPower assert _test_args(Ordinal(OmegaPower(2, 1))) def test_sympy__sets__ordinals__OrdinalOmega(): from sympy.sets.ordinals import OrdinalOmega assert _test_args(OrdinalOmega()) def test_sympy__sets__ordinals__OrdinalZero(): from sympy.sets.ordinals import OrdinalZero assert _test_args(OrdinalZero()) def test_sympy__sets__powerset__PowerSet(): from sympy.sets.powerset import PowerSet from sympy.core.singleton import S assert _test_args(PowerSet(S.EmptySet)) def test_sympy__sets__sets__EmptySet(): from sympy.sets.sets import EmptySet assert _test_args(EmptySet()) def test_sympy__sets__sets__UniversalSet(): from sympy.sets.sets import UniversalSet assert _test_args(UniversalSet()) def test_sympy__sets__sets__FiniteSet(): from sympy.sets.sets import FiniteSet assert _test_args(FiniteSet(x, y, z)) def test_sympy__sets__sets__Interval(): from sympy.sets.sets import Interval assert _test_args(Interval(0, 1)) def test_sympy__sets__sets__ProductSet(): from sympy.sets.sets import ProductSet, Interval assert _test_args(ProductSet(Interval(0, 1), Interval(0, 1))) @SKIP("does it make sense to test this?") def test_sympy__sets__sets__Set(): from sympy.sets.sets import Set assert _test_args(Set()) def test_sympy__sets__sets__Intersection(): from sympy.sets.sets import Intersection, Interval from sympy.core.symbol import Symbol x = Symbol('x') y = Symbol('y') S = Intersection(Interval(0, x), Interval(y, 1)) assert isinstance(S, Intersection) assert _test_args(S) def test_sympy__sets__sets__Union(): from sympy.sets.sets import Union, Interval assert _test_args(Union(Interval(0, 1), Interval(2, 3))) def test_sympy__sets__sets__Complement(): from sympy.sets.sets import Complement assert _test_args(Complement(Interval(0, 2), Interval(0, 1))) def test_sympy__sets__sets__SymmetricDifference(): from sympy.sets.sets import FiniteSet, SymmetricDifference assert _test_args(SymmetricDifference(FiniteSet(1, 2, 3), \ FiniteSet(2, 3, 4))) def test_sympy__core__trace__Tr(): from sympy.core.trace import Tr a, b = symbols('a b') assert _test_args(Tr(a + b)) def test_sympy__sets__setexpr__SetExpr(): from sympy.sets.setexpr import SetExpr assert _test_args(SetExpr(Interval(0, 1))) def test_sympy__sets__fancysets__Rationals(): from sympy.sets.fancysets import Rationals assert _test_args(Rationals()) def test_sympy__sets__fancysets__Naturals(): from sympy.sets.fancysets import Naturals assert _test_args(Naturals()) def test_sympy__sets__fancysets__Naturals0(): from sympy.sets.fancysets import Naturals0 assert _test_args(Naturals0()) def test_sympy__sets__fancysets__Integers(): from sympy.sets.fancysets import Integers assert _test_args(Integers()) def test_sympy__sets__fancysets__Reals(): from sympy.sets.fancysets import Reals assert _test_args(Reals()) def test_sympy__sets__fancysets__Complexes(): from sympy.sets.fancysets import Complexes assert _test_args(Complexes()) def test_sympy__sets__fancysets__ComplexRegion(): from sympy.sets.fancysets import ComplexRegion from sympy import S from sympy.sets import Interval a = Interval(0, 1) b = Interval(2, 3) theta = Interval(0, 2*S.Pi) assert _test_args(ComplexRegion(a*b)) assert _test_args(ComplexRegion(a*theta, polar=True)) def test_sympy__sets__fancysets__CartesianComplexRegion(): from sympy.sets.fancysets import CartesianComplexRegion from sympy.sets import Interval a = Interval(0, 1) b = Interval(2, 3) assert _test_args(CartesianComplexRegion(a*b)) def test_sympy__sets__fancysets__PolarComplexRegion(): from sympy.sets.fancysets import PolarComplexRegion from sympy import S from sympy.sets import Interval a = Interval(0, 1) theta = Interval(0, 2*S.Pi) assert _test_args(PolarComplexRegion(a*theta)) def test_sympy__sets__fancysets__ImageSet(): from sympy.sets.fancysets import ImageSet from sympy import S, Symbol x = Symbol('x') assert _test_args(ImageSet(Lambda(x, x**2), S.Naturals)) def test_sympy__sets__fancysets__Range(): from sympy.sets.fancysets import Range assert _test_args(Range(1, 5, 1)) def test_sympy__sets__conditionset__ConditionSet(): from sympy.sets.conditionset import ConditionSet from sympy import S, Symbol x = Symbol('x') assert _test_args(ConditionSet(x, Eq(x**2, 1), S.Reals)) def test_sympy__sets__contains__Contains(): from sympy.sets.fancysets import Range from sympy.sets.contains import Contains assert _test_args(Contains(x, Range(0, 10, 2))) # STATS from sympy.stats.crv_types import NormalDistribution nd = NormalDistribution(0, 1) from sympy.stats.frv_types import DieDistribution die = DieDistribution(6) def test_sympy__stats__crv__ContinuousDomain(): from sympy.stats.crv import ContinuousDomain assert _test_args(ContinuousDomain({x}, Interval(-oo, oo))) def test_sympy__stats__crv__SingleContinuousDomain(): from sympy.stats.crv import SingleContinuousDomain assert _test_args(SingleContinuousDomain(x, Interval(-oo, oo))) def test_sympy__stats__crv__ProductContinuousDomain(): from sympy.stats.crv import SingleContinuousDomain, ProductContinuousDomain D = SingleContinuousDomain(x, Interval(-oo, oo)) E = SingleContinuousDomain(y, Interval(0, oo)) assert _test_args(ProductContinuousDomain(D, E)) def test_sympy__stats__crv__ConditionalContinuousDomain(): from sympy.stats.crv import (SingleContinuousDomain, ConditionalContinuousDomain) D = SingleContinuousDomain(x, Interval(-oo, oo)) assert _test_args(ConditionalContinuousDomain(D, x > 0)) def test_sympy__stats__crv__ContinuousPSpace(): from sympy.stats.crv import ContinuousPSpace, SingleContinuousDomain D = SingleContinuousDomain(x, Interval(-oo, oo)) assert _test_args(ContinuousPSpace(D, nd)) def test_sympy__stats__crv__SingleContinuousPSpace(): from sympy.stats.crv import SingleContinuousPSpace assert _test_args(SingleContinuousPSpace(x, nd)) @SKIP("abstract class") def test_sympy__stats__crv__SingleContinuousDistribution(): pass def test_sympy__stats__drv__SingleDiscreteDomain(): from sympy.stats.drv import SingleDiscreteDomain assert _test_args(SingleDiscreteDomain(x, S.Naturals)) def test_sympy__stats__drv__ProductDiscreteDomain(): from sympy.stats.drv import SingleDiscreteDomain, ProductDiscreteDomain X = SingleDiscreteDomain(x, S.Naturals) Y = SingleDiscreteDomain(y, S.Integers) assert _test_args(ProductDiscreteDomain(X, Y)) def test_sympy__stats__drv__SingleDiscretePSpace(): from sympy.stats.drv import SingleDiscretePSpace from sympy.stats.drv_types import PoissonDistribution assert _test_args(SingleDiscretePSpace(x, PoissonDistribution(1))) def test_sympy__stats__drv__DiscretePSpace(): from sympy.stats.drv import DiscretePSpace, SingleDiscreteDomain density = Lambda(x, 2**(-x)) domain = SingleDiscreteDomain(x, S.Naturals) assert _test_args(DiscretePSpace(domain, density)) def test_sympy__stats__drv__ConditionalDiscreteDomain(): from sympy.stats.drv import ConditionalDiscreteDomain, SingleDiscreteDomain X = SingleDiscreteDomain(x, S.Naturals0) assert _test_args(ConditionalDiscreteDomain(X, x > 2)) def test_sympy__stats__joint_rv__JointPSpace(): from sympy.stats.joint_rv import JointPSpace, JointDistribution assert _test_args(JointPSpace('X', JointDistribution(1))) def test_sympy__stats__joint_rv__JointRandomSymbol(): from sympy.stats.joint_rv import JointRandomSymbol assert _test_args(JointRandomSymbol(x)) def test_sympy__stats__joint_rv__JointDistributionHandmade(): from sympy import Indexed from sympy.stats.joint_rv import JointDistributionHandmade x1, x2 = (Indexed('x', i) for i in (1, 2)) assert _test_args(JointDistributionHandmade(x1 + x2, S.Reals**2)) def test_sympy__stats__joint_rv__MarginalDistribution(): from sympy.stats.rv import RandomSymbol from sympy.stats.joint_rv import MarginalDistribution r = RandomSymbol(S('r')) assert _test_args(MarginalDistribution(r, (r,))) def test_sympy__stats__joint_rv__CompoundDistribution(): from sympy.stats.joint_rv import CompoundDistribution from sympy.stats.drv_types import PoissonDistribution r = PoissonDistribution(x) assert _test_args(CompoundDistribution(PoissonDistribution(r))) @SKIP("abstract class") def test_sympy__stats__drv__SingleDiscreteDistribution(): pass @SKIP("abstract class") def test_sympy__stats__drv__DiscreteDistribution(): pass @SKIP("abstract class") def test_sympy__stats__drv__DiscreteDomain(): pass def test_sympy__stats__rv__RandomDomain(): from sympy.stats.rv import RandomDomain from sympy.sets.sets import FiniteSet assert _test_args(RandomDomain(FiniteSet(x), FiniteSet(1, 2, 3))) def test_sympy__stats__rv__SingleDomain(): from sympy.stats.rv import SingleDomain from sympy.sets.sets import FiniteSet assert _test_args(SingleDomain(x, FiniteSet(1, 2, 3))) def test_sympy__stats__rv__ConditionalDomain(): from sympy.stats.rv import ConditionalDomain, RandomDomain from sympy.sets.sets import FiniteSet D = RandomDomain(FiniteSet(x), FiniteSet(1, 2)) assert _test_args(ConditionalDomain(D, x > 1)) def test_sympy__stats__rv__PSpace(): from sympy.stats.rv import PSpace, RandomDomain from sympy import FiniteSet D = RandomDomain(FiniteSet(x), FiniteSet(1, 2, 3, 4, 5, 6)) assert _test_args(PSpace(D, die)) @SKIP("abstract Class") def test_sympy__stats__rv__SinglePSpace(): pass def test_sympy__stats__rv__RandomSymbol(): from sympy.stats.rv import RandomSymbol from sympy.stats.crv import SingleContinuousPSpace A = SingleContinuousPSpace(x, nd) assert _test_args(RandomSymbol(x, A)) @SKIP("abstract Class") def test_sympy__stats__rv__ProductPSpace(): pass def test_sympy__stats__rv__IndependentProductPSpace(): from sympy.stats.rv import IndependentProductPSpace from sympy.stats.crv import SingleContinuousPSpace A = SingleContinuousPSpace(x, nd) B = SingleContinuousPSpace(y, nd) assert _test_args(IndependentProductPSpace(A, B)) def test_sympy__stats__rv__ProductDomain(): from sympy.stats.rv import ProductDomain, SingleDomain D = SingleDomain(x, Interval(-oo, oo)) E = SingleDomain(y, Interval(0, oo)) assert _test_args(ProductDomain(D, E)) def test_sympy__stats__symbolic_probability__Probability(): from sympy.stats.symbolic_probability import Probability from sympy.stats import Normal X = Normal('X', 0, 1) assert _test_args(Probability(X > 0)) def test_sympy__stats__symbolic_probability__Expectation(): from sympy.stats.symbolic_probability import Expectation from sympy.stats import Normal X = Normal('X', 0, 1) assert _test_args(Expectation(X > 0)) def test_sympy__stats__symbolic_probability__Covariance(): from sympy.stats.symbolic_probability import Covariance from sympy.stats import Normal X = Normal('X', 0, 1) Y = Normal('Y', 0, 3) assert _test_args(Covariance(X, Y)) def test_sympy__stats__symbolic_probability__Variance(): from sympy.stats.symbolic_probability import Variance from sympy.stats import Normal X = Normal('X', 0, 1) assert _test_args(Variance(X)) def test_sympy__stats__frv_types__DiscreteUniformDistribution(): from sympy.stats.frv_types import DiscreteUniformDistribution from sympy.core.containers import Tuple assert _test_args(DiscreteUniformDistribution(Tuple(*list(range(6))))) def test_sympy__stats__frv_types__DieDistribution(): assert _test_args(die) def test_sympy__stats__frv_types__BernoulliDistribution(): from sympy.stats.frv_types import BernoulliDistribution assert _test_args(BernoulliDistribution(S.Half, 0, 1)) def test_sympy__stats__frv_types__BinomialDistribution(): from sympy.stats.frv_types import BinomialDistribution assert _test_args(BinomialDistribution(5, S.Half, 1, 0)) def test_sympy__stats__frv_types__BetaBinomialDistribution(): from sympy.stats.frv_types import BetaBinomialDistribution assert _test_args(BetaBinomialDistribution(5, 1, 1)) def test_sympy__stats__frv_types__HypergeometricDistribution(): from sympy.stats.frv_types import HypergeometricDistribution assert _test_args(HypergeometricDistribution(10, 5, 3)) def test_sympy__stats__frv_types__RademacherDistribution(): from sympy.stats.frv_types import RademacherDistribution assert _test_args(RademacherDistribution()) def test_sympy__stats__frv__FiniteDomain(): from sympy.stats.frv import FiniteDomain assert _test_args(FiniteDomain({(x, 1), (x, 2)})) # x can be 1 or 2 def test_sympy__stats__frv__SingleFiniteDomain(): from sympy.stats.frv import SingleFiniteDomain assert _test_args(SingleFiniteDomain(x, {1, 2})) # x can be 1 or 2 def test_sympy__stats__frv__ProductFiniteDomain(): from sympy.stats.frv import SingleFiniteDomain, ProductFiniteDomain xd = SingleFiniteDomain(x, {1, 2}) yd = SingleFiniteDomain(y, {1, 2}) assert _test_args(ProductFiniteDomain(xd, yd)) def test_sympy__stats__frv__ConditionalFiniteDomain(): from sympy.stats.frv import SingleFiniteDomain, ConditionalFiniteDomain xd = SingleFiniteDomain(x, {1, 2}) assert _test_args(ConditionalFiniteDomain(xd, x > 1)) def test_sympy__stats__frv__FinitePSpace(): from sympy.stats.frv import FinitePSpace, SingleFiniteDomain xd = SingleFiniteDomain(x, {1, 2, 3, 4, 5, 6}) assert _test_args(FinitePSpace(xd, {(x, 1): S.Half, (x, 2): S.Half})) xd = SingleFiniteDomain(x, {1, 2}) assert _test_args(FinitePSpace(xd, {(x, 1): S.Half, (x, 2): S.Half})) def test_sympy__stats__frv__SingleFinitePSpace(): from sympy.stats.frv import SingleFinitePSpace from sympy import Symbol assert _test_args(SingleFinitePSpace(Symbol('x'), die)) def test_sympy__stats__frv__ProductFinitePSpace(): from sympy.stats.frv import SingleFinitePSpace, ProductFinitePSpace from sympy import Symbol xp = SingleFinitePSpace(Symbol('x'), die) yp = SingleFinitePSpace(Symbol('y'), die) assert _test_args(ProductFinitePSpace(xp, yp)) @SKIP("abstract class") def test_sympy__stats__frv__SingleFiniteDistribution(): pass @SKIP("abstract class") def test_sympy__stats__crv__ContinuousDistribution(): pass def test_sympy__stats__frv_types__FiniteDistributionHandmade(): from sympy.stats.frv_types import FiniteDistributionHandmade from sympy import Dict assert _test_args(FiniteDistributionHandmade(Dict({1: 1}))) def test_sympy__stats__crv__ContinuousDistributionHandmade(): from sympy.stats.crv import ContinuousDistributionHandmade from sympy import Symbol, Interval assert _test_args(ContinuousDistributionHandmade(Symbol('x'), Interval(0, 2))) def test_sympy__stats__drv__DiscreteDistributionHandmade(): from sympy.stats.drv import DiscreteDistributionHandmade assert _test_args(DiscreteDistributionHandmade(x, S.Naturals)) def test_sympy__stats__rv__Density(): from sympy.stats.rv import Density from sympy.stats.crv_types import Normal assert _test_args(Density(Normal('x', 0, 1))) def test_sympy__stats__crv_types__ArcsinDistribution(): from sympy.stats.crv_types import ArcsinDistribution assert _test_args(ArcsinDistribution(0, 1)) def test_sympy__stats__crv_types__BeniniDistribution(): from sympy.stats.crv_types import BeniniDistribution assert _test_args(BeniniDistribution(1, 1, 1)) def test_sympy__stats__crv_types__BetaDistribution(): from sympy.stats.crv_types import BetaDistribution assert _test_args(BetaDistribution(1, 1)) def test_sympy__stats__crv_types__BetaNoncentralDistribution(): from sympy.stats.crv_types import BetaNoncentralDistribution assert _test_args(BetaNoncentralDistribution(1, 1, 1)) def test_sympy__stats__crv_types__BetaPrimeDistribution(): from sympy.stats.crv_types import BetaPrimeDistribution assert _test_args(BetaPrimeDistribution(1, 1)) def test_sympy__stats__crv_types__CauchyDistribution(): from sympy.stats.crv_types import CauchyDistribution assert _test_args(CauchyDistribution(0, 1)) def test_sympy__stats__crv_types__ChiDistribution(): from sympy.stats.crv_types import ChiDistribution assert _test_args(ChiDistribution(1)) def test_sympy__stats__crv_types__ChiNoncentralDistribution(): from sympy.stats.crv_types import ChiNoncentralDistribution assert _test_args(ChiNoncentralDistribution(1,1)) def test_sympy__stats__crv_types__ChiSquaredDistribution(): from sympy.stats.crv_types import ChiSquaredDistribution assert _test_args(ChiSquaredDistribution(1)) def test_sympy__stats__crv_types__DagumDistribution(): from sympy.stats.crv_types import DagumDistribution assert _test_args(DagumDistribution(1, 1, 1)) def test_sympy__stats__crv_types__ExGaussianDistribution(): from sympy.stats.crv_types import ExGaussianDistribution assert _test_args(ExGaussianDistribution(1, 1, 1)) def test_sympy__stats__crv_types__ExponentialDistribution(): from sympy.stats.crv_types import ExponentialDistribution assert _test_args(ExponentialDistribution(1)) def test_sympy__stats__crv_types__ExponentialPowerDistribution(): from sympy.stats.crv_types import ExponentialPowerDistribution assert _test_args(ExponentialPowerDistribution(0, 1, 1)) def test_sympy__stats__crv_types__FDistributionDistribution(): from sympy.stats.crv_types import FDistributionDistribution assert _test_args(FDistributionDistribution(1, 1)) def test_sympy__stats__crv_types__FisherZDistribution(): from sympy.stats.crv_types import FisherZDistribution assert _test_args(FisherZDistribution(1, 1)) def test_sympy__stats__crv_types__FrechetDistribution(): from sympy.stats.crv_types import FrechetDistribution assert _test_args(FrechetDistribution(1, 1, 1)) def test_sympy__stats__crv_types__GammaInverseDistribution(): from sympy.stats.crv_types import GammaInverseDistribution assert _test_args(GammaInverseDistribution(1, 1)) def test_sympy__stats__crv_types__GammaDistribution(): from sympy.stats.crv_types import GammaDistribution assert _test_args(GammaDistribution(1, 1)) def test_sympy__stats__crv_types__GumbelDistribution(): from sympy.stats.crv_types import GumbelDistribution assert _test_args(GumbelDistribution(1, 1, False)) def test_sympy__stats__crv_types__GompertzDistribution(): from sympy.stats.crv_types import GompertzDistribution assert _test_args(GompertzDistribution(1, 1)) def test_sympy__stats__crv_types__KumaraswamyDistribution(): from sympy.stats.crv_types import KumaraswamyDistribution assert _test_args(KumaraswamyDistribution(1, 1)) def test_sympy__stats__crv_types__LaplaceDistribution(): from sympy.stats.crv_types import LaplaceDistribution assert _test_args(LaplaceDistribution(0, 1)) def test_sympy__stats__crv_types__LevyDistribution(): from sympy.stats.crv_types import LevyDistribution assert _test_args(LevyDistribution(0, 1)) def test_sympy__stats__crv_types__LogisticDistribution(): from sympy.stats.crv_types import LogisticDistribution assert _test_args(LogisticDistribution(0, 1)) def test_sympy__stats__crv_types__LogLogisticDistribution(): from sympy.stats.crv_types import LogLogisticDistribution assert _test_args(LogLogisticDistribution(1, 1)) def test_sympy__stats__crv_types__LogNormalDistribution(): from sympy.stats.crv_types import LogNormalDistribution assert _test_args(LogNormalDistribution(0, 1)) def test_sympy__stats__crv_types__MaxwellDistribution(): from sympy.stats.crv_types import MaxwellDistribution assert _test_args(MaxwellDistribution(1)) def test_sympy__stats__crv_types__MoyalDistribution(): from sympy.stats.crv_types import MoyalDistribution assert _test_args(MoyalDistribution(1,2)) def test_sympy__stats__crv_types__NakagamiDistribution(): from sympy.stats.crv_types import NakagamiDistribution assert _test_args(NakagamiDistribution(1, 1)) def test_sympy__stats__crv_types__NormalDistribution(): from sympy.stats.crv_types import NormalDistribution assert _test_args(NormalDistribution(0, 1)) def test_sympy__stats__crv_types__GaussianInverseDistribution(): from sympy.stats.crv_types import GaussianInverseDistribution assert _test_args(GaussianInverseDistribution(1, 1)) def test_sympy__stats__crv_types__ParetoDistribution(): from sympy.stats.crv_types import ParetoDistribution assert _test_args(ParetoDistribution(1, 1)) def test_sympy__stats__crv_types__PowerFunctionDistribution(): from sympy.stats.crv_types import PowerFunctionDistribution assert _test_args(PowerFunctionDistribution(2,0,1)) def test_sympy__stats__crv_types__QuadraticUDistribution(): from sympy.stats.crv_types import QuadraticUDistribution assert _test_args(QuadraticUDistribution(1, 2)) def test_sympy__stats__crv_types__RaisedCosineDistribution(): from sympy.stats.crv_types import RaisedCosineDistribution assert _test_args(RaisedCosineDistribution(1, 1)) def test_sympy__stats__crv_types__RayleighDistribution(): from sympy.stats.crv_types import RayleighDistribution assert _test_args(RayleighDistribution(1)) def test_sympy__stats__crv_types__ReciprocalDistribution(): from sympy.stats.crv_types import ReciprocalDistribution assert _test_args(ReciprocalDistribution(5, 30)) def test_sympy__stats__crv_types__ShiftedGompertzDistribution(): from sympy.stats.crv_types import ShiftedGompertzDistribution assert _test_args(ShiftedGompertzDistribution(1, 1)) def test_sympy__stats__crv_types__StudentTDistribution(): from sympy.stats.crv_types import StudentTDistribution assert _test_args(StudentTDistribution(1)) def test_sympy__stats__crv_types__TrapezoidalDistribution(): from sympy.stats.crv_types import TrapezoidalDistribution assert _test_args(TrapezoidalDistribution(1, 2, 3, 4)) def test_sympy__stats__crv_types__TriangularDistribution(): from sympy.stats.crv_types import TriangularDistribution assert _test_args(TriangularDistribution(-1, 0, 1)) def test_sympy__stats__crv_types__UniformDistribution(): from sympy.stats.crv_types import UniformDistribution assert _test_args(UniformDistribution(0, 1)) def test_sympy__stats__crv_types__UniformSumDistribution(): from sympy.stats.crv_types import UniformSumDistribution assert _test_args(UniformSumDistribution(1)) def test_sympy__stats__crv_types__VonMisesDistribution(): from sympy.stats.crv_types import VonMisesDistribution assert _test_args(VonMisesDistribution(1, 1)) def test_sympy__stats__crv_types__WeibullDistribution(): from sympy.stats.crv_types import WeibullDistribution assert _test_args(WeibullDistribution(1, 1)) def test_sympy__stats__crv_types__WignerSemicircleDistribution(): from sympy.stats.crv_types import WignerSemicircleDistribution assert _test_args(WignerSemicircleDistribution(1)) def test_sympy__stats__drv_types__GeometricDistribution(): from sympy.stats.drv_types import GeometricDistribution assert _test_args(GeometricDistribution(.5)) def test_sympy__stats__drv_types__HermiteDistribution(): from sympy.stats.drv_types import HermiteDistribution assert _test_args(HermiteDistribution(1, 2)) def test_sympy__stats__drv_types__LogarithmicDistribution(): from sympy.stats.drv_types import LogarithmicDistribution assert _test_args(LogarithmicDistribution(.5)) def test_sympy__stats__drv_types__NegativeBinomialDistribution(): from sympy.stats.drv_types import NegativeBinomialDistribution assert _test_args(NegativeBinomialDistribution(.5, .5)) def test_sympy__stats__drv_types__PoissonDistribution(): from sympy.stats.drv_types import PoissonDistribution assert _test_args(PoissonDistribution(1)) def test_sympy__stats__drv_types__SkellamDistribution(): from sympy.stats.drv_types import SkellamDistribution assert _test_args(SkellamDistribution(1, 1)) def test_sympy__stats__drv_types__YuleSimonDistribution(): from sympy.stats.drv_types import YuleSimonDistribution assert _test_args(YuleSimonDistribution(.5)) def test_sympy__stats__drv_types__ZetaDistribution(): from sympy.stats.drv_types import ZetaDistribution assert _test_args(ZetaDistribution(1.5)) def test_sympy__stats__joint_rv__JointDistribution(): from sympy.stats.joint_rv import JointDistribution assert _test_args(JointDistribution(1, 2, 3, 4)) def test_sympy__stats__joint_rv_types__MultivariateNormalDistribution(): from sympy.stats.joint_rv_types import MultivariateNormalDistribution assert _test_args( MultivariateNormalDistribution([0, 1], [[1, 0],[0, 1]])) def test_sympy__stats__joint_rv_types__MultivariateLaplaceDistribution(): from sympy.stats.joint_rv_types import MultivariateLaplaceDistribution assert _test_args(MultivariateLaplaceDistribution([0, 1], [[1, 0],[0, 1]])) def test_sympy__stats__joint_rv_types__MultivariateTDistribution(): from sympy.stats.joint_rv_types import MultivariateTDistribution assert _test_args(MultivariateTDistribution([0, 1], [[1, 0],[0, 1]], 1)) def test_sympy__stats__joint_rv_types__NormalGammaDistribution(): from sympy.stats.joint_rv_types import NormalGammaDistribution assert _test_args(NormalGammaDistribution(1, 2, 3, 4)) def test_sympy__stats__joint_rv_types__GeneralizedMultivariateLogGammaDistribution(): from sympy.stats.joint_rv_types import GeneralizedMultivariateLogGammaDistribution v, l, mu = (4, [1, 2, 3, 4], [1, 2, 3, 4]) assert _test_args(GeneralizedMultivariateLogGammaDistribution(S.Half, v, l, mu)) def test_sympy__stats__joint_rv_types__MultivariateBetaDistribution(): from sympy.stats.joint_rv_types import MultivariateBetaDistribution assert _test_args(MultivariateBetaDistribution([1, 2, 3])) def test_sympy__stats__joint_rv_types__MultivariateEwensDistribution(): from sympy.stats.joint_rv_types import MultivariateEwensDistribution assert _test_args(MultivariateEwensDistribution(5, 1)) def test_sympy__stats__joint_rv_types__MultinomialDistribution(): from sympy.stats.joint_rv_types import MultinomialDistribution assert _test_args(MultinomialDistribution(5, [0.5, 0.1, 0.3])) def test_sympy__stats__joint_rv_types__NegativeMultinomialDistribution(): from sympy.stats.joint_rv_types import NegativeMultinomialDistribution assert _test_args(NegativeMultinomialDistribution(5, [0.5, 0.1, 0.3])) def test_sympy__stats__rv__RandomIndexedSymbol(): from sympy.stats.rv import RandomIndexedSymbol, pspace from sympy.stats.stochastic_process_types import DiscreteMarkovChain X = DiscreteMarkovChain("X") assert _test_args(RandomIndexedSymbol(X[0].symbol, pspace(X[0]))) def test_sympy__stats__rv__RandomMatrixSymbol(): from sympy.stats.rv import RandomMatrixSymbol from sympy.stats.random_matrix import RandomMatrixPSpace pspace = RandomMatrixPSpace('P') assert _test_args(RandomMatrixSymbol('M', 3, 3, pspace)) def test_sympy__stats__stochastic_process__StochasticPSpace(): from sympy.stats.stochastic_process import StochasticPSpace from sympy.stats.stochastic_process_types import StochasticProcess from sympy.stats.frv_types import BernoulliDistribution assert _test_args(StochasticPSpace("Y", StochasticProcess("Y", [1, 2, 3]), BernoulliDistribution(S.Half, 1, 0))) def test_sympy__stats__stochastic_process_types__StochasticProcess(): from sympy.stats.stochastic_process_types import StochasticProcess assert _test_args(StochasticProcess("Y", [1, 2, 3])) def test_sympy__stats__stochastic_process_types__MarkovProcess(): from sympy.stats.stochastic_process_types import MarkovProcess assert _test_args(MarkovProcess("Y", [1, 2, 3])) def test_sympy__stats__stochastic_process_types__DiscreteTimeStochasticProcess(): from sympy.stats.stochastic_process_types import DiscreteTimeStochasticProcess assert _test_args(DiscreteTimeStochasticProcess("Y", [1, 2, 3])) def test_sympy__stats__stochastic_process_types__ContinuousTimeStochasticProcess(): from sympy.stats.stochastic_process_types import ContinuousTimeStochasticProcess assert _test_args(ContinuousTimeStochasticProcess("Y", [1, 2, 3])) def test_sympy__stats__stochastic_process_types__TransitionMatrixOf(): from sympy.stats.stochastic_process_types import TransitionMatrixOf, DiscreteMarkovChain from sympy import MatrixSymbol DMC = DiscreteMarkovChain("Y") assert _test_args(TransitionMatrixOf(DMC, MatrixSymbol('T', 3, 3))) def test_sympy__stats__stochastic_process_types__GeneratorMatrixOf(): from sympy.stats.stochastic_process_types import GeneratorMatrixOf, ContinuousMarkovChain from sympy import MatrixSymbol DMC = ContinuousMarkovChain("Y") assert _test_args(GeneratorMatrixOf(DMC, MatrixSymbol('T', 3, 3))) def test_sympy__stats__stochastic_process_types__StochasticStateSpaceOf(): from sympy.stats.stochastic_process_types import StochasticStateSpaceOf, DiscreteMarkovChain DMC = DiscreteMarkovChain("Y") assert _test_args(StochasticStateSpaceOf(DMC, [0, 1, 2])) def test_sympy__stats__stochastic_process_types__DiscreteMarkovChain(): from sympy.stats.stochastic_process_types import DiscreteMarkovChain from sympy import MatrixSymbol assert _test_args(DiscreteMarkovChain("Y", [0, 1, 2], MatrixSymbol('T', 3, 3))) def test_sympy__stats__stochastic_process_types__ContinuousMarkovChain(): from sympy.stats.stochastic_process_types import ContinuousMarkovChain from sympy import MatrixSymbol assert _test_args(ContinuousMarkovChain("Y", [0, 1, 2], MatrixSymbol('T', 3, 3))) def test_sympy__stats__stochastic_process_types__BernoulliProcess(): from sympy.stats.stochastic_process_types import BernoulliProcess assert _test_args(BernoulliProcess("B", 0.5, 1, 0)) def test_sympy__stats__random_matrix__RandomMatrixPSpace(): from sympy.stats.random_matrix import RandomMatrixPSpace from sympy.stats.random_matrix_models import RandomMatrixEnsemble assert _test_args(RandomMatrixPSpace('P', RandomMatrixEnsemble('R', 3))) def test_sympy__stats__random_matrix_models__RandomMatrixEnsemble(): from sympy.stats.random_matrix_models import RandomMatrixEnsemble assert _test_args(RandomMatrixEnsemble('R', 3)) def test_sympy__stats__random_matrix_models__GaussianEnsemble(): from sympy.stats.random_matrix_models import GaussianEnsemble assert _test_args(GaussianEnsemble('G', 3)) def test_sympy__stats__random_matrix_models__GaussianUnitaryEnsemble(): from sympy.stats import GaussianUnitaryEnsemble assert _test_args(GaussianUnitaryEnsemble('U', 3)) def test_sympy__stats__random_matrix_models__GaussianOrthogonalEnsemble(): from sympy.stats import GaussianOrthogonalEnsemble assert _test_args(GaussianOrthogonalEnsemble('U', 3)) def test_sympy__stats__random_matrix_models__GaussianSymplecticEnsemble(): from sympy.stats import GaussianSymplecticEnsemble assert _test_args(GaussianSymplecticEnsemble('U', 3)) def test_sympy__stats__random_matrix_models__CircularEnsemble(): from sympy.stats import CircularEnsemble assert _test_args(CircularEnsemble('C', 3)) def test_sympy__stats__random_matrix_models__CircularUnitaryEnsemble(): from sympy.stats import CircularUnitaryEnsemble assert _test_args(CircularUnitaryEnsemble('U', 3)) def test_sympy__stats__random_matrix_models__CircularOrthogonalEnsemble(): from sympy.stats import CircularOrthogonalEnsemble assert _test_args(CircularOrthogonalEnsemble('O', 3)) def test_sympy__stats__random_matrix_models__CircularSymplecticEnsemble(): from sympy.stats import CircularSymplecticEnsemble assert _test_args(CircularSymplecticEnsemble('S', 3)) def test_sympy__core__symbol__Dummy(): from sympy.core.symbol import Dummy assert _test_args(Dummy('t')) def test_sympy__core__symbol__Symbol(): from sympy.core.symbol import Symbol assert _test_args(Symbol('t')) def test_sympy__core__symbol__Wild(): from sympy.core.symbol import Wild assert _test_args(Wild('x', exclude=[x])) @SKIP("abstract class") def test_sympy__functions__combinatorial__factorials__CombinatorialFunction(): pass def test_sympy__functions__combinatorial__factorials__FallingFactorial(): from sympy.functions.combinatorial.factorials import FallingFactorial assert _test_args(FallingFactorial(2, x)) def test_sympy__functions__combinatorial__factorials__MultiFactorial(): from sympy.functions.combinatorial.factorials import MultiFactorial assert _test_args(MultiFactorial(x)) def test_sympy__functions__combinatorial__factorials__RisingFactorial(): from sympy.functions.combinatorial.factorials import RisingFactorial assert _test_args(RisingFactorial(2, x)) def test_sympy__functions__combinatorial__factorials__binomial(): from sympy.functions.combinatorial.factorials import binomial assert _test_args(binomial(2, x)) def test_sympy__functions__combinatorial__factorials__subfactorial(): from sympy.functions.combinatorial.factorials import subfactorial assert _test_args(subfactorial(1)) def test_sympy__functions__combinatorial__factorials__factorial(): from sympy.functions.combinatorial.factorials import factorial assert _test_args(factorial(x)) def test_sympy__functions__combinatorial__factorials__factorial2(): from sympy.functions.combinatorial.factorials import factorial2 assert _test_args(factorial2(x)) def test_sympy__functions__combinatorial__numbers__bell(): from sympy.functions.combinatorial.numbers import bell assert _test_args(bell(x, y)) def test_sympy__functions__combinatorial__numbers__bernoulli(): from sympy.functions.combinatorial.numbers import bernoulli assert _test_args(bernoulli(x)) def test_sympy__functions__combinatorial__numbers__catalan(): from sympy.functions.combinatorial.numbers import catalan assert _test_args(catalan(x)) def test_sympy__functions__combinatorial__numbers__genocchi(): from sympy.functions.combinatorial.numbers import genocchi assert _test_args(genocchi(x)) def test_sympy__functions__combinatorial__numbers__euler(): from sympy.functions.combinatorial.numbers import euler assert _test_args(euler(x)) def test_sympy__functions__combinatorial__numbers__carmichael(): from sympy.functions.combinatorial.numbers import carmichael assert _test_args(carmichael(x)) def test_sympy__functions__combinatorial__numbers__fibonacci(): from sympy.functions.combinatorial.numbers import fibonacci assert _test_args(fibonacci(x)) def test_sympy__functions__combinatorial__numbers__tribonacci(): from sympy.functions.combinatorial.numbers import tribonacci assert _test_args(tribonacci(x)) def test_sympy__functions__combinatorial__numbers__harmonic(): from sympy.functions.combinatorial.numbers import harmonic assert _test_args(harmonic(x, 2)) def test_sympy__functions__combinatorial__numbers__lucas(): from sympy.functions.combinatorial.numbers import lucas assert _test_args(lucas(x)) def test_sympy__functions__combinatorial__numbers__partition(): from sympy.core.symbol import Symbol from sympy.functions.combinatorial.numbers import partition assert _test_args(partition(Symbol('a', integer=True))) def test_sympy__functions__elementary__complexes__Abs(): from sympy.functions.elementary.complexes import Abs assert _test_args(Abs(x)) def test_sympy__functions__elementary__complexes__adjoint(): from sympy.functions.elementary.complexes import adjoint assert _test_args(adjoint(x)) def test_sympy__functions__elementary__complexes__arg(): from sympy.functions.elementary.complexes import arg assert _test_args(arg(x)) def test_sympy__functions__elementary__complexes__conjugate(): from sympy.functions.elementary.complexes import conjugate assert _test_args(conjugate(x)) def test_sympy__functions__elementary__complexes__im(): from sympy.functions.elementary.complexes import im assert _test_args(im(x)) def test_sympy__functions__elementary__complexes__re(): from sympy.functions.elementary.complexes import re assert _test_args(re(x)) def test_sympy__functions__elementary__complexes__sign(): from sympy.functions.elementary.complexes import sign assert _test_args(sign(x)) def test_sympy__functions__elementary__complexes__polar_lift(): from sympy.functions.elementary.complexes import polar_lift assert _test_args(polar_lift(x)) def test_sympy__functions__elementary__complexes__periodic_argument(): from sympy.functions.elementary.complexes import periodic_argument assert _test_args(periodic_argument(x, y)) def test_sympy__functions__elementary__complexes__principal_branch(): from sympy.functions.elementary.complexes import principal_branch assert _test_args(principal_branch(x, y)) def test_sympy__functions__elementary__complexes__transpose(): from sympy.functions.elementary.complexes import transpose assert _test_args(transpose(x)) def test_sympy__functions__elementary__exponential__LambertW(): from sympy.functions.elementary.exponential import LambertW assert _test_args(LambertW(2)) @SKIP("abstract class") def test_sympy__functions__elementary__exponential__ExpBase(): pass def test_sympy__functions__elementary__exponential__exp(): from sympy.functions.elementary.exponential import exp assert _test_args(exp(2)) def test_sympy__functions__elementary__exponential__exp_polar(): from sympy.functions.elementary.exponential import exp_polar assert _test_args(exp_polar(2)) def test_sympy__functions__elementary__exponential__log(): from sympy.functions.elementary.exponential import log assert _test_args(log(2)) @SKIP("abstract class") def test_sympy__functions__elementary__hyperbolic__HyperbolicFunction(): pass @SKIP("abstract class") def test_sympy__functions__elementary__hyperbolic__ReciprocalHyperbolicFunction(): pass @SKIP("abstract class") def test_sympy__functions__elementary__hyperbolic__InverseHyperbolicFunction(): pass def test_sympy__functions__elementary__hyperbolic__acosh(): from sympy.functions.elementary.hyperbolic import acosh assert _test_args(acosh(2)) def test_sympy__functions__elementary__hyperbolic__acoth(): from sympy.functions.elementary.hyperbolic import acoth assert _test_args(acoth(2)) def test_sympy__functions__elementary__hyperbolic__asinh(): from sympy.functions.elementary.hyperbolic import asinh assert _test_args(asinh(2)) def test_sympy__functions__elementary__hyperbolic__atanh(): from sympy.functions.elementary.hyperbolic import atanh assert _test_args(atanh(2)) def test_sympy__functions__elementary__hyperbolic__asech(): from sympy.functions.elementary.hyperbolic import asech assert _test_args(asech(2)) def test_sympy__functions__elementary__hyperbolic__acsch(): from sympy.functions.elementary.hyperbolic import acsch assert _test_args(acsch(2)) def test_sympy__functions__elementary__hyperbolic__cosh(): from sympy.functions.elementary.hyperbolic import cosh assert _test_args(cosh(2)) def test_sympy__functions__elementary__hyperbolic__coth(): from sympy.functions.elementary.hyperbolic import coth assert _test_args(coth(2)) def test_sympy__functions__elementary__hyperbolic__csch(): from sympy.functions.elementary.hyperbolic import csch assert _test_args(csch(2)) def test_sympy__functions__elementary__hyperbolic__sech(): from sympy.functions.elementary.hyperbolic import sech assert _test_args(sech(2)) def test_sympy__functions__elementary__hyperbolic__sinh(): from sympy.functions.elementary.hyperbolic import sinh assert _test_args(sinh(2)) def test_sympy__functions__elementary__hyperbolic__tanh(): from sympy.functions.elementary.hyperbolic import tanh assert _test_args(tanh(2)) @SKIP("does this work at all?") def test_sympy__functions__elementary__integers__RoundFunction(): from sympy.functions.elementary.integers import RoundFunction assert _test_args(RoundFunction()) def test_sympy__functions__elementary__integers__ceiling(): from sympy.functions.elementary.integers import ceiling assert _test_args(ceiling(x)) def test_sympy__functions__elementary__integers__floor(): from sympy.functions.elementary.integers import floor assert _test_args(floor(x)) def test_sympy__functions__elementary__integers__frac(): from sympy.functions.elementary.integers import frac assert _test_args(frac(x)) def test_sympy__functions__elementary__miscellaneous__IdentityFunction(): from sympy.functions.elementary.miscellaneous import IdentityFunction assert _test_args(IdentityFunction()) def test_sympy__functions__elementary__miscellaneous__Max(): from sympy.functions.elementary.miscellaneous import Max assert _test_args(Max(x, 2)) def test_sympy__functions__elementary__miscellaneous__Min(): from sympy.functions.elementary.miscellaneous import Min assert _test_args(Min(x, 2)) @SKIP("abstract class") def test_sympy__functions__elementary__miscellaneous__MinMaxBase(): pass def test_sympy__functions__elementary__piecewise__ExprCondPair(): from sympy.functions.elementary.piecewise import ExprCondPair assert _test_args(ExprCondPair(1, True)) def test_sympy__functions__elementary__piecewise__Piecewise(): from sympy.functions.elementary.piecewise import Piecewise assert _test_args(Piecewise((1, x >= 0), (0, True))) @SKIP("abstract class") def test_sympy__functions__elementary__trigonometric__TrigonometricFunction(): pass @SKIP("abstract class") def test_sympy__functions__elementary__trigonometric__ReciprocalTrigonometricFunction(): pass @SKIP("abstract class") def test_sympy__functions__elementary__trigonometric__InverseTrigonometricFunction(): pass def test_sympy__functions__elementary__trigonometric__acos(): from sympy.functions.elementary.trigonometric import acos assert _test_args(acos(2)) def test_sympy__functions__elementary__trigonometric__acot(): from sympy.functions.elementary.trigonometric import acot assert _test_args(acot(2)) def test_sympy__functions__elementary__trigonometric__asin(): from sympy.functions.elementary.trigonometric import asin assert _test_args(asin(2)) def test_sympy__functions__elementary__trigonometric__asec(): from sympy.functions.elementary.trigonometric import asec assert _test_args(asec(2)) def test_sympy__functions__elementary__trigonometric__acsc(): from sympy.functions.elementary.trigonometric import acsc assert _test_args(acsc(2)) def test_sympy__functions__elementary__trigonometric__atan(): from sympy.functions.elementary.trigonometric import atan assert _test_args(atan(2)) def test_sympy__functions__elementary__trigonometric__atan2(): from sympy.functions.elementary.trigonometric import atan2 assert _test_args(atan2(2, 3)) def test_sympy__functions__elementary__trigonometric__cos(): from sympy.functions.elementary.trigonometric import cos assert _test_args(cos(2)) def test_sympy__functions__elementary__trigonometric__csc(): from sympy.functions.elementary.trigonometric import csc assert _test_args(csc(2)) def test_sympy__functions__elementary__trigonometric__cot(): from sympy.functions.elementary.trigonometric import cot assert _test_args(cot(2)) def test_sympy__functions__elementary__trigonometric__sin(): assert _test_args(sin(2)) def test_sympy__functions__elementary__trigonometric__sinc(): from sympy.functions.elementary.trigonometric import sinc assert _test_args(sinc(2)) def test_sympy__functions__elementary__trigonometric__sec(): from sympy.functions.elementary.trigonometric import sec assert _test_args(sec(2)) def test_sympy__functions__elementary__trigonometric__tan(): from sympy.functions.elementary.trigonometric import tan assert _test_args(tan(2)) @SKIP("abstract class") def test_sympy__functions__special__bessel__BesselBase(): pass @SKIP("abstract class") def test_sympy__functions__special__bessel__SphericalBesselBase(): pass @SKIP("abstract class") def test_sympy__functions__special__bessel__SphericalHankelBase(): pass def test_sympy__functions__special__bessel__besseli(): from sympy.functions.special.bessel import besseli assert _test_args(besseli(x, 1)) def test_sympy__functions__special__bessel__besselj(): from sympy.functions.special.bessel import besselj assert _test_args(besselj(x, 1)) def test_sympy__functions__special__bessel__besselk(): from sympy.functions.special.bessel import besselk assert _test_args(besselk(x, 1)) def test_sympy__functions__special__bessel__bessely(): from sympy.functions.special.bessel import bessely assert _test_args(bessely(x, 1)) def test_sympy__functions__special__bessel__hankel1(): from sympy.functions.special.bessel import hankel1 assert _test_args(hankel1(x, 1)) def test_sympy__functions__special__bessel__hankel2(): from sympy.functions.special.bessel import hankel2 assert _test_args(hankel2(x, 1)) def test_sympy__functions__special__bessel__jn(): from sympy.functions.special.bessel import jn assert _test_args(jn(0, x)) def test_sympy__functions__special__bessel__yn(): from sympy.functions.special.bessel import yn assert _test_args(yn(0, x)) def test_sympy__functions__special__bessel__hn1(): from sympy.functions.special.bessel import hn1 assert _test_args(hn1(0, x)) def test_sympy__functions__special__bessel__hn2(): from sympy.functions.special.bessel import hn2 assert _test_args(hn2(0, x)) def test_sympy__functions__special__bessel__AiryBase(): pass def test_sympy__functions__special__bessel__airyai(): from sympy.functions.special.bessel import airyai assert _test_args(airyai(2)) def test_sympy__functions__special__bessel__airybi(): from sympy.functions.special.bessel import airybi assert _test_args(airybi(2)) def test_sympy__functions__special__bessel__airyaiprime(): from sympy.functions.special.bessel import airyaiprime assert _test_args(airyaiprime(2)) def test_sympy__functions__special__bessel__airybiprime(): from sympy.functions.special.bessel import airybiprime assert _test_args(airybiprime(2)) def test_sympy__functions__special__bessel__marcumq(): from sympy.functions.special.bessel import marcumq assert _test_args(marcumq(x, y, z)) def test_sympy__functions__special__elliptic_integrals__elliptic_k(): from sympy.functions.special.elliptic_integrals import elliptic_k as K assert _test_args(K(x)) def test_sympy__functions__special__elliptic_integrals__elliptic_f(): from sympy.functions.special.elliptic_integrals import elliptic_f as F assert _test_args(F(x, y)) def test_sympy__functions__special__elliptic_integrals__elliptic_e(): from sympy.functions.special.elliptic_integrals import elliptic_e as E assert _test_args(E(x)) assert _test_args(E(x, y)) def test_sympy__functions__special__elliptic_integrals__elliptic_pi(): from sympy.functions.special.elliptic_integrals import elliptic_pi as P assert _test_args(P(x, y)) assert _test_args(P(x, y, z)) def test_sympy__functions__special__delta_functions__DiracDelta(): from sympy.functions.special.delta_functions import DiracDelta assert _test_args(DiracDelta(x, 1)) def test_sympy__functions__special__singularity_functions__SingularityFunction(): from sympy.functions.special.singularity_functions import SingularityFunction assert _test_args(SingularityFunction(x, y, z)) def test_sympy__functions__special__delta_functions__Heaviside(): from sympy.functions.special.delta_functions import Heaviside assert _test_args(Heaviside(x)) def test_sympy__functions__special__error_functions__erf(): from sympy.functions.special.error_functions import erf assert _test_args(erf(2)) def test_sympy__functions__special__error_functions__erfc(): from sympy.functions.special.error_functions import erfc assert _test_args(erfc(2)) def test_sympy__functions__special__error_functions__erfi(): from sympy.functions.special.error_functions import erfi assert _test_args(erfi(2)) def test_sympy__functions__special__error_functions__erf2(): from sympy.functions.special.error_functions import erf2 assert _test_args(erf2(2, 3)) def test_sympy__functions__special__error_functions__erfinv(): from sympy.functions.special.error_functions import erfinv assert _test_args(erfinv(2)) def test_sympy__functions__special__error_functions__erfcinv(): from sympy.functions.special.error_functions import erfcinv assert _test_args(erfcinv(2)) def test_sympy__functions__special__error_functions__erf2inv(): from sympy.functions.special.error_functions import erf2inv assert _test_args(erf2inv(2, 3)) @SKIP("abstract class") def test_sympy__functions__special__error_functions__FresnelIntegral(): pass def test_sympy__functions__special__error_functions__fresnels(): from sympy.functions.special.error_functions import fresnels assert _test_args(fresnels(2)) def test_sympy__functions__special__error_functions__fresnelc(): from sympy.functions.special.error_functions import fresnelc assert _test_args(fresnelc(2)) def test_sympy__functions__special__error_functions__erfs(): from sympy.functions.special.error_functions import _erfs assert _test_args(_erfs(2)) def test_sympy__functions__special__error_functions__Ei(): from sympy.functions.special.error_functions import Ei assert _test_args(Ei(2)) def test_sympy__functions__special__error_functions__li(): from sympy.functions.special.error_functions import li assert _test_args(li(2)) def test_sympy__functions__special__error_functions__Li(): from sympy.functions.special.error_functions import Li assert _test_args(Li(2)) @SKIP("abstract class") def test_sympy__functions__special__error_functions__TrigonometricIntegral(): pass def test_sympy__functions__special__error_functions__Si(): from sympy.functions.special.error_functions import Si assert _test_args(Si(2)) def test_sympy__functions__special__error_functions__Ci(): from sympy.functions.special.error_functions import Ci assert _test_args(Ci(2)) def test_sympy__functions__special__error_functions__Shi(): from sympy.functions.special.error_functions import Shi assert _test_args(Shi(2)) def test_sympy__functions__special__error_functions__Chi(): from sympy.functions.special.error_functions import Chi assert _test_args(Chi(2)) def test_sympy__functions__special__error_functions__expint(): from sympy.functions.special.error_functions import expint assert _test_args(expint(y, x)) def test_sympy__functions__special__gamma_functions__gamma(): from sympy.functions.special.gamma_functions import gamma assert _test_args(gamma(x)) def test_sympy__functions__special__gamma_functions__loggamma(): from sympy.functions.special.gamma_functions import loggamma assert _test_args(loggamma(2)) def test_sympy__functions__special__gamma_functions__lowergamma(): from sympy.functions.special.gamma_functions import lowergamma assert _test_args(lowergamma(x, 2)) def test_sympy__functions__special__gamma_functions__polygamma(): from sympy.functions.special.gamma_functions import polygamma assert _test_args(polygamma(x, 2)) def test_sympy__functions__special__gamma_functions__digamma(): from sympy.functions.special.gamma_functions import digamma assert _test_args(digamma(x)) def test_sympy__functions__special__gamma_functions__trigamma(): from sympy.functions.special.gamma_functions import trigamma assert _test_args(trigamma(x)) def test_sympy__functions__special__gamma_functions__uppergamma(): from sympy.functions.special.gamma_functions import uppergamma assert _test_args(uppergamma(x, 2)) def test_sympy__functions__special__gamma_functions__multigamma(): from sympy.functions.special.gamma_functions import multigamma assert _test_args(multigamma(x, 1)) def test_sympy__functions__special__beta_functions__beta(): from sympy.functions.special.beta_functions import beta assert _test_args(beta(x, x)) def test_sympy__functions__special__mathieu_functions__MathieuBase(): pass def test_sympy__functions__special__mathieu_functions__mathieus(): from sympy.functions.special.mathieu_functions import mathieus assert _test_args(mathieus(1, 1, 1)) def test_sympy__functions__special__mathieu_functions__mathieuc(): from sympy.functions.special.mathieu_functions import mathieuc assert _test_args(mathieuc(1, 1, 1)) def test_sympy__functions__special__mathieu_functions__mathieusprime(): from sympy.functions.special.mathieu_functions import mathieusprime assert _test_args(mathieusprime(1, 1, 1)) def test_sympy__functions__special__mathieu_functions__mathieucprime(): from sympy.functions.special.mathieu_functions import mathieucprime assert _test_args(mathieucprime(1, 1, 1)) @SKIP("abstract class") def test_sympy__functions__special__hyper__TupleParametersBase(): pass @SKIP("abstract class") def test_sympy__functions__special__hyper__TupleArg(): pass def test_sympy__functions__special__hyper__hyper(): from sympy.functions.special.hyper import hyper assert _test_args(hyper([1, 2, 3], [4, 5], x)) def test_sympy__functions__special__hyper__meijerg(): from sympy.functions.special.hyper import meijerg assert _test_args(meijerg([1, 2, 3], [4, 5], [6], [], x)) @SKIP("abstract class") def test_sympy__functions__special__hyper__HyperRep(): pass def test_sympy__functions__special__hyper__HyperRep_power1(): from sympy.functions.special.hyper import HyperRep_power1 assert _test_args(HyperRep_power1(x, y)) def test_sympy__functions__special__hyper__HyperRep_power2(): from sympy.functions.special.hyper import HyperRep_power2 assert _test_args(HyperRep_power2(x, y)) def test_sympy__functions__special__hyper__HyperRep_log1(): from sympy.functions.special.hyper import HyperRep_log1 assert _test_args(HyperRep_log1(x)) def test_sympy__functions__special__hyper__HyperRep_atanh(): from sympy.functions.special.hyper import HyperRep_atanh assert _test_args(HyperRep_atanh(x)) def test_sympy__functions__special__hyper__HyperRep_asin1(): from sympy.functions.special.hyper import HyperRep_asin1 assert _test_args(HyperRep_asin1(x)) def test_sympy__functions__special__hyper__HyperRep_asin2(): from sympy.functions.special.hyper import HyperRep_asin2 assert _test_args(HyperRep_asin2(x)) def test_sympy__functions__special__hyper__HyperRep_sqrts1(): from sympy.functions.special.hyper import HyperRep_sqrts1 assert _test_args(HyperRep_sqrts1(x, y)) def test_sympy__functions__special__hyper__HyperRep_sqrts2(): from sympy.functions.special.hyper import HyperRep_sqrts2 assert _test_args(HyperRep_sqrts2(x, y)) def test_sympy__functions__special__hyper__HyperRep_log2(): from sympy.functions.special.hyper import HyperRep_log2 assert _test_args(HyperRep_log2(x)) def test_sympy__functions__special__hyper__HyperRep_cosasin(): from sympy.functions.special.hyper import HyperRep_cosasin assert _test_args(HyperRep_cosasin(x, y)) def test_sympy__functions__special__hyper__HyperRep_sinasin(): from sympy.functions.special.hyper import HyperRep_sinasin assert _test_args(HyperRep_sinasin(x, y)) def test_sympy__functions__special__hyper__appellf1(): from sympy.functions.special.hyper import appellf1 a, b1, b2, c, x, y = symbols('a b1 b2 c x y') assert _test_args(appellf1(a, b1, b2, c, x, y)) @SKIP("abstract class") def test_sympy__functions__special__polynomials__OrthogonalPolynomial(): pass def test_sympy__functions__special__polynomials__jacobi(): from sympy.functions.special.polynomials import jacobi assert _test_args(jacobi(x, 2, 2, 2)) def test_sympy__functions__special__polynomials__gegenbauer(): from sympy.functions.special.polynomials import gegenbauer assert _test_args(gegenbauer(x, 2, 2)) def test_sympy__functions__special__polynomials__chebyshevt(): from sympy.functions.special.polynomials import chebyshevt assert _test_args(chebyshevt(x, 2)) def test_sympy__functions__special__polynomials__chebyshevt_root(): from sympy.functions.special.polynomials import chebyshevt_root assert _test_args(chebyshevt_root(3, 2)) def test_sympy__functions__special__polynomials__chebyshevu(): from sympy.functions.special.polynomials import chebyshevu assert _test_args(chebyshevu(x, 2)) def test_sympy__functions__special__polynomials__chebyshevu_root(): from sympy.functions.special.polynomials import chebyshevu_root assert _test_args(chebyshevu_root(3, 2)) def test_sympy__functions__special__polynomials__hermite(): from sympy.functions.special.polynomials import hermite assert _test_args(hermite(x, 2)) def test_sympy__functions__special__polynomials__legendre(): from sympy.functions.special.polynomials import legendre assert _test_args(legendre(x, 2)) def test_sympy__functions__special__polynomials__assoc_legendre(): from sympy.functions.special.polynomials import assoc_legendre assert _test_args(assoc_legendre(x, 0, y)) def test_sympy__functions__special__polynomials__laguerre(): from sympy.functions.special.polynomials import laguerre assert _test_args(laguerre(x, 2)) def test_sympy__functions__special__polynomials__assoc_laguerre(): from sympy.functions.special.polynomials import assoc_laguerre assert _test_args(assoc_laguerre(x, 0, y)) def test_sympy__functions__special__spherical_harmonics__Ynm(): from sympy.functions.special.spherical_harmonics import Ynm assert _test_args(Ynm(1, 1, x, y)) def test_sympy__functions__special__spherical_harmonics__Znm(): from sympy.functions.special.spherical_harmonics import Znm assert _test_args(Znm(1, 1, x, y)) def test_sympy__functions__special__tensor_functions__LeviCivita(): from sympy.functions.special.tensor_functions import LeviCivita assert _test_args(LeviCivita(x, y, 2)) def test_sympy__functions__special__tensor_functions__KroneckerDelta(): from sympy.functions.special.tensor_functions import KroneckerDelta assert _test_args(KroneckerDelta(x, y)) def test_sympy__functions__special__zeta_functions__dirichlet_eta(): from sympy.functions.special.zeta_functions import dirichlet_eta assert _test_args(dirichlet_eta(x)) def test_sympy__functions__special__zeta_functions__zeta(): from sympy.functions.special.zeta_functions import zeta assert _test_args(zeta(101)) def test_sympy__functions__special__zeta_functions__lerchphi(): from sympy.functions.special.zeta_functions import lerchphi assert _test_args(lerchphi(x, y, z)) def test_sympy__functions__special__zeta_functions__polylog(): from sympy.functions.special.zeta_functions import polylog assert _test_args(polylog(x, y)) def test_sympy__functions__special__zeta_functions__stieltjes(): from sympy.functions.special.zeta_functions import stieltjes assert _test_args(stieltjes(x, y)) def test_sympy__integrals__integrals__Integral(): from sympy.integrals.integrals import Integral assert _test_args(Integral(2, (x, 0, 1))) def test_sympy__integrals__risch__NonElementaryIntegral(): from sympy.integrals.risch import NonElementaryIntegral assert _test_args(NonElementaryIntegral(exp(-x**2), x)) @SKIP("abstract class") def test_sympy__integrals__transforms__IntegralTransform(): pass def test_sympy__integrals__transforms__MellinTransform(): from sympy.integrals.transforms import MellinTransform assert _test_args(MellinTransform(2, x, y)) def test_sympy__integrals__transforms__InverseMellinTransform(): from sympy.integrals.transforms import InverseMellinTransform assert _test_args(InverseMellinTransform(2, x, y, 0, 1)) def test_sympy__integrals__transforms__LaplaceTransform(): from sympy.integrals.transforms import LaplaceTransform assert _test_args(LaplaceTransform(2, x, y)) def test_sympy__integrals__transforms__InverseLaplaceTransform(): from sympy.integrals.transforms import InverseLaplaceTransform assert _test_args(InverseLaplaceTransform(2, x, y, 0)) @SKIP("abstract class") def test_sympy__integrals__transforms__FourierTypeTransform(): pass def test_sympy__integrals__transforms__InverseFourierTransform(): from sympy.integrals.transforms import InverseFourierTransform assert _test_args(InverseFourierTransform(2, x, y)) def test_sympy__integrals__transforms__FourierTransform(): from sympy.integrals.transforms import FourierTransform assert _test_args(FourierTransform(2, x, y)) @SKIP("abstract class") def test_sympy__integrals__transforms__SineCosineTypeTransform(): pass def test_sympy__integrals__transforms__InverseSineTransform(): from sympy.integrals.transforms import InverseSineTransform assert _test_args(InverseSineTransform(2, x, y)) def test_sympy__integrals__transforms__SineTransform(): from sympy.integrals.transforms import SineTransform assert _test_args(SineTransform(2, x, y)) def test_sympy__integrals__transforms__InverseCosineTransform(): from sympy.integrals.transforms import InverseCosineTransform assert _test_args(InverseCosineTransform(2, x, y)) def test_sympy__integrals__transforms__CosineTransform(): from sympy.integrals.transforms import CosineTransform assert _test_args(CosineTransform(2, x, y)) @SKIP("abstract class") def test_sympy__integrals__transforms__HankelTypeTransform(): pass def test_sympy__integrals__transforms__InverseHankelTransform(): from sympy.integrals.transforms import InverseHankelTransform assert _test_args(InverseHankelTransform(2, x, y, 0)) def test_sympy__integrals__transforms__HankelTransform(): from sympy.integrals.transforms import HankelTransform assert _test_args(HankelTransform(2, x, y, 0)) @XFAIL def test_sympy__liealgebras__cartan_type__CartanType_generator(): from sympy.liealgebras.cartan_type import CartanType_generator assert _test_args(CartanType_generator("A2")) @XFAIL def test_sympy__liealgebras__cartan_type__Standard_Cartan(): from sympy.liealgebras.cartan_type import Standard_Cartan assert _test_args(Standard_Cartan("A", 2)) @XFAIL def test_sympy__liealgebras__weyl_group__WeylGroup(): from sympy.liealgebras.weyl_group import WeylGroup assert _test_args(WeylGroup("B4")) @XFAIL def test_sympy__liealgebras__root_system__RootSystem(): from sympy.liealgebras.root_system import RootSystem assert _test_args(RootSystem("A2")) @XFAIL def test_sympy__liealgebras__type_a__TypeA(): from sympy.liealgebras.type_a import TypeA assert _test_args(TypeA(2)) @XFAIL def test_sympy__liealgebras__type_b__TypeB(): from sympy.liealgebras.type_b import TypeB assert _test_args(TypeB(4)) @XFAIL def test_sympy__liealgebras__type_c__TypeC(): from sympy.liealgebras.type_c import TypeC assert _test_args(TypeC(4)) @XFAIL def test_sympy__liealgebras__type_d__TypeD(): from sympy.liealgebras.type_d import TypeD assert _test_args(TypeD(4)) @XFAIL def test_sympy__liealgebras__type_e__TypeE(): from sympy.liealgebras.type_e import TypeE assert _test_args(TypeE(6)) @XFAIL def test_sympy__liealgebras__type_f__TypeF(): from sympy.liealgebras.type_f import TypeF assert _test_args(TypeF(4)) @XFAIL def test_sympy__liealgebras__type_g__TypeG(): from sympy.liealgebras.type_g import TypeG assert _test_args(TypeG(2)) def test_sympy__logic__boolalg__And(): from sympy.logic.boolalg import And assert _test_args(And(x, y, 1)) @SKIP("abstract class") def test_sympy__logic__boolalg__Boolean(): pass def test_sympy__logic__boolalg__BooleanFunction(): from sympy.logic.boolalg import BooleanFunction assert _test_args(BooleanFunction(1, 2, 3)) @SKIP("abstract class") def test_sympy__logic__boolalg__BooleanAtom(): pass def test_sympy__logic__boolalg__BooleanTrue(): from sympy.logic.boolalg import true assert _test_args(true) def test_sympy__logic__boolalg__BooleanFalse(): from sympy.logic.boolalg import false assert _test_args(false) def test_sympy__logic__boolalg__Equivalent(): from sympy.logic.boolalg import Equivalent assert _test_args(Equivalent(x, 2)) def test_sympy__logic__boolalg__ITE(): from sympy.logic.boolalg import ITE assert _test_args(ITE(x, y, 1)) def test_sympy__logic__boolalg__Implies(): from sympy.logic.boolalg import Implies assert _test_args(Implies(x, y)) def test_sympy__logic__boolalg__Nand(): from sympy.logic.boolalg import Nand assert _test_args(Nand(x, y, 1)) def test_sympy__logic__boolalg__Nor(): from sympy.logic.boolalg import Nor assert _test_args(Nor(x, y)) def test_sympy__logic__boolalg__Not(): from sympy.logic.boolalg import Not assert _test_args(Not(x)) def test_sympy__logic__boolalg__Or(): from sympy.logic.boolalg import Or assert _test_args(Or(x, y)) def test_sympy__logic__boolalg__Xor(): from sympy.logic.boolalg import Xor assert _test_args(Xor(x, y, 2)) def test_sympy__logic__boolalg__Xnor(): from sympy.logic.boolalg import Xnor assert _test_args(Xnor(x, y, 2)) def test_sympy__matrices__matrices__DeferredVector(): from sympy.matrices.matrices import DeferredVector assert _test_args(DeferredVector("X")) @SKIP("abstract class") def test_sympy__matrices__expressions__matexpr__MatrixBase(): pass def test_sympy__matrices__immutable__ImmutableDenseMatrix(): from sympy.matrices.immutable import ImmutableDenseMatrix m = ImmutableDenseMatrix([[1, 2], [3, 4]]) assert _test_args(m) assert _test_args(Basic(*list(m))) m = ImmutableDenseMatrix(1, 1, [1]) assert _test_args(m) assert _test_args(Basic(*list(m))) m = ImmutableDenseMatrix(2, 2, lambda i, j: 1) assert m[0, 0] is S.One m = ImmutableDenseMatrix(2, 2, lambda i, j: 1/(1 + i) + 1/(1 + j)) assert m[1, 1] is S.One # true div. will give 1.0 if i,j not sympified assert _test_args(m) assert _test_args(Basic(*list(m))) def test_sympy__matrices__immutable__ImmutableSparseMatrix(): from sympy.matrices.immutable import ImmutableSparseMatrix m = ImmutableSparseMatrix([[1, 2], [3, 4]]) assert _test_args(m) assert _test_args(Basic(*list(m))) m = ImmutableSparseMatrix(1, 1, {(0, 0): 1}) assert _test_args(m) assert _test_args(Basic(*list(m))) m = ImmutableSparseMatrix(1, 1, [1]) assert _test_args(m) assert _test_args(Basic(*list(m))) m = ImmutableSparseMatrix(2, 2, lambda i, j: 1) assert m[0, 0] is S.One m = ImmutableSparseMatrix(2, 2, lambda i, j: 1/(1 + i) + 1/(1 + j)) assert m[1, 1] is S.One # true div. will give 1.0 if i,j not sympified assert _test_args(m) assert _test_args(Basic(*list(m))) def test_sympy__matrices__expressions__slice__MatrixSlice(): from sympy.matrices.expressions.slice import MatrixSlice from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', 4, 4) assert _test_args(MatrixSlice(X, (0, 2), (0, 2))) def test_sympy__matrices__expressions__applyfunc__ElementwiseApplyFunction(): from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol("X", x, x) func = Lambda(x, x**2) assert _test_args(ElementwiseApplyFunction(func, X)) def test_sympy__matrices__expressions__blockmatrix__BlockDiagMatrix(): from sympy.matrices.expressions.blockmatrix import BlockDiagMatrix from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, x) Y = MatrixSymbol('Y', y, y) assert _test_args(BlockDiagMatrix(X, Y)) def test_sympy__matrices__expressions__blockmatrix__BlockMatrix(): from sympy.matrices.expressions.blockmatrix import BlockMatrix from sympy.matrices.expressions import MatrixSymbol, ZeroMatrix X = MatrixSymbol('X', x, x) Y = MatrixSymbol('Y', y, y) Z = MatrixSymbol('Z', x, y) O = ZeroMatrix(y, x) assert _test_args(BlockMatrix([[X, Z], [O, Y]])) def test_sympy__matrices__expressions__inverse__Inverse(): from sympy.matrices.expressions.inverse import Inverse from sympy.matrices.expressions import MatrixSymbol assert _test_args(Inverse(MatrixSymbol('A', 3, 3))) def test_sympy__matrices__expressions__matadd__MatAdd(): from sympy.matrices.expressions.matadd import MatAdd from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, y) Y = MatrixSymbol('Y', x, y) assert _test_args(MatAdd(X, Y)) def test_sympy__matrices__expressions__matexpr__Identity(): from sympy.matrices.expressions.matexpr import Identity assert _test_args(Identity(3)) def test_sympy__matrices__expressions__matexpr__GenericIdentity(): from sympy.matrices.expressions.matexpr import GenericIdentity assert _test_args(GenericIdentity()) @SKIP("abstract class") def test_sympy__matrices__expressions__matexpr__MatrixExpr(): pass def test_sympy__matrices__expressions__matexpr__MatrixElement(): from sympy.matrices.expressions.matexpr import MatrixSymbol, MatrixElement from sympy import S assert _test_args(MatrixElement(MatrixSymbol('A', 3, 5), S(2), S(3))) def test_sympy__matrices__expressions__matexpr__MatrixSymbol(): from sympy.matrices.expressions.matexpr import MatrixSymbol assert _test_args(MatrixSymbol('A', 3, 5)) def test_sympy__matrices__expressions__matexpr__ZeroMatrix(): from sympy.matrices.expressions.matexpr import ZeroMatrix assert _test_args(ZeroMatrix(3, 5)) def test_sympy__matrices__expressions__matexpr__OneMatrix(): from sympy.matrices.expressions.matexpr import OneMatrix assert _test_args(OneMatrix(3, 5)) def test_sympy__matrices__expressions__matexpr__GenericZeroMatrix(): from sympy.matrices.expressions.matexpr import GenericZeroMatrix assert _test_args(GenericZeroMatrix()) def test_sympy__matrices__expressions__matmul__MatMul(): from sympy.matrices.expressions.matmul import MatMul from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, y) Y = MatrixSymbol('Y', y, x) assert _test_args(MatMul(X, Y)) def test_sympy__matrices__expressions__dotproduct__DotProduct(): from sympy.matrices.expressions.dotproduct import DotProduct from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, 1) Y = MatrixSymbol('Y', x, 1) assert _test_args(DotProduct(X, Y)) def test_sympy__matrices__expressions__diagonal__DiagonalMatrix(): from sympy.matrices.expressions.diagonal import DiagonalMatrix from sympy.matrices.expressions import MatrixSymbol x = MatrixSymbol('x', 10, 1) assert _test_args(DiagonalMatrix(x)) def test_sympy__matrices__expressions__diagonal__DiagonalOf(): from sympy.matrices.expressions.diagonal import DiagonalOf from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('x', 10, 10) assert _test_args(DiagonalOf(X)) def test_sympy__matrices__expressions__diagonal__DiagMatrix(): from sympy.matrices.expressions.diagonal import DiagMatrix from sympy.matrices.expressions import MatrixSymbol x = MatrixSymbol('x', 10, 1) assert _test_args(DiagMatrix(x)) def test_sympy__matrices__expressions__hadamard__HadamardProduct(): from sympy.matrices.expressions.hadamard import HadamardProduct from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, y) Y = MatrixSymbol('Y', x, y) assert _test_args(HadamardProduct(X, Y)) def test_sympy__matrices__expressions__hadamard__HadamardPower(): from sympy.matrices.expressions.hadamard import HadamardPower from sympy.matrices.expressions import MatrixSymbol from sympy import Symbol X = MatrixSymbol('X', x, y) n = Symbol("n") assert _test_args(HadamardPower(X, n)) def test_sympy__matrices__expressions__kronecker__KroneckerProduct(): from sympy.matrices.expressions.kronecker import KroneckerProduct from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, y) Y = MatrixSymbol('Y', x, y) assert _test_args(KroneckerProduct(X, Y)) def test_sympy__matrices__expressions__matpow__MatPow(): from sympy.matrices.expressions.matpow import MatPow from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', x, x) assert _test_args(MatPow(X, 2)) def test_sympy__matrices__expressions__transpose__Transpose(): from sympy.matrices.expressions.transpose import Transpose from sympy.matrices.expressions import MatrixSymbol assert _test_args(Transpose(MatrixSymbol('A', 3, 5))) def test_sympy__matrices__expressions__adjoint__Adjoint(): from sympy.matrices.expressions.adjoint import Adjoint from sympy.matrices.expressions import MatrixSymbol assert _test_args(Adjoint(MatrixSymbol('A', 3, 5))) def test_sympy__matrices__expressions__trace__Trace(): from sympy.matrices.expressions.trace import Trace from sympy.matrices.expressions import MatrixSymbol assert _test_args(Trace(MatrixSymbol('A', 3, 3))) def test_sympy__matrices__expressions__determinant__Determinant(): from sympy.matrices.expressions.determinant import Determinant from sympy.matrices.expressions import MatrixSymbol assert _test_args(Determinant(MatrixSymbol('A', 3, 3))) def test_sympy__matrices__expressions__funcmatrix__FunctionMatrix(): from sympy.matrices.expressions.funcmatrix import FunctionMatrix from sympy import symbols i, j = symbols('i,j') assert _test_args(FunctionMatrix(3, 3, Lambda((i, j), i - j) )) def test_sympy__matrices__expressions__fourier__DFT(): from sympy.matrices.expressions.fourier import DFT from sympy import S assert _test_args(DFT(S(2))) def test_sympy__matrices__expressions__fourier__IDFT(): from sympy.matrices.expressions.fourier import IDFT from sympy import S assert _test_args(IDFT(S(2))) from sympy.matrices.expressions import MatrixSymbol X = MatrixSymbol('X', 10, 10) def test_sympy__matrices__expressions__factorizations__LofLU(): from sympy.matrices.expressions.factorizations import LofLU assert _test_args(LofLU(X)) def test_sympy__matrices__expressions__factorizations__UofLU(): from sympy.matrices.expressions.factorizations import UofLU assert _test_args(UofLU(X)) def test_sympy__matrices__expressions__factorizations__QofQR(): from sympy.matrices.expressions.factorizations import QofQR assert _test_args(QofQR(X)) def test_sympy__matrices__expressions__factorizations__RofQR(): from sympy.matrices.expressions.factorizations import RofQR assert _test_args(RofQR(X)) def test_sympy__matrices__expressions__factorizations__LofCholesky(): from sympy.matrices.expressions.factorizations import LofCholesky assert _test_args(LofCholesky(X)) def test_sympy__matrices__expressions__factorizations__UofCholesky(): from sympy.matrices.expressions.factorizations import UofCholesky assert _test_args(UofCholesky(X)) def test_sympy__matrices__expressions__factorizations__EigenVectors(): from sympy.matrices.expressions.factorizations import EigenVectors assert _test_args(EigenVectors(X)) def test_sympy__matrices__expressions__factorizations__EigenValues(): from sympy.matrices.expressions.factorizations import EigenValues assert _test_args(EigenValues(X)) def test_sympy__matrices__expressions__factorizations__UofSVD(): from sympy.matrices.expressions.factorizations import UofSVD assert _test_args(UofSVD(X)) def test_sympy__matrices__expressions__factorizations__VofSVD(): from sympy.matrices.expressions.factorizations import VofSVD assert _test_args(VofSVD(X)) def test_sympy__matrices__expressions__factorizations__SofSVD(): from sympy.matrices.expressions.factorizations import SofSVD assert _test_args(SofSVD(X)) @SKIP("abstract class") def test_sympy__matrices__expressions__factorizations__Factorization(): pass def test_sympy__matrices__expressions__permutation__PermutationMatrix(): from sympy.combinatorics import Permutation from sympy.matrices.expressions.permutation import PermutationMatrix assert _test_args(PermutationMatrix(Permutation([2, 0, 1]))) def test_sympy__matrices__expressions__permutation__MatrixPermute(): from sympy.combinatorics import Permutation from sympy.matrices.expressions.matexpr import MatrixSymbol from sympy.matrices.expressions.permutation import MatrixPermute A = MatrixSymbol('A', 3, 3) assert _test_args(MatrixPermute(A, Permutation([2, 0, 1]))) def test_sympy__physics__vector__frame__CoordinateSym(): from sympy.physics.vector import CoordinateSym from sympy.physics.vector import ReferenceFrame assert _test_args(CoordinateSym('R_x', ReferenceFrame('R'), 0)) def test_sympy__physics__paulialgebra__Pauli(): from sympy.physics.paulialgebra import Pauli assert _test_args(Pauli(1)) def test_sympy__physics__quantum__anticommutator__AntiCommutator(): from sympy.physics.quantum.anticommutator import AntiCommutator assert _test_args(AntiCommutator(x, y)) def test_sympy__physics__quantum__cartesian__PositionBra3D(): from sympy.physics.quantum.cartesian import PositionBra3D assert _test_args(PositionBra3D(x, y, z)) def test_sympy__physics__quantum__cartesian__PositionKet3D(): from sympy.physics.quantum.cartesian import PositionKet3D assert _test_args(PositionKet3D(x, y, z)) def test_sympy__physics__quantum__cartesian__PositionState3D(): from sympy.physics.quantum.cartesian import PositionState3D assert _test_args(PositionState3D(x, y, z)) def test_sympy__physics__quantum__cartesian__PxBra(): from sympy.physics.quantum.cartesian import PxBra assert _test_args(PxBra(x, y, z)) def test_sympy__physics__quantum__cartesian__PxKet(): from sympy.physics.quantum.cartesian import PxKet assert _test_args(PxKet(x, y, z)) def test_sympy__physics__quantum__cartesian__PxOp(): from sympy.physics.quantum.cartesian import PxOp assert _test_args(PxOp(x, y, z)) def test_sympy__physics__quantum__cartesian__XBra(): from sympy.physics.quantum.cartesian import XBra assert _test_args(XBra(x)) def test_sympy__physics__quantum__cartesian__XKet(): from sympy.physics.quantum.cartesian import XKet assert _test_args(XKet(x)) def test_sympy__physics__quantum__cartesian__XOp(): from sympy.physics.quantum.cartesian import XOp assert _test_args(XOp(x)) def test_sympy__physics__quantum__cartesian__YOp(): from sympy.physics.quantum.cartesian import YOp assert _test_args(YOp(x)) def test_sympy__physics__quantum__cartesian__ZOp(): from sympy.physics.quantum.cartesian import ZOp assert _test_args(ZOp(x)) def test_sympy__physics__quantum__cg__CG(): from sympy.physics.quantum.cg import CG from sympy import S assert _test_args(CG(Rational(3, 2), Rational(3, 2), S.Half, Rational(-1, 2), 1, 1)) def test_sympy__physics__quantum__cg__Wigner3j(): from sympy.physics.quantum.cg import Wigner3j assert _test_args(Wigner3j(6, 0, 4, 0, 2, 0)) def test_sympy__physics__quantum__cg__Wigner6j(): from sympy.physics.quantum.cg import Wigner6j assert _test_args(Wigner6j(1, 2, 3, 2, 1, 2)) def test_sympy__physics__quantum__cg__Wigner9j(): from sympy.physics.quantum.cg import Wigner9j assert _test_args(Wigner9j(2, 1, 1, Rational(3, 2), S.Half, 1, S.Half, S.Half, 0)) def test_sympy__physics__quantum__circuitplot__Mz(): from sympy.physics.quantum.circuitplot import Mz assert _test_args(Mz(0)) def test_sympy__physics__quantum__circuitplot__Mx(): from sympy.physics.quantum.circuitplot import Mx assert _test_args(Mx(0)) def test_sympy__physics__quantum__commutator__Commutator(): from sympy.physics.quantum.commutator import Commutator A, B = symbols('A,B', commutative=False) assert _test_args(Commutator(A, B)) def test_sympy__physics__quantum__constants__HBar(): from sympy.physics.quantum.constants import HBar assert _test_args(HBar()) def test_sympy__physics__quantum__dagger__Dagger(): from sympy.physics.quantum.dagger import Dagger from sympy.physics.quantum.state import Ket assert _test_args(Dagger(Dagger(Ket('psi')))) def test_sympy__physics__quantum__gate__CGate(): from sympy.physics.quantum.gate import CGate, Gate assert _test_args(CGate((0, 1), Gate(2))) def test_sympy__physics__quantum__gate__CGateS(): from sympy.physics.quantum.gate import CGateS, Gate assert _test_args(CGateS((0, 1), Gate(2))) def test_sympy__physics__quantum__gate__CNotGate(): from sympy.physics.quantum.gate import CNotGate assert _test_args(CNotGate(0, 1)) def test_sympy__physics__quantum__gate__Gate(): from sympy.physics.quantum.gate import Gate assert _test_args(Gate(0)) def test_sympy__physics__quantum__gate__HadamardGate(): from sympy.physics.quantum.gate import HadamardGate assert _test_args(HadamardGate(0)) def test_sympy__physics__quantum__gate__IdentityGate(): from sympy.physics.quantum.gate import IdentityGate assert _test_args(IdentityGate(0)) def test_sympy__physics__quantum__gate__OneQubitGate(): from sympy.physics.quantum.gate import OneQubitGate assert _test_args(OneQubitGate(0)) def test_sympy__physics__quantum__gate__PhaseGate(): from sympy.physics.quantum.gate import PhaseGate assert _test_args(PhaseGate(0)) def test_sympy__physics__quantum__gate__SwapGate(): from sympy.physics.quantum.gate import SwapGate assert _test_args(SwapGate(0, 1)) def test_sympy__physics__quantum__gate__TGate(): from sympy.physics.quantum.gate import TGate assert _test_args(TGate(0)) def test_sympy__physics__quantum__gate__TwoQubitGate(): from sympy.physics.quantum.gate import TwoQubitGate assert _test_args(TwoQubitGate(0)) def test_sympy__physics__quantum__gate__UGate(): from sympy.physics.quantum.gate import UGate from sympy.matrices.immutable import ImmutableDenseMatrix from sympy import Integer, Tuple assert _test_args( UGate(Tuple(Integer(1)), ImmutableDenseMatrix([[1, 0], [0, 2]]))) def test_sympy__physics__quantum__gate__XGate(): from sympy.physics.quantum.gate import XGate assert _test_args(XGate(0)) def test_sympy__physics__quantum__gate__YGate(): from sympy.physics.quantum.gate import YGate assert _test_args(YGate(0)) def test_sympy__physics__quantum__gate__ZGate(): from sympy.physics.quantum.gate import ZGate assert _test_args(ZGate(0)) @SKIP("TODO: sympy.physics") def test_sympy__physics__quantum__grover__OracleGate(): from sympy.physics.quantum.grover import OracleGate assert _test_args(OracleGate()) def test_sympy__physics__quantum__grover__WGate(): from sympy.physics.quantum.grover import WGate assert _test_args(WGate(1)) def test_sympy__physics__quantum__hilbert__ComplexSpace(): from sympy.physics.quantum.hilbert import ComplexSpace assert _test_args(ComplexSpace(x)) def test_sympy__physics__quantum__hilbert__DirectSumHilbertSpace(): from sympy.physics.quantum.hilbert import DirectSumHilbertSpace, ComplexSpace, FockSpace c = ComplexSpace(2) f = FockSpace() assert _test_args(DirectSumHilbertSpace(c, f)) def test_sympy__physics__quantum__hilbert__FockSpace(): from sympy.physics.quantum.hilbert import FockSpace assert _test_args(FockSpace()) def test_sympy__physics__quantum__hilbert__HilbertSpace(): from sympy.physics.quantum.hilbert import HilbertSpace assert _test_args(HilbertSpace()) def test_sympy__physics__quantum__hilbert__L2(): from sympy.physics.quantum.hilbert import L2 from sympy import oo, Interval assert _test_args(L2(Interval(0, oo))) def test_sympy__physics__quantum__hilbert__TensorPowerHilbertSpace(): from sympy.physics.quantum.hilbert import TensorPowerHilbertSpace, FockSpace f = FockSpace() assert _test_args(TensorPowerHilbertSpace(f, 2)) def test_sympy__physics__quantum__hilbert__TensorProductHilbertSpace(): from sympy.physics.quantum.hilbert import TensorProductHilbertSpace, FockSpace, ComplexSpace c = ComplexSpace(2) f = FockSpace() assert _test_args(TensorProductHilbertSpace(f, c)) def test_sympy__physics__quantum__innerproduct__InnerProduct(): from sympy.physics.quantum import Bra, Ket, InnerProduct b = Bra('b') k = Ket('k') assert _test_args(InnerProduct(b, k)) def test_sympy__physics__quantum__operator__DifferentialOperator(): from sympy.physics.quantum.operator import DifferentialOperator from sympy import Derivative, Function f = Function('f') assert _test_args(DifferentialOperator(1/x*Derivative(f(x), x), f(x))) def test_sympy__physics__quantum__operator__HermitianOperator(): from sympy.physics.quantum.operator import HermitianOperator assert _test_args(HermitianOperator('H')) def test_sympy__physics__quantum__operator__IdentityOperator(): from sympy.physics.quantum.operator import IdentityOperator assert _test_args(IdentityOperator(5)) def test_sympy__physics__quantum__operator__Operator(): from sympy.physics.quantum.operator import Operator assert _test_args(Operator('A')) def test_sympy__physics__quantum__operator__OuterProduct(): from sympy.physics.quantum.operator import OuterProduct from sympy.physics.quantum import Ket, Bra b = Bra('b') k = Ket('k') assert _test_args(OuterProduct(k, b)) def test_sympy__physics__quantum__operator__UnitaryOperator(): from sympy.physics.quantum.operator import UnitaryOperator assert _test_args(UnitaryOperator('U')) def test_sympy__physics__quantum__piab__PIABBra(): from sympy.physics.quantum.piab import PIABBra assert _test_args(PIABBra('B')) def test_sympy__physics__quantum__boson__BosonOp(): from sympy.physics.quantum.boson import BosonOp assert _test_args(BosonOp('a')) assert _test_args(BosonOp('a', False)) def test_sympy__physics__quantum__boson__BosonFockKet(): from sympy.physics.quantum.boson import BosonFockKet assert _test_args(BosonFockKet(1)) def test_sympy__physics__quantum__boson__BosonFockBra(): from sympy.physics.quantum.boson import BosonFockBra assert _test_args(BosonFockBra(1)) def test_sympy__physics__quantum__boson__BosonCoherentKet(): from sympy.physics.quantum.boson import BosonCoherentKet assert _test_args(BosonCoherentKet(1)) def test_sympy__physics__quantum__boson__BosonCoherentBra(): from sympy.physics.quantum.boson import BosonCoherentBra assert _test_args(BosonCoherentBra(1)) def test_sympy__physics__quantum__fermion__FermionOp(): from sympy.physics.quantum.fermion import FermionOp assert _test_args(FermionOp('c')) assert _test_args(FermionOp('c', False)) def test_sympy__physics__quantum__fermion__FermionFockKet(): from sympy.physics.quantum.fermion import FermionFockKet assert _test_args(FermionFockKet(1)) def test_sympy__physics__quantum__fermion__FermionFockBra(): from sympy.physics.quantum.fermion import FermionFockBra assert _test_args(FermionFockBra(1)) def test_sympy__physics__quantum__pauli__SigmaOpBase(): from sympy.physics.quantum.pauli import SigmaOpBase assert _test_args(SigmaOpBase()) def test_sympy__physics__quantum__pauli__SigmaX(): from sympy.physics.quantum.pauli import SigmaX assert _test_args(SigmaX()) def test_sympy__physics__quantum__pauli__SigmaY(): from sympy.physics.quantum.pauli import SigmaY assert _test_args(SigmaY()) def test_sympy__physics__quantum__pauli__SigmaZ(): from sympy.physics.quantum.pauli import SigmaZ assert _test_args(SigmaZ()) def test_sympy__physics__quantum__pauli__SigmaMinus(): from sympy.physics.quantum.pauli import SigmaMinus assert _test_args(SigmaMinus()) def test_sympy__physics__quantum__pauli__SigmaPlus(): from sympy.physics.quantum.pauli import SigmaPlus assert _test_args(SigmaPlus()) def test_sympy__physics__quantum__pauli__SigmaZKet(): from sympy.physics.quantum.pauli import SigmaZKet assert _test_args(SigmaZKet(0)) def test_sympy__physics__quantum__pauli__SigmaZBra(): from sympy.physics.quantum.pauli import SigmaZBra assert _test_args(SigmaZBra(0)) def test_sympy__physics__quantum__piab__PIABHamiltonian(): from sympy.physics.quantum.piab import PIABHamiltonian assert _test_args(PIABHamiltonian('P')) def test_sympy__physics__quantum__piab__PIABKet(): from sympy.physics.quantum.piab import PIABKet assert _test_args(PIABKet('K')) def test_sympy__physics__quantum__qexpr__QExpr(): from sympy.physics.quantum.qexpr import QExpr assert _test_args(QExpr(0)) def test_sympy__physics__quantum__qft__Fourier(): from sympy.physics.quantum.qft import Fourier assert _test_args(Fourier(0, 1)) def test_sympy__physics__quantum__qft__IQFT(): from sympy.physics.quantum.qft import IQFT assert _test_args(IQFT(0, 1)) def test_sympy__physics__quantum__qft__QFT(): from sympy.physics.quantum.qft import QFT assert _test_args(QFT(0, 1)) def test_sympy__physics__quantum__qft__RkGate(): from sympy.physics.quantum.qft import RkGate assert _test_args(RkGate(0, 1)) def test_sympy__physics__quantum__qubit__IntQubit(): from sympy.physics.quantum.qubit import IntQubit assert _test_args(IntQubit(0)) def test_sympy__physics__quantum__qubit__IntQubitBra(): from sympy.physics.quantum.qubit import IntQubitBra assert _test_args(IntQubitBra(0)) def test_sympy__physics__quantum__qubit__IntQubitState(): from sympy.physics.quantum.qubit import IntQubitState, QubitState assert _test_args(IntQubitState(QubitState(0, 1))) def test_sympy__physics__quantum__qubit__Qubit(): from sympy.physics.quantum.qubit import Qubit assert _test_args(Qubit(0, 0, 0)) def test_sympy__physics__quantum__qubit__QubitBra(): from sympy.physics.quantum.qubit import QubitBra assert _test_args(QubitBra('1', 0)) def test_sympy__physics__quantum__qubit__QubitState(): from sympy.physics.quantum.qubit import QubitState assert _test_args(QubitState(0, 1)) def test_sympy__physics__quantum__density__Density(): from sympy.physics.quantum.density import Density from sympy.physics.quantum.state import Ket assert _test_args(Density([Ket(0), 0.5], [Ket(1), 0.5])) @SKIP("TODO: sympy.physics.quantum.shor: Cmod Not Implemented") def test_sympy__physics__quantum__shor__CMod(): from sympy.physics.quantum.shor import CMod assert _test_args(CMod()) def test_sympy__physics__quantum__spin__CoupledSpinState(): from sympy.physics.quantum.spin import CoupledSpinState assert _test_args(CoupledSpinState(1, 0, (1, 1))) assert _test_args(CoupledSpinState(1, 0, (1, S.Half, S.Half))) assert _test_args(CoupledSpinState( 1, 0, (1, S.Half, S.Half), ((2, 3, S.Half), (1, 2, 1)) )) j, m, j1, j2, j3, j12, x = symbols('j m j1:4 j12 x') assert CoupledSpinState( j, m, (j1, j2, j3)).subs(j2, x) == CoupledSpinState(j, m, (j1, x, j3)) assert CoupledSpinState(j, m, (j1, j2, j3), ((1, 3, j12), (1, 2, j)) ).subs(j12, x) == \ CoupledSpinState(j, m, (j1, j2, j3), ((1, 3, x), (1, 2, j)) ) def test_sympy__physics__quantum__spin__J2Op(): from sympy.physics.quantum.spin import J2Op assert _test_args(J2Op('J')) def test_sympy__physics__quantum__spin__JminusOp(): from sympy.physics.quantum.spin import JminusOp assert _test_args(JminusOp('J')) def test_sympy__physics__quantum__spin__JplusOp(): from sympy.physics.quantum.spin import JplusOp assert _test_args(JplusOp('J')) def test_sympy__physics__quantum__spin__JxBra(): from sympy.physics.quantum.spin import JxBra assert _test_args(JxBra(1, 0)) def test_sympy__physics__quantum__spin__JxBraCoupled(): from sympy.physics.quantum.spin import JxBraCoupled assert _test_args(JxBraCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JxKet(): from sympy.physics.quantum.spin import JxKet assert _test_args(JxKet(1, 0)) def test_sympy__physics__quantum__spin__JxKetCoupled(): from sympy.physics.quantum.spin import JxKetCoupled assert _test_args(JxKetCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JxOp(): from sympy.physics.quantum.spin import JxOp assert _test_args(JxOp('J')) def test_sympy__physics__quantum__spin__JyBra(): from sympy.physics.quantum.spin import JyBra assert _test_args(JyBra(1, 0)) def test_sympy__physics__quantum__spin__JyBraCoupled(): from sympy.physics.quantum.spin import JyBraCoupled assert _test_args(JyBraCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JyKet(): from sympy.physics.quantum.spin import JyKet assert _test_args(JyKet(1, 0)) def test_sympy__physics__quantum__spin__JyKetCoupled(): from sympy.physics.quantum.spin import JyKetCoupled assert _test_args(JyKetCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JyOp(): from sympy.physics.quantum.spin import JyOp assert _test_args(JyOp('J')) def test_sympy__physics__quantum__spin__JzBra(): from sympy.physics.quantum.spin import JzBra assert _test_args(JzBra(1, 0)) def test_sympy__physics__quantum__spin__JzBraCoupled(): from sympy.physics.quantum.spin import JzBraCoupled assert _test_args(JzBraCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JzKet(): from sympy.physics.quantum.spin import JzKet assert _test_args(JzKet(1, 0)) def test_sympy__physics__quantum__spin__JzKetCoupled(): from sympy.physics.quantum.spin import JzKetCoupled assert _test_args(JzKetCoupled(1, 0, (1, 1))) def test_sympy__physics__quantum__spin__JzOp(): from sympy.physics.quantum.spin import JzOp assert _test_args(JzOp('J')) def test_sympy__physics__quantum__spin__Rotation(): from sympy.physics.quantum.spin import Rotation assert _test_args(Rotation(pi, 0, pi/2)) def test_sympy__physics__quantum__spin__SpinState(): from sympy.physics.quantum.spin import SpinState assert _test_args(SpinState(1, 0)) def test_sympy__physics__quantum__spin__WignerD(): from sympy.physics.quantum.spin import WignerD assert _test_args(WignerD(0, 1, 2, 3, 4, 5)) def test_sympy__physics__quantum__state__Bra(): from sympy.physics.quantum.state import Bra assert _test_args(Bra(0)) def test_sympy__physics__quantum__state__BraBase(): from sympy.physics.quantum.state import BraBase assert _test_args(BraBase(0)) def test_sympy__physics__quantum__state__Ket(): from sympy.physics.quantum.state import Ket assert _test_args(Ket(0)) def test_sympy__physics__quantum__state__KetBase(): from sympy.physics.quantum.state import KetBase assert _test_args(KetBase(0)) def test_sympy__physics__quantum__state__State(): from sympy.physics.quantum.state import State assert _test_args(State(0)) def test_sympy__physics__quantum__state__StateBase(): from sympy.physics.quantum.state import StateBase assert _test_args(StateBase(0)) def test_sympy__physics__quantum__state__OrthogonalBra(): from sympy.physics.quantum.state import OrthogonalBra assert _test_args(OrthogonalBra(0)) def test_sympy__physics__quantum__state__OrthogonalKet(): from sympy.physics.quantum.state import OrthogonalKet assert _test_args(OrthogonalKet(0)) def test_sympy__physics__quantum__state__OrthogonalState(): from sympy.physics.quantum.state import OrthogonalState assert _test_args(OrthogonalState(0)) def test_sympy__physics__quantum__state__TimeDepBra(): from sympy.physics.quantum.state import TimeDepBra assert _test_args(TimeDepBra('psi', 't')) def test_sympy__physics__quantum__state__TimeDepKet(): from sympy.physics.quantum.state import TimeDepKet assert _test_args(TimeDepKet('psi', 't')) def test_sympy__physics__quantum__state__TimeDepState(): from sympy.physics.quantum.state import TimeDepState assert _test_args(TimeDepState('psi', 't')) def test_sympy__physics__quantum__state__Wavefunction(): from sympy.physics.quantum.state import Wavefunction from sympy.functions import sin from sympy import Piecewise n = 1 L = 1 g = Piecewise((0, x < 0), (0, x > L), (sqrt(2//L)*sin(n*pi*x/L), True)) assert _test_args(Wavefunction(g, x)) def test_sympy__physics__quantum__tensorproduct__TensorProduct(): from sympy.physics.quantum.tensorproduct import TensorProduct assert _test_args(TensorProduct(x, y)) def test_sympy__physics__quantum__identitysearch__GateIdentity(): from sympy.physics.quantum.gate import X from sympy.physics.quantum.identitysearch import GateIdentity assert _test_args(GateIdentity(X(0), X(0))) def test_sympy__physics__quantum__sho1d__SHOOp(): from sympy.physics.quantum.sho1d import SHOOp assert _test_args(SHOOp('a')) def test_sympy__physics__quantum__sho1d__RaisingOp(): from sympy.physics.quantum.sho1d import RaisingOp assert _test_args(RaisingOp('a')) def test_sympy__physics__quantum__sho1d__LoweringOp(): from sympy.physics.quantum.sho1d import LoweringOp assert _test_args(LoweringOp('a')) def test_sympy__physics__quantum__sho1d__NumberOp(): from sympy.physics.quantum.sho1d import NumberOp assert _test_args(NumberOp('N')) def test_sympy__physics__quantum__sho1d__Hamiltonian(): from sympy.physics.quantum.sho1d import Hamiltonian assert _test_args(Hamiltonian('H')) def test_sympy__physics__quantum__sho1d__SHOState(): from sympy.physics.quantum.sho1d import SHOState assert _test_args(SHOState(0)) def test_sympy__physics__quantum__sho1d__SHOKet(): from sympy.physics.quantum.sho1d import SHOKet assert _test_args(SHOKet(0)) def test_sympy__physics__quantum__sho1d__SHOBra(): from sympy.physics.quantum.sho1d import SHOBra assert _test_args(SHOBra(0)) def test_sympy__physics__secondquant__AnnihilateBoson(): from sympy.physics.secondquant import AnnihilateBoson assert _test_args(AnnihilateBoson(0)) def test_sympy__physics__secondquant__AnnihilateFermion(): from sympy.physics.secondquant import AnnihilateFermion assert _test_args(AnnihilateFermion(0)) @SKIP("abstract class") def test_sympy__physics__secondquant__Annihilator(): pass def test_sympy__physics__secondquant__AntiSymmetricTensor(): from sympy.physics.secondquant import AntiSymmetricTensor i, j = symbols('i j', below_fermi=True) a, b = symbols('a b', above_fermi=True) assert _test_args(AntiSymmetricTensor('v', (a, i), (b, j))) def test_sympy__physics__secondquant__BosonState(): from sympy.physics.secondquant import BosonState assert _test_args(BosonState((0, 1))) @SKIP("abstract class") def test_sympy__physics__secondquant__BosonicOperator(): pass def test_sympy__physics__secondquant__Commutator(): from sympy.physics.secondquant import Commutator assert _test_args(Commutator(x, y)) def test_sympy__physics__secondquant__CreateBoson(): from sympy.physics.secondquant import CreateBoson assert _test_args(CreateBoson(0)) def test_sympy__physics__secondquant__CreateFermion(): from sympy.physics.secondquant import CreateFermion assert _test_args(CreateFermion(0)) @SKIP("abstract class") def test_sympy__physics__secondquant__Creator(): pass def test_sympy__physics__secondquant__Dagger(): from sympy.physics.secondquant import Dagger from sympy import I assert _test_args(Dagger(2*I)) def test_sympy__physics__secondquant__FermionState(): from sympy.physics.secondquant import FermionState assert _test_args(FermionState((0, 1))) def test_sympy__physics__secondquant__FermionicOperator(): from sympy.physics.secondquant import FermionicOperator assert _test_args(FermionicOperator(0)) def test_sympy__physics__secondquant__FockState(): from sympy.physics.secondquant import FockState assert _test_args(FockState((0, 1))) def test_sympy__physics__secondquant__FockStateBosonBra(): from sympy.physics.secondquant import FockStateBosonBra assert _test_args(FockStateBosonBra((0, 1))) def test_sympy__physics__secondquant__FockStateBosonKet(): from sympy.physics.secondquant import FockStateBosonKet assert _test_args(FockStateBosonKet((0, 1))) def test_sympy__physics__secondquant__FockStateBra(): from sympy.physics.secondquant import FockStateBra assert _test_args(FockStateBra((0, 1))) def test_sympy__physics__secondquant__FockStateFermionBra(): from sympy.physics.secondquant import FockStateFermionBra assert _test_args(FockStateFermionBra((0, 1))) def test_sympy__physics__secondquant__FockStateFermionKet(): from sympy.physics.secondquant import FockStateFermionKet assert _test_args(FockStateFermionKet((0, 1))) def test_sympy__physics__secondquant__FockStateKet(): from sympy.physics.secondquant import FockStateKet assert _test_args(FockStateKet((0, 1))) def test_sympy__physics__secondquant__InnerProduct(): from sympy.physics.secondquant import InnerProduct from sympy.physics.secondquant import FockStateKet, FockStateBra assert _test_args(InnerProduct(FockStateBra((0, 1)), FockStateKet((0, 1)))) def test_sympy__physics__secondquant__NO(): from sympy.physics.secondquant import NO, F, Fd assert _test_args(NO(Fd(x)*F(y))) def test_sympy__physics__secondquant__PermutationOperator(): from sympy.physics.secondquant import PermutationOperator assert _test_args(PermutationOperator(0, 1)) def test_sympy__physics__secondquant__SqOperator(): from sympy.physics.secondquant import SqOperator assert _test_args(SqOperator(0)) def test_sympy__physics__secondquant__TensorSymbol(): from sympy.physics.secondquant import TensorSymbol assert _test_args(TensorSymbol(x)) def test_sympy__physics__units__dimensions__Dimension(): from sympy.physics.units.dimensions import Dimension assert _test_args(Dimension("length", "L")) def test_sympy__physics__units__dimensions__DimensionSystem(): from sympy.physics.units.dimensions import DimensionSystem from sympy.physics.units.definitions.dimension_definitions import length, time, velocity assert _test_args(DimensionSystem((length, time), (velocity,))) def test_sympy__physics__units__quantities__Quantity(): from sympy.physics.units.quantities import Quantity assert _test_args(Quantity("dam")) def test_sympy__physics__units__prefixes__Prefix(): from sympy.physics.units.prefixes import Prefix assert _test_args(Prefix('kilo', 'k', 3)) def test_sympy__core__numbers__AlgebraicNumber(): from sympy.core.numbers import AlgebraicNumber assert _test_args(AlgebraicNumber(sqrt(2), [1, 2, 3])) def test_sympy__polys__polytools__GroebnerBasis(): from sympy.polys.polytools import GroebnerBasis assert _test_args(GroebnerBasis([x, y, z], x, y, z)) def test_sympy__polys__polytools__Poly(): from sympy.polys.polytools import Poly assert _test_args(Poly(2, x, y)) def test_sympy__polys__polytools__PurePoly(): from sympy.polys.polytools import PurePoly assert _test_args(PurePoly(2, x, y)) @SKIP('abstract class') def test_sympy__polys__rootoftools__RootOf(): pass def test_sympy__polys__rootoftools__ComplexRootOf(): from sympy.polys.rootoftools import ComplexRootOf assert _test_args(ComplexRootOf(x**3 + x + 1, 0)) def test_sympy__polys__rootoftools__RootSum(): from sympy.polys.rootoftools import RootSum assert _test_args(RootSum(x**3 + x + 1, sin)) def test_sympy__series__limits__Limit(): from sympy.series.limits import Limit assert _test_args(Limit(x, x, 0, dir='-')) def test_sympy__series__order__Order(): from sympy.series.order import Order assert _test_args(Order(1, x, y)) @SKIP('Abstract Class') def test_sympy__series__sequences__SeqBase(): pass def test_sympy__series__sequences__EmptySequence(): # Need to imort the instance from series not the class from # series.sequence from sympy.series import EmptySequence assert _test_args(EmptySequence) @SKIP('Abstract Class') def test_sympy__series__sequences__SeqExpr(): pass def test_sympy__series__sequences__SeqPer(): from sympy.series.sequences import SeqPer assert _test_args(SeqPer((1, 2, 3), (0, 10))) def test_sympy__series__sequences__SeqFormula(): from sympy.series.sequences import SeqFormula assert _test_args(SeqFormula(x**2, (0, 10))) def test_sympy__series__sequences__RecursiveSeq(): from sympy.series.sequences import RecursiveSeq y = Function("y") n = symbols("n") assert _test_args(RecursiveSeq(y(n - 1) + y(n - 2), y(n), n, (0, 1))) assert _test_args(RecursiveSeq(y(n - 1) + y(n - 2), y(n), n)) def test_sympy__series__sequences__SeqExprOp(): from sympy.series.sequences import SeqExprOp, sequence s1 = sequence((1, 2, 3)) s2 = sequence(x**2) assert _test_args(SeqExprOp(s1, s2)) def test_sympy__series__sequences__SeqAdd(): from sympy.series.sequences import SeqAdd, sequence s1 = sequence((1, 2, 3)) s2 = sequence(x**2) assert _test_args(SeqAdd(s1, s2)) def test_sympy__series__sequences__SeqMul(): from sympy.series.sequences import SeqMul, sequence s1 = sequence((1, 2, 3)) s2 = sequence(x**2) assert _test_args(SeqMul(s1, s2)) @SKIP('Abstract Class') def test_sympy__series__series_class__SeriesBase(): pass def test_sympy__series__fourier__FourierSeries(): from sympy.series.fourier import fourier_series assert _test_args(fourier_series(x, (x, -pi, pi))) def test_sympy__series__fourier__FiniteFourierSeries(): from sympy.series.fourier import fourier_series assert _test_args(fourier_series(sin(pi*x), (x, -1, 1))) def test_sympy__series__formal__FormalPowerSeries(): from sympy.series.formal import fps assert _test_args(fps(log(1 + x), x)) def test_sympy__series__formal__Coeff(): from sympy.series.formal import fps assert _test_args(fps(x**2 + x + 1, x)) @SKIP('Abstract Class') def test_sympy__series__formal__FiniteFormalPowerSeries(): pass def test_sympy__series__formal__FormalPowerSeriesProduct(): from sympy.series.formal import fps f1, f2 = fps(sin(x)), fps(exp(x)) assert _test_args(f1.product(f2, x)) def test_sympy__series__formal__FormalPowerSeriesCompose(): from sympy.series.formal import fps f1, f2 = fps(exp(x)), fps(sin(x)) assert _test_args(f1.compose(f2, x)) def test_sympy__series__formal__FormalPowerSeriesInverse(): from sympy.series.formal import fps f1 = fps(exp(x)) assert _test_args(f1.inverse(x)) def test_sympy__simplify__hyperexpand__Hyper_Function(): from sympy.simplify.hyperexpand import Hyper_Function assert _test_args(Hyper_Function([2], [1])) def test_sympy__simplify__hyperexpand__G_Function(): from sympy.simplify.hyperexpand import G_Function assert _test_args(G_Function([2], [1], [], [])) @SKIP("abstract class") def test_sympy__tensor__array__ndim_array__ImmutableNDimArray(): pass def test_sympy__tensor__array__dense_ndim_array__ImmutableDenseNDimArray(): from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray densarr = ImmutableDenseNDimArray(range(10, 34), (2, 3, 4)) assert _test_args(densarr) def test_sympy__tensor__array__sparse_ndim_array__ImmutableSparseNDimArray(): from sympy.tensor.array.sparse_ndim_array import ImmutableSparseNDimArray sparr = ImmutableSparseNDimArray(range(10, 34), (2, 3, 4)) assert _test_args(sparr) def test_sympy__tensor__array__array_comprehension__ArrayComprehension(): from sympy.tensor.array.array_comprehension import ArrayComprehension arrcom = ArrayComprehension(x, (x, 1, 5)) assert _test_args(arrcom) def test_sympy__tensor__array__array_comprehension__ArrayComprehensionMap(): from sympy.tensor.array.array_comprehension import ArrayComprehensionMap arrcomma = ArrayComprehensionMap(lambda: 0, (x, 1, 5)) assert _test_args(arrcomma) def test_sympy__tensor__array__arrayop__Flatten(): from sympy.tensor.array.arrayop import Flatten from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray fla = Flatten(ImmutableDenseNDimArray(range(24)).reshape(2, 3, 4)) assert _test_args(fla) def test_sympy__tensor__functions__TensorProduct(): from sympy.tensor.functions import TensorProduct A = MatrixSymbol('A', 3, 3) B = MatrixSymbol('B', 3, 3) tp = TensorProduct(A, B) assert _test_args(tp) def test_sympy__tensor__indexed__Idx(): from sympy.tensor.indexed import Idx assert _test_args(Idx('test')) assert _test_args(Idx(1, (0, 10))) def test_sympy__tensor__indexed__Indexed(): from sympy.tensor.indexed import Indexed, Idx assert _test_args(Indexed('A', Idx('i'), Idx('j'))) def test_sympy__tensor__indexed__IndexedBase(): from sympy.tensor.indexed import IndexedBase assert _test_args(IndexedBase('A', shape=(x, y))) assert _test_args(IndexedBase('A', 1)) assert _test_args(IndexedBase('A')[0, 1]) def test_sympy__tensor__tensor__TensorIndexType(): from sympy.tensor.tensor import TensorIndexType assert _test_args(TensorIndexType('Lorentz')) @SKIP("deprecated class") def test_sympy__tensor__tensor__TensorType(): pass def test_sympy__tensor__tensor__TensorSymmetry(): from sympy.tensor.tensor import TensorSymmetry, get_symmetric_group_sgs assert _test_args(TensorSymmetry(get_symmetric_group_sgs(2))) def test_sympy__tensor__tensor__TensorHead(): from sympy.tensor.tensor import TensorIndexType, TensorSymmetry, get_symmetric_group_sgs, TensorHead Lorentz = TensorIndexType('Lorentz', dummy_name='L') sym = TensorSymmetry(get_symmetric_group_sgs(1)) assert _test_args(TensorHead('p', [Lorentz], sym, 0)) def test_sympy__tensor__tensor__TensorIndex(): from sympy.tensor.tensor import TensorIndexType, TensorIndex Lorentz = TensorIndexType('Lorentz', dummy_name='L') assert _test_args(TensorIndex('i', Lorentz)) @SKIP("abstract class") def test_sympy__tensor__tensor__TensExpr(): pass def test_sympy__tensor__tensor__TensAdd(): from sympy.tensor.tensor import TensorIndexType, TensorSymmetry, get_symmetric_group_sgs, tensor_indices, TensAdd, tensor_heads Lorentz = TensorIndexType('Lorentz', dummy_name='L') a, b = tensor_indices('a,b', Lorentz) sym = TensorSymmetry(get_symmetric_group_sgs(1)) p, q = tensor_heads('p,q', [Lorentz], sym) t1 = p(a) t2 = q(a) assert _test_args(TensAdd(t1, t2)) def test_sympy__tensor__tensor__Tensor(): from sympy.tensor.tensor import TensorIndexType, TensorSymmetry, get_symmetric_group_sgs, tensor_indices, TensorHead Lorentz = TensorIndexType('Lorentz', dummy_name='L') a, b = tensor_indices('a,b', Lorentz) sym = TensorSymmetry(get_symmetric_group_sgs(1)) p = TensorHead('p', [Lorentz], sym) assert _test_args(p(a)) def test_sympy__tensor__tensor__TensMul(): from sympy.tensor.tensor import TensorIndexType, TensorSymmetry, get_symmetric_group_sgs, tensor_indices, tensor_heads Lorentz = TensorIndexType('Lorentz', dummy_name='L') a, b = tensor_indices('a,b', Lorentz) sym = TensorSymmetry(get_symmetric_group_sgs(1)) p, q = tensor_heads('p, q', [Lorentz], sym) assert _test_args(3*p(a)*q(b)) def test_sympy__tensor__tensor__TensorElement(): from sympy.tensor.tensor import TensorIndexType, TensorHead, TensorElement L = TensorIndexType("L") A = TensorHead("A", [L, L]) telem = TensorElement(A(x, y), {x: 1}) assert _test_args(telem) def test_sympy__tensor__toperators__PartialDerivative(): from sympy.tensor.tensor import TensorIndexType, tensor_indices, TensorHead from sympy.tensor.toperators import PartialDerivative Lorentz = TensorIndexType('Lorentz', dummy_name='L') a, b = tensor_indices('a,b', Lorentz) A = TensorHead("A", [Lorentz]) assert _test_args(PartialDerivative(A(a), A(b))) def test_as_coeff_add(): assert (7, (3*x, 4*x**2)) == (7 + 3*x + 4*x**2).as_coeff_add() def test_sympy__geometry__curve__Curve(): from sympy.geometry.curve import Curve assert _test_args(Curve((x, 1), (x, 0, 1))) def test_sympy__geometry__point__Point(): from sympy.geometry.point import Point assert _test_args(Point(0, 1)) def test_sympy__geometry__point__Point2D(): from sympy.geometry.point import Point2D assert _test_args(Point2D(0, 1)) def test_sympy__geometry__point__Point3D(): from sympy.geometry.point import Point3D assert _test_args(Point3D(0, 1, 2)) def test_sympy__geometry__ellipse__Ellipse(): from sympy.geometry.ellipse import Ellipse assert _test_args(Ellipse((0, 1), 2, 3)) def test_sympy__geometry__ellipse__Circle(): from sympy.geometry.ellipse import Circle assert _test_args(Circle((0, 1), 2)) def test_sympy__geometry__parabola__Parabola(): from sympy.geometry.parabola import Parabola from sympy.geometry.line import Line assert _test_args(Parabola((0, 0), Line((2, 3), (4, 3)))) @SKIP("abstract class") def test_sympy__geometry__line__LinearEntity(): pass def test_sympy__geometry__line__Line(): from sympy.geometry.line import Line assert _test_args(Line((0, 1), (2, 3))) def test_sympy__geometry__line__Ray(): from sympy.geometry.line import Ray assert _test_args(Ray((0, 1), (2, 3))) def test_sympy__geometry__line__Segment(): from sympy.geometry.line import Segment assert _test_args(Segment((0, 1), (2, 3))) @SKIP("abstract class") def test_sympy__geometry__line__LinearEntity2D(): pass def test_sympy__geometry__line__Line2D(): from sympy.geometry.line import Line2D assert _test_args(Line2D((0, 1), (2, 3))) def test_sympy__geometry__line__Ray2D(): from sympy.geometry.line import Ray2D assert _test_args(Ray2D((0, 1), (2, 3))) def test_sympy__geometry__line__Segment2D(): from sympy.geometry.line import Segment2D assert _test_args(Segment2D((0, 1), (2, 3))) @SKIP("abstract class") def test_sympy__geometry__line__LinearEntity3D(): pass def test_sympy__geometry__line__Line3D(): from sympy.geometry.line import Line3D assert _test_args(Line3D((0, 1, 1), (2, 3, 4))) def test_sympy__geometry__line__Segment3D(): from sympy.geometry.line import Segment3D assert _test_args(Segment3D((0, 1, 1), (2, 3, 4))) def test_sympy__geometry__line__Ray3D(): from sympy.geometry.line import Ray3D assert _test_args(Ray3D((0, 1, 1), (2, 3, 4))) def test_sympy__geometry__plane__Plane(): from sympy.geometry.plane import Plane assert _test_args(Plane((1, 1, 1), (-3, 4, -2), (1, 2, 3))) def test_sympy__geometry__polygon__Polygon(): from sympy.geometry.polygon import Polygon assert _test_args(Polygon((0, 1), (2, 3), (4, 5), (6, 7))) def test_sympy__geometry__polygon__RegularPolygon(): from sympy.geometry.polygon import RegularPolygon assert _test_args(RegularPolygon((0, 1), 2, 3, 4)) def test_sympy__geometry__polygon__Triangle(): from sympy.geometry.polygon import Triangle assert _test_args(Triangle((0, 1), (2, 3), (4, 5))) def test_sympy__geometry__entity__GeometryEntity(): from sympy.geometry.entity import GeometryEntity from sympy.geometry.point import Point assert _test_args(GeometryEntity(Point(1, 0), 1, [1, 2])) @SKIP("abstract class") def test_sympy__geometry__entity__GeometrySet(): pass def test_sympy__diffgeom__diffgeom__Manifold(): from sympy.diffgeom import Manifold assert _test_args(Manifold('name', 3)) def test_sympy__diffgeom__diffgeom__Patch(): from sympy.diffgeom import Manifold, Patch assert _test_args(Patch('name', Manifold('name', 3))) def test_sympy__diffgeom__diffgeom__CoordSystem(): from sympy.diffgeom import Manifold, Patch, CoordSystem assert _test_args(CoordSystem('name', Patch('name', Manifold('name', 3)))) @XFAIL def test_sympy__diffgeom__diffgeom__Point(): from sympy.diffgeom import Manifold, Patch, CoordSystem, Point assert _test_args(Point( CoordSystem('name', Patch('name', Manifold('name', 3))), [x, y])) def test_sympy__diffgeom__diffgeom__BaseScalarField(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseScalarField cs = CoordSystem('name', Patch('name', Manifold('name', 3))) assert _test_args(BaseScalarField(cs, 0)) def test_sympy__diffgeom__diffgeom__BaseVectorField(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseVectorField cs = CoordSystem('name', Patch('name', Manifold('name', 3))) assert _test_args(BaseVectorField(cs, 0)) def test_sympy__diffgeom__diffgeom__Differential(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseScalarField, Differential cs = CoordSystem('name', Patch('name', Manifold('name', 3))) assert _test_args(Differential(BaseScalarField(cs, 0))) def test_sympy__diffgeom__diffgeom__Commutator(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseVectorField, Commutator cs = CoordSystem('name', Patch('name', Manifold('name', 3))) cs1 = CoordSystem('name1', Patch('name', Manifold('name', 3))) v = BaseVectorField(cs, 0) v1 = BaseVectorField(cs1, 0) assert _test_args(Commutator(v, v1)) def test_sympy__diffgeom__diffgeom__TensorProduct(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseScalarField, Differential, TensorProduct cs = CoordSystem('name', Patch('name', Manifold('name', 3))) d = Differential(BaseScalarField(cs, 0)) assert _test_args(TensorProduct(d, d)) def test_sympy__diffgeom__diffgeom__WedgeProduct(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseScalarField, Differential, WedgeProduct cs = CoordSystem('name', Patch('name', Manifold('name', 3))) d = Differential(BaseScalarField(cs, 0)) d1 = Differential(BaseScalarField(cs, 1)) assert _test_args(WedgeProduct(d, d1)) def test_sympy__diffgeom__diffgeom__LieDerivative(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseScalarField, Differential, BaseVectorField, LieDerivative cs = CoordSystem('name', Patch('name', Manifold('name', 3))) d = Differential(BaseScalarField(cs, 0)) v = BaseVectorField(cs, 0) assert _test_args(LieDerivative(v, d)) @XFAIL def test_sympy__diffgeom__diffgeom__BaseCovarDerivativeOp(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseCovarDerivativeOp cs = CoordSystem('name', Patch('name', Manifold('name', 3))) assert _test_args(BaseCovarDerivativeOp(cs, 0, [[[0, ]*3, ]*3, ]*3)) def test_sympy__diffgeom__diffgeom__CovarDerivativeOp(): from sympy.diffgeom import Manifold, Patch, CoordSystem, BaseVectorField, CovarDerivativeOp cs = CoordSystem('name', Patch('name', Manifold('name', 3))) v = BaseVectorField(cs, 0) _test_args(CovarDerivativeOp(v, [[[0, ]*3, ]*3, ]*3)) def test_sympy__categories__baseclasses__Class(): from sympy.categories.baseclasses import Class assert _test_args(Class()) def test_sympy__categories__baseclasses__Object(): from sympy.categories import Object assert _test_args(Object("A")) @XFAIL def test_sympy__categories__baseclasses__Morphism(): from sympy.categories import Object, Morphism assert _test_args(Morphism(Object("A"), Object("B"))) def test_sympy__categories__baseclasses__IdentityMorphism(): from sympy.categories import Object, IdentityMorphism assert _test_args(IdentityMorphism(Object("A"))) def test_sympy__categories__baseclasses__NamedMorphism(): from sympy.categories import Object, NamedMorphism assert _test_args(NamedMorphism(Object("A"), Object("B"), "f")) def test_sympy__categories__baseclasses__CompositeMorphism(): from sympy.categories import Object, NamedMorphism, CompositeMorphism A = Object("A") B = Object("B") C = Object("C") f = NamedMorphism(A, B, "f") g = NamedMorphism(B, C, "g") assert _test_args(CompositeMorphism(f, g)) def test_sympy__categories__baseclasses__Diagram(): from sympy.categories import Object, NamedMorphism, Diagram A = Object("A") B = Object("B") f = NamedMorphism(A, B, "f") d = Diagram([f]) assert _test_args(d) def test_sympy__categories__baseclasses__Category(): from sympy.categories import Object, NamedMorphism, Diagram, Category A = Object("A") B = Object("B") C = Object("C") f = NamedMorphism(A, B, "f") g = NamedMorphism(B, C, "g") d1 = Diagram([f, g]) d2 = Diagram([f]) K = Category("K", commutative_diagrams=[d1, d2]) assert _test_args(K) def test_sympy__ntheory__factor___totient(): from sympy.ntheory.factor_ import totient k = symbols('k', integer=True) t = totient(k) assert _test_args(t) def test_sympy__ntheory__factor___reduced_totient(): from sympy.ntheory.factor_ import reduced_totient k = symbols('k', integer=True) t = reduced_totient(k) assert _test_args(t) def test_sympy__ntheory__factor___divisor_sigma(): from sympy.ntheory.factor_ import divisor_sigma k = symbols('k', integer=True) n = symbols('n', integer=True) t = divisor_sigma(n, k) assert _test_args(t) def test_sympy__ntheory__factor___udivisor_sigma(): from sympy.ntheory.factor_ import udivisor_sigma k = symbols('k', integer=True) n = symbols('n', integer=True) t = udivisor_sigma(n, k) assert _test_args(t) def test_sympy__ntheory__factor___primenu(): from sympy.ntheory.factor_ import primenu n = symbols('n', integer=True) t = primenu(n) assert _test_args(t) def test_sympy__ntheory__factor___primeomega(): from sympy.ntheory.factor_ import primeomega n = symbols('n', integer=True) t = primeomega(n) assert _test_args(t) def test_sympy__ntheory__residue_ntheory__mobius(): from sympy.ntheory import mobius assert _test_args(mobius(2)) def test_sympy__ntheory__generate__primepi(): from sympy.ntheory import primepi n = symbols('n') t = primepi(n) assert _test_args(t) def test_sympy__physics__optics__waves__TWave(): from sympy.physics.optics import TWave A, f, phi = symbols('A, f, phi') assert _test_args(TWave(A, f, phi)) def test_sympy__physics__optics__gaussopt__BeamParameter(): from sympy.physics.optics import BeamParameter assert _test_args(BeamParameter(530e-9, 1, w=1e-3)) def test_sympy__physics__optics__medium__Medium(): from sympy.physics.optics import Medium assert _test_args(Medium('m')) def test_sympy__codegen__array_utils__CodegenArrayContraction(): from sympy.codegen.array_utils import CodegenArrayContraction from sympy import IndexedBase A = symbols("A", cls=IndexedBase) assert _test_args(CodegenArrayContraction(A, (0, 1))) def test_sympy__codegen__array_utils__CodegenArrayDiagonal(): from sympy.codegen.array_utils import CodegenArrayDiagonal from sympy import IndexedBase A = symbols("A", cls=IndexedBase) assert _test_args(CodegenArrayDiagonal(A, (0, 1))) def test_sympy__codegen__array_utils__CodegenArrayTensorProduct(): from sympy.codegen.array_utils import CodegenArrayTensorProduct from sympy import IndexedBase A, B = symbols("A B", cls=IndexedBase) assert _test_args(CodegenArrayTensorProduct(A, B)) def test_sympy__codegen__array_utils__CodegenArrayElementwiseAdd(): from sympy.codegen.array_utils import CodegenArrayElementwiseAdd from sympy import IndexedBase A, B = symbols("A B", cls=IndexedBase) assert _test_args(CodegenArrayElementwiseAdd(A, B)) def test_sympy__codegen__array_utils__CodegenArrayPermuteDims(): from sympy.codegen.array_utils import CodegenArrayPermuteDims from sympy import IndexedBase A = symbols("A", cls=IndexedBase) assert _test_args(CodegenArrayPermuteDims(A, (1, 0))) def test_sympy__codegen__ast__Assignment(): from sympy.codegen.ast import Assignment assert _test_args(Assignment(x, y)) def test_sympy__codegen__cfunctions__expm1(): from sympy.codegen.cfunctions import expm1 assert _test_args(expm1(x)) def test_sympy__codegen__cfunctions__log1p(): from sympy.codegen.cfunctions import log1p assert _test_args(log1p(x)) def test_sympy__codegen__cfunctions__exp2(): from sympy.codegen.cfunctions import exp2 assert _test_args(exp2(x)) def test_sympy__codegen__cfunctions__log2(): from sympy.codegen.cfunctions import log2 assert _test_args(log2(x)) def test_sympy__codegen__cfunctions__fma(): from sympy.codegen.cfunctions import fma assert _test_args(fma(x, y, z)) def test_sympy__codegen__cfunctions__log10(): from sympy.codegen.cfunctions import log10 assert _test_args(log10(x)) def test_sympy__codegen__cfunctions__Sqrt(): from sympy.codegen.cfunctions import Sqrt assert _test_args(Sqrt(x)) def test_sympy__codegen__cfunctions__Cbrt(): from sympy.codegen.cfunctions import Cbrt assert _test_args(Cbrt(x)) def test_sympy__codegen__cfunctions__hypot(): from sympy.codegen.cfunctions import hypot assert _test_args(hypot(x, y)) def test_sympy__codegen__fnodes__FFunction(): from sympy.codegen.fnodes import FFunction assert _test_args(FFunction('f')) def test_sympy__codegen__fnodes__F95Function(): from sympy.codegen.fnodes import F95Function assert _test_args(F95Function('f')) def test_sympy__codegen__fnodes__isign(): from sympy.codegen.fnodes import isign assert _test_args(isign(1, x)) def test_sympy__codegen__fnodes__dsign(): from sympy.codegen.fnodes import dsign assert _test_args(dsign(1, x)) def test_sympy__codegen__fnodes__cmplx(): from sympy.codegen.fnodes import cmplx assert _test_args(cmplx(x, y)) def test_sympy__codegen__fnodes__kind(): from sympy.codegen.fnodes import kind assert _test_args(kind(x)) def test_sympy__codegen__fnodes__merge(): from sympy.codegen.fnodes import merge assert _test_args(merge(1, 2, Eq(x, 0))) def test_sympy__codegen__fnodes___literal(): from sympy.codegen.fnodes import _literal assert _test_args(_literal(1)) def test_sympy__codegen__fnodes__literal_sp(): from sympy.codegen.fnodes import literal_sp assert _test_args(literal_sp(1)) def test_sympy__codegen__fnodes__literal_dp(): from sympy.codegen.fnodes import literal_dp assert _test_args(literal_dp(1)) def test_sympy__codegen__matrix_nodes__MatrixSolve(): from sympy.matrices import MatrixSymbol from sympy.codegen.matrix_nodes import MatrixSolve A = MatrixSymbol('A', 3, 3) v = MatrixSymbol('x', 3, 1) assert _test_args(MatrixSolve(A, v)) def test_sympy__vector__coordsysrect__CoordSys3D(): from sympy.vector.coordsysrect import CoordSys3D assert _test_args(CoordSys3D('C')) def test_sympy__vector__point__Point(): from sympy.vector.point import Point assert _test_args(Point('P')) def test_sympy__vector__basisdependent__BasisDependent(): #from sympy.vector.basisdependent import BasisDependent #These classes have been created to maintain an OOP hierarchy #for Vectors and Dyadics. Are NOT meant to be initialized pass def test_sympy__vector__basisdependent__BasisDependentMul(): #from sympy.vector.basisdependent import BasisDependentMul #These classes have been created to maintain an OOP hierarchy #for Vectors and Dyadics. Are NOT meant to be initialized pass def test_sympy__vector__basisdependent__BasisDependentAdd(): #from sympy.vector.basisdependent import BasisDependentAdd #These classes have been created to maintain an OOP hierarchy #for Vectors and Dyadics. Are NOT meant to be initialized pass def test_sympy__vector__basisdependent__BasisDependentZero(): #from sympy.vector.basisdependent import BasisDependentZero #These classes have been created to maintain an OOP hierarchy #for Vectors and Dyadics. Are NOT meant to be initialized pass def test_sympy__vector__vector__BaseVector(): from sympy.vector.vector import BaseVector from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(BaseVector(0, C, ' ', ' ')) def test_sympy__vector__vector__VectorAdd(): from sympy.vector.vector import VectorAdd, VectorMul from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') from sympy.abc import a, b, c, x, y, z v1 = a*C.i + b*C.j + c*C.k v2 = x*C.i + y*C.j + z*C.k assert _test_args(VectorAdd(v1, v2)) assert _test_args(VectorMul(x, v1)) def test_sympy__vector__vector__VectorMul(): from sympy.vector.vector import VectorMul from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') from sympy.abc import a assert _test_args(VectorMul(a, C.i)) def test_sympy__vector__vector__VectorZero(): from sympy.vector.vector import VectorZero assert _test_args(VectorZero()) def test_sympy__vector__vector__Vector(): #from sympy.vector.vector import Vector #Vector is never to be initialized using args pass def test_sympy__vector__vector__Cross(): from sympy.vector.vector import Cross from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') _test_args(Cross(C.i, C.j)) def test_sympy__vector__vector__Dot(): from sympy.vector.vector import Dot from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') _test_args(Dot(C.i, C.j)) def test_sympy__vector__dyadic__Dyadic(): #from sympy.vector.dyadic import Dyadic #Dyadic is never to be initialized using args pass def test_sympy__vector__dyadic__BaseDyadic(): from sympy.vector.dyadic import BaseDyadic from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(BaseDyadic(C.i, C.j)) def test_sympy__vector__dyadic__DyadicMul(): from sympy.vector.dyadic import BaseDyadic, DyadicMul from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(DyadicMul(3, BaseDyadic(C.i, C.j))) def test_sympy__vector__dyadic__DyadicAdd(): from sympy.vector.dyadic import BaseDyadic, DyadicAdd from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(2 * DyadicAdd(BaseDyadic(C.i, C.i), BaseDyadic(C.i, C.j))) def test_sympy__vector__dyadic__DyadicZero(): from sympy.vector.dyadic import DyadicZero assert _test_args(DyadicZero()) def test_sympy__vector__deloperator__Del(): from sympy.vector.deloperator import Del assert _test_args(Del()) def test_sympy__vector__operators__Curl(): from sympy.vector.operators import Curl from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(Curl(C.i)) def test_sympy__vector__operators__Laplacian(): from sympy.vector.operators import Laplacian from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(Laplacian(C.i)) def test_sympy__vector__operators__Divergence(): from sympy.vector.operators import Divergence from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(Divergence(C.i)) def test_sympy__vector__operators__Gradient(): from sympy.vector.operators import Gradient from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(Gradient(C.x)) def test_sympy__vector__orienters__Orienter(): #from sympy.vector.orienters import Orienter #Not to be initialized pass def test_sympy__vector__orienters__ThreeAngleOrienter(): #from sympy.vector.orienters import ThreeAngleOrienter #Not to be initialized pass def test_sympy__vector__orienters__AxisOrienter(): from sympy.vector.orienters import AxisOrienter from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(AxisOrienter(x, C.i)) def test_sympy__vector__orienters__BodyOrienter(): from sympy.vector.orienters import BodyOrienter assert _test_args(BodyOrienter(x, y, z, '123')) def test_sympy__vector__orienters__SpaceOrienter(): from sympy.vector.orienters import SpaceOrienter assert _test_args(SpaceOrienter(x, y, z, '123')) def test_sympy__vector__orienters__QuaternionOrienter(): from sympy.vector.orienters import QuaternionOrienter a, b, c, d = symbols('a b c d') assert _test_args(QuaternionOrienter(a, b, c, d)) def test_sympy__vector__scalar__BaseScalar(): from sympy.vector.scalar import BaseScalar from sympy.vector.coordsysrect import CoordSys3D C = CoordSys3D('C') assert _test_args(BaseScalar(0, C, ' ', ' ')) def test_sympy__physics__wigner__Wigner3j(): from sympy.physics.wigner import Wigner3j assert _test_args(Wigner3j(0, 0, 0, 0, 0, 0)) def test_sympy__integrals__rubi__symbol__matchpyWC(): from sympy.integrals.rubi.symbol import matchpyWC assert _test_args(matchpyWC(1, True, 'a')) def test_sympy__integrals__rubi__utility_function__rubi_unevaluated_expr(): from sympy.integrals.rubi.utility_function import rubi_unevaluated_expr a = symbols('a') assert _test_args(rubi_unevaluated_expr(a)) def test_sympy__integrals__rubi__utility_function__rubi_exp(): from sympy.integrals.rubi.utility_function import rubi_exp assert _test_args(rubi_exp(5)) def test_sympy__integrals__rubi__utility_function__rubi_log(): from sympy.integrals.rubi.utility_function import rubi_log assert _test_args(rubi_log(5)) def test_sympy__integrals__rubi__utility_function__Int(): from sympy.integrals.rubi.utility_function import Int assert _test_args(Int(5, x)) def test_sympy__integrals__rubi__utility_function__Util_Coefficient(): from sympy.integrals.rubi.utility_function import Util_Coefficient a, x = symbols('a x') assert _test_args(Util_Coefficient(a, x)) def test_sympy__integrals__rubi__utility_function__Gamma(): from sympy.integrals.rubi.utility_function import Gamma assert _test_args(Gamma(5)) def test_sympy__integrals__rubi__utility_function__Util_Part(): from sympy.integrals.rubi.utility_function import Util_Part a, b = symbols('a b') assert _test_args(Util_Part(a + b, 0)) def test_sympy__integrals__rubi__utility_function__PolyGamma(): from sympy.integrals.rubi.utility_function import PolyGamma assert _test_args(PolyGamma(1, 1)) def test_sympy__integrals__rubi__utility_function__ProductLog(): from sympy.integrals.rubi.utility_function import ProductLog assert _test_args(ProductLog(1))
a4c5bf92f105658a9c3eab120ee7d305c869d2b554ac174ed53527d4d36a0f8e
from sympy import (Symbol, Wild, GreaterThan, LessThan, StrictGreaterThan, StrictLessThan, pi, I, Rational, sympify, symbols, Dummy) from sympy.core.symbol import _uniquely_named_symbol, _symbol from sympy.testing.pytest import raises from sympy.core.symbol import disambiguate def test_Symbol(): a = Symbol("a") x1 = Symbol("x") x2 = Symbol("x") xdummy1 = Dummy("x") xdummy2 = Dummy("x") assert a != x1 assert a != x2 assert x1 == x2 assert x1 != xdummy1 assert xdummy1 != xdummy2 assert Symbol("x") == Symbol("x") assert Dummy("x") != Dummy("x") d = symbols('d', cls=Dummy) assert isinstance(d, Dummy) c, d = symbols('c,d', cls=Dummy) assert isinstance(c, Dummy) assert isinstance(d, Dummy) raises(TypeError, lambda: Symbol()) def test_Dummy(): assert Dummy() != Dummy() def test_Dummy_force_dummy_index(): raises(AssertionError, lambda: Dummy(dummy_index=1)) assert Dummy('d', dummy_index=2) == Dummy('d', dummy_index=2) assert Dummy('d1', dummy_index=2) != Dummy('d2', dummy_index=2) d1 = Dummy('d', dummy_index=3) d2 = Dummy('d') # might fail if d1 were created with dummy_index >= 10**6 assert d1 != d2 d3 = Dummy('d', dummy_index=3) assert d1 == d3 assert Dummy()._count == Dummy('d', dummy_index=3)._count def test_lt_gt(): from sympy import sympify as S x, y = Symbol('x'), Symbol('y') assert (x >= y) == GreaterThan(x, y) assert (x >= 0) == GreaterThan(x, 0) assert (x <= y) == LessThan(x, y) assert (x <= 0) == LessThan(x, 0) assert (0 <= x) == GreaterThan(x, 0) assert (0 >= x) == LessThan(x, 0) assert (S(0) >= x) == GreaterThan(0, x) assert (S(0) <= x) == LessThan(0, x) assert (x > y) == StrictGreaterThan(x, y) assert (x > 0) == StrictGreaterThan(x, 0) assert (x < y) == StrictLessThan(x, y) assert (x < 0) == StrictLessThan(x, 0) assert (0 < x) == StrictGreaterThan(x, 0) assert (0 > x) == StrictLessThan(x, 0) assert (S(0) > x) == StrictGreaterThan(0, x) assert (S(0) < x) == StrictLessThan(0, x) e = x**2 + 4*x + 1 assert (e >= 0) == GreaterThan(e, 0) assert (0 <= e) == GreaterThan(e, 0) assert (e > 0) == StrictGreaterThan(e, 0) assert (0 < e) == StrictGreaterThan(e, 0) assert (e <= 0) == LessThan(e, 0) assert (0 >= e) == LessThan(e, 0) assert (e < 0) == StrictLessThan(e, 0) assert (0 > e) == StrictLessThan(e, 0) assert (S(0) >= e) == GreaterThan(0, e) assert (S(0) <= e) == LessThan(0, e) assert (S(0) < e) == StrictLessThan(0, e) assert (S(0) > e) == StrictGreaterThan(0, e) def test_no_len(): # there should be no len for numbers x = Symbol('x') raises(TypeError, lambda: len(x)) def test_ineq_unequal(): S = sympify x, y, z = symbols('x,y,z') e = ( S(-1) >= x, S(-1) >= y, S(-1) >= z, S(-1) > x, S(-1) > y, S(-1) > z, S(-1) <= x, S(-1) <= y, S(-1) <= z, S(-1) < x, S(-1) < y, S(-1) < z, S(0) >= x, S(0) >= y, S(0) >= z, S(0) > x, S(0) > y, S(0) > z, S(0) <= x, S(0) <= y, S(0) <= z, S(0) < x, S(0) < y, S(0) < z, S('3/7') >= x, S('3/7') >= y, S('3/7') >= z, S('3/7') > x, S('3/7') > y, S('3/7') > z, S('3/7') <= x, S('3/7') <= y, S('3/7') <= z, S('3/7') < x, S('3/7') < y, S('3/7') < z, S(1.5) >= x, S(1.5) >= y, S(1.5) >= z, S(1.5) > x, S(1.5) > y, S(1.5) > z, S(1.5) <= x, S(1.5) <= y, S(1.5) <= z, S(1.5) < x, S(1.5) < y, S(1.5) < z, S(2) >= x, S(2) >= y, S(2) >= z, S(2) > x, S(2) > y, S(2) > z, S(2) <= x, S(2) <= y, S(2) <= z, S(2) < x, S(2) < y, S(2) < z, x >= -1, y >= -1, z >= -1, x > -1, y > -1, z > -1, x <= -1, y <= -1, z <= -1, x < -1, y < -1, z < -1, x >= 0, y >= 0, z >= 0, x > 0, y > 0, z > 0, x <= 0, y <= 0, z <= 0, x < 0, y < 0, z < 0, x >= 1.5, y >= 1.5, z >= 1.5, x > 1.5, y > 1.5, z > 1.5, x <= 1.5, y <= 1.5, z <= 1.5, x < 1.5, y < 1.5, z < 1.5, x >= 2, y >= 2, z >= 2, x > 2, y > 2, z > 2, x <= 2, y <= 2, z <= 2, x < 2, y < 2, z < 2, x >= y, x >= z, y >= x, y >= z, z >= x, z >= y, x > y, x > z, y > x, y > z, z > x, z > y, x <= y, x <= z, y <= x, y <= z, z <= x, z <= y, x < y, x < z, y < x, y < z, z < x, z < y, x - pi >= y + z, y - pi >= x + z, z - pi >= x + y, x - pi > y + z, y - pi > x + z, z - pi > x + y, x - pi <= y + z, y - pi <= x + z, z - pi <= x + y, x - pi < y + z, y - pi < x + z, z - pi < x + y, True, False ) left_e = e[:-1] for i, e1 in enumerate( left_e ): for e2 in e[i + 1:]: assert e1 != e2 def test_Wild_properties(): # these tests only include Atoms x = Symbol("x") y = Symbol("y") p = Symbol("p", positive=True) k = Symbol("k", integer=True) n = Symbol("n", integer=True, positive=True) given_patterns = [ x, y, p, k, -k, n, -n, sympify(-3), sympify(3), pi, Rational(3, 2), I ] integerp = lambda k: k.is_integer positivep = lambda k: k.is_positive symbolp = lambda k: k.is_Symbol realp = lambda k: k.is_extended_real S = Wild("S", properties=[symbolp]) R = Wild("R", properties=[realp]) Y = Wild("Y", exclude=[x, p, k, n]) P = Wild("P", properties=[positivep]) K = Wild("K", properties=[integerp]) N = Wild("N", properties=[positivep, integerp]) given_wildcards = [ S, R, Y, P, K, N ] goodmatch = { S: (x, y, p, k, n), R: (p, k, -k, n, -n, -3, 3, pi, Rational(3, 2)), Y: (y, -3, 3, pi, Rational(3, 2), I ), P: (p, n, 3, pi, Rational(3, 2)), K: (k, -k, n, -n, -3, 3), N: (n, 3)} for A in given_wildcards: for pat in given_patterns: d = pat.match(A) if pat in goodmatch[A]: assert d[A] in goodmatch[A] else: assert d is None def test_symbols(): x = Symbol('x') y = Symbol('y') z = Symbol('z') assert symbols('x') == x assert symbols('x ') == x assert symbols(' x ') == x assert symbols('x,') == (x,) assert symbols('x, ') == (x,) assert symbols('x ,') == (x,) assert symbols('x , y') == (x, y) assert symbols('x,y,z') == (x, y, z) assert symbols('x y z') == (x, y, z) assert symbols('x,y,z,') == (x, y, z) assert symbols('x y z ') == (x, y, z) xyz = Symbol('xyz') abc = Symbol('abc') assert symbols('xyz') == xyz assert symbols('xyz,') == (xyz,) assert symbols('xyz,abc') == (xyz, abc) assert symbols(('xyz',)) == (xyz,) assert symbols(('xyz,',)) == ((xyz,),) assert symbols(('x,y,z,',)) == ((x, y, z),) assert symbols(('xyz', 'abc')) == (xyz, abc) assert symbols(('xyz,abc',)) == ((xyz, abc),) assert symbols(('xyz,abc', 'x,y,z')) == ((xyz, abc), (x, y, z)) assert symbols(('x', 'y', 'z')) == (x, y, z) assert symbols(['x', 'y', 'z']) == [x, y, z] assert symbols(set(['x', 'y', 'z'])) == set([x, y, z]) raises(ValueError, lambda: symbols('')) raises(ValueError, lambda: symbols(',')) raises(ValueError, lambda: symbols('x,,y,,z')) raises(ValueError, lambda: symbols(('x', '', 'y', '', 'z'))) a, b = symbols('x,y', real=True) assert a.is_real and b.is_real x0 = Symbol('x0') x1 = Symbol('x1') x2 = Symbol('x2') y0 = Symbol('y0') y1 = Symbol('y1') assert symbols('x0:0') == () assert symbols('x0:1') == (x0,) assert symbols('x0:2') == (x0, x1) assert symbols('x0:3') == (x0, x1, x2) assert symbols('x:0') == () assert symbols('x:1') == (x0,) assert symbols('x:2') == (x0, x1) assert symbols('x:3') == (x0, x1, x2) assert symbols('x1:1') == () assert symbols('x1:2') == (x1,) assert symbols('x1:3') == (x1, x2) assert symbols('x1:3,x,y,z') == (x1, x2, x, y, z) assert symbols('x:3,y:2') == (x0, x1, x2, y0, y1) assert symbols(('x:3', 'y:2')) == ((x0, x1, x2), (y0, y1)) a = Symbol('a') b = Symbol('b') c = Symbol('c') d = Symbol('d') assert symbols('x:z') == (x, y, z) assert symbols('a:d,x:z') == (a, b, c, d, x, y, z) assert symbols(('a:d', 'x:z')) == ((a, b, c, d), (x, y, z)) aa = Symbol('aa') ab = Symbol('ab') ac = Symbol('ac') ad = Symbol('ad') assert symbols('aa:d') == (aa, ab, ac, ad) assert symbols('aa:d,x:z') == (aa, ab, ac, ad, x, y, z) assert symbols(('aa:d','x:z')) == ((aa, ab, ac, ad), (x, y, z)) # issue 6675 def sym(s): return str(symbols(s)) assert sym('a0:4') == '(a0, a1, a2, a3)' assert sym('a2:4,b1:3') == '(a2, a3, b1, b2)' assert sym('a1(2:4)') == '(a12, a13)' assert sym(('a0:2.0:2')) == '(a0.0, a0.1, a1.0, a1.1)' assert sym(('aa:cz')) == '(aaz, abz, acz)' assert sym('aa:c0:2') == '(aa0, aa1, ab0, ab1, ac0, ac1)' assert sym('aa:ba:b') == '(aaa, aab, aba, abb)' assert sym('a:3b') == '(a0b, a1b, a2b)' assert sym('a-1:3b') == '(a-1b, a-2b)' assert sym(r'a:2\,:2' + chr(0)) == '(a0,0%s, a0,1%s, a1,0%s, a1,1%s)' % ( (chr(0),)*4) assert sym('x(:a:3)') == '(x(a0), x(a1), x(a2))' assert sym('x(:c):1') == '(xa0, xb0, xc0)' assert sym('x((:a)):3') == '(x(a)0, x(a)1, x(a)2)' assert sym('x(:a:3') == '(x(a0, x(a1, x(a2)' assert sym(':2') == '(0, 1)' assert sym(':b') == '(a, b)' assert sym(':b:2') == '(a0, a1, b0, b1)' assert sym(':2:2') == '(00, 01, 10, 11)' assert sym(':b:b') == '(aa, ab, ba, bb)' raises(ValueError, lambda: symbols(':')) raises(ValueError, lambda: symbols('a:')) raises(ValueError, lambda: symbols('::')) raises(ValueError, lambda: symbols('a::')) raises(ValueError, lambda: symbols(':a:')) raises(ValueError, lambda: symbols('::a')) def test_symbols_become_functions_issue_3539(): from sympy.abc import alpha, phi, beta, t raises(TypeError, lambda: beta(2)) raises(TypeError, lambda: beta(2.5)) raises(TypeError, lambda: phi(2.5)) raises(TypeError, lambda: alpha(2.5)) raises(TypeError, lambda: phi(t)) def test_unicode(): xu = Symbol(u'x') x = Symbol('x') assert x == xu raises(TypeError, lambda: Symbol(1)) def test__uniquely_named_symbol_and__symbol(): F = _uniquely_named_symbol x = Symbol('x') assert F(x) == x assert F('x') == x assert str(F('x', x)) == '_x' assert str(F('x', (x + 1, 1/x))) == '_x' _x = Symbol('x', real=True) assert F(('x', _x)) == _x assert F((x, _x)) == _x assert F('x', real=True).is_real y = Symbol('y') assert F(('x', y), real=True).is_real r = Symbol('x', real=True) assert F(('x', r)).is_real assert F(('x', r), real=False).is_real assert F('x1', Symbol('x1'), compare=lambda i: str(i).rstrip('1')).name == 'x1' assert F('x1', Symbol('x1'), modify=lambda i: i + '_').name == 'x1_' assert _symbol(x, _x) == x def test_disambiguate(): x, y, y_1, _x, x_1, x_2 = symbols('x y y_1 _x x_1 x_2') t1 = Dummy('y'), _x, Dummy('x'), Dummy('x') t2 = Dummy('x'), Dummy('x') t3 = Dummy('x'), Dummy('y') t4 = x, Dummy('x') t5 = Symbol('x', integer=True), x, Symbol('x_1') assert disambiguate(*t1) == (y, x_2, x, x_1) assert disambiguate(*t2) == (x, x_1) assert disambiguate(*t3) == (x, y) assert disambiguate(*t4) == (x_1, x) assert disambiguate(*t5) == (t5[0], x_2, x_1) assert disambiguate(*t5)[0] != x # assumptions are retained t6 = _x, Dummy('x')/y t7 = y*Dummy('y'), y assert disambiguate(*t6) == (x_1, x/y) assert disambiguate(*t7) == (y*y_1, y_1) assert disambiguate(Dummy('x_1'), Dummy('x_1') ) == (x_1, Symbol('x_1_1'))
d0f9d1f9aff351cc8feb0dfbb5a929301eb3dd4737664992ad049f03c643f504
from __future__ import absolute_import import numbers as nums import decimal from sympy import (Rational, Symbol, Float, I, sqrt, cbrt, oo, nan, pi, E, Integer, S, factorial, Catalan, EulerGamma, GoldenRatio, TribonacciConstant, cos, exp, Number, zoo, log, Mul, Pow, Tuple, latex, Gt, Lt, Ge, Le, AlgebraicNumber, simplify, sin, fibonacci, RealField, sympify, srepr, Dummy, Sum) from sympy.core.logic import fuzzy_not from sympy.core.numbers import (igcd, ilcm, igcdex, seterr, igcd2, igcd_lehmer, mpf_norm, comp, mod_inverse) from sympy.core.power import integer_nthroot, isqrt, integer_log from sympy.polys.domains.groundtypes import PythonRational from sympy.utilities.decorator import conserve_mpmath_dps from sympy.utilities.iterables import permutations from sympy.testing.pytest import XFAIL, raises from mpmath import mpf from mpmath.rational import mpq import mpmath from sympy.core import numbers t = Symbol('t', real=False) _ninf = float(-oo) _inf = float(oo) def same_and_same_prec(a, b): # stricter matching for Floats return a == b and a._prec == b._prec def test_seterr(): seterr(divide=True) raises(ValueError, lambda: S.Zero/S.Zero) seterr(divide=False) assert S.Zero / S.Zero is S.NaN def test_mod(): x = S.Half y = Rational(3, 4) z = Rational(5, 18043) assert x % x == 0 assert x % y == S.Half assert x % z == Rational(3, 36086) assert y % x == Rational(1, 4) assert y % y == 0 assert y % z == Rational(9, 72172) assert z % x == Rational(5, 18043) assert z % y == Rational(5, 18043) assert z % z == 0 a = Float(2.6) assert (a % .2) == 0.0 assert (a % 2).round(15) == 0.6 assert (a % 0.5).round(15) == 0.1 p = Symbol('p', infinite=True) assert oo % oo is nan assert zoo % oo is nan assert 5 % oo is nan assert p % 5 is nan # In these two tests, if the precision of m does # not match the precision of the ans, then it is # likely that the change made now gives an answer # with degraded accuracy. r = Rational(500, 41) f = Float('.36', 3) m = r % f ans = Float(r % Rational(f), 3) assert m == ans and m._prec == ans._prec f = Float('8.36', 3) m = f % r ans = Float(Rational(f) % r, 3) assert m == ans and m._prec == ans._prec s = S.Zero assert s % float(1) == 0.0 # No rounding required since these numbers can be represented # exactly. assert Rational(3, 4) % Float(1.1) == 0.75 assert Float(1.5) % Rational(5, 4) == 0.25 assert Rational(5, 4).__rmod__(Float('1.5')) == 0.25 assert Float('1.5').__rmod__(Float('2.75')) == Float('1.25') assert 2.75 % Float('1.5') == Float('1.25') a = Integer(7) b = Integer(4) assert type(a % b) == Integer assert a % b == Integer(3) assert Integer(1) % Rational(2, 3) == Rational(1, 3) assert Rational(7, 5) % Integer(1) == Rational(2, 5) assert Integer(2) % 1.5 == 0.5 assert Integer(3).__rmod__(Integer(10)) == Integer(1) assert Integer(10) % 4 == Integer(2) assert 15 % Integer(4) == Integer(3) def test_divmod(): assert divmod(S(12), S(8)) == Tuple(1, 4) assert divmod(-S(12), S(8)) == Tuple(-2, 4) assert divmod(S.Zero, S.One) == Tuple(0, 0) raises(ZeroDivisionError, lambda: divmod(S.Zero, S.Zero)) raises(ZeroDivisionError, lambda: divmod(S.One, S.Zero)) assert divmod(S(12), 8) == Tuple(1, 4) assert divmod(12, S(8)) == Tuple(1, 4) assert divmod(S("2"), S("3/2")) == Tuple(S("1"), S("1/2")) assert divmod(S("3/2"), S("2")) == Tuple(S("0"), S("3/2")) assert divmod(S("2"), S("3.5")) == Tuple(S("0"), S("2")) assert divmod(S("3.5"), S("2")) == Tuple(S("1"), S("1.5")) assert divmod(S("2"), S("1/3")) == Tuple(S("6"), S("0")) assert divmod(S("1/3"), S("2")) == Tuple(S("0"), S("1/3")) assert divmod(S("2"), S("1/10")) == Tuple(S("20"), S("0")) assert divmod(S("2"), S(".1"))[0] == 19 assert divmod(S("0.1"), S("2")) == Tuple(S("0"), S("0.1")) assert divmod(S("2"), 2) == Tuple(S("1"), S("0")) assert divmod(2, S("2")) == Tuple(S("1"), S("0")) assert divmod(S("2"), 1.5) == Tuple(S("1"), S("0.5")) assert divmod(1.5, S("2")) == Tuple(S("0"), S("1.5")) assert divmod(0.3, S("2")) == Tuple(S("0"), S("0.3")) assert divmod(S("3/2"), S("3.5")) == Tuple(S("0"), S("3/2")) assert divmod(S("3.5"), S("3/2")) == Tuple(S("2"), S("0.5")) assert divmod(S("3/2"), S("1/3")) == Tuple(S("4"), S("1/6")) assert divmod(S("1/3"), S("3/2")) == Tuple(S("0"), S("1/3")) assert divmod(S("3/2"), S("0.1"))[0] == 14 assert divmod(S("0.1"), S("3/2")) == Tuple(S("0"), S("0.1")) assert divmod(S("3/2"), 2) == Tuple(S("0"), S("3/2")) assert divmod(2, S("3/2")) == Tuple(S("1"), S("1/2")) assert divmod(S("3/2"), 1.5) == Tuple(S("1"), S("0")) assert divmod(1.5, S("3/2")) == Tuple(S("1"), S("0")) assert divmod(S("3/2"), 0.3) == Tuple(S("5"), S("0")) assert divmod(0.3, S("3/2")) == Tuple(S("0"), S("0.3")) assert divmod(S("1/3"), S("3.5")) == Tuple(S("0"), S("1/3")) assert divmod(S("3.5"), S("0.1")) == Tuple(S("35"), S("0")) assert divmod(S("0.1"), S("3.5")) == Tuple(S("0"), S("0.1")) assert divmod(S("3.5"), 2) == Tuple(S("1"), S("1.5")) assert divmod(2, S("3.5")) == Tuple(S("0"), S("2")) assert divmod(S("3.5"), 1.5) == Tuple(S("2"), S("0.5")) assert divmod(1.5, S("3.5")) == Tuple(S("0"), S("1.5")) assert divmod(0.3, S("3.5")) == Tuple(S("0"), S("0.3")) assert divmod(S("0.1"), S("1/3")) == Tuple(S("0"), S("0.1")) assert divmod(S("1/3"), 2) == Tuple(S("0"), S("1/3")) assert divmod(2, S("1/3")) == Tuple(S("6"), S("0")) assert divmod(S("1/3"), 1.5) == Tuple(S("0"), S("1/3")) assert divmod(0.3, S("1/3")) == Tuple(S("0"), S("0.3")) assert divmod(S("0.1"), 2) == Tuple(S("0"), S("0.1")) assert divmod(2, S("0.1"))[0] == 19 assert divmod(S("0.1"), 1.5) == Tuple(S("0"), S("0.1")) assert divmod(1.5, S("0.1")) == Tuple(S("15"), S("0")) assert divmod(S("0.1"), 0.3) == Tuple(S("0"), S("0.1")) assert str(divmod(S("2"), 0.3)) == '(6, 0.2)' assert str(divmod(S("3.5"), S("1/3"))) == '(10, 0.166666666666667)' assert str(divmod(S("3.5"), 0.3)) == '(11, 0.2)' assert str(divmod(S("1/3"), S("0.1"))) == '(3, 0.0333333333333333)' assert str(divmod(1.5, S("1/3"))) == '(4, 0.166666666666667)' assert str(divmod(S("1/3"), 0.3)) == '(1, 0.0333333333333333)' assert str(divmod(0.3, S("0.1"))) == '(2, 0.1)' assert divmod(-3, S(2)) == (-2, 1) assert divmod(S(-3), S(2)) == (-2, 1) assert divmod(S(-3), 2) == (-2, 1) assert divmod(S(4), S(-3.1)) == Tuple(-2, -2.2) assert divmod(S(4), S(-2.1)) == divmod(4, -2.1) assert divmod(S(-8), S(-2.5) ) == Tuple(3 , -0.5) assert divmod(oo, 1) == (S.NaN, S.NaN) assert divmod(S.NaN, 1) == (S.NaN, S.NaN) assert divmod(1, S.NaN) == (S.NaN, S.NaN) ans = [(-1, oo), (-1, oo), (0, 0), (0, 1), (0, 2)] OO = float('inf') ANS = [tuple(map(float, i)) for i in ans] assert [divmod(i, oo) for i in range(-2, 3)] == ans ans = [(0, -2), (0, -1), (0, 0), (-1, -oo), (-1, -oo)] ANS = [tuple(map(float, i)) for i in ans] assert [divmod(i, -oo) for i in range(-2, 3)] == ans assert [divmod(i, -OO) for i in range(-2, 3)] == ANS assert divmod(S(3.5), S(-2)) == divmod(3.5, -2) assert divmod(-S(3.5), S(-2)) == divmod(-3.5, -2) def test_igcd(): assert igcd(0, 0) == 0 assert igcd(0, 1) == 1 assert igcd(1, 0) == 1 assert igcd(0, 7) == 7 assert igcd(7, 0) == 7 assert igcd(7, 1) == 1 assert igcd(1, 7) == 1 assert igcd(-1, 0) == 1 assert igcd(0, -1) == 1 assert igcd(-1, -1) == 1 assert igcd(-1, 7) == 1 assert igcd(7, -1) == 1 assert igcd(8, 2) == 2 assert igcd(4, 8) == 4 assert igcd(8, 16) == 8 assert igcd(7, -3) == 1 assert igcd(-7, 3) == 1 assert igcd(-7, -3) == 1 assert igcd(*[10, 20, 30]) == 10 raises(TypeError, lambda: igcd()) raises(TypeError, lambda: igcd(2)) raises(ValueError, lambda: igcd(0, None)) raises(ValueError, lambda: igcd(1, 2.2)) for args in permutations((45.1, 1, 30)): raises(ValueError, lambda: igcd(*args)) for args in permutations((1, 2, None)): raises(ValueError, lambda: igcd(*args)) def test_igcd_lehmer(): a, b = fibonacci(10001), fibonacci(10000) # len(str(a)) == 2090 # small divisors, long Euclidean sequence assert igcd_lehmer(a, b) == 1 c = fibonacci(100) assert igcd_lehmer(a*c, b*c) == c # big divisor assert igcd_lehmer(a, 10**1000) == 1 # swapping argmument assert igcd_lehmer(1, 2) == igcd_lehmer(2, 1) def test_igcd2(): # short loop assert igcd2(2**100 - 1, 2**99 - 1) == 1 # Lehmer's algorithm a, b = int(fibonacci(10001)), int(fibonacci(10000)) assert igcd2(a, b) == 1 def test_ilcm(): assert ilcm(0, 0) == 0 assert ilcm(1, 0) == 0 assert ilcm(0, 1) == 0 assert ilcm(1, 1) == 1 assert ilcm(2, 1) == 2 assert ilcm(8, 2) == 8 assert ilcm(8, 6) == 24 assert ilcm(8, 7) == 56 assert ilcm(*[10, 20, 30]) == 60 raises(ValueError, lambda: ilcm(8.1, 7)) raises(ValueError, lambda: ilcm(8, 7.1)) raises(TypeError, lambda: ilcm(8)) def test_igcdex(): assert igcdex(2, 3) == (-1, 1, 1) assert igcdex(10, 12) == (-1, 1, 2) assert igcdex(100, 2004) == (-20, 1, 4) assert igcdex(0, 0) == (0, 1, 0) assert igcdex(1, 0) == (1, 0, 1) def _strictly_equal(a, b): return (a.p, a.q, type(a.p), type(a.q)) == \ (b.p, b.q, type(b.p), type(b.q)) def _test_rational_new(cls): """ Tests that are common between Integer and Rational. """ assert cls(0) is S.Zero assert cls(1) is S.One assert cls(-1) is S.NegativeOne # These look odd, but are similar to int(): assert cls('1') is S.One assert cls(u'-1') is S.NegativeOne i = Integer(10) assert _strictly_equal(i, cls('10')) assert _strictly_equal(i, cls(u'10')) assert _strictly_equal(i, cls(int(10))) assert _strictly_equal(i, cls(i)) raises(TypeError, lambda: cls(Symbol('x'))) def test_Integer_new(): """ Test for Integer constructor """ _test_rational_new(Integer) assert _strictly_equal(Integer(0.9), S.Zero) assert _strictly_equal(Integer(10.5), Integer(10)) raises(ValueError, lambda: Integer("10.5")) assert Integer(Rational('1.' + '9'*20)) == 1 def test_Rational_new(): """" Test for Rational constructor """ _test_rational_new(Rational) n1 = S.Half assert n1 == Rational(Integer(1), 2) assert n1 == Rational(Integer(1), Integer(2)) assert n1 == Rational(1, Integer(2)) assert n1 == Rational(S.Half) assert 1 == Rational(n1, n1) assert Rational(3, 2) == Rational(S.Half, Rational(1, 3)) assert Rational(3, 1) == Rational(1, Rational(1, 3)) n3_4 = Rational(3, 4) assert Rational('3/4') == n3_4 assert -Rational('-3/4') == n3_4 assert Rational('.76').limit_denominator(4) == n3_4 assert Rational(19, 25).limit_denominator(4) == n3_4 assert Rational('19/25').limit_denominator(4) == n3_4 assert Rational(1.0, 3) == Rational(1, 3) assert Rational(1, 3.0) == Rational(1, 3) assert Rational(Float(0.5)) == S.Half assert Rational('1e2/1e-2') == Rational(10000) assert Rational('1 234') == Rational(1234) assert Rational('1/1 234') == Rational(1, 1234) assert Rational(-1, 0) is S.ComplexInfinity assert Rational(1, 0) is S.ComplexInfinity # Make sure Rational doesn't lose precision on Floats assert Rational(pi.evalf(100)).evalf(100) == pi.evalf(100) raises(TypeError, lambda: Rational('3**3')) raises(TypeError, lambda: Rational('1/2 + 2/3')) # handle fractions.Fraction instances try: import fractions assert Rational(fractions.Fraction(1, 2)) == S.Half except ImportError: pass assert Rational(mpq(2, 6)) == Rational(1, 3) assert Rational(PythonRational(2, 6)) == Rational(1, 3) def test_Number_new(): """" Test for Number constructor """ # Expected behavior on numbers and strings assert Number(1) is S.One assert Number(2).__class__ is Integer assert Number(-622).__class__ is Integer assert Number(5, 3).__class__ is Rational assert Number(5.3).__class__ is Float assert Number('1') is S.One assert Number('2').__class__ is Integer assert Number('-622').__class__ is Integer assert Number('5/3').__class__ is Rational assert Number('5.3').__class__ is Float raises(ValueError, lambda: Number('cos')) raises(TypeError, lambda: Number(cos)) a = Rational(3, 5) assert Number(a) is a # Check idempotence on Numbers u = ['inf', '-inf', 'nan', 'iNF', '+inf'] v = [oo, -oo, nan, oo, oo] for i, a in zip(u, v): assert Number(i) is a, (i, Number(i), a) def test_Number_cmp(): n1 = Number(1) n2 = Number(2) n3 = Number(-3) assert n1 < n2 assert n1 <= n2 assert n3 < n1 assert n2 > n3 assert n2 >= n3 raises(TypeError, lambda: n1 < S.NaN) raises(TypeError, lambda: n1 <= S.NaN) raises(TypeError, lambda: n1 > S.NaN) raises(TypeError, lambda: n1 >= S.NaN) def test_Rational_cmp(): n1 = Rational(1, 4) n2 = Rational(1, 3) n3 = Rational(2, 4) n4 = Rational(2, -4) n5 = Rational(0) n6 = Rational(1) n7 = Rational(3) n8 = Rational(-3) assert n8 < n5 assert n5 < n6 assert n6 < n7 assert n8 < n7 assert n7 > n8 assert (n1 + 1)**n2 < 2 assert ((n1 + n6)/n7) < 1 assert n4 < n3 assert n2 < n3 assert n1 < n2 assert n3 > n1 assert not n3 < n1 assert not (Rational(-1) > 0) assert Rational(-1) < 0 raises(TypeError, lambda: n1 < S.NaN) raises(TypeError, lambda: n1 <= S.NaN) raises(TypeError, lambda: n1 > S.NaN) raises(TypeError, lambda: n1 >= S.NaN) def test_Float(): def eq(a, b): t = Float("1.0E-15") return (-t < a - b < t) zeros = (0, S.Zero, 0., Float(0)) for i, j in permutations(zeros, 2): assert i == j for z in zeros: assert z in zeros assert S.Zero.is_zero a = Float(2) ** Float(3) assert eq(a.evalf(), Float(8)) assert eq((pi ** -1).evalf(), Float("0.31830988618379067")) a = Float(2) ** Float(4) assert eq(a.evalf(), Float(16)) assert (S(.3) == S(.5)) is False mpf = (0, 5404319552844595, -52, 53) x_str = Float((0, '13333333333333', -52, 53)) x2_str = Float((0, '26666666666666', -53, 54)) x_hex = Float((0, int(0x13333333333333), -52, 53)) x_dec = Float(mpf) assert x_str == x_hex == x_dec == Float(1.2) # x2_str was entered slightly malformed in that the mantissa # was even -- it should be odd and the even part should be # included with the exponent, but this is resolved by normalization # ONLY IF REQUIREMENTS of mpf_norm are met: the bitcount must # be exact: double the mantissa ==> increase bc by 1 assert Float(1.2)._mpf_ == mpf assert x2_str._mpf_ == mpf assert Float((0, int(0), -123, -1)) is S.NaN assert Float((0, int(0), -456, -2)) is S.Infinity assert Float((1, int(0), -789, -3)) is S.NegativeInfinity # if you don't give the full signature, it's not special assert Float((0, int(0), -123)) == Float(0) assert Float((0, int(0), -456)) == Float(0) assert Float((1, int(0), -789)) == Float(0) raises(ValueError, lambda: Float((0, 7, 1, 3), '')) assert Float('0.0').is_finite is True assert Float('0.0').is_negative is False assert Float('0.0').is_positive is False assert Float('0.0').is_infinite is False assert Float('0.0').is_zero is True # rationality properties # if the integer test fails then the use of intlike # should be removed from gamma_functions.py assert Float(1).is_integer is False assert Float(1).is_rational is None assert Float(1).is_irrational is None assert sqrt(2).n(15).is_rational is None assert sqrt(2).n(15).is_irrational is None # do not automatically evalf def teq(a): assert (a.evalf() == a) is False assert (a.evalf() != a) is True assert (a == a.evalf()) is False assert (a != a.evalf()) is True teq(pi) teq(2*pi) teq(cos(0.1, evaluate=False)) # long integer i = 12345678901234567890 assert same_and_same_prec(Float(12, ''), Float('12', '')) assert same_and_same_prec(Float(Integer(i), ''), Float(i, '')) assert same_and_same_prec(Float(i, ''), Float(str(i), 20)) assert same_and_same_prec(Float(str(i)), Float(i, '')) assert same_and_same_prec(Float(i), Float(i, '')) # inexact floats (repeating binary = denom not multiple of 2) # cannot have precision greater than 15 assert Float(.125, 22) == .125 assert Float(2.0, 22) == 2 assert float(Float('.12500000000000001', '')) == .125 raises(ValueError, lambda: Float(.12500000000000001, '')) # allow spaces Float('123 456.123 456') == Float('123456.123456') Integer('123 456') == Integer('123456') Rational('123 456.123 456') == Rational('123456.123456') assert Float(' .3e2') == Float('0.3e2') # allow underscore assert Float('1_23.4_56') == Float('123.456') assert Float('1_23.4_5_6', 12) == Float('123.456', 12) # ...but not in all cases (per Py 3.6) raises(ValueError, lambda: Float('_1')) raises(ValueError, lambda: Float('1_')) raises(ValueError, lambda: Float('1_.')) raises(ValueError, lambda: Float('1._')) raises(ValueError, lambda: Float('1__2')) raises(ValueError, lambda: Float('_inf')) # allow auto precision detection assert Float('.1', '') == Float(.1, 1) assert Float('.125', '') == Float(.125, 3) assert Float('.100', '') == Float(.1, 3) assert Float('2.0', '') == Float('2', 2) raises(ValueError, lambda: Float("12.3d-4", "")) raises(ValueError, lambda: Float(12.3, "")) raises(ValueError, lambda: Float('.')) raises(ValueError, lambda: Float('-.')) zero = Float('0.0') assert Float('-0') == zero assert Float('.0') == zero assert Float('-.0') == zero assert Float('-0.0') == zero assert Float(0.0) == zero assert Float(0) == zero assert Float(0, '') == Float('0', '') assert Float(1) == Float(1.0) assert Float(S.Zero) == zero assert Float(S.One) == Float(1.0) assert Float(decimal.Decimal('0.1'), 3) == Float('.1', 3) assert Float(decimal.Decimal('nan')) is S.NaN assert Float(decimal.Decimal('Infinity')) is S.Infinity assert Float(decimal.Decimal('-Infinity')) is S.NegativeInfinity assert '{0:.3f}'.format(Float(4.236622)) == '4.237' assert '{0:.35f}'.format(Float(pi.n(40), 40)) == \ '3.14159265358979323846264338327950288' # unicode assert Float(u'0.73908513321516064100000000') == \ Float('0.73908513321516064100000000') assert Float(u'0.73908513321516064100000000', 28) == \ Float('0.73908513321516064100000000', 28) # binary precision # Decimal value 0.1 cannot be expressed precisely as a base 2 fraction a = Float(S.One/10, dps=15) b = Float(S.One/10, dps=16) p = Float(S.One/10, precision=53) q = Float(S.One/10, precision=54) assert a._mpf_ == p._mpf_ assert not a._mpf_ == q._mpf_ assert not b._mpf_ == q._mpf_ # Precision specifying errors raises(ValueError, lambda: Float("1.23", dps=3, precision=10)) raises(ValueError, lambda: Float("1.23", dps="", precision=10)) raises(ValueError, lambda: Float("1.23", dps=3, precision="")) raises(ValueError, lambda: Float("1.23", dps="", precision="")) # from NumberSymbol assert same_and_same_prec(Float(pi, 32), pi.evalf(32)) assert same_and_same_prec(Float(Catalan), Catalan.evalf()) # oo and nan u = ['inf', '-inf', 'nan', 'iNF', '+inf'] v = [oo, -oo, nan, oo, oo] for i, a in zip(u, v): assert Float(i) is a @conserve_mpmath_dps def test_float_mpf(): import mpmath mpmath.mp.dps = 100 mp_pi = mpmath.pi() assert Float(mp_pi, 100) == Float(mp_pi._mpf_, 100) == pi.evalf(100) mpmath.mp.dps = 15 assert Float(mp_pi, 100) == Float(mp_pi._mpf_, 100) == pi.evalf(100) def test_Float_RealElement(): repi = RealField(dps=100)(pi.evalf(100)) # We still have to pass the precision because Float doesn't know what # RealElement is, but make sure it keeps full precision from the result. assert Float(repi, 100) == pi.evalf(100) def test_Float_default_to_highprec_from_str(): s = str(pi.evalf(128)) assert same_and_same_prec(Float(s), Float(s, '')) def test_Float_eval(): a = Float(3.2) assert (a**2).is_Float def test_Float_issue_2107(): a = Float(0.1, 10) b = Float("0.1", 10) assert a - a == 0 assert a + (-a) == 0 assert S.Zero + a - a == 0 assert S.Zero + a + (-a) == 0 assert b - b == 0 assert b + (-b) == 0 assert S.Zero + b - b == 0 assert S.Zero + b + (-b) == 0 def test_issue_14289(): from sympy.polys.numberfields import to_number_field a = 1 - sqrt(2) b = to_number_field(a) assert b.as_expr() == a assert b.minpoly(a).expand() == 0 def test_Float_from_tuple(): a = Float((0, '1L', 0, 1)) b = Float((0, '1', 0, 1)) assert a == b def test_Infinity(): assert oo != 1 assert 1*oo is oo assert 1 != oo assert oo != -oo assert oo != Symbol("x")**3 assert oo + 1 is oo assert 2 + oo is oo assert 3*oo + 2 is oo assert S.Half**oo == 0 assert S.Half**(-oo) is oo assert -oo*3 is -oo assert oo + oo is oo assert -oo + oo*(-5) is -oo assert 1/oo == 0 assert 1/(-oo) == 0 assert 8/oo == 0 assert oo % 2 is nan assert 2 % oo is nan assert oo/oo is nan assert oo/-oo is nan assert -oo/oo is nan assert -oo/-oo is nan assert oo - oo is nan assert oo - -oo is oo assert -oo - oo is -oo assert -oo - -oo is nan assert oo + -oo is nan assert -oo + oo is nan assert oo + oo is oo assert -oo + oo is nan assert oo + -oo is nan assert -oo + -oo is -oo assert oo*oo is oo assert -oo*oo is -oo assert oo*-oo is -oo assert -oo*-oo is oo assert oo/0 is oo assert -oo/0 is -oo assert 0/oo == 0 assert 0/-oo == 0 assert oo*0 is nan assert -oo*0 is nan assert 0*oo is nan assert 0*-oo is nan assert oo + 0 is oo assert -oo + 0 is -oo assert 0 + oo is oo assert 0 + -oo is -oo assert oo - 0 is oo assert -oo - 0 is -oo assert 0 - oo is -oo assert 0 - -oo is oo assert oo/2 is oo assert -oo/2 is -oo assert oo/-2 is -oo assert -oo/-2 is oo assert oo*2 is oo assert -oo*2 is -oo assert oo*-2 is -oo assert 2/oo == 0 assert 2/-oo == 0 assert -2/oo == 0 assert -2/-oo == 0 assert 2*oo is oo assert 2*-oo is -oo assert -2*oo is -oo assert -2*-oo is oo assert 2 + oo is oo assert 2 - oo is -oo assert -2 + oo is oo assert -2 - oo is -oo assert 2 + -oo is -oo assert 2 - -oo is oo assert -2 + -oo is -oo assert -2 - -oo is oo assert S(2) + oo is oo assert S(2) - oo is -oo assert oo/I == -oo*I assert -oo/I == oo*I assert oo*float(1) == _inf and (oo*float(1)) is oo assert -oo*float(1) == _ninf and (-oo*float(1)) is -oo assert oo/float(1) == _inf and (oo/float(1)) is oo assert -oo/float(1) == _ninf and (-oo/float(1)) is -oo assert oo*float(-1) == _ninf and (oo*float(-1)) is -oo assert -oo*float(-1) == _inf and (-oo*float(-1)) is oo assert oo/float(-1) == _ninf and (oo/float(-1)) is -oo assert -oo/float(-1) == _inf and (-oo/float(-1)) is oo assert oo + float(1) == _inf and (oo + float(1)) is oo assert -oo + float(1) == _ninf and (-oo + float(1)) is -oo assert oo - float(1) == _inf and (oo - float(1)) is oo assert -oo - float(1) == _ninf and (-oo - float(1)) is -oo assert float(1)*oo == _inf and (float(1)*oo) is oo assert float(1)*-oo == _ninf and (float(1)*-oo) is -oo assert float(1)/oo == 0 assert float(1)/-oo == 0 assert float(-1)*oo == _ninf and (float(-1)*oo) is -oo assert float(-1)*-oo == _inf and (float(-1)*-oo) is oo assert float(-1)/oo == 0 assert float(-1)/-oo == 0 assert float(1) + oo is oo assert float(1) + -oo is -oo assert float(1) - oo is -oo assert float(1) - -oo is oo assert oo == float(oo) assert (oo != float(oo)) is False assert type(float(oo)) is float assert -oo == float(-oo) assert (-oo != float(-oo)) is False assert type(float(-oo)) is float assert Float('nan') is nan assert nan*1.0 is nan assert -1.0*nan is nan assert nan*oo is nan assert nan*-oo is nan assert nan/oo is nan assert nan/-oo is nan assert nan + oo is nan assert nan + -oo is nan assert nan - oo is nan assert nan - -oo is nan assert -oo * S.Zero is nan assert oo*nan is nan assert -oo*nan is nan assert oo/nan is nan assert -oo/nan is nan assert oo + nan is nan assert -oo + nan is nan assert oo - nan is nan assert -oo - nan is nan assert S.Zero * oo is nan assert oo.is_Rational is False assert isinstance(oo, Rational) is False assert S.One/oo == 0 assert -S.One/oo == 0 assert S.One/-oo == 0 assert -S.One/-oo == 0 assert S.One*oo is oo assert -S.One*oo is -oo assert S.One*-oo is -oo assert -S.One*-oo is oo assert S.One/nan is nan assert S.One - -oo is oo assert S.One + nan is nan assert S.One - nan is nan assert nan - S.One is nan assert nan/S.One is nan assert -oo - S.One is -oo def test_Infinity_2(): x = Symbol('x') assert oo*x != oo assert oo*(pi - 1) is oo assert oo*(1 - pi) is -oo assert (-oo)*x != -oo assert (-oo)*(pi - 1) is -oo assert (-oo)*(1 - pi) is oo assert (-1)**S.NaN is S.NaN assert oo - _inf is S.NaN assert oo + _ninf is S.NaN assert oo*0 is S.NaN assert oo/_inf is S.NaN assert oo/_ninf is S.NaN assert oo**S.NaN is S.NaN assert -oo + _inf is S.NaN assert -oo - _ninf is S.NaN assert -oo*S.NaN is S.NaN assert -oo*0 is S.NaN assert -oo/_inf is S.NaN assert -oo/_ninf is S.NaN assert -oo/S.NaN is S.NaN assert abs(-oo) is oo assert all((-oo)**i is S.NaN for i in (oo, -oo, S.NaN)) assert (-oo)**3 is -oo assert (-oo)**2 is oo assert abs(S.ComplexInfinity) is oo def test_Mul_Infinity_Zero(): assert Float(0)*_inf is nan assert Float(0)*_ninf is nan assert Float(0)*_inf is nan assert Float(0)*_ninf is nan assert _inf*Float(0) is nan assert _ninf*Float(0) is nan assert _inf*Float(0) is nan assert _ninf*Float(0) is nan def test_Div_By_Zero(): assert 1/S.Zero is zoo assert 1/Float(0) is zoo assert 0/S.Zero is nan assert 0/Float(0) is nan assert S.Zero/0 is nan assert Float(0)/0 is nan assert -1/S.Zero is zoo assert -1/Float(0) is zoo def test_Infinity_inequations(): assert oo > pi assert not (oo < pi) assert exp(-3) < oo assert _inf > pi assert not (_inf < pi) assert exp(-3) < _inf raises(TypeError, lambda: oo < I) raises(TypeError, lambda: oo <= I) raises(TypeError, lambda: oo > I) raises(TypeError, lambda: oo >= I) raises(TypeError, lambda: -oo < I) raises(TypeError, lambda: -oo <= I) raises(TypeError, lambda: -oo > I) raises(TypeError, lambda: -oo >= I) raises(TypeError, lambda: I < oo) raises(TypeError, lambda: I <= oo) raises(TypeError, lambda: I > oo) raises(TypeError, lambda: I >= oo) raises(TypeError, lambda: I < -oo) raises(TypeError, lambda: I <= -oo) raises(TypeError, lambda: I > -oo) raises(TypeError, lambda: I >= -oo) assert oo > -oo and oo >= -oo assert (oo < -oo) == False and (oo <= -oo) == False assert -oo < oo and -oo <= oo assert (-oo > oo) == False and (-oo >= oo) == False assert (oo < oo) == False # issue 7775 assert (oo > oo) == False assert (-oo > -oo) == False and (-oo < -oo) == False assert oo >= oo and oo <= oo and -oo >= -oo and -oo <= -oo assert (-oo < -_inf) == False assert (oo > _inf) == False assert -oo >= -_inf assert oo <= _inf x = Symbol('x') b = Symbol('b', finite=True, real=True) assert (x < oo) == Lt(x, oo) # issue 7775 assert b < oo and b > -oo and b <= oo and b >= -oo assert oo > b and oo >= b and (oo < b) == False and (oo <= b) == False assert (-oo > b) == False and (-oo >= b) == False and -oo < b and -oo <= b assert (oo < x) == Lt(oo, x) and (oo > x) == Gt(oo, x) assert (oo <= x) == Le(oo, x) and (oo >= x) == Ge(oo, x) assert (-oo < x) == Lt(-oo, x) and (-oo > x) == Gt(-oo, x) assert (-oo <= x) == Le(-oo, x) and (-oo >= x) == Ge(-oo, x) def test_NaN(): assert nan is nan assert nan != 1 assert 1*nan is nan assert 1 != nan assert -nan is nan assert oo != Symbol("x")**3 assert 2 + nan is nan assert 3*nan + 2 is nan assert -nan*3 is nan assert nan + nan is nan assert -nan + nan*(-5) is nan assert 8/nan is nan raises(TypeError, lambda: nan > 0) raises(TypeError, lambda: nan < 0) raises(TypeError, lambda: nan >= 0) raises(TypeError, lambda: nan <= 0) raises(TypeError, lambda: 0 < nan) raises(TypeError, lambda: 0 > nan) raises(TypeError, lambda: 0 <= nan) raises(TypeError, lambda: 0 >= nan) assert nan**0 == 1 # as per IEEE 754 assert 1**nan is nan # IEEE 754 is not the best choice for symbolic work # test Pow._eval_power's handling of NaN assert Pow(nan, 0, evaluate=False)**2 == 1 for n in (1, 1., S.One, S.NegativeOne, Float(1)): assert n + nan is nan assert n - nan is nan assert nan + n is nan assert nan - n is nan assert n/nan is nan assert nan/n is nan def test_special_numbers(): assert isinstance(S.NaN, Number) is True assert isinstance(S.Infinity, Number) is True assert isinstance(S.NegativeInfinity, Number) is True assert S.NaN.is_number is True assert S.Infinity.is_number is True assert S.NegativeInfinity.is_number is True assert S.ComplexInfinity.is_number is True assert isinstance(S.NaN, Rational) is False assert isinstance(S.Infinity, Rational) is False assert isinstance(S.NegativeInfinity, Rational) is False assert S.NaN.is_rational is not True assert S.Infinity.is_rational is not True assert S.NegativeInfinity.is_rational is not True def test_powers(): assert integer_nthroot(1, 2) == (1, True) assert integer_nthroot(1, 5) == (1, True) assert integer_nthroot(2, 1) == (2, True) assert integer_nthroot(2, 2) == (1, False) assert integer_nthroot(2, 5) == (1, False) assert integer_nthroot(4, 2) == (2, True) assert integer_nthroot(123**25, 25) == (123, True) assert integer_nthroot(123**25 + 1, 25) == (123, False) assert integer_nthroot(123**25 - 1, 25) == (122, False) assert integer_nthroot(1, 1) == (1, True) assert integer_nthroot(0, 1) == (0, True) assert integer_nthroot(0, 3) == (0, True) assert integer_nthroot(10000, 1) == (10000, True) assert integer_nthroot(4, 2) == (2, True) assert integer_nthroot(16, 2) == (4, True) assert integer_nthroot(26, 2) == (5, False) assert integer_nthroot(1234567**7, 7) == (1234567, True) assert integer_nthroot(1234567**7 + 1, 7) == (1234567, False) assert integer_nthroot(1234567**7 - 1, 7) == (1234566, False) b = 25**1000 assert integer_nthroot(b, 1000) == (25, True) assert integer_nthroot(b + 1, 1000) == (25, False) assert integer_nthroot(b - 1, 1000) == (24, False) c = 10**400 c2 = c**2 assert integer_nthroot(c2, 2) == (c, True) assert integer_nthroot(c2 + 1, 2) == (c, False) assert integer_nthroot(c2 - 1, 2) == (c - 1, False) assert integer_nthroot(2, 10**10) == (1, False) p, r = integer_nthroot(int(factorial(10000)), 100) assert p % (10**10) == 5322420655 assert not r # Test that this is fast assert integer_nthroot(2, 10**10) == (1, False) # output should be int if possible assert type(integer_nthroot(2**61, 2)[0]) is int def test_integer_nthroot_overflow(): assert integer_nthroot(10**(50*50), 50) == (10**50, True) assert integer_nthroot(10**100000, 10000) == (10**10, True) def test_integer_log(): raises(ValueError, lambda: integer_log(2, 1)) raises(ValueError, lambda: integer_log(0, 2)) raises(ValueError, lambda: integer_log(1.1, 2)) raises(ValueError, lambda: integer_log(1, 2.2)) assert integer_log(1, 2) == (0, True) assert integer_log(1, 3) == (0, True) assert integer_log(2, 3) == (0, False) assert integer_log(3, 3) == (1, True) assert integer_log(3*2, 3) == (1, False) assert integer_log(3**2, 3) == (2, True) assert integer_log(3*4, 3) == (2, False) assert integer_log(3**3, 3) == (3, True) assert integer_log(27, 5) == (2, False) assert integer_log(2, 3) == (0, False) assert integer_log(-4, -2) == (2, False) assert integer_log(27, -3) == (3, False) assert integer_log(-49, 7) == (0, False) assert integer_log(-49, -7) == (2, False) def test_isqrt(): from math import sqrt as _sqrt limit = 4503599761588223 assert int(_sqrt(limit)) == integer_nthroot(limit, 2)[0] assert int(_sqrt(limit + 1)) != integer_nthroot(limit + 1, 2)[0] assert isqrt(limit + 1) == integer_nthroot(limit + 1, 2)[0] assert isqrt(limit + S.Half) == integer_nthroot(limit, 2)[0] assert isqrt(limit + 1 + S.Half) == integer_nthroot(limit + 1, 2)[0] assert isqrt(limit + 2 + S.Half) == integer_nthroot(limit + 2, 2)[0] # Regression tests for https://github.com/sympy/sympy/issues/17034 assert isqrt(4503599761588224) == 67108864 assert isqrt(9999999999999999) == 99999999 # Other corner cases, especially involving non-integers. raises(ValueError, lambda: isqrt(-1)) raises(ValueError, lambda: isqrt(-10**1000)) raises(ValueError, lambda: isqrt(Rational(-1, 2))) tiny = Rational(1, 10**1000) raises(ValueError, lambda: isqrt(-tiny)) assert isqrt(1-tiny) == 0 assert isqrt(4503599761588224-tiny) == 67108864 assert isqrt(10**100 - tiny) == 10**50 - 1 # Check that using an inaccurate math.sqrt doesn't affect the results. from sympy.core import power old_sqrt = power._sqrt power._sqrt = lambda x: 2.999999999 try: assert isqrt(9) == 3 assert isqrt(10000) == 100 finally: power._sqrt = old_sqrt def test_powers_Integer(): """Test Integer._eval_power""" # check infinity assert S.One ** S.Infinity is S.NaN assert S.NegativeOne** S.Infinity is S.NaN assert S(2) ** S.Infinity is S.Infinity assert S(-2)** S.Infinity == S.Infinity + S.Infinity * S.ImaginaryUnit assert S(0) ** S.Infinity is S.Zero # check Nan assert S.One ** S.NaN is S.NaN assert S.NegativeOne ** S.NaN is S.NaN # check for exact roots assert S.NegativeOne ** Rational(6, 5) == - (-1)**(S.One/5) assert sqrt(S(4)) == 2 assert sqrt(S(-4)) == I * 2 assert S(16) ** Rational(1, 4) == 2 assert S(-16) ** Rational(1, 4) == 2 * (-1)**Rational(1, 4) assert S(9) ** Rational(3, 2) == 27 assert S(-9) ** Rational(3, 2) == -27*I assert S(27) ** Rational(2, 3) == 9 assert S(-27) ** Rational(2, 3) == 9 * (S.NegativeOne ** Rational(2, 3)) assert (-2) ** Rational(-2, 1) == Rational(1, 4) # not exact roots assert sqrt(-3) == I*sqrt(3) assert (3) ** (Rational(3, 2)) == 3 * sqrt(3) assert (-3) ** (Rational(3, 2)) == - 3 * sqrt(-3) assert (-3) ** (Rational(5, 2)) == 9 * I * sqrt(3) assert (-3) ** (Rational(7, 2)) == - I * 27 * sqrt(3) assert (2) ** (Rational(3, 2)) == 2 * sqrt(2) assert (2) ** (Rational(-3, 2)) == sqrt(2) / 4 assert (81) ** (Rational(2, 3)) == 9 * (S(3) ** (Rational(2, 3))) assert (-81) ** (Rational(2, 3)) == 9 * (S(-3) ** (Rational(2, 3))) assert (-3) ** Rational(-7, 3) == \ -(-1)**Rational(2, 3)*3**Rational(2, 3)/27 assert (-3) ** Rational(-2, 3) == \ -(-1)**Rational(1, 3)*3**Rational(1, 3)/3 # join roots assert sqrt(6) + sqrt(24) == 3*sqrt(6) assert sqrt(2) * sqrt(3) == sqrt(6) # separate symbols & constansts x = Symbol("x") assert sqrt(49 * x) == 7 * sqrt(x) assert sqrt((3 - sqrt(pi)) ** 2) == 3 - sqrt(pi) # check that it is fast for big numbers assert (2**64 + 1) ** Rational(4, 3) assert (2**64 + 1) ** Rational(17, 25) # negative rational power and negative base assert (-3) ** Rational(-7, 3) == \ -(-1)**Rational(2, 3)*3**Rational(2, 3)/27 assert (-3) ** Rational(-2, 3) == \ -(-1)**Rational(1, 3)*3**Rational(1, 3)/3 assert (-2) ** Rational(-10, 3) == \ (-1)**Rational(2, 3)*2**Rational(2, 3)/16 assert abs(Pow(-2, Rational(-10, 3)).n() - Pow(-2, Rational(-10, 3), evaluate=False).n()) < 1e-16 # negative base and rational power with some simplification assert (-8) ** Rational(2, 5) == \ 2*(-1)**Rational(2, 5)*2**Rational(1, 5) assert (-4) ** Rational(9, 5) == \ -8*(-1)**Rational(4, 5)*2**Rational(3, 5) assert S(1234).factors() == {617: 1, 2: 1} assert Rational(2*3, 3*5*7).factors() == {2: 1, 5: -1, 7: -1} # test that eval_power factors numbers bigger than # the current limit in factor_trial_division (2**15) from sympy import nextprime n = nextprime(2**15) assert sqrt(n**2) == n assert sqrt(n**3) == n*sqrt(n) assert sqrt(4*n) == 2*sqrt(n) # check that factors of base with powers sharing gcd with power are removed assert (2**4*3)**Rational(1, 6) == 2**Rational(2, 3)*3**Rational(1, 6) assert (2**4*3)**Rational(5, 6) == 8*2**Rational(1, 3)*3**Rational(5, 6) # check that bases sharing a gcd are exptracted assert 2**Rational(1, 3)*3**Rational(1, 4)*6**Rational(1, 5) == \ 2**Rational(8, 15)*3**Rational(9, 20) assert sqrt(8)*24**Rational(1, 3)*6**Rational(1, 5) == \ 4*2**Rational(7, 10)*3**Rational(8, 15) assert sqrt(8)*(-24)**Rational(1, 3)*(-6)**Rational(1, 5) == \ 4*(-3)**Rational(8, 15)*2**Rational(7, 10) assert 2**Rational(1, 3)*2**Rational(8, 9) == 2*2**Rational(2, 9) assert 2**Rational(2, 3)*6**Rational(1, 3) == 2*3**Rational(1, 3) assert 2**Rational(2, 3)*6**Rational(8, 9) == \ 2*2**Rational(5, 9)*3**Rational(8, 9) assert (-2)**Rational(2, S(3))*(-4)**Rational(1, S(3)) == -2*2**Rational(1, 3) assert 3*Pow(3, 2, evaluate=False) == 3**3 assert 3*Pow(3, Rational(-1, 3), evaluate=False) == 3**Rational(2, 3) assert (-2)**Rational(1, 3)*(-3)**Rational(1, 4)*(-5)**Rational(5, 6) == \ -(-1)**Rational(5, 12)*2**Rational(1, 3)*3**Rational(1, 4) * \ 5**Rational(5, 6) assert Integer(-2)**Symbol('', even=True) == \ Integer(2)**Symbol('', even=True) assert (-1)**Float(.5) == 1.0*I def test_powers_Rational(): """Test Rational._eval_power""" # check infinity assert S.Half ** S.Infinity == 0 assert Rational(3, 2) ** S.Infinity is S.Infinity assert Rational(-1, 2) ** S.Infinity == 0 assert Rational(-3, 2) ** S.Infinity == \ S.Infinity + S.Infinity * S.ImaginaryUnit # check Nan assert Rational(3, 4) ** S.NaN is S.NaN assert Rational(-2, 3) ** S.NaN is S.NaN # exact roots on numerator assert sqrt(Rational(4, 3)) == 2 * sqrt(3) / 3 assert Rational(4, 3) ** Rational(3, 2) == 8 * sqrt(3) / 9 assert sqrt(Rational(-4, 3)) == I * 2 * sqrt(3) / 3 assert Rational(-4, 3) ** Rational(3, 2) == - I * 8 * sqrt(3) / 9 assert Rational(27, 2) ** Rational(1, 3) == 3 * (2 ** Rational(2, 3)) / 2 assert Rational(5**3, 8**3) ** Rational(4, 3) == Rational(5**4, 8**4) # exact root on denominator assert sqrt(Rational(1, 4)) == S.Half assert sqrt(Rational(1, -4)) == I * S.Half assert sqrt(Rational(3, 4)) == sqrt(3) / 2 assert sqrt(Rational(3, -4)) == I * sqrt(3) / 2 assert Rational(5, 27) ** Rational(1, 3) == (5 ** Rational(1, 3)) / 3 # not exact roots assert sqrt(S.Half) == sqrt(2) / 2 assert sqrt(Rational(-4, 7)) == I * sqrt(Rational(4, 7)) assert Rational(-3, 2)**Rational(-7, 3) == \ -4*(-1)**Rational(2, 3)*2**Rational(1, 3)*3**Rational(2, 3)/27 assert Rational(-3, 2)**Rational(-2, 3) == \ -(-1)**Rational(1, 3)*2**Rational(2, 3)*3**Rational(1, 3)/3 assert Rational(-3, 2)**Rational(-10, 3) == \ 8*(-1)**Rational(2, 3)*2**Rational(1, 3)*3**Rational(2, 3)/81 assert abs(Pow(Rational(-2, 3), Rational(-7, 4)).n() - Pow(Rational(-2, 3), Rational(-7, 4), evaluate=False).n()) < 1e-16 # negative integer power and negative rational base assert Rational(-2, 3) ** Rational(-2, 1) == Rational(9, 4) a = Rational(1, 10) assert a**Float(a, 2) == Float(a, 2)**Float(a, 2) assert Rational(-2, 3)**Symbol('', even=True) == \ Rational(2, 3)**Symbol('', even=True) def test_powers_Float(): assert str((S('-1/10')**S('3/10')).n()) == str(Float(-.1)**(.3)) def test_abs1(): assert Rational(1, 6) != Rational(-1, 6) assert abs(Rational(1, 6)) == abs(Rational(-1, 6)) def test_accept_int(): assert Float(4) == 4 def test_dont_accept_str(): assert Float("0.2") != "0.2" assert not (Float("0.2") == "0.2") def test_int(): a = Rational(5) assert int(a) == 5 a = Rational(9, 10) assert int(a) == int(-a) == 0 assert 1/(-1)**Rational(2, 3) == -(-1)**Rational(1, 3) assert int(pi) == 3 assert int(E) == 2 assert int(GoldenRatio) == 1 assert int(TribonacciConstant) == 2 # issue 10368 a = Rational(32442016954, 78058255275) assert type(int(a)) is type(int(-a)) is int def test_real_bug(): x = Symbol("x") assert str(2.0*x*x) in ["(2.0*x)*x", "2.0*x**2", "2.00000000000000*x**2"] assert str(2.1*x*x) != "(2.0*x)*x" def test_bug_sqrt(): assert ((sqrt(Rational(2)) + 1)*(sqrt(Rational(2)) - 1)).expand() == 1 def test_pi_Pi(): "Test that pi (instance) is imported, but Pi (class) is not" from sympy import pi # noqa with raises(ImportError): from sympy import Pi # noqa def test_no_len(): # there should be no len for numbers raises(TypeError, lambda: len(Rational(2))) raises(TypeError, lambda: len(Rational(2, 3))) raises(TypeError, lambda: len(Integer(2))) def test_issue_3321(): assert sqrt(Rational(1, 5)) == Rational(1, 5)**S.Half assert 5 * sqrt(Rational(1, 5)) == sqrt(5) def test_issue_3692(): assert ((-1)**Rational(1, 6)).expand(complex=True) == I/2 + sqrt(3)/2 assert ((-5)**Rational(1, 6)).expand(complex=True) == \ 5**Rational(1, 6)*I/2 + 5**Rational(1, 6)*sqrt(3)/2 assert ((-64)**Rational(1, 6)).expand(complex=True) == I + sqrt(3) def test_issue_3423(): x = Symbol("x") assert sqrt(x - 1).as_base_exp() == (x - 1, S.Half) assert sqrt(x - 1) != I*sqrt(1 - x) def test_issue_3449(): x = Symbol("x") assert sqrt(x - 1).subs(x, 5) == 2 def test_issue_13890(): x = Symbol("x") e = (-x/4 - S.One/12)**x - 1 f = simplify(e) a = Rational(9, 5) assert abs(e.subs(x,a).evalf() - f.subs(x,a).evalf()) < 1e-15 def test_Integer_factors(): def F(i): return Integer(i).factors() assert F(1) == {} assert F(2) == {2: 1} assert F(3) == {3: 1} assert F(4) == {2: 2} assert F(5) == {5: 1} assert F(6) == {2: 1, 3: 1} assert F(7) == {7: 1} assert F(8) == {2: 3} assert F(9) == {3: 2} assert F(10) == {2: 1, 5: 1} assert F(11) == {11: 1} assert F(12) == {2: 2, 3: 1} assert F(13) == {13: 1} assert F(14) == {2: 1, 7: 1} assert F(15) == {3: 1, 5: 1} assert F(16) == {2: 4} assert F(17) == {17: 1} assert F(18) == {2: 1, 3: 2} assert F(19) == {19: 1} assert F(20) == {2: 2, 5: 1} assert F(21) == {3: 1, 7: 1} assert F(22) == {2: 1, 11: 1} assert F(23) == {23: 1} assert F(24) == {2: 3, 3: 1} assert F(25) == {5: 2} assert F(26) == {2: 1, 13: 1} assert F(27) == {3: 3} assert F(28) == {2: 2, 7: 1} assert F(29) == {29: 1} assert F(30) == {2: 1, 3: 1, 5: 1} assert F(31) == {31: 1} assert F(32) == {2: 5} assert F(33) == {3: 1, 11: 1} assert F(34) == {2: 1, 17: 1} assert F(35) == {5: 1, 7: 1} assert F(36) == {2: 2, 3: 2} assert F(37) == {37: 1} assert F(38) == {2: 1, 19: 1} assert F(39) == {3: 1, 13: 1} assert F(40) == {2: 3, 5: 1} assert F(41) == {41: 1} assert F(42) == {2: 1, 3: 1, 7: 1} assert F(43) == {43: 1} assert F(44) == {2: 2, 11: 1} assert F(45) == {3: 2, 5: 1} assert F(46) == {2: 1, 23: 1} assert F(47) == {47: 1} assert F(48) == {2: 4, 3: 1} assert F(49) == {7: 2} assert F(50) == {2: 1, 5: 2} assert F(51) == {3: 1, 17: 1} def test_Rational_factors(): def F(p, q, visual=None): return Rational(p, q).factors(visual=visual) assert F(2, 3) == {2: 1, 3: -1} assert F(2, 9) == {2: 1, 3: -2} assert F(2, 15) == {2: 1, 3: -1, 5: -1} assert F(6, 10) == {3: 1, 5: -1} def test_issue_4107(): assert pi*(E + 10) + pi*(-E - 10) != 0 assert pi*(E + 10**10) + pi*(-E - 10**10) != 0 assert pi*(E + 10**20) + pi*(-E - 10**20) != 0 assert pi*(E + 10**80) + pi*(-E - 10**80) != 0 assert (pi*(E + 10) + pi*(-E - 10)).expand() == 0 assert (pi*(E + 10**10) + pi*(-E - 10**10)).expand() == 0 assert (pi*(E + 10**20) + pi*(-E - 10**20)).expand() == 0 assert (pi*(E + 10**80) + pi*(-E - 10**80)).expand() == 0 def test_IntegerInteger(): a = Integer(4) b = Integer(a) assert a == b def test_Rational_gcd_lcm_cofactors(): assert Integer(4).gcd(2) == Integer(2) assert Integer(4).lcm(2) == Integer(4) assert Integer(4).gcd(Integer(2)) == Integer(2) assert Integer(4).lcm(Integer(2)) == Integer(4) a, b = 720**99911, 480**12342 assert Integer(a).lcm(b) == a*b/Integer(a).gcd(b) assert Integer(4).gcd(3) == Integer(1) assert Integer(4).lcm(3) == Integer(12) assert Integer(4).gcd(Integer(3)) == Integer(1) assert Integer(4).lcm(Integer(3)) == Integer(12) assert Rational(4, 3).gcd(2) == Rational(2, 3) assert Rational(4, 3).lcm(2) == Integer(4) assert Rational(4, 3).gcd(Integer(2)) == Rational(2, 3) assert Rational(4, 3).lcm(Integer(2)) == Integer(4) assert Integer(4).gcd(Rational(2, 9)) == Rational(2, 9) assert Integer(4).lcm(Rational(2, 9)) == Integer(4) assert Rational(4, 3).gcd(Rational(2, 9)) == Rational(2, 9) assert Rational(4, 3).lcm(Rational(2, 9)) == Rational(4, 3) assert Rational(4, 5).gcd(Rational(2, 9)) == Rational(2, 45) assert Rational(4, 5).lcm(Rational(2, 9)) == Integer(4) assert Rational(5, 9).lcm(Rational(3, 7)) == Rational(Integer(5).lcm(3),Integer(9).gcd(7)) assert Integer(4).cofactors(2) == (Integer(2), Integer(2), Integer(1)) assert Integer(4).cofactors(Integer(2)) == \ (Integer(2), Integer(2), Integer(1)) assert Integer(4).gcd(Float(2.0)) == S.One assert Integer(4).lcm(Float(2.0)) == Float(8.0) assert Integer(4).cofactors(Float(2.0)) == (S.One, Integer(4), Float(2.0)) assert S.Half.gcd(Float(2.0)) == S.One assert S.Half.lcm(Float(2.0)) == Float(1.0) assert S.Half.cofactors(Float(2.0)) == \ (S.One, S.Half, Float(2.0)) def test_Float_gcd_lcm_cofactors(): assert Float(2.0).gcd(Integer(4)) == S.One assert Float(2.0).lcm(Integer(4)) == Float(8.0) assert Float(2.0).cofactors(Integer(4)) == (S.One, Float(2.0), Integer(4)) assert Float(2.0).gcd(S.Half) == S.One assert Float(2.0).lcm(S.Half) == Float(1.0) assert Float(2.0).cofactors(S.Half) == \ (S.One, Float(2.0), S.Half) def test_issue_4611(): assert abs(pi._evalf(50) - 3.14159265358979) < 1e-10 assert abs(E._evalf(50) - 2.71828182845905) < 1e-10 assert abs(Catalan._evalf(50) - 0.915965594177219) < 1e-10 assert abs(EulerGamma._evalf(50) - 0.577215664901533) < 1e-10 assert abs(GoldenRatio._evalf(50) - 1.61803398874989) < 1e-10 assert abs(TribonacciConstant._evalf(50) - 1.83928675521416) < 1e-10 x = Symbol("x") assert (pi + x).evalf() == pi.evalf() + x assert (E + x).evalf() == E.evalf() + x assert (Catalan + x).evalf() == Catalan.evalf() + x assert (EulerGamma + x).evalf() == EulerGamma.evalf() + x assert (GoldenRatio + x).evalf() == GoldenRatio.evalf() + x assert (TribonacciConstant + x).evalf() == TribonacciConstant.evalf() + x @conserve_mpmath_dps def test_conversion_to_mpmath(): assert mpmath.mpmathify(Integer(1)) == mpmath.mpf(1) assert mpmath.mpmathify(S.Half) == mpmath.mpf(0.5) assert mpmath.mpmathify(Float('1.23', 15)) == mpmath.mpf('1.23') assert mpmath.mpmathify(I) == mpmath.mpc(1j) assert mpmath.mpmathify(1 + 2*I) == mpmath.mpc(1 + 2j) assert mpmath.mpmathify(1.0 + 2*I) == mpmath.mpc(1 + 2j) assert mpmath.mpmathify(1 + 2.0*I) == mpmath.mpc(1 + 2j) assert mpmath.mpmathify(1.0 + 2.0*I) == mpmath.mpc(1 + 2j) assert mpmath.mpmathify(S.Half + S.Half*I) == mpmath.mpc(0.5 + 0.5j) assert mpmath.mpmathify(2*I) == mpmath.mpc(2j) assert mpmath.mpmathify(2.0*I) == mpmath.mpc(2j) assert mpmath.mpmathify(S.Half*I) == mpmath.mpc(0.5j) mpmath.mp.dps = 100 assert mpmath.mpmathify(pi.evalf(100) + pi.evalf(100)*I) == mpmath.pi + mpmath.pi*mpmath.j assert mpmath.mpmathify(pi.evalf(100)*I) == mpmath.pi*mpmath.j def test_relational(): # real x = S(.1) assert (x != cos) is True assert (x == cos) is False # rational x = Rational(1, 3) assert (x != cos) is True assert (x == cos) is False # integer defers to rational so these tests are omitted # number symbol x = pi assert (x != cos) is True assert (x == cos) is False def test_Integer_as_index(): assert 'hello'[Integer(2):] == 'llo' def test_Rational_int(): assert int( Rational(7, 5)) == 1 assert int( S.Half) == 0 assert int(Rational(-1, 2)) == 0 assert int(-Rational(7, 5)) == -1 def test_zoo(): b = Symbol('b', finite=True) nz = Symbol('nz', nonzero=True) p = Symbol('p', positive=True) n = Symbol('n', negative=True) im = Symbol('i', imaginary=True) c = Symbol('c', complex=True) pb = Symbol('pb', positive=True, finite=True) nb = Symbol('nb', negative=True, finite=True) imb = Symbol('ib', imaginary=True, finite=True) for i in [I, S.Infinity, S.NegativeInfinity, S.Zero, S.One, S.Pi, S.Half, S(3), log(3), b, nz, p, n, im, pb, nb, imb, c]: if i.is_finite and (i.is_real or i.is_imaginary): assert i + zoo is zoo assert i - zoo is zoo assert zoo + i is zoo assert zoo - i is zoo elif i.is_finite is not False: assert (i + zoo).is_Add assert (i - zoo).is_Add assert (zoo + i).is_Add assert (zoo - i).is_Add else: assert (i + zoo) is S.NaN assert (i - zoo) is S.NaN assert (zoo + i) is S.NaN assert (zoo - i) is S.NaN if fuzzy_not(i.is_zero) and (i.is_extended_real or i.is_imaginary): assert i*zoo is zoo assert zoo*i is zoo elif i.is_zero: assert i*zoo is S.NaN assert zoo*i is S.NaN else: assert (i*zoo).is_Mul assert (zoo*i).is_Mul if fuzzy_not((1/i).is_zero) and (i.is_real or i.is_imaginary): assert zoo/i is zoo elif (1/i).is_zero: assert zoo/i is S.NaN elif i.is_zero: assert zoo/i is zoo else: assert (zoo/i).is_Mul assert (I*oo).is_Mul # allow directed infinity assert zoo + zoo is S.NaN assert zoo * zoo is zoo assert zoo - zoo is S.NaN assert zoo/zoo is S.NaN assert zoo**zoo is S.NaN assert zoo**0 is S.One assert zoo**2 is zoo assert 1/zoo is S.Zero assert Mul.flatten([S.NegativeOne, oo, S(0)]) == ([S.NaN], [], None) def test_issue_4122(): x = Symbol('x', nonpositive=True) assert oo + x is oo x = Symbol('x', extended_nonpositive=True) assert (oo + x).is_Add x = Symbol('x', finite=True) assert (oo + x).is_Add # x could be imaginary x = Symbol('x', nonnegative=True) assert oo + x is oo x = Symbol('x', extended_nonnegative=True) assert oo + x is oo x = Symbol('x', finite=True, real=True) assert oo + x is oo # similarly for negative infinity x = Symbol('x', nonnegative=True) assert -oo + x is -oo x = Symbol('x', extended_nonnegative=True) assert (-oo + x).is_Add x = Symbol('x', finite=True) assert (-oo + x).is_Add x = Symbol('x', nonpositive=True) assert -oo + x is -oo x = Symbol('x', extended_nonpositive=True) assert -oo + x is -oo x = Symbol('x', finite=True, real=True) assert -oo + x is -oo def test_GoldenRatio_expand(): assert GoldenRatio.expand(func=True) == S.Half + sqrt(5)/2 def test_TribonacciConstant_expand(): assert TribonacciConstant.expand(func=True) == \ (1 + cbrt(19 - 3*sqrt(33)) + cbrt(19 + 3*sqrt(33))) / 3 def test_as_content_primitive(): assert S.Zero.as_content_primitive() == (1, 0) assert S.Half.as_content_primitive() == (S.Half, 1) assert (Rational(-1, 2)).as_content_primitive() == (S.Half, -1) assert S(3).as_content_primitive() == (3, 1) assert S(3.1).as_content_primitive() == (1, 3.1) def test_hashing_sympy_integers(): # Test for issue 5072 assert set([Integer(3)]) == set([int(3)]) assert hash(Integer(4)) == hash(int(4)) def test_rounding_issue_4172(): assert int((E**100).round()) == \ 26881171418161354484126255515800135873611119 assert int((pi**100).round()) == \ 51878483143196131920862615246303013562686760680406 assert int((Rational(1)/EulerGamma**100).round()) == \ 734833795660954410469466 @XFAIL def test_mpmath_issues(): from mpmath.libmp.libmpf import _normalize import mpmath.libmp as mlib rnd = mlib.round_nearest mpf = (0, int(0), -123, -1, 53, rnd) # nan assert _normalize(mpf, 53) != (0, int(0), 0, 0) mpf = (0, int(0), -456, -2, 53, rnd) # +inf assert _normalize(mpf, 53) != (0, int(0), 0, 0) mpf = (1, int(0), -789, -3, 53, rnd) # -inf assert _normalize(mpf, 53) != (0, int(0), 0, 0) from mpmath.libmp.libmpf import fnan assert mlib.mpf_eq(fnan, fnan) def test_Catalan_EulerGamma_prec(): n = GoldenRatio f = Float(n.n(), 5) assert f._mpf_ == (0, int(212079), -17, 18) assert f._prec == 20 assert n._as_mpf_val(20) == f._mpf_ n = EulerGamma f = Float(n.n(), 5) assert f._mpf_ == (0, int(302627), -19, 19) assert f._prec == 20 assert n._as_mpf_val(20) == f._mpf_ def test_Catalan_rewrite(): k = Dummy('k', integer=True, nonnegative=True) assert Catalan.rewrite(Sum).dummy_eq( Sum((-1)**k/(2*k + 1)**2, (k, 0, oo))) assert Catalan.rewrite() == Catalan def test_bool_eq(): assert 0 == False assert S(0) == False assert S(0) != S.false assert 1 == True assert S.One == True assert S.One != S.true def test_Float_eq(): # all .5 values are the same assert Float(.5, 10) == Float(.5, 11) == Float(.5, 1) # but floats that aren't exact in base-2 still # don't compare the same because they have different # underlying mpf values assert Float(.12, 3) != Float(.12, 4) assert Float(.12, 3) != .12 assert 0.12 != Float(.12, 3) assert Float('.12', 22) != .12 # issue 11707 # but Float/Rational -- except for 0 -- # are exact so Rational(x) = Float(y) only if # Rational(x) == Rational(Float(y)) assert Float('1.1') != Rational(11, 10) assert Rational(11, 10) != Float('1.1') # coverage assert not Float(3) == 2 assert not Float(2**2) == S.Half assert Float(2**2) == 4 assert not Float(2**-2) == 1 assert Float(2**-1) == S.Half assert not Float(2*3) == 3 assert not Float(2*3) == S.Half assert Float(2*3) == 6 assert not Float(2*3) == 8 assert Float(.75) == Rational(3, 4) assert Float(5/18) == 5/18 # 4473 assert Float(2.) != 3 assert Float((0,1,-3)) == S.One/8 assert Float((0,1,-3)) != S.One/9 # 16196 assert 2 == Float(2) # as per Python # but in a computation... assert t**2 != t**2.0 def test_int_NumberSymbols(): assert [int(i) for i in [pi, EulerGamma, E, GoldenRatio, Catalan]] == \ [3, 0, 2, 1, 0] def test_issue_6640(): from mpmath.libmp.libmpf import finf, fninf # fnan is not included because Float no longer returns fnan, # but otherwise, the same sort of test could apply assert Float(finf).is_zero is False assert Float(fninf).is_zero is False assert bool(Float(0)) is False def test_issue_6349(): assert Float('23.e3', '')._prec == 10 assert Float('23e3', '')._prec == 20 assert Float('23000', '')._prec == 20 assert Float('-23000', '')._prec == 20 def test_mpf_norm(): assert mpf_norm((1, 0, 1, 0), 10) == mpf('0')._mpf_ assert Float._new((1, 0, 1, 0), 10)._mpf_ == mpf('0')._mpf_ def test_latex(): assert latex(pi) == r"\pi" assert latex(E) == r"e" assert latex(GoldenRatio) == r"\phi" assert latex(TribonacciConstant) == r"\text{TribonacciConstant}" assert latex(EulerGamma) == r"\gamma" assert latex(oo) == r"\infty" assert latex(-oo) == r"-\infty" assert latex(zoo) == r"\tilde{\infty}" assert latex(nan) == r"\text{NaN}" assert latex(I) == r"i" def test_issue_7742(): assert -oo % 1 is nan def test_simplify_AlgebraicNumber(): A = AlgebraicNumber e = 3**(S.One/6)*(3 + (135 + 78*sqrt(3))**Rational(2, 3))/(45 + 26*sqrt(3))**(S.One/3) assert simplify(A(e)) == A(12) # wester test_C20 e = (41 + 29*sqrt(2))**(S.One/5) assert simplify(A(e)) == A(1 + sqrt(2)) # wester test_C21 e = (3 + 4*I)**Rational(3, 2) assert simplify(A(e)) == A(2 + 11*I) # issue 4401 def test_Float_idempotence(): x = Float('1.23', '') y = Float(x) z = Float(x, 15) assert same_and_same_prec(y, x) assert not same_and_same_prec(z, x) x = Float(10**20) y = Float(x) z = Float(x, 15) assert same_and_same_prec(y, x) assert not same_and_same_prec(z, x) def test_comp1(): # sqrt(2) = 1.414213 5623730950... a = sqrt(2).n(7) assert comp(a, 1.4142129) is False assert comp(a, 1.4142130) # ... assert comp(a, 1.4142141) assert comp(a, 1.4142142) is False assert comp(sqrt(2).n(2), '1.4') assert comp(sqrt(2).n(2), Float(1.4, 2), '') assert comp(sqrt(2).n(2), 1.4, '') assert comp(sqrt(2).n(2), Float(1.4, 3), '') is False assert comp(sqrt(2) + sqrt(3)*I, 1.4 + 1.7*I, .1) assert not comp(sqrt(2) + sqrt(3)*I, (1.5 + 1.7*I)*0.89, .1) assert comp(sqrt(2) + sqrt(3)*I, (1.5 + 1.7*I)*0.90, .1) assert comp(sqrt(2) + sqrt(3)*I, (1.5 + 1.7*I)*1.07, .1) assert not comp(sqrt(2) + sqrt(3)*I, (1.5 + 1.7*I)*1.08, .1) assert [(i, j) for i in range(130, 150) for j in range(170, 180) if comp((sqrt(2)+ I*sqrt(3)).n(3), i/100. + I*j/100.)] == [ (141, 173), (142, 173)] raises(ValueError, lambda: comp(t, '1')) raises(ValueError, lambda: comp(t, 1)) assert comp(0, 0.0) assert comp(.5, S.Half) assert comp(2 + sqrt(2), 2.0 + sqrt(2)) assert not comp(0, 1) assert not comp(2, sqrt(2)) assert not comp(2 + I, 2.0 + sqrt(2)) assert not comp(2.0 + sqrt(2), 2 + I) assert not comp(2.0 + sqrt(2), sqrt(3)) assert comp(1/pi.n(4), 0.3183, 1e-5) assert not comp(1/pi.n(4), 0.3183, 8e-6) def test_issue_9491(): assert oo**zoo is nan def test_issue_10063(): assert 2**Float(3) == Float(8) def test_issue_10020(): assert oo**I is S.NaN assert oo**(1 + I) is S.ComplexInfinity assert oo**(-1 + I) is S.Zero assert (-oo)**I is S.NaN assert (-oo)**(-1 + I) is S.Zero assert oo**t == Pow(oo, t, evaluate=False) assert (-oo)**t == Pow(-oo, t, evaluate=False) def test_invert_numbers(): assert S(2).invert(5) == 3 assert S(2).invert(Rational(5, 2)) == S.Half assert S(2).invert(5.) == 0.5 assert S(2).invert(S(5)) == 3 assert S(2.).invert(5) == 0.5 assert S(sqrt(2)).invert(5) == 1/sqrt(2) assert S(sqrt(2)).invert(sqrt(3)) == 1/sqrt(2) def test_mod_inverse(): assert mod_inverse(3, 11) == 4 assert mod_inverse(5, 11) == 9 assert mod_inverse(21124921, 521512) == 7713 assert mod_inverse(124215421, 5125) == 2981 assert mod_inverse(214, 12515) == 1579 assert mod_inverse(5823991, 3299) == 1442 assert mod_inverse(123, 44) == 39 assert mod_inverse(2, 5) == 3 assert mod_inverse(-2, 5) == 2 assert mod_inverse(2, -5) == -2 assert mod_inverse(-2, -5) == -3 assert mod_inverse(-3, -7) == -5 x = Symbol('x') assert S(2).invert(x) == S.Half raises(TypeError, lambda: mod_inverse(2, x)) raises(ValueError, lambda: mod_inverse(2, S.Half)) raises(ValueError, lambda: mod_inverse(2, cos(1)**2 + sin(1)**2)) def test_golden_ratio_rewrite_as_sqrt(): assert GoldenRatio.rewrite(sqrt) == S.Half + sqrt(5)*S.Half def test_tribonacci_constant_rewrite_as_sqrt(): assert TribonacciConstant.rewrite(sqrt) == \ (1 + cbrt(19 - 3*sqrt(33)) + cbrt(19 + 3*sqrt(33))) / 3 def test_comparisons_with_unknown_type(): class Foo(object): """ Class that is unaware of Basic, and relies on both classes returning the NotImplemented singleton for equivalence to evaluate to False. """ ni, nf, nr = Integer(3), Float(1.0), Rational(1, 3) foo = Foo() for n in ni, nf, nr, oo, -oo, zoo, nan: assert n != foo assert foo != n assert not n == foo assert not foo == n raises(TypeError, lambda: n < foo) raises(TypeError, lambda: foo > n) raises(TypeError, lambda: n > foo) raises(TypeError, lambda: foo < n) raises(TypeError, lambda: n <= foo) raises(TypeError, lambda: foo >= n) raises(TypeError, lambda: n >= foo) raises(TypeError, lambda: foo <= n) class Bar(object): """ Class that considers itself equal to any instance of Number except infinities and nans, and relies on sympy types returning the NotImplemented singleton for symmetric equality relations. """ def __eq__(self, other): if other in (oo, -oo, zoo, nan): return False if isinstance(other, Number): return True return NotImplemented def __ne__(self, other): return not self == other bar = Bar() for n in ni, nf, nr: assert n == bar assert bar == n assert not n != bar assert not bar != n for n in oo, -oo, zoo, nan: assert n != bar assert bar != n assert not n == bar assert not bar == n for n in ni, nf, nr, oo, -oo, zoo, nan: raises(TypeError, lambda: n < bar) raises(TypeError, lambda: bar > n) raises(TypeError, lambda: n > bar) raises(TypeError, lambda: bar < n) raises(TypeError, lambda: n <= bar) raises(TypeError, lambda: bar >= n) raises(TypeError, lambda: n >= bar) raises(TypeError, lambda: bar <= n) def test_NumberSymbol_comparison(): from sympy.core.tests.test_relational import rel_check rpi = Rational('905502432259640373/288230376151711744') fpi = Float(float(pi)) assert rel_check(rpi, fpi) def test_Integer_precision(): # Make sure Integer inputs for keyword args work assert Float('1.0', dps=Integer(15))._prec == 53 assert Float('1.0', precision=Integer(15))._prec == 15 assert type(Float('1.0', precision=Integer(15))._prec) == int assert sympify(srepr(Float('1.0', precision=15))) == Float('1.0', precision=15) def test_numpy_to_float(): from sympy.testing.pytest import skip from sympy.external import import_module np = import_module('numpy') if not np: skip('numpy not installed. Abort numpy tests.') def check_prec_and_relerr(npval, ratval): prec = np.finfo(npval).nmant + 1 x = Float(npval) assert x._prec == prec y = Float(ratval, precision=prec) assert abs((x - y)/y) < 2**(-(prec + 1)) check_prec_and_relerr(np.float16(2.0/3), Rational(2, 3)) check_prec_and_relerr(np.float32(2.0/3), Rational(2, 3)) check_prec_and_relerr(np.float64(2.0/3), Rational(2, 3)) # extended precision, on some arch/compilers: x = np.longdouble(2)/3 check_prec_and_relerr(x, Rational(2, 3)) y = Float(x, precision=10) assert same_and_same_prec(y, Float(Rational(2, 3), precision=10)) raises(TypeError, lambda: Float(np.complex64(1+2j))) raises(TypeError, lambda: Float(np.complex128(1+2j))) def test_Integer_ceiling_floor(): a = Integer(4) assert a.floor() == a assert a.ceiling() == a def test_ComplexInfinity(): assert zoo.floor() is zoo assert zoo.ceiling() is zoo assert zoo**zoo is S.NaN def test_Infinity_floor_ceiling_power(): assert oo.floor() is oo assert oo.ceiling() is oo assert oo**S.NaN is S.NaN assert oo**zoo is S.NaN def test_One_power(): assert S.One**12 is S.One assert S.NegativeOne**S.NaN is S.NaN def test_NegativeInfinity(): assert (-oo).floor() is -oo assert (-oo).ceiling() is -oo assert (-oo)**11 is -oo assert (-oo)**12 is oo def test_issue_6133(): raises(TypeError, lambda: (-oo < None)) raises(TypeError, lambda: (S(-2) < None)) raises(TypeError, lambda: (oo < None)) raises(TypeError, lambda: (oo > None)) raises(TypeError, lambda: (S(2) < None)) def test_abc(): x = numbers.Float(5) assert(isinstance(x, nums.Number)) assert(isinstance(x, numbers.Number)) assert(isinstance(x, nums.Real)) y = numbers.Rational(1, 3) assert(isinstance(y, nums.Number)) assert(y.numerator() == 1) assert(y.denominator() == 3) assert(isinstance(y, nums.Rational)) z = numbers.Integer(3) assert(isinstance(z, nums.Number)) def test_floordiv(): assert S(2)//S.Half == 4
007e8818080e6ca126c26cd7d3d764af002a28bda7d28f05f786163d5652309b
from sympy.core.basic import Basic from sympy.core.numbers import Rational from sympy.core.singleton import S, Singleton from sympy.core.compatibility import exec_ def test_Singleton(): global instantiated instantiated = 0 class MySingleton(Basic, metaclass=Singleton): def __new__(cls): global instantiated instantiated += 1 return Basic.__new__(cls) assert instantiated == 0 MySingleton() # force instantiation assert instantiated == 1 assert MySingleton() is not Basic() assert MySingleton() is MySingleton() assert S.MySingleton is MySingleton() assert instantiated == 1 class MySingleton_sub(MySingleton): pass assert instantiated == 1 MySingleton_sub() assert instantiated == 2 assert MySingleton_sub() is not MySingleton() assert MySingleton_sub() is MySingleton_sub() def test_singleton_redefinition(): class TestSingleton(Basic, metaclass=Singleton): pass assert TestSingleton() is S.TestSingleton class TestSingleton(Basic, metaclass=Singleton): pass assert TestSingleton() is S.TestSingleton def test_names_in_namespace(): # Every singleton name should be accessible from the 'from sympy import *' # namespace in addition to the S object. However, it does not need to be # by the same name (e.g., oo instead of S.Infinity). # As a general rule, things should only be added to the singleton registry # if they are used often enough that code can benefit either from the # performance benefit of being able to use 'is' (this only matters in very # tight loops), or from the memory savings of having exactly one instance # (this matters for the numbers singletons, but very little else). The # singleton registry is already a bit overpopulated, and things cannot be # removed from it without breaking backwards compatibility. So if you got # here by adding something new to the singletons, ask yourself if it # really needs to be singletonized. Note that SymPy classes compare to one # another just fine, so Class() == Class() will give True even if each # Class() returns a new instance. Having unique instances is only # necessary for the above noted performance gains. It should not be needed # for any behavioral purposes. # If you determine that something really should be a singleton, it must be # accessible to sympify() without using 'S' (hence this test). Also, its # str printer should print a form that does not use S. This is because # sympify() disables attribute lookups by default for safety purposes. d = {} exec_('from sympy import *', d) for name in dir(S) + list(S._classes_to_install): if name.startswith('_'): continue if name == 'register': continue if isinstance(getattr(S, name), Rational): continue if getattr(S, name).__module__.startswith('sympy.physics'): continue if name in ['MySingleton', 'MySingleton_sub', 'TestSingleton']: # From the tests above continue if name == 'NegativeInfinity': # Accessible by -oo continue # Use is here to ensure it is the exact same object assert any(getattr(S, name) is i for i in d.values()), name
459add210500e288fe90ee4b2063f8a2d97c8281135eb2cee9d3f84911f9260c
from sympy import Symbol, var, Function, FunctionClass from sympy.testing.pytest import raises def test_var(): ns = {"var": var, "raises": raises} eval("var('a')", ns) assert ns["a"] == Symbol("a") eval("var('b bb cc zz _x')", ns) assert ns["b"] == Symbol("b") assert ns["bb"] == Symbol("bb") assert ns["cc"] == Symbol("cc") assert ns["zz"] == Symbol("zz") assert ns["_x"] == Symbol("_x") v = eval("var(['d', 'e', 'fg'])", ns) assert ns['d'] == Symbol('d') assert ns['e'] == Symbol('e') assert ns['fg'] == Symbol('fg') # check return value assert v != ['d', 'e', 'fg'] assert v == [Symbol('d'), Symbol('e'), Symbol('fg')] def test_var_return(): ns = {"var": var, "raises": raises} "raises(ValueError, lambda: var(''))" v2 = eval("var('q')", ns) v3 = eval("var('q p')", ns) assert v2 == Symbol('q') assert v3 == (Symbol('q'), Symbol('p')) def test_var_accepts_comma(): ns = {"var": var} v1 = eval("var('x y z')", ns) v2 = eval("var('x,y,z')", ns) v3 = eval("var('x,y z')", ns) assert v1 == v2 assert v1 == v3 def test_var_keywords(): ns = {"var": var} eval("var('x y', real=True)", ns) assert ns['x'].is_real and ns['y'].is_real def test_var_cls(): ns = {"var": var, "Function": Function} eval("var('f', cls=Function)", ns) assert isinstance(ns['f'], FunctionClass) eval("var('g,h', cls=Function)", ns) assert isinstance(ns['g'], FunctionClass) assert isinstance(ns['h'], FunctionClass)
fc3ad267b1795c93705ed673e0beb6b9feca28383b47cf5e4444eb72cbc054b3
from sympy import (Lambda, Symbol, Function, Derivative, Subs, sqrt, log, exp, Rational, Float, sin, cos, acos, diff, I, re, im, E, expand, pi, O, Sum, S, polygamma, loggamma, expint, Tuple, Dummy, Eq, Expr, symbols, nfloat, Piecewise, Indexed, Matrix, Basic, Dict, oo, zoo, nan, Pow) from sympy.core.basic import _aresame from sympy.core.cache import clear_cache from sympy.core.expr import unchanged from sympy.core.function import (PoleError, _mexpand, arity, BadSignatureError, BadArgumentsError) from sympy.core.sympify import sympify from sympy.matrices import MutableMatrix, ImmutableMatrix from sympy.sets.sets import FiniteSet from sympy.solvers.solveset import solveset from sympy.tensor.array import NDimArray from sympy.utilities.iterables import subsets, variations from sympy.testing.pytest import XFAIL, raises, warns_deprecated_sympy from sympy.abc import t, w, x, y, z f, g, h = symbols('f g h', cls=Function) _xi_1, _xi_2, _xi_3 = [Dummy() for i in range(3)] def test_f_expand_complex(): x = Symbol('x', real=True) assert f(x).expand(complex=True) == I*im(f(x)) + re(f(x)) assert exp(x).expand(complex=True) == exp(x) assert exp(I*x).expand(complex=True) == cos(x) + I*sin(x) assert exp(z).expand(complex=True) == cos(im(z))*exp(re(z)) + \ I*sin(im(z))*exp(re(z)) def test_bug1(): e = sqrt(-log(w)) assert e.subs(log(w), -x) == sqrt(x) e = sqrt(-5*log(w)) assert e.subs(log(w), -x) == sqrt(5*x) def test_general_function(): nu = Function('nu') e = nu(x) edx = e.diff(x) edy = e.diff(y) edxdx = e.diff(x).diff(x) edxdy = e.diff(x).diff(y) assert e == nu(x) assert edx != nu(x) assert edx == diff(nu(x), x) assert edy == 0 assert edxdx == diff(diff(nu(x), x), x) assert edxdy == 0 def test_general_function_nullary(): nu = Function('nu') e = nu() edx = e.diff(x) edxdx = e.diff(x).diff(x) assert e == nu() assert edx != nu() assert edx == 0 assert edxdx == 0 def test_derivative_subs_bug(): e = diff(g(x), x) assert e.subs(g(x), f(x)) != e assert e.subs(g(x), f(x)) == Derivative(f(x), x) assert e.subs(g(x), -f(x)) == Derivative(-f(x), x) assert e.subs(x, y) == Derivative(g(y), y) def test_derivative_subs_self_bug(): d = diff(f(x), x) assert d.subs(d, y) == y def test_derivative_linearity(): assert diff(-f(x), x) == -diff(f(x), x) assert diff(8*f(x), x) == 8*diff(f(x), x) assert diff(8*f(x), x) != 7*diff(f(x), x) assert diff(8*f(x)*x, x) == 8*f(x) + 8*x*diff(f(x), x) assert diff(8*f(x)*y*x, x).expand() == 8*y*f(x) + 8*y*x*diff(f(x), x) def test_derivative_evaluate(): assert Derivative(sin(x), x) != diff(sin(x), x) assert Derivative(sin(x), x).doit() == diff(sin(x), x) assert Derivative(Derivative(f(x), x), x) == diff(f(x), x, x) assert Derivative(sin(x), x, 0) == sin(x) assert Derivative(sin(x), (x, y), (x, -y)) == sin(x) def test_diff_symbols(): assert diff(f(x, y, z), x, y, z) == Derivative(f(x, y, z), x, y, z) assert diff(f(x, y, z), x, x, x) == Derivative(f(x, y, z), x, x, x) == Derivative(f(x, y, z), (x, 3)) assert diff(f(x, y, z), x, 3) == Derivative(f(x, y, z), x, 3) # issue 5028 assert [diff(-z + x/y, sym) for sym in (z, x, y)] == [-1, 1/y, -x/y**2] assert diff(f(x, y, z), x, y, z, 2) == Derivative(f(x, y, z), x, y, z, z) assert diff(f(x, y, z), x, y, z, 2, evaluate=False) == \ Derivative(f(x, y, z), x, y, z, z) assert Derivative(f(x, y, z), x, y, z)._eval_derivative(z) == \ Derivative(f(x, y, z), x, y, z, z) assert Derivative(Derivative(f(x, y, z), x), y)._eval_derivative(z) == \ Derivative(f(x, y, z), x, y, z) raises(TypeError, lambda: cos(x).diff((x, y)).variables) assert cos(x).diff((x, y))._wrt_variables == [x] def test_Function(): class myfunc(Function): @classmethod def eval(cls): # zero args return assert myfunc.nargs == FiniteSet(0) assert myfunc().nargs == FiniteSet(0) raises(TypeError, lambda: myfunc(x).nargs) class myfunc(Function): @classmethod def eval(cls, x): # one arg return assert myfunc.nargs == FiniteSet(1) assert myfunc(x).nargs == FiniteSet(1) raises(TypeError, lambda: myfunc(x, y).nargs) class myfunc(Function): @classmethod def eval(cls, *x): # star args return assert myfunc.nargs == S.Naturals0 assert myfunc(x).nargs == S.Naturals0 def test_nargs(): f = Function('f') assert f.nargs == S.Naturals0 assert f(1).nargs == S.Naturals0 assert Function('f', nargs=2)(1, 2).nargs == FiniteSet(2) assert sin.nargs == FiniteSet(1) assert sin(2).nargs == FiniteSet(1) assert log.nargs == FiniteSet(1, 2) assert log(2).nargs == FiniteSet(1, 2) assert Function('f', nargs=2).nargs == FiniteSet(2) assert Function('f', nargs=0).nargs == FiniteSet(0) assert Function('f', nargs=(0, 1)).nargs == FiniteSet(0, 1) assert Function('f', nargs=None).nargs == S.Naturals0 raises(ValueError, lambda: Function('f', nargs=())) def test_nargs_inheritance(): class f1(Function): nargs = 2 class f2(f1): pass class f3(f2): pass class f4(f3): nargs = 1,2 class f5(f4): pass class f6(f5): pass class f7(f6): nargs=None class f8(f7): pass class f9(f8): pass class f10(f9): nargs = 1 class f11(f10): pass assert f1.nargs == FiniteSet(2) assert f2.nargs == FiniteSet(2) assert f3.nargs == FiniteSet(2) assert f4.nargs == FiniteSet(1, 2) assert f5.nargs == FiniteSet(1, 2) assert f6.nargs == FiniteSet(1, 2) assert f7.nargs == S.Naturals0 assert f8.nargs == S.Naturals0 assert f9.nargs == S.Naturals0 assert f10.nargs == FiniteSet(1) assert f11.nargs == FiniteSet(1) def test_arity(): f = lambda x, y: 1 assert arity(f) == 2 def f(x, y, z=None): pass assert arity(f) == (2, 3) assert arity(lambda *x: x) is None assert arity(log) == (1, 2) def test_Lambda(): e = Lambda(x, x**2) assert e(4) == 16 assert e(x) == x**2 assert e(y) == y**2 assert Lambda((), 42)() == 42 assert unchanged(Lambda, (), 42) assert Lambda((), 42) != Lambda((), 43) assert Lambda((), f(x))() == f(x) assert Lambda((), 42).nargs == FiniteSet(0) assert unchanged(Lambda, (x,), x**2) assert Lambda(x, x**2) == Lambda((x,), x**2) assert Lambda(x, x**2) == Lambda(y, y**2) assert Lambda(x, x**2) != Lambda(y, y**2 + 1) assert Lambda((x, y), x**y) == Lambda((y, x), y**x) assert Lambda((x, y), x**y) != Lambda((x, y), y**x) assert Lambda((x, y), x**y)(x, y) == x**y assert Lambda((x, y), x**y)(3, 3) == 3**3 assert Lambda((x, y), x**y)(x, 3) == x**3 assert Lambda((x, y), x**y)(3, y) == 3**y assert Lambda(x, f(x))(x) == f(x) assert Lambda(x, x**2)(e(x)) == x**4 assert e(e(x)) == x**4 x1, x2 = (Indexed('x', i) for i in (1, 2)) assert Lambda((x1, x2), x1 + x2)(x, y) == x + y assert Lambda((x, y), x + y).nargs == FiniteSet(2) p = x, y, z, t assert Lambda(p, t*(x + y + z))(*p) == t * (x + y + z) assert Lambda(x, 2*x) + Lambda(y, 2*y) == 2*Lambda(x, 2*x) assert Lambda(x, 2*x) not in [ Lambda(x, x) ] raises(BadSignatureError, lambda: Lambda(1, x)) assert Lambda(x, 1)(1) is S.One raises(BadSignatureError, lambda: Lambda((x, x), x + 2)) raises(BadSignatureError, lambda: Lambda(((x, x), y), x)) raises(BadSignatureError, lambda: Lambda(((y, x), x), x)) raises(BadSignatureError, lambda: Lambda(((y, 1), 2), x)) with warns_deprecated_sympy(): assert Lambda([x, y], x+y) == Lambda((x, y), x+y) flam = Lambda( ((x, y),) , x + y) assert flam((2, 3)) == 5 flam = Lambda( ((x, y), z) , x + y + z) assert flam((2, 3), 1) == 6 flam = Lambda( (((x,y),z),) , x+y+z) assert flam( ((2,3),1) ) == 6 raises(BadArgumentsError, lambda: flam(1, 2, 3)) flam = Lambda( (x,), (x, x)) assert flam(1,) == (1, 1) assert flam((1,)) == ((1,), (1,)) flam = Lambda( ((x,),) , (x, x)) raises(BadArgumentsError, lambda: flam(1)) assert flam((1,)) == (1, 1) # Previously TypeError was raised so this is potentially needed for # backwards compatibility. assert issubclass(BadSignatureError, TypeError) assert issubclass(BadArgumentsError, TypeError) # These are tested to see they don't raise: hash(Lambda(x, 2*x)) hash(Lambda(x, x)) # IdentityFunction subclass def test_IdentityFunction(): assert Lambda(x, x) is Lambda(y, y) is S.IdentityFunction assert Lambda(x, 2*x) is not S.IdentityFunction assert Lambda((x, y), x) is not S.IdentityFunction def test_Lambda_symbols(): assert Lambda(x, 2*x).free_symbols == set() assert Lambda(x, x*y).free_symbols == {y} assert Lambda((), 42).free_symbols == set() assert Lambda((), x*y).free_symbols == {x,y} def test_functionclas_symbols(): assert f.free_symbols == set() def test_Lambda_arguments(): raises(TypeError, lambda: Lambda(x, 2*x)(x, y)) raises(TypeError, lambda: Lambda((x, y), x + y)(x)) raises(TypeError, lambda: Lambda((), 42)(x)) def test_Lambda_equality(): assert Lambda(x, 2*x) == Lambda(y, 2*y) # although variables are casts as Dummies, the expressions # should still compare equal assert Lambda((x, y), 2*x) == Lambda((x, y), 2*x) assert Lambda(x, 2*x) != Lambda((x, y), 2*x) assert Lambda(x, 2*x) != 2*x def test_Subs(): assert Subs(1, (), ()) is S.One # check null subs influence on hashing assert Subs(x, y, z) != Subs(x, y, 1) # neutral subs works assert Subs(x, x, 1).subs(x, y).has(y) # self mapping var/point assert Subs(Derivative(f(x), (x, 2)), x, x).doit() == f(x).diff(x, x) assert Subs(x, x, 0).has(x) # it's a structural answer assert not Subs(x, x, 0).free_symbols assert Subs(Subs(x + y, x, 2), y, 1) == Subs(x + y, (x, y), (2, 1)) assert Subs(x, (x,), (0,)) == Subs(x, x, 0) assert Subs(x, x, 0) == Subs(y, y, 0) assert Subs(x, x, 0).subs(x, 1) == Subs(x, x, 0) assert Subs(y, x, 0).subs(y, 1) == Subs(1, x, 0) assert Subs(f(x), x, 0).doit() == f(0) assert Subs(f(x**2), x**2, 0).doit() == f(0) assert Subs(f(x, y, z), (x, y, z), (0, 1, 1)) != \ Subs(f(x, y, z), (x, y, z), (0, 0, 1)) assert Subs(x, y, 2).subs(x, y).doit() == 2 assert Subs(f(x, y), (x, y, z), (0, 1, 1)) != \ Subs(f(x, y) + z, (x, y, z), (0, 1, 0)) assert Subs(f(x, y), (x, y), (0, 1)).doit() == f(0, 1) assert Subs(Subs(f(x, y), x, 0), y, 1).doit() == f(0, 1) raises(ValueError, lambda: Subs(f(x, y), (x, y), (0, 0, 1))) raises(ValueError, lambda: Subs(f(x, y), (x, x, y), (0, 0, 1))) assert len(Subs(f(x, y), (x, y), (0, 1)).variables) == 2 assert Subs(f(x, y), (x, y), (0, 1)).point == Tuple(0, 1) assert Subs(f(x), x, 0) == Subs(f(y), y, 0) assert Subs(f(x, y), (x, y), (0, 1)) == Subs(f(x, y), (y, x), (1, 0)) assert Subs(f(x)*y, (x, y), (0, 1)) == Subs(f(y)*x, (y, x), (0, 1)) assert Subs(f(x)*y, (x, y), (1, 1)) == Subs(f(y)*x, (x, y), (1, 1)) assert Subs(f(x), x, 0).subs(x, 1).doit() == f(0) assert Subs(f(x), x, y).subs(y, 0) == Subs(f(x), x, 0) assert Subs(y*f(x), x, y).subs(y, 2) == Subs(2*f(x), x, 2) assert (2 * Subs(f(x), x, 0)).subs(Subs(f(x), x, 0), y) == 2*y assert Subs(f(x), x, 0).free_symbols == set([]) assert Subs(f(x, y), x, z).free_symbols == {y, z} assert Subs(f(x).diff(x), x, 0).doit(), Subs(f(x).diff(x), x, 0) assert Subs(1 + f(x).diff(x), x, 0).doit(), 1 + Subs(f(x).diff(x), x, 0) assert Subs(y*f(x, y).diff(x), (x, y), (0, 2)).doit() == \ 2*Subs(Derivative(f(x, 2), x), x, 0) assert Subs(y**2*f(x), x, 0).diff(y) == 2*y*f(0) e = Subs(y**2*f(x), x, y) assert e.diff(y) == e.doit().diff(y) == y**2*Derivative(f(y), y) + 2*y*f(y) assert Subs(f(x), x, 0) + Subs(f(x), x, 0) == 2*Subs(f(x), x, 0) e1 = Subs(z*f(x), x, 1) e2 = Subs(z*f(y), y, 1) assert e1 + e2 == 2*e1 assert e1.__hash__() == e2.__hash__() assert Subs(z*f(x + 1), x, 1) not in [ e1, e2 ] assert Derivative(f(x), x).subs(x, g(x)) == Derivative(f(g(x)), g(x)) assert Derivative(f(x), x).subs(x, x + y) == Subs(Derivative(f(x), x), x, x + y) assert Subs(f(x)*cos(y) + z, (x, y), (0, pi/3)).n(2) == \ Subs(f(x)*cos(y) + z, (x, y), (0, pi/3)).evalf(2) == \ z + Rational('1/2').n(2)*f(0) assert f(x).diff(x).subs(x, 0).subs(x, y) == f(x).diff(x).subs(x, 0) assert (x*f(x).diff(x).subs(x, 0)).subs(x, y) == y*f(x).diff(x).subs(x, 0) assert Subs(Derivative(g(x)**2, g(x), x), g(x), exp(x) ).doit() == 2*exp(x) assert Subs(Derivative(g(x)**2, g(x), x), g(x), exp(x) ).doit(deep=False) == 2*Derivative(exp(x), x) assert Derivative(f(x, g(x)), x).doit() == Derivative( f(x, g(x)), g(x))*Derivative(g(x), x) + Subs(Derivative( f(y, g(x)), y), y, x) def test_doitdoit(): done = Derivative(f(x, g(x)), x, g(x)).doit() assert done == done.doit() @XFAIL def test_Subs2(): # this reflects a limitation of subs(), probably won't fix assert Subs(f(x), x**2, x).doit() == f(sqrt(x)) def test_expand_function(): assert expand(x + y) == x + y assert expand(x + y, complex=True) == I*im(x) + I*im(y) + re(x) + re(y) assert expand((x + y)**11, modulus=11) == x**11 + y**11 def test_function_comparable(): assert sin(x).is_comparable is False assert cos(x).is_comparable is False assert sin(Float('0.1')).is_comparable is True assert cos(Float('0.1')).is_comparable is True assert sin(E).is_comparable is True assert cos(E).is_comparable is True assert sin(Rational(1, 3)).is_comparable is True assert cos(Rational(1, 3)).is_comparable is True def test_function_comparable_infinities(): assert sin(oo).is_comparable is False assert sin(-oo).is_comparable is False assert sin(zoo).is_comparable is False assert sin(nan).is_comparable is False def test_deriv1(): # These all require derivatives evaluated at a point (issue 4719) to work. # See issue 4624 assert f(2*x).diff(x) == 2*Subs(Derivative(f(x), x), x, 2*x) assert (f(x)**3).diff(x) == 3*f(x)**2*f(x).diff(x) assert (f(2*x)**3).diff(x) == 6*f(2*x)**2*Subs( Derivative(f(x), x), x, 2*x) assert f(2 + x).diff(x) == Subs(Derivative(f(x), x), x, x + 2) assert f(2 + 3*x).diff(x) == 3*Subs( Derivative(f(x), x), x, 3*x + 2) assert f(3*sin(x)).diff(x) == 3*cos(x)*Subs( Derivative(f(x), x), x, 3*sin(x)) # See issue 8510 assert f(x, x + z).diff(x) == ( Subs(Derivative(f(y, x + z), y), y, x) + Subs(Derivative(f(x, y), y), y, x + z)) assert f(x, x**2).diff(x) == ( 2*x*Subs(Derivative(f(x, y), y), y, x**2) + Subs(Derivative(f(y, x**2), y), y, x)) # but Subs is not always necessary assert f(x, g(y)).diff(g(y)) == Derivative(f(x, g(y)), g(y)) def test_deriv2(): assert (x**3).diff(x) == 3*x**2 assert (x**3).diff(x, evaluate=False) != 3*x**2 assert (x**3).diff(x, evaluate=False) == Derivative(x**3, x) assert diff(x**3, x) == 3*x**2 assert diff(x**3, x, evaluate=False) != 3*x**2 assert diff(x**3, x, evaluate=False) == Derivative(x**3, x) def test_func_deriv(): assert f(x).diff(x) == Derivative(f(x), x) # issue 4534 assert f(x, y).diff(x, y) - f(x, y).diff(y, x) == 0 assert Derivative(f(x, y), x, y).args[1:] == ((x, 1), (y, 1)) assert Derivative(f(x, y), y, x).args[1:] == ((y, 1), (x, 1)) assert (Derivative(f(x, y), x, y) - Derivative(f(x, y), y, x)).doit() == 0 def test_suppressed_evaluation(): a = sin(0, evaluate=False) assert a != 0 assert a.func is sin assert a.args == (0,) def test_function_evalf(): def eq(a, b, eps): return abs(a - b) < eps assert eq(sin(1).evalf(15), Float("0.841470984807897"), 1e-13) assert eq( sin(2).evalf(25), Float("0.9092974268256816953960199", 25), 1e-23) assert eq(sin(1 + I).evalf( 15), Float("1.29845758141598") + Float("0.634963914784736")*I, 1e-13) assert eq(exp(1 + I).evalf(15), Float( "1.46869393991588") + Float("2.28735528717884239")*I, 1e-13) assert eq(exp(-0.5 + 1.5*I).evalf(15), Float( "0.0429042815937374") + Float("0.605011292285002")*I, 1e-13) assert eq(log(pi + sqrt(2)*I).evalf( 15), Float("1.23699044022052") + Float("0.422985442737893")*I, 1e-13) assert eq(cos(100).evalf(15), Float("0.86231887228768"), 1e-13) def test_extensibility_eval(): class MyFunc(Function): @classmethod def eval(cls, *args): return (0, 0, 0) assert MyFunc(0) == (0, 0, 0) def test_function_non_commutative(): x = Symbol('x', commutative=False) assert f(x).is_commutative is False assert sin(x).is_commutative is False assert exp(x).is_commutative is False assert log(x).is_commutative is False assert f(x).is_complex is False assert sin(x).is_complex is False assert exp(x).is_complex is False assert log(x).is_complex is False def test_function_complex(): x = Symbol('x', complex=True) xzf = Symbol('x', complex=True, zero=False) assert f(x).is_commutative is True assert sin(x).is_commutative is True assert exp(x).is_commutative is True assert log(x).is_commutative is True assert f(x).is_complex is None assert sin(x).is_complex is True assert exp(x).is_complex is True assert log(x).is_complex is None assert log(xzf).is_complex is True def test_function__eval_nseries(): n = Symbol('n') assert sin(x)._eval_nseries(x, 2, None) == x + O(x**2) assert sin(x + 1)._eval_nseries(x, 2, None) == x*cos(1) + sin(1) + O(x**2) assert sin(pi*(1 - x))._eval_nseries(x, 2, None) == pi*x + O(x**2) assert acos(1 - x**2)._eval_nseries(x, 2, None) == sqrt(2)*sqrt(x**2) + O(x**2) assert polygamma(n, x + 1)._eval_nseries(x, 2, None) == \ polygamma(n, 1) + polygamma(n + 1, 1)*x + O(x**2) raises(PoleError, lambda: sin(1/x)._eval_nseries(x, 2, None)) assert acos(1 - x)._eval_nseries(x, 2, None) == sqrt(2)*sqrt(x) + O(x) assert acos(1 + x)._eval_nseries(x, 2, None) == sqrt(2)*sqrt(-x) + O(x) # XXX: wrong, branch cuts assert loggamma(1/x)._eval_nseries(x, 0, None) == \ log(x)/2 - log(x)/x - 1/x + O(1, x) assert loggamma(log(1/x)).nseries(x, n=1, logx=y) == loggamma(-y) # issue 6725: assert expint(Rational(3, 2), -x)._eval_nseries(x, 5, None) == \ 2 - 2*sqrt(pi)*sqrt(-x) - 2*x - x**2/3 - x**3/15 - x**4/84 + O(x**5) assert sin(sqrt(x))._eval_nseries(x, 3, None) == \ sqrt(x) - x**Rational(3, 2)/6 + x**Rational(5, 2)/120 + O(x**3) def test_doit(): n = Symbol('n', integer=True) f = Sum(2 * n * x, (n, 1, 3)) d = Derivative(f, x) assert d.doit() == 12 assert d.doit(deep=False) == Sum(2*n, (n, 1, 3)) def test_evalf_default(): from sympy.functions.special.gamma_functions import polygamma assert type(sin(4.0)) == Float assert type(re(sin(I + 1.0))) == Float assert type(im(sin(I + 1.0))) == Float assert type(sin(4)) == sin assert type(polygamma(2.0, 4.0)) == Float assert type(sin(Rational(1, 4))) == sin def test_issue_5399(): args = [x, y, S(2), S.Half] def ok(a): """Return True if the input args for diff are ok""" if not a: return False if a[0].is_Symbol is False: return False s_at = [i for i in range(len(a)) if a[i].is_Symbol] n_at = [i for i in range(len(a)) if not a[i].is_Symbol] # every symbol is followed by symbol or int # every number is followed by a symbol return (all(a[i + 1].is_Symbol or a[i + 1].is_Integer for i in s_at if i + 1 < len(a)) and all(a[i + 1].is_Symbol for i in n_at if i + 1 < len(a))) eq = x**10*y**8 for a in subsets(args): for v in variations(a, len(a)): if ok(v): eq.diff(*v) # does not raise else: raises(ValueError, lambda: eq.diff(*v)) def test_derivative_numerically(): from random import random z0 = random() + I*random() assert abs(Derivative(sin(x), x).doit_numerically(z0) - cos(z0)) < 1e-15 def test_fdiff_argument_index_error(): from sympy.core.function import ArgumentIndexError class myfunc(Function): nargs = 1 # define since there is no eval routine def fdiff(self, idx): raise ArgumentIndexError mf = myfunc(x) assert mf.diff(x) == Derivative(mf, x) raises(TypeError, lambda: myfunc(x, x)) def test_deriv_wrt_function(): x = f(t) xd = diff(x, t) xdd = diff(xd, t) y = g(t) yd = diff(y, t) assert diff(x, t) == xd assert diff(2 * x + 4, t) == 2 * xd assert diff(2 * x + 4 + y, t) == 2 * xd + yd assert diff(2 * x + 4 + y * x, t) == 2 * xd + x * yd + xd * y assert diff(2 * x + 4 + y * x, x) == 2 + y assert (diff(4 * x**2 + 3 * x + x * y, t) == 3 * xd + x * yd + xd * y + 8 * x * xd) assert (diff(4 * x**2 + 3 * xd + x * y, t) == 3 * xdd + x * yd + xd * y + 8 * x * xd) assert diff(4 * x**2 + 3 * xd + x * y, xd) == 3 assert diff(4 * x**2 + 3 * xd + x * y, xdd) == 0 assert diff(sin(x), t) == xd * cos(x) assert diff(exp(x), t) == xd * exp(x) assert diff(sqrt(x), t) == xd / (2 * sqrt(x)) def test_diff_wrt_value(): assert Expr()._diff_wrt is False assert x._diff_wrt is True assert f(x)._diff_wrt is True assert Derivative(f(x), x)._diff_wrt is True assert Derivative(x**2, x)._diff_wrt is False def test_diff_wrt(): fx = f(x) dfx = diff(f(x), x) ddfx = diff(f(x), x, x) assert diff(sin(fx) + fx**2, fx) == cos(fx) + 2*fx assert diff(sin(dfx) + dfx**2, dfx) == cos(dfx) + 2*dfx assert diff(sin(ddfx) + ddfx**2, ddfx) == cos(ddfx) + 2*ddfx assert diff(fx**2, dfx) == 0 assert diff(fx**2, ddfx) == 0 assert diff(dfx**2, fx) == 0 assert diff(dfx**2, ddfx) == 0 assert diff(ddfx**2, dfx) == 0 assert diff(fx*dfx*ddfx, fx) == dfx*ddfx assert diff(fx*dfx*ddfx, dfx) == fx*ddfx assert diff(fx*dfx*ddfx, ddfx) == fx*dfx assert diff(f(x), x).diff(f(x)) == 0 assert (sin(f(x)) - cos(diff(f(x), x))).diff(f(x)) == cos(f(x)) assert diff(sin(fx), fx, x) == diff(sin(fx), x, fx) # Chain rule cases assert f(g(x)).diff(x) == \ Derivative(g(x), x)*Derivative(f(g(x)), g(x)) assert diff(f(g(x), h(y)), x) == \ Derivative(g(x), x)*Derivative(f(g(x), h(y)), g(x)) assert diff(f(g(x), h(x)), x) == ( Derivative(f(g(x), h(x)), g(x))*Derivative(g(x), x) + Derivative(f(g(x), h(x)), h(x))*Derivative(h(x), x)) assert f( sin(x)).diff(x) == cos(x)*Subs(Derivative(f(x), x), x, sin(x)) assert diff(f(g(x)), g(x)) == Derivative(f(g(x)), g(x)) def test_diff_wrt_func_subs(): assert f(g(x)).diff(x).subs(g, Lambda(x, 2*x)).doit() == f(2*x).diff(x) def test_subs_in_derivative(): expr = sin(x*exp(y)) u = Function('u') v = Function('v') assert Derivative(expr, y).subs(expr, y) == Derivative(y, y) assert Derivative(expr, y).subs(y, x).doit() == \ Derivative(expr, y).doit().subs(y, x) assert Derivative(f(x, y), y).subs(y, x) == Subs(Derivative(f(x, y), y), y, x) assert Derivative(f(x, y), y).subs(x, y) == Subs(Derivative(f(x, y), y), x, y) assert Derivative(f(x, y), y).subs(y, g(x, y)) == Subs(Derivative(f(x, y), y), y, g(x, y)).doit() assert Derivative(f(x, y), y).subs(x, g(x, y)) == Subs(Derivative(f(x, y), y), x, g(x, y)) assert Derivative(f(x, y), g(y)).subs(x, g(x, y)) == Derivative(f(g(x, y), y), g(y)) assert Derivative(f(u(x), h(y)), h(y)).subs(h(y), g(x, y)) == \ Subs(Derivative(f(u(x), h(y)), h(y)), h(y), g(x, y)).doit() assert Derivative(f(x, y), y).subs(y, z) == Derivative(f(x, z), z) assert Derivative(f(x, y), y).subs(y, g(y)) == Derivative(f(x, g(y)), g(y)) assert Derivative(f(g(x), h(y)), h(y)).subs(h(y), u(y)) == \ Derivative(f(g(x), u(y)), u(y)) assert Derivative(f(x, f(x, x)), f(x, x)).subs( f, Lambda((x, y), x + y)) == Subs( Derivative(z + x, z), z, 2*x) assert Subs(Derivative(f(f(x)), x), f, cos).doit() == sin(x)*sin(cos(x)) assert Subs(Derivative(f(f(x)), f(x)), f, cos).doit() == -sin(cos(x)) # Issue 13791. No comparison (it's a long formula) but this used to raise an exception. assert isinstance(v(x, y, u(x, y)).diff(y).diff(x).diff(y), Expr) # This is also related to issues 13791 and 13795; issue 15190 F = Lambda((x, y), exp(2*x + 3*y)) abstract = f(x, f(x, x)).diff(x, 2) concrete = F(x, F(x, x)).diff(x, 2) assert (abstract.subs(f, F).doit() - concrete).simplify() == 0 # don't introduce a new symbol if not necessary assert x in f(x).diff(x).subs(x, 0).atoms() # case (4) assert Derivative(f(x,f(x,y)), x, y).subs(x, g(y) ) == Subs(Derivative(f(x, f(x, y)), x, y), x, g(y)) assert Derivative(f(x, x), x).subs(x, 0 ) == Subs(Derivative(f(x, x), x), x, 0) # issue 15194 assert Derivative(f(y, g(x)), (x, z)).subs(z, x ) == Derivative(f(y, g(x)), (x, x)) df = f(x).diff(x) assert df.subs(df, 1) is S.One assert df.diff(df) is S.One dxy = Derivative(f(x, y), x, y) dyx = Derivative(f(x, y), y, x) assert dxy.subs(Derivative(f(x, y), y, x), 1) is S.One assert dxy.diff(dyx) is S.One assert Derivative(f(x, y), x, 2, y, 3).subs( dyx, g(x, y)) == Derivative(g(x, y), x, 1, y, 2) assert Derivative(f(x, x - y), y).subs(x, x + y) == Subs( Derivative(f(x, x - y), y), x, x + y) def test_diff_wrt_not_allowed(): # issue 7027 included for wrt in ( cos(x), re(x), x**2, x*y, 1 + x, Derivative(cos(x), x), Derivative(f(f(x)), x)): raises(ValueError, lambda: diff(f(x), wrt)) # if we don't differentiate wrt then don't raise error assert diff(exp(x*y), x*y, 0) == exp(x*y) def test_klein_gordon_lagrangian(): m = Symbol('m') phi = f(x, t) L = -(diff(phi, t)**2 - diff(phi, x)**2 - m**2*phi**2)/2 eqna = Eq( diff(L, phi) - diff(L, diff(phi, x), x) - diff(L, diff(phi, t), t), 0) eqnb = Eq(diff(phi, t, t) - diff(phi, x, x) + m**2*phi, 0) assert eqna == eqnb def test_sho_lagrangian(): m = Symbol('m') k = Symbol('k') x = f(t) L = m*diff(x, t)**2/2 - k*x**2/2 eqna = Eq(diff(L, x), diff(L, diff(x, t), t)) eqnb = Eq(-k*x, m*diff(x, t, t)) assert eqna == eqnb assert diff(L, x, t) == diff(L, t, x) assert diff(L, diff(x, t), t) == m*diff(x, t, 2) assert diff(L, t, diff(x, t)) == -k*x + m*diff(x, t, 2) def test_straight_line(): F = f(x) Fd = F.diff(x) L = sqrt(1 + Fd**2) assert diff(L, F) == 0 assert diff(L, Fd) == Fd/sqrt(1 + Fd**2) def test_sort_variable(): vsort = Derivative._sort_variable_count def vsort0(*v, **kw): reverse = kw.get('reverse', False) return [i[0] for i in vsort([(i, 0) for i in ( reversed(v) if reverse else v)])] for R in range(2): assert vsort0(y, x, reverse=R) == [x, y] assert vsort0(f(x), x, reverse=R) == [x, f(x)] assert vsort0(f(y), f(x), reverse=R) == [f(x), f(y)] assert vsort0(g(x), f(y), reverse=R) == [f(y), g(x)] assert vsort0(f(x, y), f(x), reverse=R) == [f(x), f(x, y)] fx = f(x).diff(x) assert vsort0(fx, y, reverse=R) == [y, fx] fy = f(y).diff(y) assert vsort0(fy, fx, reverse=R) == [fx, fy] fxx = fx.diff(x) assert vsort0(fxx, fx, reverse=R) == [fx, fxx] assert vsort0(Basic(x), f(x), reverse=R) == [f(x), Basic(x)] assert vsort0(Basic(y), Basic(x), reverse=R) == [Basic(x), Basic(y)] assert vsort0(Basic(y, z), Basic(x), reverse=R) == [ Basic(x), Basic(y, z)] assert vsort0(fx, x, reverse=R) == [ x, fx] if R else [fx, x] assert vsort0(Basic(x), x, reverse=R) == [ x, Basic(x)] if R else [Basic(x), x] assert vsort0(Basic(f(x)), f(x), reverse=R) == [ f(x), Basic(f(x))] if R else [Basic(f(x)), f(x)] assert vsort0(Basic(x, z), Basic(x), reverse=R) == [ Basic(x), Basic(x, z)] if R else [Basic(x, z), Basic(x)] assert vsort([]) == [] assert _aresame(vsort([(x, 1)]), [Tuple(x, 1)]) assert vsort([(x, y), (x, z)]) == [(x, y + z)] assert vsort([(y, 1), (x, 1 + y)]) == [(x, 1 + y), (y, 1)] # coverage complete; legacy tests below assert vsort([(x, 3), (y, 2), (z, 1)]) == [(x, 3), (y, 2), (z, 1)] assert vsort([(h(x), 1), (g(x), 1), (f(x), 1)]) == [ (f(x), 1), (g(x), 1), (h(x), 1)] assert vsort([(z, 1), (y, 2), (x, 3), (h(x), 1), (g(x), 1), (f(x), 1)]) == [(x, 3), (y, 2), (z, 1), (f(x), 1), (g(x), 1), (h(x), 1)] assert vsort([(x, 1), (f(x), 1), (y, 1), (f(y), 1)]) == [(x, 1), (y, 1), (f(x), 1), (f(y), 1)] assert vsort([(y, 1), (x, 2), (g(x), 1), (f(x), 1), (z, 1), (h(x), 1), (y, 2), (x, 1)]) == [(x, 3), (y, 3), (z, 1), (f(x), 1), (g(x), 1), (h(x), 1)] assert vsort([(z, 1), (y, 1), (f(x), 1), (x, 1), (f(x), 1), (g(x), 1)]) == [(x, 1), (y, 1), (z, 1), (f(x), 2), (g(x), 1)] assert vsort([(z, 1), (y, 2), (f(x), 1), (x, 2), (f(x), 2), (g(x), 1), (z, 2), (z, 1), (y, 1), (x, 1)]) == [(x, 3), (y, 3), (z, 4), (f(x), 3), (g(x), 1)] assert vsort(((y, 2), (x, 1), (y, 1), (x, 1))) == [(x, 2), (y, 3)] assert isinstance(vsort([(x, 3), (y, 2), (z, 1)])[0], Tuple) assert vsort([(x, 1), (f(x), 1), (x, 1)]) == [(x, 2), (f(x), 1)] assert vsort([(y, 2), (x, 3), (z, 1)]) == [(x, 3), (y, 2), (z, 1)] assert vsort([(h(y), 1), (g(x), 1), (f(x), 1)]) == [ (f(x), 1), (g(x), 1), (h(y), 1)] assert vsort([(x, 1), (y, 1), (x, 1)]) == [(x, 2), (y, 1)] assert vsort([(f(x), 1), (f(y), 1), (f(x), 1)]) == [ (f(x), 2), (f(y), 1)] dfx = f(x).diff(x) self = [(dfx, 1), (x, 1)] assert vsort(self) == self assert vsort([ (dfx, 1), (y, 1), (f(x), 1), (x, 1), (f(y), 1), (x, 1)]) == [ (y, 1), (f(x), 1), (f(y), 1), (dfx, 1), (x, 2)] dfy = f(y).diff(y) assert vsort([(dfy, 1), (dfx, 1)]) == [(dfx, 1), (dfy, 1)] d2fx = dfx.diff(x) assert vsort([(d2fx, 1), (dfx, 1)]) == [(dfx, 1), (d2fx, 1)] def test_multiple_derivative(): # Issue #15007 assert f(x, y).diff(y, y, x, y, x ) == Derivative(f(x, y), (x, 2), (y, 3)) def test_unhandled(): class MyExpr(Expr): def _eval_derivative(self, s): if not s.name.startswith('xi'): return self else: return None eq = MyExpr(f(x), y, z) assert diff(eq, x, y, f(x), z) == Derivative(eq, f(x)) assert diff(eq, f(x), x) == Derivative(eq, f(x)) assert f(x, y).diff(x,(y, z)) == Derivative(f(x, y), x, (y, z)) assert f(x, y).diff(x,(y, 0)) == Derivative(f(x, y), x) def test_nfloat(): from sympy.core.basic import _aresame from sympy.polys.rootoftools import rootof x = Symbol("x") eq = x**Rational(4, 3) + 4*x**(S.One/3)/3 assert _aresame(nfloat(eq), x**Rational(4, 3) + (4.0/3)*x**(S.One/3)) assert _aresame(nfloat(eq, exponent=True), x**(4.0/3) + (4.0/3)*x**(1.0/3)) eq = x**Rational(4, 3) + 4*x**(x/3)/3 assert _aresame(nfloat(eq), x**Rational(4, 3) + (4.0/3)*x**(x/3)) big = 12345678901234567890 # specify precision to match value used in nfloat Float_big = Float(big, 15) assert _aresame(nfloat(big), Float_big) assert _aresame(nfloat(big*x), Float_big*x) assert _aresame(nfloat(x**big, exponent=True), x**Float_big) assert nfloat(cos(x + sqrt(2))) == cos(x + nfloat(sqrt(2))) # issue 6342 f = S('x*lamda + lamda**3*(x/2 + 1/2) + lamda**2 + 1/4') assert not any(a.free_symbols for a in solveset(f.subs(x, -0.139))) # issue 6632 assert nfloat(-100000*sqrt(2500000001) + 5000000001) == \ 9.99999999800000e-11 # issue 7122 eq = cos(3*x**4 + y)*rootof(x**5 + 3*x**3 + 1, 0) assert str(nfloat(eq, exponent=False, n=1)) == '-0.7*cos(3.0*x**4 + y)' # issue 10933 for ti in (dict, Dict): d = ti({S.Half: S.Half}) n = nfloat(d) assert isinstance(n, ti) assert _aresame(list(n.items()).pop(), (S.Half, Float(.5))) for ti in (dict, Dict): d = ti({S.Half: S.Half}) n = nfloat(d, dkeys=True) assert isinstance(n, ti) assert _aresame(list(n.items()).pop(), (Float(.5), Float(.5))) d = [S.Half] n = nfloat(d) assert type(n) is list assert _aresame(n[0], Float(.5)) assert _aresame(nfloat(Eq(x, S.Half)).rhs, Float(.5)) assert _aresame(nfloat(S(True)), S(True)) assert _aresame(nfloat(Tuple(S.Half))[0], Float(.5)) assert nfloat(Eq((3 - I)**2/2 + I, 0)) == S.false # pass along kwargs assert nfloat([{S.Half: x}], dkeys=True) == [{Float(0.5): x}] # Issue 17706 A = MutableMatrix([[1, 2], [3, 4]]) B = MutableMatrix( [[Float('1.0', precision=53), Float('2.0', precision=53)], [Float('3.0', precision=53), Float('4.0', precision=53)]]) assert _aresame(nfloat(A), B) A = ImmutableMatrix([[1, 2], [3, 4]]) B = ImmutableMatrix( [[Float('1.0', precision=53), Float('2.0', precision=53)], [Float('3.0', precision=53), Float('4.0', precision=53)]]) assert _aresame(nfloat(A), B) def test_issue_7068(): from sympy.abc import a, b f = Function('f') y1 = Dummy('y') y2 = Dummy('y') func1 = f(a + y1 * b) func2 = f(a + y2 * b) func1_y = func1.diff(y1) func2_y = func2.diff(y2) assert func1_y != func2_y z1 = Subs(f(a), a, y1) z2 = Subs(f(a), a, y2) assert z1 != z2 def test_issue_7231(): from sympy.abc import a ans1 = f(x).series(x, a) res = (f(a) + (-a + x)*Subs(Derivative(f(y), y), y, a) + (-a + x)**2*Subs(Derivative(f(y), y, y), y, a)/2 + (-a + x)**3*Subs(Derivative(f(y), y, y, y), y, a)/6 + (-a + x)**4*Subs(Derivative(f(y), y, y, y, y), y, a)/24 + (-a + x)**5*Subs(Derivative(f(y), y, y, y, y, y), y, a)/120 + O((-a + x)**6, (x, a))) assert res == ans1 ans2 = f(x).series(x, a) assert res == ans2 def test_issue_7687(): from sympy.core.function import Function from sympy.abc import x f = Function('f')(x) ff = Function('f')(x) match_with_cache = ff.matches(f) assert isinstance(f, type(ff)) clear_cache() ff = Function('f')(x) assert isinstance(f, type(ff)) assert match_with_cache == ff.matches(f) def test_issue_7688(): from sympy.core.function import Function, UndefinedFunction f = Function('f') # actually an UndefinedFunction clear_cache() class A(UndefinedFunction): pass a = A('f') assert isinstance(a, type(f)) def test_mexpand(): from sympy.abc import x assert _mexpand(None) is None assert _mexpand(1) is S.One assert _mexpand(x*(x + 1)**2) == (x*(x + 1)**2).expand() def test_issue_8469(): # This should not take forever to run N = 40 def g(w, theta): return 1/(1+exp(w-theta)) ws = symbols(['w%i'%i for i in range(N)]) import functools expr = functools.reduce(g, ws) assert isinstance(expr, Pow) def test_issue_12996(): # foo=True imitates the sort of arguments that Derivative can get # from Integral when it passes doit to the expression assert Derivative(im(x), x).doit(foo=True) == Derivative(im(x), x) def test_should_evalf(): # This should not take forever to run (see #8506) assert isinstance(sin((1.0 + 1.0*I)**10000 + 1), sin) def test_Derivative_as_finite_difference(): # Central 1st derivative at gridpoint x, h = symbols('x h', real=True) dfdx = f(x).diff(x) assert (dfdx.as_finite_difference([x-2, x-1, x, x+1, x+2]) - (S.One/12*(f(x-2)-f(x+2)) + Rational(2, 3)*(f(x+1)-f(x-1)))).simplify() == 0 # Central 1st derivative "half-way" assert (dfdx.as_finite_difference() - (f(x + S.Half)-f(x - S.Half))).simplify() == 0 assert (dfdx.as_finite_difference(h) - (f(x + h/S(2))-f(x - h/S(2)))/h).simplify() == 0 assert (dfdx.as_finite_difference([x - 3*h, x-h, x+h, x + 3*h]) - (S(9)/(8*2*h)*(f(x+h) - f(x-h)) + S.One/(24*2*h)*(f(x - 3*h) - f(x + 3*h)))).simplify() == 0 # One sided 1st derivative at gridpoint assert (dfdx.as_finite_difference([0, 1, 2], 0) - (Rational(-3, 2)*f(0) + 2*f(1) - f(2)/2)).simplify() == 0 assert (dfdx.as_finite_difference([x, x+h], x) - (f(x+h) - f(x))/h).simplify() == 0 assert (dfdx.as_finite_difference([x-h, x, x+h], x-h) - (-S(3)/(2*h)*f(x-h) + 2/h*f(x) - S.One/(2*h)*f(x+h))).simplify() == 0 # One sided 1st derivative "half-way" assert (dfdx.as_finite_difference([x-h, x+h, x + 3*h, x + 5*h, x + 7*h]) - 1/(2*h)*(-S(11)/(12)*f(x-h) + S(17)/(24)*f(x+h) + Rational(3, 8)*f(x + 3*h) - Rational(5, 24)*f(x + 5*h) + S.One/24*f(x + 7*h))).simplify() == 0 d2fdx2 = f(x).diff(x, 2) # Central 2nd derivative at gridpoint assert (d2fdx2.as_finite_difference([x-h, x, x+h]) - h**-2 * (f(x-h) + f(x+h) - 2*f(x))).simplify() == 0 assert (d2fdx2.as_finite_difference([x - 2*h, x-h, x, x+h, x + 2*h]) - h**-2 * (Rational(-1, 12)*(f(x - 2*h) + f(x + 2*h)) + Rational(4, 3)*(f(x+h) + f(x-h)) - Rational(5, 2)*f(x))).simplify() == 0 # Central 2nd derivative "half-way" assert (d2fdx2.as_finite_difference([x - 3*h, x-h, x+h, x + 3*h]) - (2*h)**-2 * (S.Half*(f(x - 3*h) + f(x + 3*h)) - S.Half*(f(x+h) + f(x-h)))).simplify() == 0 # One sided 2nd derivative at gridpoint assert (d2fdx2.as_finite_difference([x, x+h, x + 2*h, x + 3*h]) - h**-2 * (2*f(x) - 5*f(x+h) + 4*f(x+2*h) - f(x+3*h))).simplify() == 0 # One sided 2nd derivative at "half-way" assert (d2fdx2.as_finite_difference([x-h, x+h, x + 3*h, x + 5*h]) - (2*h)**-2 * (Rational(3, 2)*f(x-h) - Rational(7, 2)*f(x+h) + Rational(5, 2)*f(x + 3*h) - S.Half*f(x + 5*h))).simplify() == 0 d3fdx3 = f(x).diff(x, 3) # Central 3rd derivative at gridpoint assert (d3fdx3.as_finite_difference() - (-f(x - Rational(3, 2)) + 3*f(x - S.Half) - 3*f(x + S.Half) + f(x + Rational(3, 2)))).simplify() == 0 assert (d3fdx3.as_finite_difference( [x - 3*h, x - 2*h, x-h, x, x+h, x + 2*h, x + 3*h]) - h**-3 * (S.One/8*(f(x - 3*h) - f(x + 3*h)) - f(x - 2*h) + f(x + 2*h) + Rational(13, 8)*(f(x-h) - f(x+h)))).simplify() == 0 # Central 3rd derivative at "half-way" assert (d3fdx3.as_finite_difference([x - 3*h, x-h, x+h, x + 3*h]) - (2*h)**-3 * (f(x + 3*h)-f(x - 3*h) + 3*(f(x-h)-f(x+h)))).simplify() == 0 # One sided 3rd derivative at gridpoint assert (d3fdx3.as_finite_difference([x, x+h, x + 2*h, x + 3*h]) - h**-3 * (f(x + 3*h)-f(x) + 3*(f(x+h)-f(x + 2*h)))).simplify() == 0 # One sided 3rd derivative at "half-way" assert (d3fdx3.as_finite_difference([x-h, x+h, x + 3*h, x + 5*h]) - (2*h)**-3 * (f(x + 5*h)-f(x-h) + 3*(f(x+h)-f(x + 3*h)))).simplify() == 0 # issue 11007 y = Symbol('y', real=True) d2fdxdy = f(x, y).diff(x, y) ref0 = Derivative(f(x + S.Half, y), y) - Derivative(f(x - S.Half, y), y) assert (d2fdxdy.as_finite_difference(wrt=x) - ref0).simplify() == 0 half = S.Half xm, xp, ym, yp = x-half, x+half, y-half, y+half ref2 = f(xm, ym) + f(xp, yp) - f(xp, ym) - f(xm, yp) assert (d2fdxdy.as_finite_difference() - ref2).simplify() == 0 def test_issue_11159(): # Tests Application._eval_subs expr1 = E expr0 = expr1 * expr1 expr1 = expr0.subs(expr1,expr0) assert expr0 == expr1 def test_issue_12005(): e1 = Subs(Derivative(f(x), x), x, x) assert e1.diff(x) == Derivative(f(x), x, x) e2 = Subs(Derivative(f(x), x), x, x**2 + 1) assert e2.diff(x) == 2*x*Subs(Derivative(f(x), x, x), x, x**2 + 1) e3 = Subs(Derivative(f(x) + y**2 - y, y), y, y**2) assert e3.diff(y) == 4*y e4 = Subs(Derivative(f(x + y), y), y, (x**2)) assert e4.diff(y) is S.Zero e5 = Subs(Derivative(f(x), x), (y, z), (y, z)) assert e5.diff(x) == Derivative(f(x), x, x) assert f(g(x)).diff(g(x), g(x)) == Derivative(f(g(x)), g(x), g(x)) def test_issue_13843(): x = symbols('x') f = Function('f') m, n = symbols('m n', integer=True) assert Derivative(Derivative(f(x), (x, m)), (x, n)) == Derivative(f(x), (x, m + n)) assert Derivative(Derivative(f(x), (x, m+5)), (x, n+3)) == Derivative(f(x), (x, m + n + 8)) assert Derivative(f(x), (x, n)).doit() == Derivative(f(x), (x, n)) def test_order_could_be_zero(): x, y = symbols('x, y') n = symbols('n', integer=True, nonnegative=True) m = symbols('m', integer=True, positive=True) assert diff(y, (x, n)) == Piecewise((y, Eq(n, 0)), (0, True)) assert diff(y, (x, n + 1)) is S.Zero assert diff(y, (x, m)) is S.Zero def test_undefined_function_eq(): f = Function('f') f2 = Function('f') g = Function('g') f_real = Function('f', is_real=True) # This test may only be meaningful if the cache is turned off assert f == f2 assert hash(f) == hash(f2) assert f == f assert f != g assert f != f_real def test_function_assumptions(): x = Symbol('x') f = Function('f') f_real = Function('f', real=True) f_real1 = Function('f', real=1) f_real_inherit = Function(Symbol('f', real=True)) assert f_real == f_real1 # assumptions are sanitized assert f != f_real assert f(x) != f_real(x) assert f(x).is_real is None assert f_real(x).is_real is True assert f_real_inherit(x).is_real is True and f_real_inherit.name == 'f' # Can also do it this way, but it won't be equal to f_real because of the # way UndefinedFunction.__new__ works. Any non-recognized assumptions # are just added literally as something which is used in the hash f_real2 = Function('f', is_real=True) assert f_real2(x).is_real is True def test_undef_fcn_float_issue_6938(): f = Function('ceil') assert not f(0.3).is_number f = Function('sin') assert not f(0.3).is_number assert not f(pi).evalf().is_number x = Symbol('x') assert not f(x).evalf(subs={x:1.2}).is_number def test_undefined_function_eval(): # Issue 15170. Make sure UndefinedFunction with eval defined works # properly. The issue there was that the hash was determined before _nargs # was set, which is included in the hash, hence changing the hash. The # class is added to sympy.core.core.all_classes before the hash is # changed, meaning "temp in all_classes" would fail, causing sympify(temp(t)) # to give a new class. We will eventually remove all_classes, but make # sure this continues to work. fdiff = lambda self, argindex=1: cos(self.args[argindex - 1]) eval = classmethod(lambda cls, t: None) _imp_ = classmethod(lambda cls, t: sin(t)) temp = Function('temp', fdiff=fdiff, eval=eval, _imp_=_imp_) expr = temp(t) assert sympify(expr) == expr assert type(sympify(expr)).fdiff.__name__ == "<lambda>" assert expr.diff(t) == cos(t) def test_issue_15241(): F = f(x) Fx = F.diff(x) assert (F + x*Fx).diff(x, Fx) == 2 assert (F + x*Fx).diff(Fx, x) == 1 assert (x*F + x*Fx*F).diff(F, x) == x*Fx.diff(x) + Fx + 1 assert (x*F + x*Fx*F).diff(x, F) == x*Fx.diff(x) + Fx + 1 y = f(x) G = f(y) Gy = G.diff(y) assert (G + y*Gy).diff(y, Gy) == 2 assert (G + y*Gy).diff(Gy, y) == 1 assert (y*G + y*Gy*G).diff(G, y) == y*Gy.diff(y) + Gy + 1 assert (y*G + y*Gy*G).diff(y, G) == y*Gy.diff(y) + Gy + 1 def test_issue_15226(): assert Subs(Derivative(f(y), x, y), y, g(x)).doit() != 0 def test_issue_7027(): for wrt in (cos(x), re(x), Derivative(cos(x), x)): raises(ValueError, lambda: diff(f(x), wrt)) def test_derivative_quick_exit(): assert f(x).diff(y) == 0 assert f(x).diff(y, f(x)) == 0 assert f(x).diff(x, f(y)) == 0 assert f(f(x)).diff(x, f(x), f(y)) == 0 assert f(f(x)).diff(x, f(x), y) == 0 assert f(x).diff(g(x)) == 0 assert f(x).diff(x, f(x).diff(x)) == 1 df = f(x).diff(x) assert f(x).diff(df) == 0 dg = g(x).diff(x) assert dg.diff(df).doit() == 0 def test_issue_15084_13166(): eq = f(x, g(x)) assert eq.diff((g(x), y)) == Derivative(f(x, g(x)), (g(x), y)) # issue 13166 assert eq.diff(x, 2).doit() == ( (Derivative(f(x, g(x)), (g(x), 2))*Derivative(g(x), x) + Subs(Derivative(f(x, _xi_2), _xi_2, x), _xi_2, g(x)))*Derivative(g(x), x) + Derivative(f(x, g(x)), g(x))*Derivative(g(x), (x, 2)) + Derivative(g(x), x)*Subs(Derivative(f(_xi_1, g(x)), _xi_1, g(x)), _xi_1, x) + Subs(Derivative(f(_xi_1, g(x)), (_xi_1, 2)), _xi_1, x)) # issue 6681 assert diff(f(x, t, g(x, t)), x).doit() == ( Derivative(f(x, t, g(x, t)), g(x, t))*Derivative(g(x, t), x) + Subs(Derivative(f(_xi_1, t, g(x, t)), _xi_1), _xi_1, x)) # make sure the order doesn't matter when using diff assert eq.diff(x, g(x)) == eq.diff(g(x), x) def test_negative_counts(): # issue 13873 raises(ValueError, lambda: sin(x).diff(x, -1)) def test_Derivative__new__(): raises(TypeError, lambda: f(x).diff((x, 2), 0)) assert f(x, y).diff([(x, y), 0]) == f(x, y) assert f(x, y).diff([(x, y), 1]) == NDimArray([ Derivative(f(x, y), x), Derivative(f(x, y), y)]) assert f(x,y).diff(y, (x, z), y, x) == Derivative( f(x, y), (x, z + 1), (y, 2)) assert Matrix([x]).diff(x, 2) == Matrix([0]) # is_zero exit def test_issue_14719_10150(): class V(Expr): _diff_wrt = True is_scalar = False assert V().diff(V()) == Derivative(V(), V()) assert (2*V()).diff(V()) == 2*Derivative(V(), V()) class X(Expr): _diff_wrt = True assert X().diff(X()) == 1 assert (2*X()).diff(X()) == 2 def test_noncommutative_issue_15131(): x = Symbol('x', commutative=False) t = Symbol('t', commutative=False) fx = Function('Fx', commutative=False)(x) ft = Function('Ft', commutative=False)(t) A = Symbol('A', commutative=False) eq = fx * A * ft eqdt = eq.diff(t) assert eqdt.args[-1] == ft.diff(t) def test_Subs_Derivative(): a = Derivative(f(g(x), h(x)), g(x), h(x),x) b = Derivative(Derivative(f(g(x), h(x)), g(x), h(x)),x) c = f(g(x), h(x)).diff(g(x), h(x), x) d = f(g(x), h(x)).diff(g(x), h(x)).diff(x) e = Derivative(f(g(x), h(x)), x) eqs = (a, b, c, d, e) subs = lambda arg: arg.subs(f, Lambda((x, y), exp(x + y)) ).subs(g(x), 1/x).subs(h(x), x**3) ans = 3*x**2*exp(1/x)*exp(x**3) - exp(1/x)*exp(x**3)/x**2 assert all(subs(i).doit().expand() == ans for i in eqs) assert all(subs(i.doit()).doit().expand() == ans for i in eqs) def test_issue_15360(): f = Function('f') assert f.name == 'f' def test_issue_15947(): assert f._diff_wrt is False raises(TypeError, lambda: f(f)) raises(TypeError, lambda: f(x).diff(f)) def test_Derivative_free_symbols(): f = Function('f') n = Symbol('n', integer=True, positive=True) assert diff(f(x), (x, n)).free_symbols == {n, x} def test_issue_10503(): f = exp(x**3)*cos(x**6) assert f.series(x, 0, 14) == 1 + x**3 + x**6/2 + x**9/6 - 11*x**12/24 + O(x**14)
d0f1867013801255a90f7ecc9f9e547af27c59a7e05aa6d3eaf5b59060149191
"""This tests sympy/core/basic.py with (ideally) no reference to subclasses of Basic or Atom.""" import collections import sys from sympy.core.basic import (Basic, Atom, preorder_traversal, as_Basic, _atomic, _aresame) from sympy.core.singleton import S from sympy.core.symbol import symbols, Symbol from sympy.core.function import Function, Lambda from sympy.core.compatibility import default_sort_key from sympy import sin, Q, cos, gamma, Tuple, Integral, Sum from sympy.functions.elementary.exponential import exp from sympy.testing.pytest import raises from sympy.core import I, pi b1 = Basic() b2 = Basic(b1) b3 = Basic(b2) b21 = Basic(b2, b1) def test__aresame(): assert not _aresame(Basic([]), Basic()) assert not _aresame(Basic([]), Basic(())) assert not _aresame(Basic(2), Basic(2.)) def test_structure(): assert b21.args == (b2, b1) assert b21.func(*b21.args) == b21 assert bool(b1) def test_equality(): instances = [b1, b2, b3, b21, Basic(b1, b1, b1), Basic] for i, b_i in enumerate(instances): for j, b_j in enumerate(instances): assert (b_i == b_j) == (i == j) assert (b_i != b_j) == (i != j) assert Basic() != [] assert not(Basic() == []) assert Basic() != 0 assert not(Basic() == 0) class Foo(object): """ Class that is unaware of Basic, and relies on both classes returning the NotImplemented singleton for equivalence to evaluate to False. """ b = Basic() foo = Foo() assert b != foo assert foo != b assert not b == foo assert not foo == b class Bar(object): """ Class that considers itself equal to any instance of Basic, and relies on Basic returning the NotImplemented singleton in order to achieve a symmetric equivalence relation. """ def __eq__(self, other): if isinstance(other, Basic): return True return NotImplemented def __ne__(self, other): return not self == other bar = Bar() assert b == bar assert bar == b assert not b != bar assert not bar != b def test_matches_basic(): instances = [Basic(b1, b1, b2), Basic(b1, b2, b1), Basic(b2, b1, b1), Basic(b1, b2), Basic(b2, b1), b2, b1] for i, b_i in enumerate(instances): for j, b_j in enumerate(instances): if i == j: assert b_i.matches(b_j) == {} else: assert b_i.matches(b_j) is None assert b1.match(b1) == {} def test_has(): assert b21.has(b1) assert b21.has(b3, b1) assert b21.has(Basic) assert not b1.has(b21, b3) assert not b21.has() def test_subs(): assert b21.subs(b2, b1) == Basic(b1, b1) assert b21.subs(b2, b21) == Basic(b21, b1) assert b3.subs(b2, b1) == b2 assert b21.subs([(b2, b1), (b1, b2)]) == Basic(b2, b2) assert b21.subs({b1: b2, b2: b1}) == Basic(b2, b2) if sys.version_info >= (3, 4): assert b21.subs(collections.ChainMap({b1: b2}, {b2: b1})) == Basic(b2, b2) assert b21.subs(collections.OrderedDict([(b2, b1), (b1, b2)])) == Basic(b2, b2) raises(ValueError, lambda: b21.subs('bad arg')) raises(ValueError, lambda: b21.subs(b1, b2, b3)) # dict(b1=foo) creates a string 'b1' but leaves foo unchanged; subs # will convert the first to a symbol but will raise an error if foo # cannot be sympified; sympification is strict if foo is not string raises(ValueError, lambda: b21.subs(b1='bad arg')) assert Symbol(u"text").subs({u"text": b1}) == b1 assert Symbol(u"s").subs({u"s": 1}) == 1 def test_subs_with_unicode_symbols(): expr = Symbol('var1') replaced = expr.subs('var1', u'x') assert replaced.name == 'x' replaced = expr.subs('var1', 'x') assert replaced.name == 'x' def test_atoms(): assert b21.atoms() == set([Basic()]) def test_free_symbols_empty(): assert b21.free_symbols == set() def test_doit(): assert b21.doit() == b21 assert b21.doit(deep=False) == b21 def test_S(): assert repr(S) == 'S' def test_xreplace(): assert b21.xreplace({b2: b1}) == Basic(b1, b1) assert b21.xreplace({b2: b21}) == Basic(b21, b1) assert b3.xreplace({b2: b1}) == b2 assert Basic(b1, b2).xreplace({b1: b2, b2: b1}) == Basic(b2, b1) assert Atom(b1).xreplace({b1: b2}) == Atom(b1) assert Atom(b1).xreplace({Atom(b1): b2}) == b2 raises(TypeError, lambda: b1.xreplace()) raises(TypeError, lambda: b1.xreplace([b1, b2])) for f in (exp, Function('f')): assert f.xreplace({}) == f assert f.xreplace({}, hack2=True) == f assert f.xreplace({f: b1}) == b1 assert f.xreplace({f: b1}, hack2=True) == b1 def test_preorder_traversal(): expr = Basic(b21, b3) assert list( preorder_traversal(expr)) == [expr, b21, b2, b1, b1, b3, b2, b1] assert list(preorder_traversal(('abc', ('d', 'ef')))) == [ ('abc', ('d', 'ef')), 'abc', ('d', 'ef'), 'd', 'ef'] result = [] pt = preorder_traversal(expr) for i in pt: result.append(i) if i == b2: pt.skip() assert result == [expr, b21, b2, b1, b3, b2] w, x, y, z = symbols('w:z') expr = z + w*(x + y) assert list(preorder_traversal([expr], keys=default_sort_key)) == \ [[w*(x + y) + z], w*(x + y) + z, z, w*(x + y), w, x + y, x, y] assert list(preorder_traversal((x + y)*z, keys=True)) == \ [z*(x + y), z, x + y, x, y] def test_sorted_args(): x = symbols('x') assert b21._sorted_args == b21.args raises(AttributeError, lambda: x._sorted_args) def test_call(): x, y = symbols('x y') # See the long history of this in issues 5026 and 5105. raises(TypeError, lambda: sin(x)({ x : 1, sin(x) : 2})) raises(TypeError, lambda: sin(x)(1)) # No effect as there are no callables assert sin(x).rcall(1) == sin(x) assert (1 + sin(x)).rcall(1) == 1 + sin(x) # Effect in the pressence of callables l = Lambda(x, 2*x) assert (l + x).rcall(y) == 2*y + x assert (x**l).rcall(2) == x**4 # TODO UndefinedFunction does not subclass Expr #f = Function('f') #assert (2*f)(x) == 2*f(x) assert (Q.real & Q.positive).rcall(x) == Q.real(x) & Q.positive(x) def test_rewrite(): x, y, z = symbols('x y z') a, b = symbols('a b') f1 = sin(x) + cos(x) assert f1.rewrite(cos,exp) == exp(I*x)/2 + sin(x) + exp(-I*x)/2 assert f1.rewrite([cos],sin) == sin(x) + sin(x + pi/2, evaluate=False) f2 = sin(x) + cos(y)/gamma(z) assert f2.rewrite(sin,exp) == -I*(exp(I*x) - exp(-I*x))/2 + cos(y)/gamma(z) assert f1.rewrite() == f1 def test_literal_evalf_is_number_is_zero_is_comparable(): from sympy.integrals.integrals import Integral from sympy.core.symbol import symbols from sympy.core.function import Function from sympy.functions.elementary.trigonometric import cos, sin x = symbols('x') f = Function('f') # issue 5033 assert f.is_number is False # issue 6646 assert f(1).is_number is False i = Integral(0, (x, x, x)) # expressions that are symbolically 0 can be difficult to prove # so in case there is some easy way to know if something is 0 # it should appear in the is_zero property for that object; # if is_zero is true evalf should always be able to compute that # zero assert i.n() == 0 assert i.is_zero assert i.is_number is False assert i.evalf(2, strict=False) == 0 # issue 10268 n = sin(1)**2 + cos(1)**2 - 1 assert n.is_comparable is False assert n.n(2).is_comparable is False assert n.n(2).n(2).is_comparable def test_as_Basic(): assert as_Basic(1) is S.One assert as_Basic(()) == Tuple() raises(TypeError, lambda: as_Basic([])) def test_atomic(): g, h = map(Function, 'gh') x = symbols('x') assert _atomic(g(x + h(x))) == {g(x + h(x))} assert _atomic(g(x + h(x)), recursive=True) == {h(x), x, g(x + h(x))} assert _atomic(1) == set() assert _atomic(Basic(1,2)) == {Basic(1, 2)} def test_as_dummy(): u, v, x, y, z, _0, _1 = symbols('u v x y z _0 _1') assert Lambda(x, x + 1).as_dummy() == Lambda(_0, _0 + 1) assert Lambda(x, x + _0).as_dummy() == Lambda(_1, _0 + _1) assert (1 + Sum(x, (x, 1, x))).as_dummy() == 1 + Sum(_0, (_0, 1, x)) def test_canonical_variables(): x, i0, i1 = symbols('x _:2') assert Integral(x, (x, x + 1)).canonical_variables == {x: i0} assert Integral(x, (x, x + i0)).canonical_variables == {x: i1} def test_replace_exceptions(): from sympy import Wild x, y = symbols('x y') e = (x**2 + x*y) raises(TypeError, lambda: e.replace(sin, 2)) b = Wild('b') c = Wild('c') raises(TypeError, lambda: e.replace(b*c, c.is_real)) raises(TypeError, lambda: e.replace(b.is_real, 1)) raises(TypeError, lambda: e.replace(lambda d: d.is_Number, 1))
d4ee52bca764cfa323a9ea65d174c142b83c7746a2a096c761028e685dd5f56a
from sympy import Symbol, Function, exp, sqrt, Rational, I, cos, tan, S from sympy.testing.pytest import XFAIL def test_add_eval(): a = Symbol("a") b = Symbol("b") c = Rational(1) p = Rational(5) assert a*b + c + p == a*b + 6 assert c + a + p == a + 6 assert c + a - p == a + (-4) assert a + a == 2*a assert a + p + a == 2*a + 5 assert c + p == Rational(6) assert b + a - b == a def test_addmul_eval(): a = Symbol("a") b = Symbol("b") c = Rational(1) p = Rational(5) assert c + a + b*c + a - p == 2*a + b + (-4) assert a*2 + p + a == a*2 + 5 + a assert a*2 + p + a == 3*a + 5 assert a*2 + a == 3*a def test_pow_eval(): # XXX Pow does not fully support conversion of negative numbers # to their complex equivalent assert sqrt(-1) == I assert sqrt(-4) == 2*I assert sqrt( 4) == 2 assert (8)**Rational(1, 3) == 2 assert (-8)**Rational(1, 3) == 2*((-1)**Rational(1, 3)) assert sqrt(-2) == I*sqrt(2) assert (-1)**Rational(1, 3) != I assert (-10)**Rational(1, 3) != I*((10)**Rational(1, 3)) assert (-2)**Rational(1, 4) != (2)**Rational(1, 4) assert 64**Rational(1, 3) == 4 assert 64**Rational(2, 3) == 16 assert 24/sqrt(64) == 3 assert (-27)**Rational(1, 3) == 3*(-1)**Rational(1, 3) assert (cos(2) / tan(2))**2 == (cos(2) / tan(2))**2 @XFAIL def test_pow_eval_X1(): assert (-1)**Rational(1, 3) == S.Half + S.Half*I*sqrt(3) def test_mulpow_eval(): x = Symbol('x') assert sqrt(50)/(sqrt(2)*x) == 5/x assert sqrt(27)/sqrt(3) == 3 def test_evalpow_bug(): x = Symbol("x") assert 1/(1/x) == x assert 1/(-1/x) == -x def test_symbol_expand(): x = Symbol('x') y = Symbol('y') f = x**4*y**4 assert f == x**4*y**4 assert f == f.expand() g = (x*y)**4 assert g == f assert g.expand() == f assert g.expand() == g.expand().expand() def test_function(): f, l = map(Function, 'fl') x = Symbol('x') assert exp(l(x))*l(x)/exp(l(x)) == l(x) assert exp(f(x))*f(x)/exp(f(x)) == f(x)
c8bcb025ca283e76f51cf9dfb43df6e6f91cdf8ae83a0a5a91756ed94cb54f7d
from sympy.core.facts import (deduce_alpha_implications, apply_beta_to_alpha_route, rules_2prereq, FactRules, FactKB) from sympy.core.logic import And, Not from sympy.testing.pytest import raises T = True F = False U = None def test_deduce_alpha_implications(): def D(i): I = deduce_alpha_implications(i) P = rules_2prereq(dict( ((k, True), {(v, True) for v in S}) for k, S in I.items())) return I, P # transitivity I, P = D([('a', 'b'), ('b', 'c')]) assert I == {'a': set(['b', 'c']), 'b': set(['c']), Not('b'): set([Not('a')]), Not('c'): set([Not('a'), Not('b')])} assert P == {'a': set(['b', 'c']), 'b': set(['a', 'c']), 'c': set(['a', 'b'])} # Duplicate entry I, P = D([('a', 'b'), ('b', 'c'), ('b', 'c')]) assert I == {'a': set(['b', 'c']), 'b': set(['c']), Not('b'): set([Not('a')]), Not('c'): set([Not('a'), Not('b')])} assert P == {'a': set(['b', 'c']), 'b': set(['a', 'c']), 'c': set(['a', 'b'])} # see if it is tolerant to cycles assert D([('a', 'a'), ('a', 'a')]) == ({}, {}) assert D([('a', 'b'), ('b', 'a')]) == ( {'a': set(['b']), 'b': set(['a']), Not('a'): set([Not('b')]), Not('b'): set([Not('a')])}, {'a': set(['b']), 'b': set(['a'])}) # see if it catches inconsistency raises(ValueError, lambda: D([('a', Not('a'))])) raises(ValueError, lambda: D([('a', 'b'), ('b', Not('a'))])) raises(ValueError, lambda: D([('a', 'b'), ('b', 'c'), ('b', 'na'), ('na', Not('a'))])) # see if it handles implications with negations I, P = D([('a', Not('b')), ('c', 'b')]) assert I == {'a': set([Not('b'), Not('c')]), 'b': set([Not('a')]), 'c': set(['b', Not('a')]), Not('b'): set([Not('c')])} assert P == {'a': set(['b', 'c']), 'b': set(['a', 'c']), 'c': set(['a', 'b'])} I, P = D([(Not('a'), 'b'), ('a', 'c')]) assert I == {'a': set(['c']), Not('a'): set(['b']), Not('b'): set(['a', 'c']), Not('c'): set([Not('a'), 'b']),} assert P == {'a': set(['b', 'c']), 'b': set(['a', 'c']), 'c': set(['a', 'b'])} # Long deductions I, P = D([('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'e')]) assert I == {'a': set(['b', 'c', 'd', 'e']), 'b': set(['c', 'd', 'e']), 'c': set(['d', 'e']), 'd': set(['e']), Not('b'): set([Not('a')]), Not('c'): set([Not('a'), Not('b')]), Not('d'): set([Not('a'), Not('b'), Not('c')]), Not('e'): set([Not('a'), Not('b'), Not('c'), Not('d')])} assert P == {'a': set(['b', 'c', 'd', 'e']), 'b': set(['a', 'c', 'd', 'e']), 'c': set(['a', 'b', 'd', 'e']), 'd': set(['a', 'b', 'c', 'e']), 'e': set(['a', 'b', 'c', 'd'])} # something related to real-world I, P = D([('rat', 'real'), ('int', 'rat')]) assert I == {'int': set(['rat', 'real']), 'rat': set(['real']), Not('real'): set([Not('rat'), Not('int')]), Not('rat'): set([Not('int')])} assert P == {'rat': set(['int', 'real']), 'real': set(['int', 'rat']), 'int': set(['rat', 'real'])} # TODO move me to appropriate place def test_apply_beta_to_alpha_route(): APPLY = apply_beta_to_alpha_route # indicates empty alpha-chain with attached beta-rule #bidx def Q(bidx): return (set(), [bidx]) # x -> a &(a,b) -> x -- x -> a A = {'x': set(['a'])} B = [(And('a', 'b'), 'x')] assert APPLY(A, B) == {'x': (set(['a']), []), 'a': Q(0), 'b': Q(0)} # x -> a &(a,!x) -> b -- x -> a A = {'x': set(['a'])} B = [(And('a', Not('x')), 'b')] assert APPLY(A, B) == {'x': (set(['a']), []), Not('x'): Q(0), 'a': Q(0)} # x -> a b &(a,b) -> c -- x -> a b c A = {'x': set(['a', 'b'])} B = [(And('a', 'b'), 'c')] assert APPLY(A, B) == \ {'x': (set(['a', 'b', 'c']), []), 'a': Q(0), 'b': Q(0)} # x -> a &(a,b) -> y -- x -> a [#0] A = {'x': set(['a'])} B = [(And('a', 'b'), 'y')] assert APPLY(A, B) == {'x': (set(['a']), [0]), 'a': Q(0), 'b': Q(0)} # x -> a b c &(a,b) -> c -- x -> a b c A = {'x': set(['a', 'b', 'c'])} B = [(And('a', 'b'), 'c')] assert APPLY(A, B) == \ {'x': (set(['a', 'b', 'c']), []), 'a': Q(0), 'b': Q(0)} # x -> a b &(a,b,c) -> y -- x -> a b [#0] A = {'x': set(['a', 'b'])} B = [(And('a', 'b', 'c'), 'y')] assert APPLY(A, B) == \ {'x': (set(['a', 'b']), [0]), 'a': Q(0), 'b': Q(0), 'c': Q(0)} # x -> a b &(a,b) -> c -- x -> a b c d # c -> d c -> d A = {'x': set(['a', 'b']), 'c': set(['d'])} B = [(And('a', 'b'), 'c')] assert APPLY(A, B) == {'x': (set(['a', 'b', 'c', 'd']), []), 'c': (set(['d']), []), 'a': Q(0), 'b': Q(0)} # x -> a b &(a,b) -> c -- x -> a b c d e # c -> d &(c,d) -> e c -> d e A = {'x': set(['a', 'b']), 'c': set(['d'])} B = [(And('a', 'b'), 'c'), (And('c', 'd'), 'e')] assert APPLY(A, B) == {'x': (set(['a', 'b', 'c', 'd', 'e']), []), 'c': (set(['d', 'e']), []), 'a': Q(0), 'b': Q(0), 'd': Q(1)} # x -> a b &(a,y) -> z -- x -> a b y z # &(a,b) -> y A = {'x': set(['a', 'b'])} B = [(And('a', 'y'), 'z'), (And('a', 'b'), 'y')] assert APPLY(A, B) == {'x': (set(['a', 'b', 'y', 'z']), []), 'a': (set(), [0, 1]), 'y': Q(0), 'b': Q(1)} # x -> a b &(a,!b) -> c -- x -> a b A = {'x': set(['a', 'b'])} B = [(And('a', Not('b')), 'c')] assert APPLY(A, B) == \ {'x': (set(['a', 'b']), []), 'a': Q(0), Not('b'): Q(0)} # !x -> !a !b &(!a,b) -> c -- !x -> !a !b A = {Not('x'): set([Not('a'), Not('b')])} B = [(And(Not('a'), 'b'), 'c')] assert APPLY(A, B) == \ {Not('x'): (set([Not('a'), Not('b')]), []), Not('a'): Q(0), 'b': Q(0)} # x -> a b &(b,c) -> !a -- x -> a b A = {'x': set(['a', 'b'])} B = [(And('b', 'c'), Not('a'))] assert APPLY(A, B) == {'x': (set(['a', 'b']), []), 'b': Q(0), 'c': Q(0)} # x -> a b &(a, b) -> c -- x -> a b c p # c -> p a A = {'x': set(['a', 'b']), 'c': set(['p', 'a'])} B = [(And('a', 'b'), 'c')] assert APPLY(A, B) == {'x': (set(['a', 'b', 'c', 'p']), []), 'c': (set(['p', 'a']), []), 'a': Q(0), 'b': Q(0)} def test_FactRules_parse(): f = FactRules('a -> b') assert f.prereq == {'b': set(['a']), 'a': set(['b'])} f = FactRules('a -> !b') assert f.prereq == {'b': set(['a']), 'a': set(['b'])} f = FactRules('!a -> b') assert f.prereq == {'b': set(['a']), 'a': set(['b'])} f = FactRules('!a -> !b') assert f.prereq == {'b': set(['a']), 'a': set(['b'])} f = FactRules('!z == nz') assert f.prereq == {'z': set(['nz']), 'nz': set(['z'])} def test_FactRules_parse2(): raises(ValueError, lambda: FactRules('a -> !a')) def test_FactRules_deduce(): f = FactRules(['a -> b', 'b -> c', 'b -> d', 'c -> e']) def D(facts): kb = FactKB(f) kb.deduce_all_facts(facts) return kb assert D({'a': T}) == {'a': T, 'b': T, 'c': T, 'd': T, 'e': T} assert D({'b': T}) == { 'b': T, 'c': T, 'd': T, 'e': T} assert D({'c': T}) == { 'c': T, 'e': T} assert D({'d': T}) == { 'd': T } assert D({'e': T}) == { 'e': T} assert D({'a': F}) == {'a': F } assert D({'b': F}) == {'a': F, 'b': F } assert D({'c': F}) == {'a': F, 'b': F, 'c': F } assert D({'d': F}) == {'a': F, 'b': F, 'd': F } assert D({'a': U}) == {'a': U} # XXX ok? def test_FactRules_deduce2(): # pos/neg/zero, but the rules are not sufficient to derive all relations f = FactRules(['pos -> !neg', 'pos -> !z']) def D(facts): kb = FactKB(f) kb.deduce_all_facts(facts) return kb assert D({'pos': T}) == {'pos': T, 'neg': F, 'z': F} assert D({'pos': F}) == {'pos': F } assert D({'neg': T}) == {'pos': F, 'neg': T } assert D({'neg': F}) == { 'neg': F } assert D({'z': T}) == {'pos': F, 'z': T} assert D({'z': F}) == { 'z': F} # pos/neg/zero. rules are sufficient to derive all relations f = FactRules(['pos -> !neg', 'neg -> !pos', 'pos -> !z', 'neg -> !z']) assert D({'pos': T}) == {'pos': T, 'neg': F, 'z': F} assert D({'pos': F}) == {'pos': F } assert D({'neg': T}) == {'pos': F, 'neg': T, 'z': F} assert D({'neg': F}) == { 'neg': F } assert D({'z': T}) == {'pos': F, 'neg': F, 'z': T} assert D({'z': F}) == { 'z': F} def test_FactRules_deduce_multiple(): # deduction that involves _several_ starting points f = FactRules(['real == pos | npos']) def D(facts): kb = FactKB(f) kb.deduce_all_facts(facts) return kb assert D({'real': T}) == {'real': T} assert D({'real': F}) == {'real': F, 'pos': F, 'npos': F} assert D({'pos': T}) == {'real': T, 'pos': T} assert D({'npos': T}) == {'real': T, 'npos': T} # --- key tests below --- assert D({'pos': F, 'npos': F}) == {'real': F, 'pos': F, 'npos': F} assert D({'real': T, 'pos': F}) == {'real': T, 'pos': F, 'npos': T} assert D({'real': T, 'npos': F}) == {'real': T, 'pos': T, 'npos': F} assert D({'pos': T, 'npos': F}) == {'real': T, 'pos': T, 'npos': F} assert D({'pos': F, 'npos': T}) == {'real': T, 'pos': F, 'npos': T} def test_FactRules_deduce_multiple2(): f = FactRules(['real == neg | zero | pos']) def D(facts): kb = FactKB(f) kb.deduce_all_facts(facts) return kb assert D({'real': T}) == {'real': T} assert D({'real': F}) == {'real': F, 'neg': F, 'zero': F, 'pos': F} assert D({'neg': T}) == {'real': T, 'neg': T} assert D({'zero': T}) == {'real': T, 'zero': T} assert D({'pos': T}) == {'real': T, 'pos': T} # --- key tests below --- assert D({'neg': F, 'zero': F, 'pos': F}) == {'real': F, 'neg': F, 'zero': F, 'pos': F} assert D({'real': T, 'neg': F}) == {'real': T, 'neg': F} assert D({'real': T, 'zero': F}) == {'real': T, 'zero': F} assert D({'real': T, 'pos': F}) == {'real': T, 'pos': F} assert D({'real': T, 'zero': F, 'pos': F}) == {'real': T, 'neg': T, 'zero': F, 'pos': F} assert D({'real': T, 'neg': F, 'pos': F}) == {'real': T, 'neg': F, 'zero': T, 'pos': F} assert D({'real': T, 'neg': F, 'zero': F }) == {'real': T, 'neg': F, 'zero': F, 'pos': T} assert D({'neg': T, 'zero': F, 'pos': F}) == {'real': T, 'neg': T, 'zero': F, 'pos': F} assert D({'neg': F, 'zero': T, 'pos': F}) == {'real': T, 'neg': F, 'zero': T, 'pos': F} assert D({'neg': F, 'zero': F, 'pos': T}) == {'real': T, 'neg': F, 'zero': F, 'pos': T} def test_FactRules_deduce_base(): # deduction that starts from base f = FactRules(['real == neg | zero | pos', 'neg -> real & !zero & !pos', 'pos -> real & !zero & !neg']) base = FactKB(f) base.deduce_all_facts({'real': T, 'neg': F}) assert base == {'real': T, 'neg': F} base.deduce_all_facts({'zero': F}) assert base == {'real': T, 'neg': F, 'zero': F, 'pos': T} def test_FactRules_deduce_staticext(): # verify that static beta-extensions deduction takes place f = FactRules(['real == neg | zero | pos', 'neg -> real & !zero & !pos', 'pos -> real & !zero & !neg', 'nneg == real & !neg', 'npos == real & !pos']) assert ('npos', True) in f.full_implications[('neg', True)] assert ('nneg', True) in f.full_implications[('pos', True)] assert ('nneg', True) in f.full_implications[('zero', True)] assert ('npos', True) in f.full_implications[('zero', True)]
5ae4c41137f41b2f4f3344be86f158fe9e231859e7d57e2895b8fb8107e6b63b
from sympy import Integer, S, symbols, Mul from sympy.core.operations import AssocOp, LatticeOp from sympy.testing.pytest import raises from sympy.core.sympify import SympifyError from sympy.core.add import Add # create the simplest possible Lattice class class join(LatticeOp): zero = Integer(0) identity = Integer(1) def test_lattice_simple(): assert join(join(2, 3), 4) == join(2, join(3, 4)) assert join(2, 3) == join(3, 2) assert join(0, 2) == 0 assert join(1, 2) == 2 assert join(2, 2) == 2 assert join(join(2, 3), 4) == join(2, 3, 4) assert join() == 1 assert join(4) == 4 assert join(1, 4, 2, 3, 1, 3, 2) == join(2, 3, 4) def test_lattice_shortcircuit(): raises(SympifyError, lambda: join(object)) assert join(0, object) == 0 def test_lattice_print(): assert str(join(5, 4, 3, 2)) == 'join(2, 3, 4, 5)' def test_lattice_make_args(): assert join.make_args(join(2, 3, 4)) == {S(2), S(3), S(4)} assert join.make_args(0) == {0} assert list(join.make_args(0))[0] is S.Zero assert Add.make_args(0)[0] is S.Zero def test_issue_14025(): a, b, c, d = symbols('a,b,c,d', commutative=False) assert Mul(a, b, c).has(c*b) == False assert Mul(a, b, c).has(b*c) == True assert Mul(a, b, c, d).has(b*c*d) == True def test_AssocOp_flatten(): a, b, c, d = symbols('a,b,c,d') class MyAssoc(AssocOp): identity = S.One assert MyAssoc(a, MyAssoc(b, c)).args == \ MyAssoc(MyAssoc(a, b), c).args == \ MyAssoc(MyAssoc(a, b, c)).args == \ MyAssoc(a, b, c).args == \ (a, b, c) u = MyAssoc(b, c) v = MyAssoc(u, d, evaluate=False) assert v.args == (u, d) # like Add, any unevaluated outer call will flatten inner args assert MyAssoc(a, v).args == (a, b, c, d)
ce8795680f6e264e44c34ec562366e7515aa00a7c6b309beece70486009bd150
from sympy import (log, sqrt, Rational as R, Symbol, I, exp, pi, S, cos, sin, Mul, Pow, O) from sympy.simplify.radsimp import expand_numer from sympy.core.function import expand, expand_multinomial, expand_power_base from sympy.testing.pytest import raises from sympy.testing.randtest import verify_numerically from sympy.abc import x, y, z def test_expand_no_log(): assert ( (1 + log(x**4))**2).expand(log=False) == 1 + 2*log(x**4) + log(x**4)**2 assert ((1 + log(x**4))*(1 + log(x**3))).expand( log=False) == 1 + log(x**4) + log(x**3) + log(x**4)*log(x**3) def test_expand_no_multinomial(): assert ((1 + x)*(1 + (1 + x)**4)).expand(multinomial=False) == \ 1 + x + (1 + x)**4 + x*(1 + x)**4 def test_expand_negative_integer_powers(): expr = (x + y)**(-2) assert expr.expand() == 1 / (2*x*y + x**2 + y**2) assert expr.expand(multinomial=False) == (x + y)**(-2) expr = (x + y)**(-3) assert expr.expand() == 1 / (3*x*x*y + 3*x*y*y + x**3 + y**3) assert expr.expand(multinomial=False) == (x + y)**(-3) expr = (x + y)**(2) * (x + y)**(-4) assert expr.expand() == 1 / (2*x*y + x**2 + y**2) assert expr.expand(multinomial=False) == (x + y)**(-2) def test_expand_non_commutative(): A = Symbol('A', commutative=False) B = Symbol('B', commutative=False) C = Symbol('C', commutative=False) a = Symbol('a') b = Symbol('b') i = Symbol('i', integer=True) n = Symbol('n', negative=True) m = Symbol('m', negative=True) p = Symbol('p', polar=True) np = Symbol('p', polar=False) assert (C*(A + B)).expand() == C*A + C*B assert (C*(A + B)).expand() != A*C + B*C assert ((A + B)**2).expand() == A**2 + A*B + B*A + B**2 assert ((A + B)**3).expand() == (A**2*B + B**2*A + A*B**2 + B*A**2 + A**3 + B**3 + A*B*A + B*A*B) # issue 6219 assert ((a*A*B*A**-1)**2).expand() == a**2*A*B**2/A # Note that (a*A*B*A**-1)**2 is automatically converted to a**2*(A*B*A**-1)**2 assert ((a*A*B*A**-1)**2).expand(deep=False) == a**2*(A*B*A**-1)**2 assert ((a*A*B*A**-1)**2).expand() == a**2*(A*B**2*A**-1) assert ((a*A*B*A**-1)**2).expand(force=True) == a**2*A*B**2*A**(-1) assert ((a*A*B)**2).expand() == a**2*A*B*A*B assert ((a*A)**2).expand() == a**2*A**2 assert ((a*A*B)**i).expand() == a**i*(A*B)**i assert ((a*A*(B*(A*B/A)**2))**i).expand() == a**i*(A*B*A*B**2/A)**i # issue 6558 assert (A*B*(A*B)**-1).expand() == 1 assert ((a*A)**i).expand() == a**i*A**i assert ((a*A*B*A**-1)**3).expand() == a**3*A*B**3/A assert ((a*A*B*A*B/A)**3).expand() == \ a**3*A*B*(A*B**2)*(A*B**2)*A*B*A**(-1) assert ((a*A*B*A*B/A)**-2).expand() == \ A*B**-1*A**-1*B**-2*A**-1*B**-1*A**-1/a**2 assert ((a*b*A*B*A**-1)**i).expand() == a**i*b**i*(A*B/A)**i assert ((a*(a*b)**i)**i).expand() == a**i*a**(i**2)*b**(i**2) e = Pow(Mul(a, 1/a, A, B, evaluate=False), S(2), evaluate=False) assert e.expand() == A*B*A*B assert sqrt(a*(A*b)**i).expand() == sqrt(a*b**i*A**i) assert (sqrt(-a)**a).expand() == sqrt(-a)**a assert expand((-2*n)**(i/3)) == 2**(i/3)*(-n)**(i/3) assert expand((-2*n*m)**(i/a)) == (-2)**(i/a)*(-n)**(i/a)*(-m)**(i/a) assert expand((-2*a*p)**b) == 2**b*p**b*(-a)**b assert expand((-2*a*np)**b) == 2**b*(-a*np)**b assert expand(sqrt(A*B)) == sqrt(A*B) assert expand(sqrt(-2*a*b)) == sqrt(2)*sqrt(-a*b) def test_expand_radicals(): a = (x + y)**R(1, 2) assert (a**1).expand() == a assert (a**3).expand() == x*a + y*a assert (a**5).expand() == x**2*a + 2*x*y*a + y**2*a assert (1/a**1).expand() == 1/a assert (1/a**3).expand() == 1/(x*a + y*a) assert (1/a**5).expand() == 1/(x**2*a + 2*x*y*a + y**2*a) a = (x + y)**R(1, 3) assert (a**1).expand() == a assert (a**2).expand() == a**2 assert (a**4).expand() == x*a + y*a assert (a**5).expand() == x*a**2 + y*a**2 assert (a**7).expand() == x**2*a + 2*x*y*a + y**2*a def test_expand_modulus(): assert ((x + y)**11).expand(modulus=11) == x**11 + y**11 assert ((x + sqrt(2)*y)**11).expand(modulus=11) == x**11 + 10*sqrt(2)*y**11 assert (x + y/2).expand(modulus=1) == y/2 raises(ValueError, lambda: ((x + y)**11).expand(modulus=0)) raises(ValueError, lambda: ((x + y)**11).expand(modulus=x)) def test_issue_5743(): assert (x*sqrt( x + y)*(1 + sqrt(x + y))).expand() == x**2 + x*y + x*sqrt(x + y) assert (x*sqrt( x + y)*(1 + x*sqrt(x + y))).expand() == x**3 + x**2*y + x*sqrt(x + y) def test_expand_frac(): assert expand((x + y)*y/x/(x + 1), frac=True) == \ (x*y + y**2)/(x**2 + x) assert expand((x + y)*y/x/(x + 1), numer=True) == \ (x*y + y**2)/(x*(x + 1)) assert expand((x + y)*y/x/(x + 1), denom=True) == \ y*(x + y)/(x**2 + x) eq = (x + 1)**2/y assert expand_numer(eq, multinomial=False) == eq def test_issue_6121(): eq = -I*exp(-3*I*pi/4)/(4*pi**(S(3)/2)*sqrt(x)) assert eq.expand(complex=True) # does not give oo recursion eq = -I*exp(-3*I*pi/4)/(4*pi**(R(3, 2))*sqrt(x)) assert eq.expand(complex=True) # does not give oo recursion def test_expand_power_base(): assert expand_power_base((x*y*z)**4) == x**4*y**4*z**4 assert expand_power_base((x*y*z)**x).is_Pow assert expand_power_base((x*y*z)**x, force=True) == x**x*y**x*z**x assert expand_power_base((x*(y*z)**2)**3) == x**3*y**6*z**6 assert expand_power_base((sin((x*y)**2)*y)**z).is_Pow assert expand_power_base( (sin((x*y)**2)*y)**z, force=True) == sin((x*y)**2)**z*y**z assert expand_power_base( (sin((x*y)**2)*y)**z, deep=True) == (sin(x**2*y**2)*y)**z assert expand_power_base(exp(x)**2) == exp(2*x) assert expand_power_base((exp(x)*exp(y))**2) == exp(2*x)*exp(2*y) assert expand_power_base( (exp((x*y)**z)*exp(y))**2) == exp(2*(x*y)**z)*exp(2*y) assert expand_power_base((exp((x*y)**z)*exp( y))**2, deep=True, force=True) == exp(2*x**z*y**z)*exp(2*y) assert expand_power_base((exp(x)*exp(y))**z).is_Pow assert expand_power_base( (exp(x)*exp(y))**z, force=True) == exp(x)**z*exp(y)**z def test_expand_arit(): a = Symbol("a") b = Symbol("b", positive=True) c = Symbol("c") p = R(5) e = (a + b)*c assert e == c*(a + b) assert (e.expand() - a*c - b*c) == R(0) e = (a + b)*(a + b) assert e == (a + b)**2 assert e.expand() == 2*a*b + a**2 + b**2 e = (a + b)*(a + b)**R(2) assert e == (a + b)**3 assert e.expand() == 3*b*a**2 + 3*a*b**2 + a**3 + b**3 assert e.expand() == 3*b*a**2 + 3*a*b**2 + a**3 + b**3 e = (a + b)*(a + c)*(b + c) assert e == (a + c)*(a + b)*(b + c) assert e.expand() == 2*a*b*c + b*a**2 + c*a**2 + b*c**2 + a*c**2 + c*b**2 + a*b**2 e = (a + R(1))**p assert e == (1 + a)**5 assert e.expand() == 1 + 5*a + 10*a**2 + 10*a**3 + 5*a**4 + a**5 e = (a + b + c)*(a + c + p) assert e == (5 + a + c)*(a + b + c) assert e.expand() == 5*a + 5*b + 5*c + 2*a*c + b*c + a*b + a**2 + c**2 x = Symbol("x") s = exp(x*x) - 1 e = s.nseries(x, 0, 6)/x**2 assert e.expand() == 1 + x**2/2 + O(x**4) e = (x*(y + z))**(x*(y + z))*(x + y) assert e.expand(power_exp=False, power_base=False) == x*(x*y + x* z)**(x*y + x*z) + y*(x*y + x*z)**(x*y + x*z) assert e.expand(power_exp=False, power_base=False, deep=False) == x* \ (x*(y + z))**(x*(y + z)) + y*(x*(y + z))**(x*(y + z)) e = x * (x + (y + 1)**2) assert e.expand(deep=False) == x**2 + x*(y + 1)**2 e = (x*(y + z))**z assert e.expand(power_base=True, mul=True, deep=True) in [x**z*(y + z)**z, (x*y + x*z)**z] assert ((2*y)**z).expand() == 2**z*y**z p = Symbol('p', positive=True) assert sqrt(-x).expand().is_Pow assert sqrt(-x).expand(force=True) == I*sqrt(x) assert ((2*y*p)**z).expand() == 2**z*p**z*y**z assert ((2*y*p*x)**z).expand() == 2**z*p**z*(x*y)**z assert ((2*y*p*x)**z).expand(force=True) == 2**z*p**z*x**z*y**z assert ((2*y*p*-pi)**z).expand() == 2**z*pi**z*p**z*(-y)**z assert ((2*y*p*-pi*x)**z).expand() == 2**z*pi**z*p**z*(-x*y)**z n = Symbol('n', negative=True) m = Symbol('m', negative=True) assert ((-2*x*y*n)**z).expand() == 2**z*(-n)**z*(x*y)**z assert ((-2*x*y*n*m)**z).expand() == 2**z*(-m)**z*(-n)**z*(-x*y)**z # issue 5482 assert sqrt(-2*x*n) == sqrt(2)*sqrt(-n)*sqrt(x) # issue 5605 (2) assert (cos(x + y)**2).expand(trig=True) in [ (-sin(x)*sin(y) + cos(x)*cos(y))**2, sin(x)**2*sin(y)**2 - 2*sin(x)*sin(y)*cos(x)*cos(y) + cos(x)**2*cos(y)**2 ] # Check that this isn't too slow x = Symbol('x') W = 1 for i in range(1, 21): W = W * (x - i) W = W.expand() assert W.has(-1672280820*x**15) def test_power_expand(): """Test for Pow.expand()""" a = Symbol('a') b = Symbol('b') p = (a + b)**2 assert p.expand() == a**2 + b**2 + 2*a*b p = (1 + 2*(1 + a))**2 assert p.expand() == 9 + 4*(a**2) + 12*a p = 2**(a + b) assert p.expand() == 2**a*2**b A = Symbol('A', commutative=False) B = Symbol('B', commutative=False) assert (2**(A + B)).expand() == 2**(A + B) assert (A**(a + b)).expand() != A**(a + b) def test_issues_5919_6830(): # issue 5919 n = -1 + 1/x z = n/x/(-n)**2 - 1/n/x assert expand(z) == 1/(x**2 - 2*x + 1) - 1/(x - 2 + 1/x) - 1/(-x + 1) # issue 6830 p = (1 + x)**2 assert expand_multinomial((1 + x*p)**2) == ( x**2*(x**4 + 4*x**3 + 6*x**2 + 4*x + 1) + 2*x*(x**2 + 2*x + 1) + 1) assert expand_multinomial((1 + (y + x)*p)**2) == ( 2*((x + y)*(x**2 + 2*x + 1)) + (x**2 + 2*x*y + y**2)* (x**4 + 4*x**3 + 6*x**2 + 4*x + 1) + 1) A = Symbol('A', commutative=False) p = (1 + A)**2 assert expand_multinomial((1 + x*p)**2) == ( x**2*(1 + 4*A + 6*A**2 + 4*A**3 + A**4) + 2*x*(1 + 2*A + A**2) + 1) assert expand_multinomial((1 + (y + x)*p)**2) == ( (x + y)*(1 + 2*A + A**2)*2 + (x**2 + 2*x*y + y**2)* (1 + 4*A + 6*A**2 + 4*A**3 + A**4) + 1) assert expand_multinomial((1 + (y + x)*p)**3) == ( (x + y)*(1 + 2*A + A**2)*3 + (x**2 + 2*x*y + y**2)*(1 + 4*A + 6*A**2 + 4*A**3 + A**4)*3 + (x**3 + 3*x**2*y + 3*x*y**2 + y**3)*(1 + 6*A + 15*A**2 + 20*A**3 + 15*A**4 + 6*A**5 + A**6) + 1) # unevaluate powers eq = (Pow((x + 1)*((A + 1)**2), 2, evaluate=False)) # - in this case the base is not an Add so no further # expansion is done assert expand_multinomial(eq) == \ (x**2 + 2*x + 1)*(1 + 4*A + 6*A**2 + 4*A**3 + A**4) # - but here, the expanded base *is* an Add so it gets expanded eq = (Pow(((A + 1)**2), 2, evaluate=False)) assert expand_multinomial(eq) == 1 + 4*A + 6*A**2 + 4*A**3 + A**4 # coverage def ok(a, b, n): e = (a + I*b)**n return verify_numerically(e, expand_multinomial(e)) for a in [2, S.Half]: for b in [3, R(1, 3)]: for n in range(2, 6): assert ok(a, b, n) assert expand_multinomial((x + 1 + O(z))**2) == \ 1 + 2*x + x**2 + O(z) assert expand_multinomial((x + 1 + O(z))**3) == \ 1 + 3*x + 3*x**2 + x**3 + O(z) assert expand_multinomial(3**(x + y + 3)) == 27*3**(x + y) def test_expand_log(): t = Symbol('t', positive=True) # after first expansion, -2*log(2) + log(4); then 0 after second assert expand(log(t**2) - log(t**2/4) - 2*log(2)) == 0
ea3e1593d502351bfc3b2c7fe22bf578f8e8730060efffb77edad227cbb470fa
from sympy.concrete.summations import Sum from sympy.core.expr import Expr from sympy.core.function import (Derivative, Function, diff, Subs) from sympy.core.numbers import (I, Rational, pi) from sympy.core.relational import Eq from sympy.core.singleton import S from sympy.core.symbol import Symbol from sympy.functions.combinatorial.factorials import factorial from sympy.functions.elementary.complexes import (im, re) from sympy.functions.elementary.exponential import (exp, log) from sympy.functions.elementary.miscellaneous import Max from sympy.functions.elementary.piecewise import Piecewise from sympy.functions.elementary.trigonometric import (cos, cot, sin, tan) from sympy.tensor.array.ndim_array import NDimArray from sympy.testing.pytest import raises from sympy.abc import a, b, c, x, y, z def test_diff(): assert Rational(1, 3).diff(x) is S.Zero assert I.diff(x) is S.Zero assert pi.diff(x) is S.Zero assert x.diff(x, 0) == x assert (x**2).diff(x, 2, x) == 0 assert (x**2).diff((x, 2), x) == 0 assert (x**2).diff((x, 1), x) == 2 assert (x**2).diff((x, 1), (x, 1)) == 2 assert (x**2).diff((x, 2)) == 2 assert (x**2).diff(x, y, 0) == 2*x assert (x**2).diff(x, (y, 0)) == 2*x assert (x**2).diff(x, y) == 0 raises(ValueError, lambda: x.diff(1, x)) p = Rational(5) e = a*b + b**p assert e.diff(a) == b assert e.diff(b) == a + 5*b**4 assert e.diff(b).diff(a) == Rational(1) e = a*(b + c) assert e.diff(a) == b + c assert e.diff(b) == a assert e.diff(b).diff(a) == Rational(1) e = c**p assert e.diff(c, 6) == Rational(0) assert e.diff(c, 5) == Rational(120) e = c**Rational(2) assert e.diff(c) == 2*c e = a*b*c assert e.diff(c) == a*b def test_diff2(): n3 = Rational(3) n2 = Rational(2) n6 = Rational(6) e = n3*(-n2 + x**n2)*cos(x) + x*(-n6 + x**n2)*sin(x) assert e == 3*(-2 + x**2)*cos(x) + x*(-6 + x**2)*sin(x) assert e.diff(x).expand() == x**3*cos(x) e = (x + 1)**3 assert e.diff(x) == 3*(x + 1)**2 e = x*(x + 1)**3 assert e.diff(x) == (x + 1)**3 + 3*x*(x + 1)**2 e = 2*exp(x*x)*x assert e.diff(x) == 2*exp(x**2) + 4*x**2*exp(x**2) def test_diff3(): p = Rational(5) e = a*b + sin(b**p) assert e == a*b + sin(b**5) assert e.diff(a) == b assert e.diff(b) == a + 5*b**4*cos(b**5) e = tan(c) assert e == tan(c) assert e.diff(c) in [cos(c)**(-2), 1 + sin(c)**2/cos(c)**2, 1 + tan(c)**2] e = c*log(c) - c assert e == -c + c*log(c) assert e.diff(c) == log(c) e = log(sin(c)) assert e == log(sin(c)) assert e.diff(c) in [sin(c)**(-1)*cos(c), cot(c)] e = (Rational(2)**a/log(Rational(2))) assert e == 2**a*log(Rational(2))**(-1) assert e.diff(a) == 2**a def test_diff_no_eval_derivative(): class My(Expr): def __new__(cls, x): return Expr.__new__(cls, x) # My doesn't have its own _eval_derivative method assert My(x).diff(x).func is Derivative assert My(x).diff(x, 3).func is Derivative assert re(x).diff(x, 2) == Derivative(re(x), (x, 2)) # issue 15518 assert diff(NDimArray([re(x), im(x)]), (x, 2)) == NDimArray( [Derivative(re(x), (x, 2)), Derivative(im(x), (x, 2))]) # it doesn't have y so it shouldn't need a method for this case assert My(x).diff(y) == 0 def test_speed(): # this should return in 0.0s. If it takes forever, it's wrong. assert x.diff(x, 10**8) == 0 def test_deriv_noncommutative(): A = Symbol("A", commutative=False) f = Function("f") assert A*f(x)*A == f(x)*A**2 assert A*f(x).diff(x)*A == f(x).diff(x) * A**2 def test_diff_nth_derivative(): f = Function("f") n = Symbol("n", integer=True) expr = diff(sin(x), (x, n)) expr2 = diff(f(x), (x, 2)) expr3 = diff(f(x), (x, n)) assert expr.subs(sin(x), cos(-x)) == Derivative(cos(-x), (x, n)) assert expr.subs(n, 1).doit() == cos(x) assert expr.subs(n, 2).doit() == -sin(x) assert expr2.subs(Derivative(f(x), x), y) == Derivative(y, x) # Currently not supported (cannot determine if `n > 1`): #assert expr3.subs(Derivative(f(x), x), y) == Derivative(y, (x, n-1)) assert expr3 == Derivative(f(x), (x, n)) assert diff(x, (x, n)) == Piecewise((x, Eq(n, 0)), (1, Eq(n, 1)), (0, True)) assert diff(2*x, (x, n)).dummy_eq( Sum(Piecewise((2*x*factorial(n)/(factorial(y)*factorial(-y + n)), Eq(y, 0) & Eq(Max(0, -y + n), 0)), (2*factorial(n)/(factorial(y)*factorial(-y + n)), Eq(y, 0) & Eq(Max(0, -y + n), 1)), (0, True)), (y, 0, n))) # TODO: assert diff(x**2, (x, n)) == x**(2-n)*ff(2, n) exprm = x*sin(x) mul_diff = diff(exprm, (x, n)) assert isinstance(mul_diff, Sum) for i in range(5): assert mul_diff.subs(n, i).doit() == exprm.diff((x, i)).expand() exprm2 = 2*y*x*sin(x)*cos(x)*log(x)*exp(x) dex = exprm2.diff((x, n)) assert isinstance(dex, Sum) for i in range(7): assert dex.subs(n, i).doit().expand() == \ exprm2.diff((x, i)).expand() assert (cos(x)*sin(y)).diff([[x, y, z]]) == NDimArray([ -sin(x)*sin(y), cos(x)*cos(y), 0]) def test_issue_16160(): assert Derivative(x**3, (x, x)).subs(x, 2) == Subs( Derivative(x**3, (x, 2)), x, 2) assert Derivative(1 + x**3, (x, x)).subs(x, 0 ) == Derivative(1 + y**3, (y, 0)).subs(y, 0)
3e107951aede468677c624913072a82f1b73fcd4f7276bf8174c0f3074a8bc52
"""Tests for noncommutative symbols and expressions.""" from sympy import ( adjoint, cancel, collect, combsimp, conjugate, cos, expand, factor, gammasimp, posify, radsimp, ratsimp, rcollect, sin, simplify, symbols, transpose, trigsimp, I, ) from sympy.abc import x, y, z from sympy.testing.pytest import XFAIL A, B, C = symbols("A B C", commutative=False) X = symbols("X", commutative=False, hermitian=True) Y = symbols("Y", commutative=False, antihermitian=True) def test_adjoint(): assert adjoint(A).is_commutative is False assert adjoint(A*A) == adjoint(A)**2 assert adjoint(A*B) == adjoint(B)*adjoint(A) assert adjoint(A*B**2) == adjoint(B)**2*adjoint(A) assert adjoint(A*B - B*A) == adjoint(B)*adjoint(A) - adjoint(A)*adjoint(B) assert adjoint(A + I*B) == adjoint(A) - I*adjoint(B) assert adjoint(X) == X assert adjoint(-I*X) == I*X assert adjoint(Y) == -Y assert adjoint(-I*Y) == -I*Y assert adjoint(X) == conjugate(transpose(X)) assert adjoint(Y) == conjugate(transpose(Y)) assert adjoint(X) == transpose(conjugate(X)) assert adjoint(Y) == transpose(conjugate(Y)) def test_cancel(): assert cancel(A*B - B*A) == A*B - B*A assert cancel(A*B*(x - 1)) == A*B*(x - 1) assert cancel(A*B*(x**2 - 1)/(x + 1)) == A*B*(x - 1) assert cancel(A*B*(x**2 - 1)/(x + 1) - B*A*(x - 1)) == A*B*(x - 1) + (1 - x)*B*A @XFAIL def test_collect(): assert collect(A*B - B*A, A) == A*B - B*A assert collect(A*B - B*A, B) == A*B - B*A assert collect(A*B - B*A, x) == A*B - B*A def test_combsimp(): assert combsimp(A*B - B*A) == A*B - B*A def test_gammasimp(): assert gammasimp(A*B - B*A) == A*B - B*A def test_conjugate(): assert conjugate(A).is_commutative is False assert (A*A).conjugate() == conjugate(A)**2 assert (A*B).conjugate() == conjugate(A)*conjugate(B) assert (A*B**2).conjugate() == conjugate(A)*conjugate(B)**2 assert (A*B - B*A).conjugate() == \ conjugate(A)*conjugate(B) - conjugate(B)*conjugate(A) assert (A*B).conjugate() - (B*A).conjugate() == \ conjugate(A)*conjugate(B) - conjugate(B)*conjugate(A) assert (A + I*B).conjugate() == conjugate(A) - I*conjugate(B) def test_expand(): assert expand((A*B)**2) == A*B*A*B assert expand(A*B - B*A) == A*B - B*A assert expand((A*B/A)**2) == A*B*B/A assert expand(B*A*(A + B)*B) == B*A**2*B + B*A*B**2 assert expand(B*A*(A + C)*B) == B*A**2*B + B*A*C*B def test_factor(): assert factor(A*B - B*A) == A*B - B*A def test_posify(): assert posify(A)[0].is_commutative is False for q in (A*B/A, (A*B/A)**2, (A*B)**2, A*B - B*A): p = posify(q) assert p[0].subs(p[1]) == q def test_radsimp(): assert radsimp(A*B - B*A) == A*B - B*A @XFAIL def test_ratsimp(): assert ratsimp(A*B - B*A) == A*B - B*A @XFAIL def test_rcollect(): assert rcollect(A*B - B*A, A) == A*B - B*A assert rcollect(A*B - B*A, B) == A*B - B*A assert rcollect(A*B - B*A, x) == A*B - B*A def test_simplify(): assert simplify(A*B - B*A) == A*B - B*A def test_subs(): assert (x*y*A).subs(x*y, z) == A*z assert (x*A*B).subs(x*A, C) == C*B assert (x*A*x*x).subs(x**2*A, C) == x*C assert (x*A*x*B).subs(x**2*A, C) == C*B assert (A**2*B**2).subs(A*B**2, C) == A*C assert (A*A*A + A*B*A).subs(A*A*A, C) == C + A*B*A def test_transpose(): assert transpose(A).is_commutative is False assert transpose(A*A) == transpose(A)**2 assert transpose(A*B) == transpose(B)*transpose(A) assert transpose(A*B**2) == transpose(B)**2*transpose(A) assert transpose(A*B - B*A) == \ transpose(B)*transpose(A) - transpose(A)*transpose(B) assert transpose(A + I*B) == transpose(A) + I*transpose(B) assert transpose(X) == conjugate(X) assert transpose(-I*X) == -I*conjugate(X) assert transpose(Y) == -conjugate(Y) assert transpose(-I*Y) == I*conjugate(Y) def test_trigsimp(): assert trigsimp(A*sin(x)**2 + A*cos(x)**2) == A
089d9614b4b5aa8d56d30f55bae46d54467f5270814a5427fb69bb8fb5b514b8
"""Tests for tools for manipulating of large commutative expressions. """ from sympy import (S, Add, sin, Mul, Symbol, oo, Integral, sqrt, Tuple, I, Function, Interval, O, symbols, simplify, collect, Sum, Basic, Dict, root, exp, cos, Dummy, log, Rational) from sympy.core.exprtools import (decompose_power, Factors, Term, _gcd_terms, gcd_terms, factor_terms, factor_nc, _mask_nc, _monotonic_sign) from sympy.core.mul import _keep_coeff as _keep_coeff from sympy.simplify.cse_opts import sub_pre from sympy.testing.pytest import raises from sympy.abc import a, b, t, x, y, z def test_decompose_power(): assert decompose_power(x) == (x, 1) assert decompose_power(x**2) == (x, 2) assert decompose_power(x**(2*y)) == (x**y, 2) assert decompose_power(x**(2*y/3)) == (x**(y/3), 2) assert decompose_power(x**(y*Rational(2, 3))) == (x**(y/3), 2) def test_Factors(): assert Factors() == Factors({}) == Factors(S.One) assert Factors().as_expr() is S.One assert Factors({x: 2, y: 3, sin(x): 4}).as_expr() == x**2*y**3*sin(x)**4 assert Factors(S.Infinity) == Factors({oo: 1}) assert Factors(S.NegativeInfinity) == Factors({oo: 1, -1: 1}) # issue #18059: assert Factors((x**2)**S.Half).as_expr() == (x**2)**S.Half a = Factors({x: 5, y: 3, z: 7}) b = Factors({ y: 4, z: 3, t: 10}) assert a.mul(b) == a*b == Factors({x: 5, y: 7, z: 10, t: 10}) assert a.div(b) == divmod(a, b) == \ (Factors({x: 5, z: 4}), Factors({y: 1, t: 10})) assert a.quo(b) == a/b == Factors({x: 5, z: 4}) assert a.rem(b) == a % b == Factors({y: 1, t: 10}) assert a.pow(3) == a**3 == Factors({x: 15, y: 9, z: 21}) assert b.pow(3) == b**3 == Factors({y: 12, z: 9, t: 30}) assert a.gcd(b) == Factors({y: 3, z: 3}) assert a.lcm(b) == Factors({x: 5, y: 4, z: 7, t: 10}) a = Factors({x: 4, y: 7, t: 7}) b = Factors({z: 1, t: 3}) assert a.normal(b) == (Factors({x: 4, y: 7, t: 4}), Factors({z: 1})) assert Factors(sqrt(2)*x).as_expr() == sqrt(2)*x assert Factors(-I)*I == Factors() assert Factors({S.NegativeOne: S(3)})*Factors({S.NegativeOne: S.One, I: S(5)}) == \ Factors(I) assert Factors(S(2)**x).div(S(3)**x) == \ (Factors({S(2): x}), Factors({S(3): x})) assert Factors(2**(2*x + 2)).div(S(8)) == \ (Factors({S(2): 2*x + 2}), Factors({S(8): S.One})) # coverage # /!\ things break if this is not True assert Factors({S.NegativeOne: Rational(3, 2)}) == Factors({I: S.One, S.NegativeOne: S.One}) assert Factors({I: S.One, S.NegativeOne: Rational(1, 3)}).as_expr() == I*(-1)**Rational(1, 3) assert Factors(-1.) == Factors({S.NegativeOne: S.One, S(1.): 1}) assert Factors(-2.) == Factors({S.NegativeOne: S.One, S(2.): 1}) assert Factors((-2.)**x) == Factors({S(-2.): x}) assert Factors(S(-2)) == Factors({S.NegativeOne: S.One, S(2): 1}) assert Factors(S.Half) == Factors({S(2): -S.One}) assert Factors(Rational(3, 2)) == Factors({S(3): S.One, S(2): S.NegativeOne}) assert Factors({I: S.One}) == Factors(I) assert Factors({-1.0: 2, I: 1}) == Factors({S(1.0): 1, I: 1}) assert Factors({S.NegativeOne: Rational(-3, 2)}).as_expr() == I A = symbols('A', commutative=False) assert Factors(2*A**2) == Factors({S(2): 1, A**2: 1}) assert Factors(I) == Factors({I: S.One}) assert Factors(x).normal(S(2)) == (Factors(x), Factors(S(2))) assert Factors(x).normal(S.Zero) == (Factors(), Factors(S.Zero)) raises(ZeroDivisionError, lambda: Factors(x).div(S.Zero)) assert Factors(x).mul(S(2)) == Factors(2*x) assert Factors(x).mul(S.Zero).is_zero assert Factors(x).mul(1/x).is_one assert Factors(x**sqrt(2)**3).as_expr() == x**(2*sqrt(2)) assert Factors(x)**Factors(S(2)) == Factors(x**2) assert Factors(x).gcd(S.Zero) == Factors(x) assert Factors(x).lcm(S.Zero).is_zero assert Factors(S.Zero).div(x) == (Factors(S.Zero), Factors()) assert Factors(x).div(x) == (Factors(), Factors()) assert Factors({x: .2})/Factors({x: .2}) == Factors() assert Factors(x) != Factors() assert Factors(S.Zero).normal(x) == (Factors(S.Zero), Factors()) n, d = x**(2 + y), x**2 f = Factors(n) assert f.div(d) == f.normal(d) == (Factors(x**y), Factors()) assert f.gcd(d) == Factors() d = x**y assert f.div(d) == f.normal(d) == (Factors(x**2), Factors()) assert f.gcd(d) == Factors(d) n = d = 2**x f = Factors(n) assert f.div(d) == f.normal(d) == (Factors(), Factors()) assert f.gcd(d) == Factors(d) n, d = 2**x, 2**y f = Factors(n) assert f.div(d) == f.normal(d) == (Factors({S(2): x}), Factors({S(2): y})) assert f.gcd(d) == Factors() # extraction of constant only n = x**(x + 3) assert Factors(n).normal(x**-3) == (Factors({x: x + 6}), Factors({})) assert Factors(n).normal(x**3) == (Factors({x: x}), Factors({})) assert Factors(n).normal(x**4) == (Factors({x: x}), Factors({x: 1})) assert Factors(n).normal(x**(y - 3)) == \ (Factors({x: x + 6}), Factors({x: y})) assert Factors(n).normal(x**(y + 3)) == (Factors({x: x}), Factors({x: y})) assert Factors(n).normal(x**(y + 4)) == \ (Factors({x: x}), Factors({x: y + 1})) assert Factors(n).div(x**-3) == (Factors({x: x + 6}), Factors({})) assert Factors(n).div(x**3) == (Factors({x: x}), Factors({})) assert Factors(n).div(x**4) == (Factors({x: x}), Factors({x: 1})) assert Factors(n).div(x**(y - 3)) == \ (Factors({x: x + 6}), Factors({x: y})) assert Factors(n).div(x**(y + 3)) == (Factors({x: x}), Factors({x: y})) assert Factors(n).div(x**(y + 4)) == \ (Factors({x: x}), Factors({x: y + 1})) assert Factors(3 * x / 2) == Factors({3: 1, 2: -1, x: 1}) assert Factors(x * x / y) == Factors({x: 2, y: -1}) assert Factors(27 * x / y**9) == Factors({27: 1, x: 1, y: -9}) def test_Term(): a = Term(4*x*y**2/z/t**3) b = Term(2*x**3*y**5/t**3) assert a == Term(4, Factors({x: 1, y: 2}), Factors({z: 1, t: 3})) assert b == Term(2, Factors({x: 3, y: 5}), Factors({t: 3})) assert a.as_expr() == 4*x*y**2/z/t**3 assert b.as_expr() == 2*x**3*y**5/t**3 assert a.inv() == \ Term(S.One/4, Factors({z: 1, t: 3}), Factors({x: 1, y: 2})) assert b.inv() == Term(S.Half, Factors({t: 3}), Factors({x: 3, y: 5})) assert a.mul(b) == a*b == \ Term(8, Factors({x: 4, y: 7}), Factors({z: 1, t: 6})) assert a.quo(b) == a/b == Term(2, Factors({}), Factors({x: 2, y: 3, z: 1})) assert a.pow(3) == a**3 == \ Term(64, Factors({x: 3, y: 6}), Factors({z: 3, t: 9})) assert b.pow(3) == b**3 == Term(8, Factors({x: 9, y: 15}), Factors({t: 9})) assert a.pow(-3) == a**(-3) == \ Term(S.One/64, Factors({z: 3, t: 9}), Factors({x: 3, y: 6})) assert b.pow(-3) == b**(-3) == \ Term(S.One/8, Factors({t: 9}), Factors({x: 9, y: 15})) assert a.gcd(b) == Term(2, Factors({x: 1, y: 2}), Factors({t: 3})) assert a.lcm(b) == Term(4, Factors({x: 3, y: 5}), Factors({z: 1, t: 3})) a = Term(4*x*y**2/z/t**3) b = Term(2*x**3*y**5*t**7) assert a.mul(b) == Term(8, Factors({x: 4, y: 7, t: 4}), Factors({z: 1})) assert Term((2*x + 2)**3) == Term(8, Factors({x + 1: 3}), Factors({})) assert Term((2*x + 2)*(3*x + 6)**2) == \ Term(18, Factors({x + 1: 1, x + 2: 2}), Factors({})) def test_gcd_terms(): f = 2*(x + 1)*(x + 4)/(5*x**2 + 5) + (2*x + 2)*(x + 5)/(x**2 + 1)/5 + \ (2*x + 2)*(x + 6)/(5*x**2 + 5) assert _gcd_terms(f) == ((Rational(6, 5))*((1 + x)/(1 + x**2)), 5 + x, 1) assert _gcd_terms(Add.make_args(f)) == \ ((Rational(6, 5))*((1 + x)/(1 + x**2)), 5 + x, 1) newf = (Rational(6, 5))*((1 + x)*(5 + x)/(1 + x**2)) assert gcd_terms(f) == newf args = Add.make_args(f) # non-Basic sequences of terms treated as terms of Add assert gcd_terms(list(args)) == newf assert gcd_terms(tuple(args)) == newf assert gcd_terms(set(args)) == newf # but a Basic sequence is treated as a container assert gcd_terms(Tuple(*args)) != newf assert gcd_terms(Basic(Tuple(1, 3*y + 3*x*y), Tuple(1, 3))) == \ Basic((1, 3*y*(x + 1)), (1, 3)) # but we shouldn't change keys of a dictionary or some may be lost assert gcd_terms(Dict((x*(1 + y), 2), (x + x*y, y + x*y))) == \ Dict({x*(y + 1): 2, x + x*y: y*(1 + x)}) assert gcd_terms((2*x + 2)**3 + (2*x + 2)**2) == 4*(x + 1)**2*(2*x + 3) assert gcd_terms(0) == 0 assert gcd_terms(1) == 1 assert gcd_terms(x) == x assert gcd_terms(2 + 2*x) == Mul(2, 1 + x, evaluate=False) arg = x*(2*x + 4*y) garg = 2*x*(x + 2*y) assert gcd_terms(arg) == garg assert gcd_terms(sin(arg)) == sin(garg) # issue 6139-like alpha, alpha1, alpha2, alpha3 = symbols('alpha:4') a = alpha**2 - alpha*x**2 + alpha + x**3 - x*(alpha + 1) rep = (alpha, (1 + sqrt(5))/2 + alpha1*x + alpha2*x**2 + alpha3*x**3) s = (a/(x - alpha)).subs(*rep).series(x, 0, 1) assert simplify(collect(s, x)) == -sqrt(5)/2 - Rational(3, 2) + O(x) # issue 5917 assert _gcd_terms([S.Zero, S.Zero]) == (0, 0, 1) assert _gcd_terms([2*x + 4]) == (2, x + 2, 1) eq = x/(x + 1/x) assert gcd_terms(eq, fraction=False) == eq eq = x/2/y + 1/x/y assert gcd_terms(eq, fraction=True, clear=True) == \ (x**2 + 2)/(2*x*y) assert gcd_terms(eq, fraction=True, clear=False) == \ (x**2/2 + 1)/(x*y) assert gcd_terms(eq, fraction=False, clear=True) == \ (x + 2/x)/(2*y) assert gcd_terms(eq, fraction=False, clear=False) == \ (x/2 + 1/x)/y def test_factor_terms(): A = Symbol('A', commutative=False) assert factor_terms(9*(x + x*y + 1) + (3*x + 3)**(2 + 2*x)) == \ 9*x*y + 9*x + _keep_coeff(S(3), x + 1)**_keep_coeff(S(2), x + 1) + 9 assert factor_terms(9*(x + x*y + 1) + (3)**(2 + 2*x)) == \ _keep_coeff(S(9), 3**(2*x) + x*y + x + 1) assert factor_terms(3**(2 + 2*x) + a*3**(2 + 2*x)) == \ 9*3**(2*x)*(a + 1) assert factor_terms(x + x*A) == \ x*(1 + A) assert factor_terms(sin(x + x*A)) == \ sin(x*(1 + A)) assert factor_terms((3*x + 3)**((2 + 2*x)/3)) == \ _keep_coeff(S(3), x + 1)**_keep_coeff(Rational(2, 3), x + 1) assert factor_terms(x + (x*y + x)**(3*x + 3)) == \ x + (x*(y + 1))**_keep_coeff(S(3), x + 1) assert factor_terms(a*(x + x*y) + b*(x*2 + y*x*2)) == \ x*(a + 2*b)*(y + 1) i = Integral(x, (x, 0, oo)) assert factor_terms(i) == i assert factor_terms(x/2 + y) == x/2 + y # fraction doesn't apply to integer denominators assert factor_terms(x/2 + y, fraction=True) == x/2 + y # clear *does* apply to the integer denominators assert factor_terms(x/2 + y, clear=True) == Mul(S.Half, x + 2*y, evaluate=False) # check radical extraction eq = sqrt(2) + sqrt(10) assert factor_terms(eq) == eq assert factor_terms(eq, radical=True) == sqrt(2)*(1 + sqrt(5)) eq = root(-6, 3) + root(6, 3) assert factor_terms(eq, radical=True) == 6**(S.One/3)*(1 + (-1)**(S.One/3)) eq = [x + x*y] ans = [x*(y + 1)] for c in [list, tuple, set]: assert factor_terms(c(eq)) == c(ans) assert factor_terms(Tuple(x + x*y)) == Tuple(x*(y + 1)) assert factor_terms(Interval(0, 1)) == Interval(0, 1) e = 1/sqrt(a/2 + 1) assert factor_terms(e, clear=False) == 1/sqrt(a/2 + 1) assert factor_terms(e, clear=True) == sqrt(2)/sqrt(a + 2) eq = x/(x + 1/x) + 1/(x**2 + 1) assert factor_terms(eq, fraction=False) == eq assert factor_terms(eq, fraction=True) == 1 assert factor_terms((1/(x**3 + x**2) + 2/x**2)*y) == \ y*(2 + 1/(x + 1))/x**2 # if not True, then processesing for this in factor_terms is not necessary assert gcd_terms(-x - y) == -x - y assert factor_terms(-x - y) == Mul(-1, x + y, evaluate=False) # if not True, then "special" processesing in factor_terms is not necessary assert gcd_terms(exp(Mul(-1, x + 1))) == exp(-x - 1) e = exp(-x - 2) + x assert factor_terms(e) == exp(Mul(-1, x + 2, evaluate=False)) + x assert factor_terms(e, sign=False) == e assert factor_terms(exp(-4*x - 2) - x) == -x + exp(Mul(-2, 2*x + 1, evaluate=False)) # sum/integral tests for F in (Sum, Integral): assert factor_terms(F(x, (y, 1, 10))) == x * F(1, (y, 1, 10)) assert factor_terms(F(x, (y, 1, 10)) + x) == x * (1 + F(1, (y, 1, 10))) assert factor_terms(F(x*y + x*y**2, (y, 1, 10))) == x*F(y*(y + 1), (y, 1, 10)) def test_xreplace(): e = Mul(2, 1 + x, evaluate=False) assert e.xreplace({}) == e assert e.xreplace({y: x}) == e def test_factor_nc(): x, y = symbols('x,y') k = symbols('k', integer=True) n, m, o = symbols('n,m,o', commutative=False) # mul and multinomial expansion is needed from sympy.core.function import _mexpand e = x*(1 + y)**2 assert _mexpand(e) == x + x*2*y + x*y**2 def factor_nc_test(e): ex = _mexpand(e) assert ex.is_Add f = factor_nc(ex) assert not f.is_Add and _mexpand(f) == ex factor_nc_test(x*(1 + y)) factor_nc_test(n*(x + 1)) factor_nc_test(n*(x + m)) factor_nc_test((x + m)*n) factor_nc_test(n*m*(x*o + n*o*m)*n) s = Sum(x, (x, 1, 2)) factor_nc_test(x*(1 + s)) factor_nc_test(x*(1 + s)*s) factor_nc_test(x*(1 + sin(s))) factor_nc_test((1 + n)**2) factor_nc_test((x + n)*(x + m)*(x + y)) factor_nc_test(x*(n*m + 1)) factor_nc_test(x*(n*m + x)) factor_nc_test(x*(x*n*m + 1)) factor_nc_test(x*n*(x*m + 1)) factor_nc_test(x*(m*n + x*n*m)) factor_nc_test(n*(1 - m)*n**2) factor_nc_test((n + m)**2) factor_nc_test((n - m)*(n + m)**2) factor_nc_test((n + m)**2*(n - m)) factor_nc_test((m - n)*(n + m)**2*(n - m)) assert factor_nc(n*(n + n*m)) == n**2*(1 + m) assert factor_nc(m*(m*n + n*m*n**2)) == m*(m + n*m*n)*n eq = m*sin(n) - sin(n)*m assert factor_nc(eq) == eq # for coverage: from sympy.physics.secondquant import Commutator from sympy import factor eq = 1 + x*Commutator(m, n) assert factor_nc(eq) == eq eq = x*Commutator(m, n) + x*Commutator(m, o)*Commutator(m, n) assert factor(eq) == x*(1 + Commutator(m, o))*Commutator(m, n) # issue 6534 assert (2*n + 2*m).factor() == 2*(n + m) # issue 6701 assert factor_nc(n**k + n**(k + 1)) == n**k*(1 + n) assert factor_nc((m*n)**k + (m*n)**(k + 1)) == (1 + m*n)*(m*n)**k # issue 6918 assert factor_nc(-n*(2*x**2 + 2*x)) == -2*n*x*(x + 1) def test_issue_6360(): a, b = symbols("a b") apb = a + b eq = apb + apb**2*(-2*a - 2*b) assert factor_terms(sub_pre(eq)) == a + b - 2*(a + b)**3 def test_issue_7903(): a = symbols(r'a', real=True) t = exp(I*cos(a)) + exp(-I*sin(a)) assert t.simplify() def test_issue_8263(): F, G = symbols('F, G', commutative=False, cls=Function) x, y = symbols('x, y') expr, dummies, _ = _mask_nc(F(x)*G(y) - G(y)*F(x)) for v in dummies.values(): assert not v.is_commutative assert not expr.is_zero def test_monotonic_sign(): F = _monotonic_sign x = symbols('x') assert F(x) is None assert F(-x) is None assert F(Dummy(prime=True)) == 2 assert F(Dummy(prime=True, odd=True)) == 3 assert F(Dummy(composite=True)) == 4 assert F(Dummy(composite=True, odd=True)) == 9 assert F(Dummy(positive=True, integer=True)) == 1 assert F(Dummy(positive=True, even=True)) == 2 assert F(Dummy(positive=True, even=True, prime=False)) == 4 assert F(Dummy(negative=True, integer=True)) == -1 assert F(Dummy(negative=True, even=True)) == -2 assert F(Dummy(zero=True)) == 0 assert F(Dummy(nonnegative=True)) == 0 assert F(Dummy(nonpositive=True)) == 0 assert F(Dummy(positive=True) + 1).is_positive assert F(Dummy(positive=True, integer=True) - 1).is_nonnegative assert F(Dummy(positive=True) - 1) is None assert F(Dummy(negative=True) + 1) is None assert F(Dummy(negative=True, integer=True) - 1).is_nonpositive assert F(Dummy(negative=True) - 1).is_negative assert F(-Dummy(positive=True) + 1) is None assert F(-Dummy(positive=True, integer=True) - 1).is_negative assert F(-Dummy(positive=True) - 1).is_negative assert F(-Dummy(negative=True) + 1).is_positive assert F(-Dummy(negative=True, integer=True) - 1).is_nonnegative assert F(-Dummy(negative=True) - 1) is None x = Dummy(negative=True) assert F(x**3).is_nonpositive assert F(x**3 + log(2)*x - 1).is_negative x = Dummy(positive=True) assert F(-x**3).is_nonpositive p = Dummy(positive=True) assert F(1/p).is_positive assert F(p/(p + 1)).is_positive p = Dummy(nonnegative=True) assert F(p/(p + 1)).is_nonnegative p = Dummy(positive=True) assert F(-1/p).is_negative p = Dummy(nonpositive=True) assert F(p/(-p + 1)).is_nonpositive p = Dummy(positive=True, integer=True) q = Dummy(positive=True, integer=True) assert F(-2/p/q).is_negative assert F(-2/(p - 1)/q) is None assert F((p - 1)*q + 1).is_positive assert F(-(p - 1)*q - 1).is_negative def test_issue_17256(): from sympy import Symbol, Range, Sum x = Symbol('x') s1 = Sum(x + 1, (x, 1, 9)) s2 = Sum(x + 1, (x, Range(1, 10))) a = Symbol('a') r1 = s1.xreplace({x:a}) r2 = s2.xreplace({x:a}) r1.doit() == r2.doit() s1 = Sum(x + 1, (x, 0, 9)) s2 = Sum(x + 1, (x, Range(10))) a = Symbol('a') r1 = s1.xreplace({x:a}) r2 = s2.xreplace({x:a}) assert r1 == r2
7ddf118bd861132ccf04cad0f8c176aea5d8498be8d3ab948ad748a09619fc96
from sympy import Symbol, Mul, symbols, Basic from sympy.testing.pytest import XFAIL class SymbolInMulOnce(Symbol): # Test class for a symbol that can only appear once in a `Mul` expression. pass Basic._constructor_postprocessor_mapping[SymbolInMulOnce] = { "Mul": [lambda x: x], "Pow": [lambda x: x.base if isinstance(x.base, SymbolInMulOnce) else x], "Add": [lambda x: x], } def _postprocess_SymbolRemovesOtherSymbols(expr): args = tuple(i for i in expr.args if not isinstance(i, Symbol) or isinstance(i, SymbolRemovesOtherSymbols)) if args == expr.args: return expr return Mul.fromiter(args) class SymbolRemovesOtherSymbols(Symbol): # Test class for a symbol that removes other symbols in `Mul`. pass Basic._constructor_postprocessor_mapping[SymbolRemovesOtherSymbols] = { "Mul": [_postprocess_SymbolRemovesOtherSymbols], } class SubclassSymbolInMulOnce(SymbolInMulOnce): pass class SubclassSymbolRemovesOtherSymbols(SymbolRemovesOtherSymbols): pass def test_constructor_postprocessors1(): x = SymbolInMulOnce("x") y = SymbolInMulOnce("y") assert isinstance(3*x, Mul) assert (3*x).args == (3, x) assert x*x == x assert 3*x*x == 3*x assert 2*x*x + x == 3*x assert x**3*y*y == x*y assert x**5 + y*x**3 == x + x*y w = SymbolRemovesOtherSymbols("w") assert x*w == w assert (3*w).args == (3, w) assert set((w + x).args) == set((x, w)) def test_constructor_postprocessors2(): x = SubclassSymbolInMulOnce("x") y = SubclassSymbolInMulOnce("y") assert isinstance(3*x, Mul) assert (3*x).args == (3, x) assert x*x == x assert 3*x*x == 3*x assert 2*x*x + x == 3*x assert x**3*y*y == x*y assert x**5 + y*x**3 == x + x*y w = SubclassSymbolRemovesOtherSymbols("w") assert x*w == w assert (3*w).args == (3, w) assert set((w + x).args) == set((x, w)) @XFAIL def test_subexpression_postprocessors(): # The postprocessors used to work with subexpressions, but the # functionality was removed. See #15948. a = symbols("a") x = SymbolInMulOnce("x") w = SymbolRemovesOtherSymbols("w") assert 3*a*w**2 == 3*w**2 assert 3*a*x**3*w**2 == 3*w**2 x = SubclassSymbolInMulOnce("x") w = SubclassSymbolRemovesOtherSymbols("w") assert 3*a*w**2 == 3*w**2 assert 3*a*x**3*w**2 == 3*w**2
dac21ce5224050cf81ad244f88a65e82aaba652eff0210347f440d2bb31c7acb
from sympy.core import ( Rational, Symbol, S, Float, Integer, Mul, Number, Pow, Basic, I, nan, pi, symbols, oo, zoo, N) from sympy.core.tests.test_evalf import NS from sympy.core.function import expand_multinomial from sympy.functions.elementary.miscellaneous import sqrt, cbrt from sympy.functions.elementary.exponential import exp, log from sympy.functions.special.error_functions import erf from sympy.functions.elementary.trigonometric import ( sin, cos, tan, sec, csc, sinh, cosh, tanh, atan) from sympy.series.order import O from sympy.core.expr import unchanged def test_rational(): a = Rational(1, 5) r = sqrt(5)/5 assert sqrt(a) == r assert 2*sqrt(a) == 2*r r = a*a**S.Half assert a**Rational(3, 2) == r assert 2*a**Rational(3, 2) == 2*r r = a**5*a**Rational(2, 3) assert a**Rational(17, 3) == r assert 2 * a**Rational(17, 3) == 2*r def test_large_rational(): e = (Rational(123712**12 - 1, 7) + Rational(1, 7))**Rational(1, 3) assert e == 234232585392159195136 * (Rational(1, 7)**Rational(1, 3)) def test_negative_real(): def feq(a, b): return abs(a - b) < 1E-10 assert feq(S.One / Float(-0.5), -Integer(2)) def test_expand(): x = Symbol('x') assert (2**(-1 - x)).expand() == S.Half*2**(-x) def test_issue_3449(): #test if powers are simplified correctly #see also issue 3995 x = Symbol('x') assert ((x**Rational(1, 3))**Rational(2)) == x**Rational(2, 3) assert ( (x**Rational(3))**Rational(2, 5)) == (x**Rational(3))**Rational(2, 5) a = Symbol('a', real=True) b = Symbol('b', real=True) assert (a**2)**b == (abs(a)**b)**2 assert sqrt(1/a) != 1/sqrt(a) # e.g. for a = -1 assert (a**3)**Rational(1, 3) != a assert (x**a)**b != x**(a*b) # e.g. x = -1, a=2, b=1/2 assert (x**.5)**b == x**(.5*b) assert (x**.5)**.5 == x**.25 assert (x**2.5)**.5 != x**1.25 # e.g. for x = 5*I k = Symbol('k', integer=True) m = Symbol('m', integer=True) assert (x**k)**m == x**(k*m) assert Number(5)**Rational(2, 3) == Number(25)**Rational(1, 3) assert (x**.5)**2 == x**1.0 assert (x**2)**k == (x**k)**2 == x**(2*k) a = Symbol('a', positive=True) assert (a**3)**Rational(2, 5) == a**Rational(6, 5) assert (a**2)**b == (a**b)**2 assert (a**Rational(2, 3))**x == a**(x*Rational(2, 3)) != (a**x)**Rational(2, 3) def test_issue_3866(): assert --sqrt(sqrt(5) - 1) == sqrt(sqrt(5) - 1) def test_negative_one(): x = Symbol('x', complex=True) y = Symbol('y', complex=True) assert 1/x**y == x**(-y) def test_issue_4362(): neg = Symbol('neg', negative=True) nonneg = Symbol('nonneg', nonnegative=True) any = Symbol('any') num, den = sqrt(1/neg).as_numer_denom() assert num == sqrt(-1) assert den == sqrt(-neg) num, den = sqrt(1/nonneg).as_numer_denom() assert num == 1 assert den == sqrt(nonneg) num, den = sqrt(1/any).as_numer_denom() assert num == sqrt(1/any) assert den == 1 def eqn(num, den, pow): return (num/den)**pow npos = 1 nneg = -1 dpos = 2 - sqrt(3) dneg = 1 - sqrt(3) assert dpos > 0 and dneg < 0 and npos > 0 and nneg < 0 # pos or neg integer eq = eqn(npos, dpos, 2) assert eq.is_Pow and eq.as_numer_denom() == (1, dpos**2) eq = eqn(npos, dneg, 2) assert eq.is_Pow and eq.as_numer_denom() == (1, dneg**2) eq = eqn(nneg, dpos, 2) assert eq.is_Pow and eq.as_numer_denom() == (1, dpos**2) eq = eqn(nneg, dneg, 2) assert eq.is_Pow and eq.as_numer_denom() == (1, dneg**2) eq = eqn(npos, dpos, -2) assert eq.is_Pow and eq.as_numer_denom() == (dpos**2, 1) eq = eqn(npos, dneg, -2) assert eq.is_Pow and eq.as_numer_denom() == (dneg**2, 1) eq = eqn(nneg, dpos, -2) assert eq.is_Pow and eq.as_numer_denom() == (dpos**2, 1) eq = eqn(nneg, dneg, -2) assert eq.is_Pow and eq.as_numer_denom() == (dneg**2, 1) # pos or neg rational pow = S.Half eq = eqn(npos, dpos, pow) assert eq.is_Pow and eq.as_numer_denom() == (npos**pow, dpos**pow) eq = eqn(npos, dneg, pow) assert eq.is_Pow is False and eq.as_numer_denom() == ((-npos)**pow, (-dneg)**pow) eq = eqn(nneg, dpos, pow) assert not eq.is_Pow or eq.as_numer_denom() == (nneg**pow, dpos**pow) eq = eqn(nneg, dneg, pow) assert eq.is_Pow and eq.as_numer_denom() == ((-nneg)**pow, (-dneg)**pow) eq = eqn(npos, dpos, -pow) assert eq.is_Pow and eq.as_numer_denom() == (dpos**pow, npos**pow) eq = eqn(npos, dneg, -pow) assert eq.is_Pow is False and eq.as_numer_denom() == (-(-npos)**pow*(-dneg)**pow, npos) eq = eqn(nneg, dpos, -pow) assert not eq.is_Pow or eq.as_numer_denom() == (dpos**pow, nneg**pow) eq = eqn(nneg, dneg, -pow) assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-nneg)**pow) # unknown exponent pow = 2*any eq = eqn(npos, dpos, pow) assert eq.is_Pow and eq.as_numer_denom() == (npos**pow, dpos**pow) eq = eqn(npos, dneg, pow) assert eq.is_Pow and eq.as_numer_denom() == ((-npos)**pow, (-dneg)**pow) eq = eqn(nneg, dpos, pow) assert eq.is_Pow and eq.as_numer_denom() == (nneg**pow, dpos**pow) eq = eqn(nneg, dneg, pow) assert eq.is_Pow and eq.as_numer_denom() == ((-nneg)**pow, (-dneg)**pow) eq = eqn(npos, dpos, -pow) assert eq.as_numer_denom() == (dpos**pow, npos**pow) eq = eqn(npos, dneg, -pow) assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-npos)**pow) eq = eqn(nneg, dpos, -pow) assert eq.is_Pow and eq.as_numer_denom() == (dpos**pow, nneg**pow) eq = eqn(nneg, dneg, -pow) assert eq.is_Pow and eq.as_numer_denom() == ((-dneg)**pow, (-nneg)**pow) x = Symbol('x') y = Symbol('y') assert ((1/(1 + x/3))**(-S.One)).as_numer_denom() == (3 + x, 3) notp = Symbol('notp', positive=False) # not positive does not imply real b = ((1 + x/notp)**-2) assert (b**(-y)).as_numer_denom() == (1, b**y) assert (b**(-S.One)).as_numer_denom() == ((notp + x)**2, notp**2) nonp = Symbol('nonp', nonpositive=True) assert (((1 + x/nonp)**-2)**(-S.One)).as_numer_denom() == ((-nonp - x)**2, nonp**2) n = Symbol('n', negative=True) assert (x**n).as_numer_denom() == (1, x**-n) assert sqrt(1/n).as_numer_denom() == (S.ImaginaryUnit, sqrt(-n)) n = Symbol('0 or neg', nonpositive=True) # if x and n are split up without negating each term and n is negative # then the answer might be wrong; if n is 0 it won't matter since # 1/oo and 1/zoo are both zero as is sqrt(0)/sqrt(-x) unless x is also # zero (in which case the negative sign doesn't matter): # 1/sqrt(1/-1) = -I but sqrt(-1)/sqrt(1) = I assert (1/sqrt(x/n)).as_numer_denom() == (sqrt(-n), sqrt(-x)) c = Symbol('c', complex=True) e = sqrt(1/c) assert e.as_numer_denom() == (e, 1) i = Symbol('i', integer=True) assert (((1 + x/y)**i)).as_numer_denom() == ((x + y)**i, y**i) def test_Pow_signs(): """Cf. issues 4595 and 5250""" x = Symbol('x') y = Symbol('y') n = Symbol('n', even=True) assert (3 - y)**2 != (y - 3)**2 assert (3 - y)**n != (y - 3)**n assert (-3 + y - x)**2 != (3 - y + x)**2 assert (y - 3)**3 != -(3 - y)**3 def test_power_with_noncommutative_mul_as_base(): x = Symbol('x', commutative=False) y = Symbol('y', commutative=False) assert not (x*y)**3 == x**3*y**3 assert (2*x*y)**3 == 8*(x*y)**3 def test_power_rewrite_exp(): assert (I**I).rewrite(exp) == exp(-pi/2) expr = (2 + 3*I)**(4 + 5*I) assert expr.rewrite(exp) == exp((4 + 5*I)*(log(sqrt(13)) + I*atan(Rational(3, 2)))) assert expr.rewrite(exp).expand() == \ 169*exp(5*I*log(13)/2)*exp(4*I*atan(Rational(3, 2)))*exp(-5*atan(Rational(3, 2))) assert ((6 + 7*I)**5).rewrite(exp) == 7225*sqrt(85)*exp(5*I*atan(Rational(7, 6))) expr = 5**(6 + 7*I) assert expr.rewrite(exp) == exp((6 + 7*I)*log(5)) assert expr.rewrite(exp).expand() == 15625*exp(7*I*log(5)) assert Pow(123, 789, evaluate=False).rewrite(exp) == 123**789 assert (1**I).rewrite(exp) == 1**I assert (0**I).rewrite(exp) == 0**I expr = (-2)**(2 + 5*I) assert expr.rewrite(exp) == exp((2 + 5*I)*(log(2) + I*pi)) assert expr.rewrite(exp).expand() == 4*exp(-5*pi)*exp(5*I*log(2)) assert ((-2)**S(-5)).rewrite(exp) == (-2)**S(-5) x, y = symbols('x y') assert (x**y).rewrite(exp) == exp(y*log(x)) assert (7**x).rewrite(exp) == exp(x*log(7), evaluate=False) assert ((2 + 3*I)**x).rewrite(exp) == exp(x*(log(sqrt(13)) + I*atan(Rational(3, 2)))) assert (y**(5 + 6*I)).rewrite(exp) == exp(log(y)*(5 + 6*I)) assert all((1/func(x)).rewrite(exp) == 1/(func(x).rewrite(exp)) for func in (sin, cos, tan, sec, csc, sinh, cosh, tanh)) def test_zero(): x = Symbol('x') y = Symbol('y') assert 0**x != 0 assert 0**(2*x) == 0**x assert 0**(1.0*x) == 0**x assert 0**(2.0*x) == 0**x assert (0**(2 - x)).as_base_exp() == (0, 2 - x) assert 0**(x - 2) != S.Infinity**(2 - x) assert 0**(2*x*y) == 0**(x*y) assert 0**(-2*x*y) == S.ComplexInfinity**(x*y) def test_pow_as_base_exp(): x = Symbol('x') assert (S.Infinity**(2 - x)).as_base_exp() == (S.Infinity, 2 - x) assert (S.Infinity**(x - 2)).as_base_exp() == (S.Infinity, x - 2) p = S.Half**x assert p.base, p.exp == p.as_base_exp() == (S(2), -x) # issue 8344: assert Pow(1, 2, evaluate=False).as_base_exp() == (S.One, S(2)) def test_issue_6100_12942_4473(): x = Symbol('x') y = Symbol('y') assert x**1.0 != x assert x != x**1.0 assert True != x**1.0 assert x**1.0 is not True assert x is not True assert x*y != (x*y)**1.0 # Pow != Symbol assert (x**1.0)**1.0 != x assert (x**1.0)**2.0 != x**2 b = Basic() assert Pow(b, 1.0, evaluate=False) != b # if the following gets distributed as a Mul (x**1.0*y**1.0 then # __eq__ methods could be added to Symbol and Pow to detect the # power-of-1.0 case. assert ((x*y)**1.0).func is Pow def test_issue_6208(): from sympy import root, Rational I = S.ImaginaryUnit assert sqrt(33**(I*Rational(9, 10))) == -33**(I*Rational(9, 20)) assert root((6*I)**(2*I), 3).as_base_exp()[1] == Rational(1, 3) # != 2*I/3 assert root((6*I)**(I/3), 3).as_base_exp()[1] == I/9 assert sqrt(exp(3*I)) == exp(I*Rational(3, 2)) assert sqrt(-sqrt(3)*(1 + 2*I)) == sqrt(sqrt(3))*sqrt(-1 - 2*I) assert sqrt(exp(5*I)) == -exp(I*Rational(5, 2)) assert root(exp(5*I), 3).exp == Rational(1, 3) def test_issue_6990(): x = Symbol('x') a = Symbol('a') b = Symbol('b') assert (sqrt(a + b*x + x**2)).series(x, 0, 3).removeO() == \ b*x/(2*sqrt(a)) + x**2*(1/(2*sqrt(a)) - \ b**2/(8*a**Rational(3, 2))) + sqrt(a) def test_issue_6068(): x = Symbol('x') assert sqrt(sin(x)).series(x, 0, 7) == \ sqrt(x) - x**Rational(5, 2)/12 + x**Rational(9, 2)/1440 - \ x**Rational(13, 2)/24192 + O(x**7) assert sqrt(sin(x)).series(x, 0, 9) == \ sqrt(x) - x**Rational(5, 2)/12 + x**Rational(9, 2)/1440 - \ x**Rational(13, 2)/24192 - 67*x**Rational(17, 2)/29030400 + O(x**9) assert sqrt(sin(x**3)).series(x, 0, 19) == \ x**Rational(3, 2) - x**Rational(15, 2)/12 + x**Rational(27, 2)/1440 + O(x**19) assert sqrt(sin(x**3)).series(x, 0, 20) == \ x**Rational(3, 2) - x**Rational(15, 2)/12 + x**Rational(27, 2)/1440 - \ x**Rational(39, 2)/24192 + O(x**20) def test_issue_6782(): x = Symbol('x') assert sqrt(sin(x**3)).series(x, 0, 7) == x**Rational(3, 2) + O(x**7) assert sqrt(sin(x**4)).series(x, 0, 3) == x**2 + O(x**3) def test_issue_6653(): x = Symbol('x') assert (1 / sqrt(1 + sin(x**2))).series(x, 0, 3) == 1 - x**2/2 + O(x**3) def test_issue_6429(): x = Symbol('x') c = Symbol('c') f = (c**2 + x)**(0.5) assert f.series(x, x0=0, n=1) == (c**2)**0.5 + O(x) assert f.taylor_term(0, x) == (c**2)**0.5 assert f.taylor_term(1, x) == 0.5*x*(c**2)**(-0.5) assert f.taylor_term(2, x) == -0.125*x**2*(c**2)**(-1.5) def test_issue_7638(): f = pi/log(sqrt(2)) assert ((1 + I)**(I*f/2))**0.3 == (1 + I)**(0.15*I*f) # if 1/3 -> 1.0/3 this should fail since it cannot be shown that the # sign will be +/-1; for the previous "small arg" case, it didn't matter # that this could not be proved assert (1 + I)**(4*I*f) == ((1 + I)**(12*I*f))**Rational(1, 3) assert (((1 + I)**(I*(1 + 7*f)))**Rational(1, 3)).exp == Rational(1, 3) r = symbols('r', real=True) assert sqrt(r**2) == abs(r) assert cbrt(r**3) != r assert sqrt(Pow(2*I, 5*S.Half)) != (2*I)**Rational(5, 4) p = symbols('p', positive=True) assert cbrt(p**2) == p**Rational(2, 3) assert NS(((0.2 + 0.7*I)**(0.7 + 1.0*I))**(0.5 - 0.1*I), 1) == '0.4 + 0.2*I' assert sqrt(1/(1 + I)) == sqrt(1 - I)/sqrt(2) # or 1/sqrt(1 + I) e = 1/(1 - sqrt(2)) assert sqrt(e) == I/sqrt(-1 + sqrt(2)) assert e**Rational(-1, 2) == -I*sqrt(-1 + sqrt(2)) assert sqrt((cos(1)**2 + sin(1)**2 - 1)**(3 + I)).exp in [S.Half, Rational(3, 2) + I/2] assert sqrt(r**Rational(4, 3)) != r**Rational(2, 3) assert sqrt((p + I)**Rational(4, 3)) == (p + I)**Rational(2, 3) assert sqrt((p - p**2*I)**2) == p - p**2*I assert sqrt((p + r*I)**2) != p + r*I e = (1 + I/5) assert sqrt(e**5) == e**(5*S.Half) assert sqrt(e**6) == e**3 assert sqrt((1 + I*r)**6) != (1 + I*r)**3 def test_issue_8582(): assert 1**oo is nan assert 1**(-oo) is nan assert 1**zoo is nan assert 1**(oo + I) is nan assert 1**(1 + I*oo) is nan assert 1**(oo + I*oo) is nan def test_issue_8650(): n = Symbol('n', integer=True, nonnegative=True) assert (n**n).is_positive is True x = 5*n + 5 assert (x**(5*(n + 1))).is_positive is True def test_issue_13914(): b = Symbol('b') assert (-1)**zoo is nan assert 2**zoo is nan assert (S.Half)**(1 + zoo) is nan assert I**(zoo + I) is nan assert b**(I + zoo) is nan def test_better_sqrt(): n = Symbol('n', integer=True, nonnegative=True) assert sqrt(3 + 4*I) == 2 + I assert sqrt(3 - 4*I) == 2 - I assert sqrt(-3 - 4*I) == 1 - 2*I assert sqrt(-3 + 4*I) == 1 + 2*I assert sqrt(32 + 24*I) == 6 + 2*I assert sqrt(32 - 24*I) == 6 - 2*I assert sqrt(-32 - 24*I) == 2 - 6*I assert sqrt(-32 + 24*I) == 2 + 6*I # triple (3, 4, 5): # parity of 3 matches parity of 5 and # den, 4, is a square assert sqrt((3 + 4*I)/4) == 1 + I/2 # triple (8, 15, 17) # parity of 8 doesn't match parity of 17 but # den/2, 8/2, is a square assert sqrt((8 + 15*I)/8) == (5 + 3*I)/4 # handle the denominator assert sqrt((3 - 4*I)/25) == (2 - I)/5 assert sqrt((3 - 4*I)/26) == (2 - I)/sqrt(26) # mul # issue #12739 assert sqrt((3 + 4*I)/(3 - 4*I)) == (3 + 4*I)/5 assert sqrt(2/(3 + 4*I)) == sqrt(2)/5*(2 - I) assert sqrt(n/(3 + 4*I)).subs(n, 2) == sqrt(2)/5*(2 - I) assert sqrt(-2/(3 + 4*I)) == sqrt(2)/5*(1 + 2*I) assert sqrt(-n/(3 + 4*I)).subs(n, 2) == sqrt(2)/5*(1 + 2*I) # power assert sqrt(1/(3 + I*4)) == (2 - I)/5 assert sqrt(1/(3 - I)) == sqrt(10)*sqrt(3 + I)/10 # symbolic i = symbols('i', imaginary=True) assert sqrt(3/i) == Mul(sqrt(3), 1/sqrt(i), evaluate=False) # multiples of 1/2; don't make this too automatic assert sqrt((3 + 4*I))**3 == (2 + I)**3 assert Pow(3 + 4*I, Rational(3, 2)) == 2 + 11*I assert Pow(6 + 8*I, Rational(3, 2)) == 2*sqrt(2)*(2 + 11*I) n, d = (3 + 4*I), (3 - 4*I)**3 a = n/d assert a.args == (1/d, n) eq = sqrt(a) assert eq.args == (a, S.Half) assert expand_multinomial(eq) == sqrt((-117 + 44*I)*(3 + 4*I))/125 assert eq.expand() == (7 - 24*I)/125 # issue 12775 # pos im part assert sqrt(2*I) == (1 + I) assert sqrt(2*9*I) == Mul(3, 1 + I, evaluate=False) assert Pow(2*I, 3*S.Half) == (1 + I)**3 # neg im part assert sqrt(-I/2) == Mul(S.Half, 1 - I, evaluate=False) # fractional im part assert Pow(Rational(-9, 2)*I, Rational(3, 2)) == 27*(1 - I)**3/8 def test_issue_2993(): x = Symbol('x') assert str((2.3*x - 4)**0.3) == '1.5157165665104*(0.575*x - 1)**0.3' assert str((2.3*x + 4)**0.3) == '1.5157165665104*(0.575*x + 1)**0.3' assert str((-2.3*x + 4)**0.3) == '1.5157165665104*(1 - 0.575*x)**0.3' assert str((-2.3*x - 4)**0.3) == '1.5157165665104*(-0.575*x - 1)**0.3' assert str((2.3*x - 2)**0.3) == '1.28386201800527*(x - 0.869565217391304)**0.3' assert str((-2.3*x - 2)**0.3) == '1.28386201800527*(-x - 0.869565217391304)**0.3' assert str((-2.3*x + 2)**0.3) == '1.28386201800527*(0.869565217391304 - x)**0.3' assert str((2.3*x + 2)**0.3) == '1.28386201800527*(x + 0.869565217391304)**0.3' assert str((2.3*x - 4)**Rational(1, 3)) == '2**(2/3)*(0.575*x - 1)**(1/3)' eq = (2.3*x + 4) assert eq**2 == 16*(0.575*x + 1)**2 assert (1/eq).args == (eq, -1) # don't change trivial power # issue 17735 q=.5*exp(x) - .5*exp(-x) + 0.1 assert int((q**2).subs(x, 1)) == 1 # issue 17756 y = Symbol('y') assert len(sqrt(x/(x + y)**2 + Float('0.008', 30)).subs(y, pi.n(25)).atoms(Float)) == 2 # issue 17756 a, b, c, d, e, f, g = symbols('a:g') expr = sqrt(1 + a*(c**4 + g*d - 2*g*e - f*(-g + d))**2/ (c**3*b**2*(d - 3*e + 2*f)**2))/2 r = [ (a, N('0.0170992456333788667034850458615', 30)), (b, N('0.0966594956075474769169134801223', 30)), (c, N('0.390911862903463913632151616184', 30)), (d, N('0.152812084558656566271750185933', 30)), (e, N('0.137562344465103337106561623432', 30)), (f, N('0.174259178881496659302933610355', 30)), (g, N('0.220745448491223779615401870086', 30))] tru = expr.n(30, subs=dict(r)) seq = expr.subs(r) # although `tru` is the right way to evaluate # expr with numerical values, `seq` will have # significant loss of precision if extraction of # the largest coefficient of a power's base's terms # is done improperly assert seq == tru def test_issue_17450(): assert (erf(cosh(1)**7)**I).is_real is None assert (erf(cosh(1)**7)**I).is_imaginary is False assert (Pow(exp(1+sqrt(2)), ((1-sqrt(2))*I*pi), evaluate=False)).is_real is None assert ((-10)**(10*I*pi/3)).is_real is False assert ((-5)**(4*I*pi)).is_real is False def test_issue_18190(): assert sqrt(1 / tan(1 + I)) == 1 / sqrt(tan(1 + I)) def test_issue_14815(): x = Symbol('x', real=True) assert sqrt(x).is_extended_negative is False x = Symbol('x', real=False) assert sqrt(x).is_extended_negative is None x = Symbol('x', complex=True) assert sqrt(x).is_extended_negative is False x = Symbol('x', extended_real=True) assert sqrt(x).is_extended_negative is False assert sqrt(zoo, evaluate=False).is_extended_negative is None assert sqrt(nan, evaluate=False).is_extended_negative is None def test_issue_18509(): assert unchanged(Mul, oo, 1/pi**oo) assert (1/pi**oo).is_extended_positive == False
510b1b84e94a1486e2b36060fab564636e3567ee6c41cc2e740babd815edecd4
from sympy import I, sqrt, log, exp, sin, asin, factorial, Mod, pi, oo from sympy.core import Symbol, S, Rational, Integer, Dummy, Wild, Pow from sympy.core.facts import InconsistentAssumptions from sympy import simplify from sympy.testing.pytest import raises, XFAIL def test_symbol_unset(): x = Symbol('x', real=True, integer=True) assert x.is_real is True assert x.is_integer is True assert x.is_imaginary is False assert x.is_noninteger is False assert x.is_number is False def test_zero(): z = Integer(0) assert z.is_commutative is True assert z.is_integer is True assert z.is_rational is True assert z.is_algebraic is True assert z.is_transcendental is False assert z.is_real is True assert z.is_complex is True assert z.is_noninteger is False assert z.is_irrational is False assert z.is_imaginary is False assert z.is_positive is False assert z.is_negative is False assert z.is_nonpositive is True assert z.is_nonnegative is True assert z.is_even is True assert z.is_odd is False assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is True assert z.is_prime is False assert z.is_composite is False assert z.is_number is True def test_one(): z = Integer(1) assert z.is_commutative is True assert z.is_integer is True assert z.is_rational is True assert z.is_algebraic is True assert z.is_transcendental is False assert z.is_real is True assert z.is_complex is True assert z.is_noninteger is False assert z.is_irrational is False assert z.is_imaginary is False assert z.is_positive is True assert z.is_negative is False assert z.is_nonpositive is False assert z.is_nonnegative is True assert z.is_even is False assert z.is_odd is True assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is True assert z.is_prime is False assert z.is_number is True assert z.is_composite is False # issue 8807 def test_negativeone(): z = Integer(-1) assert z.is_commutative is True assert z.is_integer is True assert z.is_rational is True assert z.is_algebraic is True assert z.is_transcendental is False assert z.is_real is True assert z.is_complex is True assert z.is_noninteger is False assert z.is_irrational is False assert z.is_imaginary is False assert z.is_positive is False assert z.is_negative is True assert z.is_nonpositive is True assert z.is_nonnegative is False assert z.is_even is False assert z.is_odd is True assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is True assert z.is_prime is False assert z.is_composite is False assert z.is_number is True def test_infinity(): oo = S.Infinity assert oo.is_commutative is True assert oo.is_integer is False assert oo.is_rational is False assert oo.is_algebraic is False assert oo.is_transcendental is False assert oo.is_extended_real is True assert oo.is_real is False assert oo.is_complex is False assert oo.is_noninteger is True assert oo.is_irrational is False assert oo.is_imaginary is False assert oo.is_nonzero is False assert oo.is_positive is False assert oo.is_negative is False assert oo.is_nonpositive is False assert oo.is_nonnegative is False assert oo.is_extended_nonzero is True assert oo.is_extended_positive is True assert oo.is_extended_negative is False assert oo.is_extended_nonpositive is False assert oo.is_extended_nonnegative is True assert oo.is_even is False assert oo.is_odd is False assert oo.is_finite is False assert oo.is_infinite is True assert oo.is_comparable is True assert oo.is_prime is False assert oo.is_composite is False assert oo.is_number is True def test_neg_infinity(): mm = S.NegativeInfinity assert mm.is_commutative is True assert mm.is_integer is False assert mm.is_rational is False assert mm.is_algebraic is False assert mm.is_transcendental is False assert mm.is_extended_real is True assert mm.is_real is False assert mm.is_complex is False assert mm.is_noninteger is True assert mm.is_irrational is False assert mm.is_imaginary is False assert mm.is_nonzero is False assert mm.is_positive is False assert mm.is_negative is False assert mm.is_nonpositive is False assert mm.is_nonnegative is False assert mm.is_extended_nonzero is True assert mm.is_extended_positive is False assert mm.is_extended_negative is True assert mm.is_extended_nonpositive is True assert mm.is_extended_nonnegative is False assert mm.is_even is False assert mm.is_odd is False assert mm.is_finite is False assert mm.is_infinite is True assert mm.is_comparable is True assert mm.is_prime is False assert mm.is_composite is False assert mm.is_number is True def test_zoo(): zoo = S.ComplexInfinity assert zoo.is_complex is False assert zoo.is_real is False assert zoo.is_prime is False def test_nan(): nan = S.NaN assert nan.is_commutative is True assert nan.is_integer is None assert nan.is_rational is None assert nan.is_algebraic is None assert nan.is_transcendental is None assert nan.is_real is None assert nan.is_complex is None assert nan.is_noninteger is None assert nan.is_irrational is None assert nan.is_imaginary is None assert nan.is_positive is None assert nan.is_negative is None assert nan.is_nonpositive is None assert nan.is_nonnegative is None assert nan.is_even is None assert nan.is_odd is None assert nan.is_finite is None assert nan.is_infinite is None assert nan.is_comparable is False assert nan.is_prime is None assert nan.is_composite is None assert nan.is_number is True def test_pos_rational(): r = Rational(3, 4) assert r.is_commutative is True assert r.is_integer is False assert r.is_rational is True assert r.is_algebraic is True assert r.is_transcendental is False assert r.is_real is True assert r.is_complex is True assert r.is_noninteger is True assert r.is_irrational is False assert r.is_imaginary is False assert r.is_positive is True assert r.is_negative is False assert r.is_nonpositive is False assert r.is_nonnegative is True assert r.is_even is False assert r.is_odd is False assert r.is_finite is True assert r.is_infinite is False assert r.is_comparable is True assert r.is_prime is False assert r.is_composite is False r = Rational(1, 4) assert r.is_nonpositive is False assert r.is_positive is True assert r.is_negative is False assert r.is_nonnegative is True r = Rational(5, 4) assert r.is_negative is False assert r.is_positive is True assert r.is_nonpositive is False assert r.is_nonnegative is True r = Rational(5, 3) assert r.is_nonnegative is True assert r.is_positive is True assert r.is_negative is False assert r.is_nonpositive is False def test_neg_rational(): r = Rational(-3, 4) assert r.is_positive is False assert r.is_nonpositive is True assert r.is_negative is True assert r.is_nonnegative is False r = Rational(-1, 4) assert r.is_nonpositive is True assert r.is_positive is False assert r.is_negative is True assert r.is_nonnegative is False r = Rational(-5, 4) assert r.is_negative is True assert r.is_positive is False assert r.is_nonpositive is True assert r.is_nonnegative is False r = Rational(-5, 3) assert r.is_nonnegative is False assert r.is_positive is False assert r.is_negative is True assert r.is_nonpositive is True def test_pi(): z = S.Pi assert z.is_commutative is True assert z.is_integer is False assert z.is_rational is False assert z.is_algebraic is False assert z.is_transcendental is True assert z.is_real is True assert z.is_complex is True assert z.is_noninteger is True assert z.is_irrational is True assert z.is_imaginary is False assert z.is_positive is True assert z.is_negative is False assert z.is_nonpositive is False assert z.is_nonnegative is True assert z.is_even is False assert z.is_odd is False assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is True assert z.is_prime is False assert z.is_composite is False def test_E(): z = S.Exp1 assert z.is_commutative is True assert z.is_integer is False assert z.is_rational is False assert z.is_algebraic is False assert z.is_transcendental is True assert z.is_real is True assert z.is_complex is True assert z.is_noninteger is True assert z.is_irrational is True assert z.is_imaginary is False assert z.is_positive is True assert z.is_negative is False assert z.is_nonpositive is False assert z.is_nonnegative is True assert z.is_even is False assert z.is_odd is False assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is True assert z.is_prime is False assert z.is_composite is False def test_I(): z = S.ImaginaryUnit assert z.is_commutative is True assert z.is_integer is False assert z.is_rational is False assert z.is_algebraic is True assert z.is_transcendental is False assert z.is_real is False assert z.is_complex is True assert z.is_noninteger is False assert z.is_irrational is False assert z.is_imaginary is True assert z.is_positive is False assert z.is_negative is False assert z.is_nonpositive is False assert z.is_nonnegative is False assert z.is_even is False assert z.is_odd is False assert z.is_finite is True assert z.is_infinite is False assert z.is_comparable is False assert z.is_prime is False assert z.is_composite is False def test_symbol_real_false(): # issue 3848 a = Symbol('a', real=False) assert a.is_real is False assert a.is_integer is False assert a.is_zero is False assert a.is_negative is False assert a.is_positive is False assert a.is_nonnegative is False assert a.is_nonpositive is False assert a.is_nonzero is False assert a.is_extended_negative is None assert a.is_extended_positive is None assert a.is_extended_nonnegative is None assert a.is_extended_nonpositive is None assert a.is_extended_nonzero is None def test_symbol_extended_real_false(): # issue 3848 a = Symbol('a', extended_real=False) assert a.is_real is False assert a.is_integer is False assert a.is_zero is False assert a.is_negative is False assert a.is_positive is False assert a.is_nonnegative is False assert a.is_nonpositive is False assert a.is_nonzero is False assert a.is_extended_negative is False assert a.is_extended_positive is False assert a.is_extended_nonnegative is False assert a.is_extended_nonpositive is False assert a.is_extended_nonzero is False def test_symbol_imaginary(): a = Symbol('a', imaginary=True) assert a.is_real is False assert a.is_integer is False assert a.is_negative is False assert a.is_positive is False assert a.is_nonnegative is False assert a.is_nonpositive is False assert a.is_zero is False assert a.is_nonzero is False # since nonzero -> real def test_symbol_zero(): x = Symbol('x', zero=True) assert x.is_positive is False assert x.is_nonpositive assert x.is_negative is False assert x.is_nonnegative assert x.is_zero is True # TODO Change to x.is_nonzero is None # See https://github.com/sympy/sympy/pull/9583 assert x.is_nonzero is False assert x.is_finite is True def test_symbol_positive(): x = Symbol('x', positive=True) assert x.is_positive is True assert x.is_nonpositive is False assert x.is_negative is False assert x.is_nonnegative is True assert x.is_zero is False assert x.is_nonzero is True def test_neg_symbol_positive(): x = -Symbol('x', positive=True) assert x.is_positive is False assert x.is_nonpositive is True assert x.is_negative is True assert x.is_nonnegative is False assert x.is_zero is False assert x.is_nonzero is True def test_symbol_nonpositive(): x = Symbol('x', nonpositive=True) assert x.is_positive is False assert x.is_nonpositive is True assert x.is_negative is None assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None def test_neg_symbol_nonpositive(): x = -Symbol('x', nonpositive=True) assert x.is_positive is None assert x.is_nonpositive is None assert x.is_negative is False assert x.is_nonnegative is True assert x.is_zero is None assert x.is_nonzero is None def test_symbol_falsepositive(): x = Symbol('x', positive=False) assert x.is_positive is False assert x.is_nonpositive is None assert x.is_negative is None assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None def test_symbol_falsepositive_mul(): # To test pull request 9379 # Explicit handling of arg.is_positive=False was added to Mul._eval_is_positive x = 2*Symbol('x', positive=False) assert x.is_positive is False # This was None before assert x.is_nonpositive is None assert x.is_negative is None assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None @XFAIL def test_symbol_infinitereal_mul(): ix = Symbol('ix', infinite=True, extended_real=True) assert (-ix).is_extended_positive is None def test_neg_symbol_falsepositive(): x = -Symbol('x', positive=False) assert x.is_positive is None assert x.is_nonpositive is None assert x.is_negative is False assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None def test_neg_symbol_falsenegative(): # To test pull request 9379 # Explicit handling of arg.is_negative=False was added to Mul._eval_is_positive x = -Symbol('x', negative=False) assert x.is_positive is False # This was None before assert x.is_nonpositive is None assert x.is_negative is None assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None def test_symbol_falsepositive_real(): x = Symbol('x', positive=False, real=True) assert x.is_positive is False assert x.is_nonpositive is True assert x.is_negative is None assert x.is_nonnegative is None assert x.is_zero is None assert x.is_nonzero is None def test_neg_symbol_falsepositive_real(): x = -Symbol('x', positive=False, real=True) assert x.is_positive is None assert x.is_nonpositive is None assert x.is_negative is False assert x.is_nonnegative is True assert x.is_zero is None assert x.is_nonzero is None def test_symbol_falsenonnegative(): x = Symbol('x', nonnegative=False) assert x.is_positive is False assert x.is_nonpositive is None assert x.is_negative is None assert x.is_nonnegative is False assert x.is_zero is False assert x.is_nonzero is None @XFAIL def test_neg_symbol_falsenonnegative(): x = -Symbol('x', nonnegative=False) assert x.is_positive is None assert x.is_nonpositive is False # this currently returns None assert x.is_negative is False # this currently returns None assert x.is_nonnegative is None assert x.is_zero is False # this currently returns None assert x.is_nonzero is True # this currently returns None def test_symbol_falsenonnegative_real(): x = Symbol('x', nonnegative=False, real=True) assert x.is_positive is False assert x.is_nonpositive is True assert x.is_negative is True assert x.is_nonnegative is False assert x.is_zero is False assert x.is_nonzero is True def test_neg_symbol_falsenonnegative_real(): x = -Symbol('x', nonnegative=False, real=True) assert x.is_positive is True assert x.is_nonpositive is False assert x.is_negative is False assert x.is_nonnegative is True assert x.is_zero is False assert x.is_nonzero is True def test_prime(): assert S.NegativeOne.is_prime is False assert S(-2).is_prime is False assert S(-4).is_prime is False assert S.Zero.is_prime is False assert S.One.is_prime is False assert S(2).is_prime is True assert S(17).is_prime is True assert S(4).is_prime is False def test_composite(): assert S.NegativeOne.is_composite is False assert S(-2).is_composite is False assert S(-4).is_composite is False assert S.Zero.is_composite is False assert S(2).is_composite is False assert S(17).is_composite is False assert S(4).is_composite is True x = Dummy(integer=True, positive=True, prime=False) assert x.is_composite is None # x could be 1 assert (x + 1).is_composite is None x = Dummy(positive=True, even=True, prime=False) assert x.is_integer is True assert x.is_composite is True def test_prime_symbol(): x = Symbol('x', prime=True) assert x.is_prime is True assert x.is_integer is True assert x.is_positive is True assert x.is_negative is False assert x.is_nonpositive is False assert x.is_nonnegative is True x = Symbol('x', prime=False) assert x.is_prime is False assert x.is_integer is None assert x.is_positive is None assert x.is_negative is None assert x.is_nonpositive is None assert x.is_nonnegative is None def test_symbol_noncommutative(): x = Symbol('x', commutative=True) assert x.is_complex is None x = Symbol('x', commutative=False) assert x.is_integer is False assert x.is_rational is False assert x.is_algebraic is False assert x.is_irrational is False assert x.is_real is False assert x.is_complex is False def test_other_symbol(): x = Symbol('x', integer=True) assert x.is_integer is True assert x.is_real is True assert x.is_finite is True x = Symbol('x', integer=True, nonnegative=True) assert x.is_integer is True assert x.is_nonnegative is True assert x.is_negative is False assert x.is_positive is None assert x.is_finite is True x = Symbol('x', integer=True, nonpositive=True) assert x.is_integer is True assert x.is_nonpositive is True assert x.is_positive is False assert x.is_negative is None assert x.is_finite is True x = Symbol('x', odd=True) assert x.is_odd is True assert x.is_even is False assert x.is_integer is True assert x.is_finite is True x = Symbol('x', odd=False) assert x.is_odd is False assert x.is_even is None assert x.is_integer is None assert x.is_finite is None x = Symbol('x', even=True) assert x.is_even is True assert x.is_odd is False assert x.is_integer is True assert x.is_finite is True x = Symbol('x', even=False) assert x.is_even is False assert x.is_odd is None assert x.is_integer is None assert x.is_finite is None x = Symbol('x', integer=True, nonnegative=True) assert x.is_integer is True assert x.is_nonnegative is True assert x.is_finite is True x = Symbol('x', integer=True, nonpositive=True) assert x.is_integer is True assert x.is_nonpositive is True assert x.is_finite is True x = Symbol('x', rational=True) assert x.is_real is True assert x.is_finite is True x = Symbol('x', rational=False) assert x.is_real is None assert x.is_finite is None x = Symbol('x', irrational=True) assert x.is_real is True assert x.is_finite is True x = Symbol('x', irrational=False) assert x.is_real is None assert x.is_finite is None with raises(AttributeError): x.is_real = False x = Symbol('x', algebraic=True) assert x.is_transcendental is False x = Symbol('x', transcendental=True) assert x.is_algebraic is False assert x.is_rational is False assert x.is_integer is False def test_issue_3825(): """catch: hash instability""" x = Symbol("x") y = Symbol("y") a1 = x + y a2 = y + x a2.is_comparable h1 = hash(a1) h2 = hash(a2) assert h1 == h2 def test_issue_4822(): z = (-1)**Rational(1, 3)*(1 - I*sqrt(3)) assert z.is_real in [True, None] def test_hash_vs_typeinfo(): """seemingly different typeinfo, but in fact equal""" # the following two are semantically equal x1 = Symbol('x', even=True) x2 = Symbol('x', integer=True, odd=False) assert hash(x1) == hash(x2) assert x1 == x2 def test_hash_vs_typeinfo_2(): """different typeinfo should mean !eq""" # the following two are semantically different x = Symbol('x') x1 = Symbol('x', even=True) assert x != x1 assert hash(x) != hash(x1) # This might fail with very low probability def test_hash_vs_eq(): """catch: different hash for equal objects""" a = 1 + S.Pi # important: do not fold it into a Number instance ha = hash(a) # it should be Add/Mul/... to trigger the bug a.is_positive # this uses .evalf() and deduces it is positive assert a.is_positive is True # be sure that hash stayed the same assert ha == hash(a) # now b should be the same expression b = a.expand(trig=True) hb = hash(b) assert a == b assert ha == hb def test_Add_is_pos_neg(): # these cover lines not covered by the rest of tests in core n = Symbol('n', extended_negative=True, infinite=True) nn = Symbol('n', extended_nonnegative=True, infinite=True) np = Symbol('n', extended_nonpositive=True, infinite=True) p = Symbol('p', extended_positive=True, infinite=True) r = Dummy(extended_real=True, finite=False) x = Symbol('x') xf = Symbol('xf', finite=True) assert (n + p).is_extended_positive is None assert (n + x).is_extended_positive is None assert (p + x).is_extended_positive is None assert (n + p).is_extended_negative is None assert (n + x).is_extended_negative is None assert (p + x).is_extended_negative is None assert (n + xf).is_extended_positive is False assert (p + xf).is_extended_positive is True assert (n + xf).is_extended_negative is True assert (p + xf).is_extended_negative is False assert (x - S.Infinity).is_extended_negative is None # issue 7798 # issue 8046, 16.2 assert (p + nn).is_extended_positive assert (n + np).is_extended_negative assert (p + r).is_extended_positive is None def test_Add_is_imaginary(): nn = Dummy(nonnegative=True) assert (I*nn + I).is_imaginary # issue 8046, 17 def test_Add_is_algebraic(): a = Symbol('a', algebraic=True) b = Symbol('a', algebraic=True) na = Symbol('na', algebraic=False) nb = Symbol('nb', algebraic=False) x = Symbol('x') assert (a + b).is_algebraic assert (na + nb).is_algebraic is None assert (a + na).is_algebraic is False assert (a + x).is_algebraic is None assert (na + x).is_algebraic is None def test_Mul_is_algebraic(): a = Symbol('a', algebraic=True) b = Symbol('b', algebraic=True) na = Symbol('na', algebraic=False) an = Symbol('an', algebraic=True, nonzero=True) nb = Symbol('nb', algebraic=False) x = Symbol('x') assert (a*b).is_algebraic is True assert (na*nb).is_algebraic is None assert (a*na).is_algebraic is None assert (an*na).is_algebraic is False assert (a*x).is_algebraic is None assert (na*x).is_algebraic is None def test_Pow_is_algebraic(): e = Symbol('e', algebraic=True) assert Pow(1, e, evaluate=False).is_algebraic assert Pow(0, e, evaluate=False).is_algebraic a = Symbol('a', algebraic=True) azf = Symbol('azf', algebraic=True, zero=False) na = Symbol('na', algebraic=False) ia = Symbol('ia', algebraic=True, irrational=True) ib = Symbol('ib', algebraic=True, irrational=True) r = Symbol('r', rational=True) x = Symbol('x') assert (a**2).is_algebraic is True assert (a**r).is_algebraic is None assert (azf**r).is_algebraic is True assert (a**x).is_algebraic is None assert (na**r).is_algebraic is None assert (ia**r).is_algebraic is True assert (ia**ib).is_algebraic is False assert (a**e).is_algebraic is None # Gelfond-Schneider constant: assert Pow(2, sqrt(2), evaluate=False).is_algebraic is False assert Pow(S.GoldenRatio, sqrt(3), evaluate=False).is_algebraic is False # issue 8649 t = Symbol('t', real=True, transcendental=True) n = Symbol('n', integer=True) assert (t**n).is_algebraic is None assert (t**n).is_integer is None assert (pi**3).is_algebraic is False r = Symbol('r', zero=True) assert (pi**r).is_algebraic is True def test_Mul_is_prime_composite(): x = Symbol('x', positive=True, integer=True) y = Symbol('y', positive=True, integer=True) assert (x*y).is_prime is None assert ( (x+1)*(y+1) ).is_prime is False assert ( (x+1)*(y+1) ).is_composite is True x = Symbol('x', positive=True) assert ( (x+1)*(y+1) ).is_prime is None assert ( (x+1)*(y+1) ).is_composite is None def test_Pow_is_pos_neg(): z = Symbol('z', real=True) w = Symbol('w', nonpositive=True) assert (S.NegativeOne**S(2)).is_positive is True assert (S.One**z).is_positive is True assert (S.NegativeOne**S(3)).is_positive is False assert (S.Zero**S.Zero).is_positive is True # 0**0 is 1 assert (w**S(3)).is_positive is False assert (w**S(2)).is_positive is None assert (I**2).is_positive is False assert (I**4).is_positive is True # tests emerging from #16332 issue p = Symbol('p', zero=True) q = Symbol('q', zero=False, real=True) j = Symbol('j', zero=False, even=True) x = Symbol('x', zero=True) y = Symbol('y', zero=True) assert (p**q).is_positive is False assert (p**q).is_negative is False assert (p**j).is_positive is False assert (x**y).is_positive is True # 0**0 assert (x**y).is_negative is False def test_Pow_is_prime_composite(): x = Symbol('x', positive=True, integer=True) y = Symbol('y', positive=True, integer=True) assert (x**y).is_prime is None assert ( x**(y+1) ).is_prime is False assert ( x**(y+1) ).is_composite is None assert ( (x+1)**(y+1) ).is_composite is True assert ( (-x-1)**(2*y) ).is_composite is True x = Symbol('x', positive=True) assert (x**y).is_prime is None def test_Mul_is_infinite(): x = Symbol('x') f = Symbol('f', finite=True) i = Symbol('i', infinite=True) z = Dummy(zero=True) nzf = Dummy(finite=True, zero=False) from sympy import Mul assert (x*f).is_finite is None assert (x*i).is_finite is None assert (f*i).is_finite is None assert (x*f*i).is_finite is None assert (z*i).is_finite is None assert (nzf*i).is_finite is False assert (z*f).is_finite is True assert Mul(0, f, evaluate=False).is_finite is True assert Mul(0, i, evaluate=False).is_finite is None assert (x*f).is_infinite is None assert (x*i).is_infinite is None assert (f*i).is_infinite is None assert (x*f*i).is_infinite is None assert (z*i).is_infinite is S.NaN.is_infinite assert (nzf*i).is_infinite is True assert (z*f).is_infinite is False assert Mul(0, f, evaluate=False).is_infinite is False assert Mul(0, i, evaluate=False).is_infinite is S.NaN.is_infinite def test_Add_is_infinite(): x = Symbol('x') f = Symbol('f', finite=True) i = Symbol('i', infinite=True) i2 = Symbol('i2', infinite=True) z = Dummy(zero=True) nzf = Dummy(finite=True, zero=False) from sympy import Add assert (x+f).is_finite is None assert (x+i).is_finite is None assert (f+i).is_finite is False assert (x+f+i).is_finite is None assert (z+i).is_finite is False assert (nzf+i).is_finite is False assert (z+f).is_finite is True assert (i+i2).is_finite is None assert Add(0, f, evaluate=False).is_finite is True assert Add(0, i, evaluate=False).is_finite is False assert (x+f).is_infinite is None assert (x+i).is_infinite is None assert (f+i).is_infinite is True assert (x+f+i).is_infinite is None assert (z+i).is_infinite is True assert (nzf+i).is_infinite is True assert (z+f).is_infinite is False assert (i+i2).is_infinite is None assert Add(0, f, evaluate=False).is_infinite is False assert Add(0, i, evaluate=False).is_infinite is True def test_special_is_rational(): i = Symbol('i', integer=True) i2 = Symbol('i2', integer=True) ni = Symbol('ni', integer=True, nonzero=True) r = Symbol('r', rational=True) rn = Symbol('r', rational=True, nonzero=True) nr = Symbol('nr', irrational=True) x = Symbol('x') assert sqrt(3).is_rational is False assert (3 + sqrt(3)).is_rational is False assert (3*sqrt(3)).is_rational is False assert exp(3).is_rational is False assert exp(ni).is_rational is False assert exp(rn).is_rational is False assert exp(x).is_rational is None assert exp(log(3), evaluate=False).is_rational is True assert log(exp(3), evaluate=False).is_rational is True assert log(3).is_rational is False assert log(ni + 1).is_rational is False assert log(rn + 1).is_rational is False assert log(x).is_rational is None assert (sqrt(3) + sqrt(5)).is_rational is None assert (sqrt(3) + S.Pi).is_rational is False assert (x**i).is_rational is None assert (i**i).is_rational is True assert (i**i2).is_rational is None assert (r**i).is_rational is None assert (r**r).is_rational is None assert (r**x).is_rational is None assert (nr**i).is_rational is None # issue 8598 assert (nr**Symbol('z', zero=True)).is_rational assert sin(1).is_rational is False assert sin(ni).is_rational is False assert sin(rn).is_rational is False assert sin(x).is_rational is None assert asin(r).is_rational is False assert sin(asin(3), evaluate=False).is_rational is True @XFAIL def test_issue_6275(): x = Symbol('x') # both zero or both Muls...but neither "change would be very appreciated. # This is similar to x/x => 1 even though if x = 0, it is really nan. assert isinstance(x*0, type(0*S.Infinity)) if 0*S.Infinity is S.NaN: b = Symbol('b', finite=None) assert (b*0).is_zero is None def test_sanitize_assumptions(): # issue 6666 for cls in (Symbol, Dummy, Wild): x = cls('x', real=1, positive=0) assert x.is_real is True assert x.is_positive is False assert cls('', real=True, positive=None).is_positive is None raises(ValueError, lambda: cls('', commutative=None)) raises(ValueError, lambda: Symbol._sanitize(dict(commutative=None))) def test_special_assumptions(): e = -3 - sqrt(5) + (-sqrt(10)/2 - sqrt(2)/2)**2 assert simplify(e < 0) is S.false assert simplify(e > 0) is S.false assert (e == 0) is False # it's not a literal 0 assert e.equals(0) is True def test_inconsistent(): # cf. issues 5795 and 5545 raises(InconsistentAssumptions, lambda: Symbol('x', real=True, commutative=False)) def test_issue_6631(): assert ((-1)**(I)).is_real is True assert ((-1)**(I*2)).is_real is True assert ((-1)**(I/2)).is_real is True assert ((-1)**(I*S.Pi)).is_real is True assert (I**(I + 2)).is_real is True def test_issue_2730(): assert (1/(1 + I)).is_real is False def test_issue_4149(): assert (3 + I).is_complex assert (3 + I).is_imaginary is False assert (3*I + S.Pi*I).is_imaginary # as Zero.is_imaginary is False, see issue 7649 y = Symbol('y', real=True) assert (3*I + S.Pi*I + y*I).is_imaginary is None p = Symbol('p', positive=True) assert (3*I + S.Pi*I + p*I).is_imaginary n = Symbol('n', negative=True) assert (-3*I - S.Pi*I + n*I).is_imaginary i = Symbol('i', imaginary=True) assert ([(i**a).is_imaginary for a in range(4)] == [False, True, False, True]) # tests from the PR #7887: e = S("-sqrt(3)*I/2 + 0.866025403784439*I") assert e.is_real is False assert e.is_imaginary def test_issue_2920(): n = Symbol('n', negative=True) assert sqrt(n).is_imaginary def test_issue_7899(): x = Symbol('x', real=True) assert (I*x).is_real is None assert ((x - I)*(x - 1)).is_zero is None assert ((x - I)*(x - 1)).is_real is None @XFAIL def test_issue_7993(): x = Dummy(integer=True) y = Dummy(noninteger=True) assert (x - y).is_zero is False def test_issue_8075(): raises(InconsistentAssumptions, lambda: Dummy(zero=True, finite=False)) raises(InconsistentAssumptions, lambda: Dummy(zero=True, infinite=True)) def test_issue_8642(): x = Symbol('x', real=True, integer=False) assert (x*2).is_integer is None def test_issues_8632_8633_8638_8675_8992(): p = Dummy(integer=True, positive=True) nn = Dummy(integer=True, nonnegative=True) assert (p - S.Half).is_positive assert (p - 1).is_nonnegative assert (nn + 1).is_positive assert (-p + 1).is_nonpositive assert (-nn - 1).is_negative prime = Dummy(prime=True) assert (prime - 2).is_nonnegative assert (prime - 3).is_nonnegative is None even = Dummy(positive=True, even=True) assert (even - 2).is_nonnegative p = Dummy(positive=True) assert (p/(p + 1) - 1).is_negative assert ((p + 2)**3 - S.Half).is_positive n = Dummy(negative=True) assert (n - 3).is_nonpositive def test_issue_9115_9150(): n = Dummy('n', integer=True, nonnegative=True) assert (factorial(n) >= 1) == True assert (factorial(n) < 1) == False assert factorial(n + 1).is_even is None assert factorial(n + 2).is_even is True assert factorial(n + 2) >= 2 def test_issue_9165(): z = Symbol('z', zero=True) f = Symbol('f', finite=False) assert 0/z is S.NaN assert 0*(1/z) is S.NaN assert 0*f is S.NaN def test_issue_10024(): x = Dummy('x') assert Mod(x, 2*pi).is_zero is None def test_issue_10302(): x = Symbol('x') r = Symbol('r', real=True) u = -(3*2**pi)**(1/pi) + 2*3**(1/pi) i = u + u*I assert i.is_real is None # w/o simplification this should fail assert (u + i).is_zero is None assert (1 + i).is_zero is False a = Dummy('a', zero=True) assert (a + I).is_zero is False assert (a + r*I).is_zero is None assert (a + I).is_imaginary assert (a + x + I).is_imaginary is None assert (a + r*I + I).is_imaginary is None def test_complex_reciprocal_imaginary(): assert (1 / (4 + 3*I)).is_imaginary is False def test_issue_16313(): x = Symbol('x', extended_real=False) k = Symbol('k', real=True) l = Symbol('l', real=True, zero=False) assert (-x).is_real is False assert (k*x).is_real is None # k can be zero also assert (l*x).is_real is False assert (l*x*x).is_real is None # since x*x can be a real number assert (-x).is_positive is False def test_issue_16579(): # extended_real -> finite | infinite x = Symbol('x', extended_real=True, infinite=False) y = Symbol('y', extended_real=True, finite=False) assert x.is_finite is True assert y.is_infinite is True # With PR 16978, complex now implies finite c = Symbol('c', complex=True) assert c.is_finite is True raises(InconsistentAssumptions, lambda: Dummy(complex=True, finite=False)) def test_issue_17556(): z = I*oo assert z.is_imaginary is False assert z.is_finite is False
68f6a7a8396c7b5bb69c30fc40d1dbbcba9a78196e04ab4a055cace16f9e1038
from sympy.testing.pytest import XFAIL, raises, warns_deprecated_sympy from sympy import (S, Symbol, symbols, nan, oo, I, pi, Float, And, Or, Not, Implies, Xor, zoo, sqrt, Rational, simplify, Function, log, cos, sin, Add, Mul, Pow, floor, ceiling, trigsimp, Reals) from sympy.core.relational import (Relational, Equality, Unequality, GreaterThan, LessThan, StrictGreaterThan, StrictLessThan, Rel, Eq, Lt, Le, Gt, Ge, Ne) from sympy.sets.sets import Interval, FiniteSet from itertools import combinations x, y, z, t = symbols('x,y,z,t') def rel_check(a, b): from sympy.testing.pytest import raises assert a.is_number and b.is_number for do in range(len(set([type(a), type(b)]))): if S.NaN in (a, b): v = [(a == b), (a != b)] assert len(set(v)) == 1 and v[0] == False assert not (a != b) and not (a == b) assert raises(TypeError, lambda: a < b) assert raises(TypeError, lambda: a <= b) assert raises(TypeError, lambda: a > b) assert raises(TypeError, lambda: a >= b) else: E = [(a == b), (a != b)] assert len(set(E)) == 2 v = [ (a < b), (a <= b), (a > b), (a >= b)] i = [ [True, True, False, False], [False, True, False, True], # <-- i == 1 [False, False, True, True]].index(v) if i == 1: assert E[0] or (a.is_Float != b.is_Float) # ugh else: assert E[1] a, b = b, a return True def test_rel_ne(): assert Relational(x, y, '!=') == Ne(x, y) # issue 6116 p = Symbol('p', positive=True) assert Ne(p, 0) is S.true def test_rel_subs(): e = Relational(x, y, '==') e = e.subs(x, z) assert isinstance(e, Equality) assert e.lhs == z assert e.rhs == y e = Relational(x, y, '>=') e = e.subs(x, z) assert isinstance(e, GreaterThan) assert e.lhs == z assert e.rhs == y e = Relational(x, y, '<=') e = e.subs(x, z) assert isinstance(e, LessThan) assert e.lhs == z assert e.rhs == y e = Relational(x, y, '>') e = e.subs(x, z) assert isinstance(e, StrictGreaterThan) assert e.lhs == z assert e.rhs == y e = Relational(x, y, '<') e = e.subs(x, z) assert isinstance(e, StrictLessThan) assert e.lhs == z assert e.rhs == y e = Eq(x, 0) assert e.subs(x, 0) is S.true assert e.subs(x, 1) is S.false def test_wrappers(): e = x + x**2 res = Relational(y, e, '==') assert Rel(y, x + x**2, '==') == res assert Eq(y, x + x**2) == res res = Relational(y, e, '<') assert Lt(y, x + x**2) == res res = Relational(y, e, '<=') assert Le(y, x + x**2) == res res = Relational(y, e, '>') assert Gt(y, x + x**2) == res res = Relational(y, e, '>=') assert Ge(y, x + x**2) == res res = Relational(y, e, '!=') assert Ne(y, x + x**2) == res def test_Eq(): assert Eq(x, x) # issue 5719 with warns_deprecated_sympy(): assert Eq(x) == Eq(x, 0) # issue 6116 p = Symbol('p', positive=True) assert Eq(p, 0) is S.false # issue 13348 assert Eq(True, 1) is S.false assert Eq((), 1) is S.false def test_as_poly(): from sympy.polys.polytools import Poly # Only Eq should have an as_poly method: assert Eq(x, 1).as_poly() == Poly(x - 1, x, domain='ZZ') raises(AttributeError, lambda: Ne(x, 1).as_poly()) raises(AttributeError, lambda: Ge(x, 1).as_poly()) raises(AttributeError, lambda: Gt(x, 1).as_poly()) raises(AttributeError, lambda: Le(x, 1).as_poly()) raises(AttributeError, lambda: Lt(x, 1).as_poly()) def test_rel_Infinity(): # NOTE: All of these are actually handled by sympy.core.Number, and do # not create Relational objects. assert (oo > oo) is S.false assert (oo > -oo) is S.true assert (oo > 1) is S.true assert (oo < oo) is S.false assert (oo < -oo) is S.false assert (oo < 1) is S.false assert (oo >= oo) is S.true assert (oo >= -oo) is S.true assert (oo >= 1) is S.true assert (oo <= oo) is S.true assert (oo <= -oo) is S.false assert (oo <= 1) is S.false assert (-oo > oo) is S.false assert (-oo > -oo) is S.false assert (-oo > 1) is S.false assert (-oo < oo) is S.true assert (-oo < -oo) is S.false assert (-oo < 1) is S.true assert (-oo >= oo) is S.false assert (-oo >= -oo) is S.true assert (-oo >= 1) is S.false assert (-oo <= oo) is S.true assert (-oo <= -oo) is S.true assert (-oo <= 1) is S.true def test_infinite_symbol_inequalities(): x = Symbol('x', extended_positive=True, infinite=True) y = Symbol('y', extended_positive=True, infinite=True) z = Symbol('z', extended_negative=True, infinite=True) w = Symbol('w', extended_negative=True, infinite=True) inf_set = (x, y, oo) ninf_set = (z, w, -oo) for inf1 in inf_set: assert (inf1 < 1) is S.false assert (inf1 > 1) is S.true assert (inf1 <= 1) is S.false assert (inf1 >= 1) is S.true for inf2 in inf_set: assert (inf1 < inf2) is S.false assert (inf1 > inf2) is S.false assert (inf1 <= inf2) is S.true assert (inf1 >= inf2) is S.true for ninf1 in ninf_set: assert (inf1 < ninf1) is S.false assert (inf1 > ninf1) is S.true assert (inf1 <= ninf1) is S.false assert (inf1 >= ninf1) is S.true assert (ninf1 < inf1) is S.true assert (ninf1 > inf1) is S.false assert (ninf1 <= inf1) is S.true assert (ninf1 >= inf1) is S.false for ninf1 in ninf_set: assert (ninf1 < 1) is S.true assert (ninf1 > 1) is S.false assert (ninf1 <= 1) is S.true assert (ninf1 >= 1) is S.false for ninf2 in ninf_set: assert (ninf1 < ninf2) is S.false assert (ninf1 > ninf2) is S.false assert (ninf1 <= ninf2) is S.true assert (ninf1 >= ninf2) is S.true def test_bool(): assert Eq(0, 0) is S.true assert Eq(1, 0) is S.false assert Ne(0, 0) is S.false assert Ne(1, 0) is S.true assert Lt(0, 1) is S.true assert Lt(1, 0) is S.false assert Le(0, 1) is S.true assert Le(1, 0) is S.false assert Le(0, 0) is S.true assert Gt(1, 0) is S.true assert Gt(0, 1) is S.false assert Ge(1, 0) is S.true assert Ge(0, 1) is S.false assert Ge(1, 1) is S.true assert Eq(I, 2) is S.false assert Ne(I, 2) is S.true raises(TypeError, lambda: Gt(I, 2)) raises(TypeError, lambda: Ge(I, 2)) raises(TypeError, lambda: Lt(I, 2)) raises(TypeError, lambda: Le(I, 2)) a = Float('.000000000000000000001', '') b = Float('.0000000000000000000001', '') assert Eq(pi + a, pi + b) is S.false def test_rich_cmp(): assert (x < y) == Lt(x, y) assert (x <= y) == Le(x, y) assert (x > y) == Gt(x, y) assert (x >= y) == Ge(x, y) def test_doit(): from sympy import Symbol p = Symbol('p', positive=True) n = Symbol('n', negative=True) np = Symbol('np', nonpositive=True) nn = Symbol('nn', nonnegative=True) assert Gt(p, 0).doit() is S.true assert Gt(p, 1).doit() == Gt(p, 1) assert Ge(p, 0).doit() is S.true assert Le(p, 0).doit() is S.false assert Lt(n, 0).doit() is S.true assert Le(np, 0).doit() is S.true assert Gt(nn, 0).doit() == Gt(nn, 0) assert Lt(nn, 0).doit() is S.false assert Eq(x, 0).doit() == Eq(x, 0) def test_new_relational(): x = Symbol('x') assert Eq(x, 0) == Relational(x, 0) # None ==> Equality assert Eq(x, 0) == Relational(x, 0, '==') assert Eq(x, 0) == Relational(x, 0, 'eq') assert Eq(x, 0) == Equality(x, 0) assert Eq(x, 0) != Relational(x, 1) # None ==> Equality assert Eq(x, 0) != Relational(x, 1, '==') assert Eq(x, 0) != Relational(x, 1, 'eq') assert Eq(x, 0) != Equality(x, 1) assert Eq(x, -1) == Relational(x, -1) # None ==> Equality assert Eq(x, -1) == Relational(x, -1, '==') assert Eq(x, -1) == Relational(x, -1, 'eq') assert Eq(x, -1) == Equality(x, -1) assert Eq(x, -1) != Relational(x, 1) # None ==> Equality assert Eq(x, -1) != Relational(x, 1, '==') assert Eq(x, -1) != Relational(x, 1, 'eq') assert Eq(x, -1) != Equality(x, 1) assert Ne(x, 0) == Relational(x, 0, '!=') assert Ne(x, 0) == Relational(x, 0, '<>') assert Ne(x, 0) == Relational(x, 0, 'ne') assert Ne(x, 0) == Unequality(x, 0) assert Ne(x, 0) != Relational(x, 1, '!=') assert Ne(x, 0) != Relational(x, 1, '<>') assert Ne(x, 0) != Relational(x, 1, 'ne') assert Ne(x, 0) != Unequality(x, 1) assert Ge(x, 0) == Relational(x, 0, '>=') assert Ge(x, 0) == Relational(x, 0, 'ge') assert Ge(x, 0) == GreaterThan(x, 0) assert Ge(x, 1) != Relational(x, 0, '>=') assert Ge(x, 1) != Relational(x, 0, 'ge') assert Ge(x, 1) != GreaterThan(x, 0) assert (x >= 1) == Relational(x, 1, '>=') assert (x >= 1) == Relational(x, 1, 'ge') assert (x >= 1) == GreaterThan(x, 1) assert (x >= 0) != Relational(x, 1, '>=') assert (x >= 0) != Relational(x, 1, 'ge') assert (x >= 0) != GreaterThan(x, 1) assert Le(x, 0) == Relational(x, 0, '<=') assert Le(x, 0) == Relational(x, 0, 'le') assert Le(x, 0) == LessThan(x, 0) assert Le(x, 1) != Relational(x, 0, '<=') assert Le(x, 1) != Relational(x, 0, 'le') assert Le(x, 1) != LessThan(x, 0) assert (x <= 1) == Relational(x, 1, '<=') assert (x <= 1) == Relational(x, 1, 'le') assert (x <= 1) == LessThan(x, 1) assert (x <= 0) != Relational(x, 1, '<=') assert (x <= 0) != Relational(x, 1, 'le') assert (x <= 0) != LessThan(x, 1) assert Gt(x, 0) == Relational(x, 0, '>') assert Gt(x, 0) == Relational(x, 0, 'gt') assert Gt(x, 0) == StrictGreaterThan(x, 0) assert Gt(x, 1) != Relational(x, 0, '>') assert Gt(x, 1) != Relational(x, 0, 'gt') assert Gt(x, 1) != StrictGreaterThan(x, 0) assert (x > 1) == Relational(x, 1, '>') assert (x > 1) == Relational(x, 1, 'gt') assert (x > 1) == StrictGreaterThan(x, 1) assert (x > 0) != Relational(x, 1, '>') assert (x > 0) != Relational(x, 1, 'gt') assert (x > 0) != StrictGreaterThan(x, 1) assert Lt(x, 0) == Relational(x, 0, '<') assert Lt(x, 0) == Relational(x, 0, 'lt') assert Lt(x, 0) == StrictLessThan(x, 0) assert Lt(x, 1) != Relational(x, 0, '<') assert Lt(x, 1) != Relational(x, 0, 'lt') assert Lt(x, 1) != StrictLessThan(x, 0) assert (x < 1) == Relational(x, 1, '<') assert (x < 1) == Relational(x, 1, 'lt') assert (x < 1) == StrictLessThan(x, 1) assert (x < 0) != Relational(x, 1, '<') assert (x < 0) != Relational(x, 1, 'lt') assert (x < 0) != StrictLessThan(x, 1) # finally, some fuzz testing from random import randint for i in range(100): while 1: strtype, length = (chr, 65535) if randint(0, 1) else (chr, 255) relation_type = strtype(randint(0, length)) if randint(0, 1): relation_type += strtype(randint(0, length)) if relation_type not in ('==', 'eq', '!=', '<>', 'ne', '>=', 'ge', '<=', 'le', '>', 'gt', '<', 'lt', ':=', '+=', '-=', '*=', '/=', '%='): break raises(ValueError, lambda: Relational(x, 1, relation_type)) assert all(Relational(x, 0, op).rel_op == '==' for op in ('eq', '==')) assert all(Relational(x, 0, op).rel_op == '!=' for op in ('ne', '<>', '!=')) assert all(Relational(x, 0, op).rel_op == '>' for op in ('gt', '>')) assert all(Relational(x, 0, op).rel_op == '<' for op in ('lt', '<')) assert all(Relational(x, 0, op).rel_op == '>=' for op in ('ge', '>=')) assert all(Relational(x, 0, op).rel_op == '<=' for op in ('le', '<=')) def test_relational_arithmetic(): for cls in [Eq, Ne, Le, Lt, Ge, Gt]: rel = cls(x, y) raises(TypeError, lambda: 0+rel) raises(TypeError, lambda: 1*rel) raises(TypeError, lambda: 1**rel) raises(TypeError, lambda: rel**1) raises(TypeError, lambda: Add(0, rel)) raises(TypeError, lambda: Mul(1, rel)) raises(TypeError, lambda: Pow(1, rel)) raises(TypeError, lambda: Pow(rel, 1)) def test_relational_bool_output(): # https://github.com/sympy/sympy/issues/5931 raises(TypeError, lambda: bool(x > 3)) raises(TypeError, lambda: bool(x >= 3)) raises(TypeError, lambda: bool(x < 3)) raises(TypeError, lambda: bool(x <= 3)) raises(TypeError, lambda: bool(Eq(x, 3))) raises(TypeError, lambda: bool(Ne(x, 3))) def test_relational_logic_symbols(): # See issue 6204 assert (x < y) & (z < t) == And(x < y, z < t) assert (x < y) | (z < t) == Or(x < y, z < t) assert ~(x < y) == Not(x < y) assert (x < y) >> (z < t) == Implies(x < y, z < t) assert (x < y) << (z < t) == Implies(z < t, x < y) assert (x < y) ^ (z < t) == Xor(x < y, z < t) assert isinstance((x < y) & (z < t), And) assert isinstance((x < y) | (z < t), Or) assert isinstance(~(x < y), GreaterThan) assert isinstance((x < y) >> (z < t), Implies) assert isinstance((x < y) << (z < t), Implies) assert isinstance((x < y) ^ (z < t), (Or, Xor)) def test_univariate_relational_as_set(): assert (x > 0).as_set() == Interval(0, oo, True, True) assert (x >= 0).as_set() == Interval(0, oo) assert (x < 0).as_set() == Interval(-oo, 0, True, True) assert (x <= 0).as_set() == Interval(-oo, 0) assert Eq(x, 0).as_set() == FiniteSet(0) assert Ne(x, 0).as_set() == Interval(-oo, 0, True, True) + \ Interval(0, oo, True, True) assert (x**2 >= 4).as_set() == Interval(-oo, -2) + Interval(2, oo) @XFAIL def test_multivariate_relational_as_set(): assert (x*y >= 0).as_set() == Interval(0, oo)*Interval(0, oo) + \ Interval(-oo, 0)*Interval(-oo, 0) def test_Not(): assert Not(Equality(x, y)) == Unequality(x, y) assert Not(Unequality(x, y)) == Equality(x, y) assert Not(StrictGreaterThan(x, y)) == LessThan(x, y) assert Not(StrictLessThan(x, y)) == GreaterThan(x, y) assert Not(GreaterThan(x, y)) == StrictLessThan(x, y) assert Not(LessThan(x, y)) == StrictGreaterThan(x, y) def test_evaluate(): assert str(Eq(x, x, evaluate=False)) == 'Eq(x, x)' assert Eq(x, x, evaluate=False).doit() == S.true assert str(Ne(x, x, evaluate=False)) == 'Ne(x, x)' assert Ne(x, x, evaluate=False).doit() == S.false assert str(Ge(x, x, evaluate=False)) == 'x >= x' assert str(Le(x, x, evaluate=False)) == 'x <= x' assert str(Gt(x, x, evaluate=False)) == 'x > x' assert str(Lt(x, x, evaluate=False)) == 'x < x' def assert_all_ineq_raise_TypeError(a, b): raises(TypeError, lambda: a > b) raises(TypeError, lambda: a >= b) raises(TypeError, lambda: a < b) raises(TypeError, lambda: a <= b) raises(TypeError, lambda: b > a) raises(TypeError, lambda: b >= a) raises(TypeError, lambda: b < a) raises(TypeError, lambda: b <= a) def assert_all_ineq_give_class_Inequality(a, b): """All inequality operations on `a` and `b` result in class Inequality.""" from sympy.core.relational import _Inequality as Inequality assert isinstance(a > b, Inequality) assert isinstance(a >= b, Inequality) assert isinstance(a < b, Inequality) assert isinstance(a <= b, Inequality) assert isinstance(b > a, Inequality) assert isinstance(b >= a, Inequality) assert isinstance(b < a, Inequality) assert isinstance(b <= a, Inequality) def test_imaginary_compare_raises_TypeError(): # See issue #5724 assert_all_ineq_raise_TypeError(I, x) def test_complex_compare_not_real(): # two cases which are not real y = Symbol('y', imaginary=True) z = Symbol('z', complex=True, extended_real=False) for w in (y, z): assert_all_ineq_raise_TypeError(2, w) # some cases which should remain un-evaluated t = Symbol('t') x = Symbol('x', real=True) z = Symbol('z', complex=True) for w in (x, z, t): assert_all_ineq_give_class_Inequality(2, w) def test_imaginary_and_inf_compare_raises_TypeError(): # See pull request #7835 y = Symbol('y', imaginary=True) assert_all_ineq_raise_TypeError(oo, y) assert_all_ineq_raise_TypeError(-oo, y) def test_complex_pure_imag_not_ordered(): raises(TypeError, lambda: 2*I < 3*I) # more generally x = Symbol('x', real=True, nonzero=True) y = Symbol('y', imaginary=True) z = Symbol('z', complex=True) assert_all_ineq_raise_TypeError(I, y) t = I*x # an imaginary number, should raise errors assert_all_ineq_raise_TypeError(2, t) t = -I*y # a real number, so no errors assert_all_ineq_give_class_Inequality(2, t) t = I*z # unknown, should be unevaluated assert_all_ineq_give_class_Inequality(2, t) def test_x_minus_y_not_same_as_x_lt_y(): """ A consequence of pull request #7792 is that `x - y < 0` and `x < y` are not synonymous. """ x = I + 2 y = I + 3 raises(TypeError, lambda: x < y) assert x - y < 0 ineq = Lt(x, y, evaluate=False) raises(TypeError, lambda: ineq.doit()) assert ineq.lhs - ineq.rhs < 0 t = Symbol('t', imaginary=True) x = 2 + t y = 3 + t ineq = Lt(x, y, evaluate=False) raises(TypeError, lambda: ineq.doit()) assert ineq.lhs - ineq.rhs < 0 # this one should give error either way x = I + 2 y = 2*I + 3 raises(TypeError, lambda: x < y) raises(TypeError, lambda: x - y < 0) def test_nan_equality_exceptions(): # See issue #7774 import random assert Equality(nan, nan) is S.false assert Unequality(nan, nan) is S.true # See issue #7773 A = (x, S.Zero, S.One/3, pi, oo, -oo) assert Equality(nan, random.choice(A)) is S.false assert Equality(random.choice(A), nan) is S.false assert Unequality(nan, random.choice(A)) is S.true assert Unequality(random.choice(A), nan) is S.true def test_nan_inequality_raise_errors(): # See discussion in pull request #7776. We test inequalities with # a set including examples of various classes. for q in (x, S.Zero, S(10), S.One/3, pi, S(1.3), oo, -oo, nan): assert_all_ineq_raise_TypeError(q, nan) def test_nan_complex_inequalities(): # Comparisons of NaN with non-real raise errors, we're not too # fussy whether its the NaN error or complex error. for r in (I, zoo, Symbol('z', imaginary=True)): assert_all_ineq_raise_TypeError(r, nan) def test_complex_infinity_inequalities(): raises(TypeError, lambda: zoo > 0) raises(TypeError, lambda: zoo >= 0) raises(TypeError, lambda: zoo < 0) raises(TypeError, lambda: zoo <= 0) def test_inequalities_symbol_name_same(): """Using the operator and functional forms should give same results.""" # We test all combinations from a set # FIXME: could replace with random selection after test passes A = (x, y, S.Zero, S.One/3, pi, oo, -oo) for a in A: for b in A: assert Gt(a, b) == (a > b) assert Lt(a, b) == (a < b) assert Ge(a, b) == (a >= b) assert Le(a, b) == (a <= b) for b in (y, S.Zero, S.One/3, pi, oo, -oo): assert Gt(x, b, evaluate=False) == (x > b) assert Lt(x, b, evaluate=False) == (x < b) assert Ge(x, b, evaluate=False) == (x >= b) assert Le(x, b, evaluate=False) == (x <= b) for b in (y, S.Zero, S.One/3, pi, oo, -oo): assert Gt(b, x, evaluate=False) == (b > x) assert Lt(b, x, evaluate=False) == (b < x) assert Ge(b, x, evaluate=False) == (b >= x) assert Le(b, x, evaluate=False) == (b <= x) def test_inequalities_symbol_name_same_complex(): """Using the operator and functional forms should give same results. With complex non-real numbers, both should raise errors. """ # FIXME: could replace with random selection after test passes for a in (x, S.Zero, S.One/3, pi, oo, Rational(1, 3)): raises(TypeError, lambda: Gt(a, I)) raises(TypeError, lambda: a > I) raises(TypeError, lambda: Lt(a, I)) raises(TypeError, lambda: a < I) raises(TypeError, lambda: Ge(a, I)) raises(TypeError, lambda: a >= I) raises(TypeError, lambda: Le(a, I)) raises(TypeError, lambda: a <= I) def test_inequalities_cant_sympify_other(): # see issue 7833 from operator import gt, lt, ge, le bar = "foo" for a in (x, S.Zero, S.One/3, pi, I, zoo, oo, -oo, nan, Rational(1, 3)): for op in (lt, gt, le, ge): raises(TypeError, lambda: op(a, bar)) def test_ineq_avoid_wild_symbol_flip(): # see issue #7951, we try to avoid this internally, e.g., by using # __lt__ instead of "<". from sympy.core.symbol import Wild p = symbols('p', cls=Wild) # x > p might flip, but Gt should not: assert Gt(x, p) == Gt(x, p, evaluate=False) # Previously failed as 'p > x': e = Lt(x, y).subs({y: p}) assert e == Lt(x, p, evaluate=False) # Previously failed as 'p <= x': e = Ge(x, p).doit() assert e == Ge(x, p, evaluate=False) def test_issue_8245(): a = S("6506833320952669167898688709329/5070602400912917605986812821504") assert rel_check(a, a.n(10)) assert rel_check(a, a.n(20)) assert rel_check(a, a.n()) # prec of 30 is enough to fully capture a as mpf assert Float(a, 30) == Float(str(a.p), '')/Float(str(a.q), '') for i in range(31): r = Rational(Float(a, i)) f = Float(r) assert (f < a) == (Rational(f) < a) # test sign handling assert (-f < -a) == (Rational(-f) < -a) # test equivalence handling isa = Float(a.p,'')/Float(a.q,'') assert isa <= a assert not isa < a assert isa >= a assert not isa > a assert isa > 0 a = sqrt(2) r = Rational(str(a.n(30))) assert rel_check(a, r) a = sqrt(2) r = Rational(str(a.n(29))) assert rel_check(a, r) assert Eq(log(cos(2)**2 + sin(2)**2), 0) == True def test_issue_8449(): p = Symbol('p', nonnegative=True) assert Lt(-oo, p) assert Ge(-oo, p) is S.false assert Gt(oo, -p) assert Le(oo, -p) is S.false def test_simplify_relational(): assert simplify(x*(y + 1) - x*y - x + 1 < x) == (x > 1) assert simplify(x*(y + 1) - x*y - x - 1 < x) == (x > -1) assert simplify(x < x*(y + 1) - x*y - x + 1) == (x < 1) r = S.One < x # canonical operations are not the same as simplification, # so if there is no simplification, canonicalization will # be done unless the measure forbids it assert simplify(r) == r.canonical assert simplify(r, ratio=0) != r.canonical # this is not a random test; in _eval_simplify # this will simplify to S.false and that is the # reason for the 'if r.is_Relational' in Relational's # _eval_simplify routine assert simplify(-(2**(pi*Rational(3, 2)) + 6**pi)**(1/pi) + 2*(2**(pi/2) + 3**pi)**(1/pi) < 0) is S.false # canonical at least assert Eq(y, x).simplify() == Eq(x, y) assert Eq(x - 1, 0).simplify() == Eq(x, 1) assert Eq(x - 1, x).simplify() == S.false assert Eq(2*x - 1, x).simplify() == Eq(x, 1) assert Eq(2*x, 4).simplify() == Eq(x, 2) z = cos(1)**2 + sin(1)**2 - 1 # z.is_zero is None assert Eq(z*x, 0).simplify() == S.true assert Ne(y, x).simplify() == Ne(x, y) assert Ne(x - 1, 0).simplify() == Ne(x, 1) assert Ne(x - 1, x).simplify() == S.true assert Ne(2*x - 1, x).simplify() == Ne(x, 1) assert Ne(2*x, 4).simplify() == Ne(x, 2) assert Ne(z*x, 0).simplify() == S.false # No real-valued assumptions assert Ge(y, x).simplify() == Le(x, y) assert Ge(x - 1, 0).simplify() == Ge(x, 1) assert Ge(x - 1, x).simplify() == S.false assert Ge(2*x - 1, x).simplify() == Ge(x, 1) assert Ge(2*x, 4).simplify() == Ge(x, 2) assert Ge(z*x, 0).simplify() == S.true assert Ge(x, -2).simplify() == Ge(x, -2) assert Ge(-x, -2).simplify() == Le(x, 2) assert Ge(x, 2).simplify() == Ge(x, 2) assert Ge(-x, 2).simplify() == Le(x, -2) assert Le(y, x).simplify() == Ge(x, y) assert Le(x - 1, 0).simplify() == Le(x, 1) assert Le(x - 1, x).simplify() == S.true assert Le(2*x - 1, x).simplify() == Le(x, 1) assert Le(2*x, 4).simplify() == Le(x, 2) assert Le(z*x, 0).simplify() == S.true assert Le(x, -2).simplify() == Le(x, -2) assert Le(-x, -2).simplify() == Ge(x, 2) assert Le(x, 2).simplify() == Le(x, 2) assert Le(-x, 2).simplify() == Ge(x, -2) assert Gt(y, x).simplify() == Lt(x, y) assert Gt(x - 1, 0).simplify() == Gt(x, 1) assert Gt(x - 1, x).simplify() == S.false assert Gt(2*x - 1, x).simplify() == Gt(x, 1) assert Gt(2*x, 4).simplify() == Gt(x, 2) assert Gt(z*x, 0).simplify() == S.false assert Gt(x, -2).simplify() == Gt(x, -2) assert Gt(-x, -2).simplify() == Lt(x, 2) assert Gt(x, 2).simplify() == Gt(x, 2) assert Gt(-x, 2).simplify() == Lt(x, -2) assert Lt(y, x).simplify() == Gt(x, y) assert Lt(x - 1, 0).simplify() == Lt(x, 1) assert Lt(x - 1, x).simplify() == S.true assert Lt(2*x - 1, x).simplify() == Lt(x, 1) assert Lt(2*x, 4).simplify() == Lt(x, 2) assert Lt(z*x, 0).simplify() == S.false assert Lt(x, -2).simplify() == Lt(x, -2) assert Lt(-x, -2).simplify() == Gt(x, 2) assert Lt(x, 2).simplify() == Lt(x, 2) assert Lt(-x, 2).simplify() == Gt(x, -2) def test_equals(): w, x, y, z = symbols('w:z') f = Function('f') assert Eq(x, 1).equals(Eq(x*(y + 1) - x*y - x + 1, x)) assert Eq(x, y).equals(x < y, True) == False assert Eq(x, f(1)).equals(Eq(x, f(2)), True) == f(1) - f(2) assert Eq(f(1), y).equals(Eq(f(2), y), True) == f(1) - f(2) assert Eq(x, f(1)).equals(Eq(f(2), x), True) == f(1) - f(2) assert Eq(f(1), x).equals(Eq(x, f(2)), True) == f(1) - f(2) assert Eq(w, x).equals(Eq(y, z), True) == False assert Eq(f(1), f(2)).equals(Eq(f(3), f(4)), True) == f(1) - f(3) assert (x < y).equals(y > x, True) == True assert (x < y).equals(y >= x, True) == False assert (x < y).equals(z < y, True) == False assert (x < y).equals(x < z, True) == False assert (x < f(1)).equals(x < f(2), True) == f(1) - f(2) assert (f(1) < x).equals(f(2) < x, True) == f(1) - f(2) def test_reversed(): assert (x < y).reversed == (y > x) assert (x <= y).reversed == (y >= x) assert Eq(x, y, evaluate=False).reversed == Eq(y, x, evaluate=False) assert Ne(x, y, evaluate=False).reversed == Ne(y, x, evaluate=False) assert (x >= y).reversed == (y <= x) assert (x > y).reversed == (y < x) def test_canonical(): c = [i.canonical for i in ( x + y < z, x + 2 > 3, x < 2, S(2) > x, x**2 > -x/y, Gt(3, 2, evaluate=False) )] assert [i.canonical for i in c] == c assert [i.reversed.canonical for i in c] == c assert not any(i.lhs.is_Number and not i.rhs.is_Number for i in c) c = [i.reversed.func(i.rhs, i.lhs, evaluate=False).canonical for i in c] assert [i.canonical for i in c] == c assert [i.reversed.canonical for i in c] == c assert not any(i.lhs.is_Number and not i.rhs.is_Number for i in c) @XFAIL def test_issue_8444_nonworkingtests(): x = symbols('x', real=True) assert (x <= oo) == (x >= -oo) == True x = symbols('x') assert x >= floor(x) assert (x < floor(x)) == False assert x <= ceiling(x) assert (x > ceiling(x)) == False def test_issue_8444_workingtests(): x = symbols('x') assert Gt(x, floor(x)) == Gt(x, floor(x), evaluate=False) assert Ge(x, floor(x)) == Ge(x, floor(x), evaluate=False) assert Lt(x, ceiling(x)) == Lt(x, ceiling(x), evaluate=False) assert Le(x, ceiling(x)) == Le(x, ceiling(x), evaluate=False) i = symbols('i', integer=True) assert (i > floor(i)) == False assert (i < ceiling(i)) == False def test_issue_10304(): d = cos(1)**2 + sin(1)**2 - 1 assert d.is_comparable is False # if this fails, find a new d e = 1 + d*I assert simplify(Eq(e, 0)) is S.false def test_issue_18412(): d = (Rational(1, 6) + z / 4 / y) assert Eq(x, pi * y**3 * d).replace(y**3, z) == Eq(x, pi * z * d) def test_issue_10401(): x = symbols('x') fin = symbols('inf', finite=True) inf = symbols('inf', infinite=True) inf2 = symbols('inf2', infinite=True) infx = symbols('infx', infinite=True, extended_real=True) # Used in the commented tests below: #infx2 = symbols('infx2', infinite=True, extended_real=True) infnx = symbols('inf~x', infinite=True, extended_real=False) infnx2 = symbols('inf~x2', infinite=True, extended_real=False) infp = symbols('infp', infinite=True, extended_positive=True) infp1 = symbols('infp1', infinite=True, extended_positive=True) infn = symbols('infn', infinite=True, extended_negative=True) zero = symbols('z', zero=True) nonzero = symbols('nz', zero=False, finite=True) assert Eq(1/(1/x + 1), 1).func is Eq assert Eq(1/(1/x + 1), 1).subs(x, S.ComplexInfinity) is S.true assert Eq(1/(1/fin + 1), 1) is S.false T, F = S.true, S.false assert Eq(fin, inf) is F assert Eq(inf, inf2) not in (T, F) and inf != inf2 assert Eq(1 + inf, 2 + inf2) not in (T, F) and inf != inf2 assert Eq(infp, infp1) is T assert Eq(infp, infn) is F assert Eq(1 + I*oo, I*oo) is F assert Eq(I*oo, 1 + I*oo) is F assert Eq(1 + I*oo, 2 + I*oo) is F assert Eq(1 + I*oo, 2 + I*infx) is F assert Eq(1 + I*oo, 2 + infx) is F # FIXME: The test below fails because (-infx).is_extended_positive is True # (should be None) #assert Eq(1 + I*infx, 1 + I*infx2) not in (T, F) and infx != infx2 # assert Eq(zoo, sqrt(2) + I*oo) is F assert Eq(zoo, oo) is F r = Symbol('r', real=True) i = Symbol('i', imaginary=True) assert Eq(i*I, r) not in (T, F) assert Eq(infx, infnx) is F assert Eq(infnx, infnx2) not in (T, F) and infnx != infnx2 assert Eq(zoo, oo) is F assert Eq(inf/inf2, 0) is F assert Eq(inf/fin, 0) is F assert Eq(fin/inf, 0) is T assert Eq(zero/nonzero, 0) is T and ((zero/nonzero) != 0) # The commented out test below is incorrect because: assert zoo == -zoo assert Eq(zoo, -zoo) is T assert Eq(oo, -oo) is F assert Eq(inf, -inf) not in (T, F) assert Eq(fin/(fin + 1), 1) is S.false o = symbols('o', odd=True) assert Eq(o, 2*o) is S.false p = symbols('p', positive=True) assert Eq(p/(p - 1), 1) is F def test_issue_10633(): assert Eq(True, False) == False assert Eq(False, True) == False assert Eq(True, True) == True assert Eq(False, False) == True def test_issue_10927(): x = symbols('x') assert str(Eq(x, oo)) == 'Eq(x, oo)' assert str(Eq(x, -oo)) == 'Eq(x, -oo)' def test_issues_13081_12583_12534(): # 13081 r = Rational('905502432259640373/288230376151711744') assert (r < pi) is S.false assert (r > pi) is S.true # 12583 v = sqrt(2) u = sqrt(v) + 2/sqrt(10 - 8/sqrt(2 - v) + 4*v*(1/sqrt(2 - v) - 1)) assert (u >= 0) is S.true # 12534; Rational vs NumberSymbol # here are some precisions for which Rational forms # at a lower and higher precision bracket the value of pi # e.g. for p = 20: # Rational(pi.n(p + 1)).n(25) = 3.14159265358979323846 2834 # pi.n(25) = 3.14159265358979323846 2643 # Rational(pi.n(p )).n(25) = 3.14159265358979323846 1987 assert [p for p in range(20, 50) if (Rational(pi.n(p)) < pi) and (pi < Rational(pi.n(p + 1)))] == [20, 24, 27, 33, 37, 43, 48] # pick one such precision and affirm that the reversed operation # gives the opposite result, i.e. if x < y is true then x > y # must be false for i in (20, 21): v = pi.n(i) assert rel_check(Rational(v), pi) assert rel_check(v, pi) assert rel_check(pi.n(20), pi.n(21)) # Float vs Rational # the rational form is less than the floating representation # at the same precision assert [i for i in range(15, 50) if Rational(pi.n(i)) > pi.n(i)] == [] # this should be the same if we reverse the relational assert [i for i in range(15, 50) if pi.n(i) < Rational(pi.n(i))] == [] def test_issue_18188(): from sympy.sets.conditionset import ConditionSet result1 = Eq(x*cos(x) - 3*sin(x), 0) assert result1.as_set() == ConditionSet(x, Eq(x*cos(x) - 3*sin(x), 0), Reals) result2 = Eq(x**2 + sqrt(x*2) + sin(x), 0) assert result2.as_set() == ConditionSet(x, Eq(sqrt(2)*sqrt(x) + x**2 + sin(x), 0), Reals) def test_binary_symbols(): ans = set([x]) for f in Eq, Ne: for t in S.true, S.false: eq = f(x, S.true) assert eq.binary_symbols == ans assert eq.reversed.binary_symbols == ans assert f(x, 1).binary_symbols == set() def test_rel_args(): # can't have Boolean args; this is automatic with Python 3 # so this test and the __lt__, etc..., definitions in # relational.py and boolalg.py which are marked with /// # can be removed. for op in ['<', '<=', '>', '>=']: for b in (S.true, x < 1, And(x, y)): for v in (0.1, 1, 2**32, t, S.One): raises(TypeError, lambda: Relational(b, v, op)) def test_Equality_rewrite_as_Add(): eq = Eq(x + y, y - x) assert eq.rewrite(Add) == 2*x assert eq.rewrite(Add, evaluate=None).args == (x, x, y, -y) assert eq.rewrite(Add, evaluate=False).args == (x, y, x, -y) def test_issue_15847(): a = Ne(x*(x+y), x**2 + x*y) assert simplify(a) == False def test_negated_property(): eq = Eq(x, y) assert eq.negated == Ne(x, y) eq = Ne(x, y) assert eq.negated == Eq(x, y) eq = Ge(x + y, y - x) assert eq.negated == Lt(x + y, y - x) for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(x, y).negated.negated == f(x, y) def test_reversedsign_property(): eq = Eq(x, y) assert eq.reversedsign == Eq(-x, -y) eq = Ne(x, y) assert eq.reversedsign == Ne(-x, -y) eq = Ge(x + y, y - x) assert eq.reversedsign == Le(-x - y, x - y) for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(x, y).reversedsign.reversedsign == f(x, y) for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(-x, y).reversedsign.reversedsign == f(-x, y) for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(x, -y).reversedsign.reversedsign == f(x, -y) for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(-x, -y).reversedsign.reversedsign == f(-x, -y) def test_reversed_reversedsign_property(): for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(x, y).reversed.reversedsign == f(x, y).reversedsign.reversed for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(-x, y).reversed.reversedsign == f(-x, y).reversedsign.reversed for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(x, -y).reversed.reversedsign == f(x, -y).reversedsign.reversed for f in (Eq, Ne, Ge, Gt, Le, Lt): assert f(-x, -y).reversed.reversedsign == \ f(-x, -y).reversedsign.reversed def test_improved_canonical(): def test_different_forms(listofforms): for form1, form2 in combinations(listofforms, 2): assert form1.canonical == form2.canonical def generate_forms(expr): return [expr, expr.reversed, expr.reversedsign, expr.reversed.reversedsign] test_different_forms(generate_forms(x > -y)) test_different_forms(generate_forms(x >= -y)) test_different_forms(generate_forms(Eq(x, -y))) test_different_forms(generate_forms(Ne(x, -y))) test_different_forms(generate_forms(pi < x)) test_different_forms(generate_forms(pi - 5*y < -x + 2*y**2 - 7)) assert (pi >= x).canonical == (x <= pi) def test_set_equality_canonical(): a, b, c = symbols('a b c') A = Eq(FiniteSet(a, b, c), FiniteSet(1, 2, 3)) B = Ne(FiniteSet(a, b, c), FiniteSet(4, 5, 6)) assert A.canonical == A.reversed assert B.canonical == B.reversed def test_trigsimp(): # issue 16736 s, c = sin(2*x), cos(2*x) eq = Eq(s, c) assert trigsimp(eq) == eq # no rearrangement of sides # simplification of sides might result in # an unevaluated Eq changed = trigsimp(Eq(s + c, sqrt(2))) assert isinstance(changed, Eq) assert changed.subs(x, pi/8) is S.true # or an evaluated one assert trigsimp(Eq(cos(x)**2 + sin(x)**2, 1)) is S.true def test_polynomial_relation_simplification(): assert Ge(3*x*(x + 1) + 4, 3*x).simplify() in [Ge(x**2, -Rational(4,3)), Le(-x**2, Rational(4, 3))] assert Le(-(3*x*(x + 1) + 4), -3*x).simplify() in [Ge(x**2, -Rational(4,3)), Le(-x**2, Rational(4, 3))] assert ((x**2+3)*(x**2-1)+3*x >= 2*x**2).simplify() in [(x**4 + 3*x >= 3), (-x**4 - 3*x <= -3)] def test_multivariate_linear_function_simplification(): assert Ge(x + y, x - y).simplify() == Ge(y, 0) assert Le(-x + y, -x - y).simplify() == Le(y, 0) assert Eq(2*x + y, 2*x + y - 3).simplify() == False assert (2*x + y > 2*x + y - 3).simplify() == True assert (2*x + y < 2*x + y - 3).simplify() == False assert (2*x + y < 2*x + y + 3).simplify() == True a, b, c, d, e, f, g = symbols('a b c d e f g') assert Lt(a + b + c + 2*d, 3*d - f + g). simplify() == Lt(a, -b - c + d - f + g) def test_nonpolymonial_relations(): assert Eq(cos(x), 0).simplify() == Eq(cos(x), 0)
29174563d3309c81840a2dc21940b8702473ab9db328727dc06dcaaac16bf371
from collections import defaultdict from sympy import Matrix, Tuple, symbols, sympify, Basic, Dict, S, FiniteSet, Integer from sympy.core.compatibility import is_sequence, iterable from sympy.core.containers import tuple_wrapper from sympy.core.expr import unchanged from sympy.core.function import Function, Lambda from sympy.core.relational import Eq from sympy.testing.pytest import raises from sympy.abc import x, y def test_Tuple(): t = (1, 2, 3, 4) st = Tuple(*t) assert set(sympify(t)) == set(st) assert len(t) == len(st) assert set(sympify(t[:2])) == set(st[:2]) assert isinstance(st[:], Tuple) assert st == Tuple(1, 2, 3, 4) assert st.func(*st.args) == st p, q, r, s = symbols('p q r s') t2 = (p, q, r, s) st2 = Tuple(*t2) assert st2.atoms() == set(t2) assert st == st2.subs({p: 1, q: 2, r: 3, s: 4}) # issue 5505 assert all(isinstance(arg, Basic) for arg in st.args) assert Tuple(p, 1).subs(p, 0) == Tuple(0, 1) assert Tuple(p, Tuple(p, 1)).subs(p, 0) == Tuple(0, Tuple(0, 1)) assert Tuple(t2) == Tuple(Tuple(*t2)) assert Tuple.fromiter(t2) == Tuple(*t2) assert Tuple.fromiter(x for x in range(4)) == Tuple(0, 1, 2, 3) assert st2.fromiter(st2.args) == st2 def test_Tuple_contains(): t1, t2 = Tuple(1), Tuple(2) assert t1 in Tuple(1, 2, 3, t1, Tuple(t2)) assert t2 not in Tuple(1, 2, 3, t1, Tuple(t2)) def test_Tuple_concatenation(): assert Tuple(1, 2) + Tuple(3, 4) == Tuple(1, 2, 3, 4) assert (1, 2) + Tuple(3, 4) == Tuple(1, 2, 3, 4) assert Tuple(1, 2) + (3, 4) == Tuple(1, 2, 3, 4) raises(TypeError, lambda: Tuple(1, 2) + 3) raises(TypeError, lambda: 1 + Tuple(2, 3)) #the Tuple case in __radd__ is only reached when a subclass is involved class Tuple2(Tuple): def __radd__(self, other): return Tuple.__radd__(self, other + other) assert Tuple(1, 2) + Tuple2(3, 4) == Tuple(1, 2, 1, 2, 3, 4) assert Tuple2(1, 2) + Tuple(3, 4) == Tuple(1, 2, 3, 4) def test_Tuple_equality(): assert not isinstance(Tuple(1, 2), tuple) assert (Tuple(1, 2) == (1, 2)) is True assert (Tuple(1, 2) != (1, 2)) is False assert (Tuple(1, 2) == (1, 3)) is False assert (Tuple(1, 2) != (1, 3)) is True assert (Tuple(1, 2) == Tuple(1, 2)) is True assert (Tuple(1, 2) != Tuple(1, 2)) is False assert (Tuple(1, 2) == Tuple(1, 3)) is False assert (Tuple(1, 2) != Tuple(1, 3)) is True def test_Tuple_Eq(): assert Eq(Tuple(), Tuple()) is S.true assert Eq(Tuple(1), 1) is S.false assert Eq(Tuple(1, 2), Tuple(1)) is S.false assert Eq(Tuple(1), Tuple(1)) is S.true assert Eq(Tuple(1, 2), Tuple(1, 3)) is S.false assert Eq(Tuple(1, 2), Tuple(1, 2)) is S.true assert unchanged(Eq, Tuple(1, x), Tuple(1, 2)) assert Eq(Tuple(1, x), Tuple(1, 2)).subs(x, 2) is S.true assert unchanged(Eq, Tuple(1, 2), x) f = Function('f') assert unchanged(Eq, Tuple(1), f(x)) assert Eq(Tuple(1), f(x)).subs(x, 1).subs(f, Lambda(y, (y,))) is S.true def test_Tuple_comparision(): assert (Tuple(1, 3) >= Tuple(-10, 30)) is S.true assert (Tuple(1, 3) <= Tuple(-10, 30)) is S.false assert (Tuple(1, 3) >= Tuple(1, 3)) is S.true assert (Tuple(1, 3) <= Tuple(1, 3)) is S.true def test_Tuple_tuple_count(): assert Tuple(0, 1, 2, 3).tuple_count(4) == 0 assert Tuple(0, 4, 1, 2, 3).tuple_count(4) == 1 assert Tuple(0, 4, 1, 4, 2, 3).tuple_count(4) == 2 assert Tuple(0, 4, 1, 4, 2, 4, 3).tuple_count(4) == 3 def test_Tuple_index(): assert Tuple(4, 0, 1, 2, 3).index(4) == 0 assert Tuple(0, 4, 1, 2, 3).index(4) == 1 assert Tuple(0, 1, 4, 2, 3).index(4) == 2 assert Tuple(0, 1, 2, 4, 3).index(4) == 3 assert Tuple(0, 1, 2, 3, 4).index(4) == 4 raises(ValueError, lambda: Tuple(0, 1, 2, 3).index(4)) raises(ValueError, lambda: Tuple(4, 0, 1, 2, 3).index(4, 1)) raises(ValueError, lambda: Tuple(0, 1, 2, 3, 4).index(4, 1, 4)) def test_Tuple_mul(): assert Tuple(1, 2, 3)*2 == Tuple(1, 2, 3, 1, 2, 3) assert 2*Tuple(1, 2, 3) == Tuple(1, 2, 3, 1, 2, 3) assert Tuple(1, 2, 3)*Integer(2) == Tuple(1, 2, 3, 1, 2, 3) assert Integer(2)*Tuple(1, 2, 3) == Tuple(1, 2, 3, 1, 2, 3) raises(TypeError, lambda: Tuple(1, 2, 3)*S.Half) raises(TypeError, lambda: S.Half*Tuple(1, 2, 3)) def test_tuple_wrapper(): @tuple_wrapper def wrap_tuples_and_return(*t): return t p = symbols('p') assert wrap_tuples_and_return(p, 1) == (p, 1) assert wrap_tuples_and_return((p, 1)) == (Tuple(p, 1),) assert wrap_tuples_and_return(1, (p, 2), 3) == (1, Tuple(p, 2), 3) def test_iterable_is_sequence(): ordered = [list(), tuple(), Tuple(), Matrix([[]])] unordered = [set()] not_sympy_iterable = [{}, '', u''] assert all(is_sequence(i) for i in ordered) assert all(not is_sequence(i) for i in unordered) assert all(iterable(i) for i in ordered + unordered) assert all(not iterable(i) for i in not_sympy_iterable) assert all(iterable(i, exclude=None) for i in not_sympy_iterable) def test_Dict(): x, y, z = symbols('x y z') d = Dict({x: 1, y: 2, z: 3}) assert d[x] == 1 assert d[y] == 2 raises(KeyError, lambda: d[2]) assert len(d) == 3 assert set(d.keys()) == set((x, y, z)) assert set(d.values()) == set((S.One, S(2), S(3))) assert d.get(5, 'default') == 'default' assert x in d and z in d and not 5 in d assert d.has(x) and d.has(1) # SymPy Basic .has method # Test input types # input - a python dict # input - items as args - SymPy style assert (Dict({x: 1, y: 2, z: 3}) == Dict((x, 1), (y, 2), (z, 3))) raises(TypeError, lambda: Dict(((x, 1), (y, 2), (z, 3)))) with raises(NotImplementedError): d[5] = 6 # assert immutability assert set( d.items()) == set((Tuple(x, S.One), Tuple(y, S(2)), Tuple(z, S(3)))) assert set(d) == {x, y, z} assert str(d) == '{x: 1, y: 2, z: 3}' assert d.__repr__() == '{x: 1, y: 2, z: 3}' # Test creating a Dict from a Dict. d = Dict({x: 1, y: 2, z: 3}) assert d == Dict(d) # Test for supporting defaultdict d = defaultdict(int) assert d[x] == 0 assert d[y] == 0 assert d[z] == 0 assert Dict(d) d = Dict(d) assert len(d) == 3 assert set(d.keys()) == set((x, y, z)) assert set(d.values()) == set((S.Zero, S.Zero, S.Zero)) def test_issue_5788(): args = [(1, 2), (2, 1)] for o in [Dict, Tuple, FiniteSet]: # __eq__ and arg handling if o != Tuple: assert o(*args) == o(*reversed(args)) pair = [o(*args), o(*reversed(args))] assert sorted(pair) == sorted(reversed(pair)) assert set(o(*args)) # doesn't fail
cce0b5df39df6a9e82da2e1fc3dc0aa66d3d986b5af6712e45242a1fd3154164
from sympy import (Symbol, exp, Integer, Float, sin, cos, log, Poly, Lambda, Function, I, S, sqrt, srepr, Rational, Tuple, Matrix, Interval, Add, Mul, Pow, Or, true, false, Abs, pi, Range, Xor) from sympy.abc import x, y from sympy.core.sympify import (sympify, _sympify, SympifyError, kernS, CantSympify) from sympy.core.decorators import _sympifyit from sympy.external import import_module from sympy.testing.pytest import raises, XFAIL, skip from sympy.utilities.decorator import conserve_mpmath_dps from sympy.geometry import Point, Line from sympy.functions.combinatorial.factorials import factorial, factorial2 from sympy.abc import _clash, _clash1, _clash2 from sympy.core.compatibility import exec_, HAS_GMPY from sympy.sets import FiniteSet, EmptySet from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray import mpmath from collections import defaultdict, OrderedDict from mpmath.rational import mpq numpy = import_module('numpy') def test_issue_3538(): v = sympify("exp(x)") assert v == exp(x) assert type(v) == type(exp(x)) assert str(type(v)) == str(type(exp(x))) def test_sympify1(): assert sympify("x") == Symbol("x") assert sympify(" x") == Symbol("x") assert sympify(" x ") == Symbol("x") # issue 4877 n1 = S.Half assert sympify('--.5') == n1 assert sympify('-1/2') == -n1 assert sympify('-+--.5') == -n1 assert sympify('-.[3]') == Rational(-1, 3) assert sympify('.[3]') == Rational(1, 3) assert sympify('+.[3]') == Rational(1, 3) assert sympify('+0.[3]*10**-2') == Rational(1, 300) assert sympify('.[052631578947368421]') == Rational(1, 19) assert sympify('.0[526315789473684210]') == Rational(1, 19) assert sympify('.034[56]') == Rational(1711, 49500) # options to make reals into rationals assert sympify('1.22[345]', rational=True) == \ 1 + Rational(22, 100) + Rational(345, 99900) assert sympify('2/2.6', rational=True) == Rational(10, 13) assert sympify('2.6/2', rational=True) == Rational(13, 10) assert sympify('2.6e2/17', rational=True) == Rational(260, 17) assert sympify('2.6e+2/17', rational=True) == Rational(260, 17) assert sympify('2.6e-2/17', rational=True) == Rational(26, 17000) assert sympify('2.1+3/4', rational=True) == \ Rational(21, 10) + Rational(3, 4) assert sympify('2.234456', rational=True) == Rational(279307, 125000) assert sympify('2.234456e23', rational=True) == 223445600000000000000000 assert sympify('2.234456e-23', rational=True) == \ Rational(279307, 12500000000000000000000000000) assert sympify('-2.234456e-23', rational=True) == \ Rational(-279307, 12500000000000000000000000000) assert sympify('12345678901/17', rational=True) == \ Rational(12345678901, 17) assert sympify('1/.3 + x', rational=True) == Rational(10, 3) + x # make sure longs in fractions work assert sympify('222222222222/11111111111') == \ Rational(222222222222, 11111111111) # ... even if they come from repetend notation assert sympify('1/.2[123456789012]') == Rational(333333333333, 70781892967) # ... or from high precision reals assert sympify('.1234567890123456', rational=True) == \ Rational(19290123283179, 156250000000000) def test_sympify_Fraction(): try: import fractions except ImportError: pass else: value = sympify(fractions.Fraction(101, 127)) assert value == Rational(101, 127) and type(value) is Rational def test_sympify_gmpy(): if HAS_GMPY: if HAS_GMPY == 2: import gmpy2 as gmpy elif HAS_GMPY == 1: import gmpy value = sympify(gmpy.mpz(1000001)) assert value == Integer(1000001) and type(value) is Integer value = sympify(gmpy.mpq(101, 127)) assert value == Rational(101, 127) and type(value) is Rational @conserve_mpmath_dps def test_sympify_mpmath(): value = sympify(mpmath.mpf(1.0)) assert value == Float(1.0) and type(value) is Float mpmath.mp.dps = 12 assert sympify( mpmath.pi).epsilon_eq(Float("3.14159265359"), Float("1e-12")) == True assert sympify( mpmath.pi).epsilon_eq(Float("3.14159265359"), Float("1e-13")) == False mpmath.mp.dps = 6 assert sympify( mpmath.pi).epsilon_eq(Float("3.14159"), Float("1e-5")) == True assert sympify( mpmath.pi).epsilon_eq(Float("3.14159"), Float("1e-6")) == False assert sympify(mpmath.mpc(1.0 + 2.0j)) == Float(1.0) + Float(2.0)*I assert sympify(mpq(1, 2)) == S.Half def test_sympify2(): class A: def _sympy_(self): return Symbol("x")**3 a = A() assert _sympify(a) == x**3 assert sympify(a) == x**3 assert a == x**3 def test_sympify3(): assert sympify("x**3") == x**3 assert sympify("x^3") == x**3 assert sympify("1/2") == Integer(1)/2 raises(SympifyError, lambda: _sympify('x**3')) raises(SympifyError, lambda: _sympify('1/2')) def test_sympify_keywords(): raises(SympifyError, lambda: sympify('if')) raises(SympifyError, lambda: sympify('for')) raises(SympifyError, lambda: sympify('while')) raises(SympifyError, lambda: sympify('lambda')) def test_sympify_float(): assert sympify("1e-64") != 0 assert sympify("1e-20000") != 0 def test_sympify_bool(): assert sympify(True) is true assert sympify(False) is false def test_sympyify_iterables(): ans = [Rational(3, 10), Rational(1, 5)] assert sympify(['.3', '.2'], rational=True) == ans assert sympify(dict(x=0, y=1)) == {x: 0, y: 1} assert sympify(['1', '2', ['3', '4']]) == [S(1), S(2), [S(3), S(4)]] @XFAIL def test_issue_16772(): # because there is a converter for tuple, the # args are only sympified without the flags being passed # along; list, on the other hand, is not converted # with a converter so its args are traversed later ans = [Rational(3, 10), Rational(1, 5)] assert sympify(tuple(['.3', '.2']), rational=True) == Tuple(*ans) def test_issue_16859(): class no(float, CantSympify): pass raises(SympifyError, lambda: sympify(no(1.2))) def test_sympify4(): class A: def _sympy_(self): return Symbol("x") a = A() assert _sympify(a)**3 == x**3 assert sympify(a)**3 == x**3 assert a == x def test_sympify_text(): assert sympify('some') == Symbol('some') assert sympify('core') == Symbol('core') assert sympify('True') is True assert sympify('False') is False assert sympify('Poly') == Poly assert sympify('sin') == sin def test_sympify_function(): assert sympify('factor(x**2-1, x)') == -(1 - x)*(x + 1) assert sympify('sin(pi/2)*cos(pi)') == -Integer(1) def test_sympify_poly(): p = Poly(x**2 + x + 1, x) assert _sympify(p) is p assert sympify(p) is p def test_sympify_factorial(): assert sympify('x!') == factorial(x) assert sympify('(x+1)!') == factorial(x + 1) assert sympify('(1 + y*(x + 1))!') == factorial(1 + y*(x + 1)) assert sympify('(1 + y*(x + 1)!)^2') == (1 + y*factorial(x + 1))**2 assert sympify('y*x!') == y*factorial(x) assert sympify('x!!') == factorial2(x) assert sympify('(x+1)!!') == factorial2(x + 1) assert sympify('(1 + y*(x + 1))!!') == factorial2(1 + y*(x + 1)) assert sympify('(1 + y*(x + 1)!!)^2') == (1 + y*factorial2(x + 1))**2 assert sympify('y*x!!') == y*factorial2(x) assert sympify('factorial2(x)!') == factorial(factorial2(x)) raises(SympifyError, lambda: sympify("+!!")) raises(SympifyError, lambda: sympify(")!!")) raises(SympifyError, lambda: sympify("!")) raises(SympifyError, lambda: sympify("(!)")) raises(SympifyError, lambda: sympify("x!!!")) def test_sage(): # how to effectivelly test for the _sage_() method without having SAGE # installed? assert hasattr(x, "_sage_") assert hasattr(Integer(3), "_sage_") assert hasattr(sin(x), "_sage_") assert hasattr(cos(x), "_sage_") assert hasattr(x**2, "_sage_") assert hasattr(x + y, "_sage_") assert hasattr(exp(x), "_sage_") assert hasattr(log(x), "_sage_") def test_issue_3595(): assert sympify("a_") == Symbol("a_") assert sympify("_a") == Symbol("_a") def test_lambda(): x = Symbol('x') assert sympify('lambda: 1') == Lambda((), 1) assert sympify('lambda x: x') == Lambda(x, x) assert sympify('lambda x: 2*x') == Lambda(x, 2*x) assert sympify('lambda x, y: 2*x+y') == Lambda((x, y), 2*x + y) def test_lambda_raises(): raises(SympifyError, lambda: sympify("lambda *args: args")) # args argument error raises(SympifyError, lambda: sympify("lambda **kwargs: kwargs[0]")) # kwargs argument error raises(SympifyError, lambda: sympify("lambda x = 1: x")) # Keyword argument error with raises(SympifyError): _sympify('lambda: 1') def test_sympify_raises(): raises(SympifyError, lambda: sympify("fx)")) def test__sympify(): x = Symbol('x') f = Function('f') # positive _sympify assert _sympify(x) is x assert _sympify(f) is f assert _sympify(1) == Integer(1) assert _sympify(0.5) == Float("0.5") assert _sympify(1 + 1j) == 1.0 + I*1.0 class A: def _sympy_(self): return Integer(5) a = A() assert _sympify(a) == Integer(5) # negative _sympify raises(SympifyError, lambda: _sympify('1')) raises(SympifyError, lambda: _sympify([1, 2, 3])) def test_sympifyit(): x = Symbol('x') y = Symbol('y') @_sympifyit('b', NotImplemented) def add(a, b): return a + b assert add(x, 1) == x + 1 assert add(x, 0.5) == x + Float('0.5') assert add(x, y) == x + y assert add(x, '1') == NotImplemented @_sympifyit('b') def add_raises(a, b): return a + b assert add_raises(x, 1) == x + 1 assert add_raises(x, 0.5) == x + Float('0.5') assert add_raises(x, y) == x + y raises(SympifyError, lambda: add_raises(x, '1')) def test_int_float(): class F1_1(object): def __float__(self): return 1.1 class F1_1b(object): """ This class is still a float, even though it also implements __int__(). """ def __float__(self): return 1.1 def __int__(self): return 1 class F1_1c(object): """ This class is still a float, because it implements _sympy_() """ def __float__(self): return 1.1 def __int__(self): return 1 def _sympy_(self): return Float(1.1) class I5(object): def __int__(self): return 5 class I5b(object): """ This class implements both __int__() and __float__(), so it will be treated as Float in SymPy. One could change this behavior, by using float(a) == int(a), but deciding that integer-valued floats represent exact numbers is arbitrary and often not correct, so we do not do it. If, in the future, we decide to do it anyway, the tests for I5b need to be changed. """ def __float__(self): return 5.0 def __int__(self): return 5 class I5c(object): """ This class implements both __int__() and __float__(), but also a _sympy_() method, so it will be Integer. """ def __float__(self): return 5.0 def __int__(self): return 5 def _sympy_(self): return Integer(5) i5 = I5() i5b = I5b() i5c = I5c() f1_1 = F1_1() f1_1b = F1_1b() f1_1c = F1_1c() assert sympify(i5) == 5 assert isinstance(sympify(i5), Integer) assert sympify(i5b) == 5 assert isinstance(sympify(i5b), Float) assert sympify(i5c) == 5 assert isinstance(sympify(i5c), Integer) assert abs(sympify(f1_1) - 1.1) < 1e-5 assert abs(sympify(f1_1b) - 1.1) < 1e-5 assert abs(sympify(f1_1c) - 1.1) < 1e-5 assert _sympify(i5) == 5 assert isinstance(_sympify(i5), Integer) assert _sympify(i5b) == 5 assert isinstance(_sympify(i5b), Float) assert _sympify(i5c) == 5 assert isinstance(_sympify(i5c), Integer) assert abs(_sympify(f1_1) - 1.1) < 1e-5 assert abs(_sympify(f1_1b) - 1.1) < 1e-5 assert abs(_sympify(f1_1c) - 1.1) < 1e-5 def test_evaluate_false(): cases = { '2 + 3': Add(2, 3, evaluate=False), '2**2 / 3': Mul(Pow(2, 2, evaluate=False), Pow(3, -1, evaluate=False), evaluate=False), '2 + 3 * 5': Add(2, Mul(3, 5, evaluate=False), evaluate=False), '2 - 3 * 5': Add(2, Mul(-1, Mul(3, 5,evaluate=False), evaluate=False), evaluate=False), '1 / 3': Mul(1, Pow(3, -1, evaluate=False), evaluate=False), 'True | False': Or(True, False, evaluate=False), '1 + 2 + 3 + 5*3 + integrate(x)': Add(1, 2, 3, Mul(5, 3, evaluate=False), x**2/2, evaluate=False), '2 * 4 * 6 + 8': Add(Mul(2, 4, 6, evaluate=False), 8, evaluate=False), '2 - 8 / 4': Add(2, Mul(-1, Mul(8, Pow(4, -1, evaluate=False), evaluate=False), evaluate=False), evaluate=False), '2 - 2**2': Add(2, Mul(-1, Pow(2, 2, evaluate=False), evaluate=False), evaluate=False), } for case, result in cases.items(): assert sympify(case, evaluate=False) == result def test_issue_4133(): a = sympify('Integer(4)') assert a == Integer(4) assert a.is_Integer def test_issue_3982(): a = [3, 2.0] assert sympify(a) == [Integer(3), Float(2.0)] assert sympify(tuple(a)) == Tuple(Integer(3), Float(2.0)) assert sympify(set(a)) == FiniteSet(Integer(3), Float(2.0)) def test_S_sympify(): assert S(1)/2 == sympify(1)/2 assert (-2)**(S(1)/2) == sqrt(2)*I def test_issue_4788(): assert srepr(S(1.0 + 0J)) == srepr(S(1.0)) == srepr(Float(1.0)) def test_issue_4798_None(): assert S(None) is None def test_issue_3218(): assert sympify("x+\ny") == x + y def test_issue_4988_builtins(): C = Symbol('C') vars = {'C': C} exp1 = sympify('C') assert exp1 == C # Make sure it did not get mixed up with sympy.C exp2 = sympify('C', vars) assert exp2 == C # Make sure it did not get mixed up with sympy.C def test_geometry(): p = sympify(Point(0, 1)) assert p == Point(0, 1) and isinstance(p, Point) L = sympify(Line(p, (1, 0))) assert L == Line((0, 1), (1, 0)) and isinstance(L, Line) def test_kernS(): s = '-1 - 2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x)))' # when 1497 is fixed, this no longer should pass: the expression # should be unchanged assert -1 - 2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) == -1 # sympification should not allow the constant to enter a Mul # or else the structure can change dramatically ss = kernS(s) assert ss != -1 and ss.simplify() == -1 s = '-1 - 2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x)))'.replace( 'x', '_kern') ss = kernS(s) assert ss != -1 and ss.simplify() == -1 # issue 6687 assert kernS('Interval(-1,-2 - 4*(-3))') == Interval(-1, 10) assert kernS('_kern') == Symbol('_kern') assert kernS('E**-(x)') == exp(-x) e = 2*(x + y)*y assert kernS(['2*(x + y)*y', ('2*(x + y)*y',)]) == [e, (e,)] assert kernS('-(2*sin(x)**2 + 2*sin(x)*cos(x))*y/2') == \ -y*(2*sin(x)**2 + 2*sin(x)*cos(x))/2 # issue 15132 assert kernS('(1 - x)/(1 - x*(1-y))') == kernS('(1-x)/(1-(1-y)*x)') assert kernS('(1-2**-(4+1)*(1-y)*x)') == (1 - x*(1 - y)/32) assert kernS('(1-2**(4+1)*(1-y)*x)') == (1 - 32*x*(1 - y)) assert kernS('(1-2.*(1-y)*x)') == 1 - 2.*x*(1 - y) one = kernS('x - (x - 1)') assert one != 1 and one.expand() == 1 def test_issue_6540_6552(): assert S('[[1/3,2], (2/5,)]') == [[Rational(1, 3), 2], (Rational(2, 5),)] assert S('[[2/6,2], (2/4,)]') == [[Rational(1, 3), 2], (S.Half,)] assert S('[[[2*(1)]]]') == [[[2]]] assert S('Matrix([2*(1)])') == Matrix([2]) def test_issue_6046(): assert str(S("Q & C", locals=_clash1)) == 'C & Q' assert str(S('pi(x)', locals=_clash2)) == 'pi(x)' assert str(S('pi(C, Q)', locals=_clash)) == 'pi(C, Q)' locals = {} exec_("from sympy.abc import Q, C", locals) assert str(S('C&Q', locals)) == 'C & Q' def test_issue_8821_highprec_from_str(): s = str(pi.evalf(128)) p = sympify(s) assert Abs(sin(p)) < 1e-127 def test_issue_10295(): if not numpy: skip("numpy not installed.") A = numpy.array([[1, 3, -1], [0, 1, 7]]) sA = S(A) assert sA.shape == (2, 3) for (ri, ci), val in numpy.ndenumerate(A): assert sA[ri, ci] == val B = numpy.array([-7, x, 3*y**2]) sB = S(B) assert sB.shape == (3,) assert B[0] == sB[0] == -7 assert B[1] == sB[1] == x assert B[2] == sB[2] == 3*y**2 C = numpy.arange(0, 24) C.resize(2,3,4) sC = S(C) assert sC[0, 0, 0].is_integer assert sC[0, 0, 0] == 0 a1 = numpy.array([1, 2, 3]) a2 = numpy.array([i for i in range(24)]) a2.resize(2, 4, 3) assert sympify(a1) == ImmutableDenseNDimArray([1, 2, 3]) assert sympify(a2) == ImmutableDenseNDimArray([i for i in range(24)], (2, 4, 3)) def test_Range(): # Only works in Python 3 where range returns a range type assert sympify(range(10)) == Range(10) assert _sympify(range(10)) == Range(10) def test_sympify_set(): n = Symbol('n') assert sympify({n}) == FiniteSet(n) assert sympify(set()) == EmptySet def test_sympify_numpy(): if not numpy: skip('numpy not installed. Abort numpy tests.') np = numpy def equal(x, y): return x == y and type(x) == type(y) assert sympify(np.bool_(1)) is S(True) try: assert equal( sympify(np.int_(1234567891234567891)), S(1234567891234567891)) assert equal( sympify(np.intp(1234567891234567891)), S(1234567891234567891)) except OverflowError: # May fail on 32-bit systems: Python int too large to convert to C long pass assert equal(sympify(np.intc(1234567891)), S(1234567891)) assert equal(sympify(np.int8(-123)), S(-123)) assert equal(sympify(np.int16(-12345)), S(-12345)) assert equal(sympify(np.int32(-1234567891)), S(-1234567891)) assert equal( sympify(np.int64(-1234567891234567891)), S(-1234567891234567891)) assert equal(sympify(np.uint8(123)), S(123)) assert equal(sympify(np.uint16(12345)), S(12345)) assert equal(sympify(np.uint32(1234567891)), S(1234567891)) assert equal( sympify(np.uint64(1234567891234567891)), S(1234567891234567891)) assert equal(sympify(np.float32(1.123456)), Float(1.123456, precision=24)) assert equal(sympify(np.float64(1.1234567891234)), Float(1.1234567891234, precision=53)) assert equal(sympify(np.longdouble(1.123456789)), Float(1.123456789, precision=80)) assert equal(sympify(np.complex64(1 + 2j)), S(1.0 + 2.0*I)) assert equal(sympify(np.complex128(1 + 2j)), S(1.0 + 2.0*I)) assert equal(sympify(np.longcomplex(1 + 2j)), S(1.0 + 2.0*I)) #float96 does not exist on all platforms if hasattr(np, 'float96'): assert equal(sympify(np.float96(1.123456789)), Float(1.123456789, precision=80)) #float128 does not exist on all platforms if hasattr(np, 'float128'): assert equal(sympify(np.float128(1.123456789123)), Float(1.123456789123, precision=80)) @XFAIL def test_sympify_rational_numbers_set(): ans = [Rational(3, 10), Rational(1, 5)] assert sympify({'.3', '.2'}, rational=True) == FiniteSet(*ans) def test_issue_13924(): if not numpy: skip("numpy not installed.") a = sympify(numpy.array([1])) assert isinstance(a, ImmutableDenseNDimArray) assert a[0] == 1 def test_numpy_sympify_args(): # Issue 15098. Make sure sympify args work with numpy types (like numpy.str_) if not numpy: skip("numpy not installed.") a = sympify(numpy.str_('a')) assert type(a) is Symbol assert a == Symbol('a') class CustomSymbol(Symbol): pass a = sympify(numpy.str_('a'), {"Symbol": CustomSymbol}) assert isinstance(a, CustomSymbol) a = sympify(numpy.str_('x^y')) assert a == x**y a = sympify(numpy.str_('x^y'), convert_xor=False) assert a == Xor(x, y) raises(SympifyError, lambda: sympify(numpy.str_('x'), strict=True)) a = sympify(numpy.str_('1.1')) assert isinstance(a, Float) assert a == 1.1 a = sympify(numpy.str_('1.1'), rational=True) assert isinstance(a, Rational) assert a == Rational(11, 10) a = sympify(numpy.str_('x + x')) assert isinstance(a, Mul) assert a == 2*x a = sympify(numpy.str_('x + x'), evaluate=False) assert isinstance(a, Add) assert a == Add(x, x, evaluate=False) def test_issue_5939(): a = Symbol('a') b = Symbol('b') assert sympify('''a+\nb''') == a + b def test_issue_16759(): d = sympify({.5: 1}) assert S.Half not in d assert Float(.5) in d assert d[.5] is S.One d = sympify(OrderedDict({.5: 1})) assert S.Half not in d assert Float(.5) in d assert d[.5] is S.One d = sympify(defaultdict(int, {.5: 1})) assert S.Half not in d assert Float(.5) in d assert d[.5] is S.One def test_issue_17811(): a = Function('a') assert sympify('a(x)*5', evaluate=False) == Mul(a(x), 5, evaluate=False)
4160a43ea464dc9d314b9a6911af2503a7db8c3bcf2f21ff2128aa2ae157f71e
from sympy import (Abs, Add, atan, ceiling, cos, E, Eq, exp, factor, factorial, fibonacci, floor, Function, GoldenRatio, I, Integral, integrate, log, Mul, N, oo, pi, Pow, product, Product, Rational, S, Sum, simplify, sin, sqrt, sstr, sympify, Symbol, Max, nfloat, cosh, acosh, acos) from sympy.core.numbers import comp from sympy.core.evalf import (complex_accuracy, PrecisionExhausted, scaled_zero, get_integer_part, as_mpmath, evalf) from mpmath import inf, ninf from mpmath.libmp.libmpf import from_float from sympy.core.expr import unchanged from sympy.testing.pytest import raises, XFAIL from sympy.abc import n, x, y def NS(e, n=15, **options): return sstr(sympify(e).evalf(n, **options), full_prec=True) def test_evalf_helpers(): assert complex_accuracy((from_float(2.0), None, 35, None)) == 35 assert complex_accuracy((from_float(2.0), from_float(10.0), 35, 100)) == 37 assert complex_accuracy( (from_float(2.0), from_float(1000.0), 35, 100)) == 43 assert complex_accuracy((from_float(2.0), from_float(10.0), 100, 35)) == 35 assert complex_accuracy( (from_float(2.0), from_float(1000.0), 100, 35)) == 35 def test_evalf_basic(): assert NS('pi', 15) == '3.14159265358979' assert NS('2/3', 10) == '0.6666666667' assert NS('355/113-pi', 6) == '2.66764e-7' assert NS('16*atan(1/5)-4*atan(1/239)', 15) == '3.14159265358979' def test_cancellation(): assert NS(Add(pi, Rational(1, 10**1000), -pi, evaluate=False), 15, maxn=1200) == '1.00000000000000e-1000' def test_evalf_powers(): assert NS('pi**(10**20)', 10) == '1.339148777e+49714987269413385435' assert NS(pi**(10**100), 10) == ('4.946362032e+4971498726941338543512682882' '9089887365167832438044244613405349992494711208' '95526746555473864642912223') assert NS('2**(1/10**50)', 15) == '1.00000000000000' assert NS('2**(1/10**50)-1', 15) == '6.93147180559945e-51' # Evaluation of Rump's ill-conditioned polynomial def test_evalf_rump(): a = 1335*y**6/4 + x**2*(11*x**2*y**2 - y**6 - 121*y**4 - 2) + 11*y**8/2 + x/(2*y) assert NS(a, 15, subs={x: 77617, y: 33096}) == '-0.827396059946821' def test_evalf_complex(): assert NS('2*sqrt(pi)*I', 10) == '3.544907702*I' assert NS('3+3*I', 15) == '3.00000000000000 + 3.00000000000000*I' assert NS('E+pi*I', 15) == '2.71828182845905 + 3.14159265358979*I' assert NS('pi * (3+4*I)', 15) == '9.42477796076938 + 12.5663706143592*I' assert NS('I*(2+I)', 15) == '-1.00000000000000 + 2.00000000000000*I' @XFAIL def test_evalf_complex_bug(): assert NS('(pi+E*I)*(E+pi*I)', 15) in ('0.e-15 + 17.25866050002*I', '0.e-17 + 17.25866050002*I', '-0.e-17 + 17.25866050002*I') def test_evalf_complex_powers(): assert NS('(E+pi*I)**100000000000000000') == \ '-3.58896782867793e+61850354284995199 + 4.58581754997159e+61850354284995199*I' # XXX: rewrite if a+a*I simplification introduced in sympy #assert NS('(pi + pi*I)**2') in ('0.e-15 + 19.7392088021787*I', '0.e-16 + 19.7392088021787*I') assert NS('(pi + pi*I)**2', chop=True) == '19.7392088021787*I' assert NS( '(pi + 1/10**8 + pi*I)**2') == '6.2831853e-8 + 19.7392088650106*I' assert NS('(pi + 1/10**12 + pi*I)**2') == '6.283e-12 + 19.7392088021850*I' assert NS('(pi + pi*I)**4', chop=True) == '-389.636364136010' assert NS( '(pi + 1/10**8 + pi*I)**4') == '-389.636366616512 + 2.4805021e-6*I' assert NS('(pi + 1/10**12 + pi*I)**4') == '-389.636364136258 + 2.481e-10*I' assert NS( '(10000*pi + 10000*pi*I)**4', chop=True) == '-3.89636364136010e+18' @XFAIL def test_evalf_complex_powers_bug(): assert NS('(pi + pi*I)**4') == '-389.63636413601 + 0.e-14*I' def test_evalf_exponentiation(): assert NS(sqrt(-pi)) == '1.77245385090552*I' assert NS(Pow(pi*I, Rational( 1, 2), evaluate=False)) == '1.25331413731550 + 1.25331413731550*I' assert NS(pi**I) == '0.413292116101594 + 0.910598499212615*I' assert NS(pi**(E + I/3)) == '20.8438653991931 + 8.36343473930031*I' assert NS((pi + I/3)**(E + I/3)) == '17.2442906093590 + 13.6839376767037*I' assert NS(exp(pi)) == '23.1406926327793' assert NS(exp(pi + E*I)) == '-21.0981542849657 + 9.50576358282422*I' assert NS(pi**pi) == '36.4621596072079' assert NS((-pi)**pi) == '-32.9138577418939 - 15.6897116534332*I' assert NS((-pi)**(-pi)) == '-0.0247567717232697 + 0.0118013091280262*I' # An example from Smith, "Multiple Precision Complex Arithmetic and Functions" def test_evalf_complex_cancellation(): A = Rational('63287/100000') B = Rational('52498/100000') C = Rational('69301/100000') D = Rational('83542/100000') F = Rational('2231321613/2500000000') # XXX: the number of returned mantissa digits in the real part could # change with the implementation. What matters is that the returned digits are # correct; those that are showing now are correct. # >>> ((A+B*I)*(C+D*I)).expand() # 64471/10000000000 + 2231321613*I/2500000000 # >>> 2231321613*4 # 8925286452L assert NS((A + B*I)*(C + D*I), 6) == '6.44710e-6 + 0.892529*I' assert NS((A + B*I)*(C + D*I), 10) == '6.447100000e-6 + 0.8925286452*I' assert NS((A + B*I)*( C + D*I) - F*I, 5) in ('6.4471e-6 + 0.e-14*I', '6.4471e-6 - 0.e-14*I') def test_evalf_logs(): assert NS("log(3+pi*I)", 15) == '1.46877619736226 + 0.808448792630022*I' assert NS("log(pi*I)", 15) == '1.14472988584940 + 1.57079632679490*I' assert NS('log(-1 + 0.00001)', 2) == '-1.0e-5 + 3.1*I' assert NS('log(100, 10, evaluate=False)', 15) == '2.00000000000000' assert NS('-2*I*log(-(-1)**(S(1)/9))', 15) == '-5.58505360638185' def test_evalf_trig(): assert NS('sin(1)', 15) == '0.841470984807897' assert NS('cos(1)', 15) == '0.540302305868140' assert NS('sin(10**-6)', 15) == '9.99999999999833e-7' assert NS('cos(10**-6)', 15) == '0.999999999999500' assert NS('sin(E*10**100)', 15) == '0.409160531722613' # Some input near roots assert NS(sin(exp(pi*sqrt(163))*pi), 15) == '-2.35596641936785e-12' assert NS(sin(pi*10**100 + Rational(7, 10**5), evaluate=False), 15, maxn=120) == \ '6.99999999428333e-5' assert NS(sin(Rational(7, 10**5), evaluate=False), 15) == \ '6.99999999428333e-5' # Check detection of various false identities def test_evalf_near_integers(): # Binet's formula f = lambda n: ((1 + sqrt(5))**n)/(2**n * sqrt(5)) assert NS(f(5000) - fibonacci(5000), 10, maxn=1500) == '5.156009964e-1046' # Some near-integer identities from # http://mathworld.wolfram.com/AlmostInteger.html assert NS('sin(2017*2**(1/5))', 15) == '-1.00000000000000' assert NS('sin(2017*2**(1/5))', 20) == '-0.99999999999999997857' assert NS('1+sin(2017*2**(1/5))', 15) == '2.14322287389390e-17' assert NS('45 - 613*E/37 + 35/991', 15) == '6.03764498766326e-11' def test_evalf_ramanujan(): assert NS(exp(pi*sqrt(163)) - 640320**3 - 744, 10) == '-7.499274028e-13' # A related identity A = 262537412640768744*exp(-pi*sqrt(163)) B = 196884*exp(-2*pi*sqrt(163)) C = 103378831900730205293632*exp(-3*pi*sqrt(163)) assert NS(1 - A - B + C, 10) == '1.613679005e-59' # Input that for various reasons have failed at some point def test_evalf_bugs(): assert NS(sin(1) + exp(-10**10), 10) == NS(sin(1), 10) assert NS(exp(10**10) + sin(1), 10) == NS(exp(10**10), 10) assert NS('expand_log(log(1+1/10**50))', 20) == '1.0000000000000000000e-50' assert NS('log(10**100,10)', 10) == '100.0000000' assert NS('log(2)', 10) == '0.6931471806' assert NS( '(sin(x)-x)/x**3', 15, subs={x: '1/10**50'}) == '-0.166666666666667' assert NS(sin(1) + Rational( 1, 10**100)*I, 15) == '0.841470984807897 + 1.00000000000000e-100*I' assert x.evalf() == x assert NS((1 + I)**2*I, 6) == '-2.00000' d = {n: ( -1)**Rational(6, 7), y: (-1)**Rational(4, 7), x: (-1)**Rational(2, 7)} assert NS((x*(1 + y*(1 + n))).subs(d).evalf(), 6) == '0.346011 + 0.433884*I' assert NS(((-I - sqrt(2)*I)**2).evalf()) == '-5.82842712474619' assert NS((1 + I)**2*I, 15) == '-2.00000000000000' # issue 4758 (1/2): assert NS(pi.evalf(69) - pi) == '-4.43863937855894e-71' # issue 4758 (2/2): With the bug present, this still only fails if the # terms are in the order given here. This is not generally the case, # because the order depends on the hashes of the terms. assert NS(20 - 5008329267844*n**25 - 477638700*n**37 - 19*n, subs={n: .01}) == '19.8100000000000' assert NS(((x - 1)*((1 - x))**1000).n() ) == '(1.00000000000000 - x)**1000*(x - 1.00000000000000)' assert NS((-x).n()) == '-x' assert NS((-2*x).n()) == '-2.00000000000000*x' assert NS((-2*x*y).n()) == '-2.00000000000000*x*y' assert cos(x).n(subs={x: 1+I}) == cos(x).subs(x, 1+I).n() # issue 6660. Also NaN != mpmath.nan # In this order: # 0*nan, 0/nan, 0*inf, 0/inf # 0+nan, 0-nan, 0+inf, 0-inf # >>> n = Some Number # n*nan, n/nan, n*inf, n/inf # n+nan, n-nan, n+inf, n-inf assert (0*E**(oo)).n() is S.NaN assert (0/E**(oo)).n() is S.Zero assert (0+E**(oo)).n() is S.Infinity assert (0-E**(oo)).n() is S.NegativeInfinity assert (5*E**(oo)).n() is S.Infinity assert (5/E**(oo)).n() is S.Zero assert (5+E**(oo)).n() is S.Infinity assert (5-E**(oo)).n() is S.NegativeInfinity #issue 7416 assert as_mpmath(0.0, 10, {'chop': True}) == 0 #issue 5412 assert ((oo*I).n() == S.Infinity*I) assert ((oo+oo*I).n() == S.Infinity + S.Infinity*I) #issue 11518 assert NS(2*x**2.5, 5) == '2.0000*x**2.5000' #issue 13076 assert NS(Mul(Max(0, y), x, evaluate=False).evalf()) == 'x*Max(0, y)' def test_evalf_integer_parts(): a = floor(log(8)/log(2) - exp(-1000), evaluate=False) b = floor(log(8)/log(2), evaluate=False) assert a.evalf() == 3 assert b.evalf() == 3 # equals, as a fallback, can still fail but it might succeed as here assert ceiling(10*(sin(1)**2 + cos(1)**2)) == 10 assert int(floor(factorial(50)/E, evaluate=False).evalf(70)) == \ int(11188719610782480504630258070757734324011354208865721592720336800) assert int(ceiling(factorial(50)/E, evaluate=False).evalf(70)) == \ int(11188719610782480504630258070757734324011354208865721592720336801) assert int(floor((GoldenRatio**999 / sqrt(5) + S.Half)) .evalf(1000)) == fibonacci(999) assert int(floor((GoldenRatio**1000 / sqrt(5) + S.Half)) .evalf(1000)) == fibonacci(1000) assert ceiling(x).evalf(subs={x: 3}) == 3 assert ceiling(x).evalf(subs={x: 3*I}) == 3.0*I assert ceiling(x).evalf(subs={x: 2 + 3*I}) == 2.0 + 3.0*I assert ceiling(x).evalf(subs={x: 3.}) == 3 assert ceiling(x).evalf(subs={x: 3.*I}) == 3.0*I assert ceiling(x).evalf(subs={x: 2. + 3*I}) == 2.0 + 3.0*I assert float((floor(1.5, evaluate=False)+1/9).evalf()) == 1 + 1/9 assert float((floor(0.5, evaluate=False)+20).evalf()) == 20 def test_evalf_trig_zero_detection(): a = sin(160*pi, evaluate=False) t = a.evalf(maxn=100) assert abs(t) < 1e-100 assert t._prec < 2 assert a.evalf(chop=True) == 0 raises(PrecisionExhausted, lambda: a.evalf(strict=True)) def test_evalf_sum(): assert Sum(n,(n,1,2)).evalf() == 3. assert Sum(n,(n,1,2)).doit().evalf() == 3. # the next test should return instantly assert Sum(1/n,(n,1,2)).evalf() == 1.5 # issue 8219 assert Sum(E/factorial(n), (n, 0, oo)).evalf() == (E*E).evalf() # issue 8254 assert Sum(2**n*n/factorial(n), (n, 0, oo)).evalf() == (2*E*E).evalf() # issue 8411 s = Sum(1/x**2, (x, 100, oo)) assert s.n() == s.doit().n() def test_evalf_divergent_series(): raises(ValueError, lambda: Sum(1/n, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum(n/(n**2 + 1), (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum((-1)**n, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum((-1)**n, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum(n**2, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum(2**n, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum((-2)**n, (n, 1, oo)).evalf()) raises(ValueError, lambda: Sum((2*n + 3)/(3*n**2 + 4), (n, 0, oo)).evalf()) raises(ValueError, lambda: Sum((0.5*n**3)/(n**4 + 1), (n, 0, oo)).evalf()) def test_evalf_product(): assert Product(n, (n, 1, 10)).evalf() == 3628800. assert comp(Product(1 - S.Half**2/n**2, (n, 1, oo)).n(5), 0.63662) assert Product(n, (n, -1, 3)).evalf() == 0 def test_evalf_py_methods(): assert abs(float(pi + 1) - 4.1415926535897932) < 1e-10 assert abs(complex(pi + 1) - 4.1415926535897932) < 1e-10 assert abs( complex(pi + E*I) - (3.1415926535897931 + 2.7182818284590451j)) < 1e-10 raises(TypeError, lambda: float(pi + x)) def test_evalf_power_subs_bugs(): assert (x**2).evalf(subs={x: 0}) == 0 assert sqrt(x).evalf(subs={x: 0}) == 0 assert (x**Rational(2, 3)).evalf(subs={x: 0}) == 0 assert (x**x).evalf(subs={x: 0}) == 1 assert (3**x).evalf(subs={x: 0}) == 1 assert exp(x).evalf(subs={x: 0}) == 1 assert ((2 + I)**x).evalf(subs={x: 0}) == 1 assert (0**x).evalf(subs={x: 0}) == 1 def test_evalf_arguments(): raises(TypeError, lambda: pi.evalf(method="garbage")) def test_implemented_function_evalf(): from sympy.utilities.lambdify import implemented_function f = Function('f') f = implemented_function(f, lambda x: x + 1) assert str(f(x)) == "f(x)" assert str(f(2)) == "f(2)" assert f(2).evalf() == 3 assert f(x).evalf() == f(x) f = implemented_function(Function('sin'), lambda x: x + 1) assert f(2).evalf() != sin(2) del f._imp_ # XXX: due to caching _imp_ would influence all other tests def test_evaluate_false(): for no in [0, False]: assert Add(3, 2, evaluate=no).is_Add assert Mul(3, 2, evaluate=no).is_Mul assert Pow(3, 2, evaluate=no).is_Pow assert Pow(y, 2, evaluate=True) - Pow(y, 2, evaluate=True) == 0 def test_evalf_relational(): assert Eq(x/5, y/10).evalf() == Eq(0.2*x, 0.1*y) # if this first assertion fails it should be replaced with # one that doesn't assert unchanged(Eq, (3 - I)**2/2 + I, 0) assert Eq((3 - I)**2/2 + I, 0).n() is S.false assert nfloat(Eq((3 - I)**2 + I, 0)) == S.false def test_issue_5486(): assert not cos(sqrt(0.5 + I)).n().is_Function def test_issue_5486_bug(): from sympy import I, Expr assert abs(Expr._from_mpmath(I._to_mpmath(15), 15) - I) < 1.0e-15 def test_bugs(): from sympy import polar_lift, re assert abs(re((1 + I)**2)) < 1e-15 # anything that evalf's to 0 will do in place of polar_lift assert abs(polar_lift(0)).n() == 0 def test_subs(): assert NS('besseli(-x, y) - besseli(x, y)', subs={x: 3.5, y: 20.0}) == \ '-4.92535585957223e-10' assert NS('Piecewise((x, x>0)) + Piecewise((1-x, x>0))', subs={x: 0.1}) == \ '1.00000000000000' raises(TypeError, lambda: x.evalf(subs=(x, 1))) def test_issue_4956_5204(): # issue 4956 v = S('''(-27*12**(1/3)*sqrt(31)*I + 27*2**(2/3)*3**(1/3)*sqrt(31)*I)/(-2511*2**(2/3)*3**(1/3) + (29*18**(1/3) + 9*2**(1/3)*3**(2/3)*sqrt(31)*I + 87*2**(1/3)*3**(1/6)*I)**2)''') assert NS(v, 1) == '0.e-118 - 0.e-118*I' # issue 5204 v = S('''-(357587765856 + 18873261792*249**(1/2) + 56619785376*I*83**(1/2) + 108755765856*I*3**(1/2) + 41281887168*6**(1/3)*(1422 + 54*249**(1/2))**(1/3) - 1239810624*6**(1/3)*249**(1/2)*(1422 + 54*249**(1/2))**(1/3) - 3110400000*I*6**(1/3)*83**(1/2)*(1422 + 54*249**(1/2))**(1/3) + 13478400000*I*3**(1/2)*6**(1/3)*(1422 + 54*249**(1/2))**(1/3) + 1274950152*6**(2/3)*(1422 + 54*249**(1/2))**(2/3) + 32347944*6**(2/3)*249**(1/2)*(1422 + 54*249**(1/2))**(2/3) - 1758790152*I*3**(1/2)*6**(2/3)*(1422 + 54*249**(1/2))**(2/3) - 304403832*I*6**(2/3)*83**(1/2)*(1422 + 4*249**(1/2))**(2/3))/(175732658352 + (1106028 + 25596*249**(1/2) + 76788*I*83**(1/2))**2)''') assert NS(v, 5) == '0.077284 + 1.1104*I' assert NS(v, 1) == '0.08 + 1.*I' def test_old_docstring(): a = (E + pi*I)*(E - pi*I) assert NS(a) == '17.2586605000200' assert a.n() == 17.25866050002001 def test_issue_4806(): assert integrate(atan(x)**2, (x, -1, 1)).evalf().round(1) == 0.5 assert atan(0, evaluate=False).n() == 0 def test_evalf_mul(): # sympy should not try to expand this; it should be handled term-wise # in evalf through mpmath assert NS(product(1 + sqrt(n)*I, (n, 1, 500)), 1) == '5.e+567 + 2.e+568*I' def test_scaled_zero(): a, b = (([0], 1, 100, 1), -1) assert scaled_zero(100) == (a, b) assert scaled_zero(a) == (0, 1, 100, 1) a, b = (([1], 1, 100, 1), -1) assert scaled_zero(100, -1) == (a, b) assert scaled_zero(a) == (1, 1, 100, 1) raises(ValueError, lambda: scaled_zero(scaled_zero(100))) raises(ValueError, lambda: scaled_zero(100, 2)) raises(ValueError, lambda: scaled_zero(100, 0)) raises(ValueError, lambda: scaled_zero((1, 5, 1, 3))) def test_chop_value(): for i in range(-27, 28): assert (Pow(10, i)*2).n(chop=10**i) and not (Pow(10, i)).n(chop=10**i) def test_infinities(): assert oo.evalf(chop=True) == inf assert (-oo).evalf(chop=True) == ninf def test_to_mpmath(): assert sqrt(3)._to_mpmath(20)._mpf_ == (0, int(908093), -19, 20) assert S(3.2)._to_mpmath(20)._mpf_ == (0, int(838861), -18, 20) def test_issue_6632_evalf(): add = (-100000*sqrt(2500000001) + 5000000001) assert add.n() == 9.999999998e-11 assert (add*add).n() == 9.999999996e-21 def test_issue_4945(): from sympy.abc import H from sympy import zoo assert (H/0).evalf(subs={H:1}) == zoo*H def test_evalf_integral(): # test that workprec has to increase in order to get a result other than 0 eps = Rational(1, 1000000) assert Integral(sin(x), (x, -pi, pi + eps)).n(2)._prec == 10 def test_issue_8821_highprec_from_str(): s = str(pi.evalf(128)) p = N(s) assert Abs(sin(p)) < 1e-15 p = N(s, 64) assert Abs(sin(p)) < 1e-64 def test_issue_8853(): p = Symbol('x', even=True, positive=True) assert floor(-p - S.Half).is_even == False assert floor(-p + S.Half).is_even == True assert ceiling(p - S.Half).is_even == True assert ceiling(p + S.Half).is_even == False assert get_integer_part(S.Half, -1, {}, True) == (0, 0) assert get_integer_part(S.Half, 1, {}, True) == (1, 0) assert get_integer_part(Rational(-1, 2), -1, {}, True) == (-1, 0) assert get_integer_part(Rational(-1, 2), 1, {}, True) == (0, 0) def test_issue_17681(): class identity_func(Function): def _eval_evalf(self, *args, **kwargs): return self.args[0].evalf(*args, **kwargs) assert floor(identity_func(S(0))) == 0 assert get_integer_part(S(0), 1, {}, True) == (0, 0) def test_issue_9326(): from sympy import Dummy d1 = Dummy('d') d2 = Dummy('d') e = d1 + d2 assert e.evalf(subs = {d1: 1, d2: 2}) == 3 def test_issue_10323(): assert ceiling(sqrt(2**30 + 1)) == 2**15 + 1 def test_AssocOp_Function(): # the first arg of Min is not comparable in the imaginary part raises(ValueError, lambda: S(''' Min(-sqrt(3)*cos(pi/18)/6 + re(1/((-1/2 - sqrt(3)*I/2)*(1/6 + sqrt(3)*I/18)**(1/3)))/3 + sin(pi/18)/2 + 2 + I*(-cos(pi/18)/2 - sqrt(3)*sin(pi/18)/6 + im(1/((-1/2 - sqrt(3)*I/2)*(1/6 + sqrt(3)*I/18)**(1/3)))/3), re(1/((-1/2 + sqrt(3)*I/2)*(1/6 + sqrt(3)*I/18)**(1/3)))/3 - sqrt(3)*cos(pi/18)/6 - sin(pi/18)/2 + 2 + I*(im(1/((-1/2 + sqrt(3)*I/2)*(1/6 + sqrt(3)*I/18)**(1/3)))/3 - sqrt(3)*sin(pi/18)/6 + cos(pi/18)/2))''')) # if that is changed so a non-comparable number remains as # an arg, then the Min/Max instantiation needs to be changed # to watch out for non-comparable args when making simplifications # and the following test should be added instead (with e being # the sympified expression above): # raises(ValueError, lambda: e._eval_evalf(2)) def test_issue_10395(): eq = x*Max(0, y) assert nfloat(eq) == eq eq = x*Max(y, -1.1) assert nfloat(eq) == eq assert Max(y, 4).n() == Max(4.0, y) def test_issue_13098(): assert floor(log(S('9.'+'9'*20), 10)) == 0 assert ceiling(log(S('9.'+'9'*20), 10)) == 1 assert floor(log(20 - S('9.'+'9'*20), 10)) == 1 assert ceiling(log(20 - S('9.'+'9'*20), 10)) == 2 def test_issue_14601(): e = 5*x*y/2 - y*(35*(x**3)/2 - 15*x/2) subst = {x:0.0, y:0.0} e2 = e.evalf(subs=subst) assert float(e2) == 0.0 assert float((x + x*(x**2 + x)).evalf(subs={x: 0.0})) == 0.0 def test_issue_11151(): z = S.Zero e = Sum(z, (x, 1, 2)) assert e != z # it shouldn't evaluate # when it does evaluate, this is what it should give assert evalf(e, 15, {}) == \ evalf(z, 15, {}) == (None, None, 15, None) # so this shouldn't fail assert (e/2).n() == 0 # this was where the issue appeared expr0 = Sum(x**2 + x, (x, 1, 2)) expr1 = Sum(0, (x, 1, 2)) expr2 = expr1/expr0 assert simplify(factor(expr2) - expr2) == 0 def test_issue_13425(): assert N('2**.5', 30) == N('sqrt(2)', 30) assert N('x - x', 30) == 0 assert abs((N('pi*.1', 22)*10 - pi).n()) < 1e-22 def test_issue_17421(): assert N(acos(-I + acosh(cosh(cosh(1) + I)))) == 1.0*I
2be4f7a9f72da474d44d9b7a4515208738f5f3595ea82c41992856373d5018ba
from sympy import (abc, Add, cos, collect, Derivative, diff, exp, Float, Function, I, Integer, log, Mul, oo, Poly, Rational, S, sin, sqrt, Symbol, symbols, Wild, pi, meijerg ) from sympy.testing.pytest import XFAIL def test_symbol(): x = Symbol('x') a, b, c, p, q = map(Wild, 'abcpq') e = x assert e.match(x) == {} assert e.matches(x) == {} assert e.match(a) == {a: x} e = Rational(5) assert e.match(c) == {c: 5} assert e.match(e) == {} assert e.match(e + 1) is None def test_add(): x, y, a, b, c = map(Symbol, 'xyabc') p, q, r = map(Wild, 'pqr') e = a + b assert e.match(p + b) == {p: a} assert e.match(p + a) == {p: b} e = 1 + b assert e.match(p + b) == {p: 1} e = a + b + c assert e.match(a + p + c) == {p: b} assert e.match(b + p + c) == {p: a} e = a + b + c + x assert e.match(a + p + x + c) == {p: b} assert e.match(b + p + c + x) == {p: a} assert e.match(b) is None assert e.match(b + p) == {p: a + c + x} assert e.match(a + p + c) == {p: b + x} assert e.match(b + p + c) == {p: a + x} e = 4*x + 5 assert e.match(4*x + p) == {p: 5} assert e.match(3*x + p) == {p: x + 5} assert e.match(p*x + 5) == {p: 4} def test_power(): x, y, a, b, c = map(Symbol, 'xyabc') p, q, r = map(Wild, 'pqr') e = (x + y)**a assert e.match(p**q) == {p: x + y, q: a} assert e.match(p**p) is None e = (x + y)**(x + y) assert e.match(p**p) == {p: x + y} assert e.match(p**q) == {p: x + y, q: x + y} e = (2*x)**2 assert e.match(p*q**r) == {p: 4, q: x, r: 2} e = Integer(1) assert e.match(x**p) == {p: 0} def test_match_exclude(): x = Symbol('x') y = Symbol('y') p = Wild("p") q = Wild("q") r = Wild("r") e = Rational(6) assert e.match(2*p) == {p: 3} e = 3/(4*x + 5) assert e.match(3/(p*x + q)) == {p: 4, q: 5} e = 3/(4*x + 5) assert e.match(p/(q*x + r)) == {p: 3, q: 4, r: 5} e = 2/(x + 1) assert e.match(p/(q*x + r)) == {p: 2, q: 1, r: 1} e = 1/(x + 1) assert e.match(p/(q*x + r)) == {p: 1, q: 1, r: 1} e = 4*x + 5 assert e.match(p*x + q) == {p: 4, q: 5} e = 4*x + 5*y + 6 assert e.match(p*x + q*y + r) == {p: 4, q: 5, r: 6} a = Wild('a', exclude=[x]) e = 3*x assert e.match(p*x) == {p: 3} assert e.match(a*x) == {a: 3} e = 3*x**2 assert e.match(p*x) == {p: 3*x} assert e.match(a*x) is None e = 3*x + 3 + 6/x assert e.match(p*x**2 + p*x + 2*p) == {p: 3/x} assert e.match(a*x**2 + a*x + 2*a) is None def test_mul(): x, y, a, b, c = map(Symbol, 'xyabc') p, q = map(Wild, 'pq') e = 4*x assert e.match(p*x) == {p: 4} assert e.match(p*y) is None assert e.match(e + p*y) == {p: 0} e = a*x*b*c assert e.match(p*x) == {p: a*b*c} assert e.match(c*p*x) == {p: a*b} e = (a + b)*(a + c) assert e.match((p + b)*(p + c)) == {p: a} e = x assert e.match(p*x) == {p: 1} e = exp(x) assert e.match(x**p*exp(x*q)) == {p: 0, q: 1} e = I*Poly(x, x) assert e.match(I*p) == {p: x} def test_mul_noncommutative(): x, y = symbols('x y') A, B, C = symbols('A B C', commutative=False) u, v = symbols('u v', cls=Wild) w, z = symbols('w z', cls=Wild, commutative=False) assert (u*v).matches(x) in ({v: x, u: 1}, {u: x, v: 1}) assert (u*v).matches(x*y) in ({v: y, u: x}, {u: y, v: x}) assert (u*v).matches(A) is None assert (u*v).matches(A*B) is None assert (u*v).matches(x*A) is None assert (u*v).matches(x*y*A) is None assert (u*v).matches(x*A*B) is None assert (u*v).matches(x*y*A*B) is None assert (v*w).matches(x) is None assert (v*w).matches(x*y) is None assert (v*w).matches(A) == {w: A, v: 1} assert (v*w).matches(A*B) == {w: A*B, v: 1} assert (v*w).matches(x*A) == {w: A, v: x} assert (v*w).matches(x*y*A) == {w: A, v: x*y} assert (v*w).matches(x*A*B) == {w: A*B, v: x} assert (v*w).matches(x*y*A*B) == {w: A*B, v: x*y} assert (v*w).matches(-x) is None assert (v*w).matches(-x*y) is None assert (v*w).matches(-A) == {w: A, v: -1} assert (v*w).matches(-A*B) == {w: A*B, v: -1} assert (v*w).matches(-x*A) == {w: A, v: -x} assert (v*w).matches(-x*y*A) == {w: A, v: -x*y} assert (v*w).matches(-x*A*B) == {w: A*B, v: -x} assert (v*w).matches(-x*y*A*B) == {w: A*B, v: -x*y} assert (w*z).matches(x) is None assert (w*z).matches(x*y) is None assert (w*z).matches(A) is None assert (w*z).matches(A*B) == {w: A, z: B} assert (w*z).matches(B*A) == {w: B, z: A} assert (w*z).matches(A*B*C) in [{w: A, z: B*C}, {w: A*B, z: C}] assert (w*z).matches(x*A) is None assert (w*z).matches(x*y*A) is None assert (w*z).matches(x*A*B) is None assert (w*z).matches(x*y*A*B) is None assert (w*A).matches(A) is None assert (A*w*B).matches(A*B) is None assert (u*w*z).matches(x) is None assert (u*w*z).matches(x*y) is None assert (u*w*z).matches(A) is None assert (u*w*z).matches(A*B) == {u: 1, w: A, z: B} assert (u*w*z).matches(B*A) == {u: 1, w: B, z: A} assert (u*w*z).matches(x*A) is None assert (u*w*z).matches(x*y*A) is None assert (u*w*z).matches(x*A*B) == {u: x, w: A, z: B} assert (u*w*z).matches(x*B*A) == {u: x, w: B, z: A} assert (u*w*z).matches(x*y*A*B) == {u: x*y, w: A, z: B} assert (u*w*z).matches(x*y*B*A) == {u: x*y, w: B, z: A} assert (u*A).matches(x*A) == {u: x} assert (u*A).matches(x*A*B) is None assert (u*B).matches(x*A) is None assert (u*A*B).matches(x*A*B) == {u: x} assert (u*A*B).matches(x*B*A) is None assert (u*A*B).matches(x*A) is None assert (u*w*A).matches(x*A*B) is None assert (u*w*B).matches(x*A*B) == {u: x, w: A} assert (u*v*A*B).matches(x*A*B) in [{u: x, v: 1}, {v: x, u: 1}] assert (u*v*A*B).matches(x*B*A) is None assert (u*v*A*B).matches(u*v*A*C) is None def test_mul_noncommutative_mismatch(): A, B, C = symbols('A B C', commutative=False) w = symbols('w', cls=Wild, commutative=False) assert (w*B*w).matches(A*B*A) == {w: A} assert (w*B*w).matches(A*C*B*A*C) == {w: A*C} assert (w*B*w).matches(A*C*B*A*B) is None assert (w*B*w).matches(A*B*C) is None assert (w*w*C).matches(A*B*C) is None def test_mul_noncommutative_pow(): A, B, C = symbols('A B C', commutative=False) w = symbols('w', cls=Wild, commutative=False) assert (A*B*w).matches(A*B**2) == {w: B} assert (A*(B**2)*w*(B**3)).matches(A*B**8) == {w: B**3} assert (A*B*w*C).matches(A*(B**4)*C) == {w: B**3} assert (A*B*(w**(-1))).matches(A*B*(C**(-1))) == {w: C} assert (A*(B*w)**(-1)*C).matches(A*(B*C)**(-1)*C) == {w: C} assert ((w**2)*B*C).matches((A**2)*B*C) == {w: A} assert ((w**2)*B*(w**3)).matches((A**2)*B*(A**3)) == {w: A} assert ((w**2)*B*(w**4)).matches((A**2)*B*(A**2)) is None def test_complex(): a, b, c = map(Symbol, 'abc') x, y = map(Wild, 'xy') assert (1 + I).match(x + I) == {x: 1} assert (a + I).match(x + I) == {x: a} assert (2*I).match(x*I) == {x: 2} assert (a*I).match(x*I) == {x: a} assert (a*I).match(x*y) == {x: I, y: a} assert (2*I).match(x*y) == {x: 2, y: I} assert (a + b*I).match(x + y*I) == {x: a, y: b} def test_functions(): from sympy.core.function import WildFunction x = Symbol('x') g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5*x) notf = x assert f.match(p*cos(q*x)) == {p: 1, q: 5} assert f.match(p*g) == {p: 1, g: cos(5*x)} assert notf.match(g) is None @XFAIL def test_functions_X1(): from sympy.core.function import WildFunction x = Symbol('x') g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5*x) assert f.match(p*g(q*x)) == {p: 1, g: cos, q: 5} def test_interface(): x, y = map(Symbol, 'xy') p, q = map(Wild, 'pq') assert (x + 1).match(p + 1) == {p: x} assert (x*3).match(p*3) == {p: x} assert (x**3).match(p**3) == {p: x} assert (x*cos(y)).match(p*cos(q)) == {p: x, q: y} assert (x*y).match(p*q) in [{p:x, q:y}, {p:y, q:x}] assert (x + y).match(p + q) in [{p:x, q:y}, {p:y, q:x}] assert (x*y + 1).match(p*q) in [{p:1, q:1 + x*y}, {p:1 + x*y, q:1}] def test_derivative1(): x, y = map(Symbol, 'xy') p, q = map(Wild, 'pq') f = Function('f', nargs=1) fd = Derivative(f(x), x) assert fd.match(p) == {p: fd} assert (fd + 1).match(p + 1) == {p: fd} assert (fd).match(fd) == {} assert (3*fd).match(p*fd) is not None assert (3*fd - 1).match(p*fd + q) == {p: 3, q: -1} def test_derivative_bug1(): f = Function("f") x = Symbol("x") a = Wild("a", exclude=[f, x]) b = Wild("b", exclude=[f]) pattern = a * Derivative(f(x), x, x) + b expr = Derivative(f(x), x) + x**2 d1 = {b: x**2} d2 = pattern.xreplace(d1).matches(expr, d1) assert d2 is None def test_derivative2(): f = Function("f") x = Symbol("x") a = Wild("a", exclude=[f, x]) b = Wild("b", exclude=[f]) e = Derivative(f(x), x) assert e.match(Derivative(f(x), x)) == {} assert e.match(Derivative(f(x), x, x)) is None e = Derivative(f(x), x, x) assert e.match(Derivative(f(x), x)) is None assert e.match(Derivative(f(x), x, x)) == {} e = Derivative(f(x), x) + x**2 assert e.match(a*Derivative(f(x), x) + b) == {a: 1, b: x**2} assert e.match(a*Derivative(f(x), x, x) + b) is None e = Derivative(f(x), x, x) + x**2 assert e.match(a*Derivative(f(x), x) + b) is None assert e.match(a*Derivative(f(x), x, x) + b) == {a: 1, b: x**2} def test_match_deriv_bug1(): n = Function('n') l = Function('l') x = Symbol('x') p = Wild('p') e = diff(l(x), x)/x - diff(diff(n(x), x), x)/2 - \ diff(n(x), x)**2/4 + diff(n(x), x)*diff(l(x), x)/4 e = e.subs(n(x), -l(x)).doit() t = x*exp(-l(x)) t2 = t.diff(x, x)/t assert e.match( (p*t2).expand() ) == {p: Rational(-1, 2)} def test_match_bug2(): x, y = map(Symbol, 'xy') p, q, r = map(Wild, 'pqr') res = (x + y).match(p + q + r) assert (p + q + r).subs(res) == x + y def test_match_bug3(): x, a, b = map(Symbol, 'xab') p = Wild('p') assert (b*x*exp(a*x)).match(x*exp(p*x)) is None def test_match_bug4(): x = Symbol('x') p = Wild('p') e = x assert e.match(-p*x) == {p: -1} def test_match_bug5(): x = Symbol('x') p = Wild('p') e = -x assert e.match(-p*x) == {p: 1} def test_match_bug6(): x = Symbol('x') p = Wild('p') e = x assert e.match(3*p*x) == {p: Rational(1)/3} def test_match_polynomial(): x = Symbol('x') a = Wild('a', exclude=[x]) b = Wild('b', exclude=[x]) c = Wild('c', exclude=[x]) d = Wild('d', exclude=[x]) eq = 4*x**3 + 3*x**2 + 2*x + 1 pattern = a*x**3 + b*x**2 + c*x + d assert eq.match(pattern) == {a: 4, b: 3, c: 2, d: 1} assert (eq - 3*x**2).match(pattern) == {a: 4, b: 0, c: 2, d: 1} assert (x + sqrt(2) + 3).match(a + b*x + c*x**2) == \ {b: 1, a: sqrt(2) + 3, c: 0} def test_exclude(): x, y, a = map(Symbol, 'xya') p = Wild('p', exclude=[1, x]) q = Wild('q') r = Wild('r', exclude=[sin, y]) assert sin(x).match(r) is None assert cos(y).match(r) is None e = 3*x**2 + y*x + a assert e.match(p*x**2 + q*x + r) == {p: 3, q: y, r: a} e = x + 1 assert e.match(x + p) is None assert e.match(p + 1) is None assert e.match(x + 1 + p) == {p: 0} e = cos(x) + 5*sin(y) assert e.match(r) is None assert e.match(cos(y) + r) is None assert e.match(r + p*sin(q)) == {r: cos(x), p: 5, q: y} def test_floats(): a, b = map(Wild, 'ab') e = cos(0.12345, evaluate=False)**2 r = e.match(a*cos(b)**2) assert r == {a: 1, b: Float(0.12345)} def test_Derivative_bug1(): f = Function("f") x = abc.x a = Wild("a", exclude=[f(x)]) b = Wild("b", exclude=[f(x)]) eq = f(x).diff(x) assert eq.match(a*Derivative(f(x), x) + b) == {a: 1, b: 0} def test_match_wild_wild(): p = Wild('p') q = Wild('q') r = Wild('r') assert p.match(q + r) in [ {q: p, r: 0}, {q: 0, r: p} ] assert p.match(q*r) in [ {q: p, r: 1}, {q: 1, r: p} ] p = Wild('p') q = Wild('q', exclude=[p]) r = Wild('r') assert p.match(q + r) == {q: 0, r: p} assert p.match(q*r) == {q: 1, r: p} p = Wild('p') q = Wild('q', exclude=[p]) r = Wild('r', exclude=[p]) assert p.match(q + r) is None assert p.match(q*r) is None def test__combine_inverse(): x, y = symbols("x y") assert Mul._combine_inverse(x*I*y, x*I) == y assert Mul._combine_inverse(x*x**(1 + y), x**(1 + y)) == x assert Mul._combine_inverse(x*I*y, y*I) == x assert Mul._combine_inverse(oo*I*y, y*I) is oo assert Mul._combine_inverse(oo*I*y, oo*I) == y assert Mul._combine_inverse(oo*I*y, oo*I) == y assert Mul._combine_inverse(oo*y, -oo) == -y assert Mul._combine_inverse(-oo*y, oo) == -y assert Add._combine_inverse(oo, oo) is S.Zero assert Add._combine_inverse(oo*I, oo*I) is S.Zero assert Add._combine_inverse(x*oo, x*oo) is S.Zero assert Add._combine_inverse(-x*oo, -x*oo) is S.Zero assert Add._combine_inverse((x - oo)*(x + oo), -oo) def test_issue_3773(): x = symbols('x') z, phi, r = symbols('z phi r') c, A, B, N = symbols('c A B N', cls=Wild) l = Wild('l', exclude=(0,)) eq = z * sin(2*phi) * r**7 matcher = c * sin(phi*N)**l * r**A * log(r)**B assert eq.match(matcher) == {c: z, l: 1, N: 2, A: 7, B: 0} assert (-eq).match(matcher) == {c: -z, l: 1, N: 2, A: 7, B: 0} assert (x*eq).match(matcher) == {c: x*z, l: 1, N: 2, A: 7, B: 0} assert (-7*x*eq).match(matcher) == {c: -7*x*z, l: 1, N: 2, A: 7, B: 0} matcher = c*sin(phi*N)**l * r**A assert eq.match(matcher) == {c: z, l: 1, N: 2, A: 7} assert (-eq).match(matcher) == {c: -z, l: 1, N: 2, A: 7} assert (x*eq).match(matcher) == {c: x*z, l: 1, N: 2, A: 7} assert (-7*x*eq).match(matcher) == {c: -7*x*z, l: 1, N: 2, A: 7} def test_issue_3883(): from sympy.abc import gamma, mu, x f = (-gamma * (x - mu)**2 - log(gamma) + log(2*pi))/2 a, b, c = symbols('a b c', cls=Wild, exclude=(gamma,)) assert f.match(a * log(gamma) + b * gamma + c) == \ {a: Rational(-1, 2), b: -(x - mu)**2/2, c: log(2*pi)/2} assert f.expand().collect(gamma).match(a * log(gamma) + b * gamma + c) == \ {a: Rational(-1, 2), b: (-(x - mu)**2/2).expand(), c: (log(2*pi)/2).expand()} g1 = Wild('g1', exclude=[gamma]) g2 = Wild('g2', exclude=[gamma]) g3 = Wild('g3', exclude=[gamma]) assert f.expand().match(g1 * log(gamma) + g2 * gamma + g3) == \ {g3: log(2)/2 + log(pi)/2, g1: Rational(-1, 2), g2: -mu**2/2 + mu*x - x**2/2} def test_issue_4418(): x = Symbol('x') a, b, c = symbols('a b c', cls=Wild, exclude=(x,)) f, g = symbols('f g', cls=Function) eq = diff(g(x)*f(x).diff(x), x) assert eq.match( g(x).diff(x)*f(x).diff(x) + g(x)*f(x).diff(x, x) + c) == {c: 0} assert eq.match(a*g(x).diff( x)*f(x).diff(x) + b*g(x)*f(x).diff(x, x) + c) == {a: 1, b: 1, c: 0} def test_issue_4700(): f = Function('f') x = Symbol('x') a, b = symbols('a b', cls=Wild, exclude=(f(x),)) p = a*f(x) + b eq1 = sin(x) eq2 = f(x) + sin(x) eq3 = f(x) + x + sin(x) eq4 = x + sin(x) assert eq1.match(p) == {a: 0, b: sin(x)} assert eq2.match(p) == {a: 1, b: sin(x)} assert eq3.match(p) == {a: 1, b: x + sin(x)} assert eq4.match(p) == {a: 0, b: x + sin(x)} def test_issue_5168(): a, b, c = symbols('a b c', cls=Wild) x = Symbol('x') f = Function('f') assert x.match(a) == {a: x} assert x.match(a*f(x)**c) == {a: x, c: 0} assert x.match(a*b) == {a: 1, b: x} assert x.match(a*b*f(x)**c) == {a: 1, b: x, c: 0} assert (-x).match(a) == {a: -x} assert (-x).match(a*f(x)**c) == {a: -x, c: 0} assert (-x).match(a*b) == {a: -1, b: x} assert (-x).match(a*b*f(x)**c) == {a: -1, b: x, c: 0} assert (2*x).match(a) == {a: 2*x} assert (2*x).match(a*f(x)**c) == {a: 2*x, c: 0} assert (2*x).match(a*b) == {a: 2, b: x} assert (2*x).match(a*b*f(x)**c) == {a: 2, b: x, c: 0} assert (-2*x).match(a) == {a: -2*x} assert (-2*x).match(a*f(x)**c) == {a: -2*x, c: 0} assert (-2*x).match(a*b) == {a: -2, b: x} assert (-2*x).match(a*b*f(x)**c) == {a: -2, b: x, c: 0} def test_issue_4559(): x = Symbol('x') e = Symbol('e') w = Wild('w', exclude=[x]) y = Wild('y') # this is as it should be assert (3/x).match(w/y) == {w: 3, y: x} assert (3*x).match(w*y) == {w: 3, y: x} assert (x/3).match(y/w) == {w: 3, y: x} assert (3*x).match(y/w) == {w: S.One/3, y: x} assert (3*x).match(y/w) == {w: Rational(1, 3), y: x} # these could be allowed to fail assert (x/3).match(w/y) == {w: S.One/3, y: 1/x} assert (3*x).match(w/y) == {w: 3, y: 1/x} assert (3/x).match(w*y) == {w: 3, y: 1/x} # Note that solve will give # multiple roots but match only gives one: # # >>> solve(x**r-y**2,y) # [-x**(r/2), x**(r/2)] r = Symbol('r', rational=True) assert (x**r).match(y**2) == {y: x**(r/2)} assert (x**e).match(y**2) == {y: sqrt(x**e)} # since (x**i = y) -> x = y**(1/i) where i is an integer # the following should also be valid as long as y is not # zero when i is negative. a = Wild('a') e = S.Zero assert e.match(a) == {a: e} assert e.match(1/a) is None assert e.match(a**.3) is None e = S(3) assert e.match(1/a) == {a: 1/e} assert e.match(1/a**2) == {a: 1/sqrt(e)} e = pi assert e.match(1/a) == {a: 1/e} assert e.match(1/a**2) == {a: 1/sqrt(e)} assert (-e).match(sqrt(a)) is None assert (-e).match(a**2) == {a: I*sqrt(pi)} # The pattern matcher doesn't know how to handle (x - a)**2 == (a - x)**2. To # avoid ambiguity in actual applications, don't put a coefficient (including a # minus sign) in front of a wild. @XFAIL def test_issue_4883(): a = Wild('a') x = Symbol('x') e = [i**2 for i in (x - 2, 2 - x)] p = [i**2 for i in (x - a, a- x)] for eq in e: for pat in p: assert eq.match(pat) == {a: 2} def test_issue_4319(): x, y = symbols('x y') p = -x*(S.One/8 - y) ans = {S.Zero, y - S.One/8} def ok(pat): assert set(p.match(pat).values()) == ans ok(Wild("coeff", exclude=[x])*x + Wild("rest")) ok(Wild("w", exclude=[x])*x + Wild("rest")) ok(Wild("coeff", exclude=[x])*x + Wild("rest")) ok(Wild("w", exclude=[x])*x + Wild("rest")) ok(Wild("e", exclude=[x])*x + Wild("rest")) ok(Wild("ress", exclude=[x])*x + Wild("rest")) ok(Wild("resu", exclude=[x])*x + Wild("rest")) def test_issue_3778(): p, c, q = symbols('p c q', cls=Wild) x = Symbol('x') assert (sin(x)**2).match(sin(p)*sin(q)*c) == {q: x, c: 1, p: x} assert (2*sin(x)).match(sin(p) + sin(q) + c) == {q: x, c: 0, p: x} def test_issue_6103(): x = Symbol('x') a = Wild('a') assert (-I*x*oo).match(I*a*oo) == {a: -x} def test_issue_3539(): a = Wild('a') x = Symbol('x') assert (x - 2).match(a - x) is None assert (6/x).match(a*x) is None assert (6/x**2).match(a/x) == {a: 6/x} def test_gh_issue_2711(): x = Symbol('x') f = meijerg(((), ()), ((0,), ()), x) a = Wild('a') b = Wild('b') assert f.find(a) == set([(S.Zero,), ((), ()), ((S.Zero,), ()), x, S.Zero, (), meijerg(((), ()), ((S.Zero,), ()), x)]) assert f.find(a + b) == \ {meijerg(((), ()), ((S.Zero,), ()), x), x, S.Zero} assert f.find(a**2) == {meijerg(((), ()), ((S.Zero,), ()), x), x} def test_match_issue_17397(): f = Function("f") x = Symbol("x") a3 = Wild('a3', exclude=[f(x), f(x).diff(x), f(x).diff(x, 2)]) b3 = Wild('b3', exclude=[f(x), f(x).diff(x), f(x).diff(x, 2)]) c3 = Wild('c3', exclude=[f(x), f(x).diff(x), f(x).diff(x, 2)]) deq = a3*(f(x).diff(x, 2)) + b3*f(x).diff(x) + c3*f(x) eq = (x-2)**2*(f(x).diff(x, 2)) + (x-2)*(f(x).diff(x)) + ((x-2)**2 - 4)*f(x) r = collect(eq, [f(x).diff(x, 2), f(x).diff(x), f(x)]).match(deq) assert r == {a3: (x - 2)**2, c3: (x - 2)**2 - 4, b3: x - 2} eq =x*f(x) + x*Derivative(f(x), (x, 2)) - 4*f(x) + Derivative(f(x), x) \ - 4*Derivative(f(x), (x, 2)) - 2*Derivative(f(x), x)/x + 4*Derivative(f(x), (x, 2))/x r = collect(eq, [f(x).diff(x, 2), f(x).diff(x), f(x)]).match(deq) assert r == {a3: x - 4 + 4/x, b3: 1 - 2/x, c3: x - 4}
742b08a917cca503e3c621ea6fa9142b924132f583fc696a9d722a0dd0e81e60
from sympy import (Basic, Symbol, sin, cos, atan, exp, sqrt, Rational, Float, re, pi, sympify, Add, Mul, Pow, Mod, I, log, S, Max, symbols, oo, zoo, Integer, sign, im, nan, Dummy, factorial, comp, floor ) from sympy.core.parameters import distribute from sympy.core.expr import unchanged from sympy.utilities.iterables import cartes from sympy.testing.pytest import XFAIL, raises from sympy.testing.randtest import verify_numerically a, c, x, y, z = symbols('a,c,x,y,z') b = Symbol("b", positive=True) def same_and_same_prec(a, b): # stricter matching for Floats return a == b and a._prec == b._prec def test_bug1(): assert re(x) != x x.series(x, 0, 1) assert re(x) != x def test_Symbol(): e = a*b assert e == a*b assert a*b*b == a*b**2 assert a*b*b + c == c + a*b**2 assert a*b*b - c == -c + a*b**2 x = Symbol('x', complex=True, real=False) assert x.is_imaginary is None # could be I or 1 + I x = Symbol('x', complex=True, imaginary=False) assert x.is_real is None # could be 1 or 1 + I x = Symbol('x', real=True) assert x.is_complex x = Symbol('x', imaginary=True) assert x.is_complex x = Symbol('x', real=False, imaginary=False) assert x.is_complex is None # might be a non-number def test_arit0(): p = Rational(5) e = a*b assert e == a*b e = a*b + b*a assert e == 2*a*b e = a*b + b*a + a*b + p*b*a assert e == 8*a*b e = a*b + b*a + a*b + p*b*a + a assert e == a + 8*a*b e = a + a assert e == 2*a e = a + b + a assert e == b + 2*a e = a + b*b + a + b*b assert e == 2*a + 2*b**2 e = a + Rational(2) + b*b + a + b*b + p assert e == 7 + 2*a + 2*b**2 e = (a + b*b + a + b*b)*p assert e == 5*(2*a + 2*b**2) e = (a*b*c + c*b*a + b*a*c)*p assert e == 15*a*b*c e = (a*b*c + c*b*a + b*a*c)*p - Rational(15)*a*b*c assert e == Rational(0) e = Rational(50)*(a - a) assert e == Rational(0) e = b*a - b - a*b + b assert e == Rational(0) e = a*b + c**p assert e == a*b + c**5 e = a/b assert e == a*b**(-1) e = a*2*2 assert e == 4*a e = 2 + a*2/2 assert e == 2 + a e = 2 - a - 2 assert e == -a e = 2*a*2 assert e == 4*a e = 2/a/2 assert e == a**(-1) e = 2**a**2 assert e == 2**(a**2) e = -(1 + a) assert e == -1 - a e = S.Half*(1 + a) assert e == S.Half + a/2 def test_div(): e = a/b assert e == a*b**(-1) e = a/b + c/2 assert e == a*b**(-1) + Rational(1)/2*c e = (1 - b)/(b - 1) assert e == (1 + -b)*((-1) + b)**(-1) def test_pow(): n1 = Rational(1) n2 = Rational(2) n5 = Rational(5) e = a*a assert e == a**2 e = a*a*a assert e == a**3 e = a*a*a*a**Rational(6) assert e == a**9 e = a*a*a*a**Rational(6) - a**Rational(9) assert e == Rational(0) e = a**(b - b) assert e == Rational(1) e = (a + Rational(1) - a)**b assert e == Rational(1) e = (a + b + c)**n2 assert e == (a + b + c)**2 assert e.expand() == 2*b*c + 2*a*c + 2*a*b + a**2 + c**2 + b**2 e = (a + b)**n2 assert e == (a + b)**2 assert e.expand() == 2*a*b + a**2 + b**2 e = (a + b)**(n1/n2) assert e == sqrt(a + b) assert e.expand() == sqrt(a + b) n = n5**(n1/n2) assert n == sqrt(5) e = n*a*b - n*b*a assert e == Rational(0) e = n*a*b + n*b*a assert e == 2*a*b*sqrt(5) assert e.diff(a) == 2*b*sqrt(5) assert e.diff(a) == 2*b*sqrt(5) e = a/b**2 assert e == a*b**(-2) assert sqrt(2*(1 + sqrt(2))) == (2*(1 + 2**S.Half))**S.Half x = Symbol('x') y = Symbol('y') assert ((x*y)**3).expand() == y**3 * x**3 assert ((x*y)**-3).expand() == y**-3 * x**-3 assert (x**5*(3*x)**(3)).expand() == 27 * x**8 assert (x**5*(-3*x)**(3)).expand() == -27 * x**8 assert (x**5*(3*x)**(-3)).expand() == x**2 * Rational(1, 27) assert (x**5*(-3*x)**(-3)).expand() == x**2 * Rational(-1, 27) # expand_power_exp assert (x**(y**(x + exp(x + y)) + z)).expand(deep=False) == \ x**z*x**(y**(x + exp(x + y))) assert (x**(y**(x + exp(x + y)) + z)).expand() == \ x**z*x**(y**x*y**(exp(x)*exp(y))) n = Symbol('n', even=False) k = Symbol('k', even=True) o = Symbol('o', odd=True) assert unchanged(Pow, -1, x) assert unchanged(Pow, -1, n) assert (-2)**k == 2**k assert (-1)**k == 1 assert (-1)**o == -1 def test_pow2(): # x**(2*y) is always (x**y)**2 but is only (x**2)**y if # x.is_positive or y.is_integer # let x = 1 to see why the following are not true. assert (-x)**Rational(2, 3) != x**Rational(2, 3) assert (-x)**Rational(5, 7) != -x**Rational(5, 7) assert ((-x)**2)**Rational(1, 3) != ((-x)**Rational(1, 3))**2 assert sqrt(x**2) != x def test_pow3(): assert sqrt(2)**3 == 2 * sqrt(2) assert sqrt(2)**3 == sqrt(8) def test_mod_pow(): for s, t, u, v in [(4, 13, 497, 445), (4, -3, 497, 365), (3.2, 2.1, 1.9, 0.1031015682350942), (S(3)/2, 5, S(5)/6, S(3)/32)]: assert pow(S(s), t, u) == v assert pow(S(s), S(t), u) == v assert pow(S(s), t, S(u)) == v assert pow(S(s), S(t), S(u)) == v assert pow(S(2), S(10000000000), S(3)) == 1 assert pow(x, y, z) == x**y%z raises(TypeError, lambda: pow(S(4), "13", 497)) raises(TypeError, lambda: pow(S(4), 13, "497")) def test_pow_E(): assert 2**(y/log(2)) == S.Exp1**y assert 2**(y/log(2)/3) == S.Exp1**(y/3) assert 3**(1/log(-3)) != S.Exp1 assert (3 + 2*I)**(1/(log(-3 - 2*I) + I*pi)) == S.Exp1 assert (4 + 2*I)**(1/(log(-4 - 2*I) + I*pi)) == S.Exp1 assert (3 + 2*I)**(1/(log(-3 - 2*I, 3)/2 + I*pi/log(3)/2)) == 9 assert (3 + 2*I)**(1/(log(3 + 2*I, 3)/2)) == 9 # every time tests are run they will affirm with a different random # value that this identity holds while 1: b = x._random() r, i = b.as_real_imag() if i: break assert verify_numerically(b**(1/(log(-b) + sign(i)*I*pi).n()), S.Exp1) def test_pow_issue_3516(): assert 4**Rational(1, 4) == sqrt(2) def test_pow_im(): for m in (-2, -1, 2): for d in (3, 4, 5): b = m*I for i in range(1, 4*d + 1): e = Rational(i, d) assert (b**e - b.n()**e.n()).n(2, chop=1e-10) == 0 e = Rational(7, 3) assert (2*x*I)**e == 4*2**Rational(1, 3)*(I*x)**e # same as Wolfram Alpha im = symbols('im', imaginary=True) assert (2*im*I)**e == 4*2**Rational(1, 3)*(I*im)**e args = [I, I, I, I, 2] e = Rational(1, 3) ans = 2**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args = [I, I, I, 2] e = Rational(1, 3) ans = 2**e*(-I)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args.append(-3) ans = (6*I)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args.append(-1) ans = (-6*I)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args = [I, I, 2] e = Rational(1, 3) ans = (-2)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args.append(-3) ans = (6)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans args.append(-1) ans = (-6)**e assert Mul(*args, evaluate=False)**e == ans assert Mul(*args)**e == ans assert Mul(Pow(-1, Rational(3, 2), evaluate=False), I, I) == I assert Mul(I*Pow(I, S.Half, evaluate=False)) == sqrt(I)*I def test_real_mul(): assert Float(0) * pi * x == 0 assert set((Float(1) * pi * x).args) == {Float(1), pi, x} def test_ncmul(): A = Symbol("A", commutative=False) B = Symbol("B", commutative=False) C = Symbol("C", commutative=False) assert A*B != B*A assert A*B*C != C*B*A assert A*b*B*3*C == 3*b*A*B*C assert A*b*B*3*C != 3*b*B*A*C assert A*b*B*3*C == 3*A*B*C*b assert A + B == B + A assert (A + B)*C != C*(A + B) assert C*(A + B)*C != C*C*(A + B) assert A*A == A**2 assert (A + B)*(A + B) == (A + B)**2 assert A**-1 * A == 1 assert A/A == 1 assert A/(A**2) == 1/A assert A/(1 + A) == A/(1 + A) assert set((A + B + 2*(A + B)).args) == \ {A, B, 2*(A + B)} def test_ncpow(): x = Symbol('x', commutative=False) y = Symbol('y', commutative=False) z = Symbol('z', commutative=False) a = Symbol('a') b = Symbol('b') c = Symbol('c') assert (x**2)*(y**2) != (y**2)*(x**2) assert (x**-2)*y != y*(x**2) assert 2**x*2**y != 2**(x + y) assert 2**x*2**y*2**z != 2**(x + y + z) assert 2**x*2**(2*x) == 2**(3*x) assert 2**x*2**(2*x)*2**x == 2**(4*x) assert exp(x)*exp(y) != exp(y)*exp(x) assert exp(x)*exp(y)*exp(z) != exp(y)*exp(x)*exp(z) assert exp(x)*exp(y)*exp(z) != exp(x + y + z) assert x**a*x**b != x**(a + b) assert x**a*x**b*x**c != x**(a + b + c) assert x**3*x**4 == x**7 assert x**3*x**4*x**2 == x**9 assert x**a*x**(4*a) == x**(5*a) assert x**a*x**(4*a)*x**a == x**(6*a) def test_powerbug(): x = Symbol("x") assert x**1 != (-x)**1 assert x**2 == (-x)**2 assert x**3 != (-x)**3 assert x**4 == (-x)**4 assert x**5 != (-x)**5 assert x**6 == (-x)**6 assert x**128 == (-x)**128 assert x**129 != (-x)**129 assert (2*x)**2 == (-2*x)**2 def test_Mul_doesnt_expand_exp(): x = Symbol('x') y = Symbol('y') assert unchanged(Mul, exp(x), exp(y)) assert unchanged(Mul, 2**x, 2**y) assert x**2*x**3 == x**5 assert 2**x*3**x == 6**x assert x**(y)*x**(2*y) == x**(3*y) assert sqrt(2)*sqrt(2) == 2 assert 2**x*2**(2*x) == 2**(3*x) assert sqrt(2)*2**Rational(1, 4)*5**Rational(3, 4) == 10**Rational(3, 4) assert (x**(-log(5)/log(3))*x)/(x*x**( - log(5)/log(3))) == sympify(1) def test_Add_Mul_is_integer(): x = Symbol('x') k = Symbol('k', integer=True) n = Symbol('n', integer=True) assert (2*k).is_integer is True assert (-k).is_integer is True assert (k/3).is_integer is None assert (x*k*n).is_integer is None assert (k + n).is_integer is True assert (k + x).is_integer is None assert (k + n*x).is_integer is None assert (k + n/3).is_integer is None assert ((1 + sqrt(3))*(-sqrt(3) + 1)).is_integer is not False assert (1 + (1 + sqrt(3))*(-sqrt(3) + 1)).is_integer is not False def test_Add_Mul_is_finite(): x = Symbol('x', extended_real=True, finite=False) assert sin(x).is_finite is True assert (x*sin(x)).is_finite is None assert (x*atan(x)).is_finite is False assert (1024*sin(x)).is_finite is True assert (sin(x)*exp(x)).is_finite is None assert (sin(x)*cos(x)).is_finite is True assert (x*sin(x)*exp(x)).is_finite is None assert (sin(x) - 67).is_finite is True assert (sin(x) + exp(x)).is_finite is not True assert (1 + x).is_finite is False assert (1 + x**2 + (1 + x)*(1 - x)).is_finite is None assert (sqrt(2)*(1 + x)).is_finite is False assert (sqrt(2)*(1 + x)*(1 - x)).is_finite is False def test_Mul_is_even_odd(): x = Symbol('x', integer=True) y = Symbol('y', integer=True) k = Symbol('k', odd=True) n = Symbol('n', odd=True) m = Symbol('m', even=True) assert (2*x).is_even is True assert (2*x).is_odd is False assert (3*x).is_even is None assert (3*x).is_odd is None assert (k/3).is_integer is None assert (k/3).is_even is None assert (k/3).is_odd is None assert (2*n).is_even is True assert (2*n).is_odd is False assert (2*m).is_even is True assert (2*m).is_odd is False assert (-n).is_even is False assert (-n).is_odd is True assert (k*n).is_even is False assert (k*n).is_odd is True assert (k*m).is_even is True assert (k*m).is_odd is False assert (k*n*m).is_even is True assert (k*n*m).is_odd is False assert (k*m*x).is_even is True assert (k*m*x).is_odd is False # issue 6791: assert (x/2).is_integer is None assert (k/2).is_integer is False assert (m/2).is_integer is True assert (x*y).is_even is None assert (x*x).is_even is None assert (x*(x + k)).is_even is True assert (x*(x + m)).is_even is None assert (x*y).is_odd is None assert (x*x).is_odd is None assert (x*(x + k)).is_odd is False assert (x*(x + m)).is_odd is None @XFAIL def test_evenness_in_ternary_integer_product_with_odd(): # Tests that oddness inference is independent of term ordering. # Term ordering at the point of testing depends on SymPy's symbol order, so # we try to force a different order by modifying symbol names. x = Symbol('x', integer=True) y = Symbol('y', integer=True) k = Symbol('k', odd=True) assert (x*y*(y + k)).is_even is True assert (y*x*(x + k)).is_even is True def test_evenness_in_ternary_integer_product_with_even(): x = Symbol('x', integer=True) y = Symbol('y', integer=True) m = Symbol('m', even=True) assert (x*y*(y + m)).is_even is None @XFAIL def test_oddness_in_ternary_integer_product_with_odd(): # Tests that oddness inference is independent of term ordering. # Term ordering at the point of testing depends on SymPy's symbol order, so # we try to force a different order by modifying symbol names. x = Symbol('x', integer=True) y = Symbol('y', integer=True) k = Symbol('k', odd=True) assert (x*y*(y + k)).is_odd is False assert (y*x*(x + k)).is_odd is False def test_oddness_in_ternary_integer_product_with_even(): x = Symbol('x', integer=True) y = Symbol('y', integer=True) m = Symbol('m', even=True) assert (x*y*(y + m)).is_odd is None def test_Mul_is_rational(): x = Symbol('x') n = Symbol('n', integer=True) m = Symbol('m', integer=True, nonzero=True) assert (n/m).is_rational is True assert (x/pi).is_rational is None assert (x/n).is_rational is None assert (m/pi).is_rational is False r = Symbol('r', rational=True) assert (pi*r).is_rational is None # issue 8008 z = Symbol('z', zero=True) i = Symbol('i', imaginary=True) assert (z*i).is_rational is True bi = Symbol('i', imaginary=True, finite=True) assert (z*bi).is_zero is True def test_Add_is_rational(): x = Symbol('x') n = Symbol('n', rational=True) m = Symbol('m', rational=True) assert (n + m).is_rational is True assert (x + pi).is_rational is None assert (x + n).is_rational is None assert (n + pi).is_rational is False def test_Add_is_even_odd(): x = Symbol('x', integer=True) k = Symbol('k', odd=True) n = Symbol('n', odd=True) m = Symbol('m', even=True) assert (k + 7).is_even is True assert (k + 7).is_odd is False assert (-k + 7).is_even is True assert (-k + 7).is_odd is False assert (k - 12).is_even is False assert (k - 12).is_odd is True assert (-k - 12).is_even is False assert (-k - 12).is_odd is True assert (k + n).is_even is True assert (k + n).is_odd is False assert (k + m).is_even is False assert (k + m).is_odd is True assert (k + n + m).is_even is True assert (k + n + m).is_odd is False assert (k + n + x + m).is_even is None assert (k + n + x + m).is_odd is None def test_Mul_is_negative_positive(): x = Symbol('x', real=True) y = Symbol('y', extended_real=False, complex=True) z = Symbol('z', zero=True) e = 2*z assert e.is_Mul and e.is_positive is False and e.is_negative is False neg = Symbol('neg', negative=True) pos = Symbol('pos', positive=True) nneg = Symbol('nneg', nonnegative=True) npos = Symbol('npos', nonpositive=True) assert neg.is_negative is True assert (-neg).is_negative is False assert (2*neg).is_negative is True assert (2*pos)._eval_is_extended_negative() is False assert (2*pos).is_negative is False assert pos.is_negative is False assert (-pos).is_negative is True assert (2*pos).is_negative is False assert (pos*neg).is_negative is True assert (2*pos*neg).is_negative is True assert (-pos*neg).is_negative is False assert (pos*neg*y).is_negative is False # y.is_real=F; !real -> !neg assert nneg.is_negative is False assert (-nneg).is_negative is None assert (2*nneg).is_negative is False assert npos.is_negative is None assert (-npos).is_negative is False assert (2*npos).is_negative is None assert (nneg*npos).is_negative is None assert (neg*nneg).is_negative is None assert (neg*npos).is_negative is False assert (pos*nneg).is_negative is False assert (pos*npos).is_negative is None assert (npos*neg*nneg).is_negative is False assert (npos*pos*nneg).is_negative is None assert (-npos*neg*nneg).is_negative is None assert (-npos*pos*nneg).is_negative is False assert (17*npos*neg*nneg).is_negative is False assert (17*npos*pos*nneg).is_negative is None assert (neg*npos*pos*nneg).is_negative is False assert (x*neg).is_negative is None assert (nneg*npos*pos*x*neg).is_negative is None assert neg.is_positive is False assert (-neg).is_positive is True assert (2*neg).is_positive is False assert pos.is_positive is True assert (-pos).is_positive is False assert (2*pos).is_positive is True assert (pos*neg).is_positive is False assert (2*pos*neg).is_positive is False assert (-pos*neg).is_positive is True assert (-pos*neg*y).is_positive is False # y.is_real=F; !real -> !neg assert nneg.is_positive is None assert (-nneg).is_positive is False assert (2*nneg).is_positive is None assert npos.is_positive is False assert (-npos).is_positive is None assert (2*npos).is_positive is False assert (nneg*npos).is_positive is False assert (neg*nneg).is_positive is False assert (neg*npos).is_positive is None assert (pos*nneg).is_positive is None assert (pos*npos).is_positive is False assert (npos*neg*nneg).is_positive is None assert (npos*pos*nneg).is_positive is False assert (-npos*neg*nneg).is_positive is False assert (-npos*pos*nneg).is_positive is None assert (17*npos*neg*nneg).is_positive is None assert (17*npos*pos*nneg).is_positive is False assert (neg*npos*pos*nneg).is_positive is None assert (x*neg).is_positive is None assert (nneg*npos*pos*x*neg).is_positive is None def test_Mul_is_negative_positive_2(): a = Symbol('a', nonnegative=True) b = Symbol('b', nonnegative=True) c = Symbol('c', nonpositive=True) d = Symbol('d', nonpositive=True) assert (a*b).is_nonnegative is True assert (a*b).is_negative is False assert (a*b).is_zero is None assert (a*b).is_positive is None assert (c*d).is_nonnegative is True assert (c*d).is_negative is False assert (c*d).is_zero is None assert (c*d).is_positive is None assert (a*c).is_nonpositive is True assert (a*c).is_positive is False assert (a*c).is_zero is None assert (a*c).is_negative is None def test_Mul_is_nonpositive_nonnegative(): x = Symbol('x', real=True) k = Symbol('k', negative=True) n = Symbol('n', positive=True) u = Symbol('u', nonnegative=True) v = Symbol('v', nonpositive=True) assert k.is_nonpositive is True assert (-k).is_nonpositive is False assert (2*k).is_nonpositive is True assert n.is_nonpositive is False assert (-n).is_nonpositive is True assert (2*n).is_nonpositive is False assert (n*k).is_nonpositive is True assert (2*n*k).is_nonpositive is True assert (-n*k).is_nonpositive is False assert u.is_nonpositive is None assert (-u).is_nonpositive is True assert (2*u).is_nonpositive is None assert v.is_nonpositive is True assert (-v).is_nonpositive is None assert (2*v).is_nonpositive is True assert (u*v).is_nonpositive is True assert (k*u).is_nonpositive is True assert (k*v).is_nonpositive is None assert (n*u).is_nonpositive is None assert (n*v).is_nonpositive is True assert (v*k*u).is_nonpositive is None assert (v*n*u).is_nonpositive is True assert (-v*k*u).is_nonpositive is True assert (-v*n*u).is_nonpositive is None assert (17*v*k*u).is_nonpositive is None assert (17*v*n*u).is_nonpositive is True assert (k*v*n*u).is_nonpositive is None assert (x*k).is_nonpositive is None assert (u*v*n*x*k).is_nonpositive is None assert k.is_nonnegative is False assert (-k).is_nonnegative is True assert (2*k).is_nonnegative is False assert n.is_nonnegative is True assert (-n).is_nonnegative is False assert (2*n).is_nonnegative is True assert (n*k).is_nonnegative is False assert (2*n*k).is_nonnegative is False assert (-n*k).is_nonnegative is True assert u.is_nonnegative is True assert (-u).is_nonnegative is None assert (2*u).is_nonnegative is True assert v.is_nonnegative is None assert (-v).is_nonnegative is True assert (2*v).is_nonnegative is None assert (u*v).is_nonnegative is None assert (k*u).is_nonnegative is None assert (k*v).is_nonnegative is True assert (n*u).is_nonnegative is True assert (n*v).is_nonnegative is None assert (v*k*u).is_nonnegative is True assert (v*n*u).is_nonnegative is None assert (-v*k*u).is_nonnegative is None assert (-v*n*u).is_nonnegative is True assert (17*v*k*u).is_nonnegative is True assert (17*v*n*u).is_nonnegative is None assert (k*v*n*u).is_nonnegative is True assert (x*k).is_nonnegative is None assert (u*v*n*x*k).is_nonnegative is None def test_Add_is_negative_positive(): x = Symbol('x', real=True) k = Symbol('k', negative=True) n = Symbol('n', positive=True) u = Symbol('u', nonnegative=True) v = Symbol('v', nonpositive=True) assert (k - 2).is_negative is True assert (k + 17).is_negative is None assert (-k - 5).is_negative is None assert (-k + 123).is_negative is False assert (k - n).is_negative is True assert (k + n).is_negative is None assert (-k - n).is_negative is None assert (-k + n).is_negative is False assert (k - n - 2).is_negative is True assert (k + n + 17).is_negative is None assert (-k - n - 5).is_negative is None assert (-k + n + 123).is_negative is False assert (-2*k + 123*n + 17).is_negative is False assert (k + u).is_negative is None assert (k + v).is_negative is True assert (n + u).is_negative is False assert (n + v).is_negative is None assert (u - v).is_negative is False assert (u + v).is_negative is None assert (-u - v).is_negative is None assert (-u + v).is_negative is None assert (u - v + n + 2).is_negative is False assert (u + v + n + 2).is_negative is None assert (-u - v + n + 2).is_negative is None assert (-u + v + n + 2).is_negative is None assert (k + x).is_negative is None assert (k + x - n).is_negative is None assert (k - 2).is_positive is False assert (k + 17).is_positive is None assert (-k - 5).is_positive is None assert (-k + 123).is_positive is True assert (k - n).is_positive is False assert (k + n).is_positive is None assert (-k - n).is_positive is None assert (-k + n).is_positive is True assert (k - n - 2).is_positive is False assert (k + n + 17).is_positive is None assert (-k - n - 5).is_positive is None assert (-k + n + 123).is_positive is True assert (-2*k + 123*n + 17).is_positive is True assert (k + u).is_positive is None assert (k + v).is_positive is False assert (n + u).is_positive is True assert (n + v).is_positive is None assert (u - v).is_positive is None assert (u + v).is_positive is None assert (-u - v).is_positive is None assert (-u + v).is_positive is False assert (u - v - n - 2).is_positive is None assert (u + v - n - 2).is_positive is None assert (-u - v - n - 2).is_positive is None assert (-u + v - n - 2).is_positive is False assert (n + x).is_positive is None assert (n + x - k).is_positive is None z = (-3 - sqrt(5) + (-sqrt(10)/2 - sqrt(2)/2)**2) assert z.is_zero z = sqrt(1 + sqrt(3)) + sqrt(3 + 3*sqrt(3)) - sqrt(10 + 6*sqrt(3)) assert z.is_zero def test_Add_is_nonpositive_nonnegative(): x = Symbol('x', real=True) k = Symbol('k', negative=True) n = Symbol('n', positive=True) u = Symbol('u', nonnegative=True) v = Symbol('v', nonpositive=True) assert (u - 2).is_nonpositive is None assert (u + 17).is_nonpositive is False assert (-u - 5).is_nonpositive is True assert (-u + 123).is_nonpositive is None assert (u - v).is_nonpositive is None assert (u + v).is_nonpositive is None assert (-u - v).is_nonpositive is None assert (-u + v).is_nonpositive is True assert (u - v - 2).is_nonpositive is None assert (u + v + 17).is_nonpositive is None assert (-u - v - 5).is_nonpositive is None assert (-u + v - 123).is_nonpositive is True assert (-2*u + 123*v - 17).is_nonpositive is True assert (k + u).is_nonpositive is None assert (k + v).is_nonpositive is True assert (n + u).is_nonpositive is False assert (n + v).is_nonpositive is None assert (k - n).is_nonpositive is True assert (k + n).is_nonpositive is None assert (-k - n).is_nonpositive is None assert (-k + n).is_nonpositive is False assert (k - n + u + 2).is_nonpositive is None assert (k + n + u + 2).is_nonpositive is None assert (-k - n + u + 2).is_nonpositive is None assert (-k + n + u + 2).is_nonpositive is False assert (u + x).is_nonpositive is None assert (v - x - n).is_nonpositive is None assert (u - 2).is_nonnegative is None assert (u + 17).is_nonnegative is True assert (-u - 5).is_nonnegative is False assert (-u + 123).is_nonnegative is None assert (u - v).is_nonnegative is True assert (u + v).is_nonnegative is None assert (-u - v).is_nonnegative is None assert (-u + v).is_nonnegative is None assert (u - v + 2).is_nonnegative is True assert (u + v + 17).is_nonnegative is None assert (-u - v - 5).is_nonnegative is None assert (-u + v - 123).is_nonnegative is False assert (2*u - 123*v + 17).is_nonnegative is True assert (k + u).is_nonnegative is None assert (k + v).is_nonnegative is False assert (n + u).is_nonnegative is True assert (n + v).is_nonnegative is None assert (k - n).is_nonnegative is False assert (k + n).is_nonnegative is None assert (-k - n).is_nonnegative is None assert (-k + n).is_nonnegative is True assert (k - n - u - 2).is_nonnegative is False assert (k + n - u - 2).is_nonnegative is None assert (-k - n - u - 2).is_nonnegative is None assert (-k + n - u - 2).is_nonnegative is None assert (u - x).is_nonnegative is None assert (v + x + n).is_nonnegative is None def test_Pow_is_integer(): x = Symbol('x') k = Symbol('k', integer=True) n = Symbol('n', integer=True, nonnegative=True) m = Symbol('m', integer=True, positive=True) assert (k**2).is_integer is True assert (k**(-2)).is_integer is None assert ((m + 1)**(-2)).is_integer is False assert (m**(-1)).is_integer is None # issue 8580 assert (2**k).is_integer is None assert (2**(-k)).is_integer is None assert (2**n).is_integer is True assert (2**(-n)).is_integer is None assert (2**m).is_integer is True assert (2**(-m)).is_integer is False assert (x**2).is_integer is None assert (2**x).is_integer is None assert (k**n).is_integer is True assert (k**(-n)).is_integer is None assert (k**x).is_integer is None assert (x**k).is_integer is None assert (k**(n*m)).is_integer is True assert (k**(-n*m)).is_integer is None assert sqrt(3).is_integer is False assert sqrt(.3).is_integer is False assert Pow(3, 2, evaluate=False).is_integer is True assert Pow(3, 0, evaluate=False).is_integer is True assert Pow(3, -2, evaluate=False).is_integer is False assert Pow(S.Half, 3, evaluate=False).is_integer is False # decided by re-evaluating assert Pow(3, S.Half, evaluate=False).is_integer is False assert Pow(3, S.Half, evaluate=False).is_integer is False assert Pow(4, S.Half, evaluate=False).is_integer is True assert Pow(S.Half, -2, evaluate=False).is_integer is True assert ((-1)**k).is_integer x = Symbol('x', real=True, integer=False) assert (x**2).is_integer is None # issue 8641 def test_Pow_is_real(): x = Symbol('x', real=True) y = Symbol('y', real=True, positive=True) assert (x**2).is_real is True assert (x**3).is_real is True assert (x**x).is_real is None assert (y**x).is_real is True assert (x**Rational(1, 3)).is_real is None assert (y**Rational(1, 3)).is_real is True assert sqrt(-1 - sqrt(2)).is_real is False i = Symbol('i', imaginary=True) assert (i**i).is_real is None assert (I**i).is_extended_real is True assert ((-I)**i).is_extended_real is True assert (2**i).is_real is None # (2**(pi/log(2) * I)) is real, 2**I is not assert (2**I).is_real is False assert (2**-I).is_real is False assert (i**2).is_extended_real is True assert (i**3).is_extended_real is False assert (i**x).is_real is None # could be (-I)**(2/3) e = Symbol('e', even=True) o = Symbol('o', odd=True) k = Symbol('k', integer=True) assert (i**e).is_extended_real is True assert (i**o).is_extended_real is False assert (i**k).is_real is None assert (i**(4*k)).is_extended_real is True x = Symbol("x", nonnegative=True) y = Symbol("y", nonnegative=True) assert im(x**y).expand(complex=True) is S.Zero assert (x**y).is_real is True i = Symbol('i', imaginary=True) assert (exp(i)**I).is_extended_real is True assert log(exp(i)).is_imaginary is None # i could be 2*pi*I c = Symbol('c', complex=True) assert log(c).is_real is None # c could be 0 or 2, too assert log(exp(c)).is_real is None # log(0), log(E), ... n = Symbol('n', negative=False) assert log(n).is_real is None n = Symbol('n', nonnegative=True) assert log(n).is_real is None assert sqrt(-I).is_real is False # issue 7843 i = Symbol('i', integer=True) assert (1/(i-1)).is_real is None assert (1/(i-1)).is_extended_real is None def test_real_Pow(): k = Symbol('k', integer=True, nonzero=True) assert (k**(I*pi/log(k))).is_real def test_Pow_is_finite(): xe = Symbol('xe', extended_real=True) xr = Symbol('xr', real=True) p = Symbol('p', positive=True) n = Symbol('n', negative=True) i = Symbol('i', integer=True) assert (xe**2).is_finite is None # xe could be oo assert (xr**2).is_finite is True assert (xe**xe).is_finite is None assert (xr**xe).is_finite is None assert (xe**xr).is_finite is None # FIXME: The line below should be True rather than None # assert (xr**xr).is_finite is True assert (xr**xr).is_finite is None assert (p**xe).is_finite is None assert (p**xr).is_finite is True assert (n**xe).is_finite is None assert (n**xr).is_finite is True assert (sin(xe)**2).is_finite is True assert (sin(xr)**2).is_finite is True assert (sin(xe)**xe).is_finite is None # xe, xr could be -pi assert (sin(xr)**xr).is_finite is None # FIXME: Should the line below be True rather than None? assert (sin(xe)**exp(xe)).is_finite is None assert (sin(xr)**exp(xr)).is_finite is True assert (1/sin(xe)).is_finite is None # if zero, no, otherwise yes assert (1/sin(xr)).is_finite is None assert (1/exp(xe)).is_finite is None # xe could be -oo assert (1/exp(xr)).is_finite is True assert (1/S.Pi).is_finite is True assert (1/(i-1)).is_finite is None def test_Pow_is_even_odd(): x = Symbol('x') k = Symbol('k', even=True) n = Symbol('n', odd=True) m = Symbol('m', integer=True, nonnegative=True) p = Symbol('p', integer=True, positive=True) assert ((-1)**n).is_odd assert ((-1)**k).is_odd assert ((-1)**(m - p)).is_odd assert (k**2).is_even is True assert (n**2).is_even is False assert (2**k).is_even is None assert (x**2).is_even is None assert (k**m).is_even is None assert (n**m).is_even is False assert (k**p).is_even is True assert (n**p).is_even is False assert (m**k).is_even is None assert (p**k).is_even is None assert (m**n).is_even is None assert (p**n).is_even is None assert (k**x).is_even is None assert (n**x).is_even is None assert (k**2).is_odd is False assert (n**2).is_odd is True assert (3**k).is_odd is None assert (k**m).is_odd is None assert (n**m).is_odd is True assert (k**p).is_odd is False assert (n**p).is_odd is True assert (m**k).is_odd is None assert (p**k).is_odd is None assert (m**n).is_odd is None assert (p**n).is_odd is None assert (k**x).is_odd is None assert (n**x).is_odd is None def test_Pow_is_negative_positive(): r = Symbol('r', real=True) k = Symbol('k', integer=True, positive=True) n = Symbol('n', even=True) m = Symbol('m', odd=True) x = Symbol('x') assert (2**r).is_positive is True assert ((-2)**r).is_positive is None assert ((-2)**n).is_positive is True assert ((-2)**m).is_positive is False assert (k**2).is_positive is True assert (k**(-2)).is_positive is True assert (k**r).is_positive is True assert ((-k)**r).is_positive is None assert ((-k)**n).is_positive is True assert ((-k)**m).is_positive is False assert (2**r).is_negative is False assert ((-2)**r).is_negative is None assert ((-2)**n).is_negative is False assert ((-2)**m).is_negative is True assert (k**2).is_negative is False assert (k**(-2)).is_negative is False assert (k**r).is_negative is False assert ((-k)**r).is_negative is None assert ((-k)**n).is_negative is False assert ((-k)**m).is_negative is True assert (2**x).is_positive is None assert (2**x).is_negative is None def test_Pow_is_zero(): z = Symbol('z', zero=True) e = z**2 assert e.is_zero assert e.is_positive is False assert e.is_negative is False assert Pow(0, 0, evaluate=False).is_zero is False assert Pow(0, 3, evaluate=False).is_zero assert Pow(0, oo, evaluate=False).is_zero assert Pow(0, -3, evaluate=False).is_zero is False assert Pow(0, -oo, evaluate=False).is_zero is False assert Pow(2, 2, evaluate=False).is_zero is False a = Symbol('a', zero=False) assert Pow(a, 3).is_zero is False # issue 7965 assert Pow(2, oo, evaluate=False).is_zero is False assert Pow(2, -oo, evaluate=False).is_zero assert Pow(S.Half, oo, evaluate=False).is_zero assert Pow(S.Half, -oo, evaluate=False).is_zero is False def test_Pow_is_nonpositive_nonnegative(): x = Symbol('x', real=True) k = Symbol('k', integer=True, nonnegative=True) l = Symbol('l', integer=True, positive=True) n = Symbol('n', even=True) m = Symbol('m', odd=True) assert (x**(4*k)).is_nonnegative is True assert (2**x).is_nonnegative is True assert ((-2)**x).is_nonnegative is None assert ((-2)**n).is_nonnegative is True assert ((-2)**m).is_nonnegative is False assert (k**2).is_nonnegative is True assert (k**(-2)).is_nonnegative is None assert (k**k).is_nonnegative is True assert (k**x).is_nonnegative is None # NOTE (0**x).is_real = U assert (l**x).is_nonnegative is True assert (l**x).is_positive is True assert ((-k)**x).is_nonnegative is None assert ((-k)**m).is_nonnegative is None assert (2**x).is_nonpositive is False assert ((-2)**x).is_nonpositive is None assert ((-2)**n).is_nonpositive is False assert ((-2)**m).is_nonpositive is True assert (k**2).is_nonpositive is None assert (k**(-2)).is_nonpositive is None assert (k**x).is_nonpositive is None assert ((-k)**x).is_nonpositive is None assert ((-k)**n).is_nonpositive is None assert (x**2).is_nonnegative is True i = symbols('i', imaginary=True) assert (i**2).is_nonpositive is True assert (i**4).is_nonpositive is False assert (i**3).is_nonpositive is False assert (I**i).is_nonnegative is True assert (exp(I)**i).is_nonnegative is True assert ((-l)**n).is_nonnegative is True assert ((-l)**m).is_nonpositive is True assert ((-k)**n).is_nonnegative is None assert ((-k)**m).is_nonpositive is None def test_Mul_is_imaginary_real(): r = Symbol('r', real=True) p = Symbol('p', positive=True) i1 = Symbol('i1', imaginary=True) i2 = Symbol('i2', imaginary=True) x = Symbol('x') assert I.is_imaginary is True assert I.is_real is False assert (-I).is_imaginary is True assert (-I).is_real is False assert (3*I).is_imaginary is True assert (3*I).is_real is False assert (I*I).is_imaginary is False assert (I*I).is_real is True e = (p + p*I) j = Symbol('j', integer=True, zero=False) assert (e**j).is_real is None assert (e**(2*j)).is_real is None assert (e**j).is_imaginary is None assert (e**(2*j)).is_imaginary is None assert (e**-1).is_imaginary is False assert (e**2).is_imaginary assert (e**3).is_imaginary is False assert (e**4).is_imaginary is False assert (e**5).is_imaginary is False assert (e**-1).is_real is False assert (e**2).is_real is False assert (e**3).is_real is False assert (e**4).is_real is True assert (e**5).is_real is False assert (e**3).is_complex assert (r*i1).is_imaginary is None assert (r*i1).is_real is None assert (x*i1).is_imaginary is None assert (x*i1).is_real is None assert (i1*i2).is_imaginary is False assert (i1*i2).is_real is True assert (r*i1*i2).is_imaginary is False assert (r*i1*i2).is_real is True # Github's issue 5874: nr = Symbol('nr', real=False, complex=True) # e.g. I or 1 + I a = Symbol('a', real=True, nonzero=True) b = Symbol('b', real=True) assert (i1*nr).is_real is None assert (a*nr).is_real is False assert (b*nr).is_real is None ni = Symbol('ni', imaginary=False, complex=True) # e.g. 2 or 1 + I a = Symbol('a', real=True, nonzero=True) b = Symbol('b', real=True) assert (i1*ni).is_real is False assert (a*ni).is_real is None assert (b*ni).is_real is None def test_Mul_hermitian_antihermitian(): a = Symbol('a', hermitian=True, zero=False) b = Symbol('b', hermitian=True) c = Symbol('c', hermitian=False) d = Symbol('d', antihermitian=True) e1 = Mul(a, b, c, evaluate=False) e2 = Mul(b, a, c, evaluate=False) e3 = Mul(a, b, c, d, evaluate=False) e4 = Mul(b, a, c, d, evaluate=False) e5 = Mul(a, c, evaluate=False) e6 = Mul(a, c, d, evaluate=False) assert e1.is_hermitian is None assert e2.is_hermitian is None assert e1.is_antihermitian is None assert e2.is_antihermitian is None assert e3.is_antihermitian is None assert e4.is_antihermitian is None assert e5.is_antihermitian is None assert e6.is_antihermitian is None def test_Add_is_comparable(): assert (x + y).is_comparable is False assert (x + 1).is_comparable is False assert (Rational(1, 3) - sqrt(8)).is_comparable is True def test_Mul_is_comparable(): assert (x*y).is_comparable is False assert (x*2).is_comparable is False assert (sqrt(2)*Rational(1, 3)).is_comparable is True def test_Pow_is_comparable(): assert (x**y).is_comparable is False assert (x**2).is_comparable is False assert (sqrt(Rational(1, 3))).is_comparable is True def test_Add_is_positive_2(): e = Rational(1, 3) - sqrt(8) assert e.is_positive is False assert e.is_negative is True e = pi - 1 assert e.is_positive is True assert e.is_negative is False def test_Add_is_irrational(): i = Symbol('i', irrational=True) assert i.is_irrational is True assert i.is_rational is False assert (i + 1).is_irrational is True assert (i + 1).is_rational is False def test_Mul_is_irrational(): expr = Mul(1, 2, 3, evaluate=False) assert expr.is_irrational is False expr = Mul(1, I, I, evaluate=False) assert expr.is_irrational is not False expr = Mul(sqrt(2), I, I, evaluate=False) assert expr.is_irrational is not True @XFAIL def test_issue_3531(): class MightyNumeric(tuple): def __rdiv__(self, other): return "something" def __rtruediv__(self, other): return "something" assert sympify(1)/MightyNumeric((1, 2)) == "something" def test_issue_3531b(): class Foo: def __init__(self): self.field = 1.0 def __mul__(self, other): self.field = self.field * other def __rmul__(self, other): self.field = other * self.field f = Foo() x = Symbol("x") assert f*x == x*f def test_bug3(): a = Symbol("a") b = Symbol("b", positive=True) e = 2*a + b f = b + 2*a assert e == f def test_suppressed_evaluation(): a = Add(0, 3, 2, evaluate=False) b = Mul(1, 3, 2, evaluate=False) c = Pow(3, 2, evaluate=False) assert a != 6 assert a.func is Add assert a.args == (3, 2) assert b != 6 assert b.func is Mul assert b.args == (3, 2) assert c != 9 assert c.func is Pow assert c.args == (3, 2) def test_Add_as_coeff_mul(): # issue 5524. These should all be (1, self) assert (x + 1).as_coeff_mul() == (1, (x + 1,)) assert (x + 2).as_coeff_mul() == (1, (x + 2,)) assert (x + 3).as_coeff_mul() == (1, (x + 3,)) assert (x - 1).as_coeff_mul() == (1, (x - 1,)) assert (x - 2).as_coeff_mul() == (1, (x - 2,)) assert (x - 3).as_coeff_mul() == (1, (x - 3,)) n = Symbol('n', integer=True) assert (n + 1).as_coeff_mul() == (1, (n + 1,)) assert (n + 2).as_coeff_mul() == (1, (n + 2,)) assert (n + 3).as_coeff_mul() == (1, (n + 3,)) assert (n - 1).as_coeff_mul() == (1, (n - 1,)) assert (n - 2).as_coeff_mul() == (1, (n - 2,)) assert (n - 3).as_coeff_mul() == (1, (n - 3,)) def test_Pow_as_coeff_mul_doesnt_expand(): assert exp(x + y).as_coeff_mul() == (1, (exp(x + y),)) assert exp(x + exp(x + y)) != exp(x + exp(x)*exp(y)) def test_issue_3514_18626(): assert sqrt(S.Half) * sqrt(6) == 2 * sqrt(3)/2 assert S.Half*sqrt(6)*sqrt(2) == sqrt(3) assert sqrt(6)/2*sqrt(2) == sqrt(3) assert sqrt(6)*sqrt(2)/2 == sqrt(3) assert sqrt(8)**Rational(2, 3) == 2 def test_make_args(): assert Add.make_args(x) == (x,) assert Mul.make_args(x) == (x,) assert Add.make_args(x*y*z) == (x*y*z,) assert Mul.make_args(x*y*z) == (x*y*z).args assert Add.make_args(x + y + z) == (x + y + z).args assert Mul.make_args(x + y + z) == (x + y + z,) assert Add.make_args((x + y)**z) == ((x + y)**z,) assert Mul.make_args((x + y)**z) == ((x + y)**z,) def test_issue_5126(): assert (-2)**x*(-3)**x != 6**x i = Symbol('i', integer=1) assert (-2)**i*(-3)**i == 6**i def test_Rational_as_content_primitive(): c, p = S.One, S.Zero assert (c*p).as_content_primitive() == (c, p) c, p = S.Half, S.One assert (c*p).as_content_primitive() == (c, p) def test_Add_as_content_primitive(): assert (x + 2).as_content_primitive() == (1, x + 2) assert (3*x + 2).as_content_primitive() == (1, 3*x + 2) assert (3*x + 3).as_content_primitive() == (3, x + 1) assert (3*x + 6).as_content_primitive() == (3, x + 2) assert (3*x + 2*y).as_content_primitive() == (1, 3*x + 2*y) assert (3*x + 3*y).as_content_primitive() == (3, x + y) assert (3*x + 6*y).as_content_primitive() == (3, x + 2*y) assert (3/x + 2*x*y*z**2).as_content_primitive() == (1, 3/x + 2*x*y*z**2) assert (3/x + 3*x*y*z**2).as_content_primitive() == (3, 1/x + x*y*z**2) assert (3/x + 6*x*y*z**2).as_content_primitive() == (3, 1/x + 2*x*y*z**2) assert (2*x/3 + 4*y/9).as_content_primitive() == \ (Rational(2, 9), 3*x + 2*y) assert (2*x/3 + 2.5*y).as_content_primitive() == \ (Rational(1, 3), 2*x + 7.5*y) # the coefficient may sort to a position other than 0 p = 3 + x + y assert (2*p).expand().as_content_primitive() == (2, p) assert (2.0*p).expand().as_content_primitive() == (1, 2.*p) p *= -1 assert (2*p).expand().as_content_primitive() == (2, p) def test_Mul_as_content_primitive(): assert (2*x).as_content_primitive() == (2, x) assert (x*(2 + 2*x)).as_content_primitive() == (2, x*(1 + x)) assert (x*(2 + 2*y)*(3*x + 3)**2).as_content_primitive() == \ (18, x*(1 + y)*(x + 1)**2) assert ((2 + 2*x)**2*(3 + 6*x) + S.Half).as_content_primitive() == \ (S.Half, 24*(x + 1)**2*(2*x + 1) + 1) def test_Pow_as_content_primitive(): assert (x**y).as_content_primitive() == (1, x**y) assert ((2*x + 2)**y).as_content_primitive() == \ (1, (Mul(2, (x + 1), evaluate=False))**y) assert ((2*x + 2)**3).as_content_primitive() == (8, (x + 1)**3) def test_issue_5460(): u = Mul(2, (1 + x), evaluate=False) assert (2 + u).args == (2, u) def test_product_irrational(): from sympy import I, pi assert (I*pi).is_irrational is False # The following used to be deduced from the above bug: assert (I*pi).is_positive is False def test_issue_5919(): assert (x/(y*(1 + y))).expand() == x/(y**2 + y) def test_Mod(): assert Mod(x, 1).func is Mod assert pi % pi is S.Zero assert Mod(5, 3) == 2 assert Mod(-5, 3) == 1 assert Mod(5, -3) == -1 assert Mod(-5, -3) == -2 assert type(Mod(3.2, 2, evaluate=False)) == Mod assert 5 % x == Mod(5, x) assert x % 5 == Mod(x, 5) assert x % y == Mod(x, y) assert (x % y).subs({x: 5, y: 3}) == 2 assert Mod(nan, 1) is nan assert Mod(1, nan) is nan assert Mod(nan, nan) is nan Mod(0, x) == 0 with raises(ZeroDivisionError): Mod(x, 0) k = Symbol('k', integer=True) m = Symbol('m', integer=True, positive=True) assert (x**m % x).func is Mod assert (k**(-m) % k).func is Mod assert k**m % k == 0 assert (-2*k)**m % k == 0 # Float handling point3 = Float(3.3) % 1 assert (x - 3.3) % 1 == Mod(1.*x + 1 - point3, 1) assert Mod(-3.3, 1) == 1 - point3 assert Mod(0.7, 1) == Float(0.7) e = Mod(1.3, 1) assert comp(e, .3) and e.is_Float e = Mod(1.3, .7) assert comp(e, .6) and e.is_Float e = Mod(1.3, Rational(7, 10)) assert comp(e, .6) and e.is_Float e = Mod(Rational(13, 10), 0.7) assert comp(e, .6) and e.is_Float e = Mod(Rational(13, 10), Rational(7, 10)) assert comp(e, .6) and e.is_Rational # check that sign is right r2 = sqrt(2) r3 = sqrt(3) for i in [-r3, -r2, r2, r3]: for j in [-r3, -r2, r2, r3]: assert verify_numerically(i % j, i.n() % j.n()) for _x in range(4): for _y in range(9): reps = [(x, _x), (y, _y)] assert Mod(3*x + y, 9).subs(reps) == (3*_x + _y) % 9 # denesting t = Symbol('t', real=True) assert Mod(Mod(x, t), t) == Mod(x, t) assert Mod(-Mod(x, t), t) == Mod(-x, t) assert Mod(Mod(x, 2*t), t) == Mod(x, t) assert Mod(-Mod(x, 2*t), t) == Mod(-x, t) assert Mod(Mod(x, t), 2*t) == Mod(x, t) assert Mod(-Mod(x, t), -2*t) == -Mod(x, t) for i in [-4, -2, 2, 4]: for j in [-4, -2, 2, 4]: for k in range(4): assert Mod(Mod(x, i), j).subs({x: k}) == (k % i) % j assert Mod(-Mod(x, i), j).subs({x: k}) == -(k % i) % j # known difference assert Mod(5*sqrt(2), sqrt(5)) == 5*sqrt(2) - 3*sqrt(5) p = symbols('p', positive=True) assert Mod(2, p + 3) == 2 assert Mod(-2, p + 3) == p + 1 assert Mod(2, -p - 3) == -p - 1 assert Mod(-2, -p - 3) == -2 assert Mod(p + 5, p + 3) == 2 assert Mod(-p - 5, p + 3) == p + 1 assert Mod(p + 5, -p - 3) == -p - 1 assert Mod(-p - 5, -p - 3) == -2 assert Mod(p + 1, p - 1).func is Mod # handling sums assert (x + 3) % 1 == Mod(x, 1) assert (x + 3.0) % 1 == Mod(1.*x, 1) assert (x - S(33)/10) % 1 == Mod(x + S(7)/10, 1) a = Mod(.6*x + y, .3*y) b = Mod(0.1*y + 0.6*x, 0.3*y) # Test that a, b are equal, with 1e-14 accuracy in coefficients eps = 1e-14 assert abs((a.args[0] - b.args[0]).subs({x: 1, y: 1})) < eps assert abs((a.args[1] - b.args[1]).subs({x: 1, y: 1})) < eps assert (x + 1) % x == 1 % x assert (x + y) % x == y % x assert (x + y + 2) % x == (y + 2) % x assert (a + 3*x + 1) % (2*x) == Mod(a + x + 1, 2*x) assert (12*x + 18*y) % (3*x) == 3*Mod(6*y, x) # gcd extraction assert (-3*x) % (-2*y) == -Mod(3*x, 2*y) assert (.6*pi) % (.3*x*pi) == 0.3*pi*Mod(2, x) assert (.6*pi) % (.31*x*pi) == pi*Mod(0.6, 0.31*x) assert (6*pi) % (.3*x*pi) == 0.3*pi*Mod(20, x) assert (6*pi) % (.31*x*pi) == pi*Mod(6, 0.31*x) assert (6*pi) % (.42*x*pi) == pi*Mod(6, 0.42*x) assert (12*x) % (2*y) == 2*Mod(6*x, y) assert (12*x) % (3*5*y) == 3*Mod(4*x, 5*y) assert (12*x) % (15*x*y) == 3*x*Mod(4, 5*y) assert (-2*pi) % (3*pi) == pi assert (2*x + 2) % (x + 1) == 0 assert (x*(x + 1)) % (x + 1) == (x + 1)*Mod(x, 1) assert Mod(5.0*x, 0.1*y) == 0.1*Mod(50*x, y) i = Symbol('i', integer=True) assert (3*i*x) % (2*i*y) == i*Mod(3*x, 2*y) assert Mod(4*i, 4) == 0 # issue 8677 n = Symbol('n', integer=True, positive=True) assert factorial(n) % n == 0 assert factorial(n + 2) % n == 0 assert (factorial(n + 4) % (n + 5)).func is Mod # Wilson's theorem factorial(18042, evaluate=False) % 18043 == 18042 p = Symbol('n', prime=True) factorial(p - 1) % p == p - 1 factorial(p - 1) % -p == -1 (factorial(3, evaluate=False) % 4).doit() == 2 n = Symbol('n', composite=True, odd=True) factorial(n - 1) % n == 0 # symbolic with known parity n = Symbol('n', even=True) assert Mod(n, 2) == 0 n = Symbol('n', odd=True) assert Mod(n, 2) == 1 # issue 10963 assert (x**6000%400).args[1] == 400 #issue 13543 assert Mod(Mod(x + 1, 2) + 1 , 2) == Mod(x,2) assert Mod(Mod(x + 2, 4)*(x + 4), 4) == Mod(x*(x + 2), 4) assert Mod(Mod(x + 2, 4)*4, 4) == 0 # issue 15493 i, j = symbols('i j', integer=True, positive=True) assert Mod(3*i, 2) == Mod(i, 2) assert Mod(8*i/j, 4) == 4*Mod(2*i/j, 1) assert Mod(8*i, 4) == 0 # rewrite assert Mod(x, y).rewrite(floor) == x - y*floor(x/y) assert ((x - Mod(x, y))/y).rewrite(floor) == floor(x/y) def test_Mod_Pow(): # modular exponentiation assert isinstance(Mod(Pow(2, 2, evaluate=False), 3), Integer) assert Mod(Pow(4, 13, evaluate=False), 497) == Mod(Pow(4, 13), 497) assert Mod(Pow(2, 10000000000, evaluate=False), 3) == 1 assert Mod(Pow(32131231232, 9**10**6, evaluate=False),10**12) == \ pow(32131231232,9**10**6,10**12) assert Mod(Pow(33284959323, 123**999, evaluate=False),11**13) == \ pow(33284959323,123**999,11**13) assert Mod(Pow(78789849597, 333**555, evaluate=False),12**9) == \ pow(78789849597,333**555,12**9) # modular nested exponentiation expr = Pow(2, 2, evaluate=False) expr = Pow(2, expr, evaluate=False) assert Mod(expr, 3**10) == 16 expr = Pow(2, expr, evaluate=False) assert Mod(expr, 3**10) == 6487 expr = Pow(2, expr, evaluate=False) assert Mod(expr, 3**10) == 32191 expr = Pow(2, expr, evaluate=False) assert Mod(expr, 3**10) == 18016 expr = Pow(2, expr, evaluate=False) assert Mod(expr, 3**10) == 5137 expr = Pow(2, 2, evaluate=False) expr = Pow(expr, 2, evaluate=False) assert Mod(expr, 3**10) == 16 expr = Pow(expr, 2, evaluate=False) assert Mod(expr, 3**10) == 256 expr = Pow(expr, 2, evaluate=False) assert Mod(expr, 3**10) == 6487 expr = Pow(expr, 2, evaluate=False) assert Mod(expr, 3**10) == 38281 expr = Pow(expr, 2, evaluate=False) assert Mod(expr, 3**10) == 15928 @XFAIL def test_failing_Mod_Pow_nested(): expr = Pow(2, 2, evaluate=False) expr = Pow(expr, expr, evaluate=False) assert Mod(expr, 3**10) == 256 expr = Pow(expr, expr, evaluate=False) assert Mod(expr, 3**10) == 9229 expr = Pow(expr, expr, evaluate=False) assert Mod(expr, 3**10) == 25708 expr = Pow(expr, expr, evaluate=False) assert Mod(expr, 3**10) == 26608 # XXX This fails in nondeterministic way because of the overflow # error in mpmath expr = Pow(expr, expr, evaluate=False) assert Mod(expr, 3**10) == 1966 def test_Mod_is_integer(): p = Symbol('p', integer=True) q1 = Symbol('q1', integer=True) q2 = Symbol('q2', integer=True, nonzero=True) assert Mod(x, y).is_integer is None assert Mod(p, q1).is_integer is None assert Mod(x, q2).is_integer is None assert Mod(p, q2).is_integer def test_Mod_is_nonposneg(): n = Symbol('n', integer=True) k = Symbol('k', integer=True, positive=True) assert (n%3).is_nonnegative assert Mod(n, -3).is_nonpositive assert Mod(n, k).is_nonnegative assert Mod(n, -k).is_nonpositive assert Mod(k, n).is_nonnegative is None def test_issue_6001(): A = Symbol("A", commutative=False) eq = A + A**2 # it doesn't matter whether it's True or False; they should # just all be the same assert ( eq.is_commutative == (eq + 1).is_commutative == (A + 1).is_commutative) B = Symbol("B", commutative=False) # Although commutative terms could cancel we return True # meaning "there are non-commutative symbols; aftersubstitution # that definition can change, e.g. (A*B).subs(B,A**-1) -> 1 assert (sqrt(2)*A).is_commutative is False assert (sqrt(2)*A*B).is_commutative is False def test_polar(): from sympy import polar_lift p = Symbol('p', polar=True) x = Symbol('x') assert p.is_polar assert x.is_polar is None assert S.One.is_polar is None assert (p**x).is_polar is True assert (x**p).is_polar is None assert ((2*p)**x).is_polar is True assert (2*p).is_polar is True assert (-2*p).is_polar is not True assert (polar_lift(-2)*p).is_polar is True q = Symbol('q', polar=True) assert (p*q)**2 == p**2 * q**2 assert (2*q)**2 == 4 * q**2 assert ((p*q)**x).expand() == p**x * q**x def test_issue_6040(): a, b = Pow(1, 2, evaluate=False), S.One assert a != b assert b != a assert not (a == b) assert not (b == a) def test_issue_6082(): # Comparison is symmetric assert Basic.compare(Max(x, 1), Max(x, 2)) == \ - Basic.compare(Max(x, 2), Max(x, 1)) # Equal expressions compare equal assert Basic.compare(Max(x, 1), Max(x, 1)) == 0 # Basic subtypes (such as Max) compare different than standard types assert Basic.compare(Max(1, x), frozenset((1, x))) != 0 def test_issue_6077(): assert x**2.0/x == x**1.0 assert x/x**2.0 == x**-1.0 assert x*x**2.0 == x**3.0 assert x**1.5*x**2.5 == x**4.0 assert 2**(2.0*x)/2**x == 2**(1.0*x) assert 2**x/2**(2.0*x) == 2**(-1.0*x) assert 2**x*2**(2.0*x) == 2**(3.0*x) assert 2**(1.5*x)*2**(2.5*x) == 2**(4.0*x) def test_mul_flatten_oo(): p = symbols('p', positive=True) n, m = symbols('n,m', negative=True) x_im = symbols('x_im', imaginary=True) assert n*oo is -oo assert n*m*oo is oo assert p*oo is oo assert x_im*oo != I*oo # i could be +/- 3*I -> +/-oo def test_add_flatten(): # see https://github.com/sympy/sympy/issues/2633#issuecomment-29545524 a = oo + I*oo b = oo - I*oo assert a + b is nan assert a - b is nan # FIXME: This evaluates as: # >>> 1/a # 0*(oo + oo*I) # which should not simplify to 0. Should be fixed in Pow.eval #assert (1/a).simplify() == (1/b).simplify() == 0 a = Pow(2, 3, evaluate=False) assert a + a == 16 def test_issue_5160_6087_6089_6090(): # issue 6087 assert ((-2*x*y**y)**3.2).n(2) == (2**3.2*(-x*y**y)**3.2).n(2) # issue 6089 A, B, C = symbols('A,B,C', commutative=False) assert (2.*B*C)**3 == 8.0*(B*C)**3 assert (-2.*B*C)**3 == -8.0*(B*C)**3 assert (-2*B*C)**2 == 4*(B*C)**2 # issue 5160 assert sqrt(-1.0*x) == 1.0*sqrt(-x) assert sqrt(1.0*x) == 1.0*sqrt(x) # issue 6090 assert (-2*x*y*A*B)**2 == 4*x**2*y**2*(A*B)**2 def test_float_int_round(): assert int(float(sqrt(10))) == int(sqrt(10)) assert int(pi**1000) % 10 == 2 assert int(Float('1.123456789012345678901234567890e20', '')) == \ int(112345678901234567890) assert int(Float('1.123456789012345678901234567890e25', '')) == \ int(11234567890123456789012345) # decimal forces float so it's not an exact integer ending in 000000 assert int(Float('1.123456789012345678901234567890e35', '')) == \ 112345678901234567890123456789000192 assert int(Float('123456789012345678901234567890e5', '')) == \ 12345678901234567890123456789000000 assert Integer(Float('1.123456789012345678901234567890e20', '')) == \ 112345678901234567890 assert Integer(Float('1.123456789012345678901234567890e25', '')) == \ 11234567890123456789012345 # decimal forces float so it's not an exact integer ending in 000000 assert Integer(Float('1.123456789012345678901234567890e35', '')) == \ 112345678901234567890123456789000192 assert Integer(Float('123456789012345678901234567890e5', '')) == \ 12345678901234567890123456789000000 assert same_and_same_prec(Float('123000e-2',''), Float('1230.00', '')) assert same_and_same_prec(Float('123000e2',''), Float('12300000', '')) assert int(1 + Rational('.9999999999999999999999999')) == 1 assert int(pi/1e20) == 0 assert int(1 + pi/1e20) == 1 assert int(Add(1.2, -2, evaluate=False)) == int(1.2 - 2) assert int(Add(1.2, +2, evaluate=False)) == int(1.2 + 2) assert int(Add(1 + Float('.99999999999999999', ''), evaluate=False)) == 1 raises(TypeError, lambda: float(x)) raises(TypeError, lambda: float(sqrt(-1))) assert int(12345678901234567890 + cos(1)**2 + sin(1)**2) == \ 12345678901234567891 def test_issue_6611a(): assert Mul.flatten([3**Rational(1, 3), Pow(-Rational(1, 9), Rational(2, 3), evaluate=False)]) == \ ([Rational(1, 3), (-1)**Rational(2, 3)], [], None) def test_denest_add_mul(): # when working with evaluated expressions make sure they denest eq = x + 1 eq = Add(eq, 2, evaluate=False) eq = Add(eq, 2, evaluate=False) assert Add(*eq.args) == x + 5 eq = x*2 eq = Mul(eq, 2, evaluate=False) eq = Mul(eq, 2, evaluate=False) assert Mul(*eq.args) == 8*x # but don't let them denest unecessarily eq = Mul(-2, x - 2, evaluate=False) assert 2*eq == Mul(-4, x - 2, evaluate=False) assert -eq == Mul(2, x - 2, evaluate=False) def test_mul_coeff(): # It is important that all Numbers be removed from the seq; # This can be tricky when powers combine to produce those numbers p = exp(I*pi/3) assert p**2*x*p*y*p*x*p**2 == x**2*y def test_mul_zero_detection(): nz = Dummy(real=True, zero=False) r = Dummy(extended_real=True) c = Dummy(real=False, complex=True) c2 = Dummy(real=False, complex=True) i = Dummy(imaginary=True) e = nz*r*c assert e.is_imaginary is None assert e.is_extended_real is None e = nz*c assert e.is_imaginary is None assert e.is_extended_real is False e = nz*i*c assert e.is_imaginary is False assert e.is_extended_real is None # check for more than one complex; it is important to use # uniquely named Symbols to ensure that two factors appear # e.g. if the symbols have the same name they just become # a single factor, a power. e = nz*i*c*c2 assert e.is_imaginary is None assert e.is_extended_real is None # _eval_is_extended_real and _eval_is_zero both employ trapping of the # zero value so args should be tested in both directions and # TO AVOID GETTING THE CACHED RESULT, Dummy MUST BE USED # real is unknown def test(z, b, e): if z.is_zero and b.is_finite: assert e.is_extended_real and e.is_zero else: assert e.is_extended_real is None if b.is_finite: if z.is_zero: assert e.is_zero else: assert e.is_zero is None elif b.is_finite is False: if z.is_zero is None: assert e.is_zero is None else: assert e.is_zero is False for iz, ib in cartes(*[[True, False, None]]*2): z = Dummy('z', nonzero=iz) b = Dummy('f', finite=ib) e = Mul(z, b, evaluate=False) test(z, b, e) z = Dummy('nz', nonzero=iz) b = Dummy('f', finite=ib) e = Mul(b, z, evaluate=False) test(z, b, e) # real is True def test(z, b, e): if z.is_zero and not b.is_finite: assert e.is_extended_real is None else: assert e.is_extended_real is True for iz, ib in cartes(*[[True, False, None]]*2): z = Dummy('z', nonzero=iz, extended_real=True) b = Dummy('b', finite=ib, extended_real=True) e = Mul(z, b, evaluate=False) test(z, b, e) z = Dummy('z', nonzero=iz, extended_real=True) b = Dummy('b', finite=ib, extended_real=True) e = Mul(b, z, evaluate=False) test(z, b, e) def test_Mul_with_zero_infinite(): zer = Dummy(zero=True) inf = Dummy(finite=False) e = Mul(zer, inf, evaluate=False) assert e.is_extended_positive is None assert e.is_hermitian is None e = Mul(inf, zer, evaluate=False) assert e.is_extended_positive is None assert e.is_hermitian is None def test_Mul_does_not_cancel_infinities(): a, b = symbols('a b') assert ((zoo + 3*a)/(3*a + zoo)) is nan assert ((b - oo)/(b - oo)) is nan # issue 13904 expr = (1/(a+b) + 1/(a-b))/(1/(a+b) - 1/(a-b)) assert expr.subs(b, a) is nan def test_Mul_does_not_distribute_infinity(): a, b = symbols('a b') assert ((1 + I)*oo).is_Mul assert ((a + b)*(-oo)).is_Mul assert ((a + 1)*zoo).is_Mul assert ((1 + I)*oo).is_finite is False z = (1 + I)*oo assert ((1 - I)*z).expand() is oo def test_issue_8247_8354(): from sympy import tan z = sqrt(1 + sqrt(3)) + sqrt(3 + 3*sqrt(3)) - sqrt(10 + 6*sqrt(3)) assert z.is_positive is False # it's 0 z = S('''-2**(1/3)*(3*sqrt(93) + 29)**2 - 4*(3*sqrt(93) + 29)**(4/3) + 12*sqrt(93)*(3*sqrt(93) + 29)**(1/3) + 116*(3*sqrt(93) + 29)**(1/3) + 174*2**(1/3)*sqrt(93) + 1678*2**(1/3)''') assert z.is_positive is False # it's 0 z = 2*(-3*tan(19*pi/90) + sqrt(3))*cos(11*pi/90)*cos(19*pi/90) - \ sqrt(3)*(-3 + 4*cos(19*pi/90)**2) assert z.is_positive is not True # it's zero and it shouldn't hang z = S('''9*(3*sqrt(93) + 29)**(2/3)*((3*sqrt(93) + 29)**(1/3)*(-2**(2/3)*(3*sqrt(93) + 29)**(1/3) - 2) - 2*2**(1/3))**3 + 72*(3*sqrt(93) + 29)**(2/3)*(81*sqrt(93) + 783) + (162*sqrt(93) + 1566)*((3*sqrt(93) + 29)**(1/3)*(-2**(2/3)*(3*sqrt(93) + 29)**(1/3) - 2) - 2*2**(1/3))**2''') assert z.is_positive is False # it's 0 (and a single _mexpand isn't enough) def test_Add_is_zero(): x, y = symbols('x y', zero=True) assert (x + y).is_zero # Issue 15873 e = -2*I + (1 + I)**2 assert e.is_zero is None def test_issue_14392(): assert (sin(zoo)**2).as_real_imag() == (nan, nan) def test_divmod(): assert divmod(x, y) == (x//y, x % y) assert divmod(x, 3) == (x//3, x % 3) assert divmod(3, x) == (3//x, 3 % x) def test__neg__(): assert -(x*y) == -x*y assert -(-x*y) == x*y assert -(1.*x) == -1.*x assert -(-1.*x) == 1.*x assert -(2.*x) == -2.*x assert -(-2.*x) == 2.*x with distribute(False): eq = -(x + y) assert eq.is_Mul and eq.args == (-1, x + y) def test_issue_18507(): assert Mul(zoo, zoo, 0) is nan
8b098c5fb8710bfef70ae5fd062cde01c8be70ee090eafb2d6c89c2815c4180e
from sympy.core.rules import Transform from sympy.testing.pytest import raises def test_Transform(): add1 = Transform(lambda x: x + 1, lambda x: x % 2 == 1) assert add1[1] == 2 assert (1 in add1) is True assert add1.get(1) == 2 raises(KeyError, lambda: add1[2]) assert (2 in add1) is False assert add1.get(2) is None
aa9ee1204265de46c35f8c3c955d173cb2dec0e16a6c90b589d0eff0d51c2961
from sympy import symbols, Matrix, Tuple from sympy.core.trace import Tr from sympy.testing.pytest import raises def test_trace_new(): a, b, c, d, Y = symbols('a b c d Y') A, B, C, D = symbols('A B C D', commutative=False) assert Tr(a + b) == a + b assert Tr(A + B) == Tr(A) + Tr(B) #check trace args not implicitly permuted assert Tr(C*D*A*B).args[0].args == (C, D, A, B) # check for mul and adds assert Tr((a*b) + ( c*d)) == (a*b) + (c*d) # Tr(scalar*A) = scalar*Tr(A) assert Tr(a*A) == a*Tr(A) assert Tr(a*A*B*b) == a*b*Tr(A*B) # since A is symbol and not commutative assert isinstance(Tr(A), Tr) #POW assert Tr(pow(a, b)) == a**b assert isinstance(Tr(pow(A, a)), Tr) #Matrix M = Matrix([[1, 1], [2, 2]]) assert Tr(M) == 3 ##test indices in different forms #no index t = Tr(A) assert t.args[1] == Tuple() #single index t = Tr(A, 0) assert t.args[1] == Tuple(0) #index in a list t = Tr(A, [0]) assert t.args[1] == Tuple(0) t = Tr(A, [0, 1, 2]) assert t.args[1] == Tuple(0, 1, 2) #index is tuple t = Tr(A, (0)) assert t.args[1] == Tuple(0) t = Tr(A, (1, 2)) assert t.args[1] == Tuple(1, 2) #trace indices test t = Tr((A + B), [2]) assert t.args[0].args[1] == Tuple(2) and t.args[1].args[1] == Tuple(2) t = Tr(a*A, [2, 3]) assert t.args[1].args[1] == Tuple(2, 3) #class with trace method defined #to simulate numpy objects class Foo: def trace(self): return 1 assert Tr(Foo()) == 1 #argument test # check for value error, when either/both arguments are not provided raises(ValueError, lambda: Tr()) raises(ValueError, lambda: Tr(A, 1, 2)) def test_trace_doit(): a, b, c, d = symbols('a b c d') A, B, C, D = symbols('A B C D', commutative=False) #TODO: needed while testing reduced density operations, etc. def test_permute(): A, B, C, D, E, F, G = symbols('A B C D E F G', commutative=False) t = Tr(A*B*C*D*E*F*G) assert t.permute(0).args[0].args == (A, B, C, D, E, F, G) assert t.permute(2).args[0].args == (F, G, A, B, C, D, E) assert t.permute(4).args[0].args == (D, E, F, G, A, B, C) assert t.permute(6).args[0].args == (B, C, D, E, F, G, A) assert t.permute(8).args[0].args == t.permute(1).args[0].args assert t.permute(-1).args[0].args == (B, C, D, E, F, G, A) assert t.permute(-3).args[0].args == (D, E, F, G, A, B, C) assert t.permute(-5).args[0].args == (F, G, A, B, C, D, E) assert t.permute(-8).args[0].args == t.permute(-1).args[0].args t = Tr((A + B)*(B*B)*C*D) assert t.permute(2).args[0].args == (C, D, (A + B), (B**2)) t1 = Tr(A*B) t2 = t1.permute(1) assert id(t1) != id(t2) and t1 == t2
06295f54914cf632f3fa8bd3f5a953b98579251abfd3a1c35b773b99b265809a
from sympy.core.logic import (fuzzy_not, Logic, And, Or, Not, fuzzy_and, fuzzy_or, _fuzzy_group, _torf, fuzzy_nand, fuzzy_xor) from sympy.testing.pytest import raises T = True F = False U = None def test_torf(): from sympy.utilities.iterables import cartes v = [T, F, U] for i in cartes(*[v]*3): assert _torf(i) is (True if all(j for j in i) else (False if all(j is False for j in i) else None)) def test_fuzzy_group(): from sympy.utilities.iterables import cartes v = [T, F, U] for i in cartes(*[v]*3): assert _fuzzy_group(i) is (None if None in i else (True if all(j for j in i) else False)) assert _fuzzy_group(i, quick_exit=True) is \ (None if (i.count(False) > 1) else (None if None in i else (True if all(j for j in i) else False))) it = (True if (i == 0) else None for i in range(2)) assert _torf(it) is None it = (True if (i == 1) else None for i in range(2)) assert _torf(it) is None def test_fuzzy_not(): assert fuzzy_not(T) == F assert fuzzy_not(F) == T assert fuzzy_not(U) == U def test_fuzzy_and(): assert fuzzy_and([T, T]) == T assert fuzzy_and([T, F]) == F assert fuzzy_and([T, U]) == U assert fuzzy_and([F, F]) == F assert fuzzy_and([F, U]) == F assert fuzzy_and([U, U]) == U assert [fuzzy_and([w]) for w in [U, T, F]] == [U, T, F] assert fuzzy_and([T, F, U]) == F assert fuzzy_and([]) == T raises(TypeError, lambda: fuzzy_and()) def test_fuzzy_or(): assert fuzzy_or([T, T]) == T assert fuzzy_or([T, F]) == T assert fuzzy_or([T, U]) == T assert fuzzy_or([F, F]) == F assert fuzzy_or([F, U]) == U assert fuzzy_or([U, U]) == U assert [fuzzy_or([w]) for w in [U, T, F]] == [U, T, F] assert fuzzy_or([T, F, U]) == T assert fuzzy_or([]) == F raises(TypeError, lambda: fuzzy_or()) def test_logic_cmp(): l1 = And('a', Not('b')) l2 = And('a', Not('b')) assert hash(l1) == hash(l2) assert (l1 == l2) == T assert (l1 != l2) == F assert And('a', 'b', 'c') == And('b', 'a', 'c') assert And('a', 'b', 'c') == And('c', 'b', 'a') assert And('a', 'b', 'c') == And('c', 'a', 'b') assert Not('a') < Not('b') assert (Not('b') < Not('a')) is False assert (Not('a') < 2) is False def test_logic_onearg(): assert And() is True assert Or() is False assert And(T) == T assert And(F) == F assert Or(T) == T assert Or(F) == F assert And('a') == 'a' assert Or('a') == 'a' def test_logic_xnotx(): assert And('a', Not('a')) == F assert Or('a', Not('a')) == T def test_logic_eval_TF(): assert And(F, F) == F assert And(F, T) == F assert And(T, F) == F assert And(T, T) == T assert Or(F, F) == F assert Or(F, T) == T assert Or(T, F) == T assert Or(T, T) == T assert And('a', T) == 'a' assert And('a', F) == F assert Or('a', T) == T assert Or('a', F) == 'a' def test_logic_combine_args(): assert And('a', 'b', 'a') == And('a', 'b') assert Or('a', 'b', 'a') == Or('a', 'b') assert And(And('a', 'b'), And('c', 'd')) == And('a', 'b', 'c', 'd') assert Or(Or('a', 'b'), Or('c', 'd')) == Or('a', 'b', 'c', 'd') assert Or('t', And('n', 'p', 'r'), And('n', 'r'), And('n', 'p', 'r'), 't', And('n', 'r')) == Or('t', And('n', 'p', 'r'), And('n', 'r')) def test_logic_expand(): t = And(Or('a', 'b'), 'c') assert t.expand() == Or(And('a', 'c'), And('b', 'c')) t = And(Or('a', Not('b')), 'b') assert t.expand() == And('a', 'b') t = And(Or('a', 'b'), Or('c', 'd')) assert t.expand() == \ Or(And('a', 'c'), And('a', 'd'), And('b', 'c'), And('b', 'd')) def test_logic_fromstring(): S = Logic.fromstring assert S('a') == 'a' assert S('!a') == Not('a') assert S('a & b') == And('a', 'b') assert S('a | b') == Or('a', 'b') assert S('a | b & c') == And(Or('a', 'b'), 'c') assert S('a & b | c') == Or(And('a', 'b'), 'c') assert S('a & b & c') == And('a', 'b', 'c') assert S('a | b | c') == Or('a', 'b', 'c') raises(ValueError, lambda: S('| a')) raises(ValueError, lambda: S('& a')) raises(ValueError, lambda: S('a | | b')) raises(ValueError, lambda: S('a | & b')) raises(ValueError, lambda: S('a & & b')) raises(ValueError, lambda: S('a |')) raises(ValueError, lambda: S('a|b')) raises(ValueError, lambda: S('!')) raises(ValueError, lambda: S('! a')) raises(ValueError, lambda: S('!(a + 1)')) raises(ValueError, lambda: S('')) def test_logic_not(): assert Not('a') != '!a' assert Not('!a') != 'a' assert Not(True) == False assert Not(False) == True # NOTE: we may want to change default Not behaviour and put this # functionality into some method. assert Not(And('a', 'b')) == Or(Not('a'), Not('b')) assert Not(Or('a', 'b')) == And(Not('a'), Not('b')) raises(ValueError, lambda: Not(1)) def test_formatting(): S = Logic.fromstring raises(ValueError, lambda: S('a&b')) raises(ValueError, lambda: S('a|b')) raises(ValueError, lambda: S('! a')) def test_fuzzy_xor(): assert fuzzy_xor((None,)) is None assert fuzzy_xor((None, True)) is None assert fuzzy_xor((None, False)) is None assert fuzzy_xor((True, False)) is True assert fuzzy_xor((True, True)) is False assert fuzzy_xor((True, True, False)) is False assert fuzzy_xor((True, True, False, True)) is True def test_fuzzy_nand(): for args in [(1, 0), (1, 1), (0, 0)]: assert fuzzy_nand(args) == fuzzy_not(fuzzy_and(args))
2b348952e0dcd461c3b8dd1813fe848eded8c85a9fadfcfa9c6c217b14e01b59
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module from sympy.testing.pytest import raises # run_cell was added in IPython 0.11 ipython = import_module("IPython", min_module_version="0.11") # disable tests if ipython is not present if not ipython: disabled = True def test_ipythonprinting(): # Initialize and setup IPython session app = init_ipython_session() app.run_cell("ip = get_ipython()") app.run_cell("inst = ip.instance()") app.run_cell("format = inst.display_formatter.format") app.run_cell("from sympy import Symbol") # Printing without printing extension app.run_cell("a = format(Symbol('pi'))") app.run_cell("a2 = format(Symbol('pi')**2)") # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: assert app.user_ns['a']['text/plain'] == "pi" assert app.user_ns['a2']['text/plain'] == "pi**2" else: assert app.user_ns['a'][0]['text/plain'] == "pi" assert app.user_ns['a2'][0]['text/plain'] == "pi**2" # Load printing extension app.run_cell("from sympy import init_printing") app.run_cell("init_printing()") # Printing with printing extension app.run_cell("a = format(Symbol('pi'))") app.run_cell("a2 = format(Symbol('pi')**2)") # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: assert app.user_ns['a']['text/plain'] in (u'\N{GREEK SMALL LETTER PI}', 'pi') assert app.user_ns['a2']['text/plain'] in (u' 2\n\N{GREEK SMALL LETTER PI} ', ' 2\npi ') else: assert app.user_ns['a'][0]['text/plain'] in (u'\N{GREEK SMALL LETTER PI}', 'pi') assert app.user_ns['a2'][0]['text/plain'] in (u' 2\n\N{GREEK SMALL LETTER PI} ', ' 2\npi ') def test_print_builtin_option(): # Initialize and setup IPython session app = init_ipython_session() app.run_cell("ip = get_ipython()") app.run_cell("inst = ip.instance()") app.run_cell("format = inst.display_formatter.format") app.run_cell("from sympy import Symbol") app.run_cell("from sympy import init_printing") app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})") # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: text = app.user_ns['a']['text/plain'] raises(KeyError, lambda: app.user_ns['a']['text/latex']) else: text = app.user_ns['a'][0]['text/plain'] raises(KeyError, lambda: app.user_ns['a'][0]['text/latex']) # Note : Unicode of Python2 is equivalent to str in Python3. In Python 3 we have one # text type: str which holds Unicode data and two byte types bytes and bytearray. # XXX: How can we make this ignore the terminal width? This test fails if # the terminal is too narrow. assert text in ("{pi: 3.14, n_i: 3}", u'{n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3, \N{GREEK SMALL LETTER PI}: 3.14}', "{n_i: 3, pi: 3.14}", u'{\N{GREEK SMALL LETTER PI}: 3.14, n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3}') # If we enable the default printing, then the dictionary's should render # as a LaTeX version of the whole dict: ${\pi: 3.14, n_i: 3}$ app.run_cell("inst.display_formatter.formatters['text/latex'].enabled = True") app.run_cell("init_printing(use_latex=True)") app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})") # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: text = app.user_ns['a']['text/plain'] latex = app.user_ns['a']['text/latex'] else: text = app.user_ns['a'][0]['text/plain'] latex = app.user_ns['a'][0]['text/latex'] assert text in ("{pi: 3.14, n_i: 3}", u'{n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3, \N{GREEK SMALL LETTER PI}: 3.14}', "{n_i: 3, pi: 3.14}", u'{\N{GREEK SMALL LETTER PI}: 3.14, n\N{LATIN SUBSCRIPT SMALL LETTER I}: 3}') assert latex == r'$\displaystyle \left\{ n_{i} : 3, \ \pi : 3.14\right\}$' app.run_cell("inst.display_formatter.formatters['text/latex'].enabled = True") app.run_cell("init_printing(use_latex=True, print_builtin=False)") app.run_cell("a = format({Symbol('pi'): 3.14, Symbol('n_i'): 3})") # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: text = app.user_ns['a']['text/plain'] raises(KeyError, lambda: app.user_ns['a']['text/latex']) else: text = app.user_ns['a'][0]['text/plain'] raises(KeyError, lambda: app.user_ns['a'][0]['text/latex']) # Note : Unicode of Python2 is equivalent to str in Python3. In Python 3 we have one # text type: str which holds Unicode data and two byte types bytes and bytearray. # Python 3.3.3 + IPython 0.13.2 gives: '{n_i: 3, pi: 3.14}' # Python 3.3.3 + IPython 1.1.0 gives: '{n_i: 3, pi: 3.14}' # Python 2.7.5 + IPython 1.1.0 gives: '{pi: 3.14, n_i: 3}' assert text in ("{pi: 3.14, n_i: 3}", "{n_i: 3, pi: 3.14}") def test_builtin_containers(): # Initialize and setup IPython session app = init_ipython_session() app.run_cell("ip = get_ipython()") app.run_cell("inst = ip.instance()") app.run_cell("format = inst.display_formatter.format") app.run_cell("inst.display_formatter.formatters['text/latex'].enabled = True") app.run_cell("from sympy import init_printing, Matrix") app.run_cell('init_printing(use_latex=True, use_unicode=False)') # Make sure containers that shouldn't pretty print don't. app.run_cell('a = format((True, False))') app.run_cell('import sys') app.run_cell('b = format(sys.flags)') app.run_cell('c = format((Matrix([1, 2]),))') # Deal with API change starting at IPython 1.0 if int(ipython.__version__.split(".")[0]) < 1: assert app.user_ns['a']['text/plain'] == '(True, False)' assert 'text/latex' not in app.user_ns['a'] assert app.user_ns['b']['text/plain'][:10] == 'sys.flags(' assert 'text/latex' not in app.user_ns['b'] assert app.user_ns['c']['text/plain'] == \ """\ [1] \n\ ([ ],) [2] \ """ assert app.user_ns['c']['text/latex'] == '$\\displaystyle \\left( \\left[\\begin{matrix}1\\\\2\\end{matrix}\\right]\\right)$' else: assert app.user_ns['a'][0]['text/plain'] == '(True, False)' assert 'text/latex' not in app.user_ns['a'][0] assert app.user_ns['b'][0]['text/plain'][:10] == 'sys.flags(' assert 'text/latex' not in app.user_ns['b'][0] assert app.user_ns['c'][0]['text/plain'] == \ """\ [1] \n\ ([ ],) [2] \ """ assert app.user_ns['c'][0]['text/latex'] == '$\\displaystyle \\left( \\left[\\begin{matrix}1\\\\2\\end{matrix}\\right]\\right)$' def test_matplotlib_bad_latex(): # Initialize and setup IPython session app = init_ipython_session() app.run_cell("import IPython") app.run_cell("ip = get_ipython()") app.run_cell("inst = ip.instance()") app.run_cell("format = inst.display_formatter.format") app.run_cell("from sympy import init_printing, Matrix") app.run_cell("init_printing(use_latex='matplotlib')") # The png formatter is not enabled by default in this context app.run_cell("inst.display_formatter.formatters['image/png'].enabled = True") # Make sure no warnings are raised by IPython app.run_cell("import warnings") # IPython.core.formatters.FormatterWarning was introduced in IPython 2.0 if int(ipython.__version__.split(".")[0]) < 2: app.run_cell("warnings.simplefilter('error')") else: app.run_cell("warnings.simplefilter('error', IPython.core.formatters.FormatterWarning)") # This should not raise an exception app.run_cell("a = format(Matrix([1, 2, 3]))") # issue 9799 app.run_cell("from sympy import Piecewise, Symbol, Eq") app.run_cell("x = Symbol('x'); pw = format(Piecewise((1, Eq(x, 0)), (0, True)))")
0b1262a09590eca84facf603d0cde013030730559571ce50912871f69baab4cf
"""Benchmarks for polynomials over Galois fields. """ from __future__ import print_function, division from sympy.polys.galoistools import gf_from_dict, gf_factor_sqf from sympy.polys.domains import ZZ from sympy import pi, nextprime def gathen_poly(n, p, K): return gf_from_dict({n: K.one, 1: K.one, 0: K.one}, p, K) def shoup_poly(n, p, K): f = [K.one] * (n + 1) for i in range(1, n + 1): f[i] = (f[i - 1]**2 + K.one) % p return f def genprime(n, K): return K(nextprime(int((2**n * pi).evalf()))) p_10 = genprime(10, ZZ) f_10 = gathen_poly(10, p_10, ZZ) p_20 = genprime(20, ZZ) f_20 = gathen_poly(20, p_20, ZZ) def timeit_gathen_poly_f10_zassenhaus(): gf_factor_sqf(f_10, p_10, ZZ, method='zassenhaus') def timeit_gathen_poly_f10_shoup(): gf_factor_sqf(f_10, p_10, ZZ, method='shoup') def timeit_gathen_poly_f20_zassenhaus(): gf_factor_sqf(f_20, p_20, ZZ, method='zassenhaus') def timeit_gathen_poly_f20_shoup(): gf_factor_sqf(f_20, p_20, ZZ, method='shoup') P_08 = genprime(8, ZZ) F_10 = shoup_poly(10, P_08, ZZ) P_18 = genprime(18, ZZ) F_20 = shoup_poly(20, P_18, ZZ) def timeit_shoup_poly_F10_zassenhaus(): gf_factor_sqf(F_10, P_08, ZZ, method='zassenhaus') def timeit_shoup_poly_F10_shoup(): gf_factor_sqf(F_10, P_08, ZZ, method='shoup') def timeit_shoup_poly_F20_zassenhaus(): gf_factor_sqf(F_20, P_18, ZZ, method='zassenhaus') def timeit_shoup_poly_F20_shoup(): gf_factor_sqf(F_20, P_18, ZZ, method='shoup')
a52033830255653444f23f154b55ac5e5cbfc32384e98fc964b7d5c837abb83a
"""Implementation of :class:`AlgebraicField` class. """ from __future__ import print_function, division from sympy.polys.domains.characteristiczero import CharacteristicZero from sympy.polys.domains.field import Field from sympy.polys.domains.simpledomain import SimpleDomain from sympy.polys.polyclasses import ANP from sympy.polys.polyerrors import CoercionFailed, DomainError, NotAlgebraic, IsomorphismFailed from sympy.utilities import public @public class AlgebraicField(Field, CharacteristicZero, SimpleDomain): """A class for representing algebraic number fields. """ dtype = ANP is_AlgebraicField = is_Algebraic = True is_Numerical = True has_assoc_Ring = False has_assoc_Field = True def __init__(self, dom, *ext): if not dom.is_QQ: raise DomainError("ground domain must be a rational field") from sympy.polys.numberfields import to_number_field if len(ext) == 1 and isinstance(ext[0], tuple): self.orig_ext = ext[0][1:] else: self.orig_ext = ext self.ext = to_number_field(ext) self.mod = self.ext.minpoly.rep self.domain = self.dom = dom self.ngens = 1 self.symbols = self.gens = (self.ext,) self.unit = self([dom(1), dom(0)]) self.zero = self.dtype.zero(self.mod.rep, dom) self.one = self.dtype.one(self.mod.rep, dom) def new(self, element): return self.dtype(element, self.mod.rep, self.dom) def __str__(self): return str(self.dom) + '<' + str(self.ext) + '>' def __hash__(self): return hash((self.__class__.__name__, self.dtype, self.dom, self.ext)) def __eq__(self, other): """Returns ``True`` if two domains are equivalent. """ return isinstance(other, AlgebraicField) and \ self.dtype == other.dtype and self.ext == other.ext def algebraic_field(self, *extension): r"""Returns an algebraic field, i.e. `\mathbb{Q}(\alpha, \ldots)`. """ return AlgebraicField(self.dom, *((self.ext,) + extension)) def to_sympy(self, a): """Convert ``a`` to a SymPy object. """ from sympy.polys.numberfields import AlgebraicNumber return AlgebraicNumber(self.ext, a).as_expr() def from_sympy(self, a): """Convert SymPy's expression to ``dtype``. """ try: return self([self.dom.from_sympy(a)]) except CoercionFailed: pass from sympy.polys.numberfields import to_number_field try: return self(to_number_field(a, self.ext).native_coeffs()) except (NotAlgebraic, IsomorphismFailed): raise CoercionFailed( "%s is not a valid algebraic number in %s" % (a, self)) def from_ZZ_python(K1, a, K0): """Convert a Python ``int`` object to ``dtype``. """ return K1(K1.dom.convert(a, K0)) def from_QQ_python(K1, a, K0): """Convert a Python ``Fraction`` object to ``dtype``. """ return K1(K1.dom.convert(a, K0)) def from_ZZ_gmpy(K1, a, K0): """Convert a GMPY ``mpz`` object to ``dtype``. """ return K1(K1.dom.convert(a, K0)) def from_QQ_gmpy(K1, a, K0): """Convert a GMPY ``mpq`` object to ``dtype``. """ return K1(K1.dom.convert(a, K0)) def from_RealField(K1, a, K0): """Convert a mpmath ``mpf`` object to ``dtype``. """ return K1(K1.dom.convert(a, K0)) def get_ring(self): """Returns a ring associated with ``self``. """ raise DomainError('there is no ring associated with %s' % self) def is_positive(self, a): """Returns True if ``a`` is positive. """ return self.dom.is_positive(a.LC()) def is_negative(self, a): """Returns True if ``a`` is negative. """ return self.dom.is_negative(a.LC()) def is_nonpositive(self, a): """Returns True if ``a`` is non-positive. """ return self.dom.is_nonpositive(a.LC()) def is_nonnegative(self, a): """Returns True if ``a`` is non-negative. """ return self.dom.is_nonnegative(a.LC()) def numer(self, a): """Returns numerator of ``a``. """ return a def denom(self, a): """Returns denominator of ``a``. """ return self.one def from_AlgebraicField(K1, a, K0): """Convert AlgebraicField element 'a' to another AlgebraicField """ return K1.from_sympy(K0.to_sympy(a))
0f9343fcfb382c1edea76d27f7b835c0aa3e6c5a1b6630c7b56498762c373184
"""Rational number type based on Python integers. """ from __future__ import print_function, division import operator from sympy.core.numbers import Rational, Integer from sympy.core.sympify import converter from sympy.polys.polyutils import PicklableWithSlots from sympy.polys.domains.domainelement import DomainElement from sympy.printing.defaults import DefaultPrinting from sympy.utilities import public @public class PythonRational(DefaultPrinting, PicklableWithSlots, DomainElement): """ Rational number type based on Python integers. This was supposed to be needed for compatibility with older Python versions which don't support Fraction. However, Fraction is very slow so we don't use it anyway. Examples ======== >>> from sympy.polys.domains import PythonRational >>> PythonRational(1) 1 >>> PythonRational(2, 3) 2/3 >>> PythonRational(14, 10) 7/5 """ __slots__ = ('p', 'q') def parent(self): from sympy.polys.domains import PythonRationalField return PythonRationalField() def __init__(self, p, q=1, _gcd=True): from sympy.polys.domains.groundtypes import python_gcd as gcd if isinstance(p, Integer): p = p.p elif isinstance(p, Rational): p, q = p.p, p.q if not q: raise ZeroDivisionError('rational number') elif q < 0: p, q = -p, -q if not p: self.p = 0 self.q = 1 elif p == 1 or q == 1: self.p = p self.q = q else: if _gcd: x = gcd(p, q) if x != 1: p //= x q //= x self.p = p self.q = q @classmethod def new(cls, p, q): obj = object.__new__(cls) obj.p = p obj.q = q return obj def __hash__(self): if self.q == 1: return hash(self.p) else: return hash((self.p, self.q)) def __int__(self): p, q = self.p, self.q if p < 0: return -(-p//q) return p//q def __float__(self): return float(self.p)/self.q def __abs__(self): return self.new(abs(self.p), self.q) def __pos__(self): return self.new(+self.p, self.q) def __neg__(self): return self.new(-self.p, self.q) def __add__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if isinstance(other, PythonRational): ap, aq, bp, bq = self.p, self.q, other.p, other.q g = gcd(aq, bq) if g == 1: p = ap*bq + aq*bp q = bq*aq else: q1, q2 = aq//g, bq//g p, q = ap*q2 + bp*q1, q1*q2 g2 = gcd(p, g) p, q = (p // g2), q * (g // g2) elif isinstance(other, int): p = self.p + self.q*other q = self.q else: return NotImplemented return self.__class__(p, q, _gcd=False) def __radd__(self, other): if not isinstance(other, int): return NotImplemented p = self.p + self.q*other q = self.q return self.__class__(p, q, _gcd=False) def __sub__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if isinstance(other, PythonRational): ap, aq, bp, bq = self.p, self.q, other.p, other.q g = gcd(aq, bq) if g == 1: p = ap*bq - aq*bp q = bq*aq else: q1, q2 = aq//g, bq//g p, q = ap*q2 - bp*q1, q1*q2 g2 = gcd(p, g) p, q = (p // g2), q * (g // g2) elif isinstance(other, int): p = self.p - self.q*other q = self.q else: return NotImplemented return self.__class__(p, q, _gcd=False) def __rsub__(self, other): if not isinstance(other, int): return NotImplemented p = self.q*other - self.p q = self.q return self.__class__(p, q, _gcd=False) def __mul__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if isinstance(other, PythonRational): ap, aq, bp, bq = self.p, self.q, other.p, other.q x1 = gcd(ap, bq) x2 = gcd(bp, aq) p, q = ((ap//x1)*(bp//x2), (aq//x2)*(bq//x1)) elif isinstance(other, int): x = gcd(other, self.q) p = self.p*(other//x) q = self.q//x else: return NotImplemented return self.__class__(p, q, _gcd=False) def __rmul__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if not isinstance(other, int): return NotImplemented x = gcd(self.q, other) p = self.p*(other//x) q = self.q//x return self.__class__(p, q, _gcd=False) def __div__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if isinstance(other, PythonRational): ap, aq, bp, bq = self.p, self.q, other.p, other.q x1 = gcd(ap, bp) x2 = gcd(bq, aq) p, q = ((ap//x1)*(bq//x2), (aq//x2)*(bp//x1)) elif isinstance(other, int): x = gcd(other, self.p) p = self.p//x q = self.q*(other//x) else: return NotImplemented return self.__class__(p, q, _gcd=False) __truediv__ = __div__ def __rdiv__(self, other): from sympy.polys.domains.groundtypes import python_gcd as gcd if not isinstance(other, int): return NotImplemented x = gcd(self.p, other) p = self.q*(other//x) q = self.p//x return self.__class__(p, q) __rtruediv__ = __rdiv__ def __mod__(self, other): return self.__class__(0) def __divmod__(self, other): return (self//other, self % other) def __pow__(self, exp): p, q = self.p, self.q if exp < 0: p, q, exp = q, p, -exp return self.__class__(p**exp, q**exp, _gcd=False) def __nonzero__(self): return self.p != 0 __bool__ = __nonzero__ def __eq__(self, other): if isinstance(other, PythonRational): return self.q == other.q and self.p == other.p elif isinstance(other, int): return self.q == 1 and self.p == other else: return False def __ne__(self, other): return not self == other def _cmp(self, other, op): try: diff = self - other except TypeError: return NotImplemented else: return op(diff.p, 0) def __lt__(self, other): return self._cmp(other, operator.lt) def __le__(self, other): return self._cmp(other, operator.le) def __gt__(self, other): return self._cmp(other, operator.gt) def __ge__(self, other): return self._cmp(other, operator.ge) @property def numer(self): return self.p @property def denom(self): return self.q numerator = numer denominator = denom def sympify_pythonrational(arg): return Rational(arg.p, arg.q) converter[PythonRational] = sympify_pythonrational
126a0fdf0c7f0d5708f69af2eccc757ab9f239a457fcd26a27a6f1a841feb89a
"""Implementation of mathematical domains. """ __all__ = ['Domain', 'FiniteField', 'IntegerRing', 'RationalField', 'RealField', 'ComplexField', 'PythonFiniteField', 'GMPYFiniteField', 'PythonIntegerRing', 'GMPYIntegerRing', 'PythonRational', 'GMPYRationalField', 'AlgebraicField', 'PolynomialRing', 'FractionField', 'ExpressionDomain', 'PythonRational'] from .domain import Domain from .finitefield import FiniteField from .integerring import IntegerRing from .rationalfield import RationalField from .realfield import RealField from .complexfield import ComplexField from .pythonfinitefield import PythonFiniteField from .gmpyfinitefield import GMPYFiniteField from .pythonintegerring import PythonIntegerRing from .gmpyintegerring import GMPYIntegerRing from .pythonrationalfield import PythonRationalField from .gmpyrationalfield import GMPYRationalField from .algebraicfield import AlgebraicField from .polynomialring import PolynomialRing from .fractionfield import FractionField from .expressiondomain import ExpressionDomain from .pythonrational import PythonRational FF_python = PythonFiniteField FF_gmpy = GMPYFiniteField ZZ_python = PythonIntegerRing ZZ_gmpy = GMPYIntegerRing QQ_python = PythonRationalField QQ_gmpy = GMPYRationalField RR = RealField() CC = ComplexField() from sympy.core.compatibility import GROUND_TYPES _GROUND_TYPES_MAP = { 'gmpy': (FF_gmpy, ZZ_gmpy(), QQ_gmpy()), 'python': (FF_python, ZZ_python(), QQ_python()), } try: FF, ZZ, QQ = _GROUND_TYPES_MAP[GROUND_TYPES] except KeyError: raise ValueError("invalid ground types: %s" % GROUND_TYPES) GF = FF EX = ExpressionDomain() __all__.extend([ "FF_python", "FF_gmpy", "ZZ_python", "ZZ_gmpy", "QQ_python", "QQ_gmpy", "GF", "FF", "ZZ", "QQ", "RR", "CC", "EX", ])
49f2e0d1092d9195e7ab2443b397c171ed1bbb5fda175fd88359184d9712dcff
"""Implementation of :class:`RealField` class. """ from __future__ import print_function, division from sympy.core.numbers import Float from sympy.polys.domains.field import Field from sympy.polys.domains.simpledomain import SimpleDomain from sympy.polys.domains.characteristiczero import CharacteristicZero from sympy.polys.domains.mpelements import MPContext from sympy.polys.polyerrors import CoercionFailed from sympy.utilities import public @public class RealField(Field, CharacteristicZero, SimpleDomain): """Real numbers up to the given precision. """ rep = 'RR' is_RealField = is_RR = True is_Exact = False is_Numerical = True is_PID = False has_assoc_Ring = False has_assoc_Field = True _default_precision = 53 @property def has_default_precision(self): return self.precision == self._default_precision @property def precision(self): return self._context.prec @property def dps(self): return self._context.dps @property def tolerance(self): return self._context.tolerance def __init__(self, prec=_default_precision, dps=None, tol=None): context = MPContext(prec, dps, tol, True) context._parent = self self._context = context self.dtype = context.mpf self.zero = self.dtype(0) self.one = self.dtype(1) def __eq__(self, other): return (isinstance(other, RealField) and self.precision == other.precision and self.tolerance == other.tolerance) def __hash__(self): return hash((self.__class__.__name__, self.dtype, self.precision, self.tolerance)) def to_sympy(self, element): """Convert ``element`` to SymPy number. """ return Float(element, self.dps) def from_sympy(self, expr): """Convert SymPy's number to ``dtype``. """ number = expr.evalf(n=self.dps) if number.is_Number: return self.dtype(number) else: raise CoercionFailed("expected real number, got %s" % expr) def from_ZZ_python(self, element, base): return self.dtype(element) def from_QQ_python(self, element, base): return self.dtype(element.numerator) / element.denominator def from_ZZ_gmpy(self, element, base): return self.dtype(int(element)) def from_QQ_gmpy(self, element, base): return self.dtype(int(element.numerator)) / int(element.denominator) def from_RealField(self, element, base): if self == base: return element else: return self.dtype(element) def from_ComplexField(self, element, base): if not element.imag: return self.dtype(element.real) def to_rational(self, element, limit=True): """Convert a real number to rational number. """ return self._context.to_rational(element, limit) def get_ring(self): """Returns a ring associated with ``self``. """ return self def get_exact(self): """Returns an exact domain associated with ``self``. """ from sympy.polys.domains import QQ return QQ def gcd(self, a, b): """Returns GCD of ``a`` and ``b``. """ return self.one def lcm(self, a, b): """Returns LCM of ``a`` and ``b``. """ return a*b def almosteq(self, a, b, tolerance=None): """Check if ``a`` and ``b`` are almost equal. """ return self._context.almosteq(a, b, tolerance)
8f2cb0c5b9ab5652be49eb8cb83dbeb1776b25a8a97fde88d886b38d225d6f7b
"""Implementation of :class:`PolynomialRing` class. """ from __future__ import print_function, division from sympy.core.compatibility import iterable from sympy.polys.agca.modules import FreeModulePolyRing from sympy.polys.domains.characteristiczero import CharacteristicZero from sympy.polys.domains.compositedomain import CompositeDomain from sympy.polys.domains.old_fractionfield import FractionField from sympy.polys.domains.ring import Ring from sympy.polys.orderings import monomial_key, build_product_order from sympy.polys.polyclasses import DMP, DMF from sympy.polys.polyerrors import (GeneratorsNeeded, PolynomialError, CoercionFailed, ExactQuotientFailed, NotReversible) from sympy.polys.polyutils import dict_from_basic, basic_from_dict, _dict_reorder from sympy.utilities import public # XXX why does this derive from CharacteristicZero??? @public class PolynomialRingBase(Ring, CharacteristicZero, CompositeDomain): """ Base class for generalized polynomial rings. This base class should be used for uniform access to generalized polynomial rings. Subclasses only supply information about the element storage etc. Do not instantiate. """ has_assoc_Ring = True has_assoc_Field = True default_order = "grevlex" def __init__(self, dom, *gens, **opts): if not gens: raise GeneratorsNeeded("generators not specified") lev = len(gens) - 1 self.ngens = len(gens) self.zero = self.dtype.zero(lev, dom, ring=self) self.one = self.dtype.one(lev, dom, ring=self) self.domain = self.dom = dom self.symbols = self.gens = gens # NOTE 'order' may not be set if inject was called through CompositeDomain self.order = opts.get('order', monomial_key(self.default_order)) def new(self, element): return self.dtype(element, self.dom, len(self.gens) - 1, ring=self) def __str__(self): s_order = str(self.order) orderstr = ( " order=" + s_order) if s_order != self.default_order else "" return str(self.dom) + '[' + ','.join(map(str, self.gens)) + orderstr + ']' def __hash__(self): return hash((self.__class__.__name__, self.dtype, self.dom, self.gens, self.order)) def __eq__(self, other): """Returns `True` if two domains are equivalent. """ return isinstance(other, PolynomialRingBase) and \ self.dtype == other.dtype and self.dom == other.dom and \ self.gens == other.gens and self.order == other.order def from_ZZ_python(K1, a, K0): """Convert a Python `int` object to `dtype`. """ return K1(K1.dom.convert(a, K0)) def from_QQ_python(K1, a, K0): """Convert a Python `Fraction` object to `dtype`. """ return K1(K1.dom.convert(a, K0)) def from_ZZ_gmpy(K1, a, K0): """Convert a GMPY `mpz` object to `dtype`. """ return K1(K1.dom.convert(a, K0)) def from_QQ_gmpy(K1, a, K0): """Convert a GMPY `mpq` object to `dtype`. """ return K1(K1.dom.convert(a, K0)) def from_RealField(K1, a, K0): """Convert a mpmath `mpf` object to `dtype`. """ return K1(K1.dom.convert(a, K0)) def from_AlgebraicField(K1, a, K0): """Convert a `ANP` object to `dtype`. """ if K1.dom == K0: return K1(a) def from_GlobalPolynomialRing(K1, a, K0): """Convert a `DMP` object to `dtype`. """ if K1.gens == K0.gens: if K1.dom == K0.dom: return K1(a.rep) # set the correct ring else: return K1(a.convert(K1.dom).rep) else: monoms, coeffs = _dict_reorder(a.to_dict(), K0.gens, K1.gens) if K1.dom != K0.dom: coeffs = [ K1.dom.convert(c, K0.dom) for c in coeffs ] return K1(dict(zip(monoms, coeffs))) def get_field(self): """Returns a field associated with `self`. """ return FractionField(self.dom, *self.gens) def poly_ring(self, *gens): """Returns a polynomial ring, i.e. `K[X]`. """ raise NotImplementedError('nested domains not allowed') def frac_field(self, *gens): """Returns a fraction field, i.e. `K(X)`. """ raise NotImplementedError('nested domains not allowed') def revert(self, a): try: return 1/a except (ExactQuotientFailed, ZeroDivisionError): raise NotReversible('%s is not a unit' % a) def gcdex(self, a, b): """Extended GCD of `a` and `b`. """ return a.gcdex(b) def gcd(self, a, b): """Returns GCD of `a` and `b`. """ return a.gcd(b) def lcm(self, a, b): """Returns LCM of `a` and `b`. """ return a.lcm(b) def factorial(self, a): """Returns factorial of `a`. """ return self.dtype(self.dom.factorial(a)) def _vector_to_sdm(self, v, order): """ For internal use by the modules class. Convert an iterable of elements of this ring into a sparse distributed module element. """ raise NotImplementedError def _sdm_to_dics(self, s, n): """Helper for _sdm_to_vector.""" from sympy.polys.distributedmodules import sdm_to_dict dic = sdm_to_dict(s) res = [{} for _ in range(n)] for k, v in dic.items(): res[k[0]][k[1:]] = v return res def _sdm_to_vector(self, s, n): """ For internal use by the modules class. Convert a sparse distributed module into a list of length ``n``. Examples ======== >>> from sympy import QQ, ilex >>> from sympy.abc import x, y >>> R = QQ.old_poly_ring(x, y, order=ilex) >>> L = [((1, 1, 1), QQ(1)), ((0, 1, 0), QQ(1)), ((0, 0, 1), QQ(2))] >>> R._sdm_to_vector(L, 2) [x + 2*y, x*y] """ dics = self._sdm_to_dics(s, n) # NOTE this works for global and local rings! return [self(x) for x in dics] def free_module(self, rank): """ Generate a free module of rank ``rank`` over ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(2) QQ[x]**2 """ return FreeModulePolyRing(self, rank) def _vector_to_sdm_helper(v, order): """Helper method for common code in Global and Local poly rings.""" from sympy.polys.distributedmodules import sdm_from_dict d = {} for i, e in enumerate(v): for key, value in e.to_dict().items(): d[(i,) + key] = value return sdm_from_dict(d, order) @public class GlobalPolynomialRing(PolynomialRingBase): """A true polynomial ring, with objects DMP. """ is_PolynomialRing = is_Poly = True dtype = DMP def from_FractionField(K1, a, K0): """ Convert a ``DMF`` object to ``DMP``. Examples ======== >>> from sympy.polys.polyclasses import DMP, DMF >>> from sympy.polys.domains import ZZ >>> from sympy.abc import x >>> f = DMF(([ZZ(1), ZZ(1)], [ZZ(1)]), ZZ) >>> K = ZZ.old_frac_field(x) >>> F = ZZ.old_poly_ring(x).from_FractionField(f, K) >>> F == DMP([ZZ(1), ZZ(1)], ZZ) True >>> type(F) <class 'sympy.polys.polyclasses.DMP'> """ if a.denom().is_one: return K1.from_GlobalPolynomialRing(a.numer(), K0) def to_sympy(self, a): """Convert `a` to a SymPy object. """ return basic_from_dict(a.to_sympy_dict(), *self.gens) def from_sympy(self, a): """Convert SymPy's expression to `dtype`. """ try: rep, _ = dict_from_basic(a, gens=self.gens) except PolynomialError: raise CoercionFailed("can't convert %s to type %s" % (a, self)) for k, v in rep.items(): rep[k] = self.dom.from_sympy(v) return self(rep) def is_positive(self, a): """Returns True if `LC(a)` is positive. """ return self.dom.is_positive(a.LC()) def is_negative(self, a): """Returns True if `LC(a)` is negative. """ return self.dom.is_negative(a.LC()) def is_nonpositive(self, a): """Returns True if `LC(a)` is non-positive. """ return self.dom.is_nonpositive(a.LC()) def is_nonnegative(self, a): """Returns True if `LC(a)` is non-negative. """ return self.dom.is_nonnegative(a.LC()) def _vector_to_sdm(self, v, order): """ Examples ======== >>> from sympy import lex, QQ >>> from sympy.abc import x, y >>> R = QQ.old_poly_ring(x, y) >>> f = R.convert(x + 2*y) >>> g = R.convert(x * y) >>> R._vector_to_sdm([f, g], lex) [((1, 1, 1), 1), ((0, 1, 0), 1), ((0, 0, 1), 2)] """ return _vector_to_sdm_helper(v, order) class GeneralizedPolynomialRing(PolynomialRingBase): """A generalized polynomial ring, with objects DMF. """ dtype = DMF def new(self, a): """Construct an element of `self` domain from `a`. """ res = self.dtype(a, self.dom, len(self.gens) - 1, ring=self) # make sure res is actually in our ring if res.denom().terms(order=self.order)[0][0] != (0,)*len(self.gens): from sympy.printing.str import sstr raise CoercionFailed("denominator %s not allowed in %s" % (sstr(res), self)) return res def __contains__(self, a): try: a = self.convert(a) except CoercionFailed: return False return a.denom().terms(order=self.order)[0][0] == (0,)*len(self.gens) def from_FractionField(K1, a, K0): dmf = K1.get_field().from_FractionField(a, K0) return K1((dmf.num, dmf.den)) def to_sympy(self, a): """Convert `a` to a SymPy object. """ return (basic_from_dict(a.numer().to_sympy_dict(), *self.gens) / basic_from_dict(a.denom().to_sympy_dict(), *self.gens)) def from_sympy(self, a): """Convert SymPy's expression to `dtype`. """ p, q = a.as_numer_denom() num, _ = dict_from_basic(p, gens=self.gens) den, _ = dict_from_basic(q, gens=self.gens) for k, v in num.items(): num[k] = self.dom.from_sympy(v) for k, v in den.items(): den[k] = self.dom.from_sympy(v) return self((num, den)).cancel() def _vector_to_sdm(self, v, order): """ Turn an iterable into a sparse distributed module. Note that the vector is multiplied by a unit first to make all entries polynomials. Examples ======== >>> from sympy import ilex, QQ >>> from sympy.abc import x, y >>> R = QQ.old_poly_ring(x, y, order=ilex) >>> f = R.convert((x + 2*y) / (1 + x)) >>> g = R.convert(x * y) >>> R._vector_to_sdm([f, g], ilex) [((0, 0, 1), 2), ((0, 1, 0), 1), ((1, 1, 1), 1), ((1, 2, 1), 1)] """ # NOTE this is quite inefficient... u = self.one.numer() for x in v: u *= x.denom() return _vector_to_sdm_helper([x.numer()*u/x.denom() for x in v], order) @public def PolynomialRing(dom, *gens, **opts): r""" Create a generalized multivariate polynomial ring. A generalized polynomial ring is defined by a ground field `K`, a set of generators (typically `x_1, \ldots, x_n`) and a monomial order `<`. The monomial order can be global, local or mixed. In any case it induces a total ordering on the monomials, and there exists for every (non-zero) polynomial `f \in K[x_1, \ldots, x_n]` a well-defined "leading monomial" `LM(f) = LM(f, >)`. One can then define a multiplicative subset `S = S_> = \{f \in K[x_1, \ldots, x_n] | LM(f) = 1\}`. The generalized polynomial ring corresponding to the monomial order is `R = S^{-1}K[x_1, \ldots, x_n]`. If `>` is a so-called global order, that is `1` is the smallest monomial, then we just have `S = K` and `R = K[x_1, \ldots, x_n]`. Examples ======== A few examples may make this clearer. >>> from sympy.abc import x, y >>> from sympy import QQ Our first ring uses global lexicographic order. >>> R1 = QQ.old_poly_ring(x, y, order=(("lex", x, y),)) The second ring uses local lexicographic order. Note that when using a single (non-product) order, you can just specify the name and omit the variables: >>> R2 = QQ.old_poly_ring(x, y, order="ilex") The third and fourth rings use a mixed orders: >>> o1 = (("ilex", x), ("lex", y)) >>> o2 = (("lex", x), ("ilex", y)) >>> R3 = QQ.old_poly_ring(x, y, order=o1) >>> R4 = QQ.old_poly_ring(x, y, order=o2) We will investigate what elements of `K(x, y)` are contained in the various rings. >>> L = [x, 1/x, y/(1 + x), 1/(1 + y), 1/(1 + x*y)] >>> test = lambda R: [f in R for f in L] The first ring is just `K[x, y]`: >>> test(R1) [True, False, False, False, False] The second ring is R1 localised at the maximal ideal (x, y): >>> test(R2) [True, False, True, True, True] The third ring is R1 localised at the prime ideal (x): >>> test(R3) [True, False, True, False, True] Finally the fourth ring is R1 localised at `S = K[x, y] \setminus yK[y]`: >>> test(R4) [True, False, False, True, False] """ order = opts.get("order", GeneralizedPolynomialRing.default_order) if iterable(order): order = build_product_order(order, gens) order = monomial_key(order) opts['order'] = order if order.is_global: return GlobalPolynomialRing(dom, *gens, **opts) else: return GeneralizedPolynomialRing(dom, *gens, **opts)
f8141c4e55d82f96124082af0373da46b0c2f76e92f08f689e6ca20f784a846e
"""Implementation of :class:`ComplexField` class. """ from __future__ import print_function, division from sympy.core.numbers import Float, I from sympy.polys.domains.characteristiczero import CharacteristicZero from sympy.polys.domains.field import Field from sympy.polys.domains.mpelements import MPContext from sympy.polys.domains.simpledomain import SimpleDomain from sympy.polys.polyerrors import DomainError, CoercionFailed from sympy.utilities import public @public class ComplexField(Field, CharacteristicZero, SimpleDomain): """Complex numbers up to the given precision. """ rep = 'CC' is_ComplexField = is_CC = True is_Exact = False is_Numerical = True has_assoc_Ring = False has_assoc_Field = True _default_precision = 53 @property def has_default_precision(self): return self.precision == self._default_precision @property def precision(self): return self._context.prec @property def dps(self): return self._context.dps @property def tolerance(self): return self._context.tolerance def __init__(self, prec=_default_precision, dps=None, tol=None): context = MPContext(prec, dps, tol, False) context._parent = self self._context = context self.dtype = context.mpc self.zero = self.dtype(0) self.one = self.dtype(1) def __eq__(self, other): return (isinstance(other, ComplexField) and self.precision == other.precision and self.tolerance == other.tolerance) def __hash__(self): return hash((self.__class__.__name__, self.dtype, self.precision, self.tolerance)) def to_sympy(self, element): """Convert ``element`` to SymPy number. """ return Float(element.real, self.dps) + I*Float(element.imag, self.dps) def from_sympy(self, expr): """Convert SymPy's number to ``dtype``. """ number = expr.evalf(n=self.dps) real, imag = number.as_real_imag() if real.is_Number and imag.is_Number: return self.dtype(real, imag) else: raise CoercionFailed("expected complex number, got %s" % expr) def from_ZZ_python(self, element, base): return self.dtype(element) def from_QQ_python(self, element, base): return self.dtype(element.numerator) / element.denominator def from_ZZ_gmpy(self, element, base): return self.dtype(int(element)) def from_QQ_gmpy(self, element, base): return self.dtype(int(element.numerator)) / int(element.denominator) def from_RealField(self, element, base): return self.dtype(element) def from_ComplexField(self, element, base): if self == base: return element else: return self.dtype(element) def get_ring(self): """Returns a ring associated with ``self``. """ raise DomainError("there is no ring associated with %s" % self) def get_exact(self): """Returns an exact domain associated with ``self``. """ raise DomainError("there is no exact domain associated with %s" % self) def gcd(self, a, b): """Returns GCD of ``a`` and ``b``. """ return self.one def lcm(self, a, b): """Returns LCM of ``a`` and ``b``. """ return a*b def almosteq(self, a, b, tolerance=None): """Check if ``a`` and ``b`` are almost equal. """ return self._context.almosteq(a, b, tolerance)
aa234cdf932d1cae9802563404c20e02dc5fb0cf0aa81f496423febe4ee7ec38
"""Implementation of :class:`ExpressionDomain` class. """ from __future__ import print_function, division from sympy.core import sympify, SympifyError from sympy.polys.domains.characteristiczero import CharacteristicZero from sympy.polys.domains.field import Field from sympy.polys.domains.simpledomain import SimpleDomain from sympy.polys.polyutils import PicklableWithSlots from sympy.utilities import public eflags = dict(deep=False, mul=True, power_exp=False, power_base=False, basic=False, multinomial=False, log=False) @public class ExpressionDomain(Field, CharacteristicZero, SimpleDomain): """A class for arbitrary expressions. """ is_SymbolicDomain = is_EX = True class Expression(PicklableWithSlots): """An arbitrary expression. """ __slots__ = ('ex',) def __init__(self, ex): if not isinstance(ex, self.__class__): self.ex = sympify(ex) else: self.ex = ex.ex def __repr__(f): return 'EX(%s)' % repr(f.ex) def __str__(f): return 'EX(%s)' % str(f.ex) def __hash__(self): return hash((self.__class__.__name__, self.ex)) def as_expr(f): return f.ex def numer(f): return f.__class__(f.ex.as_numer_denom()[0]) def denom(f): return f.__class__(f.ex.as_numer_denom()[1]) def simplify(f, ex): return f.__class__(ex.cancel().expand(**eflags)) def __abs__(f): return f.__class__(abs(f.ex)) def __neg__(f): return f.__class__(-f.ex) def _to_ex(f, g): try: return f.__class__(g) except SympifyError: return None def __add__(f, g): g = f._to_ex(g) if g is not None: return f.simplify(f.ex + g.ex) else: return NotImplemented def __radd__(f, g): return f.simplify(f.__class__(g).ex + f.ex) def __sub__(f, g): g = f._to_ex(g) if g is not None: return f.simplify(f.ex - g.ex) else: return NotImplemented def __rsub__(f, g): return f.simplify(f.__class__(g).ex - f.ex) def __mul__(f, g): g = f._to_ex(g) if g is not None: return f.simplify(f.ex*g.ex) else: return NotImplemented def __rmul__(f, g): return f.simplify(f.__class__(g).ex*f.ex) def __pow__(f, n): n = f._to_ex(n) if n is not None: return f.simplify(f.ex**n.ex) else: return NotImplemented def __truediv__(f, g): g = f._to_ex(g) if g is not None: return f.simplify(f.ex/g.ex) else: return NotImplemented def __rtruediv__(f, g): return f.simplify(f.__class__(g).ex/f.ex) __div__ = __truediv__ __rdiv__ = __rtruediv__ def __eq__(f, g): return f.ex == f.__class__(g).ex def __ne__(f, g): return not f == g def __nonzero__(f): return f.ex != 0 __bool__ = __nonzero__ def gcd(f, g): from sympy.polys import gcd return f.__class__(gcd(f.ex, f.__class__(g).ex)) def lcm(f, g): from sympy.polys import lcm return f.__class__(lcm(f.ex, f.__class__(g).ex)) dtype = Expression zero = Expression(0) one = Expression(1) rep = 'EX' has_assoc_Ring = False has_assoc_Field = True def __init__(self): pass def to_sympy(self, a): """Convert ``a`` to a SymPy object. """ return a.as_expr() def from_sympy(self, a): """Convert SymPy's expression to ``dtype``. """ return self.dtype(a) def from_ZZ_python(K1, a, K0): """Convert a Python ``int`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_QQ_python(K1, a, K0): """Convert a Python ``Fraction`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_ZZ_gmpy(K1, a, K0): """Convert a GMPY ``mpz`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_QQ_gmpy(K1, a, K0): """Convert a GMPY ``mpq`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_RealField(K1, a, K0): """Convert a mpmath ``mpf`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_PolynomialRing(K1, a, K0): """Convert a ``DMP`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_FractionField(K1, a, K0): """Convert a ``DMF`` object to ``dtype``. """ return K1(K0.to_sympy(a)) def from_ExpressionDomain(K1, a, K0): """Convert a ``EX`` object to ``dtype``. """ return a def get_ring(self): """Returns a ring associated with ``self``. """ return self # XXX: EX is not a ring but we don't have much choice here. def get_field(self): """Returns a field associated with ``self``. """ return self def is_positive(self, a): """Returns True if ``a`` is positive. """ return a.ex.as_coeff_mul()[0].is_positive def is_negative(self, a): """Returns True if ``a`` is negative. """ return a.ex.could_extract_minus_sign() def is_nonpositive(self, a): """Returns True if ``a`` is non-positive. """ return a.ex.as_coeff_mul()[0].is_nonpositive def is_nonnegative(self, a): """Returns True if ``a`` is non-negative. """ return a.ex.as_coeff_mul()[0].is_nonnegative def numer(self, a): """Returns numerator of ``a``. """ return a.numer() def denom(self, a): """Returns denominator of ``a``. """ return a.denom() def gcd(self, a, b): return a.gcd(b) def lcm(self, a, b): return a.lcm(b)
7f18f2d47dd2c67f647f7a4ad5877d9b3b18702c3a077499c82923c3a855da27
"""Implementation of :class:`ModularInteger` class. """ from __future__ import print_function, division from typing import Any, Dict, Tuple, Type import operator from sympy.polys.polyutils import PicklableWithSlots from sympy.polys.polyerrors import CoercionFailed from sympy.polys.domains.domainelement import DomainElement from sympy.utilities import public @public class ModularInteger(PicklableWithSlots, DomainElement): """A class representing a modular integer. """ mod, dom, sym, _parent = None, None, None, None __slots__ = ('val',) def parent(self): return self._parent def __init__(self, val): if isinstance(val, self.__class__): self.val = val.val % self.mod else: self.val = self.dom.convert(val) % self.mod def __hash__(self): return hash((self.val, self.mod)) def __repr__(self): return "%s(%s)" % (self.__class__.__name__, self.val) def __str__(self): return "%s mod %s" % (self.val, self.mod) def __int__(self): return int(self.to_int()) def to_int(self): if self.sym: if self.val <= self.mod // 2: return self.val else: return self.val - self.mod else: return self.val def __pos__(self): return self def __neg__(self): return self.__class__(-self.val) @classmethod def _get_val(cls, other): if isinstance(other, cls): return other.val else: try: return cls.dom.convert(other) except CoercionFailed: return None def __add__(self, other): val = self._get_val(other) if val is not None: return self.__class__(self.val + val) else: return NotImplemented def __radd__(self, other): return self.__add__(other) def __sub__(self, other): val = self._get_val(other) if val is not None: return self.__class__(self.val - val) else: return NotImplemented def __rsub__(self, other): return (-self).__add__(other) def __mul__(self, other): val = self._get_val(other) if val is not None: return self.__class__(self.val * val) else: return NotImplemented def __rmul__(self, other): return self.__mul__(other) def __div__(self, other): val = self._get_val(other) if val is not None: return self.__class__(self.val * self._invert(val)) else: return NotImplemented def __rdiv__(self, other): return self.invert().__mul__(other) __truediv__ = __div__ __rtruediv__ = __rdiv__ def __mod__(self, other): val = self._get_val(other) if val is not None: return self.__class__(self.val % val) else: return NotImplemented def __rmod__(self, other): val = self._get_val(other) if val is not None: return self.__class__(val % self.val) else: return NotImplemented def __pow__(self, exp): if not exp: return self.__class__(self.dom.one) if exp < 0: val, exp = self.invert().val, -exp else: val = self.val return self.__class__(pow(val, int(exp), self.mod)) def _compare(self, other, op): val = self._get_val(other) if val is not None: return op(self.val, val % self.mod) else: return NotImplemented def __eq__(self, other): return self._compare(other, operator.eq) def __ne__(self, other): return self._compare(other, operator.ne) def __lt__(self, other): return self._compare(other, operator.lt) def __le__(self, other): return self._compare(other, operator.le) def __gt__(self, other): return self._compare(other, operator.gt) def __ge__(self, other): return self._compare(other, operator.ge) def __nonzero__(self): return bool(self.val) __bool__ = __nonzero__ @classmethod def _invert(cls, value): return cls.dom.invert(value, cls.mod) def invert(self): return self.__class__(self._invert(self.val)) _modular_integer_cache = {} # type: Dict[Tuple[Any, Any, Any], Type[ModularInteger]] def ModularIntegerFactory(_mod, _dom, _sym, parent): """Create custom class for specific integer modulus.""" try: _mod = _dom.convert(_mod) except CoercionFailed: ok = False else: ok = True if not ok or _mod < 1: raise ValueError("modulus must be a positive integer, got %s" % _mod) key = _mod, _dom, _sym try: cls = _modular_integer_cache[key] except KeyError: class cls(ModularInteger): mod, dom, sym = _mod, _dom, _sym _parent = parent if _sym: cls.__name__ = "SymmetricModularIntegerMod%s" % _mod else: cls.__name__ = "ModularIntegerMod%s" % _mod _modular_integer_cache[key] = cls return cls
c150b0ae1d79b16dcfcc2ecaf6ebcb09d5dce74bc93cd9345b3b580a97b7d352
"""Ground types for various mathematical domains in SymPy. """ from __future__ import print_function, division from sympy.core.compatibility import builtins, HAS_GMPY PythonInteger = builtins.int PythonReal = builtins.float PythonComplex = builtins.complex from .pythonrational import PythonRational from sympy.core.numbers import ( igcdex as python_gcdex, igcd2 as python_gcd, ilcm as python_lcm, ) from sympy import ( Float as SymPyReal, Integer as SymPyInteger, Rational as SymPyRational, ) if HAS_GMPY == 1: from gmpy import ( mpz as GMPYInteger, mpq as GMPYRational, fac as gmpy_factorial, numer as gmpy_numer, denom as gmpy_denom, gcdext as gmpy_gcdex, gcd as gmpy_gcd, lcm as gmpy_lcm, sqrt as gmpy_sqrt, qdiv as gmpy_qdiv, ) elif HAS_GMPY == 2: from gmpy2 import ( mpz as GMPYInteger, mpq as GMPYRational, fac as gmpy_factorial, numer as gmpy_numer, denom as gmpy_denom, gcdext as gmpy_gcdex, gcd as gmpy_gcd, lcm as gmpy_lcm, isqrt as gmpy_sqrt, qdiv as gmpy_qdiv, ) else: class _GMPYInteger(object): def __init__(self, obj): pass class _GMPYRational(object): def __init__(self, obj): pass GMPYInteger = _GMPYInteger GMPYRational = _GMPYRational gmpy_factorial = None gmpy_numer = None gmpy_denom = None gmpy_gcdex = None gmpy_gcd = None gmpy_lcm = None gmpy_sqrt = None gmpy_qdiv = None import mpmath.libmp as mlib def python_sqrt(n): return int(mlib.isqrt(n)) def python_factorial(n): return int(mlib.ifac(n)) __all__ = [ 'PythonInteger', 'PythonReal', 'PythonComplex', 'PythonRational', 'python_gcdex', 'python_gcd', 'python_lcm', 'SymPyReal', 'SymPyInteger', 'SymPyRational', 'GMPYInteger', 'GMPYRational', 'gmpy_factorial', 'gmpy_numer', 'gmpy_denom', 'gmpy_gcdex', 'gmpy_gcd', 'gmpy_lcm', 'gmpy_sqrt', 'gmpy_qdiv', 'GMPYInteger', 'GMPYRational', 'mlib', 'python_sqrt', 'python_factorial' ]
2ba8534ac871b4f6c644c53a19a3bec4c3f76eb3687a09ffbb78612f799da559
"""Implementation of :class:`Domain` class. """ from __future__ import print_function, division from typing import Any, Optional, Type from sympy.core import Basic, sympify from sympy.core.compatibility import HAS_GMPY, is_sequence from sympy.core.decorators import deprecated from sympy.polys.domains.domainelement import DomainElement from sympy.polys.orderings import lex from sympy.polys.polyerrors import UnificationFailed, CoercionFailed, DomainError from sympy.polys.polyutils import _unify_gens, _not_a_coeff from sympy.utilities import default_sort_key, public @public class Domain(object): """Represents an abstract domain. """ dtype = None # type: Optional[Type] zero = None # type: Optional[Any] one = None # type: Optional[Any] is_Ring = False is_Field = False has_assoc_Ring = False has_assoc_Field = False is_FiniteField = is_FF = False is_IntegerRing = is_ZZ = False is_RationalField = is_QQ = False is_RealField = is_RR = False is_ComplexField = is_CC = False is_AlgebraicField = is_Algebraic = False is_PolynomialRing = is_Poly = False is_FractionField = is_Frac = False is_SymbolicDomain = is_EX = False is_Exact = True is_Numerical = False is_Simple = False is_Composite = False is_PID = False has_CharacteristicZero = False rep = None # type: Optional[str] alias = None # type: Optional[str] @property # type: ignore @deprecated(useinstead="is_Field", issue=12723, deprecated_since_version="1.1") def has_Field(self): return self.is_Field @property # type: ignore @deprecated(useinstead="is_Ring", issue=12723, deprecated_since_version="1.1") def has_Ring(self): return self.is_Ring def __init__(self): raise NotImplementedError def __str__(self): return self.rep def __repr__(self): return str(self) def __hash__(self): return hash((self.__class__.__name__, self.dtype)) def new(self, *args): return self.dtype(*args) @property def tp(self): return self.dtype def __call__(self, *args): """Construct an element of ``self`` domain from ``args``. """ return self.new(*args) def normal(self, *args): return self.dtype(*args) def convert_from(self, element, base): """Convert ``element`` to ``self.dtype`` given the base domain. """ if base.alias is not None: method = "from_" + base.alias else: method = "from_" + base.__class__.__name__ _convert = getattr(self, method) if _convert is not None: result = _convert(element, base) if result is not None: return result raise CoercionFailed("can't convert %s of type %s from %s to %s" % (element, type(element), base, self)) def convert(self, element, base=None): """Convert ``element`` to ``self.dtype``. """ if _not_a_coeff(element): raise CoercionFailed('%s is not in any domain' % element) if base is not None: return self.convert_from(element, base) if self.of_type(element): return element from sympy.polys.domains import PythonIntegerRing, GMPYIntegerRing, GMPYRationalField, RealField, ComplexField if isinstance(element, int): return self.convert_from(element, PythonIntegerRing()) if HAS_GMPY: integers = GMPYIntegerRing() if isinstance(element, integers.tp): return self.convert_from(element, integers) rationals = GMPYRationalField() if isinstance(element, rationals.tp): return self.convert_from(element, rationals) if isinstance(element, float): parent = RealField(tol=False) return self.convert_from(parent(element), parent) if isinstance(element, complex): parent = ComplexField(tol=False) return self.convert_from(parent(element), parent) if isinstance(element, DomainElement): return self.convert_from(element, element.parent()) # TODO: implement this in from_ methods if self.is_Numerical and getattr(element, 'is_ground', False): return self.convert(element.LC()) if isinstance(element, Basic): try: return self.from_sympy(element) except (TypeError, ValueError): pass else: # TODO: remove this branch if not is_sequence(element): try: element = sympify(element) if isinstance(element, Basic): return self.from_sympy(element) except (TypeError, ValueError): pass raise CoercionFailed("can't convert %s of type %s to %s" % (element, type(element), self)) def of_type(self, element): """Check if ``a`` is of type ``dtype``. """ return isinstance(element, self.tp) # XXX: this isn't correct, e.g. PolyElement def __contains__(self, a): """Check if ``a`` belongs to this domain. """ try: if _not_a_coeff(a): raise CoercionFailed self.convert(a) # this might raise, too except CoercionFailed: return False return True def to_sympy(self, a): """Convert ``a`` to a SymPy object. """ raise NotImplementedError def from_sympy(self, a): """Convert a SymPy object to ``dtype``. """ raise NotImplementedError def from_FF_python(K1, a, K0): """Convert ``ModularInteger(int)`` to ``dtype``. """ return None def from_ZZ_python(K1, a, K0): """Convert a Python ``int`` object to ``dtype``. """ return None def from_QQ_python(K1, a, K0): """Convert a Python ``Fraction`` object to ``dtype``. """ return None def from_FF_gmpy(K1, a, K0): """Convert ``ModularInteger(mpz)`` to ``dtype``. """ return None def from_ZZ_gmpy(K1, a, K0): """Convert a GMPY ``mpz`` object to ``dtype``. """ return None def from_QQ_gmpy(K1, a, K0): """Convert a GMPY ``mpq`` object to ``dtype``. """ return None def from_RealField(K1, a, K0): """Convert a real element object to ``dtype``. """ return None def from_ComplexField(K1, a, K0): """Convert a complex element to ``dtype``. """ return None def from_AlgebraicField(K1, a, K0): """Convert an algebraic number to ``dtype``. """ return None def from_PolynomialRing(K1, a, K0): """Convert a polynomial to ``dtype``. """ if a.is_ground: return K1.convert(a.LC, K0.dom) def from_FractionField(K1, a, K0): """Convert a rational function to ``dtype``. """ return None def from_ExpressionDomain(K1, a, K0): """Convert a ``EX`` object to ``dtype``. """ return K1.from_sympy(a.ex) def from_GlobalPolynomialRing(K1, a, K0): """Convert a polynomial to ``dtype``. """ if a.degree() <= 0: return K1.convert(a.LC(), K0.dom) def from_GeneralizedPolynomialRing(K1, a, K0): return K1.from_FractionField(a, K0) def unify_with_symbols(K0, K1, symbols): if (K0.is_Composite and (set(K0.symbols) & set(symbols))) or (K1.is_Composite and (set(K1.symbols) & set(symbols))): raise UnificationFailed("can't unify %s with %s, given %s generators" % (K0, K1, tuple(symbols))) return K0.unify(K1) def unify(K0, K1, symbols=None): """ Construct a minimal domain that contains elements of ``K0`` and ``K1``. Known domains (from smallest to largest): - ``GF(p)`` - ``ZZ`` - ``QQ`` - ``RR(prec, tol)`` - ``CC(prec, tol)`` - ``ALG(a, b, c)`` - ``K[x, y, z]`` - ``K(x, y, z)`` - ``EX`` """ if symbols is not None: return K0.unify_with_symbols(K1, symbols) if K0 == K1: return K0 if K0.is_EX: return K0 if K1.is_EX: return K1 if K0.is_Composite or K1.is_Composite: K0_ground = K0.dom if K0.is_Composite else K0 K1_ground = K1.dom if K1.is_Composite else K1 K0_symbols = K0.symbols if K0.is_Composite else () K1_symbols = K1.symbols if K1.is_Composite else () domain = K0_ground.unify(K1_ground) symbols = _unify_gens(K0_symbols, K1_symbols) order = K0.order if K0.is_Composite else K1.order if ((K0.is_FractionField and K1.is_PolynomialRing or K1.is_FractionField and K0.is_PolynomialRing) and (not K0_ground.is_Field or not K1_ground.is_Field) and domain.is_Field): domain = domain.get_ring() if K0.is_Composite and (not K1.is_Composite or K0.is_FractionField or K1.is_PolynomialRing): cls = K0.__class__ else: cls = K1.__class__ from sympy.polys.domains.old_polynomialring import GlobalPolynomialRing if cls == GlobalPolynomialRing: return cls(domain, symbols) return cls(domain, symbols, order) def mkinexact(cls, K0, K1): prec = max(K0.precision, K1.precision) tol = max(K0.tolerance, K1.tolerance) return cls(prec=prec, tol=tol) if K0.is_ComplexField and K1.is_ComplexField: return mkinexact(K0.__class__, K0, K1) if K0.is_ComplexField and K1.is_RealField: return mkinexact(K0.__class__, K0, K1) if K0.is_RealField and K1.is_ComplexField: return mkinexact(K1.__class__, K1, K0) if K0.is_RealField and K1.is_RealField: return mkinexact(K0.__class__, K0, K1) if K0.is_ComplexField or K0.is_RealField: return K0 if K1.is_ComplexField or K1.is_RealField: return K1 if K0.is_AlgebraicField and K1.is_AlgebraicField: return K0.__class__(K0.dom.unify(K1.dom), *_unify_gens(K0.orig_ext, K1.orig_ext)) elif K0.is_AlgebraicField: return K0 elif K1.is_AlgebraicField: return K1 if K0.is_RationalField: return K0 if K1.is_RationalField: return K1 if K0.is_IntegerRing: return K0 if K1.is_IntegerRing: return K1 if K0.is_FiniteField and K1.is_FiniteField: return K0.__class__(max(K0.mod, K1.mod, key=default_sort_key)) from sympy.polys.domains import EX return EX def __eq__(self, other): """Returns ``True`` if two domains are equivalent. """ return isinstance(other, Domain) and self.dtype == other.dtype def __ne__(self, other): """Returns ``False`` if two domains are equivalent. """ return not self == other def map(self, seq): """Rersively apply ``self`` to all elements of ``seq``. """ result = [] for elt in seq: if isinstance(elt, list): result.append(self.map(elt)) else: result.append(self(elt)) return result def get_ring(self): """Returns a ring associated with ``self``. """ raise DomainError('there is no ring associated with %s' % self) def get_field(self): """Returns a field associated with ``self``. """ raise DomainError('there is no field associated with %s' % self) def get_exact(self): """Returns an exact domain associated with ``self``. """ return self def __getitem__(self, symbols): """The mathematical way to make a polynomial ring. """ if hasattr(symbols, '__iter__'): return self.poly_ring(*symbols) else: return self.poly_ring(symbols) def poly_ring(self, *symbols, **kwargs): """Returns a polynomial ring, i.e. `K[X]`. """ from sympy.polys.domains.polynomialring import PolynomialRing return PolynomialRing(self, symbols, kwargs.get("order", lex)) def frac_field(self, *symbols, **kwargs): """Returns a fraction field, i.e. `K(X)`. """ from sympy.polys.domains.fractionfield import FractionField return FractionField(self, symbols, kwargs.get("order", lex)) def old_poly_ring(self, *symbols, **kwargs): """Returns a polynomial ring, i.e. `K[X]`. """ from sympy.polys.domains.old_polynomialring import PolynomialRing return PolynomialRing(self, *symbols, **kwargs) def old_frac_field(self, *symbols, **kwargs): """Returns a fraction field, i.e. `K(X)`. """ from sympy.polys.domains.old_fractionfield import FractionField return FractionField(self, *symbols, **kwargs) def algebraic_field(self, *extension): r"""Returns an algebraic field, i.e. `K(\alpha, \ldots)`. """ raise DomainError("can't create algebraic field over %s" % self) def inject(self, *symbols): """Inject generators into this domain. """ raise NotImplementedError def is_zero(self, a): """Returns True if ``a`` is zero. """ return not a def is_one(self, a): """Returns True if ``a`` is one. """ return a == self.one def is_positive(self, a): """Returns True if ``a`` is positive. """ return a > 0 def is_negative(self, a): """Returns True if ``a`` is negative. """ return a < 0 def is_nonpositive(self, a): """Returns True if ``a`` is non-positive. """ return a <= 0 def is_nonnegative(self, a): """Returns True if ``a`` is non-negative. """ return a >= 0 def abs(self, a): """Absolute value of ``a``, implies ``__abs__``. """ return abs(a) def neg(self, a): """Returns ``a`` negated, implies ``__neg__``. """ return -a def pos(self, a): """Returns ``a`` positive, implies ``__pos__``. """ return +a def add(self, a, b): """Sum of ``a`` and ``b``, implies ``__add__``. """ return a + b def sub(self, a, b): """Difference of ``a`` and ``b``, implies ``__sub__``. """ return a - b def mul(self, a, b): """Product of ``a`` and ``b``, implies ``__mul__``. """ return a * b def pow(self, a, b): """Raise ``a`` to power ``b``, implies ``__pow__``. """ return a ** b def exquo(self, a, b): """Exact quotient of ``a`` and ``b``, implies something. """ raise NotImplementedError def quo(self, a, b): """Quotient of ``a`` and ``b``, implies something. """ raise NotImplementedError def rem(self, a, b): """Remainder of ``a`` and ``b``, implies ``__mod__``. """ raise NotImplementedError def div(self, a, b): """Division of ``a`` and ``b``, implies something. """ raise NotImplementedError def invert(self, a, b): """Returns inversion of ``a mod b``, implies something. """ raise NotImplementedError def revert(self, a): """Returns ``a**(-1)`` if possible. """ raise NotImplementedError def numer(self, a): """Returns numerator of ``a``. """ raise NotImplementedError def denom(self, a): """Returns denominator of ``a``. """ raise NotImplementedError def half_gcdex(self, a, b): """Half extended GCD of ``a`` and ``b``. """ s, t, h = self.gcdex(a, b) return s, h def gcdex(self, a, b): """Extended GCD of ``a`` and ``b``. """ raise NotImplementedError def cofactors(self, a, b): """Returns GCD and cofactors of ``a`` and ``b``. """ gcd = self.gcd(a, b) cfa = self.quo(a, gcd) cfb = self.quo(b, gcd) return gcd, cfa, cfb def gcd(self, a, b): """Returns GCD of ``a`` and ``b``. """ raise NotImplementedError def lcm(self, a, b): """Returns LCM of ``a`` and ``b``. """ raise NotImplementedError def log(self, a, b): """Returns b-base logarithm of ``a``. """ raise NotImplementedError def sqrt(self, a): """Returns square root of ``a``. """ raise NotImplementedError def evalf(self, a, prec=None, **options): """Returns numerical approximation of ``a``. """ return self.to_sympy(a).evalf(prec, **options) n = evalf def real(self, a): return a def imag(self, a): return self.zero def almosteq(self, a, b, tolerance=None): """Check if ``a`` and ``b`` are almost equal. """ return a == b def characteristic(self): """Return the characteristic of this domain. """ raise NotImplementedError('characteristic()') __all__ = ['Domain']
64dd2d57e2f6a975dbb6561e03b9a1ed0797db4987fafdb9fc3e74d3bf3ea0d6
"""Real and complex elements. """ from __future__ import print_function, division from sympy.polys.domains.domainelement import DomainElement from sympy.utilities import public from mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant from mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan, round_nearest, mpf_mul, repr_dps, int_types, from_int, from_float, from_str, to_rational) from mpmath.rational import mpq @public class RealElement(_mpf, DomainElement): """An element of a real domain. """ __slots__ = ('__mpf__',) def _set_mpf(self, val): self.__mpf__ = val _mpf_ = property(lambda self: self.__mpf__, _set_mpf) def parent(self): return self.context._parent @public class ComplexElement(_mpc, DomainElement): """An element of a complex domain. """ __slots__ = ('__mpc__',) def _set_mpc(self, val): self.__mpc__ = val _mpc_ = property(lambda self: self.__mpc__, _set_mpc) def parent(self): return self.context._parent new = object.__new__ @public class MPContext(PythonMPContext): def __init__(ctx, prec=53, dps=None, tol=None, real=False): ctx._prec_rounding = [prec, round_nearest] if dps is None: ctx._set_prec(prec) else: ctx._set_dps(dps) ctx.mpf = RealElement ctx.mpc = ComplexElement ctx.mpf._ctxdata = [ctx.mpf, new, ctx._prec_rounding] ctx.mpc._ctxdata = [ctx.mpc, new, ctx._prec_rounding] if real: ctx.mpf.context = ctx else: ctx.mpc.context = ctx ctx.constant = _constant ctx.constant._ctxdata = [ctx.mpf, new, ctx._prec_rounding] ctx.constant.context = ctx ctx.types = [ctx.mpf, ctx.mpc, ctx.constant] ctx.trap_complex = True ctx.pretty = True if tol is None: ctx.tol = ctx._make_tol() elif tol is False: ctx.tol = fzero else: ctx.tol = ctx._convert_tol(tol) ctx.tolerance = ctx.make_mpf(ctx.tol) if not ctx.tolerance: ctx.max_denom = 1000000 else: ctx.max_denom = int(1/ctx.tolerance) ctx.zero = ctx.make_mpf(fzero) ctx.one = ctx.make_mpf(fone) ctx.j = ctx.make_mpc((fzero, fone)) ctx.inf = ctx.make_mpf(finf) ctx.ninf = ctx.make_mpf(fninf) ctx.nan = ctx.make_mpf(fnan) def _make_tol(ctx): hundred = (0, 25, 2, 5) eps = (0, MPZ_ONE, 1-ctx.prec, 1) return mpf_mul(hundred, eps) def make_tol(ctx): return ctx.make_mpf(ctx._make_tol()) def _convert_tol(ctx, tol): if isinstance(tol, int_types): return from_int(tol) if isinstance(tol, float): return from_float(tol) if hasattr(tol, "_mpf_"): return tol._mpf_ prec, rounding = ctx._prec_rounding if isinstance(tol, str): return from_str(tol, prec, rounding) raise ValueError("expected a real number, got %s" % tol) def _convert_fallback(ctx, x, strings): raise TypeError("cannot create mpf from " + repr(x)) @property def _repr_digits(ctx): return repr_dps(ctx._prec) @property def _str_digits(ctx): return ctx._dps def to_rational(ctx, s, limit=True): p, q = to_rational(s._mpf_) if not limit or q <= ctx.max_denom: return p, q p0, q0, p1, q1 = 0, 1, 1, 0 n, d = p, q while True: a = n//d q2 = q0 + a*q1 if q2 > ctx.max_denom: break p0, q0, p1, q1 = p1, q1, p0 + a*p1, q2 n, d = d, n - a*d k = (ctx.max_denom - q0)//q1 number = mpq(p, q) bound1 = mpq(p0 + k*p1, q0 + k*q1) bound2 = mpq(p1, q1) if not bound2 or not bound1: return p, q elif abs(bound2 - number) <= abs(bound1 - number): return bound2._mpq_ else: return bound1._mpq_ def almosteq(ctx, s, t, rel_eps=None, abs_eps=None): t = ctx.convert(t) if abs_eps is None and rel_eps is None: rel_eps = abs_eps = ctx.tolerance or ctx.make_tol() if abs_eps is None: abs_eps = ctx.convert(rel_eps) elif rel_eps is None: rel_eps = ctx.convert(abs_eps) diff = abs(s-t) if diff <= abs_eps: return True abss = abs(s) abst = abs(t) if abss < abst: err = diff/abst else: err = diff/abss return err <= rel_eps
8510d753a52beed9077b484451338207d0e63c1248276235f33c2e88de22f25b
"""Tools for polynomial factorization routines in characteristic zero. """ from sympy.polys.rings import ring, xring from sympy.polys.domains import FF, ZZ, QQ, RR, EX from sympy.polys import polyconfig as config from sympy.polys.polyerrors import DomainError from sympy.polys.polyclasses import ANP from sympy.polys.specialpolys import f_polys, w_polys from sympy import nextprime, sin, sqrt, I from sympy.testing.pytest import raises, XFAIL f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_polys() w_1, w_2 = w_polys() def test_dup_trial_division(): R, x = ring("x", ZZ) assert R.dup_trial_division(x**5 + 8*x**4 + 25*x**3 + 38*x**2 + 28*x + 8, (x + 1, x + 2)) == [(x + 1, 2), (x + 2, 3)] def test_dmp_trial_division(): R, x, y = ring("x,y", ZZ) assert R.dmp_trial_division(x**5 + 8*x**4 + 25*x**3 + 38*x**2 + 28*x + 8, (x + 1, x + 2)) == [(x + 1, 2), (x + 2, 3)] def test_dup_zz_mignotte_bound(): R, x = ring("x", ZZ) assert R.dup_zz_mignotte_bound(2*x**2 + 3*x + 4) == 32 def test_dmp_zz_mignotte_bound(): R, x, y = ring("x,y", ZZ) assert R.dmp_zz_mignotte_bound(2*x**2 + 3*x + 4) == 32 def test_dup_zz_hensel_step(): R, x = ring("x", ZZ) f = x**4 - 1 g = x**3 + 2*x**2 - x - 2 h = x - 2 s = -2 t = 2*x**2 - 2*x - 1 G, H, S, T = R.dup_zz_hensel_step(5, f, g, h, s, t) assert G == x**3 + 7*x**2 - x - 7 assert H == x - 7 assert S == 8 assert T == -8*x**2 - 12*x - 1 def test_dup_zz_hensel_lift(): R, x = ring("x", ZZ) f = x**4 - 1 F = [x - 1, x - 2, x + 2, x + 1] assert R.dup_zz_hensel_lift(ZZ(5), f, F, 4) == \ [x - 1, x - 182, x + 182, x + 1] def test_dup_zz_irreducible_p(): R, x = ring("x", ZZ) assert R.dup_zz_irreducible_p(3*x**4 + 2*x**3 + 6*x**2 + 8*x + 7) is None assert R.dup_zz_irreducible_p(3*x**4 + 2*x**3 + 6*x**2 + 8*x + 4) is None assert R.dup_zz_irreducible_p(3*x**4 + 2*x**3 + 6*x**2 + 8*x + 10) is True assert R.dup_zz_irreducible_p(3*x**4 + 2*x**3 + 6*x**2 + 8*x + 14) is True def test_dup_cyclotomic_p(): R, x = ring("x", ZZ) assert R.dup_cyclotomic_p(x - 1) is True assert R.dup_cyclotomic_p(x + 1) is True assert R.dup_cyclotomic_p(x**2 + x + 1) is True assert R.dup_cyclotomic_p(x**2 + 1) is True assert R.dup_cyclotomic_p(x**4 + x**3 + x**2 + x + 1) is True assert R.dup_cyclotomic_p(x**2 - x + 1) is True assert R.dup_cyclotomic_p(x**6 + x**5 + x**4 + x**3 + x**2 + x + 1) is True assert R.dup_cyclotomic_p(x**4 + 1) is True assert R.dup_cyclotomic_p(x**6 + x**3 + 1) is True assert R.dup_cyclotomic_p(0) is False assert R.dup_cyclotomic_p(1) is False assert R.dup_cyclotomic_p(x) is False assert R.dup_cyclotomic_p(x + 2) is False assert R.dup_cyclotomic_p(3*x + 1) is False assert R.dup_cyclotomic_p(x**2 - 1) is False f = x**16 + x**14 - x**10 + x**8 - x**6 + x**2 + 1 assert R.dup_cyclotomic_p(f) is False g = x**16 + x**14 - x**10 - x**8 - x**6 + x**2 + 1 assert R.dup_cyclotomic_p(g) is True R, x = ring("x", QQ) assert R.dup_cyclotomic_p(x**2 + x + 1) is True assert R.dup_cyclotomic_p(QQ(1,2)*x**2 + x + 1) is False R, x = ring("x", ZZ["y"]) assert R.dup_cyclotomic_p(x**2 + x + 1) is False def test_dup_zz_cyclotomic_poly(): R, x = ring("x", ZZ) assert R.dup_zz_cyclotomic_poly(1) == x - 1 assert R.dup_zz_cyclotomic_poly(2) == x + 1 assert R.dup_zz_cyclotomic_poly(3) == x**2 + x + 1 assert R.dup_zz_cyclotomic_poly(4) == x**2 + 1 assert R.dup_zz_cyclotomic_poly(5) == x**4 + x**3 + x**2 + x + 1 assert R.dup_zz_cyclotomic_poly(6) == x**2 - x + 1 assert R.dup_zz_cyclotomic_poly(7) == x**6 + x**5 + x**4 + x**3 + x**2 + x + 1 assert R.dup_zz_cyclotomic_poly(8) == x**4 + 1 assert R.dup_zz_cyclotomic_poly(9) == x**6 + x**3 + 1 def test_dup_zz_cyclotomic_factor(): R, x = ring("x", ZZ) assert R.dup_zz_cyclotomic_factor(0) is None assert R.dup_zz_cyclotomic_factor(1) is None assert R.dup_zz_cyclotomic_factor(2*x**10 - 1) is None assert R.dup_zz_cyclotomic_factor(x**10 - 3) is None assert R.dup_zz_cyclotomic_factor(x**10 + x**5 - 1) is None assert R.dup_zz_cyclotomic_factor(x + 1) == [x + 1] assert R.dup_zz_cyclotomic_factor(x - 1) == [x - 1] assert R.dup_zz_cyclotomic_factor(x**2 + 1) == [x**2 + 1] assert R.dup_zz_cyclotomic_factor(x**2 - 1) == [x - 1, x + 1] assert R.dup_zz_cyclotomic_factor(x**27 + 1) == \ [x + 1, x**2 - x + 1, x**6 - x**3 + 1, x**18 - x**9 + 1] assert R.dup_zz_cyclotomic_factor(x**27 - 1) == \ [x - 1, x**2 + x + 1, x**6 + x**3 + 1, x**18 + x**9 + 1] def test_dup_zz_factor(): R, x = ring("x", ZZ) assert R.dup_zz_factor(0) == (0, []) assert R.dup_zz_factor(7) == (7, []) assert R.dup_zz_factor(-7) == (-7, []) assert R.dup_zz_factor_sqf(0) == (0, []) assert R.dup_zz_factor_sqf(7) == (7, []) assert R.dup_zz_factor_sqf(-7) == (-7, []) assert R.dup_zz_factor(2*x + 4) == (2, [(x + 2, 1)]) assert R.dup_zz_factor_sqf(2*x + 4) == (2, [x + 2]) f = x**4 + x + 1 for i in range(0, 20): assert R.dup_zz_factor(f) == (1, [(f, 1)]) assert R.dup_zz_factor(x**2 + 2*x + 2) == \ (1, [(x**2 + 2*x + 2, 1)]) assert R.dup_zz_factor(18*x**2 + 12*x + 2) == \ (2, [(3*x + 1, 2)]) assert R.dup_zz_factor(-9*x**2 + 1) == \ (-1, [(3*x - 1, 1), (3*x + 1, 1)]) assert R.dup_zz_factor_sqf(-9*x**2 + 1) == \ (-1, [3*x - 1, 3*x + 1]) assert R.dup_zz_factor(x**3 - 6*x**2 + 11*x - 6) == \ (1, [(x - 3, 1), (x - 2, 1), (x - 1, 1)]) assert R.dup_zz_factor_sqf(x**3 - 6*x**2 + 11*x - 6) == \ (1, [x - 3, x - 2, x - 1]) assert R.dup_zz_factor(3*x**3 + 10*x**2 + 13*x + 10) == \ (1, [(x + 2, 1), (3*x**2 + 4*x + 5, 1)]) assert R.dup_zz_factor_sqf(3*x**3 + 10*x**2 + 13*x + 10) == \ (1, [x + 2, 3*x**2 + 4*x + 5]) assert R.dup_zz_factor(-x**6 + x**2) == \ (-1, [(x - 1, 1), (x + 1, 1), (x, 2), (x**2 + 1, 1)]) f = 1080*x**8 + 5184*x**7 + 2099*x**6 + 744*x**5 + 2736*x**4 - 648*x**3 + 129*x**2 - 324 assert R.dup_zz_factor(f) == \ (1, [(5*x**4 + 24*x**3 + 9*x**2 + 12, 1), (216*x**4 + 31*x**2 - 27, 1)]) f = -29802322387695312500000000000000000000*x**25 \ + 2980232238769531250000000000000000*x**20 \ + 1743435859680175781250000000000*x**15 \ + 114142894744873046875000000*x**10 \ - 210106372833251953125*x**5 \ + 95367431640625 assert R.dup_zz_factor(f) == \ (-95367431640625, [(5*x - 1, 1), (100*x**2 + 10*x - 1, 2), (625*x**4 + 125*x**3 + 25*x**2 + 5*x + 1, 1), (10000*x**4 - 3000*x**3 + 400*x**2 - 20*x + 1, 2), (10000*x**4 + 2000*x**3 + 400*x**2 + 30*x + 1, 2)]) f = x**10 - 1 config.setup('USE_CYCLOTOMIC_FACTOR', True) F_0 = R.dup_zz_factor(f) config.setup('USE_CYCLOTOMIC_FACTOR', False) F_1 = R.dup_zz_factor(f) assert F_0 == F_1 == \ (1, [(x - 1, 1), (x + 1, 1), (x**4 - x**3 + x**2 - x + 1, 1), (x**4 + x**3 + x**2 + x + 1, 1)]) config.setup('USE_CYCLOTOMIC_FACTOR') f = x**10 + 1 config.setup('USE_CYCLOTOMIC_FACTOR', True) F_0 = R.dup_zz_factor(f) config.setup('USE_CYCLOTOMIC_FACTOR', False) F_1 = R.dup_zz_factor(f) assert F_0 == F_1 == \ (1, [(x**2 + 1, 1), (x**8 - x**6 + x**4 - x**2 + 1, 1)]) config.setup('USE_CYCLOTOMIC_FACTOR') def test_dmp_zz_wang(): R, x,y,z = ring("x,y,z", ZZ) UV, _x = ring("x", ZZ) p = ZZ(nextprime(R.dmp_zz_mignotte_bound(w_1))) assert p == 6291469 t_1, k_1, e_1 = y, 1, ZZ(-14) t_2, k_2, e_2 = z, 2, ZZ(3) t_3, k_3, e_3 = y + z, 2, ZZ(-11) t_4, k_4, e_4 = y - z, 1, ZZ(-17) T = [t_1, t_2, t_3, t_4] K = [k_1, k_2, k_3, k_4] E = [e_1, e_2, e_3, e_4] T = zip([ t.drop(x) for t in T ], K) A = [ZZ(-14), ZZ(3)] S = R.dmp_eval_tail(w_1, A) cs, s = UV.dup_primitive(S) assert cs == 1 and s == S == \ 1036728*_x**6 + 915552*_x**5 + 55748*_x**4 + 105621*_x**3 - 17304*_x**2 - 26841*_x - 644 assert R.dmp_zz_wang_non_divisors(E, cs, ZZ(4)) == [7, 3, 11, 17] assert UV.dup_sqf_p(s) and UV.dup_degree(s) == R.dmp_degree(w_1) _, H = UV.dup_zz_factor_sqf(s) h_1 = 44*_x**2 + 42*_x + 1 h_2 = 126*_x**2 - 9*_x + 28 h_3 = 187*_x**2 - 23 assert H == [h_1, h_2, h_3] LC = [ lc.drop(x) for lc in [-4*y - 4*z, -y*z**2, y**2 - z**2] ] assert R.dmp_zz_wang_lead_coeffs(w_1, T, cs, E, H, A) == (w_1, H, LC) factors = R.dmp_zz_wang_hensel_lifting(w_1, H, LC, A, p) assert R.dmp_expand(factors) == w_1 @XFAIL def test_dmp_zz_wang_fail(): R, x,y,z = ring("x,y,z", ZZ) UV, _x = ring("x", ZZ) p = ZZ(nextprime(R.dmp_zz_mignotte_bound(w_1))) assert p == 6291469 H_1 = [44*x**2 + 42*x + 1, 126*x**2 - 9*x + 28, 187*x**2 - 23] H_2 = [-4*x**2*y - 12*x**2 - 3*x*y + 1, -9*x**2*y - 9*x - 2*y, x**2*y**2 - 9*x**2 + y - 9] H_3 = [-4*x**2*y - 12*x**2 - 3*x*y + 1, -9*x**2*y - 9*x - 2*y, x**2*y**2 - 9*x**2 + y - 9] c_1 = -70686*x**5 - 5863*x**4 - 17826*x**3 + 2009*x**2 + 5031*x + 74 c_2 = 9*x**5*y**4 + 12*x**5*y**3 - 45*x**5*y**2 - 108*x**5*y - 324*x**5 + 18*x**4*y**3 - 216*x**4*y**2 - 810*x**4*y + 2*x**3*y**4 + 9*x**3*y**3 - 252*x**3*y**2 - 288*x**3*y - 945*x**3 - 30*x**2*y**2 - 414*x**2*y + 2*x*y**3 - 54*x*y**2 - 3*x*y + 81*x + 12*y c_3 = -36*x**4*y**2 - 108*x**4*y - 27*x**3*y**2 - 36*x**3*y - 108*x**3 - 8*x**2*y**2 - 42*x**2*y - 6*x*y**2 + 9*x + 2*y assert R.dmp_zz_diophantine(H_1, c_1, [], 5, p) == [-3*x, -2, 1] assert R.dmp_zz_diophantine(H_2, c_2, [ZZ(-14)], 5, p) == [-x*y, -3*x, -6] assert R.dmp_zz_diophantine(H_3, c_3, [ZZ(-14)], 5, p) == [0, 0, -1] def test_issue_6355(): # This tests a bug in the Wang algorithm that occurred only with a very # specific set of random numbers. random_sequence = [-1, -1, 0, 0, 0, 0, -1, -1, 0, -1, 3, -1, 3, 3, 3, 3, -1, 3] R, x, y, z = ring("x,y,z", ZZ) f = 2*x**2 + y*z - y - z**2 + z assert R.dmp_zz_wang(f, seed=random_sequence) == [f] def test_dmp_zz_factor(): R, x = ring("x", ZZ) assert R.dmp_zz_factor(0) == (0, []) assert R.dmp_zz_factor(7) == (7, []) assert R.dmp_zz_factor(-7) == (-7, []) assert R.dmp_zz_factor(x**2 - 9) == (1, [(x - 3, 1), (x + 3, 1)]) R, x, y = ring("x,y", ZZ) assert R.dmp_zz_factor(0) == (0, []) assert R.dmp_zz_factor(7) == (7, []) assert R.dmp_zz_factor(-7) == (-7, []) assert R.dmp_zz_factor(x) == (1, [(x, 1)]) assert R.dmp_zz_factor(4*x) == (4, [(x, 1)]) assert R.dmp_zz_factor(4*x + 2) == (2, [(2*x + 1, 1)]) assert R.dmp_zz_factor(x*y + 1) == (1, [(x*y + 1, 1)]) assert R.dmp_zz_factor(y**2 + 1) == (1, [(y**2 + 1, 1)]) assert R.dmp_zz_factor(y**2 - 1) == (1, [(y - 1, 1), (y + 1, 1)]) assert R.dmp_zz_factor(x**2*y**2 + 6*x**2*y + 9*x**2 - 1) == (1, [(x*y + 3*x - 1, 1), (x*y + 3*x + 1, 1)]) assert R.dmp_zz_factor(x**2*y**2 - 9) == (1, [(x*y - 3, 1), (x*y + 3, 1)]) R, x, y, z = ring("x,y,z", ZZ) assert R.dmp_zz_factor(x**2*y**2*z**2 - 9) == \ (1, [(x*y*z - 3, 1), (x*y*z + 3, 1)]) R, x, y, z, u = ring("x,y,z,u", ZZ) assert R.dmp_zz_factor(x**2*y**2*z**2*u**2 - 9) == \ (1, [(x*y*z*u - 3, 1), (x*y*z*u + 3, 1)]) R, x, y, z = ring("x,y,z", ZZ) assert R.dmp_zz_factor(f_1) == \ (1, [(x + y*z + 20, 1), (x*y + z + 10, 1), (x*z + y + 30, 1)]) assert R.dmp_zz_factor(f_2) == \ (1, [(x**2*y**2 + x**2*z**2 + y + 90, 1), (x**3*y + x**3*z + z - 11, 1)]) assert R.dmp_zz_factor(f_3) == \ (1, [(x**2*y**2 + x*z**4 + x + z, 1), (x**3 + x*y*z + y**2 + y*z**3, 1)]) assert R.dmp_zz_factor(f_4) == \ (-1, [(x*y**3 + z**2, 1), (x**2*z + y**4*z**2 + 5, 1), (x**3*y - z**2 - 3, 1), (x**3*y**4 + z**2, 1)]) assert R.dmp_zz_factor(f_5) == \ (-1, [(x + y - z, 3)]) R, x, y, z, t = ring("x,y,z,t", ZZ) assert R.dmp_zz_factor(f_6) == \ (1, [(47*x*y + z**3*t**2 - t**2, 1), (45*x**3 - 9*y**3 - y**2 + 3*z**3 + 2*z*t, 1)]) R, x, y, z = ring("x,y,z", ZZ) assert R.dmp_zz_factor(w_1) == \ (1, [(x**2*y**2 - x**2*z**2 + y - z**2, 1), (x**2*y*z**2 + 3*x*z + 2*y, 1), (4*x**2*y + 4*x**2*z + x*y*z - 1, 1)]) R, x, y = ring("x,y", ZZ) f = -12*x**16*y + 240*x**12*y**3 - 768*x**10*y**4 + 1080*x**8*y**5 - 768*x**6*y**6 + 240*x**4*y**7 - 12*y**9 assert R.dmp_zz_factor(f) == \ (-12, [(y, 1), (x**2 - y, 6), (x**4 + 6*x**2*y + y**2, 1)]) def test_dup_ext_factor(): R, x = ring("x", QQ.algebraic_field(I)) def anp(element): return ANP(element, [QQ(1), QQ(0), QQ(1)], QQ) assert R.dup_ext_factor(0) == (anp([]), []) f = anp([QQ(1)])*x + anp([QQ(1)]) assert R.dup_ext_factor(f) == (anp([QQ(1)]), [(f, 1)]) g = anp([QQ(2)])*x + anp([QQ(2)]) assert R.dup_ext_factor(g) == (anp([QQ(2)]), [(f, 1)]) f = anp([QQ(7)])*x**4 + anp([QQ(1, 1)]) g = anp([QQ(1)])*x**4 + anp([QQ(1, 7)]) assert R.dup_ext_factor(f) == (anp([QQ(7)]), [(g, 1)]) f = anp([QQ(1)])*x**4 + anp([QQ(1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(1, 1)]), [(anp([QQ(1)])*x**2 + anp([QQ(-1), QQ(0)]), 1), (anp([QQ(1)])*x**2 + anp([QQ( 1), QQ(0)]), 1)]) f = anp([QQ(4, 1)])*x**2 + anp([QQ(9, 1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(4, 1)]), [(anp([QQ(1, 1)])*x + anp([-QQ(3, 2), QQ(0, 1)]), 1), (anp([QQ(1, 1)])*x + anp([ QQ(3, 2), QQ(0, 1)]), 1)]) f = anp([QQ(4, 1)])*x**4 + anp([QQ(8, 1)])*x**3 + anp([QQ(77, 1)])*x**2 + anp([QQ(18, 1)])*x + anp([QQ(153, 1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(4, 1)]), [(anp([QQ(1, 1)])*x + anp([-QQ(4, 1), QQ(1, 1)]), 1), (anp([QQ(1, 1)])*x + anp([-QQ(3, 2), QQ(0, 1)]), 1), (anp([QQ(1, 1)])*x + anp([ QQ(3, 2), QQ(0, 1)]), 1), (anp([QQ(1, 1)])*x + anp([ QQ(4, 1), QQ(1, 1)]), 1)]) R, x = ring("x", QQ.algebraic_field(sqrt(2))) def anp(element): return ANP(element, [QQ(1), QQ(0), QQ(-2)], QQ) f = anp([QQ(1)])*x**4 + anp([QQ(1, 1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(1)]), [(anp([QQ(1)])*x**2 + anp([QQ(-1), QQ(0)])*x + anp([QQ(1)]), 1), (anp([QQ(1)])*x**2 + anp([QQ( 1), QQ(0)])*x + anp([QQ(1)]), 1)]) f = anp([QQ(1, 1)])*x**2 + anp([QQ(2), QQ(0)])*x + anp([QQ(2, 1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(1, 1)]), [(anp([1])*x + anp([1, 0]), 2)]) assert R.dup_ext_factor(f**3) == \ (anp([QQ(1, 1)]), [(anp([1])*x + anp([1, 0]), 6)]) f *= anp([QQ(2, 1)]) assert R.dup_ext_factor(f) == \ (anp([QQ(2, 1)]), [(anp([1])*x + anp([1, 0]), 2)]) assert R.dup_ext_factor(f**3) == \ (anp([QQ(8, 1)]), [(anp([1])*x + anp([1, 0]), 6)]) def test_dmp_ext_factor(): R, x,y = ring("x,y", QQ.algebraic_field(sqrt(2))) def anp(x): return ANP(x, [QQ(1), QQ(0), QQ(-2)], QQ) assert R.dmp_ext_factor(0) == (anp([]), []) f = anp([QQ(1)])*x + anp([QQ(1)]) assert R.dmp_ext_factor(f) == (anp([QQ(1)]), [(f, 1)]) g = anp([QQ(2)])*x + anp([QQ(2)]) assert R.dmp_ext_factor(g) == (anp([QQ(2)]), [(f, 1)]) f = anp([QQ(1)])*x**2 + anp([QQ(-2)])*y**2 assert R.dmp_ext_factor(f) == \ (anp([QQ(1)]), [(anp([QQ(1)])*x + anp([QQ(-1), QQ(0)])*y, 1), (anp([QQ(1)])*x + anp([QQ( 1), QQ(0)])*y, 1)]) f = anp([QQ(2)])*x**2 + anp([QQ(-4)])*y**2 assert R.dmp_ext_factor(f) == \ (anp([QQ(2)]), [(anp([QQ(1)])*x + anp([QQ(-1), QQ(0)])*y, 1), (anp([QQ(1)])*x + anp([QQ( 1), QQ(0)])*y, 1)]) def test_dup_factor_list(): R, x = ring("x", ZZ) assert R.dup_factor_list(0) == (0, []) assert R.dup_factor_list(7) == (7, []) R, x = ring("x", QQ) assert R.dup_factor_list(0) == (0, []) assert R.dup_factor_list(QQ(1, 7)) == (QQ(1, 7), []) R, x = ring("x", ZZ['t']) assert R.dup_factor_list(0) == (0, []) assert R.dup_factor_list(7) == (7, []) R, x = ring("x", QQ['t']) assert R.dup_factor_list(0) == (0, []) assert R.dup_factor_list(QQ(1, 7)) == (QQ(1, 7), []) R, x = ring("x", ZZ) assert R.dup_factor_list_include(0) == [(0, 1)] assert R.dup_factor_list_include(7) == [(7, 1)] assert R.dup_factor_list(x**2 + 2*x + 1) == (1, [(x + 1, 2)]) assert R.dup_factor_list_include(x**2 + 2*x + 1) == [(x + 1, 2)] # issue 8037 assert R.dup_factor_list(6*x**2 - 5*x - 6) == (1, [(2*x - 3, 1), (3*x + 2, 1)]) R, x = ring("x", QQ) assert R.dup_factor_list(QQ(1,2)*x**2 + x + QQ(1,2)) == (QQ(1, 2), [(x + 1, 2)]) R, x = ring("x", FF(2)) assert R.dup_factor_list(x**2 + 1) == (1, [(x + 1, 2)]) R, x = ring("x", RR) assert R.dup_factor_list(1.0*x**2 + 2.0*x + 1.0) == (1.0, [(1.0*x + 1.0, 2)]) assert R.dup_factor_list(2.0*x**2 + 4.0*x + 2.0) == (2.0, [(1.0*x + 1.0, 2)]) f = 6.7225336055071*x**2 - 10.6463972754741*x - 0.33469524022264 coeff, factors = R.dup_factor_list(f) assert coeff == RR(10.6463972754741) assert len(factors) == 1 assert factors[0][0].max_norm() == RR(1.0) assert factors[0][1] == 1 Rt, t = ring("t", ZZ) R, x = ring("x", Rt) f = 4*t*x**2 + 4*t**2*x assert R.dup_factor_list(f) == \ (4*t, [(x, 1), (x + t, 1)]) Rt, t = ring("t", QQ) R, x = ring("x", Rt) f = QQ(1, 2)*t*x**2 + QQ(1, 2)*t**2*x assert R.dup_factor_list(f) == \ (QQ(1, 2)*t, [(x, 1), (x + t, 1)]) R, x = ring("x", QQ.algebraic_field(I)) def anp(element): return ANP(element, [QQ(1), QQ(0), QQ(1)], QQ) f = anp([QQ(1, 1)])*x**4 + anp([QQ(2, 1)])*x**2 assert R.dup_factor_list(f) == \ (anp([QQ(1, 1)]), [(anp([QQ(1, 1)])*x, 2), (anp([QQ(1, 1)])*x**2 + anp([])*x + anp([QQ(2, 1)]), 1)]) R, x = ring("x", EX) raises(DomainError, lambda: R.dup_factor_list(EX(sin(1)))) def test_dmp_factor_list(): R, x, y = ring("x,y", ZZ) assert R.dmp_factor_list(0) == (ZZ(0), []) assert R.dmp_factor_list(7) == (7, []) R, x, y = ring("x,y", QQ) assert R.dmp_factor_list(0) == (QQ(0), []) assert R.dmp_factor_list(QQ(1, 7)) == (QQ(1, 7), []) Rt, t = ring("t", ZZ) R, x, y = ring("x,y", Rt) assert R.dmp_factor_list(0) == (0, []) assert R.dmp_factor_list(7) == (ZZ(7), []) Rt, t = ring("t", QQ) R, x, y = ring("x,y", Rt) assert R.dmp_factor_list(0) == (0, []) assert R.dmp_factor_list(QQ(1, 7)) == (QQ(1, 7), []) R, x, y = ring("x,y", ZZ) assert R.dmp_factor_list_include(0) == [(0, 1)] assert R.dmp_factor_list_include(7) == [(7, 1)] R, X = xring("x:200", ZZ) f, g = X[0]**2 + 2*X[0] + 1, X[0] + 1 assert R.dmp_factor_list(f) == (1, [(g, 2)]) f, g = X[-1]**2 + 2*X[-1] + 1, X[-1] + 1 assert R.dmp_factor_list(f) == (1, [(g, 2)]) R, x = ring("x", ZZ) assert R.dmp_factor_list(x**2 + 2*x + 1) == (1, [(x + 1, 2)]) R, x = ring("x", QQ) assert R.dmp_factor_list(QQ(1,2)*x**2 + x + QQ(1,2)) == (QQ(1,2), [(x + 1, 2)]) R, x, y = ring("x,y", ZZ) assert R.dmp_factor_list(x**2 + 2*x + 1) == (1, [(x + 1, 2)]) R, x, y = ring("x,y", QQ) assert R.dmp_factor_list(QQ(1,2)*x**2 + x + QQ(1,2)) == (QQ(1,2), [(x + 1, 2)]) R, x, y = ring("x,y", ZZ) f = 4*x**2*y + 4*x*y**2 assert R.dmp_factor_list(f) == \ (4, [(y, 1), (x, 1), (x + y, 1)]) assert R.dmp_factor_list_include(f) == \ [(4*y, 1), (x, 1), (x + y, 1)] R, x, y = ring("x,y", QQ) f = QQ(1,2)*x**2*y + QQ(1,2)*x*y**2 assert R.dmp_factor_list(f) == \ (QQ(1,2), [(y, 1), (x, 1), (x + y, 1)]) R, x, y = ring("x,y", RR) f = 2.0*x**2 - 8.0*y**2 assert R.dmp_factor_list(f) == \ (RR(8.0), [(0.5*x - y, 1), (0.5*x + y, 1)]) f = 6.7225336055071*x**2*y**2 - 10.6463972754741*x*y - 0.33469524022264 coeff, factors = R.dmp_factor_list(f) assert coeff == RR(10.6463972754741) assert len(factors) == 1 assert factors[0][0].max_norm() == RR(1.0) assert factors[0][1] == 1 Rt, t = ring("t", ZZ) R, x, y = ring("x,y", Rt) f = 4*t*x**2 + 4*t**2*x assert R.dmp_factor_list(f) == \ (4*t, [(x, 1), (x + t, 1)]) Rt, t = ring("t", QQ) R, x, y = ring("x,y", Rt) f = QQ(1, 2)*t*x**2 + QQ(1, 2)*t**2*x assert R.dmp_factor_list(f) == \ (QQ(1, 2)*t, [(x, 1), (x + t, 1)]) R, x, y = ring("x,y", FF(2)) raises(NotImplementedError, lambda: R.dmp_factor_list(x**2 + y**2)) R, x, y = ring("x,y", EX) raises(DomainError, lambda: R.dmp_factor_list(EX(sin(1)))) def test_dup_irreducible_p(): R, x = ring("x", ZZ) assert R.dup_irreducible_p(x**2 + x + 1) is True assert R.dup_irreducible_p(x**2 + 2*x + 1) is False def test_dmp_irreducible_p(): R, x, y = ring("x,y", ZZ) assert R.dmp_irreducible_p(x**2 + x + 1) is True assert R.dmp_irreducible_p(x**2 + 2*x + 1) is False
116a61830d29a164e4567b63c04dda643e4b1d87f7aaca1e8380e1576aeb4e81
from sympy.polys.domains import QQ, EX, RR from sympy.polys.rings import ring from sympy.polys.ring_series import (_invert_monoms, rs_integrate, rs_trunc, rs_mul, rs_square, rs_pow, _has_constant_term, rs_hadamard_exp, rs_series_from_list, rs_exp, rs_log, rs_newton, rs_series_inversion, rs_compose_add, rs_asin, rs_atan, rs_atanh, rs_tan, rs_cot, rs_sin, rs_cos, rs_cos_sin, rs_sinh, rs_cosh, rs_tanh, _tan1, rs_fun, rs_nth_root, rs_LambertW, rs_series_reversion, rs_is_puiseux, rs_series) from sympy.testing.pytest import raises from sympy.core.symbol import symbols from sympy.functions import (sin, cos, exp, tan, cot, atan, atanh, tanh, log, sqrt) from sympy.core.numbers import Rational from sympy.core import expand, S def is_close(a, b): tol = 10**(-10) assert abs(a - b) < tol def test_ring_series1(): R, x = ring('x', QQ) p = x**4 + 2*x**3 + 3*x + 4 assert _invert_monoms(p) == 4*x**4 + 3*x**3 + 2*x + 1 assert rs_hadamard_exp(p) == x**4/24 + x**3/3 + 3*x + 4 R, x = ring('x', QQ) p = x**4 + 2*x**3 + 3*x + 4 assert rs_integrate(p, x) == x**5/5 + x**4/2 + 3*x**2/2 + 4*x R, x, y = ring('x, y', QQ) p = x**2*y**2 + x + 1 assert rs_integrate(p, x) == x**3*y**2/3 + x**2/2 + x assert rs_integrate(p, y) == x**2*y**3/3 + x*y + y def test_trunc(): R, x, y, t = ring('x, y, t', QQ) p = (y + t*x)**4 p1 = rs_trunc(p, x, 3) assert p1 == y**4 + 4*y**3*t*x + 6*y**2*t**2*x**2 def test_mul_trunc(): R, x, y, t = ring('x, y, t', QQ) p = 1 + t*x + t*y for i in range(2): p = rs_mul(p, p, t, 3) assert p == 6*x**2*t**2 + 12*x*y*t**2 + 6*y**2*t**2 + 4*x*t + 4*y*t + 1 p = 1 + t*x + t*y + t**2*x*y p1 = rs_mul(p, p, t, 2) assert p1 == 1 + 2*t*x + 2*t*y R1, z = ring('z', QQ) raises(ValueError, lambda: rs_mul(p, z, x, 2)) p1 = 2 + 2*x + 3*x**2 p2 = 3 + x**2 assert rs_mul(p1, p2, x, 4) == 2*x**3 + 11*x**2 + 6*x + 6 def test_square_trunc(): R, x, y, t = ring('x, y, t', QQ) p = (1 + t*x + t*y)*2 p1 = rs_mul(p, p, x, 3) p2 = rs_square(p, x, 3) assert p1 == p2 p = 1 + x + x**2 + x**3 assert rs_square(p, x, 4) == 4*x**3 + 3*x**2 + 2*x + 1 def test_pow_trunc(): R, x, y, z = ring('x, y, z', QQ) p0 = y + x*z p = p0**16 for xx in (x, y, z): p1 = rs_trunc(p, xx, 8) p2 = rs_pow(p0, 16, xx, 8) assert p1 == p2 p = 1 + x p1 = rs_pow(p, 3, x, 2) assert p1 == 1 + 3*x assert rs_pow(p, 0, x, 2) == 1 assert rs_pow(p, -2, x, 2) == 1 - 2*x p = x + y assert rs_pow(p, 3, y, 3) == x**3 + 3*x**2*y + 3*x*y**2 assert rs_pow(1 + x, Rational(2, 3), x, 4) == 4*x**3/81 - x**2/9 + x*Rational(2, 3) + 1 def test_has_constant_term(): R, x, y, z = ring('x, y, z', QQ) p = y + x*z assert _has_constant_term(p, x) p = x + x**4 assert not _has_constant_term(p, x) p = 1 + x + x**4 assert _has_constant_term(p, x) p = x + y + x*z def test_inversion(): R, x = ring('x', QQ) p = 2 + x + 2*x**2 n = 5 p1 = rs_series_inversion(p, x, n) assert rs_trunc(p*p1, x, n) == 1 R, x, y = ring('x, y', QQ) p = 2 + x + 2*x**2 + y*x + x**2*y p1 = rs_series_inversion(p, x, n) assert rs_trunc(p*p1, x, n) == 1 R, x, y = ring('x, y', QQ) p = 1 + x + y raises(NotImplementedError, lambda: rs_series_inversion(p, x, 4)) p = R.zero raises(ZeroDivisionError, lambda: rs_series_inversion(p, x, 3)) def test_series_reversion(): R, x, y = ring('x, y', QQ) p = rs_tan(x, x, 10) assert rs_series_reversion(p, x, 8, y) == rs_atan(y, y, 8) p = rs_sin(x, x, 10) assert rs_series_reversion(p, x, 8, y) == 5*y**7/112 + 3*y**5/40 + \ y**3/6 + y def test_series_from_list(): R, x = ring('x', QQ) p = 1 + 2*x + x**2 + 3*x**3 c = [1, 2, 0, 4, 4] r = rs_series_from_list(p, c, x, 5) pc = R.from_list(list(reversed(c))) r1 = rs_trunc(pc.compose(x, p), x, 5) assert r == r1 R, x, y = ring('x, y', QQ) c = [1, 3, 5, 7] p1 = rs_series_from_list(x + y, c, x, 3, concur=0) p2 = rs_trunc((1 + 3*(x+y) + 5*(x+y)**2 + 7*(x+y)**3), x, 3) assert p1 == p2 R, x = ring('x', QQ) h = 25 p = rs_exp(x, x, h) - 1 p1 = rs_series_from_list(p, c, x, h) p2 = 0 for i, cx in enumerate(c): p2 += cx*rs_pow(p, i, x, h) assert p1 == p2 def test_log(): R, x = ring('x', QQ) p = 1 + x p1 = rs_log(p, x, 4)/x**2 assert p1 == Rational(1, 3)*x - S.Half + x**(-1) p = 1 + x +2*x**2/3 p1 = rs_log(p, x, 9) assert p1 == -17*x**8/648 + 13*x**7/189 - 11*x**6/162 - x**5/45 + \ 7*x**4/36 - x**3/3 + x**2/6 + x p2 = rs_series_inversion(p, x, 9) p3 = rs_log(p2, x, 9) assert p3 == -p1 R, x, y = ring('x, y', QQ) p = 1 + x + 2*y*x**2 p1 = rs_log(p, x, 6) assert p1 == (4*x**5*y**2 - 2*x**5*y - 2*x**4*y**2 + x**5/5 + 2*x**4*y - x**4/4 - 2*x**3*y + x**3/3 + 2*x**2*y - x**2/2 + x) # Constant term in series a = symbols('a') R, x, y = ring('x, y', EX) assert rs_log(x + a, x, 5) == -EX(1/(4*a**4))*x**4 + EX(1/(3*a**3))*x**3 \ - EX(1/(2*a**2))*x**2 + EX(1/a)*x + EX(log(a)) assert rs_log(x + x**2*y + a, x, 4) == -EX(a**(-2))*x**3*y + \ EX(1/(3*a**3))*x**3 + EX(1/a)*x**2*y - EX(1/(2*a**2))*x**2 + \ EX(1/a)*x + EX(log(a)) p = x + x**2 + 3 assert rs_log(p, x, 10).compose(x, 5) == EX(log(3) + Rational(19281291595, 9920232)) def test_exp(): R, x = ring('x', QQ) p = x + x**4 for h in [10, 30]: q = rs_series_inversion(1 + p, x, h) - 1 p1 = rs_exp(q, x, h) q1 = rs_log(p1, x, h) assert q1 == q p1 = rs_exp(p, x, 30) assert p1.coeff(x**29) == QQ(74274246775059676726972369, 353670479749588078181744640000) prec = 21 p = rs_log(1 + x, x, prec) p1 = rs_exp(p, x, prec) assert p1 == x + 1 # Constant term in series a = symbols('a') R, x, y = ring('x, y', QQ[exp(a), a]) assert rs_exp(x + a, x, 5) == exp(a)*x**4/24 + exp(a)*x**3/6 + \ exp(a)*x**2/2 + exp(a)*x + exp(a) assert rs_exp(x + x**2*y + a, x, 5) == exp(a)*x**4*y**2/2 + \ exp(a)*x**4*y/2 + exp(a)*x**4/24 + exp(a)*x**3*y + \ exp(a)*x**3/6 + exp(a)*x**2*y + exp(a)*x**2/2 + exp(a)*x + exp(a) R, x, y = ring('x, y', EX) assert rs_exp(x + a, x, 5) == EX(exp(a)/24)*x**4 + EX(exp(a)/6)*x**3 + \ EX(exp(a)/2)*x**2 + EX(exp(a))*x + EX(exp(a)) assert rs_exp(x + x**2*y + a, x, 5) == EX(exp(a)/2)*x**4*y**2 + \ EX(exp(a)/2)*x**4*y + EX(exp(a)/24)*x**4 + EX(exp(a))*x**3*y + \ EX(exp(a)/6)*x**3 + EX(exp(a))*x**2*y + EX(exp(a)/2)*x**2 + \ EX(exp(a))*x + EX(exp(a)) def test_newton(): R, x = ring('x', QQ) p = x**2 - 2 r = rs_newton(p, x, 4) assert r == 8*x**4 + 4*x**2 + 2 def test_compose_add(): R, x = ring('x', QQ) p1 = x**3 - 1 p2 = x**2 - 2 assert rs_compose_add(p1, p2) == x**6 - 6*x**4 - 2*x**3 + 12*x**2 - 12*x - 7 def test_fun(): R, x, y = ring('x, y', QQ) p = x*y + x**2*y**3 + x**5*y assert rs_fun(p, rs_tan, x, 10) == rs_tan(p, x, 10) assert rs_fun(p, _tan1, x, 10) == _tan1(p, x, 10) def test_nth_root(): R, x, y = ring('x, y', QQ) assert rs_nth_root(1 + x**2*y, 4, x, 10) == -77*x**8*y**4/2048 + \ 7*x**6*y**3/128 - 3*x**4*y**2/32 + x**2*y/4 + 1 assert rs_nth_root(1 + x*y + x**2*y**3, 3, x, 5) == -x**4*y**6/9 + \ 5*x**4*y**5/27 - 10*x**4*y**4/243 - 2*x**3*y**4/9 + 5*x**3*y**3/81 + \ x**2*y**3/3 - x**2*y**2/9 + x*y/3 + 1 assert rs_nth_root(8*x, 3, x, 3) == 2*x**QQ(1, 3) assert rs_nth_root(8*x + x**2 + x**3, 3, x, 3) == x**QQ(4,3)/12 + 2*x**QQ(1,3) r = rs_nth_root(8*x + x**2*y + x**3, 3, x, 4) assert r == -x**QQ(7,3)*y**2/288 + x**QQ(7,3)/12 + x**QQ(4,3)*y/12 + 2*x**QQ(1,3) # Constant term in series a = symbols('a') R, x, y = ring('x, y', EX) assert rs_nth_root(x + a, 3, x, 4) == EX(5/(81*a**QQ(8, 3)))*x**3 - \ EX(1/(9*a**QQ(5, 3)))*x**2 + EX(1/(3*a**QQ(2, 3)))*x + EX(a**QQ(1, 3)) assert rs_nth_root(x**QQ(2, 3) + x**2*y + 5, 2, x, 3) == -EX(sqrt(5)/100)*\ x**QQ(8, 3)*y - EX(sqrt(5)/16000)*x**QQ(8, 3) + EX(sqrt(5)/10)*x**2*y + \ EX(sqrt(5)/2000)*x**2 - EX(sqrt(5)/200)*x**QQ(4, 3) + \ EX(sqrt(5)/10)*x**QQ(2, 3) + EX(sqrt(5)) def test_atan(): R, x, y = ring('x, y', QQ) assert rs_atan(x, x, 9) == -x**7/7 + x**5/5 - x**3/3 + x assert rs_atan(x*y + x**2*y**3, x, 9) == 2*x**8*y**11 - x**8*y**9 + \ 2*x**7*y**9 - x**7*y**7/7 - x**6*y**9/3 + x**6*y**7 - x**5*y**7 + \ x**5*y**5/5 - x**4*y**5 - x**3*y**3/3 + x**2*y**3 + x*y # Constant term in series a = symbols('a') R, x, y = ring('x, y', EX) assert rs_atan(x + a, x, 5) == -EX((a**3 - a)/(a**8 + 4*a**6 + 6*a**4 + \ 4*a**2 + 1))*x**4 + EX((3*a**2 - 1)/(3*a**6 + 9*a**4 + \ 9*a**2 + 3))*x**3 - EX(a/(a**4 + 2*a**2 + 1))*x**2 + \ EX(1/(a**2 + 1))*x + EX(atan(a)) assert rs_atan(x + x**2*y + a, x, 4) == -EX(2*a/(a**4 + 2*a**2 + 1)) \ *x**3*y + EX((3*a**2 - 1)/(3*a**6 + 9*a**4 + 9*a**2 + 3))*x**3 + \ EX(1/(a**2 + 1))*x**2*y - EX(a/(a**4 + 2*a**2 + 1))*x**2 + EX(1/(a**2 \ + 1))*x + EX(atan(a)) def test_asin(): R, x, y = ring('x, y', QQ) assert rs_asin(x + x*y, x, 5) == x**3*y**3/6 + x**3*y**2/2 + x**3*y/2 + \ x**3/6 + x*y + x assert rs_asin(x*y + x**2*y**3, x, 6) == x**5*y**7/2 + 3*x**5*y**5/40 + \ x**4*y**5/2 + x**3*y**3/6 + x**2*y**3 + x*y def test_tan(): R, x, y = ring('x, y', QQ) assert rs_tan(x, x, 9)/x**5 == \ Rational(17, 315)*x**2 + Rational(2, 15) + Rational(1, 3)*x**(-2) + x**(-4) assert rs_tan(x*y + x**2*y**3, x, 9) == 4*x**8*y**11/3 + 17*x**8*y**9/45 + \ 4*x**7*y**9/3 + 17*x**7*y**7/315 + x**6*y**9/3 + 2*x**6*y**7/3 + \ x**5*y**7 + 2*x**5*y**5/15 + x**4*y**5 + x**3*y**3/3 + x**2*y**3 + x*y # Constant term in series a = symbols('a') R, x, y = ring('x, y', QQ[tan(a), a]) assert rs_tan(x + a, x, 5) == (tan(a)**5 + 5*tan(a)**3/3 + 2*tan(a)/3)*x**4 + (tan(a)**4 + 4*tan(a)**2/3 + Rational(1, 3))*x**3 + \ (tan(a)**3 + tan(a))*x**2 + (tan(a)**2 + 1)*x + tan(a) assert rs_tan(x + x**2*y + a, x, 4) == (2*tan(a)**3 + 2*tan(a))*x**3*y + \ (tan(a)**4 + Rational(4, 3)*tan(a)**2 + Rational(1, 3))*x**3 + (tan(a)**2 + 1)*x**2*y + \ (tan(a)**3 + tan(a))*x**2 + (tan(a)**2 + 1)*x + tan(a) R, x, y = ring('x, y', EX) assert rs_tan(x + a, x, 5) == EX(tan(a)**5 + 5*tan(a)**3/3 + 2*tan(a)/3)*x**4 + EX(tan(a)**4 + 4*tan(a)**2/3 + EX(1)/3)*x**3 + \ EX(tan(a)**3 + tan(a))*x**2 + EX(tan(a)**2 + 1)*x + EX(tan(a)) assert rs_tan(x + x**2*y + a, x, 4) == EX(2*tan(a)**3 + 2*tan(a))*x**3*y + EX(tan(a)**4 + 4*tan(a)**2/3 + EX(1)/3)*x**3 + \ EX(tan(a)**2 + 1)*x**2*y + EX(tan(a)**3 + tan(a))*x**2 + \ EX(tan(a)**2 + 1)*x + EX(tan(a)) p = x + x**2 + 5 assert rs_atan(p, x, 10).compose(x, 10) == EX(atan(5) + S(67701870330562640) / \ 668083460499) def test_cot(): R, x, y = ring('x, y', QQ) assert rs_cot(x**6 + x**7, x, 8) == x**(-6) - x**(-5) + x**(-4) - \ x**(-3) + x**(-2) - x**(-1) + 1 - x + x**2 - x**3 + x**4 - x**5 + \ 2*x**6/3 - 4*x**7/3 assert rs_cot(x + x**2*y, x, 5) == -x**4*y**5 - x**4*y/15 + x**3*y**4 - \ x**3/45 - x**2*y**3 - x**2*y/3 + x*y**2 - x/3 - y + x**(-1) def test_sin(): R, x, y = ring('x, y', QQ) assert rs_sin(x, x, 9)/x**5 == \ Rational(-1, 5040)*x**2 + Rational(1, 120) - Rational(1, 6)*x**(-2) + x**(-4) assert rs_sin(x*y + x**2*y**3, x, 9) == x**8*y**11/12 - \ x**8*y**9/720 + x**7*y**9/12 - x**7*y**7/5040 - x**6*y**9/6 + \ x**6*y**7/24 - x**5*y**7/2 + x**5*y**5/120 - x**4*y**5/2 - \ x**3*y**3/6 + x**2*y**3 + x*y # Constant term in series a = symbols('a') R, x, y = ring('x, y', QQ[sin(a), cos(a), a]) assert rs_sin(x + a, x, 5) == sin(a)*x**4/24 - cos(a)*x**3/6 - \ sin(a)*x**2/2 + cos(a)*x + sin(a) assert rs_sin(x + x**2*y + a, x, 5) == -sin(a)*x**4*y**2/2 - \ cos(a)*x**4*y/2 + sin(a)*x**4/24 - sin(a)*x**3*y - cos(a)*x**3/6 + \ cos(a)*x**2*y - sin(a)*x**2/2 + cos(a)*x + sin(a) R, x, y = ring('x, y', EX) assert rs_sin(x + a, x, 5) == EX(sin(a)/24)*x**4 - EX(cos(a)/6)*x**3 - \ EX(sin(a)/2)*x**2 + EX(cos(a))*x + EX(sin(a)) assert rs_sin(x + x**2*y + a, x, 5) == -EX(sin(a)/2)*x**4*y**2 - \ EX(cos(a)/2)*x**4*y + EX(sin(a)/24)*x**4 - EX(sin(a))*x**3*y - \ EX(cos(a)/6)*x**3 + EX(cos(a))*x**2*y - EX(sin(a)/2)*x**2 + \ EX(cos(a))*x + EX(sin(a)) def test_cos(): R, x, y = ring('x, y', QQ) assert rs_cos(x, x, 9)/x**5 == \ Rational(1, 40320)*x**3 - Rational(1, 720)*x + Rational(1, 24)*x**(-1) - S.Half*x**(-3) + x**(-5) assert rs_cos(x*y + x**2*y**3, x, 9) == x**8*y**12/24 - \ x**8*y**10/48 + x**8*y**8/40320 + x**7*y**10/6 - \ x**7*y**8/120 + x**6*y**8/4 - x**6*y**6/720 + x**5*y**6/6 - \ x**4*y**6/2 + x**4*y**4/24 - x**3*y**4 - x**2*y**2/2 + 1 # Constant term in series a = symbols('a') R, x, y = ring('x, y', QQ[sin(a), cos(a), a]) assert rs_cos(x + a, x, 5) == cos(a)*x**4/24 + sin(a)*x**3/6 - \ cos(a)*x**2/2 - sin(a)*x + cos(a) assert rs_cos(x + x**2*y + a, x, 5) == -cos(a)*x**4*y**2/2 + \ sin(a)*x**4*y/2 + cos(a)*x**4/24 - cos(a)*x**3*y + sin(a)*x**3/6 - \ sin(a)*x**2*y - cos(a)*x**2/2 - sin(a)*x + cos(a) R, x, y = ring('x, y', EX) assert rs_cos(x + a, x, 5) == EX(cos(a)/24)*x**4 + EX(sin(a)/6)*x**3 - \ EX(cos(a)/2)*x**2 - EX(sin(a))*x + EX(cos(a)) assert rs_cos(x + x**2*y + a, x, 5) == -EX(cos(a)/2)*x**4*y**2 + \ EX(sin(a)/2)*x**4*y + EX(cos(a)/24)*x**4 - EX(cos(a))*x**3*y + \ EX(sin(a)/6)*x**3 - EX(sin(a))*x**2*y - EX(cos(a)/2)*x**2 - \ EX(sin(a))*x + EX(cos(a)) def test_cos_sin(): R, x, y = ring('x, y', QQ) cos, sin = rs_cos_sin(x, x, 9) assert cos == rs_cos(x, x, 9) assert sin == rs_sin(x, x, 9) cos, sin = rs_cos_sin(x + x*y, x, 5) assert cos == rs_cos(x + x*y, x, 5) assert sin == rs_sin(x + x*y, x, 5) def test_atanh(): R, x, y = ring('x, y', QQ) assert rs_atanh(x, x, 9)/x**5 == Rational(1, 7)*x**2 + Rational(1, 5) + Rational(1, 3)*x**(-2) + x**(-4) assert rs_atanh(x*y + x**2*y**3, x, 9) == 2*x**8*y**11 + x**8*y**9 + \ 2*x**7*y**9 + x**7*y**7/7 + x**6*y**9/3 + x**6*y**7 + x**5*y**7 + \ x**5*y**5/5 + x**4*y**5 + x**3*y**3/3 + x**2*y**3 + x*y # Constant term in series a = symbols('a') R, x, y = ring('x, y', EX) assert rs_atanh(x + a, x, 5) == EX((a**3 + a)/(a**8 - 4*a**6 + 6*a**4 - \ 4*a**2 + 1))*x**4 - EX((3*a**2 + 1)/(3*a**6 - 9*a**4 + \ 9*a**2 - 3))*x**3 + EX(a/(a**4 - 2*a**2 + 1))*x**2 - EX(1/(a**2 - \ 1))*x + EX(atanh(a)) assert rs_atanh(x + x**2*y + a, x, 4) == EX(2*a/(a**4 - 2*a**2 + \ 1))*x**3*y - EX((3*a**2 + 1)/(3*a**6 - 9*a**4 + 9*a**2 - 3))*x**3 - \ EX(1/(a**2 - 1))*x**2*y + EX(a/(a**4 - 2*a**2 + 1))*x**2 - \ EX(1/(a**2 - 1))*x + EX(atanh(a)) p = x + x**2 + 5 assert rs_atanh(p, x, 10).compose(x, 10) == EX(Rational(-733442653682135, 5079158784) \ + atanh(5)) def test_sinh(): R, x, y = ring('x, y', QQ) assert rs_sinh(x, x, 9)/x**5 == Rational(1, 5040)*x**2 + Rational(1, 120) + Rational(1, 6)*x**(-2) + x**(-4) assert rs_sinh(x*y + x**2*y**3, x, 9) == x**8*y**11/12 + \ x**8*y**9/720 + x**7*y**9/12 + x**7*y**7/5040 + x**6*y**9/6 + \ x**6*y**7/24 + x**5*y**7/2 + x**5*y**5/120 + x**4*y**5/2 + \ x**3*y**3/6 + x**2*y**3 + x*y def test_cosh(): R, x, y = ring('x, y', QQ) assert rs_cosh(x, x, 9)/x**5 == Rational(1, 40320)*x**3 + Rational(1, 720)*x + Rational(1, 24)*x**(-1) + \ S.Half*x**(-3) + x**(-5) assert rs_cosh(x*y + x**2*y**3, x, 9) == x**8*y**12/24 + \ x**8*y**10/48 + x**8*y**8/40320 + x**7*y**10/6 + \ x**7*y**8/120 + x**6*y**8/4 + x**6*y**6/720 + x**5*y**6/6 + \ x**4*y**6/2 + x**4*y**4/24 + x**3*y**4 + x**2*y**2/2 + 1 def test_tanh(): R, x, y = ring('x, y', QQ) assert rs_tanh(x, x, 9)/x**5 == Rational(-17, 315)*x**2 + Rational(2, 15) - Rational(1, 3)*x**(-2) + x**(-4) assert rs_tanh(x*y + x**2*y**3, x, 9) == 4*x**8*y**11/3 - \ 17*x**8*y**9/45 + 4*x**7*y**9/3 - 17*x**7*y**7/315 - x**6*y**9/3 + \ 2*x**6*y**7/3 - x**5*y**7 + 2*x**5*y**5/15 - x**4*y**5 - \ x**3*y**3/3 + x**2*y**3 + x*y # Constant term in series a = symbols('a') R, x, y = ring('x, y', EX) assert rs_tanh(x + a, x, 5) == EX(tanh(a)**5 - 5*tanh(a)**3/3 + 2*tanh(a)/3)*x**4 + EX(-tanh(a)**4 + 4*tanh(a)**2/3 - QQ(1, 3))*x**3 + \ EX(tanh(a)**3 - tanh(a))*x**2 + EX(-tanh(a)**2 + 1)*x + EX(tanh(a)) p = rs_tanh(x + x**2*y + a, x, 4) assert (p.compose(x, 10)).compose(y, 5) == EX(-1000*tanh(a)**4 + \ 10100*tanh(a)**3 + 2470*tanh(a)**2/3 - 10099*tanh(a) + QQ(530, 3)) def test_RR(): rs_funcs = [rs_sin, rs_cos, rs_tan, rs_cot, rs_atan, rs_tanh] sympy_funcs = [sin, cos, tan, cot, atan, tanh] R, x, y = ring('x, y', RR) a = symbols('a') for rs_func, sympy_func in zip(rs_funcs, sympy_funcs): p = rs_func(2 + x, x, 5).compose(x, 5) q = sympy_func(2 + a).series(a, 0, 5).removeO() is_close(p.as_expr(), q.subs(a, 5).n()) p = rs_nth_root(2 + x, 5, x, 5).compose(x, 5) q = ((2 + a)**QQ(1, 5)).series(a, 0, 5).removeO() is_close(p.as_expr(), q.subs(a, 5).n()) def test_is_regular(): R, x, y = ring('x, y', QQ) p = 1 + 2*x + x**2 + 3*x**3 assert not rs_is_puiseux(p, x) p = x + x**QQ(1,5)*y assert rs_is_puiseux(p, x) assert not rs_is_puiseux(p, y) p = x + x**2*y**QQ(1,5)*y assert not rs_is_puiseux(p, x) def test_puiseux(): R, x, y = ring('x, y', QQ) p = x**QQ(2,5) + x**QQ(2,3) + x r = rs_series_inversion(p, x, 1) r1 = -x**QQ(14,15) + x**QQ(4,5) - 3*x**QQ(11,15) + x**QQ(2,3) + \ 2*x**QQ(7,15) - x**QQ(2,5) - x**QQ(1,5) + x**QQ(2,15) - x**QQ(-2,15) \ + x**QQ(-2,5) assert r == r1 r = rs_nth_root(1 + p, 3, x, 1) assert r == -x**QQ(4,5)/9 + x**QQ(2,3)/3 + x**QQ(2,5)/3 + 1 r = rs_log(1 + p, x, 1) assert r == -x**QQ(4,5)/2 + x**QQ(2,3) + x**QQ(2,5) r = rs_LambertW(p, x, 1) assert r == -x**QQ(4,5) + x**QQ(2,3) + x**QQ(2,5) p1 = x + x**QQ(1,5)*y r = rs_exp(p1, x, 1) assert r == x**QQ(4,5)*y**4/24 + x**QQ(3,5)*y**3/6 + x**QQ(2,5)*y**2/2 + \ x**QQ(1,5)*y + 1 r = rs_atan(p, x, 2) assert r == -x**QQ(9,5) - x**QQ(26,15) - x**QQ(22,15) - x**QQ(6,5)/3 + \ x + x**QQ(2,3) + x**QQ(2,5) r = rs_atan(p1, x, 2) assert r == x**QQ(9,5)*y**9/9 + x**QQ(9,5)*y**4 - x**QQ(7,5)*y**7/7 - \ x**QQ(7,5)*y**2 + x*y**5/5 + x - x**QQ(3,5)*y**3/3 + x**QQ(1,5)*y r = rs_asin(p, x, 2) assert r == x**QQ(9,5)/2 + x**QQ(26,15)/2 + x**QQ(22,15)/2 + \ x**QQ(6,5)/6 + x + x**QQ(2,3) + x**QQ(2,5) r = rs_cot(p, x, 1) assert r == -x**QQ(14,15) + x**QQ(4,5) - 3*x**QQ(11,15) + \ 2*x**QQ(2,3)/3 + 2*x**QQ(7,15) - 4*x**QQ(2,5)/3 - x**QQ(1,5) + \ x**QQ(2,15) - x**QQ(-2,15) + x**QQ(-2,5) r = rs_cos_sin(p, x, 2) assert r[0] == x**QQ(28,15)/6 - x**QQ(5,3) + x**QQ(8,5)/24 - x**QQ(7,5) - \ x**QQ(4,3)/2 - x**QQ(16,15) - x**QQ(4,5)/2 + 1 assert r[1] == -x**QQ(9,5)/2 - x**QQ(26,15)/2 - x**QQ(22,15)/2 - \ x**QQ(6,5)/6 + x + x**QQ(2,3) + x**QQ(2,5) r = rs_atanh(p, x, 2) assert r == x**QQ(9,5) + x**QQ(26,15) + x**QQ(22,15) + x**QQ(6,5)/3 + x + \ x**QQ(2,3) + x**QQ(2,5) r = rs_sinh(p, x, 2) assert r == x**QQ(9,5)/2 + x**QQ(26,15)/2 + x**QQ(22,15)/2 + \ x**QQ(6,5)/6 + x + x**QQ(2,3) + x**QQ(2,5) r = rs_cosh(p, x, 2) assert r == x**QQ(28,15)/6 + x**QQ(5,3) + x**QQ(8,5)/24 + x**QQ(7,5) + \ x**QQ(4,3)/2 + x**QQ(16,15) + x**QQ(4,5)/2 + 1 r = rs_tanh(p, x, 2) assert r == -x**QQ(9,5) - x**QQ(26,15) - x**QQ(22,15) - x**QQ(6,5)/3 + \ x + x**QQ(2,3) + x**QQ(2,5) def test1(): R, x = ring('x', QQ) r = rs_sin(x, x, 15)*x**(-5) assert r == x**8/6227020800 - x**6/39916800 + x**4/362880 - x**2/5040 + \ QQ(1,120) - x**-2/6 + x**-4 p = rs_sin(x, x, 10) r = rs_nth_root(p, 2, x, 10) assert r == -67*x**QQ(17,2)/29030400 - x**QQ(13,2)/24192 + \ x**QQ(9,2)/1440 - x**QQ(5,2)/12 + x**QQ(1,2) p = rs_sin(x, x, 10) r = rs_nth_root(p, 7, x, 10) r = rs_pow(r, 5, x, 10) assert r == -97*x**QQ(61,7)/124467840 - x**QQ(47,7)/16464 + \ 11*x**QQ(33,7)/3528 - 5*x**QQ(19,7)/42 + x**QQ(5,7) r = rs_exp(x**QQ(1,2), x, 10) assert r == x**QQ(19,2)/121645100408832000 + x**9/6402373705728000 + \ x**QQ(17,2)/355687428096000 + x**8/20922789888000 + \ x**QQ(15,2)/1307674368000 + x**7/87178291200 + \ x**QQ(13,2)/6227020800 + x**6/479001600 + x**QQ(11,2)/39916800 + \ x**5/3628800 + x**QQ(9,2)/362880 + x**4/40320 + x**QQ(7,2)/5040 + \ x**3/720 + x**QQ(5,2)/120 + x**2/24 + x**QQ(3,2)/6 + x/2 + \ x**QQ(1,2) + 1 def test_puiseux2(): R, y = ring('y', QQ) S, x = ring('x', R) p = x + x**QQ(1,5)*y r = rs_atan(p, x, 3) assert r == (y**13/13 + y**8 + 2*y**3)*x**QQ(13,5) - (y**11/11 + y**6 + y)*x**QQ(11,5) + (y**9/9 + y**4)*x**QQ(9,5) - (y**7/7 + y**2)*x**QQ(7,5) + (y**5/5 + 1)*x - y**3*x**QQ(3,5)/3 + y*x**QQ(1,5) def test_rs_series(): x, a, b, c = symbols('x, a, b, c') assert rs_series(a, a, 5).as_expr() == a assert rs_series(sin(a), a, 5).as_expr() == (sin(a).series(a, 0, 5)).removeO() assert rs_series(sin(a) + cos(a), a, 5).as_expr() == ((sin(a) + cos(a)).series(a, 0, 5)).removeO() assert rs_series(sin(a)*cos(a), a, 5).as_expr() == ((sin(a)* cos(a)).series(a, 0, 5)).removeO() p = (sin(a) - a)*(cos(a**2) + a**4/2) assert expand(rs_series(p, a, 10).as_expr()) == expand(p.series(a, 0, 10).removeO()) p = sin(a**2/2 + a/3) + cos(a/5)*sin(a/2)**3 assert expand(rs_series(p, a, 5).as_expr()) == expand(p.series(a, 0, 5).removeO()) p = sin(x**2 + a)*(cos(x**3 - 1) - a - a**2) assert expand(rs_series(p, a, 5).as_expr()) == expand(p.series(a, 0, 5).removeO()) p = sin(a**2 - a/3 + 2)**5*exp(a**3 - a/2) assert expand(rs_series(p, a, 10).as_expr()) == expand(p.series(a, 0, 10).removeO()) p = sin(a + b + c) assert expand(rs_series(p, a, 5).as_expr()) == expand(p.series(a, 0, 5).removeO()) p = tan(sin(a**2 + 4) + b + c) assert expand(rs_series(p, a, 6).as_expr()) == expand(p.series(a, 0, 6).removeO()) p = a**QQ(2,5) + a**QQ(2,3) + a r = rs_series(tan(p), a, 2) assert r.as_expr() == a**QQ(9,5) + a**QQ(26,15) + a**QQ(22,15) + a**QQ(6,5)/3 + \ a + a**QQ(2,3) + a**QQ(2,5) r = rs_series(exp(p), a, 1) assert r.as_expr() == a**QQ(4,5)/2 + a**QQ(2,3) + a**QQ(2,5) + 1 r = rs_series(sin(p), a, 2) assert r.as_expr() == -a**QQ(9,5)/2 - a**QQ(26,15)/2 - a**QQ(22,15)/2 - \ a**QQ(6,5)/6 + a + a**QQ(2,3) + a**QQ(2,5) r = rs_series(cos(p), a, 2) assert r.as_expr() == a**QQ(28,15)/6 - a**QQ(5,3) + a**QQ(8,5)/24 - a**QQ(7,5) - \ a**QQ(4,3)/2 - a**QQ(16,15) - a**QQ(4,5)/2 + 1 assert rs_series(sin(a)/7, a, 5).as_expr() == (sin(a)/7).series(a, 0, 5).removeO() assert rs_series(log(1 + x), x, 5).as_expr() == -x**4/4 + x**3/3 - \ x**2/2 + x assert rs_series(log(1 + 4*x), x, 5).as_expr() == -64*x**4 + 64*x**3/3 - \ 8*x**2 + 4*x assert rs_series(log(1 + x + x**2), x, 10).as_expr() == -2*x**9/9 + \ x**8/8 + x**7/7 - x**6/3 + x**5/5 + x**4/4 - 2*x**3/3 + \ x**2/2 + x assert rs_series(log(1 + x*a**2), x, 7).as_expr() == -x**6*a**12/6 + \ x**5*a**10/5 - x**4*a**8/4 + x**3*a**6/3 - \ x**2*a**4/2 + x*a**2
bf6767ca8f8397834716d10a4396196b7a093134a4601e0527084e69d2d555b7
"""Tests for tools and arithmetics for monomials of distributed polynomials. """ from sympy.polys.monomials import ( itermonomials, monomial_count, monomial_mul, monomial_div, monomial_gcd, monomial_lcm, monomial_max, monomial_min, monomial_divides, monomial_pow, Monomial, ) from sympy.polys.polyerrors import ExactQuotientFailed from sympy.abc import a, b, c, x, y, z from sympy.core import S, symbols from sympy.testing.pytest import raises def test_monomials(): # total_degree tests assert set(itermonomials([], 0)) == {S.One} assert set(itermonomials([], 1)) == {S.One} assert set(itermonomials([], 2)) == {S.One} assert set(itermonomials([], 0, 0)) == {S.One} assert set(itermonomials([], 1, 0)) == {S.One} assert set(itermonomials([], 2, 0)) == {S.One} raises(StopIteration, lambda: next(itermonomials([], 0, 1))) raises(StopIteration, lambda: next(itermonomials([], 0, 2))) raises(StopIteration, lambda: next(itermonomials([], 0, 3))) assert set(itermonomials([], 0, 1)) == set() assert set(itermonomials([], 0, 2)) == set() assert set(itermonomials([], 0, 3)) == set() raises(ValueError, lambda: set(itermonomials([], -1))) raises(ValueError, lambda: set(itermonomials([x], -1))) raises(ValueError, lambda: set(itermonomials([x, y], -1))) assert set(itermonomials([x], 0)) == {S.One} assert set(itermonomials([x], 1)) == {S.One, x} assert set(itermonomials([x], 2)) == {S.One, x, x**2} assert set(itermonomials([x], 3)) == {S.One, x, x**2, x**3} assert set(itermonomials([x, y], 0)) == {S.One} assert set(itermonomials([x, y], 1)) == {S.One, x, y} assert set(itermonomials([x, y], 2)) == {S.One, x, y, x**2, y**2, x*y} assert set(itermonomials([x, y], 3)) == \ {S.One, x, y, x**2, x**3, y**2, y**3, x*y, x*y**2, y*x**2} i, j, k = symbols('i j k', commutative=False) assert set(itermonomials([i, j, k], 0)) == {S.One} assert set(itermonomials([i, j, k], 1)) == {S.One, i, j, k} assert set(itermonomials([i, j, k], 2)) == \ {S.One, i, j, k, i**2, j**2, k**2, i*j, i*k, j*i, j*k, k*i, k*j} assert set(itermonomials([i, j, k], 3)) == \ {S.One, i, j, k, i**2, j**2, k**2, i*j, i*k, j*i, j*k, k*i, k*j, i**3, j**3, k**3, i**2 * j, i**2 * k, j * i**2, k * i**2, j**2 * i, j**2 * k, i * j**2, k * j**2, k**2 * i, k**2 * j, i * k**2, j * k**2, i*j*i, i*k*i, j*i*j, j*k*j, k*i*k, k*j*k, i*j*k, i*k*j, j*i*k, j*k*i, k*i*j, k*j*i, } assert set(itermonomials([x, i, j], 0)) == {S.One} assert set(itermonomials([x, i, j], 1)) == {S.One, x, i, j} assert set(itermonomials([x, i, j], 2)) == {S.One, x, i, j, x*i, x*j, i*j, j*i, x**2, i**2, j**2} assert set(itermonomials([x, i, j], 3)) == \ {S.One, x, i, j, x*i, x*j, i*j, j*i, x**2, i**2, j**2, x**3, i**3, j**3, x**2 * i, x**2 * j, x * i**2, j * i**2, i**2 * j, i*j*i, x * j**2, i * j**2, j**2 * i, j*i*j, x * i * j, x * j * i } # degree_list tests assert set(itermonomials([], [])) == {S.One} raises(ValueError, lambda: set(itermonomials([], [0]))) raises(ValueError, lambda: set(itermonomials([], [1]))) raises(ValueError, lambda: set(itermonomials([], [2]))) raises(ValueError, lambda: set(itermonomials([x], [1], []))) raises(ValueError, lambda: set(itermonomials([x], [1, 2], []))) raises(ValueError, lambda: set(itermonomials([x], [1, 2, 3], []))) raises(ValueError, lambda: set(itermonomials([x], [], [1]))) raises(ValueError, lambda: set(itermonomials([x], [], [1, 2]))) raises(ValueError, lambda: set(itermonomials([x], [], [1, 2, 3]))) raises(ValueError, lambda: set(itermonomials([x, y], [1, 2], [1, 2, 3]))) raises(ValueError, lambda: set(itermonomials([x, y, z], [1, 2, 3], [0, 1]))) raises(ValueError, lambda: set(itermonomials([x], [1], [-1]))) raises(ValueError, lambda: set(itermonomials([x, y], [1, 2], [1, -1]))) raises(ValueError, lambda: set(itermonomials([], [], 1))) raises(ValueError, lambda: set(itermonomials([], [], 2))) raises(ValueError, lambda: set(itermonomials([], [], 3))) raises(ValueError, lambda: set(itermonomials([x, y], [0, 1], [1, 2]))) raises(ValueError, lambda: set(itermonomials([x, y, z], [0, 0, 3], [0, 1, 2]))) assert set(itermonomials([x], [0])) == {S.One} assert set(itermonomials([x], [1])) == {S.One, x} assert set(itermonomials([x], [2])) == {S.One, x, x**2} assert set(itermonomials([x], [3])) == {S.One, x, x**2, x**3} assert set(itermonomials([x], [3], [1])) == {x, x**3, x**2} assert set(itermonomials([x], [3], [2])) == {x**3, x**2} assert set(itermonomials([x, y], [0, 0])) == {S.One} assert set(itermonomials([x, y], [0, 1])) == {S.One, y} assert set(itermonomials([x, y], [0, 2])) == {S.One, y, y**2} assert set(itermonomials([x, y], [0, 2], [0, 1])) == {y, y**2} assert set(itermonomials([x, y], [0, 2], [0, 2])) == {y**2} assert set(itermonomials([x, y], [1, 0])) == {S.One, x} assert set(itermonomials([x, y], [1, 1])) == {S.One, x, y, x*y} assert set(itermonomials([x, y], [1, 2])) == {S.One, x, y, x*y, y**2, x*y**2} assert set(itermonomials([x, y], [1, 2], [1, 1])) == {x*y, x*y**2} assert set(itermonomials([x, y], [1, 2], [1, 2])) == {x*y**2} assert set(itermonomials([x, y], [2, 0])) == {S.One, x, x**2} assert set(itermonomials([x, y], [2, 1])) == {S.One, x, y, x*y, x**2, x**2*y} assert set(itermonomials([x, y], [2, 2])) == \ {S.One, y**2, x*y**2, x, x*y, x**2, x**2*y**2, y, x**2*y} i, j, k = symbols('i j k', commutative=False) assert set(itermonomials([i, j, k], [0, 0, 0])) == {S.One} assert set(itermonomials([i, j, k], [0, 0, 1])) == {1, k} assert set(itermonomials([i, j, k], [0, 1, 0])) == {1, j} assert set(itermonomials([i, j, k], [1, 0, 0])) == {i, 1} assert set(itermonomials([i, j, k], [0, 0, 2])) == {k**2, 1, k} assert set(itermonomials([i, j, k], [0, 2, 0])) == {1, j, j**2} assert set(itermonomials([i, j, k], [2, 0, 0])) == {i, 1, i**2} assert set(itermonomials([i, j, k], [1, 1, 1])) == {1, k, j, j*k, i*k, i, i*j, i*j*k} assert set(itermonomials([i, j, k], [2, 2, 2])) == \ {1, k, i**2*k**2, j*k, j**2, i, i*k, j*k**2, i*j**2*k**2, i**2*j, i**2*j**2, k**2, j**2*k, i*j**2*k, j**2*k**2, i*j, i**2*k, i**2*j**2*k, j, i**2*j*k, i*j**2, i*k**2, i*j*k, i**2*j**2*k**2, i*j*k**2, i**2, i**2*j*k**2 } assert set(itermonomials([x, j, k], [0, 0, 0])) == {S.One} assert set(itermonomials([x, j, k], [0, 0, 1])) == {1, k} assert set(itermonomials([x, j, k], [0, 1, 0])) == {1, j} assert set(itermonomials([x, j, k], [1, 0, 0])) == {x, 1} assert set(itermonomials([x, j, k], [0, 0, 2])) == {k**2, 1, k} assert set(itermonomials([x, j, k], [0, 2, 0])) == {1, j, j**2} assert set(itermonomials([x, j, k], [2, 0, 0])) == {x, 1, x**2} assert set(itermonomials([x, j, k], [1, 1, 1])) == {1, k, j, j*k, x*k, x, x*j, x*j*k} assert set(itermonomials([x, j, k], [2, 2, 2])) == \ {1, k, x**2*k**2, j*k, j**2, x, x*k, j*k**2, x*j**2*k**2, x**2*j, x**2*j**2, k**2, j**2*k, x*j**2*k, j**2*k**2, x*j, x**2*k, x**2*j**2*k, j, x**2*j*k, x*j**2, x*k**2, x*j*k, x**2*j**2*k**2, x*j*k**2, x**2, x**2*j*k**2 } def test_monomial_count(): assert monomial_count(2, 2) == 6 assert monomial_count(2, 3) == 10 def test_monomial_mul(): assert monomial_mul((3, 4, 1), (1, 2, 0)) == (4, 6, 1) def test_monomial_div(): assert monomial_div((3, 4, 1), (1, 2, 0)) == (2, 2, 1) def test_monomial_gcd(): assert monomial_gcd((3, 4, 1), (1, 2, 0)) == (1, 2, 0) def test_monomial_lcm(): assert monomial_lcm((3, 4, 1), (1, 2, 0)) == (3, 4, 1) def test_monomial_max(): assert monomial_max((3, 4, 5), (0, 5, 1), (6, 3, 9)) == (6, 5, 9) def test_monomial_pow(): assert monomial_pow((1, 2, 3), 3) == (3, 6, 9) def test_monomial_min(): assert monomial_min((3, 4, 5), (0, 5, 1), (6, 3, 9)) == (0, 3, 1) def test_monomial_divides(): assert monomial_divides((1, 2, 3), (4, 5, 6)) is True assert monomial_divides((1, 2, 3), (0, 5, 6)) is False def test_Monomial(): m = Monomial((3, 4, 1), (x, y, z)) n = Monomial((1, 2, 0), (x, y, z)) assert m.as_expr() == x**3*y**4*z assert n.as_expr() == x**1*y**2 assert m.as_expr(a, b, c) == a**3*b**4*c assert n.as_expr(a, b, c) == a**1*b**2 assert m.exponents == (3, 4, 1) assert m.gens == (x, y, z) assert n.exponents == (1, 2, 0) assert n.gens == (x, y, z) assert m == (3, 4, 1) assert n != (3, 4, 1) assert m != (1, 2, 0) assert n == (1, 2, 0) assert (m == 1) is False assert m[0] == m[-3] == 3 assert m[1] == m[-2] == 4 assert m[2] == m[-1] == 1 assert n[0] == n[-3] == 1 assert n[1] == n[-2] == 2 assert n[2] == n[-1] == 0 assert m[:2] == (3, 4) assert n[:2] == (1, 2) assert m*n == Monomial((4, 6, 1)) assert m/n == Monomial((2, 2, 1)) assert m*(1, 2, 0) == Monomial((4, 6, 1)) assert m/(1, 2, 0) == Monomial((2, 2, 1)) assert m.gcd(n) == Monomial((1, 2, 0)) assert m.lcm(n) == Monomial((3, 4, 1)) assert m.gcd((1, 2, 0)) == Monomial((1, 2, 0)) assert m.lcm((1, 2, 0)) == Monomial((3, 4, 1)) assert m**0 == Monomial((0, 0, 0)) assert m**1 == m assert m**2 == Monomial((6, 8, 2)) assert m**3 == Monomial((9, 12, 3)) raises(ExactQuotientFailed, lambda: m/Monomial((5, 2, 0))) mm = Monomial((1, 2, 3)) raises(ValueError, lambda: mm.as_expr()) assert str(mm) == 'Monomial((1, 2, 3))' assert str(m) == 'x**3*y**4*z**1' raises(NotImplementedError, lambda: m*1) raises(NotImplementedError, lambda: m/1) raises(ValueError, lambda: m**-1) raises(TypeError, lambda: m.gcd(3)) raises(TypeError, lambda: m.lcm(3))
c2c00a80e2ae2d8adad78a8c4bc114b7f3dd6bf4a805f3fdd17dbe4efd561bb0
from sympy.polys.rings import ring from sympy.polys.domains import ZZ from sympy.polys.heuristicgcd import heugcd def test_heugcd_univariate_integers(): R, x = ring("x", ZZ) f = x**4 + 8*x**3 + 21*x**2 + 22*x + 8 g = x**3 + 6*x**2 + 11*x + 6 h = x**2 + 3*x + 2 cff = x**2 + 5*x + 4 cfg = x + 3 assert heugcd(f, g) == (h, cff, cfg) f = x**4 - 4 g = x**4 + 4*x**2 + 4 h = x**2 + 2 cff = x**2 - 2 cfg = x**2 + 2 assert heugcd(f, g) == (h, cff, cfg) f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 h = 1 cff = f cfg = g assert heugcd(f, g) == (h, cff, cfg) f = - 352518131239247345597970242177235495263669787845475025293906825864749649589178600387510272*x**49 \ + 46818041807522713962450042363465092040687472354933295397472942006618953623327997952*x**42 \ + 378182690892293941192071663536490788434899030680411695933646320291525827756032*x**35 \ + 112806468807371824947796775491032386836656074179286744191026149539708928*x**28 \ - 12278371209708240950316872681744825481125965781519138077173235712*x**21 \ + 289127344604779611146960547954288113529690984687482920704*x**14 \ + 19007977035740498977629742919480623972236450681*x**7 \ + 311973482284542371301330321821976049 g = 365431878023781158602430064717380211405897160759702125019136*x**21 \ + 197599133478719444145775798221171663643171734081650688*x**14 \ - 9504116979659010018253915765478924103928886144*x**7 \ - 311973482284542371301330321821976049 # TODO: assert heugcd(f, f.diff(x))[0] == g f = 1317378933230047068160*x + 2945748836994210856960 g = 120352542776360960*x + 269116466014453760 h = 120352542776360960*x + 269116466014453760 cff = 10946 cfg = 1 assert heugcd(f, g) == (h, cff, cfg) def test_heugcd_multivariate_integers(): R, x, y = ring("x,y", ZZ) f, g = 2*x**2 + 4*x + 2, x + 1 assert heugcd(f, g) == (x + 1, 2*x + 2, 1) f, g = x + 1, 2*x**2 + 4*x + 2 assert heugcd(f, g) == (x + 1, 1, 2*x + 2) R, x, y, z, u = ring("x,y,z,u", ZZ) f, g = u**2 + 2*u + 1, 2*u + 2 assert heugcd(f, g) == (u + 1, u + 1, 2) f, g = z**2*u**2 + 2*z**2*u + z**2 + z*u + z, u**2 + 2*u + 1 h, cff, cfg = u + 1, z**2*u + z**2 + z, u + 1 assert heugcd(f, g) == (h, cff, cfg) assert heugcd(g, f) == (h, cfg, cff) R, x, y, z = ring("x,y,z", ZZ) f, g, h = R.fateman_poly_F_1() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g R, x, y, z, u, v = ring("x,y,z,u,v", ZZ) f, g, h = R.fateman_poly_F_1() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g R, x, y, z, u, v, a, b = ring("x,y,z,u,v,a,b", ZZ) f, g, h = R.fateman_poly_F_1() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g R, x, y, z, u, v, a, b, c, d = ring("x,y,z,u,v,a,b,c,d", ZZ) f, g, h = R.fateman_poly_F_1() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g R, x, y, z = ring("x,y,z", ZZ) f, g, h = R.fateman_poly_F_2() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g f, g, h = R.fateman_poly_F_3() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g R, x, y, z, t = ring("x,y,z,t", ZZ) f, g, h = R.fateman_poly_F_3() H, cff, cfg = heugcd(f, g) assert H == h and H*cff == f and H*cfg == g def test_issue_10996(): R, x, y, z = ring("x,y,z", ZZ) f = 12*x**6*y**7*z**3 - 3*x**4*y**9*z**3 + 12*x**3*y**5*z**4 g = -48*x**7*y**8*z**3 + 12*x**5*y**10*z**3 - 48*x**5*y**7*z**2 + \ 36*x**4*y**7*z - 48*x**4*y**6*z**4 + 12*x**3*y**9*z**2 - 48*x**3*y**4 \ - 9*x**2*y**9*z - 48*x**2*y**5*z**3 + 12*x*y**6 + 36*x*y**5*z**2 - 48*y**2*z H, cff, cfg = heugcd(f, g) assert H == 12*x**3*y**4 - 3*x*y**6 + 12*y**2*z assert H*cff == f and H*cfg == g
da96127b112d97ae833e4f45cf55ec4eb0982a1d0325e75dc7c3d7069add9c13
"""Test sparse polynomials. """ from operator import add, mul from sympy.polys.rings import ring, xring, sring, PolyRing, PolyElement from sympy.polys.fields import field, FracField from sympy.polys.domains import ZZ, QQ, RR, FF, EX from sympy.polys.orderings import lex, grlex from sympy.polys.polyerrors import GeneratorsError, \ ExactQuotientFailed, MultivariatePolynomialError, CoercionFailed from sympy.testing.pytest import raises from sympy.core import Symbol, symbols from sympy.core.compatibility import reduce from sympy import sqrt, pi, oo def test_PolyRing___init__(): x, y, z, t = map(Symbol, "xyzt") assert len(PolyRing("x,y,z", ZZ, lex).gens) == 3 assert len(PolyRing(x, ZZ, lex).gens) == 1 assert len(PolyRing(("x", "y", "z"), ZZ, lex).gens) == 3 assert len(PolyRing((x, y, z), ZZ, lex).gens) == 3 assert len(PolyRing("", ZZ, lex).gens) == 0 assert len(PolyRing([], ZZ, lex).gens) == 0 raises(GeneratorsError, lambda: PolyRing(0, ZZ, lex)) assert PolyRing("x", ZZ[t], lex).domain == ZZ[t] assert PolyRing("x", 'ZZ[t]', lex).domain == ZZ[t] assert PolyRing("x", PolyRing("t", ZZ, lex), lex).domain == ZZ[t] raises(GeneratorsError, lambda: PolyRing("x", PolyRing("x", ZZ, lex), lex)) _lex = Symbol("lex") assert PolyRing("x", ZZ, lex).order == lex assert PolyRing("x", ZZ, _lex).order == lex assert PolyRing("x", ZZ, 'lex').order == lex R1 = PolyRing("x,y", ZZ, lex) R2 = PolyRing("x,y", ZZ, lex) R3 = PolyRing("x,y,z", ZZ, lex) assert R1.x == R1.gens[0] assert R1.y == R1.gens[1] assert R1.x == R2.x assert R1.y == R2.y assert R1.x != R3.x assert R1.y != R3.y def test_PolyRing___hash__(): R, x, y, z = ring("x,y,z", QQ) assert hash(R) def test_PolyRing___eq__(): assert ring("x,y,z", QQ)[0] == ring("x,y,z", QQ)[0] assert ring("x,y,z", QQ)[0] is ring("x,y,z", QQ)[0] assert ring("x,y,z", QQ)[0] != ring("x,y,z", ZZ)[0] assert ring("x,y,z", QQ)[0] is not ring("x,y,z", ZZ)[0] assert ring("x,y,z", ZZ)[0] != ring("x,y,z", QQ)[0] assert ring("x,y,z", ZZ)[0] is not ring("x,y,z", QQ)[0] assert ring("x,y,z", QQ)[0] != ring("x,y", QQ)[0] assert ring("x,y,z", QQ)[0] is not ring("x,y", QQ)[0] assert ring("x,y", QQ)[0] != ring("x,y,z", QQ)[0] assert ring("x,y", QQ)[0] is not ring("x,y,z", QQ)[0] def test_PolyRing_ring_new(): R, x, y, z = ring("x,y,z", QQ) assert R.ring_new(7) == R(7) assert R.ring_new(7*x*y*z) == 7*x*y*z f = x**2 + 2*x*y + 3*x + 4*z**2 + 5*z + 6 assert R.ring_new([[[1]], [[2], [3]], [[4, 5, 6]]]) == f assert R.ring_new({(2, 0, 0): 1, (1, 1, 0): 2, (1, 0, 0): 3, (0, 0, 2): 4, (0, 0, 1): 5, (0, 0, 0): 6}) == f assert R.ring_new([((2, 0, 0), 1), ((1, 1, 0), 2), ((1, 0, 0), 3), ((0, 0, 2), 4), ((0, 0, 1), 5), ((0, 0, 0), 6)]) == f R, = ring("", QQ) assert R.ring_new([((), 7)]) == R(7) def test_PolyRing_drop(): R, x,y,z = ring("x,y,z", ZZ) assert R.drop(x) == PolyRing("y,z", ZZ, lex) assert R.drop(y) == PolyRing("x,z", ZZ, lex) assert R.drop(z) == PolyRing("x,y", ZZ, lex) assert R.drop(0) == PolyRing("y,z", ZZ, lex) assert R.drop(0).drop(0) == PolyRing("z", ZZ, lex) assert R.drop(0).drop(0).drop(0) == ZZ assert R.drop(1) == PolyRing("x,z", ZZ, lex) assert R.drop(2) == PolyRing("x,y", ZZ, lex) assert R.drop(2).drop(1) == PolyRing("x", ZZ, lex) assert R.drop(2).drop(1).drop(0) == ZZ raises(ValueError, lambda: R.drop(3)) raises(ValueError, lambda: R.drop(x).drop(y)) def test_PolyRing___getitem__(): R, x,y,z = ring("x,y,z", ZZ) assert R[0:] == PolyRing("x,y,z", ZZ, lex) assert R[1:] == PolyRing("y,z", ZZ, lex) assert R[2:] == PolyRing("z", ZZ, lex) assert R[3:] == ZZ def test_PolyRing_is_(): R = PolyRing("x", QQ, lex) assert R.is_univariate is True assert R.is_multivariate is False R = PolyRing("x,y,z", QQ, lex) assert R.is_univariate is False assert R.is_multivariate is True R = PolyRing("", QQ, lex) assert R.is_univariate is False assert R.is_multivariate is False def test_PolyRing_add(): R, x = ring("x", ZZ) F = [ x**2 + 2*i + 3 for i in range(4) ] assert R.add(F) == reduce(add, F) == 4*x**2 + 24 R, = ring("", ZZ) assert R.add([2, 5, 7]) == 14 def test_PolyRing_mul(): R, x = ring("x", ZZ) F = [ x**2 + 2*i + 3 for i in range(4) ] assert R.mul(F) == reduce(mul, F) == x**8 + 24*x**6 + 206*x**4 + 744*x**2 + 945 R, = ring("", ZZ) assert R.mul([2, 3, 5]) == 30 def test_sring(): x, y, z, t = symbols("x,y,z,t") R = PolyRing("x,y,z", ZZ, lex) assert sring(x + 2*y + 3*z) == (R, R.x + 2*R.y + 3*R.z) R = PolyRing("x,y,z", QQ, lex) assert sring(x + 2*y + z/3) == (R, R.x + 2*R.y + R.z/3) assert sring([x, 2*y, z/3]) == (R, [R.x, 2*R.y, R.z/3]) Rt = PolyRing("t", ZZ, lex) R = PolyRing("x,y,z", Rt, lex) assert sring(x + 2*t*y + 3*t**2*z, x, y, z) == (R, R.x + 2*Rt.t*R.y + 3*Rt.t**2*R.z) Rt = PolyRing("t", QQ, lex) R = PolyRing("x,y,z", Rt, lex) assert sring(x + t*y/2 + t**2*z/3, x, y, z) == (R, R.x + Rt.t*R.y/2 + Rt.t**2*R.z/3) Rt = FracField("t", ZZ, lex) R = PolyRing("x,y,z", Rt, lex) assert sring(x + 2*y/t + t**2*z/3, x, y, z) == (R, R.x + 2*R.y/Rt.t + Rt.t**2*R.z/3) r = sqrt(2) - sqrt(3) R, a = sring(r, extension=True) assert R.domain == QQ.algebraic_field(r) assert R.gens == () assert a == R.domain.from_sympy(r) def test_PolyElement___hash__(): R, x, y, z = ring("x,y,z", QQ) assert hash(x*y*z) def test_PolyElement___eq__(): R, x, y = ring("x,y", ZZ, lex) assert ((x*y + 5*x*y) == 6) == False assert ((x*y + 5*x*y) == 6*x*y) == True assert (6 == (x*y + 5*x*y)) == False assert (6*x*y == (x*y + 5*x*y)) == True assert ((x*y - x*y) == 0) == True assert (0 == (x*y - x*y)) == True assert ((x*y - x*y) == 1) == False assert (1 == (x*y - x*y)) == False assert ((x*y - x*y) == 1) == False assert (1 == (x*y - x*y)) == False assert ((x*y + 5*x*y) != 6) == True assert ((x*y + 5*x*y) != 6*x*y) == False assert (6 != (x*y + 5*x*y)) == True assert (6*x*y != (x*y + 5*x*y)) == False assert ((x*y - x*y) != 0) == False assert (0 != (x*y - x*y)) == False assert ((x*y - x*y) != 1) == True assert (1 != (x*y - x*y)) == True Rt, t = ring("t", ZZ) R, x, y = ring("x,y", Rt) assert (t**3*x/x == t**3) == True assert (t**3*x/x == t**4) == False def test_PolyElement__lt_le_gt_ge__(): R, x, y = ring("x,y", ZZ) assert R(1) < x < x**2 < x**3 assert R(1) <= x <= x**2 <= x**3 assert x**3 > x**2 > x > R(1) assert x**3 >= x**2 >= x >= R(1) def test_PolyElement_copy(): R, x, y, z = ring("x,y,z", ZZ) f = x*y + 3*z g = f.copy() assert f == g g[(1, 1, 1)] = 7 assert f != g def test_PolyElement_as_expr(): R, x, y, z = ring("x,y,z", ZZ) f = 3*x**2*y - x*y*z + 7*z**3 + 1 X, Y, Z = R.symbols g = 3*X**2*Y - X*Y*Z + 7*Z**3 + 1 assert f != g assert f.as_expr() == g X, Y, Z = symbols("x,y,z") g = 3*X**2*Y - X*Y*Z + 7*Z**3 + 1 assert f != g assert f.as_expr(X, Y, Z) == g raises(ValueError, lambda: f.as_expr(X)) R, = ring("", ZZ) R(3).as_expr() == 3 def test_PolyElement_from_expr(): x, y, z = symbols("x,y,z") R, X, Y, Z = ring((x, y, z), ZZ) f = R.from_expr(1) assert f == 1 and isinstance(f, R.dtype) f = R.from_expr(x) assert f == X and isinstance(f, R.dtype) f = R.from_expr(x*y*z) assert f == X*Y*Z and isinstance(f, R.dtype) f = R.from_expr(x*y*z + x*y + x) assert f == X*Y*Z + X*Y + X and isinstance(f, R.dtype) f = R.from_expr(x**3*y*z + x**2*y**7 + 1) assert f == X**3*Y*Z + X**2*Y**7 + 1 and isinstance(f, R.dtype) raises(ValueError, lambda: R.from_expr(1/x)) raises(ValueError, lambda: R.from_expr(2**x)) raises(ValueError, lambda: R.from_expr(7*x + sqrt(2))) R, = ring("", ZZ) f = R.from_expr(1) assert f == 1 and isinstance(f, R.dtype) def test_PolyElement_degree(): R, x,y,z = ring("x,y,z", ZZ) assert R(0).degree() is -oo assert R(1).degree() == 0 assert (x + 1).degree() == 1 assert (2*y**3 + z).degree() == 0 assert (x*y**3 + z).degree() == 1 assert (x**5*y**3 + z).degree() == 5 assert R(0).degree(x) is -oo assert R(1).degree(x) == 0 assert (x + 1).degree(x) == 1 assert (2*y**3 + z).degree(x) == 0 assert (x*y**3 + z).degree(x) == 1 assert (7*x**5*y**3 + z).degree(x) == 5 assert R(0).degree(y) is -oo assert R(1).degree(y) == 0 assert (x + 1).degree(y) == 0 assert (2*y**3 + z).degree(y) == 3 assert (x*y**3 + z).degree(y) == 3 assert (7*x**5*y**3 + z).degree(y) == 3 assert R(0).degree(z) is -oo assert R(1).degree(z) == 0 assert (x + 1).degree(z) == 0 assert (2*y**3 + z).degree(z) == 1 assert (x*y**3 + z).degree(z) == 1 assert (7*x**5*y**3 + z).degree(z) == 1 R, = ring("", ZZ) assert R(0).degree() is -oo assert R(1).degree() == 0 def test_PolyElement_tail_degree(): R, x,y,z = ring("x,y,z", ZZ) assert R(0).tail_degree() is -oo assert R(1).tail_degree() == 0 assert (x + 1).tail_degree() == 0 assert (2*y**3 + x**3*z).tail_degree() == 0 assert (x*y**3 + x**3*z).tail_degree() == 1 assert (x**5*y**3 + x**3*z).tail_degree() == 3 assert R(0).tail_degree(x) is -oo assert R(1).tail_degree(x) == 0 assert (x + 1).tail_degree(x) == 0 assert (2*y**3 + x**3*z).tail_degree(x) == 0 assert (x*y**3 + x**3*z).tail_degree(x) == 1 assert (7*x**5*y**3 + x**3*z).tail_degree(x) == 3 assert R(0).tail_degree(y) is -oo assert R(1).tail_degree(y) == 0 assert (x + 1).tail_degree(y) == 0 assert (2*y**3 + x**3*z).tail_degree(y) == 0 assert (x*y**3 + x**3*z).tail_degree(y) == 0 assert (7*x**5*y**3 + x**3*z).tail_degree(y) == 0 assert R(0).tail_degree(z) is -oo assert R(1).tail_degree(z) == 0 assert (x + 1).tail_degree(z) == 0 assert (2*y**3 + x**3*z).tail_degree(z) == 0 assert (x*y**3 + x**3*z).tail_degree(z) == 0 assert (7*x**5*y**3 + x**3*z).tail_degree(z) == 0 R, = ring("", ZZ) assert R(0).tail_degree() is -oo assert R(1).tail_degree() == 0 def test_PolyElement_degrees(): R, x,y,z = ring("x,y,z", ZZ) assert R(0).degrees() == (-oo, -oo, -oo) assert R(1).degrees() == (0, 0, 0) assert (x**2*y + x**3*z**2).degrees() == (3, 1, 2) def test_PolyElement_tail_degrees(): R, x,y,z = ring("x,y,z", ZZ) assert R(0).tail_degrees() == (-oo, -oo, -oo) assert R(1).tail_degrees() == (0, 0, 0) assert (x**2*y + x**3*z**2).tail_degrees() == (2, 0, 0) def test_PolyElement_coeff(): R, x, y, z = ring("x,y,z", ZZ, lex) f = 3*x**2*y - x*y*z + 7*z**3 + 23 assert f.coeff(1) == 23 raises(ValueError, lambda: f.coeff(3)) assert f.coeff(x) == 0 assert f.coeff(y) == 0 assert f.coeff(z) == 0 assert f.coeff(x**2*y) == 3 assert f.coeff(x*y*z) == -1 assert f.coeff(z**3) == 7 raises(ValueError, lambda: f.coeff(3*x**2*y)) raises(ValueError, lambda: f.coeff(-x*y*z)) raises(ValueError, lambda: f.coeff(7*z**3)) R, = ring("", ZZ) R(3).coeff(1) == 3 def test_PolyElement_LC(): R, x, y = ring("x,y", QQ, lex) assert R(0).LC == QQ(0) assert (QQ(1,2)*x).LC == QQ(1, 2) assert (QQ(1,4)*x*y + QQ(1,2)*x).LC == QQ(1, 4) def test_PolyElement_LM(): R, x, y = ring("x,y", QQ, lex) assert R(0).LM == (0, 0) assert (QQ(1,2)*x).LM == (1, 0) assert (QQ(1,4)*x*y + QQ(1,2)*x).LM == (1, 1) def test_PolyElement_LT(): R, x, y = ring("x,y", QQ, lex) assert R(0).LT == ((0, 0), QQ(0)) assert (QQ(1,2)*x).LT == ((1, 0), QQ(1, 2)) assert (QQ(1,4)*x*y + QQ(1,2)*x).LT == ((1, 1), QQ(1, 4)) R, = ring("", ZZ) assert R(0).LT == ((), 0) assert R(1).LT == ((), 1) def test_PolyElement_leading_monom(): R, x, y = ring("x,y", QQ, lex) assert R(0).leading_monom() == 0 assert (QQ(1,2)*x).leading_monom() == x assert (QQ(1,4)*x*y + QQ(1,2)*x).leading_monom() == x*y def test_PolyElement_leading_term(): R, x, y = ring("x,y", QQ, lex) assert R(0).leading_term() == 0 assert (QQ(1,2)*x).leading_term() == QQ(1,2)*x assert (QQ(1,4)*x*y + QQ(1,2)*x).leading_term() == QQ(1,4)*x*y def test_PolyElement_terms(): R, x,y,z = ring("x,y,z", QQ) terms = (x**2/3 + y**3/4 + z**4/5).terms() assert terms == [((2,0,0), QQ(1,3)), ((0,3,0), QQ(1,4)), ((0,0,4), QQ(1,5))] R, x,y = ring("x,y", ZZ, lex) f = x*y**7 + 2*x**2*y**3 assert f.terms() == f.terms(lex) == f.terms('lex') == [((2, 3), 2), ((1, 7), 1)] assert f.terms(grlex) == f.terms('grlex') == [((1, 7), 1), ((2, 3), 2)] R, x,y = ring("x,y", ZZ, grlex) f = x*y**7 + 2*x**2*y**3 assert f.terms() == f.terms(grlex) == f.terms('grlex') == [((1, 7), 1), ((2, 3), 2)] assert f.terms(lex) == f.terms('lex') == [((2, 3), 2), ((1, 7), 1)] R, = ring("", ZZ) assert R(3).terms() == [((), 3)] def test_PolyElement_monoms(): R, x,y,z = ring("x,y,z", QQ) monoms = (x**2/3 + y**3/4 + z**4/5).monoms() assert monoms == [(2,0,0), (0,3,0), (0,0,4)] R, x,y = ring("x,y", ZZ, lex) f = x*y**7 + 2*x**2*y**3 assert f.monoms() == f.monoms(lex) == f.monoms('lex') == [(2, 3), (1, 7)] assert f.monoms(grlex) == f.monoms('grlex') == [(1, 7), (2, 3)] R, x,y = ring("x,y", ZZ, grlex) f = x*y**7 + 2*x**2*y**3 assert f.monoms() == f.monoms(grlex) == f.monoms('grlex') == [(1, 7), (2, 3)] assert f.monoms(lex) == f.monoms('lex') == [(2, 3), (1, 7)] def test_PolyElement_coeffs(): R, x,y,z = ring("x,y,z", QQ) coeffs = (x**2/3 + y**3/4 + z**4/5).coeffs() assert coeffs == [QQ(1,3), QQ(1,4), QQ(1,5)] R, x,y = ring("x,y", ZZ, lex) f = x*y**7 + 2*x**2*y**3 assert f.coeffs() == f.coeffs(lex) == f.coeffs('lex') == [2, 1] assert f.coeffs(grlex) == f.coeffs('grlex') == [1, 2] R, x,y = ring("x,y", ZZ, grlex) f = x*y**7 + 2*x**2*y**3 assert f.coeffs() == f.coeffs(grlex) == f.coeffs('grlex') == [1, 2] assert f.coeffs(lex) == f.coeffs('lex') == [2, 1] def test_PolyElement___add__(): Rt, t = ring("t", ZZ) Ruv, u,v = ring("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Ruv) assert dict(x + 3*y) == {(1, 0, 0): 1, (0, 1, 0): 3} assert dict(u + x) == dict(x + u) == {(1, 0, 0): 1, (0, 0, 0): u} assert dict(u + x*y) == dict(x*y + u) == {(1, 1, 0): 1, (0, 0, 0): u} assert dict(u + x*y + z) == dict(x*y + z + u) == {(1, 1, 0): 1, (0, 0, 1): 1, (0, 0, 0): u} assert dict(u*x + x) == dict(x + u*x) == {(1, 0, 0): u + 1} assert dict(u*x + x*y) == dict(x*y + u*x) == {(1, 1, 0): 1, (1, 0, 0): u} assert dict(u*x + x*y + z) == dict(x*y + z + u*x) == {(1, 1, 0): 1, (0, 0, 1): 1, (1, 0, 0): u} raises(TypeError, lambda: t + x) raises(TypeError, lambda: x + t) raises(TypeError, lambda: t + u) raises(TypeError, lambda: u + t) Fuv, u,v = field("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Fuv) assert dict(u + x) == dict(x + u) == {(1, 0, 0): 1, (0, 0, 0): u} Rxyz, x,y,z = ring("x,y,z", EX) assert dict(EX(pi) + x*y*z) == dict(x*y*z + EX(pi)) == {(1, 1, 1): EX(1), (0, 0, 0): EX(pi)} def test_PolyElement___sub__(): Rt, t = ring("t", ZZ) Ruv, u,v = ring("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Ruv) assert dict(x - 3*y) == {(1, 0, 0): 1, (0, 1, 0): -3} assert dict(-u + x) == dict(x - u) == {(1, 0, 0): 1, (0, 0, 0): -u} assert dict(-u + x*y) == dict(x*y - u) == {(1, 1, 0): 1, (0, 0, 0): -u} assert dict(-u + x*y + z) == dict(x*y + z - u) == {(1, 1, 0): 1, (0, 0, 1): 1, (0, 0, 0): -u} assert dict(-u*x + x) == dict(x - u*x) == {(1, 0, 0): -u + 1} assert dict(-u*x + x*y) == dict(x*y - u*x) == {(1, 1, 0): 1, (1, 0, 0): -u} assert dict(-u*x + x*y + z) == dict(x*y + z - u*x) == {(1, 1, 0): 1, (0, 0, 1): 1, (1, 0, 0): -u} raises(TypeError, lambda: t - x) raises(TypeError, lambda: x - t) raises(TypeError, lambda: t - u) raises(TypeError, lambda: u - t) Fuv, u,v = field("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Fuv) assert dict(-u + x) == dict(x - u) == {(1, 0, 0): 1, (0, 0, 0): -u} Rxyz, x,y,z = ring("x,y,z", EX) assert dict(-EX(pi) + x*y*z) == dict(x*y*z - EX(pi)) == {(1, 1, 1): EX(1), (0, 0, 0): -EX(pi)} def test_PolyElement___mul__(): Rt, t = ring("t", ZZ) Ruv, u,v = ring("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Ruv) assert dict(u*x) == dict(x*u) == {(1, 0, 0): u} assert dict(2*u*x + z) == dict(x*2*u + z) == {(1, 0, 0): 2*u, (0, 0, 1): 1} assert dict(u*2*x + z) == dict(2*x*u + z) == {(1, 0, 0): 2*u, (0, 0, 1): 1} assert dict(2*u*x + z) == dict(x*2*u + z) == {(1, 0, 0): 2*u, (0, 0, 1): 1} assert dict(u*x*2 + z) == dict(x*u*2 + z) == {(1, 0, 0): 2*u, (0, 0, 1): 1} assert dict(2*u*x*y + z) == dict(x*y*2*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(u*2*x*y + z) == dict(2*x*y*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(2*u*x*y + z) == dict(x*y*2*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(u*x*y*2 + z) == dict(x*y*u*2 + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(2*u*y*x + z) == dict(y*x*2*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(u*2*y*x + z) == dict(2*y*x*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(2*u*y*x + z) == dict(y*x*2*u + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(u*y*x*2 + z) == dict(y*x*u*2 + z) == {(1, 1, 0): 2*u, (0, 0, 1): 1} assert dict(3*u*(x + y) + z) == dict((x + y)*3*u + z) == {(1, 0, 0): 3*u, (0, 1, 0): 3*u, (0, 0, 1): 1} raises(TypeError, lambda: t*x + z) raises(TypeError, lambda: x*t + z) raises(TypeError, lambda: t*u + z) raises(TypeError, lambda: u*t + z) Fuv, u,v = field("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Fuv) assert dict(u*x) == dict(x*u) == {(1, 0, 0): u} Rxyz, x,y,z = ring("x,y,z", EX) assert dict(EX(pi)*x*y*z) == dict(x*y*z*EX(pi)) == {(1, 1, 1): EX(pi)} def test_PolyElement___div__(): R, x,y,z = ring("x,y,z", ZZ) assert (2*x**2 - 4)/2 == x**2 - 2 assert (2*x**2 - 3)/2 == x**2 assert (x**2 - 1).quo(x) == x assert (x**2 - x).quo(x) == x - 1 assert (x**2 - 1)/x == x - x**(-1) assert (x**2 - x)/x == x - 1 assert (x**2 - 1)/(2*x) == x/2 - x**(-1)/2 assert (x**2 - 1).quo(2*x) == 0 assert (x**2 - x)/(x - 1) == (x**2 - x).quo(x - 1) == x R, x,y,z = ring("x,y,z", ZZ) assert len((x**2/3 + y**3/4 + z**4/5).terms()) == 0 R, x,y,z = ring("x,y,z", QQ) assert len((x**2/3 + y**3/4 + z**4/5).terms()) == 3 Rt, t = ring("t", ZZ) Ruv, u,v = ring("u,v", ZZ) Rxyz, x,y,z = ring("x,y,z", Ruv) assert dict((u**2*x + u)/u) == {(1, 0, 0): u, (0, 0, 0): 1} raises(TypeError, lambda: u/(u**2*x + u)) raises(TypeError, lambda: t/x) raises(TypeError, lambda: x/t) raises(TypeError, lambda: t/u) raises(TypeError, lambda: u/t) R, x = ring("x", ZZ) f, g = x**2 + 2*x + 3, R(0) raises(ZeroDivisionError, lambda: f.div(g)) raises(ZeroDivisionError, lambda: divmod(f, g)) raises(ZeroDivisionError, lambda: f.rem(g)) raises(ZeroDivisionError, lambda: f % g) raises(ZeroDivisionError, lambda: f.quo(g)) raises(ZeroDivisionError, lambda: f / g) raises(ZeroDivisionError, lambda: f.exquo(g)) R, x, y = ring("x,y", ZZ) f, g = x*y + 2*x + 3, R(0) raises(ZeroDivisionError, lambda: f.div(g)) raises(ZeroDivisionError, lambda: divmod(f, g)) raises(ZeroDivisionError, lambda: f.rem(g)) raises(ZeroDivisionError, lambda: f % g) raises(ZeroDivisionError, lambda: f.quo(g)) raises(ZeroDivisionError, lambda: f / g) raises(ZeroDivisionError, lambda: f.exquo(g)) R, x = ring("x", ZZ) f, g = x**2 + 1, 2*x - 4 q, r = R(0), x**2 + 1 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = 3*x**3 + x**2 + x + 5, 5*x**2 - 3*x + 1 q, r = R(0), f assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1, x**2 + 2*x + 3 q, r = 5*x**2 - 6*x, 20*x + 1 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = 5*x**5 + 4*x**4 + 3*x**3 + 2*x**2 + x, x**4 + 2*x**3 + 9 q, r = 5*x - 6, 15*x**3 + 2*x**2 - 44*x + 54 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) R, x = ring("x", QQ) f, g = x**2 + 1, 2*x - 4 q, r = x/2 + 1, R(5) assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = 3*x**3 + x**2 + x + 5, 5*x**2 - 3*x + 1 q, r = QQ(3, 5)*x + QQ(14, 25), QQ(52, 25)*x + QQ(111, 25) assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) R, x,y = ring("x,y", ZZ) f, g = x**2 - y**2, x - y q, r = x + y, R(0) assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q assert f.exquo(g) == q f, g = x**2 + y**2, x - y q, r = x + y, 2*y**2 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = x**2 + y**2, -x + y q, r = -x - y, 2*y**2 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = x**2 + y**2, 2*x - 2*y q, r = R(0), f assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) R, x,y = ring("x,y", QQ) f, g = x**2 - y**2, x - y q, r = x + y, R(0) assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q assert f.exquo(g) == q f, g = x**2 + y**2, x - y q, r = x + y, 2*y**2 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = x**2 + y**2, -x + y q, r = -x - y, 2*y**2 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) f, g = x**2 + y**2, 2*x - 2*y q, r = x/2 + y/2, 2*y**2 assert f.div(g) == divmod(f, g) == (q, r) assert f.rem(g) == f % g == r assert f.quo(g) == f / g == q raises(ExactQuotientFailed, lambda: f.exquo(g)) def test_PolyElement___pow__(): R, x = ring("x", ZZ, grlex) f = 2*x + 3 assert f**0 == 1 assert f**1 == f raises(ValueError, lambda: f**(-1)) assert x**(-1) == x**(-1) assert f**2 == f._pow_generic(2) == f._pow_multinomial(2) == 4*x**2 + 12*x + 9 assert f**3 == f._pow_generic(3) == f._pow_multinomial(3) == 8*x**3 + 36*x**2 + 54*x + 27 assert f**4 == f._pow_generic(4) == f._pow_multinomial(4) == 16*x**4 + 96*x**3 + 216*x**2 + 216*x + 81 assert f**5 == f._pow_generic(5) == f._pow_multinomial(5) == 32*x**5 + 240*x**4 + 720*x**3 + 1080*x**2 + 810*x + 243 R, x,y,z = ring("x,y,z", ZZ, grlex) f = x**3*y - 2*x*y**2 - 3*z + 1 g = x**6*y**2 - 4*x**4*y**3 - 6*x**3*y*z + 2*x**3*y + 4*x**2*y**4 + 12*x*y**2*z - 4*x*y**2 + 9*z**2 - 6*z + 1 assert f**2 == f._pow_generic(2) == f._pow_multinomial(2) == g R, t = ring("t", ZZ) f = -11200*t**4 - 2604*t**2 + 49 g = 15735193600000000*t**16 + 14633730048000000*t**14 + 4828147466240000*t**12 \ + 598976863027200*t**10 + 3130812416256*t**8 - 2620523775744*t**6 \ + 92413760096*t**4 - 1225431984*t**2 + 5764801 assert f**4 == f._pow_generic(4) == f._pow_multinomial(4) == g def test_PolyElement_div(): R, x = ring("x", ZZ, grlex) f = x**3 - 12*x**2 - 42 g = x - 3 q = x**2 - 9*x - 27 r = -123 assert f.div([g]) == ([q], r) R, x = ring("x", ZZ, grlex) f = x**2 + 2*x + 2 assert f.div([R(1)]) == ([f], 0) R, x = ring("x", QQ, grlex) f = x**2 + 2*x + 2 assert f.div([R(2)]) == ([QQ(1,2)*x**2 + x + 1], 0) R, x,y = ring("x,y", ZZ, grlex) f = 4*x**2*y - 2*x*y + 4*x - 2*y + 8 assert f.div([R(2)]) == ([2*x**2*y - x*y + 2*x - y + 4], 0) assert f.div([2*y]) == ([2*x**2 - x - 1], 4*x + 8) f = x - 1 g = y - 1 assert f.div([g]) == ([0], f) f = x*y**2 + 1 G = [x*y + 1, y + 1] Q = [y, -1] r = 2 assert f.div(G) == (Q, r) f = x**2*y + x*y**2 + y**2 G = [x*y - 1, y**2 - 1] Q = [x + y, 1] r = x + y + 1 assert f.div(G) == (Q, r) G = [y**2 - 1, x*y - 1] Q = [x + 1, x] r = 2*x + 1 assert f.div(G) == (Q, r) R, = ring("", ZZ) assert R(3).div(R(2)) == (0, 3) R, = ring("", QQ) assert R(3).div(R(2)) == (QQ(3, 2), 0) def test_PolyElement_rem(): R, x = ring("x", ZZ, grlex) f = x**3 - 12*x**2 - 42 g = x - 3 r = -123 assert f.rem([g]) == f.div([g])[1] == r R, x,y = ring("x,y", ZZ, grlex) f = 4*x**2*y - 2*x*y + 4*x - 2*y + 8 assert f.rem([R(2)]) == f.div([R(2)])[1] == 0 assert f.rem([2*y]) == f.div([2*y])[1] == 4*x + 8 f = x - 1 g = y - 1 assert f.rem([g]) == f.div([g])[1] == f f = x*y**2 + 1 G = [x*y + 1, y + 1] r = 2 assert f.rem(G) == f.div(G)[1] == r f = x**2*y + x*y**2 + y**2 G = [x*y - 1, y**2 - 1] r = x + y + 1 assert f.rem(G) == f.div(G)[1] == r G = [y**2 - 1, x*y - 1] r = 2*x + 1 assert f.rem(G) == f.div(G)[1] == r def test_PolyElement_deflate(): R, x = ring("x", ZZ) assert (2*x**2).deflate(x**4 + 4*x**2 + 1) == ((2,), [2*x, x**2 + 4*x + 1]) R, x,y = ring("x,y", ZZ) assert R(0).deflate(R(0)) == ((1, 1), [0, 0]) assert R(1).deflate(R(0)) == ((1, 1), [1, 0]) assert R(1).deflate(R(2)) == ((1, 1), [1, 2]) assert R(1).deflate(2*y) == ((1, 1), [1, 2*y]) assert (2*y).deflate(2*y) == ((1, 1), [2*y, 2*y]) assert R(2).deflate(2*y**2) == ((1, 2), [2, 2*y]) assert (2*y**2).deflate(2*y**2) == ((1, 2), [2*y, 2*y]) f = x**4*y**2 + x**2*y + 1 g = x**2*y**3 + x**2*y + 1 assert f.deflate(g) == ((2, 1), [x**2*y**2 + x*y + 1, x*y**3 + x*y + 1]) def test_PolyElement_clear_denoms(): R, x,y = ring("x,y", QQ) assert R(1).clear_denoms() == (ZZ(1), 1) assert R(7).clear_denoms() == (ZZ(1), 7) assert R(QQ(7,3)).clear_denoms() == (3, 7) assert R(QQ(7,3)).clear_denoms() == (3, 7) assert (3*x**2 + x).clear_denoms() == (1, 3*x**2 + x) assert (x**2 + QQ(1,2)*x).clear_denoms() == (2, 2*x**2 + x) rQQ, x,t = ring("x,t", QQ, lex) rZZ, X,T = ring("x,t", ZZ, lex) F = [x - QQ(17824537287975195925064602467992950991718052713078834557692023531499318507213727406844943097,413954288007559433755329699713866804710749652268151059918115348815925474842910720000)*t**7 - QQ(4882321164854282623427463828745855894130208215961904469205260756604820743234704900167747753,12936071500236232304854053116058337647210926633379720622441104650497671088840960000)*t**6 - QQ(36398103304520066098365558157422127347455927422509913596393052633155821154626830576085097433,25872143000472464609708106232116675294421853266759441244882209300995342177681920000)*t**5 - QQ(168108082231614049052707339295479262031324376786405372698857619250210703675982492356828810819,58212321751063045371843239022262519412449169850208742800984970927239519899784320000)*t**4 - QQ(5694176899498574510667890423110567593477487855183144378347226247962949388653159751849449037,1617008937529529038106756639507292205901365829172465077805138081312208886105120000)*t**3 - QQ(154482622347268833757819824809033388503591365487934245386958884099214649755244381307907779,60637835157357338929003373981523457721301218593967440417692678049207833228942000)*t**2 - QQ(2452813096069528207645703151222478123259511586701148682951852876484544822947007791153163,2425513406294293557160134959260938308852048743758697616707707121968313329157680)*t - QQ(34305265428126440542854669008203683099323146152358231964773310260498715579162112959703,202126117191191129763344579938411525737670728646558134725642260164026110763140), t**8 + QQ(693749860237914515552,67859264524169150569)*t**7 + QQ(27761407182086143225024,610733380717522355121)*t**6 + QQ(7785127652157884044288,67859264524169150569)*t**5 + QQ(36567075214771261409792,203577793572507451707)*t**4 + QQ(36336335165196147384320,203577793572507451707)*t**3 + QQ(7452455676042754048000,67859264524169150569)*t**2 + QQ(2593331082514399232000,67859264524169150569)*t + QQ(390399197427343360000,67859264524169150569)] G = [3725588592068034903797967297424801242396746870413359539263038139343329273586196480000*X - 160420835591776763325581422211936558925462474417709511019228211783493866564923546661604487873*T**7 - 1406108495478033395547109582678806497509499966197028487131115097902188374051595011248311352864*T**6 - 5241326875850889518164640374668786338033653548841427557880599579174438246266263602956254030352*T**5 - 10758917262823299139373269714910672770004760114329943852726887632013485035262879510837043892416*T**4 - 13119383576444715672578819534846747735372132018341964647712009275306635391456880068261130581248*T**3 - 9491412317016197146080450036267011389660653495578680036574753839055748080962214787557853941760*T**2 - 3767520915562795326943800040277726397326609797172964377014046018280260848046603967211258368000*T - 632314652371226552085897259159210286886724229880266931574701654721512325555116066073245696000, 610733380717522355121*T**8 + 6243748742141230639968*T**7 + 27761407182086143225024*T**6 + 70066148869420956398592*T**5 + 109701225644313784229376*T**4 + 109009005495588442152960*T**3 + 67072101084384786432000*T**2 + 23339979742629593088000*T + 3513592776846090240000] assert [ f.clear_denoms()[1].set_ring(rZZ) for f in F ] == G def test_PolyElement_cofactors(): R, x, y = ring("x,y", ZZ) f, g = R(0), R(0) assert f.cofactors(g) == (0, 0, 0) f, g = R(2), R(0) assert f.cofactors(g) == (2, 1, 0) f, g = R(-2), R(0) assert f.cofactors(g) == (2, -1, 0) f, g = R(0), R(-2) assert f.cofactors(g) == (2, 0, -1) f, g = R(0), 2*x + 4 assert f.cofactors(g) == (2*x + 4, 0, 1) f, g = 2*x + 4, R(0) assert f.cofactors(g) == (2*x + 4, 1, 0) f, g = R(2), R(2) assert f.cofactors(g) == (2, 1, 1) f, g = R(-2), R(2) assert f.cofactors(g) == (2, -1, 1) f, g = R(2), R(-2) assert f.cofactors(g) == (2, 1, -1) f, g = R(-2), R(-2) assert f.cofactors(g) == (2, -1, -1) f, g = x**2 + 2*x + 1, R(1) assert f.cofactors(g) == (1, x**2 + 2*x + 1, 1) f, g = x**2 + 2*x + 1, R(2) assert f.cofactors(g) == (1, x**2 + 2*x + 1, 2) f, g = 2*x**2 + 4*x + 2, R(2) assert f.cofactors(g) == (2, x**2 + 2*x + 1, 1) f, g = R(2), 2*x**2 + 4*x + 2 assert f.cofactors(g) == (2, 1, x**2 + 2*x + 1) f, g = 2*x**2 + 4*x + 2, x + 1 assert f.cofactors(g) == (x + 1, 2*x + 2, 1) f, g = x + 1, 2*x**2 + 4*x + 2 assert f.cofactors(g) == (x + 1, 1, 2*x + 2) R, x, y, z, t = ring("x,y,z,t", ZZ) f, g = t**2 + 2*t + 1, 2*t + 2 assert f.cofactors(g) == (t + 1, t + 1, 2) f, g = z**2*t**2 + 2*z**2*t + z**2 + z*t + z, t**2 + 2*t + 1 h, cff, cfg = t + 1, z**2*t + z**2 + z, t + 1 assert f.cofactors(g) == (h, cff, cfg) assert g.cofactors(f) == (h, cfg, cff) R, x, y = ring("x,y", QQ) f = QQ(1,2)*x**2 + x + QQ(1,2) g = QQ(1,2)*x + QQ(1,2) h = x + 1 assert f.cofactors(g) == (h, g, QQ(1,2)) assert g.cofactors(f) == (h, QQ(1,2), g) R, x, y = ring("x,y", RR) f = 2.1*x*y**2 - 2.1*x*y + 2.1*x g = 2.1*x**3 h = 1.0*x assert f.cofactors(g) == (h, f/h, g/h) assert g.cofactors(f) == (h, g/h, f/h) def test_PolyElement_gcd(): R, x, y = ring("x,y", QQ) f = QQ(1,2)*x**2 + x + QQ(1,2) g = QQ(1,2)*x + QQ(1,2) assert f.gcd(g) == x + 1 def test_PolyElement_cancel(): R, x, y = ring("x,y", ZZ) f = 2*x**3 + 4*x**2 + 2*x g = 3*x**2 + 3*x F = 2*x + 2 G = 3 assert f.cancel(g) == (F, G) assert (-f).cancel(g) == (-F, G) assert f.cancel(-g) == (-F, G) R, x, y = ring("x,y", QQ) f = QQ(1,2)*x**3 + x**2 + QQ(1,2)*x g = QQ(1,3)*x**2 + QQ(1,3)*x F = 3*x + 3 G = 2 assert f.cancel(g) == (F, G) assert (-f).cancel(g) == (-F, G) assert f.cancel(-g) == (-F, G) Fx, x = field("x", ZZ) Rt, t = ring("t", Fx) f = (-x**2 - 4)/4*t g = t**2 + (x**2 + 2)/2 assert f.cancel(g) == ((-x**2 - 4)*t, 4*t**2 + 2*x**2 + 4) def test_PolyElement_max_norm(): R, x, y = ring("x,y", ZZ) assert R(0).max_norm() == 0 assert R(1).max_norm() == 1 assert (x**3 + 4*x**2 + 2*x + 3).max_norm() == 4 def test_PolyElement_l1_norm(): R, x, y = ring("x,y", ZZ) assert R(0).l1_norm() == 0 assert R(1).l1_norm() == 1 assert (x**3 + 4*x**2 + 2*x + 3).l1_norm() == 10 def test_PolyElement_diff(): R, X = xring("x:11", QQ) f = QQ(288,5)*X[0]**8*X[1]**6*X[4]**3*X[10]**2 + 8*X[0]**2*X[2]**3*X[4]**3 +2*X[0]**2 - 2*X[1]**2 assert f.diff(X[0]) == QQ(2304,5)*X[0]**7*X[1]**6*X[4]**3*X[10]**2 + 16*X[0]*X[2]**3*X[4]**3 + 4*X[0] assert f.diff(X[4]) == QQ(864,5)*X[0]**8*X[1]**6*X[4]**2*X[10]**2 + 24*X[0]**2*X[2]**3*X[4]**2 assert f.diff(X[10]) == QQ(576,5)*X[0]**8*X[1]**6*X[4]**3*X[10] def test_PolyElement___call__(): R, x = ring("x", ZZ) f = 3*x + 1 assert f(0) == 1 assert f(1) == 4 raises(ValueError, lambda: f()) raises(ValueError, lambda: f(0, 1)) raises(CoercionFailed, lambda: f(QQ(1,7))) R, x,y = ring("x,y", ZZ) f = 3*x + y**2 + 1 assert f(0, 0) == 1 assert f(1, 7) == 53 Ry = R.drop(x) assert f(0) == Ry.y**2 + 1 assert f(1) == Ry.y**2 + 4 raises(ValueError, lambda: f()) raises(ValueError, lambda: f(0, 1, 2)) raises(CoercionFailed, lambda: f(1, QQ(1,7))) raises(CoercionFailed, lambda: f(QQ(1,7), 1)) raises(CoercionFailed, lambda: f(QQ(1,7), QQ(1,7))) def test_PolyElement_evaluate(): R, x = ring("x", ZZ) f = x**3 + 4*x**2 + 2*x + 3 r = f.evaluate(x, 0) assert r == 3 and not isinstance(r, PolyElement) raises(CoercionFailed, lambda: f.evaluate(x, QQ(1,7))) R, x, y, z = ring("x,y,z", ZZ) f = (x*y)**3 + 4*(x*y)**2 + 2*x*y + 3 r = f.evaluate(x, 0) assert r == 3 and isinstance(r, R.drop(x).dtype) r = f.evaluate([(x, 0), (y, 0)]) assert r == 3 and isinstance(r, R.drop(x, y).dtype) r = f.evaluate(y, 0) assert r == 3 and isinstance(r, R.drop(y).dtype) r = f.evaluate([(y, 0), (x, 0)]) assert r == 3 and isinstance(r, R.drop(y, x).dtype) r = f.evaluate([(x, 0), (y, 0), (z, 0)]) assert r == 3 and not isinstance(r, PolyElement) raises(CoercionFailed, lambda: f.evaluate([(x, 1), (y, QQ(1,7))])) raises(CoercionFailed, lambda: f.evaluate([(x, QQ(1,7)), (y, 1)])) raises(CoercionFailed, lambda: f.evaluate([(x, QQ(1,7)), (y, QQ(1,7))])) def test_PolyElement_subs(): R, x = ring("x", ZZ) f = x**3 + 4*x**2 + 2*x + 3 r = f.subs(x, 0) assert r == 3 and isinstance(r, R.dtype) raises(CoercionFailed, lambda: f.subs(x, QQ(1,7))) R, x, y, z = ring("x,y,z", ZZ) f = x**3 + 4*x**2 + 2*x + 3 r = f.subs(x, 0) assert r == 3 and isinstance(r, R.dtype) r = f.subs([(x, 0), (y, 0)]) assert r == 3 and isinstance(r, R.dtype) raises(CoercionFailed, lambda: f.subs([(x, 1), (y, QQ(1,7))])) raises(CoercionFailed, lambda: f.subs([(x, QQ(1,7)), (y, 1)])) raises(CoercionFailed, lambda: f.subs([(x, QQ(1,7)), (y, QQ(1,7))])) def test_PolyElement_compose(): R, x = ring("x", ZZ) f = x**3 + 4*x**2 + 2*x + 3 r = f.compose(x, 0) assert r == 3 and isinstance(r, R.dtype) assert f.compose(x, x) == f assert f.compose(x, x**2) == x**6 + 4*x**4 + 2*x**2 + 3 raises(CoercionFailed, lambda: f.compose(x, QQ(1,7))) R, x, y, z = ring("x,y,z", ZZ) f = x**3 + 4*x**2 + 2*x + 3 r = f.compose(x, 0) assert r == 3 and isinstance(r, R.dtype) r = f.compose([(x, 0), (y, 0)]) assert r == 3 and isinstance(r, R.dtype) r = (x**3 + 4*x**2 + 2*x*y*z + 3).compose(x, y*z**2 - 1) q = (y*z**2 - 1)**3 + 4*(y*z**2 - 1)**2 + 2*(y*z**2 - 1)*y*z + 3 assert r == q and isinstance(r, R.dtype) def test_PolyElement_is_(): R, x,y,z = ring("x,y,z", QQ) assert (x - x).is_generator == False assert (x - x).is_ground == True assert (x - x).is_monomial == True assert (x - x).is_term == True assert (x - x + 1).is_generator == False assert (x - x + 1).is_ground == True assert (x - x + 1).is_monomial == True assert (x - x + 1).is_term == True assert x.is_generator == True assert x.is_ground == False assert x.is_monomial == True assert x.is_term == True assert (x*y).is_generator == False assert (x*y).is_ground == False assert (x*y).is_monomial == True assert (x*y).is_term == True assert (3*x).is_generator == False assert (3*x).is_ground == False assert (3*x).is_monomial == False assert (3*x).is_term == True assert (3*x + 1).is_generator == False assert (3*x + 1).is_ground == False assert (3*x + 1).is_monomial == False assert (3*x + 1).is_term == False assert R(0).is_zero is True assert R(1).is_zero is False assert R(0).is_one is False assert R(1).is_one is True assert (x - 1).is_monic is True assert (2*x - 1).is_monic is False assert (3*x + 2).is_primitive is True assert (4*x + 2).is_primitive is False assert (x + y + z + 1).is_linear is True assert (x*y*z + 1).is_linear is False assert (x*y + z + 1).is_quadratic is True assert (x*y*z + 1).is_quadratic is False assert (x - 1).is_squarefree is True assert ((x - 1)**2).is_squarefree is False assert (x**2 + x + 1).is_irreducible is True assert (x**2 + 2*x + 1).is_irreducible is False _, t = ring("t", FF(11)) assert (7*t + 3).is_irreducible is True assert (7*t**2 + 3*t + 1).is_irreducible is False _, u = ring("u", ZZ) f = u**16 + u**14 - u**10 - u**8 - u**6 + u**2 assert f.is_cyclotomic is False assert (f + 1).is_cyclotomic is True raises(MultivariatePolynomialError, lambda: x.is_cyclotomic) R, = ring("", ZZ) assert R(4).is_squarefree is True assert R(6).is_irreducible is True def test_PolyElement_drop(): R, x,y,z = ring("x,y,z", ZZ) assert R(1).drop(0).ring == PolyRing("y,z", ZZ, lex) assert R(1).drop(0).drop(0).ring == PolyRing("z", ZZ, lex) assert isinstance(R(1).drop(0).drop(0).drop(0), R.dtype) is False raises(ValueError, lambda: z.drop(0).drop(0).drop(0)) raises(ValueError, lambda: x.drop(0)) def test_PolyElement_pdiv(): _, x, y = ring("x,y", ZZ) f, g = x**2 - y**2, x - y q, r = x + y, 0 assert f.pdiv(g) == (q, r) assert f.prem(g) == r assert f.pquo(g) == q assert f.pexquo(g) == q def test_PolyElement_gcdex(): _, x = ring("x", QQ) f, g = 2*x, x**2 - 16 s, t, h = x/32, -QQ(1, 16), 1 assert f.half_gcdex(g) == (s, h) assert f.gcdex(g) == (s, t, h) def test_PolyElement_subresultants(): _, x = ring("x", ZZ) f, g, h = x**2 - 2*x + 1, x**2 - 1, 2*x - 2 assert f.subresultants(g) == [f, g, h] def test_PolyElement_resultant(): _, x = ring("x", ZZ) f, g, h = x**2 - 2*x + 1, x**2 - 1, 0 assert f.resultant(g) == h def test_PolyElement_discriminant(): _, x = ring("x", ZZ) f, g = x**3 + 3*x**2 + 9*x - 13, -11664 assert f.discriminant() == g F, a, b, c = ring("a,b,c", ZZ) _, x = ring("x", F) f, g = a*x**2 + b*x + c, b**2 - 4*a*c assert f.discriminant() == g def test_PolyElement_decompose(): _, x = ring("x", ZZ) f = x**12 + 20*x**10 + 150*x**8 + 500*x**6 + 625*x**4 - 2*x**3 - 10*x + 9 g = x**4 - 2*x + 9 h = x**3 + 5*x assert g.compose(x, h) == f assert f.decompose() == [g, h] def test_PolyElement_shift(): _, x = ring("x", ZZ) assert (x**2 - 2*x + 1).shift(2) == x**2 + 2*x + 1 def test_PolyElement_sturm(): F, t = field("t", ZZ) _, x = ring("x", F) f = 1024/(15625*t**8)*x**5 - 4096/(625*t**8)*x**4 + 32/(15625*t**4)*x**3 - 128/(625*t**4)*x**2 + F(1)/62500*x - F(1)/625 assert f.sturm() == [ x**3 - 100*x**2 + t**4/64*x - 25*t**4/16, 3*x**2 - 200*x + t**4/64, (-t**4/96 + F(20000)/9)*x + 25*t**4/18, (-9*t**12 - 11520000*t**8 - 3686400000000*t**4)/(576*t**8 - 245760000*t**4 + 26214400000000), ] def test_PolyElement_gff_list(): _, x = ring("x", ZZ) f = x**5 + 2*x**4 - x**3 - 2*x**2 assert f.gff_list() == [(x, 1), (x + 2, 4)] f = x*(x - 1)**3*(x - 2)**2*(x - 4)**2*(x - 5) assert f.gff_list() == [(x**2 - 5*x + 4, 1), (x**2 - 5*x + 4, 2), (x, 3)] def test_PolyElement_sqf_norm(): R, x = ring("x", QQ.algebraic_field(sqrt(3))) X = R.to_ground().x assert (x**2 - 2).sqf_norm() == (1, x**2 - 2*sqrt(3)*x + 1, X**4 - 10*X**2 + 1) R, x = ring("x", QQ.algebraic_field(sqrt(2))) X = R.to_ground().x assert (x**2 - 3).sqf_norm() == (1, x**2 - 2*sqrt(2)*x - 1, X**4 - 10*X**2 + 1) def test_PolyElement_sqf_list(): _, x = ring("x", ZZ) f = x**5 - x**3 - x**2 + 1 g = x**3 + 2*x**2 + 2*x + 1 h = x - 1 p = x**4 + x**3 - x - 1 assert f.sqf_part() == p assert f.sqf_list() == (1, [(g, 1), (h, 2)]) def test_PolyElement_factor_list(): _, x = ring("x", ZZ) f = x**5 - x**3 - x**2 + 1 u = x + 1 v = x - 1 w = x**2 + x + 1 assert f.factor_list() == (1, [(u, 1), (v, 2), (w, 1)])
d6fae98d8c34b2fc8c59e710dd617653166bd1acc75b609c9425a0472a7574d0
"""Tests for Dixon's and Macaulay's classes. """ from sympy import Matrix, factor from sympy.core import symbols from sympy.tensor.indexed import IndexedBase from sympy.polys.multivariate_resultants import (DixonResultant, MacaulayResultant) c, d = symbols("a, b") x, y = symbols("x, y") p = c * x + y q = x + d * y dixon = DixonResultant(polynomials=[p, q], variables=[x, y]) macaulay = MacaulayResultant(polynomials=[p, q], variables=[x, y]) def test_dixon_resultant_init(): """Test init method of DixonResultant.""" a = IndexedBase("alpha") assert dixon.polynomials == [p, q] assert dixon.variables == [x, y] assert dixon.n == 2 assert dixon.m == 2 assert dixon.dummy_variables == [a[0], a[1]] def test_get_dixon_polynomial_numerical(): """Test Dixon's polynomial for a numerical example.""" a = IndexedBase("alpha") p = x + y q = x ** 2 + y **3 h = x ** 2 + y dixon = DixonResultant([p, q, h], [x, y]) polynomial = -x * y ** 2 * a[0] - x * y ** 2 * a[1] - x * y * a[0] \ * a[1] - x * y * a[1] ** 2 - x * a[0] * a[1] ** 2 + x * a[0] - \ y ** 2 * a[0] * a[1] + y ** 2 * a[1] - y * a[0] * a[1] ** 2 + y * \ a[1] ** 2 assert dixon.get_dixon_polynomial().as_expr().expand() == polynomial def test_get_max_degrees(): """Tests max degrees function.""" p = x + y q = x ** 2 + y **3 h = x ** 2 + y dixon = DixonResultant(polynomials=[p, q, h], variables=[x, y]) dixon_polynomial = dixon.get_dixon_polynomial() assert dixon.get_max_degrees(dixon_polynomial) == [1, 2] def test_get_dixon_matrix(): """Test Dixon's resultant for a numerical example.""" x, y = symbols('x, y') p = x + y q = x ** 2 + y ** 3 h = x ** 2 + y dixon = DixonResultant([p, q, h], [x, y]) polynomial = dixon.get_dixon_polynomial() assert dixon.get_dixon_matrix(polynomial).det() == 0 def test_get_dixon_matrix_example_two(): """Test Dixon's matrix for example from [Palancz08]_.""" x, y, z = symbols('x, y, z') f = x ** 2 + y ** 2 - 1 + z * 0 g = x ** 2 + z ** 2 - 1 + y * 0 h = y ** 2 + z ** 2 - 1 example_two = DixonResultant([f, g, h], [y, z]) poly = example_two.get_dixon_polynomial() matrix = example_two.get_dixon_matrix(poly) expr = 1 - 8 * x ** 2 + 24 * x ** 4 - 32 * x ** 6 + 16 * x ** 8 assert (matrix.det() - expr).expand() == 0 def test_KSY_precondition(): """Tests precondition for KSY Resultant.""" A, B, C = symbols('A, B, C') m1 = Matrix([[1, 2, 3], [4, 5, 12], [6, 7, 18]]) m2 = Matrix([[0, C**2], [-2 * C, -C ** 2]]) m3 = Matrix([[1, 0], [0, 1]]) m4 = Matrix([[A**2, 0, 1], [A, 1, 1 / A]]) m5 = Matrix([[5, 1], [2, B], [0, 1], [0, 0]]) assert dixon.KSY_precondition(m1) == False assert dixon.KSY_precondition(m2) == True assert dixon.KSY_precondition(m3) == True assert dixon.KSY_precondition(m4) == False assert dixon.KSY_precondition(m5) == True def test_delete_zero_rows_and_columns(): """Tests method for deleting rows and columns containing only zeros.""" A, B, C = symbols('A, B, C') m1 = Matrix([[0, 0], [0, 0], [1, 2]]) m2 = Matrix([[0, 1, 2], [0, 3, 4], [0, 5, 6]]) m3 = Matrix([[0, 0, 0, 0], [0, 1, 2, 0], [0, 3, 4, 0], [0, 0, 0, 0]]) m4 = Matrix([[1, 0, 2], [0, 0, 0], [3, 0, 4]]) m5 = Matrix([[0, 0, 0, 1], [0, 0, 0, 2], [0, 0, 0, 3], [0, 0, 0, 4]]) m6 = Matrix([[0, 0, A], [B, 0, 0], [0, 0, C]]) assert dixon.delete_zero_rows_and_columns(m1) == Matrix([[1, 2]]) assert dixon.delete_zero_rows_and_columns(m2) == Matrix([[1, 2], [3, 4], [5, 6]]) assert dixon.delete_zero_rows_and_columns(m3) == Matrix([[1, 2], [3, 4]]) assert dixon.delete_zero_rows_and_columns(m4) == Matrix([[1, 2], [3, 4]]) assert dixon.delete_zero_rows_and_columns(m5) == Matrix([[1], [2], [3], [4]]) assert dixon.delete_zero_rows_and_columns(m6) == Matrix([[0, A], [B, 0], [0, C]]) def test_product_leading_entries(): """Tests product of leading entries method.""" A, B = symbols('A, B') m1 = Matrix([[1, 2, 3], [0, 4, 5], [0, 0, 6]]) m2 = Matrix([[0, 0, 1], [2, 0, 3]]) m3 = Matrix([[0, 0, 0], [1, 2, 3], [0, 0, 0]]) m4 = Matrix([[0, 0, A], [1, 2, 3], [B, 0, 0]]) assert dixon.product_leading_entries(m1) == 24 assert dixon.product_leading_entries(m2) == 2 assert dixon.product_leading_entries(m3) == 1 assert dixon.product_leading_entries(m4) == A * B def test_get_KSY_Dixon_resultant_example_one(): """Tests the KSY Dixon resultant for example one""" x, y, z = symbols('x, y, z') p = x * y * z q = x**2 - z**2 h = x + y + z dixon = DixonResultant([p, q, h], [x, y]) dixon_poly = dixon.get_dixon_polynomial() dixon_matrix = dixon.get_dixon_matrix(dixon_poly) D = dixon.get_KSY_Dixon_resultant(dixon_matrix) assert D == -z**3 def test_get_KSY_Dixon_resultant_example_two(): """Tests the KSY Dixon resultant for example two""" x, y, A = symbols('x, y, A') p = x * y + x * A + x - A**2 - A + y**2 + y q = x**2 + x * A - x + x * y + y * A - y h = x**2 + x * y + 2 * x - x * A - y * A - 2 * A dixon = DixonResultant([p, q, h], [x, y]) dixon_poly = dixon.get_dixon_polynomial() dixon_matrix = dixon.get_dixon_matrix(dixon_poly) D = factor(dixon.get_KSY_Dixon_resultant(dixon_matrix)) assert D == -8*A*(A - 1)*(A + 2)*(2*A - 1)**2 def test_macaulay_resultant_init(): """Test init method of MacaulayResultant.""" assert macaulay.polynomials == [p, q] assert macaulay.variables == [x, y] assert macaulay.n == 2 assert macaulay.degrees == [1, 1] assert macaulay.degree_m == 1 assert macaulay.monomials_size == 2 def test_get_degree_m(): assert macaulay._get_degree_m() == 1 def test_get_size(): assert macaulay.get_size() == 2 def test_macaulay_example_one(): """Tests the Macaulay for example from [Bruce97]_""" x, y, z = symbols('x, y, z') a_1_1, a_1_2, a_1_3 = symbols('a_1_1, a_1_2, a_1_3') a_2_2, a_2_3, a_3_3 = symbols('a_2_2, a_2_3, a_3_3') b_1_1, b_1_2, b_1_3 = symbols('b_1_1, b_1_2, b_1_3') b_2_2, b_2_3, b_3_3 = symbols('b_2_2, b_2_3, b_3_3') c_1, c_2, c_3 = symbols('c_1, c_2, c_3') f_1 = a_1_1 * x ** 2 + a_1_2 * x * y + a_1_3 * x * z + \ a_2_2 * y ** 2 + a_2_3 * y * z + a_3_3 * z ** 2 f_2 = b_1_1 * x ** 2 + b_1_2 * x * y + b_1_3 * x * z + \ b_2_2 * y ** 2 + b_2_3 * y * z + b_3_3 * z ** 2 f_3 = c_1 * x + c_2 * y + c_3 * z mac = MacaulayResultant([f_1, f_2, f_3], [x, y, z]) assert mac.degrees == [2, 2, 1] assert mac.degree_m == 3 assert mac.monomial_set == [x ** 3, x ** 2 * y, x ** 2 * z, x * y ** 2, x * y * z, x * z ** 2, y ** 3, y ** 2 *z, y * z ** 2, z ** 3] assert mac.monomials_size == 10 assert mac.get_row_coefficients() == [[x, y, z], [x, y, z], [x * y, x * z, y * z, z ** 2]] matrix = mac.get_matrix() assert matrix.shape == (mac.monomials_size, mac.monomials_size) assert mac.get_submatrix(matrix) == Matrix([[a_1_1, a_2_2], [b_1_1, b_2_2]]) def test_macaulay_example_two(): """Tests the Macaulay formulation for example from [Stiller96]_.""" x, y, z = symbols('x, y, z') a_0, a_1, a_2 = symbols('a_0, a_1, a_2') b_0, b_1, b_2 = symbols('b_0, b_1, b_2') c_0, c_1, c_2, c_3, c_4 = symbols('c_0, c_1, c_2, c_3, c_4') f = a_0 * y - a_1 * x + a_2 * z g = b_1 * x ** 2 + b_0 * y ** 2 - b_2 * z ** 2 h = c_0 * y - c_1 * x ** 3 + c_2 * x ** 2 * z - c_3 * x * z ** 2 + \ c_4 * z ** 3 mac = MacaulayResultant([f, g, h], [x, y, z]) assert mac.degrees == [1, 2, 3] assert mac.degree_m == 4 assert mac.monomials_size == 15 assert len(mac.get_row_coefficients()) == mac.n matrix = mac.get_matrix() assert matrix.shape == (mac.monomials_size, mac.monomials_size) assert mac.get_submatrix(matrix) == Matrix([[-a_1, a_0, a_2, 0], [0, -a_1, 0, 0], [0, 0, -a_1, 0], [0, 0, 0, -a_1]])
1e9b01166d5bbd88187da976c30504789417830405ada14e17b921a51f06a675
"""Tests for algorithms for partial fraction decomposition of rational functions. """ from sympy.polys.partfrac import ( apart_undetermined_coeffs, apart, apart_list, assemble_partfrac_list ) from sympy import (S, Poly, E, pi, I, Matrix, Eq, RootSum, Lambda, Symbol, Dummy, factor, together, sqrt, Expr, Rational) from sympy.testing.pytest import raises, XFAIL from sympy.abc import x, y, a, b, c def test_apart(): assert apart(1) == 1 assert apart(1, x) == 1 f, g = (x**2 + 1)/(x + 1), 2/(x + 1) + x - 1 assert apart(f, full=False) == g assert apart(f, full=True) == g f, g = 1/(x + 2)/(x + 1), 1/(1 + x) - 1/(2 + x) assert apart(f, full=False) == g assert apart(f, full=True) == g f, g = 1/(x + 1)/(x + 5), -1/(5 + x)/4 + 1/(1 + x)/4 assert apart(f, full=False) == g assert apart(f, full=True) == g assert apart((E*x + 2)/(x - pi)*(x - 1), x) == \ 2 - E + E*pi + E*x + (E*pi + 2)*(pi - 1)/(x - pi) assert apart(Eq((x**2 + 1)/(x + 1), x), x) == Eq(x - 1 + 2/(x + 1), x) assert apart(x/2, y) == x/2 f, g = (x+y)/(2*x - y), Rational(3, 2)*y/((2*x - y)) + S.Half assert apart(f, x, full=False) == g assert apart(f, x, full=True) == g f, g = (x+y)/(2*x - y), 3*x/(2*x - y) - 1 assert apart(f, y, full=False) == g assert apart(f, y, full=True) == g raises(NotImplementedError, lambda: apart(1/(x + 1)/(y + 2))) def test_apart_matrix(): M = Matrix(2, 2, lambda i, j: 1/(x + i + 1)/(x + j)) assert apart(M) == Matrix([ [1/x - 1/(x + 1), (x + 1)**(-2)], [1/(2*x) - (S.Half)/(x + 2), 1/(x + 1) - 1/(x + 2)], ]) def test_apart_symbolic(): f = a*x**4 + (2*b + 2*a*c)*x**3 + (4*b*c - a**2 + a*c**2)*x**2 + \ (-2*a*b + 2*b*c**2)*x - b**2 g = a**2*x**4 + (2*a*b + 2*c*a**2)*x**3 + (4*a*b*c + b**2 + a**2*c**2)*x**2 + (2*c*b**2 + 2*a*b*c**2)*x + b**2*c**2 assert apart(f/g, x) == 1/a - 1/(x + c)**2 - b**2/(a*(a*x + b)**2) assert apart(1/((x + a)*(x + b)*(x + c)), x) == \ 1/((a - c)*(b - c)*(c + x)) - 1/((a - b)*(b - c)*(b + x)) + \ 1/((a - b)*(a - c)*(a + x)) def test_apart_extension(): f = 2/(x**2 + 1) g = I/(x + I) - I/(x - I) assert apart(f, extension=I) == g assert apart(f, gaussian=True) == g f = x/((x - 2)*(x + I)) assert factor(together(apart(f)).expand()) == f def test_apart_full(): f = 1/(x**2 + 1) assert apart(f, full=False) == f assert apart(f, full=True) == \ -RootSum(x**2 + 1, Lambda(a, a/(x - a)), auto=False)/2 f = 1/(x**3 + x + 1) assert apart(f, full=False) == f assert apart(f, full=True) == \ RootSum(x**3 + x + 1, Lambda(a, (a**2*Rational(6, 31) - a*Rational(9, 31) + Rational(4, 31))/(x - a)), auto=False) f = 1/(x**5 + 1) assert apart(f, full=False) == \ (Rational(-1, 5))*((x**3 - 2*x**2 + 3*x - 4)/(x**4 - x**3 + x**2 - x + 1)) + (Rational(1, 5))/(x + 1) assert apart(f, full=True) == \ -RootSum(x**4 - x**3 + x**2 - x + 1, Lambda(a, a/(x - a)), auto=False)/5 + (Rational(1, 5))/(x + 1) def test_apart_undetermined_coeffs(): p = Poly(2*x - 3) q = Poly(x**9 - x**8 - x**6 + x**5 - 2*x**2 + 3*x - 1) r = (-x**7 - x**6 - x**5 + 4)/(x**8 - x**5 - 2*x + 1) + 1/(x - 1) assert apart_undetermined_coeffs(p, q) == r p = Poly(1, x, domain='ZZ[a,b]') q = Poly((x + a)*(x + b), x, domain='ZZ[a,b]') r = 1/((a - b)*(b + x)) - 1/((a - b)*(a + x)) assert apart_undetermined_coeffs(p, q) == r def test_apart_list(): from sympy.utilities.iterables import numbered_symbols w0, w1, w2 = Symbol("w0"), Symbol("w1"), Symbol("w2") _a = Dummy("a") f = (-2*x - 2*x**2) / (3*x**2 - 6*x) assert apart_list(f, x, dummies=numbered_symbols("w")) == (-1, Poly(Rational(2, 3), x, domain='QQ'), [(Poly(w0 - 2, w0, domain='ZZ'), Lambda(_a, 2), Lambda(_a, -_a + x), 1)]) assert apart_list(2/(x**2-2), x, dummies=numbered_symbols("w")) == (1, Poly(0, x, domain='ZZ'), [(Poly(w0**2 - 2, w0, domain='ZZ'), Lambda(_a, _a/2), Lambda(_a, -_a + x), 1)]) f = 36 / (x**5 - 2*x**4 - 2*x**3 + 4*x**2 + x - 2) assert apart_list(f, x, dummies=numbered_symbols("w")) == (1, Poly(0, x, domain='ZZ'), [(Poly(w0 - 2, w0, domain='ZZ'), Lambda(_a, 4), Lambda(_a, -_a + x), 1), (Poly(w1**2 - 1, w1, domain='ZZ'), Lambda(_a, -3*_a - 6), Lambda(_a, -_a + x), 2), (Poly(w2 + 1, w2, domain='ZZ'), Lambda(_a, -4), Lambda(_a, -_a + x), 1)]) def test_assemble_partfrac_list(): f = 36 / (x**5 - 2*x**4 - 2*x**3 + 4*x**2 + x - 2) pfd = apart_list(f) assert assemble_partfrac_list(pfd) == -4/(x + 1) - 3/(x + 1)**2 - 9/(x - 1)**2 + 4/(x - 2) a = Dummy("a") pfd = (1, Poly(0, x, domain='ZZ'), [([sqrt(2),-sqrt(2)], Lambda(a, a/2), Lambda(a, -a + x), 1)]) assert assemble_partfrac_list(pfd) == -1/(sqrt(2)*(x + sqrt(2))) + 1/(sqrt(2)*(x - sqrt(2))) @XFAIL def test_noncommutative_pseudomultivariate(): # apart doesn't go inside noncommutative expressions class foo(Expr): is_commutative=False e = x/(x + x*y) c = 1/(1 + y) assert apart(e + foo(e)) == c + foo(c) assert apart(e*foo(e)) == c*foo(c) def test_noncommutative(): class foo(Expr): is_commutative=False e = x/(x + x*y) c = 1/(1 + y) assert apart(e + foo()) == c + foo() def test_issue_5798(): assert apart( 2*x/(x**2 + 1) - (x - 1)/(2*(x**2 + 1)) + 1/(2*(x + 1)) - 2/x) == \ (3*x + 1)/(x**2 + 1)/2 + 1/(x + 1)/2 - 2/x
54f9ce9c552d4fca469452bcd7188dbd276e6eae7b8665f72ddf5e106bc81ab7
"""Tests for computational algebraic number field theory. """ from sympy import (S, Rational, Symbol, Poly, sqrt, I, oo, Tuple, expand, pi, cos, sin, exp, GoldenRatio, TribonacciConstant, cbrt) from sympy.solvers.solveset import nonlinsolve from sympy.geometry import Circle, intersection from sympy.testing.pytest import raises, slow from sympy.sets.sets import FiniteSet from sympy import Point2D from sympy.polys.numberfields import ( minimal_polynomial, primitive_element, is_isomorphism_possible, field_isomorphism_pslq, field_isomorphism, to_number_field, AlgebraicNumber, isolate, IntervalPrinter, ) from sympy.polys.polyerrors import ( IsomorphismFailed, NotAlgebraic, GeneratorsError, ) from sympy.polys.polyclasses import DMP from sympy.polys.domains import QQ from sympy.polys.rootoftools import rootof from sympy.polys.polytools import degree from sympy.abc import x, y, z Q = Rational def test_minimal_polynomial(): assert minimal_polynomial(-7, x) == x + 7 assert minimal_polynomial(-1, x) == x + 1 assert minimal_polynomial( 0, x) == x assert minimal_polynomial( 1, x) == x - 1 assert minimal_polynomial( 7, x) == x - 7 assert minimal_polynomial(sqrt(2), x) == x**2 - 2 assert minimal_polynomial(sqrt(5), x) == x**2 - 5 assert minimal_polynomial(sqrt(6), x) == x**2 - 6 assert minimal_polynomial(2*sqrt(2), x) == x**2 - 8 assert minimal_polynomial(3*sqrt(5), x) == x**2 - 45 assert minimal_polynomial(4*sqrt(6), x) == x**2 - 96 assert minimal_polynomial(2*sqrt(2) + 3, x) == x**2 - 6*x + 1 assert minimal_polynomial(3*sqrt(5) + 6, x) == x**2 - 12*x - 9 assert minimal_polynomial(4*sqrt(6) + 7, x) == x**2 - 14*x - 47 assert minimal_polynomial(2*sqrt(2) - 3, x) == x**2 + 6*x + 1 assert minimal_polynomial(3*sqrt(5) - 6, x) == x**2 + 12*x - 9 assert minimal_polynomial(4*sqrt(6) - 7, x) == x**2 + 14*x - 47 assert minimal_polynomial(sqrt(1 + sqrt(6)), x) == x**4 - 2*x**2 - 5 assert minimal_polynomial(sqrt(I + sqrt(6)), x) == x**8 - 10*x**4 + 49 assert minimal_polynomial(2*I + sqrt(2 + I), x) == x**4 + 4*x**2 + 8*x + 37 assert minimal_polynomial(sqrt(2) + sqrt(3), x) == x**4 - 10*x**2 + 1 assert minimal_polynomial( sqrt(2) + sqrt(3) + sqrt(6), x) == x**4 - 22*x**2 - 48*x - 23 a = 1 - 9*sqrt(2) + 7*sqrt(3) assert minimal_polynomial( 1/a, x) == 392*x**4 - 1232*x**3 + 612*x**2 + 4*x - 1 assert minimal_polynomial( 1/sqrt(a), x) == 392*x**8 - 1232*x**6 + 612*x**4 + 4*x**2 - 1 raises(NotAlgebraic, lambda: minimal_polynomial(oo, x)) raises(NotAlgebraic, lambda: minimal_polynomial(2**y, x)) raises(NotAlgebraic, lambda: minimal_polynomial(sin(1), x)) assert minimal_polynomial(sqrt(2)).dummy_eq(x**2 - 2) assert minimal_polynomial(sqrt(2), x) == x**2 - 2 assert minimal_polynomial(sqrt(2), polys=True) == Poly(x**2 - 2) assert minimal_polynomial(sqrt(2), x, polys=True) == Poly(x**2 - 2, domain='QQ') assert minimal_polynomial(sqrt(2), x, polys=True, compose=False) == Poly(x**2 - 2, domain='QQ') a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) assert minimal_polynomial(a, x) == x**2 - 2 assert minimal_polynomial(b, x) == x**2 - 3 assert minimal_polynomial(a, x, polys=True) == Poly(x**2 - 2, domain='QQ') assert minimal_polynomial(b, x, polys=True) == Poly(x**2 - 3, domain='QQ') assert minimal_polynomial(sqrt(a/2 + 17), x) == 2*x**4 - 68*x**2 + 577 assert minimal_polynomial(sqrt(b/2 + 17), x) == 4*x**4 - 136*x**2 + 1153 a, b = sqrt(2)/3 + 7, AlgebraicNumber(sqrt(2)/3 + 7) f = 81*x**8 - 2268*x**6 - 4536*x**5 + 22644*x**4 + 63216*x**3 - \ 31608*x**2 - 189648*x + 141358 assert minimal_polynomial(sqrt(a) + sqrt(sqrt(a)), x) == f assert minimal_polynomial(sqrt(b) + sqrt(sqrt(b)), x) == f assert minimal_polynomial( a**Q(3, 2), x) == 729*x**4 - 506898*x**2 + 84604519 # issue 5994 eq = S(''' -1/(800*sqrt(-1/240 + 1/(18000*(-1/17280000 + sqrt(15)*I/28800000)**(1/3)) + 2*(-1/17280000 + sqrt(15)*I/28800000)**(1/3)))''') assert minimal_polynomial(eq, x) == 8000*x**2 - 1 ex = 1 + sqrt(2) + sqrt(3) mp = minimal_polynomial(ex, x) assert mp == x**4 - 4*x**3 - 4*x**2 + 16*x - 8 ex = 1/(1 + sqrt(2) + sqrt(3)) mp = minimal_polynomial(ex, x) assert mp == 8*x**4 - 16*x**3 + 4*x**2 + 4*x - 1 p = (expand((1 + sqrt(2) - 2*sqrt(3) + sqrt(7))**3))**Rational(1, 3) mp = minimal_polynomial(p, x) assert mp == x**8 - 8*x**7 - 56*x**6 + 448*x**5 + 480*x**4 - 5056*x**3 + 1984*x**2 + 7424*x - 3008 p = expand((1 + sqrt(2) - 2*sqrt(3) + sqrt(7))**3) mp = minimal_polynomial(p, x) assert mp == x**8 - 512*x**7 - 118208*x**6 + 31131136*x**5 + 647362560*x**4 - 56026611712*x**3 + 116994310144*x**2 + 404854931456*x - 27216576512 assert minimal_polynomial(S("-sqrt(5)/2 - 1/2 + (-sqrt(5)/2 - 1/2)**2"), x) == x - 1 a = 1 + sqrt(2) assert minimal_polynomial((a*sqrt(2) + a)**3, x) == x**2 - 198*x + 1 p = 1/(1 + sqrt(2) + sqrt(3)) assert minimal_polynomial(p, x, compose=False) == 8*x**4 - 16*x**3 + 4*x**2 + 4*x - 1 p = 2/(1 + sqrt(2) + sqrt(3)) assert minimal_polynomial(p, x, compose=False) == x**4 - 4*x**3 + 2*x**2 + 4*x - 2 assert minimal_polynomial(1 + sqrt(2)*I, x, compose=False) == x**2 - 2*x + 3 assert minimal_polynomial(1/(1 + sqrt(2)) + 1, x, compose=False) == x**2 - 2 assert minimal_polynomial(sqrt(2)*I + I*(1 + sqrt(2)), x, compose=False) == x**4 + 18*x**2 + 49 # minimal polynomial of I assert minimal_polynomial(I, x, domain=QQ.algebraic_field(I)) == x - I K = QQ.algebraic_field(I*(sqrt(2) + 1)) assert minimal_polynomial(I, x, domain=K) == x - I assert minimal_polynomial(I, x, domain=QQ) == x**2 + 1 assert minimal_polynomial(I, x, domain='QQ(y)') == x**2 + 1 #issue 11553 assert minimal_polynomial(GoldenRatio, x) == x**2 - x - 1 assert minimal_polynomial(TribonacciConstant + 3, x) == x**3 - 10*x**2 + 32*x - 34 assert minimal_polynomial(GoldenRatio, x, domain=QQ.algebraic_field(sqrt(5))) == \ 2*x - sqrt(5) - 1 assert minimal_polynomial(TribonacciConstant, x, domain=QQ.algebraic_field(cbrt(19 - 3*sqrt(33)))) == \ 48*x - 19*(19 - 3*sqrt(33))**Rational(2, 3) - 3*sqrt(33)*(19 - 3*sqrt(33))**Rational(2, 3) \ - 16*(19 - 3*sqrt(33))**Rational(1, 3) - 16 def test_minimal_polynomial_hi_prec(): p = 1/sqrt(1 - 9*sqrt(2) + 7*sqrt(3) + Rational(1, 10)**30) mp = minimal_polynomial(p, x) # checked with Wolfram Alpha assert mp.coeff(x**6) == -1232000000000000000000000000001223999999999999999999999999999987999999999999999999999999999996000000000000000000000000000000 def test_minimal_polynomial_sq(): from sympy import Add, expand_multinomial p = expand_multinomial((1 + 5*sqrt(2) + 2*sqrt(3))**3) mp = minimal_polynomial(p**Rational(1, 3), x) assert mp == x**4 - 4*x**3 - 118*x**2 + 244*x + 1321 p = expand_multinomial((1 + sqrt(2) - 2*sqrt(3) + sqrt(7))**3) mp = minimal_polynomial(p**Rational(1, 3), x) assert mp == x**8 - 8*x**7 - 56*x**6 + 448*x**5 + 480*x**4 - 5056*x**3 + 1984*x**2 + 7424*x - 3008 p = Add(*[sqrt(i) for i in range(1, 12)]) mp = minimal_polynomial(p, x) assert mp.subs({x: 0}) == -71965773323122507776 def test_minpoly_compose(): # issue 6868 eq = S(''' -1/(800*sqrt(-1/240 + 1/(18000*(-1/17280000 + sqrt(15)*I/28800000)**(1/3)) + 2*(-1/17280000 + sqrt(15)*I/28800000)**(1/3)))''') mp = minimal_polynomial(eq + 3, x) assert mp == 8000*x**2 - 48000*x + 71999 # issue 5888 assert minimal_polynomial(exp(I*pi/8), x) == x**8 + 1 mp = minimal_polynomial(sin(pi/7) + sqrt(2), x) assert mp == 4096*x**12 - 63488*x**10 + 351488*x**8 - 826496*x**6 + \ 770912*x**4 - 268432*x**2 + 28561 mp = minimal_polynomial(cos(pi/7) + sqrt(2), x) assert mp == 64*x**6 - 64*x**5 - 432*x**4 + 304*x**3 + 712*x**2 - \ 232*x - 239 mp = minimal_polynomial(exp(I*pi/7) + sqrt(2), x) assert mp == x**12 - 2*x**11 - 9*x**10 + 16*x**9 + 43*x**8 - 70*x**7 - 97*x**6 + 126*x**5 + 211*x**4 - 212*x**3 - 37*x**2 + 142*x + 127 mp = minimal_polynomial(sin(pi/7) + sqrt(2), x) assert mp == 4096*x**12 - 63488*x**10 + 351488*x**8 - 826496*x**6 + \ 770912*x**4 - 268432*x**2 + 28561 mp = minimal_polynomial(cos(pi/7) + sqrt(2), x) assert mp == 64*x**6 - 64*x**5 - 432*x**4 + 304*x**3 + 712*x**2 - \ 232*x - 239 mp = minimal_polynomial(exp(I*pi/7) + sqrt(2), x) assert mp == x**12 - 2*x**11 - 9*x**10 + 16*x**9 + 43*x**8 - 70*x**7 - 97*x**6 + 126*x**5 + 211*x**4 - 212*x**3 - 37*x**2 + 142*x + 127 mp = minimal_polynomial(exp(I*pi*Rational(2, 7)), x) assert mp == x**6 + x**5 + x**4 + x**3 + x**2 + x + 1 mp = minimal_polynomial(exp(I*pi*Rational(2, 15)), x) assert mp == x**8 - x**7 + x**5 - x**4 + x**3 - x + 1 mp = minimal_polynomial(cos(pi*Rational(2, 7)), x) assert mp == 8*x**3 + 4*x**2 - 4*x - 1 mp = minimal_polynomial(sin(pi*Rational(2, 7)), x) ex = (5*cos(pi*Rational(2, 7)) - 7)/(9*cos(pi/7) - 5*cos(pi*Rational(3, 7))) mp = minimal_polynomial(ex, x) assert mp == x**3 + 2*x**2 - x - 1 assert minimal_polynomial(-1/(2*cos(pi/7)), x) == x**3 + 2*x**2 - x - 1 assert minimal_polynomial(sin(pi*Rational(2, 15)), x) == \ 256*x**8 - 448*x**6 + 224*x**4 - 32*x**2 + 1 assert minimal_polynomial(sin(pi*Rational(5, 14)), x) == 8*x**3 - 4*x**2 - 4*x + 1 assert minimal_polynomial(cos(pi/15), x) == 16*x**4 + 8*x**3 - 16*x**2 - 8*x + 1 ex = rootof(x**3 +x*4 + 1, 0) mp = minimal_polynomial(ex, x) assert mp == x**3 + 4*x + 1 mp = minimal_polynomial(ex + 1, x) assert mp == x**3 - 3*x**2 + 7*x - 4 assert minimal_polynomial(exp(I*pi/3), x) == x**2 - x + 1 assert minimal_polynomial(exp(I*pi/4), x) == x**4 + 1 assert minimal_polynomial(exp(I*pi/6), x) == x**4 - x**2 + 1 assert minimal_polynomial(exp(I*pi/9), x) == x**6 - x**3 + 1 assert minimal_polynomial(exp(I*pi/10), x) == x**8 - x**6 + x**4 - x**2 + 1 assert minimal_polynomial(sin(pi/9), x) == 64*x**6 - 96*x**4 + 36*x**2 - 3 assert minimal_polynomial(sin(pi/11), x) == 1024*x**10 - 2816*x**8 + \ 2816*x**6 - 1232*x**4 + 220*x**2 - 11 ex = 2**Rational(1, 3)*exp(Rational(2, 3)*I*pi) assert minimal_polynomial(ex, x) == x**3 - 2 raises(NotAlgebraic, lambda: minimal_polynomial(cos(pi*sqrt(2)), x)) raises(NotAlgebraic, lambda: minimal_polynomial(sin(pi*sqrt(2)), x)) raises(NotAlgebraic, lambda: minimal_polynomial(exp(I*pi*sqrt(2)), x)) # issue 5934 ex = 1/(-36000 - 7200*sqrt(5) + (12*sqrt(10)*sqrt(sqrt(5) + 5) + 24*sqrt(10)*sqrt(-sqrt(5) + 5))**2) + 1 raises(ZeroDivisionError, lambda: minimal_polynomial(ex, x)) ex = sqrt(1 + 2**Rational(1,3)) + sqrt(1 + 2**Rational(1,4)) + sqrt(2) mp = minimal_polynomial(ex, x) assert degree(mp) == 48 and mp.subs({x:0}) == -16630256576 def test_minpoly_issue_7113(): # see discussion in https://github.com/sympy/sympy/pull/2234 from sympy.simplify.simplify import nsimplify r = nsimplify(pi, tolerance=0.000000001) mp = minimal_polynomial(r, x) assert mp == 1768292677839237920489538677417507171630859375*x**109 - \ 2734577732179183863586489182929671773182898498218854181690460140337930774573792597743853652058046464 def test_minpoly_issue_7574(): ex = -(-1)**Rational(1, 3) + (-1)**Rational(2,3) assert minimal_polynomial(ex, x) == x + 1 def test_primitive_element(): assert primitive_element([sqrt(2)], x) == (x**2 - 2, [1]) assert primitive_element( [sqrt(2), sqrt(3)], x) == (x**4 - 10*x**2 + 1, [1, 1]) assert primitive_element([sqrt(2)], x, polys=True) == (Poly(x**2 - 2, domain='QQ'), [1]) assert primitive_element([sqrt( 2), sqrt(3)], x, polys=True) == (Poly(x**4 - 10*x**2 + 1, domain='QQ'), [1, 1]) assert primitive_element( [sqrt(2)], x, ex=True) == (x**2 - 2, [1], [[1, 0]]) assert primitive_element([sqrt(2), sqrt(3)], x, ex=True) == \ (x**4 - 10*x**2 + 1, [1, 1], [[Q(1, 2), 0, -Q(9, 2), 0], [- Q(1, 2), 0, Q(11, 2), 0]]) assert primitive_element( [sqrt(2)], x, ex=True, polys=True) == (Poly(x**2 - 2, domain='QQ'), [1], [[1, 0]]) assert primitive_element([sqrt(2), sqrt(3)], x, ex=True, polys=True) == \ (Poly(x**4 - 10*x**2 + 1, domain='QQ'), [1, 1], [[Q(1, 2), 0, -Q(9, 2), 0], [-Q(1, 2), 0, Q(11, 2), 0]]) assert primitive_element([sqrt(2)], polys=True) == (Poly(x**2 - 2), [1]) raises(ValueError, lambda: primitive_element([], x, ex=False)) raises(ValueError, lambda: primitive_element([], x, ex=True)) # Issue 14117 a, b = I*sqrt(2*sqrt(2) + 3), I*sqrt(-2*sqrt(2) + 3) assert primitive_element([a, b, I], x) == (x**4 + 6*x**2 + 1, [1, 0, 0]) def test_field_isomorphism_pslq(): a = AlgebraicNumber(I) b = AlgebraicNumber(I*sqrt(3)) raises(NotImplementedError, lambda: field_isomorphism_pslq(a, b)) a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) c = AlgebraicNumber(sqrt(7)) d = AlgebraicNumber(sqrt(2) + sqrt(3)) e = AlgebraicNumber(sqrt(2) + sqrt(3) + sqrt(7)) assert field_isomorphism_pslq(a, a) == [1, 0] assert field_isomorphism_pslq(a, b) is None assert field_isomorphism_pslq(a, c) is None assert field_isomorphism_pslq(a, d) == [Q(1, 2), 0, -Q(9, 2), 0] assert field_isomorphism_pslq( a, e) == [Q(1, 80), 0, -Q(1, 2), 0, Q(59, 20), 0] assert field_isomorphism_pslq(b, a) is None assert field_isomorphism_pslq(b, b) == [1, 0] assert field_isomorphism_pslq(b, c) is None assert field_isomorphism_pslq(b, d) == [-Q(1, 2), 0, Q(11, 2), 0] assert field_isomorphism_pslq(b, e) == [-Q( 3, 640), 0, Q(67, 320), 0, -Q(297, 160), 0, Q(313, 80), 0] assert field_isomorphism_pslq(c, a) is None assert field_isomorphism_pslq(c, b) is None assert field_isomorphism_pslq(c, c) == [1, 0] assert field_isomorphism_pslq(c, d) is None assert field_isomorphism_pslq(c, e) == [Q( 3, 640), 0, -Q(71, 320), 0, Q(377, 160), 0, -Q(469, 80), 0] assert field_isomorphism_pslq(d, a) is None assert field_isomorphism_pslq(d, b) is None assert field_isomorphism_pslq(d, c) is None assert field_isomorphism_pslq(d, d) == [1, 0] assert field_isomorphism_pslq(d, e) == [-Q( 3, 640), 0, Q(71, 320), 0, -Q(377, 160), 0, Q(549, 80), 0] assert field_isomorphism_pslq(e, a) is None assert field_isomorphism_pslq(e, b) is None assert field_isomorphism_pslq(e, c) is None assert field_isomorphism_pslq(e, d) is None assert field_isomorphism_pslq(e, e) == [1, 0] f = AlgebraicNumber(3*sqrt(2) + 8*sqrt(7) - 5) assert field_isomorphism_pslq( f, e) == [Q(3, 80), 0, -Q(139, 80), 0, Q(347, 20), 0, -Q(761, 20), -5] def test_field_isomorphism(): assert field_isomorphism(3, sqrt(2)) == [3] assert field_isomorphism( I*sqrt(3), I*sqrt(3)/2) == [ 2, 0] assert field_isomorphism(-I*sqrt(3), I*sqrt(3)/2) == [-2, 0] assert field_isomorphism( I*sqrt(3), -I*sqrt(3)/2) == [-2, 0] assert field_isomorphism(-I*sqrt(3), -I*sqrt(3)/2) == [ 2, 0] assert field_isomorphism( 2*I*sqrt(3)/7, 5*I*sqrt(3)/3) == [ Rational(6, 35), 0] assert field_isomorphism(-2*I*sqrt(3)/7, 5*I*sqrt(3)/3) == [Rational(-6, 35), 0] assert field_isomorphism( 2*I*sqrt(3)/7, -5*I*sqrt(3)/3) == [Rational(-6, 35), 0] assert field_isomorphism(-2*I*sqrt(3)/7, -5*I*sqrt(3)/3) == [ Rational(6, 35), 0] assert field_isomorphism( 2*I*sqrt(3)/7 + 27, 5*I*sqrt(3)/3) == [ Rational(6, 35), 27] assert field_isomorphism( -2*I*sqrt(3)/7 + 27, 5*I*sqrt(3)/3) == [Rational(-6, 35), 27] assert field_isomorphism( 2*I*sqrt(3)/7 + 27, -5*I*sqrt(3)/3) == [Rational(-6, 35), 27] assert field_isomorphism( -2*I*sqrt(3)/7 + 27, -5*I*sqrt(3)/3) == [ Rational(6, 35), 27] p = AlgebraicNumber( sqrt(2) + sqrt(3)) q = AlgebraicNumber(-sqrt(2) + sqrt(3)) r = AlgebraicNumber( sqrt(2) - sqrt(3)) s = AlgebraicNumber(-sqrt(2) - sqrt(3)) pos_coeffs = [ S.Half, S.Zero, Rational(-9, 2), S.Zero] neg_coeffs = [Rational(-1, 2), S.Zero, Rational(9, 2), S.Zero] a = AlgebraicNumber(sqrt(2)) assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == pos_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == neg_coeffs assert field_isomorphism(a, p, fast=False) == pos_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == neg_coeffs a = AlgebraicNumber(-sqrt(2)) assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == pos_coeffs assert field_isomorphism(a, r, fast=True) == neg_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == pos_coeffs assert field_isomorphism(a, r, fast=False) == neg_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs pos_coeffs = [ S.Half, S.Zero, Rational(-11, 2), S.Zero] neg_coeffs = [Rational(-1, 2), S.Zero, Rational(11, 2), S.Zero] a = AlgebraicNumber(sqrt(3)) assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs a = AlgebraicNumber(-sqrt(3)) assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == pos_coeffs assert field_isomorphism(a, q, fast=True) == pos_coeffs assert field_isomorphism(a, r, fast=True) == neg_coeffs assert field_isomorphism(a, s, fast=True) == neg_coeffs assert field_isomorphism(a, p, fast=False) == pos_coeffs assert field_isomorphism(a, q, fast=False) == pos_coeffs assert field_isomorphism(a, r, fast=False) == neg_coeffs assert field_isomorphism(a, s, fast=False) == neg_coeffs pos_coeffs = [ Rational(3, 2), S.Zero, Rational(-33, 2), -S(8)] neg_coeffs = [Rational(-3, 2), S.Zero, Rational(33, 2), -S(8)] a = AlgebraicNumber(3*sqrt(3) - 8) assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == neg_coeffs assert field_isomorphism(a, q, fast=True) == neg_coeffs assert field_isomorphism(a, r, fast=True) == pos_coeffs assert field_isomorphism(a, s, fast=True) == pos_coeffs assert field_isomorphism(a, p, fast=False) == neg_coeffs assert field_isomorphism(a, q, fast=False) == neg_coeffs assert field_isomorphism(a, r, fast=False) == pos_coeffs assert field_isomorphism(a, s, fast=False) == pos_coeffs a = AlgebraicNumber(3*sqrt(2) + 2*sqrt(3) + 1) pos_1_coeffs = [ S.Half, S.Zero, Rational(-5, 2), S.One] neg_5_coeffs = [Rational(-5, 2), S.Zero, Rational(49, 2), S.One] pos_5_coeffs = [ Rational(5, 2), S.Zero, Rational(-49, 2), S.One] neg_1_coeffs = [Rational(-1, 2), S.Zero, Rational(5, 2), S.One] assert is_isomorphism_possible(a, p) is True assert is_isomorphism_possible(a, q) is True assert is_isomorphism_possible(a, r) is True assert is_isomorphism_possible(a, s) is True assert field_isomorphism(a, p, fast=True) == pos_1_coeffs assert field_isomorphism(a, q, fast=True) == neg_5_coeffs assert field_isomorphism(a, r, fast=True) == pos_5_coeffs assert field_isomorphism(a, s, fast=True) == neg_1_coeffs assert field_isomorphism(a, p, fast=False) == pos_1_coeffs assert field_isomorphism(a, q, fast=False) == neg_5_coeffs assert field_isomorphism(a, r, fast=False) == pos_5_coeffs assert field_isomorphism(a, s, fast=False) == neg_1_coeffs a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(3)) c = AlgebraicNumber(sqrt(7)) assert is_isomorphism_possible(a, b) is True assert is_isomorphism_possible(b, a) is True assert is_isomorphism_possible(c, p) is False assert field_isomorphism(sqrt(2), sqrt(3), fast=True) is None assert field_isomorphism(sqrt(3), sqrt(2), fast=True) is None assert field_isomorphism(sqrt(2), sqrt(3), fast=False) is None assert field_isomorphism(sqrt(3), sqrt(2), fast=False) is None def test_to_number_field(): assert to_number_field(sqrt(2)) == AlgebraicNumber(sqrt(2)) assert to_number_field( [sqrt(2), sqrt(3)]) == AlgebraicNumber(sqrt(2) + sqrt(3)) a = AlgebraicNumber(sqrt(2) + sqrt(3), [S.Half, S.Zero, Rational(-9, 2), S.Zero]) assert to_number_field(sqrt(2), sqrt(2) + sqrt(3)) == a assert to_number_field(sqrt(2), AlgebraicNumber(sqrt(2) + sqrt(3))) == a raises(IsomorphismFailed, lambda: to_number_field(sqrt(2), sqrt(3))) def test_AlgebraicNumber(): minpoly, root = x**2 - 2, sqrt(2) a = AlgebraicNumber(root, gen=x) assert a.rep == DMP([QQ(1), QQ(0)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is False assert a.coeffs() == [S.One, S.Zero] assert a.native_coeffs() == [QQ(1), QQ(0)] a = AlgebraicNumber(root, gen=x, alias='y') assert a.rep == DMP([QQ(1), QQ(0)], QQ) assert a.root == root assert a.alias == Symbol('y') assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is True a = AlgebraicNumber(root, gen=x, alias=Symbol('y')) assert a.rep == DMP([QQ(1), QQ(0)], QQ) assert a.root == root assert a.alias == Symbol('y') assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is True assert AlgebraicNumber(sqrt(2), []).rep == DMP([], QQ) assert AlgebraicNumber(sqrt(2), ()).rep == DMP([], QQ) assert AlgebraicNumber(sqrt(2), (0, 0)).rep == DMP([], QQ) assert AlgebraicNumber(sqrt(2), [8]).rep == DMP([QQ(8)], QQ) assert AlgebraicNumber(sqrt(2), [Rational(8, 3)]).rep == DMP([QQ(8, 3)], QQ) assert AlgebraicNumber(sqrt(2), [7, 3]).rep == DMP([QQ(7), QQ(3)], QQ) assert AlgebraicNumber( sqrt(2), [Rational(7, 9), Rational(3, 2)]).rep == DMP([QQ(7, 9), QQ(3, 2)], QQ) assert AlgebraicNumber(sqrt(2), [1, 2, 3]).rep == DMP([QQ(2), QQ(5)], QQ) a = AlgebraicNumber(AlgebraicNumber(root, gen=x), [1, 2]) assert a.rep == DMP([QQ(1), QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is False assert a.coeffs() == [S.One, S(2)] assert a.native_coeffs() == [QQ(1), QQ(2)] a = AlgebraicNumber((minpoly, root), [1, 2]) assert a.rep == DMP([QQ(1), QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is False a = AlgebraicNumber((Poly(minpoly), root), [1, 2]) assert a.rep == DMP([QQ(1), QQ(2)], QQ) assert a.root == root assert a.alias is None assert a.minpoly == minpoly assert a.is_number assert a.is_aliased is False assert AlgebraicNumber( sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ) assert AlgebraicNumber(-sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ) a = AlgebraicNumber(sqrt(2)) b = AlgebraicNumber(sqrt(2)) assert a == b c = AlgebraicNumber(sqrt(2), gen=x) assert a == b assert a == c a = AlgebraicNumber(sqrt(2), [1, 2]) b = AlgebraicNumber(sqrt(2), [1, 3]) assert a != b and a != sqrt(2) + 3 assert (a == x) is False and (a != x) is True a = AlgebraicNumber(sqrt(2), [1, 0]) b = AlgebraicNumber(sqrt(2), [1, 0], alias=y) assert a.as_poly(x) == Poly(x, domain='QQ') assert b.as_poly() == Poly(y, domain='QQ') assert a.as_expr() == sqrt(2) assert a.as_expr(x) == x assert b.as_expr() == sqrt(2) assert b.as_expr(x) == x a = AlgebraicNumber(sqrt(2), [2, 3]) b = AlgebraicNumber(sqrt(2), [2, 3], alias=y) p = a.as_poly() assert p == Poly(2*p.gen + 3) assert a.as_poly(x) == Poly(2*x + 3, domain='QQ') assert b.as_poly() == Poly(2*y + 3, domain='QQ') assert a.as_expr() == 2*sqrt(2) + 3 assert a.as_expr(x) == 2*x + 3 assert b.as_expr() == 2*sqrt(2) + 3 assert b.as_expr(x) == 2*x + 3 a = AlgebraicNumber(sqrt(2)) b = to_number_field(sqrt(2)) assert a.args == b.args == (sqrt(2), Tuple(1, 0)) b = AlgebraicNumber(sqrt(2), alias='alpha') assert b.args == (sqrt(2), Tuple(1, 0), Symbol('alpha')) a = AlgebraicNumber(sqrt(2), [1, 2, 3]) assert a.args == (sqrt(2), Tuple(1, 2, 3)) def test_to_algebraic_integer(): a = AlgebraicNumber(sqrt(3), gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 3 assert a.root == sqrt(3) assert a.rep == DMP([QQ(1), QQ(0)], QQ) a = AlgebraicNumber(2*sqrt(3), gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(1), QQ(0)], QQ) a = AlgebraicNumber(sqrt(3)/2, gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(1), QQ(0)], QQ) a = AlgebraicNumber(sqrt(3)/2, [Rational(7, 19), 3], gen=x).to_algebraic_integer() assert a.minpoly == x**2 - 12 assert a.root == 2*sqrt(3) assert a.rep == DMP([QQ(7, 19), QQ(3)], QQ) def test_IntervalPrinter(): ip = IntervalPrinter() assert ip.doprint(x**Q(1, 3)) == "x**(mpi('1/3'))" assert ip.doprint(sqrt(x)) == "x**(mpi('1/2'))" def test_isolate(): assert isolate(1) == (1, 1) assert isolate(S.Half) == (S.Half, S.Half) assert isolate(sqrt(2)) == (1, 2) assert isolate(-sqrt(2)) == (-2, -1) assert isolate(sqrt(2), eps=Rational(1, 100)) == (Rational(24, 17), Rational(17, 12)) assert isolate(-sqrt(2), eps=Rational(1, 100)) == (Rational(-17, 12), Rational(-24, 17)) raises(NotImplementedError, lambda: isolate(I)) def test_minpoly_fraction_field(): assert minimal_polynomial(1/x, y) == -x*y + 1 assert minimal_polynomial(1 / (x + 1), y) == (x + 1)*y - 1 assert minimal_polynomial(sqrt(x), y) == y**2 - x assert minimal_polynomial(sqrt(x + 1), y) == y**2 - x - 1 assert minimal_polynomial(sqrt(x) / x, y) == x*y**2 - 1 assert minimal_polynomial(sqrt(2) * sqrt(x), y) == y**2 - 2 * x assert minimal_polynomial(sqrt(2) + sqrt(x), y) == \ y**4 + (-2*x - 4)*y**2 + x**2 - 4*x + 4 assert minimal_polynomial(x**Rational(1,3), y) == y**3 - x assert minimal_polynomial(x**Rational(1,3) + sqrt(x), y) == \ y**6 - 3*x*y**4 - 2*x*y**3 + 3*x**2*y**2 - 6*x**2*y - x**3 + x**2 assert minimal_polynomial(sqrt(x) / z, y) == z**2*y**2 - x assert minimal_polynomial(sqrt(x) / (z + 1), y) == (z**2 + 2*z + 1)*y**2 - x assert minimal_polynomial(1/x, y, polys=True) == Poly(-x*y + 1, y, domain='ZZ(x)') assert minimal_polynomial(1 / (x + 1), y, polys=True) == \ Poly((x + 1)*y - 1, y, domain='ZZ(x)') assert minimal_polynomial(sqrt(x), y, polys=True) == Poly(y**2 - x, y, domain='ZZ(x)') assert minimal_polynomial(sqrt(x) / z, y, polys=True) == \ Poly(z**2*y**2 - x, y, domain='ZZ(x, z)') # this is (sqrt(1 + x**3)/x).integrate(x).diff(x) - sqrt(1 + x**3)/x a = sqrt(x)/sqrt(1 + x**(-3)) - sqrt(x**3 + 1)/x + 1/(x**Rational(5, 2)* \ (1 + x**(-3))**Rational(3, 2)) + 1/(x**Rational(11, 2)*(1 + x**(-3))**Rational(3, 2)) assert minimal_polynomial(a, y) == y raises(NotAlgebraic, lambda: minimal_polynomial(exp(x), y)) raises(GeneratorsError, lambda: minimal_polynomial(sqrt(x), x)) raises(GeneratorsError, lambda: minimal_polynomial(sqrt(x) - y, x)) raises(NotImplementedError, lambda: minimal_polynomial(sqrt(x), y, compose=False)) @slow def test_minpoly_fraction_field_slow(): assert minimal_polynomial(minimal_polynomial(sqrt(x**Rational(1,5) - 1), y).subs(y, sqrt(x**Rational(1,5) - 1)), z) == z def test_minpoly_domain(): assert minimal_polynomial(sqrt(2), x, domain=QQ.algebraic_field(sqrt(2))) == \ x - sqrt(2) assert minimal_polynomial(sqrt(8), x, domain=QQ.algebraic_field(sqrt(2))) == \ x - 2*sqrt(2) assert minimal_polynomial(sqrt(Rational(3,2)), x, domain=QQ.algebraic_field(sqrt(2))) == 2*x**2 - 3 raises(NotAlgebraic, lambda: minimal_polynomial(y, x, domain=QQ)) def test_issue_14831(): a = -2*sqrt(2)*sqrt(12*sqrt(2) + 17) assert minimal_polynomial(a, x) == x**2 + 16*x - 8 e = (-3*sqrt(12*sqrt(2) + 17) + 12*sqrt(2) + 17 - 2*sqrt(2)*sqrt(12*sqrt(2) + 17)) assert minimal_polynomial(e, x) == x def test_issue_18248(): assert nonlinsolve([x*y**3-sqrt(2)/3, x*y**6-4/(9*(sqrt(3)))],x,y) == \ FiniteSet((sqrt(3)/2, sqrt(6)/3), (sqrt(3)/2, -sqrt(6)/6 - sqrt(2)*I/2), (sqrt(3)/2, -sqrt(6)/6 + sqrt(2)*I/2)) def test_issue_13230(): c1 = Circle(Point2D(3, sqrt(5)), 5) c2 = Circle(Point2D(4, sqrt(7)), 6) assert intersection(c1, c2) == [Point2D(-1 + (-sqrt(7) + sqrt(5))*(-2*sqrt(7)/29 + 9*sqrt(5)/29 + sqrt(196*sqrt(35) + 1941)/29), -2*sqrt(7)/29 + 9*sqrt(5)/29 + sqrt(196*sqrt(35) + 1941)/29), Point2D(-1 + (-sqrt(7) + sqrt(5))*(-sqrt(196*sqrt(35) + 1941)/29 - 2*sqrt(7)/29 + 9*sqrt(5)/29), -sqrt(196*sqrt(35) + 1941)/29 - 2*sqrt(7)/29 + 9*sqrt(5)/29)]
10e3468200543566954b08bcd7b0b32c16098244de845abcfa6f9076a7acf7ce
"""Tests for functions that inject symbols into the global namespace. """ from sympy.polys.rings import vring from sympy.polys.fields import vfield from sympy.polys.domains import QQ def test_vring(): ns = {'vring':vring, 'QQ':QQ} exec('R = vring("r", QQ)', ns) exec('assert r == R.gens[0]', ns) exec('R = vring("rb rbb rcc rzz _rx", QQ)', ns) exec('assert rb == R.gens[0]', ns) exec('assert rbb == R.gens[1]', ns) exec('assert rcc == R.gens[2]', ns) exec('assert rzz == R.gens[3]', ns) exec('assert _rx == R.gens[4]', ns) exec('R = vring(["rd", "re", "rfg"], QQ)', ns) exec('assert rd == R.gens[0]', ns) exec('assert re == R.gens[1]', ns) exec('assert rfg == R.gens[2]', ns) def test_vfield(): ns = {'vfield':vfield, 'QQ':QQ} exec('F = vfield("f", QQ)', ns) exec('assert f == F.gens[0]', ns) exec('F = vfield("fb fbb fcc fzz _fx", QQ)', ns) exec('assert fb == F.gens[0]', ns) exec('assert fbb == F.gens[1]', ns) exec('assert fcc == F.gens[2]', ns) exec('assert fzz == F.gens[3]', ns) exec('assert _fx == F.gens[4]', ns) exec('F = vfield(["fd", "fe", "ffg"], QQ)', ns) exec('assert fd == F.gens[0]', ns) exec('assert fe == F.gens[1]', ns) exec('assert ffg == F.gens[2]', ns)
eb080ddf8fb7a2eae6d38e24cbb37d422af453322087444031ba159b383102a0
"""Tests for dense recursive polynomials' arithmetics. """ from sympy.polys.densebasic import ( dup_normal, dmp_normal, ) from sympy.polys.densearith import ( dup_add_term, dmp_add_term, dup_sub_term, dmp_sub_term, dup_mul_term, dmp_mul_term, dup_add_ground, dmp_add_ground, dup_sub_ground, dmp_sub_ground, dup_mul_ground, dmp_mul_ground, dup_quo_ground, dmp_quo_ground, dup_exquo_ground, dmp_exquo_ground, dup_lshift, dup_rshift, dup_abs, dmp_abs, dup_neg, dmp_neg, dup_add, dmp_add, dup_sub, dmp_sub, dup_mul, dmp_mul, dup_sqr, dmp_sqr, dup_pow, dmp_pow, dup_add_mul, dmp_add_mul, dup_sub_mul, dmp_sub_mul, dup_pdiv, dup_prem, dup_pquo, dup_pexquo, dmp_pdiv, dmp_prem, dmp_pquo, dmp_pexquo, dup_rr_div, dmp_rr_div, dup_ff_div, dmp_ff_div, dup_div, dup_rem, dup_quo, dup_exquo, dmp_div, dmp_rem, dmp_quo, dmp_exquo, dup_max_norm, dmp_max_norm, dup_l1_norm, dmp_l1_norm, dup_expand, dmp_expand, ) from sympy.polys.polyerrors import ( ExactQuotientFailed, ) from sympy.polys.specialpolys import f_polys from sympy.polys.domains import FF, ZZ, QQ from sympy.testing.pytest import raises f_0, f_1, f_2, f_3, f_4, f_5, f_6 = [ f.to_dense() for f in f_polys() ] F_0 = dmp_mul_ground(dmp_normal(f_0, 2, QQ), QQ(1, 7), 2, QQ) def test_dup_add_term(): f = dup_normal([], ZZ) assert dup_add_term(f, ZZ(0), 0, ZZ) == dup_normal([], ZZ) assert dup_add_term(f, ZZ(1), 0, ZZ) == dup_normal([1], ZZ) assert dup_add_term(f, ZZ(1), 1, ZZ) == dup_normal([1, 0], ZZ) assert dup_add_term(f, ZZ(1), 2, ZZ) == dup_normal([1, 0, 0], ZZ) f = dup_normal([1, 1, 1], ZZ) assert dup_add_term(f, ZZ(1), 0, ZZ) == dup_normal([1, 1, 2], ZZ) assert dup_add_term(f, ZZ(1), 1, ZZ) == dup_normal([1, 2, 1], ZZ) assert dup_add_term(f, ZZ(1), 2, ZZ) == dup_normal([2, 1, 1], ZZ) assert dup_add_term(f, ZZ(1), 3, ZZ) == dup_normal([1, 1, 1, 1], ZZ) assert dup_add_term(f, ZZ(1), 4, ZZ) == dup_normal([1, 0, 1, 1, 1], ZZ) assert dup_add_term(f, ZZ(1), 5, ZZ) == dup_normal([1, 0, 0, 1, 1, 1], ZZ) assert dup_add_term( f, ZZ(1), 6, ZZ) == dup_normal([1, 0, 0, 0, 1, 1, 1], ZZ) assert dup_add_term(f, ZZ(-1), 2, ZZ) == dup_normal([1, 1], ZZ) def test_dmp_add_term(): assert dmp_add_term([ZZ(1), ZZ(1), ZZ(1)], ZZ(1), 2, 0, ZZ) == \ dup_add_term([ZZ(1), ZZ(1), ZZ(1)], ZZ(1), 2, ZZ) assert dmp_add_term(f_0, [[]], 3, 2, ZZ) == f_0 assert dmp_add_term(F_0, [[]], 3, 2, QQ) == F_0 def test_dup_sub_term(): f = dup_normal([], ZZ) assert dup_sub_term(f, ZZ(0), 0, ZZ) == dup_normal([], ZZ) assert dup_sub_term(f, ZZ(1), 0, ZZ) == dup_normal([-1], ZZ) assert dup_sub_term(f, ZZ(1), 1, ZZ) == dup_normal([-1, 0], ZZ) assert dup_sub_term(f, ZZ(1), 2, ZZ) == dup_normal([-1, 0, 0], ZZ) f = dup_normal([1, 1, 1], ZZ) assert dup_sub_term(f, ZZ(2), 0, ZZ) == dup_normal([ 1, 1, -1], ZZ) assert dup_sub_term(f, ZZ(2), 1, ZZ) == dup_normal([ 1, -1, 1], ZZ) assert dup_sub_term(f, ZZ(2), 2, ZZ) == dup_normal([-1, 1, 1], ZZ) assert dup_sub_term(f, ZZ(1), 3, ZZ) == dup_normal([-1, 1, 1, 1], ZZ) assert dup_sub_term(f, ZZ(1), 4, ZZ) == dup_normal([-1, 0, 1, 1, 1], ZZ) assert dup_sub_term(f, ZZ(1), 5, ZZ) == dup_normal([-1, 0, 0, 1, 1, 1], ZZ) assert dup_sub_term( f, ZZ(1), 6, ZZ) == dup_normal([-1, 0, 0, 0, 1, 1, 1], ZZ) assert dup_sub_term(f, ZZ(1), 2, ZZ) == dup_normal([1, 1], ZZ) def test_dmp_sub_term(): assert dmp_sub_term([ZZ(1), ZZ(1), ZZ(1)], ZZ(1), 2, 0, ZZ) == \ dup_sub_term([ZZ(1), ZZ(1), ZZ(1)], ZZ(1), 2, ZZ) assert dmp_sub_term(f_0, [[]], 3, 2, ZZ) == f_0 assert dmp_sub_term(F_0, [[]], 3, 2, QQ) == F_0 def test_dup_mul_term(): f = dup_normal([], ZZ) assert dup_mul_term(f, ZZ(2), 3, ZZ) == dup_normal([], ZZ) f = dup_normal([1, 1], ZZ) assert dup_mul_term(f, ZZ(0), 3, ZZ) == dup_normal([], ZZ) f = dup_normal([1, 2, 3], ZZ) assert dup_mul_term(f, ZZ(2), 0, ZZ) == dup_normal([2, 4, 6], ZZ) assert dup_mul_term(f, ZZ(2), 1, ZZ) == dup_normal([2, 4, 6, 0], ZZ) assert dup_mul_term(f, ZZ(2), 2, ZZ) == dup_normal([2, 4, 6, 0, 0], ZZ) assert dup_mul_term(f, ZZ(2), 3, ZZ) == dup_normal([2, 4, 6, 0, 0, 0], ZZ) def test_dmp_mul_term(): assert dmp_mul_term([ZZ(1), ZZ(2), ZZ(3)], ZZ(2), 1, 0, ZZ) == \ dup_mul_term([ZZ(1), ZZ(2), ZZ(3)], ZZ(2), 1, ZZ) assert dmp_mul_term([[]], [ZZ(2)], 3, 1, ZZ) == [[]] assert dmp_mul_term([[ZZ(1)]], [], 3, 1, ZZ) == [[]] assert dmp_mul_term([[ZZ(1), ZZ(2)], [ZZ(3)]], [ZZ(2)], 2, 1, ZZ) == \ [[ZZ(2), ZZ(4)], [ZZ(6)], [], []] assert dmp_mul_term([[]], [QQ(2, 3)], 3, 1, QQ) == [[]] assert dmp_mul_term([[QQ(1, 2)]], [], 3, 1, QQ) == [[]] assert dmp_mul_term([[QQ(1, 5), QQ(2, 5)], [QQ(3, 5)]], [QQ(2, 3)], 2, 1, QQ) == \ [[QQ(2, 15), QQ(4, 15)], [QQ(6, 15)], [], []] def test_dup_add_ground(): f = ZZ.map([1, 2, 3, 4]) g = ZZ.map([1, 2, 3, 8]) assert dup_add_ground(f, ZZ(4), ZZ) == g def test_dmp_add_ground(): f = ZZ.map([[1], [2], [3], [4]]) g = ZZ.map([[1], [2], [3], [8]]) assert dmp_add_ground(f, ZZ(4), 1, ZZ) == g def test_dup_sub_ground(): f = ZZ.map([1, 2, 3, 4]) g = ZZ.map([1, 2, 3, 0]) assert dup_sub_ground(f, ZZ(4), ZZ) == g def test_dmp_sub_ground(): f = ZZ.map([[1], [2], [3], [4]]) g = ZZ.map([[1], [2], [3], []]) assert dmp_sub_ground(f, ZZ(4), 1, ZZ) == g def test_dup_mul_ground(): f = dup_normal([], ZZ) assert dup_mul_ground(f, ZZ(2), ZZ) == dup_normal([], ZZ) f = dup_normal([1, 2, 3], ZZ) assert dup_mul_ground(f, ZZ(0), ZZ) == dup_normal([], ZZ) assert dup_mul_ground(f, ZZ(2), ZZ) == dup_normal([2, 4, 6], ZZ) def test_dmp_mul_ground(): assert dmp_mul_ground(f_0, ZZ(2), 2, ZZ) == [ [[ZZ(2), ZZ(4), ZZ(6)], [ZZ(4)]], [[ZZ(6)]], [[ZZ(8), ZZ(10), ZZ(12)], [ZZ(2), ZZ(4), ZZ(2)], [ZZ(2)]] ] assert dmp_mul_ground(F_0, QQ(1, 2), 2, QQ) == [ [[QQ(1, 14), QQ(2, 14), QQ(3, 14)], [QQ(2, 14)]], [[QQ(3, 14)]], [[QQ(4, 14), QQ(5, 14), QQ(6, 14)], [QQ(1, 14), QQ(2, 14), QQ(1, 14)], [QQ(1, 14)]] ] def test_dup_quo_ground(): raises(ZeroDivisionError, lambda: dup_quo_ground(dup_normal([1, 2, 3], ZZ), ZZ(0), ZZ)) f = dup_normal([], ZZ) assert dup_quo_ground(f, ZZ(3), ZZ) == dup_normal([], ZZ) f = dup_normal([6, 2, 8], ZZ) assert dup_quo_ground(f, ZZ(1), ZZ) == f assert dup_quo_ground(f, ZZ(2), ZZ) == dup_normal([3, 1, 4], ZZ) assert dup_quo_ground(f, ZZ(3), ZZ) == dup_normal([2, 0, 2], ZZ) f = dup_normal([6, 2, 8], QQ) assert dup_quo_ground(f, QQ(1), QQ) == f assert dup_quo_ground(f, QQ(2), QQ) == [QQ(3), QQ(1), QQ(4)] assert dup_quo_ground(f, QQ(7), QQ) == [QQ(6, 7), QQ(2, 7), QQ(8, 7)] def test_dup_exquo_ground(): raises(ZeroDivisionError, lambda: dup_exquo_ground(dup_normal([1, 2, 3], ZZ), ZZ(0), ZZ)) raises(ExactQuotientFailed, lambda: dup_exquo_ground(dup_normal([1, 2, 3], ZZ), ZZ(3), ZZ)) f = dup_normal([], ZZ) assert dup_exquo_ground(f, ZZ(3), ZZ) == dup_normal([], ZZ) f = dup_normal([6, 2, 8], ZZ) assert dup_exquo_ground(f, ZZ(1), ZZ) == f assert dup_exquo_ground(f, ZZ(2), ZZ) == dup_normal([3, 1, 4], ZZ) f = dup_normal([6, 2, 8], QQ) assert dup_exquo_ground(f, QQ(1), QQ) == f assert dup_exquo_ground(f, QQ(2), QQ) == [QQ(3), QQ(1), QQ(4)] assert dup_exquo_ground(f, QQ(7), QQ) == [QQ(6, 7), QQ(2, 7), QQ(8, 7)] def test_dmp_quo_ground(): f = dmp_normal([[6], [2], [8]], 1, ZZ) assert dmp_quo_ground(f, ZZ(1), 1, ZZ) == f assert dmp_quo_ground( f, ZZ(2), 1, ZZ) == dmp_normal([[3], [1], [4]], 1, ZZ) assert dmp_normal(dmp_quo_ground( f, ZZ(3), 1, ZZ), 1, ZZ) == dmp_normal([[2], [], [2]], 1, ZZ) def test_dmp_exquo_ground(): f = dmp_normal([[6], [2], [8]], 1, ZZ) assert dmp_exquo_ground(f, ZZ(1), 1, ZZ) == f assert dmp_exquo_ground( f, ZZ(2), 1, ZZ) == dmp_normal([[3], [1], [4]], 1, ZZ) def test_dup_lshift(): assert dup_lshift([], 3, ZZ) == [] assert dup_lshift([1], 3, ZZ) == [1, 0, 0, 0] def test_dup_rshift(): assert dup_rshift([], 3, ZZ) == [] assert dup_rshift([1, 0, 0, 0], 3, ZZ) == [1] def test_dup_abs(): assert dup_abs([], ZZ) == [] assert dup_abs([ZZ( 1)], ZZ) == [ZZ(1)] assert dup_abs([ZZ(-7)], ZZ) == [ZZ(7)] assert dup_abs([ZZ(-1), ZZ(2), ZZ(3)], ZZ) == [ZZ(1), ZZ(2), ZZ(3)] assert dup_abs([], QQ) == [] assert dup_abs([QQ( 1, 2)], QQ) == [QQ(1, 2)] assert dup_abs([QQ(-7, 3)], QQ) == [QQ(7, 3)] assert dup_abs( [QQ(-1, 7), QQ(2, 7), QQ(3, 7)], QQ) == [QQ(1, 7), QQ(2, 7), QQ(3, 7)] def test_dmp_abs(): assert dmp_abs([ZZ(-1)], 0, ZZ) == [ZZ(1)] assert dmp_abs([QQ(-1, 2)], 0, QQ) == [QQ(1, 2)] assert dmp_abs([[[]]], 2, ZZ) == [[[]]] assert dmp_abs([[[ZZ(1)]]], 2, ZZ) == [[[ZZ(1)]]] assert dmp_abs([[[ZZ(-7)]]], 2, ZZ) == [[[ZZ(7)]]] assert dmp_abs([[[]]], 2, QQ) == [[[]]] assert dmp_abs([[[QQ(1, 2)]]], 2, QQ) == [[[QQ(1, 2)]]] assert dmp_abs([[[QQ(-7, 9)]]], 2, QQ) == [[[QQ(7, 9)]]] def test_dup_neg(): assert dup_neg([], ZZ) == [] assert dup_neg([ZZ(1)], ZZ) == [ZZ(-1)] assert dup_neg([ZZ(-7)], ZZ) == [ZZ(7)] assert dup_neg([ZZ(-1), ZZ(2), ZZ(3)], ZZ) == [ZZ(1), ZZ(-2), ZZ(-3)] assert dup_neg([], QQ) == [] assert dup_neg([QQ(1, 2)], QQ) == [QQ(-1, 2)] assert dup_neg([QQ(-7, 9)], QQ) == [QQ(7, 9)] assert dup_neg([QQ( -1, 7), QQ(2, 7), QQ(3, 7)], QQ) == [QQ(1, 7), QQ(-2, 7), QQ(-3, 7)] def test_dmp_neg(): assert dmp_neg([ZZ(-1)], 0, ZZ) == [ZZ(1)] assert dmp_neg([QQ(-1, 2)], 0, QQ) == [QQ(1, 2)] assert dmp_neg([[[]]], 2, ZZ) == [[[]]] assert dmp_neg([[[ZZ(1)]]], 2, ZZ) == [[[ZZ(-1)]]] assert dmp_neg([[[ZZ(-7)]]], 2, ZZ) == [[[ZZ(7)]]] assert dmp_neg([[[]]], 2, QQ) == [[[]]] assert dmp_neg([[[QQ(1, 9)]]], 2, QQ) == [[[QQ(-1, 9)]]] assert dmp_neg([[[QQ(-7, 9)]]], 2, QQ) == [[[QQ(7, 9)]]] def test_dup_add(): assert dup_add([], [], ZZ) == [] assert dup_add([ZZ(1)], [], ZZ) == [ZZ(1)] assert dup_add([], [ZZ(1)], ZZ) == [ZZ(1)] assert dup_add([ZZ(1)], [ZZ(1)], ZZ) == [ZZ(2)] assert dup_add([ZZ(1)], [ZZ(2)], ZZ) == [ZZ(3)] assert dup_add([ZZ(1), ZZ(2)], [ZZ(1)], ZZ) == [ZZ(1), ZZ(3)] assert dup_add([ZZ(1)], [ZZ(1), ZZ(2)], ZZ) == [ZZ(1), ZZ(3)] assert dup_add([ZZ(1), ZZ( 2), ZZ(3)], [ZZ(8), ZZ(9), ZZ(10)], ZZ) == [ZZ(9), ZZ(11), ZZ(13)] assert dup_add([], [], QQ) == [] assert dup_add([QQ(1, 2)], [], QQ) == [QQ(1, 2)] assert dup_add([], [QQ(1, 2)], QQ) == [QQ(1, 2)] assert dup_add([QQ(1, 4)], [QQ(1, 4)], QQ) == [QQ(1, 2)] assert dup_add([QQ(1, 4)], [QQ(1, 2)], QQ) == [QQ(3, 4)] assert dup_add([QQ(1, 2), QQ(2, 3)], [QQ(1)], QQ) == [QQ(1, 2), QQ(5, 3)] assert dup_add([QQ(1)], [QQ(1, 2), QQ(2, 3)], QQ) == [QQ(1, 2), QQ(5, 3)] assert dup_add([QQ(1, 7), QQ(2, 7), QQ(3, 7)], [QQ( 8, 7), QQ(9, 7), QQ(10, 7)], QQ) == [QQ(9, 7), QQ(11, 7), QQ(13, 7)] def test_dmp_add(): assert dmp_add([ZZ(1), ZZ(2)], [ZZ(1)], 0, ZZ) == \ dup_add([ZZ(1), ZZ(2)], [ZZ(1)], ZZ) assert dmp_add([QQ(1, 2), QQ(2, 3)], [QQ(1)], 0, QQ) == \ dup_add([QQ(1, 2), QQ(2, 3)], [QQ(1)], QQ) assert dmp_add([[[]]], [[[]]], 2, ZZ) == [[[]]] assert dmp_add([[[ZZ(1)]]], [[[]]], 2, ZZ) == [[[ZZ(1)]]] assert dmp_add([[[]]], [[[ZZ(1)]]], 2, ZZ) == [[[ZZ(1)]]] assert dmp_add([[[ZZ(2)]]], [[[ZZ(1)]]], 2, ZZ) == [[[ZZ(3)]]] assert dmp_add([[[ZZ(1)]]], [[[ZZ(2)]]], 2, ZZ) == [[[ZZ(3)]]] assert dmp_add([[[]]], [[[]]], 2, QQ) == [[[]]] assert dmp_add([[[QQ(1, 2)]]], [[[]]], 2, QQ) == [[[QQ(1, 2)]]] assert dmp_add([[[]]], [[[QQ(1, 2)]]], 2, QQ) == [[[QQ(1, 2)]]] assert dmp_add([[[QQ(2, 7)]]], [[[QQ(1, 7)]]], 2, QQ) == [[[QQ(3, 7)]]] assert dmp_add([[[QQ(1, 7)]]], [[[QQ(2, 7)]]], 2, QQ) == [[[QQ(3, 7)]]] def test_dup_sub(): assert dup_sub([], [], ZZ) == [] assert dup_sub([ZZ(1)], [], ZZ) == [ZZ(1)] assert dup_sub([], [ZZ(1)], ZZ) == [ZZ(-1)] assert dup_sub([ZZ(1)], [ZZ(1)], ZZ) == [] assert dup_sub([ZZ(1)], [ZZ(2)], ZZ) == [ZZ(-1)] assert dup_sub([ZZ(1), ZZ(2)], [ZZ(1)], ZZ) == [ZZ(1), ZZ(1)] assert dup_sub([ZZ(1)], [ZZ(1), ZZ(2)], ZZ) == [ZZ(-1), ZZ(-1)] assert dup_sub([ZZ(3), ZZ( 2), ZZ(1)], [ZZ(8), ZZ(9), ZZ(10)], ZZ) == [ZZ(-5), ZZ(-7), ZZ(-9)] assert dup_sub([], [], QQ) == [] assert dup_sub([QQ(1, 2)], [], QQ) == [QQ(1, 2)] assert dup_sub([], [QQ(1, 2)], QQ) == [QQ(-1, 2)] assert dup_sub([QQ(1, 3)], [QQ(1, 3)], QQ) == [] assert dup_sub([QQ(1, 3)], [QQ(2, 3)], QQ) == [QQ(-1, 3)] assert dup_sub([QQ(1, 7), QQ(2, 7)], [QQ(1)], QQ) == [QQ(1, 7), QQ(-5, 7)] assert dup_sub([QQ(1)], [QQ(1, 7), QQ(2, 7)], QQ) == [QQ(-1, 7), QQ(5, 7)] assert dup_sub([QQ(3, 7), QQ(2, 7), QQ(1, 7)], [QQ( 8, 7), QQ(9, 7), QQ(10, 7)], QQ) == [QQ(-5, 7), QQ(-7, 7), QQ(-9, 7)] def test_dmp_sub(): assert dmp_sub([ZZ(1), ZZ(2)], [ZZ(1)], 0, ZZ) == \ dup_sub([ZZ(1), ZZ(2)], [ZZ(1)], ZZ) assert dmp_sub([QQ(1, 2), QQ(2, 3)], [QQ(1)], 0, QQ) == \ dup_sub([QQ(1, 2), QQ(2, 3)], [QQ(1)], QQ) assert dmp_sub([[[]]], [[[]]], 2, ZZ) == [[[]]] assert dmp_sub([[[ZZ(1)]]], [[[]]], 2, ZZ) == [[[ZZ(1)]]] assert dmp_sub([[[]]], [[[ZZ(1)]]], 2, ZZ) == [[[ZZ(-1)]]] assert dmp_sub([[[ZZ(2)]]], [[[ZZ(1)]]], 2, ZZ) == [[[ZZ(1)]]] assert dmp_sub([[[ZZ(1)]]], [[[ZZ(2)]]], 2, ZZ) == [[[ZZ(-1)]]] assert dmp_sub([[[]]], [[[]]], 2, QQ) == [[[]]] assert dmp_sub([[[QQ(1, 2)]]], [[[]]], 2, QQ) == [[[QQ(1, 2)]]] assert dmp_sub([[[]]], [[[QQ(1, 2)]]], 2, QQ) == [[[QQ(-1, 2)]]] assert dmp_sub([[[QQ(2, 7)]]], [[[QQ(1, 7)]]], 2, QQ) == [[[QQ(1, 7)]]] assert dmp_sub([[[QQ(1, 7)]]], [[[QQ(2, 7)]]], 2, QQ) == [[[QQ(-1, 7)]]] def test_dup_add_mul(): assert dup_add_mul([ZZ(1), ZZ(2), ZZ(3)], [ZZ(3), ZZ(2), ZZ(1)], [ZZ(1), ZZ(2)], ZZ) == [ZZ(3), ZZ(9), ZZ(7), ZZ(5)] assert dmp_add_mul([[ZZ(1), ZZ(2)], [ZZ(3)]], [[ZZ(3)], [ZZ(2), ZZ(1)]], [[ZZ(1)], [ZZ(2)]], 1, ZZ) == [[ZZ(3)], [ZZ(3), ZZ(9)], [ZZ(4), ZZ(5)]] def test_dup_sub_mul(): assert dup_sub_mul([ZZ(1), ZZ(2), ZZ(3)], [ZZ(3), ZZ(2), ZZ(1)], [ZZ(1), ZZ(2)], ZZ) == [ZZ(-3), ZZ(-7), ZZ(-3), ZZ(1)] assert dmp_sub_mul([[ZZ(1), ZZ(2)], [ZZ(3)]], [[ZZ(3)], [ZZ(2), ZZ(1)]], [[ZZ(1)], [ZZ(2)]], 1, ZZ) == [[ZZ(-3)], [ZZ(-1), ZZ(-5)], [ZZ(-4), ZZ(1)]] def test_dup_mul(): assert dup_mul([], [], ZZ) == [] assert dup_mul([], [ZZ(1)], ZZ) == [] assert dup_mul([ZZ(1)], [], ZZ) == [] assert dup_mul([ZZ(1)], [ZZ(1)], ZZ) == [ZZ(1)] assert dup_mul([ZZ(5)], [ZZ(7)], ZZ) == [ZZ(35)] assert dup_mul([], [], QQ) == [] assert dup_mul([], [QQ(1, 2)], QQ) == [] assert dup_mul([QQ(1, 2)], [], QQ) == [] assert dup_mul([QQ(1, 2)], [QQ(4, 7)], QQ) == [QQ(2, 7)] assert dup_mul([QQ(5, 7)], [QQ(3, 7)], QQ) == [QQ(15, 49)] f = dup_normal([3, 0, 0, 6, 1, 2], ZZ) g = dup_normal([4, 0, 1, 0], ZZ) h = dup_normal([12, 0, 3, 24, 4, 14, 1, 2, 0], ZZ) assert dup_mul(f, g, ZZ) == h assert dup_mul(g, f, ZZ) == h f = dup_normal([2, 0, 0, 1, 7], ZZ) h = dup_normal([4, 0, 0, 4, 28, 0, 1, 14, 49], ZZ) assert dup_mul(f, f, ZZ) == h K = FF(6) assert dup_mul([K(2), K(1)], [K(3), K(4)], K) == [K(5), K(4)] p1 = dup_normal([79, -1, 78, -94, -10, 11, 32, -19, 78, 2, -89, 30, 73, 42, 85, 77, 83, -30, -34, -2, 95, -81, 37, -49, -46, -58, -16, 37, 35, -11, -57, -15, -31, 67, -20, 27, 76, 2, 70, 67, -65, 65, -26, -93, -44, -12, -92, 57, -90, -57, -11, -67, -98, -69, 97, -41, 89, 33, 89, -50, 81, -31, 60, -27, 43, 29, -77, 44, 21, -91, 32, -57, 33, 3, 53, -51, -38, -99, -84, 23, -50, 66, -100, 1, -75, -25, 27, -60, 98, -51, -87, 6, 8, 78, -28, -95, -88, 12, -35, 26, -9, 16, -92, 55, -7, -86, 68, -39, -46, 84, 94, 45, 60, 92, 68, -75, -74, -19, 8, 75, 78, 91, 57, 34, 14, -3, -49, 65, 78, -18, 6, -29, -80, -98, 17, 13, 58, 21, 20, 9, 37, 7, -30, -53, -20, 34, 67, -42, 89, -22, 73, 43, -6, 5, 51, -8, -15, -52, -22, -58, -72, -3, 43, -92, 82, 83, -2, -13, -23, -60, 16, -94, -8, -28, -95, -72, 63, -90, 76, 6, -43, -100, -59, 76, 3, 3, 46, -85, 75, 62, -71, -76, 88, 97, -72, -1, 30, -64, 72, -48, 14, -78, 58, 63, -91, 24, -87, -27, -80, -100, -44, 98, 70, 100, -29, -38, 11, 77, 100, 52, 86, 65, -5, -42, -81, -38, -42, 43, -2, -70, -63, -52], ZZ) p2 = dup_normal([65, -19, -47, 1, 90, 81, -15, -34, 25, -75, 9, -83, 50, -5, -44, 31, 1, 70, -7, 78, 74, 80, 85, 65, 21, 41, 66, 19, -40, 63, -21, -27, 32, 69, 83, 34, -35, 14, 81, 57, -75, 32, -67, -89, -100, -61, 46, 84, -78, -29, -50, -94, -24, -32, -68, -16, 100, -7, -72, -89, 35, 82, 58, 81, -92, 62, 5, -47, -39, -58, -72, -13, 84, 44, 55, -25, 48, -54, -31, -56, -11, -50, -84, 10, 67, 17, 13, -14, 61, 76, -64, -44, -40, -96, 11, -11, -94, 2, 6, 27, -6, 68, -54, 66, -74, -14, -1, -24, -73, 96, 89, -11, -89, 56, -53, 72, -43, 96, 25, 63, -31, 29, 68, 83, 91, -93, -19, -38, -40, 40, -12, -19, -79, 44, 100, -66, -29, -77, 62, 39, -8, 11, -97, 14, 87, 64, 21, -18, 13, 15, -59, -75, -99, -88, 57, 54, 56, -67, 6, -63, -59, -14, 28, 87, -20, -39, 84, -91, -2, 49, -75, 11, -24, -95, 36, 66, 5, 25, -72, -40, 86, 90, 37, -33, 57, -35, 29, -18, 4, -79, 64, -17, -27, 21, 29, -5, -44, -87, -24, 52, 78, 11, -23, -53, 36, 42, 21, -68, 94, -91, -51, -21, 51, -76, 72, 31, 24, -48, -80, -9, 37, -47, -6, -8, -63, -91, 79, -79, -100, 38, -20, 38, 100, 83, -90, 87, 63, -36, 82, -19, 18, -98, -38, 26, 98, -70, 79, 92, 12, 12, 70, 74, 36, 48, -13, 31, 31, -47, -71, -12, -64, 36, -42, 32, -86, 60, 83, 70, 55, 0, 1, 29, -35, 8, -82, 8, -73, -46, -50, 43, 48, -5, -86, -72, 44, -90, 19, 19, 5, -20, 97, -13, -66, -5, 5, -69, 64, -30, 41, 51, 36, 13, -99, -61, 94, -12, 74, 98, 68, 24, 46, -97, -87, -6, -27, 82, 62, -11, -77, 86, 66, -47, -49, -50, 13, 18, 89, -89, 46, -80, 13, 98, -35, -36, -25, 12, 20, 26, -52, 79, 27, 79, 100, 8, 62, -58, -28, 37], ZZ) res = dup_normal([5135, -1566, 1376, -7466, 4579, 11710, 8001, -7183, -3737, -7439, 345, -10084, 24522, -1201, 1070, -10245, 9582, 9264, 1903, 23312, 18953, 10037, -15268, -5450, 6442, -6243, -3777, 5110, 10936, -16649, -6022, 16255, 31300, 24818, 31922, 32760, 7854, 27080, 15766, 29596, 7139, 31945, -19810, 465, -38026, -3971, 9641, 465, -19375, 5524, -30112, -11960, -12813, 13535, 30670, 5925, -43725, -14089, 11503, -22782, 6371, 43881, 37465, -33529, -33590, -39798, -37854, -18466, -7908, -35825, -26020, -36923, -11332, -5699, 25166, -3147, 19885, 12962, -20659, -1642, 27723, -56331, -24580, -11010, -20206, 20087, -23772, -16038, 38580, 20901, -50731, 32037, -4299, 26508, 18038, -28357, 31846, -7405, -20172, -15894, 2096, 25110, -45786, 45918, -55333, -31928, -49428, -29824, -58796, -24609, -15408, 69, -35415, -18439, 10123, -20360, -65949, 33356, -20333, 26476, -32073, 33621, 930, 28803, -42791, 44716, 38164, 12302, -1739, 11421, 73385, -7613, 14297, 38155, -414, 77587, 24338, -21415, 29367, 42639, 13901, -288, 51027, -11827, 91260, 43407, 88521, -15186, 70572, -12049, 5090, -12208, -56374, 15520, -623, -7742, 50825, 11199, -14894, 40892, 59591, -31356, -28696, -57842, -87751, -33744, -28436, -28945, -40287, 37957, -35638, 33401, -61534, 14870, 40292, 70366, -10803, 102290, -71719, -85251, 7902, -22409, 75009, 99927, 35298, -1175, -762, -34744, -10587, -47574, -62629, -19581, -43659, -54369, -32250, -39545, 15225, -24454, 11241, -67308, -30148, 39929, 37639, 14383, -73475, -77636, -81048, -35992, 41601, -90143, 76937, -8112, 56588, 9124, -40094, -32340, 13253, 10898, -51639, 36390, 12086, -1885, 100714, -28561, -23784, -18735, 18916, 16286, 10742, -87360, -13697, 10689, -19477, -29770, 5060, 20189, -8297, 112407, 47071, 47743, 45519, -4109, 17468, -68831, 78325, -6481, -21641, -19459, 30919, 96115, 8607, 53341, 32105, -16211, 23538, 57259, -76272, -40583, 62093, 38511, -34255, -40665, -40604, -37606, -15274, 33156, -13885, 103636, 118678, -14101, -92682, -100791, 2634, 63791, 98266, 19286, -34590, -21067, -71130, 25380, -40839, -27614, -26060, 52358, -15537, 27138, -6749, 36269, -33306, 13207, -91084, -5540, -57116, 69548, 44169, -57742, -41234, -103327, -62904, -8566, 41149, -12866, 71188, 23980, 1838, 58230, 73950, 5594, 43113, -8159, -15925, 6911, 85598, -75016, -16214, -62726, -39016, 8618, -63882, -4299, 23182, 49959, 49342, -3238, -24913, -37138, 78361, 32451, 6337, -11438, -36241, -37737, 8169, -3077, -24829, 57953, 53016, -31511, -91168, 12599, -41849, 41576, 55275, -62539, 47814, -62319, 12300, -32076, -55137, -84881, -27546, 4312, -3433, -54382, 113288, -30157, 74469, 18219, 79880, -2124, 98911, 17655, -33499, -32861, 47242, -37393, 99765, 14831, -44483, 10800, -31617, -52710, 37406, 22105, 29704, -20050, 13778, 43683, 36628, 8494, 60964, -22644, 31550, -17693, 33805, -124879, -12302, 19343, 20400, -30937, -21574, -34037, -33380, 56539, -24993, -75513, -1527, 53563, 65407, -101, 53577, 37991, 18717, -23795, -8090, -47987, -94717, 41967, 5170, -14815, -94311, 17896, -17734, -57718, -774, -38410, 24830, 29682, 76480, 58802, -46416, -20348, -61353, -68225, -68306, 23822, -31598, 42972, 36327, 28968, -65638, -21638, 24354, -8356, 26777, 52982, -11783, -44051, -26467, -44721, -28435, -53265, -25574, -2669, 44155, 22946, -18454, -30718, -11252, 58420, 8711, 67447, 4425, 41749, 67543, 43162, 11793, -41907, 20477, -13080, 6559, -6104, -13244, 42853, 42935, 29793, 36730, -28087, 28657, 17946, 7503, 7204, 21491, -27450, -24241, -98156, -18082, -42613, -24928, 10775, -14842, -44127, 55910, 14777, 31151, -2194, 39206, -2100, -4211, 11827, -8918, -19471, 72567, 36447, -65590, -34861, -17147, -45303, 9025, -7333, -35473, 11101, 11638, 3441, 6626, -41800, 9416, 13679, 33508, 40502, -60542, 16358, 8392, -43242, -35864, -34127, -48721, 35878, 30598, 28630, 20279, -19983, -14638, -24455, -1851, -11344, 45150, 42051, 26034, -28889, -32382, -3527, -14532, 22564, -22346, 477, 11706, 28338, -25972, -9185, -22867, -12522, 32120, -4424, 11339, -33913, -7184, 5101, -23552, -17115, -31401, -6104, 21906, 25708, 8406, 6317, -7525, 5014, 20750, 20179, 22724, 11692, 13297, 2493, -253, -16841, -17339, -6753, -4808, 2976, -10881, -10228, -13816, -12686, 1385, 2316, 2190, -875, -1924], ZZ) assert dup_mul(p1, p2, ZZ) == res p1 = dup_normal([83, -61, -86, -24, 12, 43, -88, -9, 42, 55, -66, 74, 95, -25, -12, 68, -99, 4, 45, 6, -15, -19, 78, 65, -55, 47, -13, 17, 86, 81, -58, -27, 50, -40, -24, 39, -41, -92, 75, 90, -1, 40, -15, -27, -35, 68, 70, -64, -40, 78, -88, -58, -39, 69, 46, 12, 28, -94, -37, -50, -80, -96, -61, 25, 1, 71, 4, 12, 48, 4, 34, -47, -75, 5, 48, 82, 88, 23, 98, 35, 17, -10, 48, -61, -95, 47, 65, -19, -66, -57, -6, -51, -42, -89, 66, -13, 18, 37, 90, -23, 72, 96, -53, 0, 40, -73, -52, -68, 32, -25, -53, 79, -52, 18, 44, 73, -81, 31, -90, 70, 3, 36, 48, 76, -24, -44, 23, 98, -4, 73, 69, 88, -70, 14, -68, 94, -78, -15, -64, -97, -70, -35, 65, 88, 49, -53, -7, 12, -45, -7, 59, -94, 99, -2, 67, -60, -71, 29, -62, -77, 1, 51, 17, 80, -20, -47, -19, 24, -9, 39, -23, 21, -84, 10, 84, 56, -17, -21, -66, 85, 70, 46, -51, -22, -95, 78, -60, -96, -97, -45, 72, 35, 30, -61, -92, -93, -60, -61, 4, -4, -81, -73, 46, 53, -11, 26, 94, 45, 14, -78, 55, 84, -68, 98, 60, 23, 100, -63, 68, 96, -16, 3, 56, 21, -58, 62, -67, 66, 85, 41, -79, -22, 97, -67, 82, 82, -96, -20, -7, 48, -67, 48, -9, -39, 78], ZZ) p2 = dup_normal([52, 88, 76, 66, 9, -64, 46, -20, -28, 69, 60, 96, -36, -92, -30, -11, -35, 35, 55, 63, -92, -7, 25, -58, 74, 55, -6, 4, 47, -92, -65, 67, -45, 74, -76, 59, -6, 69, 39, 24, -71, -7, 39, -45, 60, -68, 98, 97, -79, 17, 4, 94, -64, 68, -100, -96, -2, 3, 22, 96, 54, -77, -86, 67, 6, 57, 37, 40, 89, -78, 64, -94, -45, -92, 57, 87, -26, 36, 19, 97, 25, 77, -87, 24, 43, -5, 35, 57, 83, 71, 35, 63, 61, 96, -22, 8, -1, 96, 43, 45, 94, -93, 36, 71, -41, -99, 85, -48, 59, 52, -17, 5, 87, -16, -68, -54, 76, -18, 100, 91, -42, -70, -66, -88, -12, 1, 95, -82, 52, 43, -29, 3, 12, 72, -99, -43, -32, -93, -51, 16, -20, -12, -11, 5, 33, -38, 93, -5, -74, 25, 74, -58, 93, 59, -63, -86, 63, -20, -4, -74, -73, -95, 29, -28, 93, -91, -2, -38, -62, 77, -58, -85, -28, 95, 38, 19, -69, 86, 94, 25, -2, -4, 47, 34, -59, 35, -48, 29, -63, -53, 34, 29, 66, 73, 6, 92, -84, 89, 15, 81, 93, 97, 51, -72, -78, 25, 60, 90, -45, 39, 67, -84, -62, 57, 26, -32, -56, -14, -83, 76, 5, -2, 99, -100, 28, 46, 94, -7, 53, -25, 16, -23, -36, 89, -78, -63, 31, 1, 84, -99, -52, 76, 48, 90, -76, 44, -19, 54, -36, -9, -73, -100, -69, 31, 42, 25, -39, 76, -26, -8, -14, 51, 3, 37, 45, 2, -54, 13, -34, -92, 17, -25, -65, 53, -63, 30, 4, -70, -67, 90, 52, 51, 18, -3, 31, -45, -9, 59, 63, -87, 22, -32, 29, -38, 21, 36, -82, 27, -11], ZZ) res = dup_normal([4316, 4132, -3532, -7974, -11303, -10069, 5484, -3330, -5874, 7734, 4673, 11327, -9884, -8031, 17343, 21035, -10570, -9285, 15893, 3780, -14083, 8819, 17592, 10159, 7174, -11587, 8598, -16479, 3602, 25596, 9781, 12163, 150, 18749, -21782, -12307, 27578, -2757, -12573, 12565, 6345, -18956, 19503, -15617, 1443, -16778, 36851, 23588, -28474, 5749, 40695, -7521, -53669, -2497, -18530, 6770, 57038, 3926, -6927, -15399, 1848, -64649, -27728, 3644, 49608, 15187, -8902, -9480, -7398, -40425, 4824, 23767, -7594, -6905, 33089, 18786, 12192, 24670, 31114, 35334, -4501, -14676, 7107, -59018, -21352, 20777, 19661, 20653, 33754, -885, -43758, 6269, 51897, -28719, -97488, -9527, 13746, 11644, 17644, -21720, 23782, -10481, 47867, 20752, 33810, -1875, 39918, -7710, -40840, 19808, -47075, 23066, 46616, 25201, 9287, 35436, -1602, 9645, -11978, 13273, 15544, 33465, 20063, 44539, 11687, 27314, -6538, -37467, 14031, 32970, -27086, 41323, 29551, 65910, -39027, -37800, -22232, 8212, 46316, -28981, -55282, 50417, -44929, -44062, 73879, 37573, -2596, -10877, -21893, -133218, -33707, -25753, -9531, 17530, 61126, 2748, -56235, 43874, -10872, -90459, -30387, 115267, -7264, -44452, 122626, 14839, -599, 10337, 57166, -67467, -54957, 63669, 1202, 18488, 52594, 7205, -97822, 612, 78069, -5403, -63562, 47236, 36873, -154827, -26188, 82427, -39521, 5628, 7416, 5276, -53095, 47050, 26121, -42207, 79021, -13035, 2499, -66943, 29040, -72355, -23480, 23416, -12885, -44225, -42688, -4224, 19858, 55299, 15735, 11465, 101876, -39169, 51786, 14723, 43280, -68697, 16410, 92295, 56767, 7183, 111850, 4550, 115451, -38443, -19642, -35058, 10230, 93829, 8925, 63047, 3146, 29250, 8530, 5255, -98117, -115517, -76817, -8724, 41044, 1312, -35974, 79333, -28567, 7547, -10580, -24559, -16238, 10794, -3867, 24848, 57770, -51536, -35040, 71033, 29853, 62029, -7125, -125585, -32169, -47907, 156811, -65176, -58006, -15757, -57861, 11963, 30225, -41901, -41681, 31310, 27982, 18613, 61760, 60746, -59096, 33499, 30097, -17997, 24032, 56442, -83042, 23747, -20931, -21978, -158752, -9883, -73598, -7987, -7333, -125403, -116329, 30585, 53281, 51018, -29193, 88575, 8264, -40147, -16289, 113088, 12810, -6508, 101552, -13037, 34440, -41840, 101643, 24263, 80532, 61748, 65574, 6423, -20672, 6591, -10834, -71716, 86919, -92626, 39161, 28490, 81319, 46676, 106720, 43530, 26998, 57456, -8862, 60989, 13982, 3119, -2224, 14743, 55415, -49093, -29303, 28999, 1789, 55953, -84043, -7780, -65013, 57129, -47251, 61484, 61994, -78361, -82778, 22487, -26894, 9756, -74637, -15519, -4360, 30115, 42433, 35475, 15286, 69768, 21509, -20214, 78675, -21163, 13596, 11443, -10698, -53621, -53867, -24155, 64500, -42784, -33077, -16500, 873, -52788, 14546, -38011, 36974, -39849, -34029, -94311, 83068, -50437, -26169, -46746, 59185, 42259, -101379, -12943, 30089, -59086, 36271, 22723, -30253, -52472, -70826, -23289, 3331, -31687, 14183, -857, -28627, 35246, -51284, 5636, -6933, 66539, 36654, 50927, 24783, 3457, 33276, 45281, 45650, -4938, -9968, -22590, 47995, 69229, 5214, -58365, -17907, -14651, 18668, 18009, 12649, -11851, -13387, 20339, 52472, -1087, -21458, -68647, 52295, 15849, 40608, 15323, 25164, -29368, 10352, -7055, 7159, 21695, -5373, -54849, 101103, -24963, -10511, 33227, 7659, 41042, -69588, 26718, -20515, 6441, 38135, -63, 24088, -35364, -12785, -18709, 47843, 48533, -48575, 17251, -19394, 32878, -9010, -9050, 504, -12407, 28076, -3429, 25324, -4210, -26119, 752, -29203, 28251, -11324, -32140, -3366, -25135, 18702, -31588, -7047, -24267, 49987, -14975, -33169, 37744, -7720, -9035, 16964, -2807, -421, 14114, -17097, -13662, 40628, -12139, -9427, 5369, 17551, -13232, -16211, 9804, -7422, 2677, 28635, -8280, -4906, 2908, -22558, 5604, 12459, 8756, -3980, -4745, -18525, 7913, 5970, -16457, 20230, -6247, -13812, 2505, 11899, 1409, -15094, 22540, -18863, 137, 11123, -4516, 2290, -8594, 12150, -10380, 3005, 5235, -7350, 2535, -858], ZZ) assert dup_mul(p1, p2, ZZ) == res def test_dmp_mul(): assert dmp_mul([ZZ(5)], [ZZ(7)], 0, ZZ) == \ dup_mul([ZZ(5)], [ZZ(7)], ZZ) assert dmp_mul([QQ(5, 7)], [QQ(3, 7)], 0, QQ) == \ dup_mul([QQ(5, 7)], [QQ(3, 7)], QQ) assert dmp_mul([[[]]], [[[]]], 2, ZZ) == [[[]]] assert dmp_mul([[[ZZ(1)]]], [[[]]], 2, ZZ) == [[[]]] assert dmp_mul([[[]]], [[[ZZ(1)]]], 2, ZZ) == [[[]]] assert dmp_mul([[[ZZ(2)]]], [[[ZZ(1)]]], 2, ZZ) == [[[ZZ(2)]]] assert dmp_mul([[[ZZ(1)]]], [[[ZZ(2)]]], 2, ZZ) == [[[ZZ(2)]]] assert dmp_mul([[[]]], [[[]]], 2, QQ) == [[[]]] assert dmp_mul([[[QQ(1, 2)]]], [[[]]], 2, QQ) == [[[]]] assert dmp_mul([[[]]], [[[QQ(1, 2)]]], 2, QQ) == [[[]]] assert dmp_mul([[[QQ(2, 7)]]], [[[QQ(1, 3)]]], 2, QQ) == [[[QQ(2, 21)]]] assert dmp_mul([[[QQ(1, 7)]]], [[[QQ(2, 3)]]], 2, QQ) == [[[QQ(2, 21)]]] K = FF(6) assert dmp_mul( [[K(2)], [K(1)]], [[K(3)], [K(4)]], 1, K) == [[K(5)], [K(4)]] def test_dup_sqr(): assert dup_sqr([], ZZ) == [] assert dup_sqr([ZZ(2)], ZZ) == [ZZ(4)] assert dup_sqr([ZZ(1), ZZ(2)], ZZ) == [ZZ(1), ZZ(4), ZZ(4)] assert dup_sqr([], QQ) == [] assert dup_sqr([QQ(2, 3)], QQ) == [QQ(4, 9)] assert dup_sqr([QQ(1, 3), QQ(2, 3)], QQ) == [QQ(1, 9), QQ(4, 9), QQ(4, 9)] f = dup_normal([2, 0, 0, 1, 7], ZZ) assert dup_sqr(f, ZZ) == dup_normal([4, 0, 0, 4, 28, 0, 1, 14, 49], ZZ) K = FF(9) assert dup_sqr([K(3), K(4)], K) == [K(6), K(7)] def test_dmp_sqr(): assert dmp_sqr([ZZ(1), ZZ(2)], 0, ZZ) == \ dup_sqr([ZZ(1), ZZ(2)], ZZ) assert dmp_sqr([[[]]], 2, ZZ) == [[[]]] assert dmp_sqr([[[ZZ(2)]]], 2, ZZ) == [[[ZZ(4)]]] assert dmp_sqr([[[]]], 2, QQ) == [[[]]] assert dmp_sqr([[[QQ(2, 3)]]], 2, QQ) == [[[QQ(4, 9)]]] K = FF(9) assert dmp_sqr([[K(3)], [K(4)]], 1, K) == [[K(6)], [K(7)]] def test_dup_pow(): assert dup_pow([], 0, ZZ) == [ZZ(1)] assert dup_pow([], 0, QQ) == [QQ(1)] assert dup_pow([], 1, ZZ) == [] assert dup_pow([], 7, ZZ) == [] assert dup_pow([ZZ(1)], 0, ZZ) == [ZZ(1)] assert dup_pow([ZZ(1)], 1, ZZ) == [ZZ(1)] assert dup_pow([ZZ(1)], 7, ZZ) == [ZZ(1)] assert dup_pow([ZZ(3)], 0, ZZ) == [ZZ(1)] assert dup_pow([ZZ(3)], 1, ZZ) == [ZZ(3)] assert dup_pow([ZZ(3)], 7, ZZ) == [ZZ(2187)] assert dup_pow([QQ(1, 1)], 0, QQ) == [QQ(1, 1)] assert dup_pow([QQ(1, 1)], 1, QQ) == [QQ(1, 1)] assert dup_pow([QQ(1, 1)], 7, QQ) == [QQ(1, 1)] assert dup_pow([QQ(3, 7)], 0, QQ) == [QQ(1, 1)] assert dup_pow([QQ(3, 7)], 1, QQ) == [QQ(3, 7)] assert dup_pow([QQ(3, 7)], 7, QQ) == [QQ(2187, 823543)] f = dup_normal([2, 0, 0, 1, 7], ZZ) assert dup_pow(f, 0, ZZ) == dup_normal([1], ZZ) assert dup_pow(f, 1, ZZ) == dup_normal([2, 0, 0, 1, 7], ZZ) assert dup_pow(f, 2, ZZ) == dup_normal([4, 0, 0, 4, 28, 0, 1, 14, 49], ZZ) assert dup_pow(f, 3, ZZ) == dup_normal( [8, 0, 0, 12, 84, 0, 6, 84, 294, 1, 21, 147, 343], ZZ) def test_dmp_pow(): assert dmp_pow([[]], 0, 1, ZZ) == [[ZZ(1)]] assert dmp_pow([[]], 0, 1, QQ) == [[QQ(1)]] assert dmp_pow([[]], 1, 1, ZZ) == [[]] assert dmp_pow([[]], 7, 1, ZZ) == [[]] assert dmp_pow([[ZZ(1)]], 0, 1, ZZ) == [[ZZ(1)]] assert dmp_pow([[ZZ(1)]], 1, 1, ZZ) == [[ZZ(1)]] assert dmp_pow([[ZZ(1)]], 7, 1, ZZ) == [[ZZ(1)]] assert dmp_pow([[QQ(3, 7)]], 0, 1, QQ) == [[QQ(1, 1)]] assert dmp_pow([[QQ(3, 7)]], 1, 1, QQ) == [[QQ(3, 7)]] assert dmp_pow([[QQ(3, 7)]], 7, 1, QQ) == [[QQ(2187, 823543)]] f = dup_normal([2, 0, 0, 1, 7], ZZ) assert dmp_pow(f, 2, 0, ZZ) == dup_pow(f, 2, ZZ) def test_dup_pdiv(): f = dup_normal([3, 1, 1, 5], ZZ) g = dup_normal([5, -3, 1], ZZ) q = dup_normal([15, 14], ZZ) r = dup_normal([52, 111], ZZ) assert dup_pdiv(f, g, ZZ) == (q, r) assert dup_pquo(f, g, ZZ) == q assert dup_prem(f, g, ZZ) == r raises(ExactQuotientFailed, lambda: dup_pexquo(f, g, ZZ)) f = dup_normal([3, 1, 1, 5], QQ) g = dup_normal([5, -3, 1], QQ) q = dup_normal([15, 14], QQ) r = dup_normal([52, 111], QQ) assert dup_pdiv(f, g, QQ) == (q, r) assert dup_pquo(f, g, QQ) == q assert dup_prem(f, g, QQ) == r raises(ExactQuotientFailed, lambda: dup_pexquo(f, g, QQ)) def test_dmp_pdiv(): f = dmp_normal([[1], [], [1, 0, 0]], 1, ZZ) g = dmp_normal([[1], [-1, 0]], 1, ZZ) q = dmp_normal([[1], [1, 0]], 1, ZZ) r = dmp_normal([[2, 0, 0]], 1, ZZ) assert dmp_pdiv(f, g, 1, ZZ) == (q, r) assert dmp_pquo(f, g, 1, ZZ) == q assert dmp_prem(f, g, 1, ZZ) == r raises(ExactQuotientFailed, lambda: dmp_pexquo(f, g, 1, ZZ)) f = dmp_normal([[1], [], [1, 0, 0]], 1, ZZ) g = dmp_normal([[2], [-2, 0]], 1, ZZ) q = dmp_normal([[2], [2, 0]], 1, ZZ) r = dmp_normal([[8, 0, 0]], 1, ZZ) assert dmp_pdiv(f, g, 1, ZZ) == (q, r) assert dmp_pquo(f, g, 1, ZZ) == q assert dmp_prem(f, g, 1, ZZ) == r raises(ExactQuotientFailed, lambda: dmp_pexquo(f, g, 1, ZZ)) def test_dup_rr_div(): raises(ZeroDivisionError, lambda: dup_rr_div([1, 2, 3], [], ZZ)) f = dup_normal([3, 1, 1, 5], ZZ) g = dup_normal([5, -3, 1], ZZ) q, r = [], f assert dup_rr_div(f, g, ZZ) == (q, r) def test_dmp_rr_div(): raises(ZeroDivisionError, lambda: dmp_rr_div([[1, 2], [3]], [[]], 1, ZZ)) f = dmp_normal([[1], [], [1, 0, 0]], 1, ZZ) g = dmp_normal([[1], [-1, 0]], 1, ZZ) q = dmp_normal([[1], [1, 0]], 1, ZZ) r = dmp_normal([[2, 0, 0]], 1, ZZ) assert dmp_rr_div(f, g, 1, ZZ) == (q, r) f = dmp_normal([[1], [], [1, 0, 0]], 1, ZZ) g = dmp_normal([[-1], [1, 0]], 1, ZZ) q = dmp_normal([[-1], [-1, 0]], 1, ZZ) r = dmp_normal([[2, 0, 0]], 1, ZZ) assert dmp_rr_div(f, g, 1, ZZ) == (q, r) f = dmp_normal([[1], [], [1, 0, 0]], 1, ZZ) g = dmp_normal([[2], [-2, 0]], 1, ZZ) q, r = [[]], f assert dmp_rr_div(f, g, 1, ZZ) == (q, r) def test_dup_ff_div(): raises(ZeroDivisionError, lambda: dup_ff_div([1, 2, 3], [], QQ)) f = dup_normal([3, 1, 1, 5], QQ) g = dup_normal([5, -3, 1], QQ) q = [QQ(3, 5), QQ(14, 25)] r = [QQ(52, 25), QQ(111, 25)] assert dup_ff_div(f, g, QQ) == (q, r) def test_dup_ff_div_gmpy2(): try: from gmpy2 import mpq except ImportError: return from sympy.polys.domains import GMPYRationalField K = GMPYRationalField() f = [mpq(1,3), mpq(3,2)] g = [mpq(2,1)] assert dmp_ff_div(f, g, 0, K) == ([mpq(1,6), mpq(3,4)], []) f = [mpq(1,2), mpq(1,3), mpq(1,4), mpq(1,5)] g = [mpq(-1,1), mpq(1,1), mpq(-1,1)] assert dmp_ff_div(f, g, 0, K) == ([mpq(-1,2), mpq(-5,6)], [mpq(7,12), mpq(-19,30)]) def test_dmp_ff_div(): raises(ZeroDivisionError, lambda: dmp_ff_div([[1, 2], [3]], [[]], 1, QQ)) f = dmp_normal([[1], [], [1, 0, 0]], 1, QQ) g = dmp_normal([[1], [-1, 0]], 1, QQ) q = [[QQ(1, 1)], [QQ(1, 1), QQ(0, 1)]] r = [[QQ(2, 1), QQ(0, 1), QQ(0, 1)]] assert dmp_ff_div(f, g, 1, QQ) == (q, r) f = dmp_normal([[1], [], [1, 0, 0]], 1, QQ) g = dmp_normal([[-1], [1, 0]], 1, QQ) q = [[QQ(-1, 1)], [QQ(-1, 1), QQ(0, 1)]] r = [[QQ(2, 1), QQ(0, 1), QQ(0, 1)]] assert dmp_ff_div(f, g, 1, QQ) == (q, r) f = dmp_normal([[1], [], [1, 0, 0]], 1, QQ) g = dmp_normal([[2], [-2, 0]], 1, QQ) q = [[QQ(1, 2)], [QQ(1, 2), QQ(0, 1)]] r = [[QQ(2, 1), QQ(0, 1), QQ(0, 1)]] assert dmp_ff_div(f, g, 1, QQ) == (q, r) def test_dup_div(): f, g, q, r = [5, 4, 3, 2, 1], [1, 2, 3], [5, -6, 0], [20, 1] assert dup_div(f, g, ZZ) == (q, r) assert dup_quo(f, g, ZZ) == q assert dup_rem(f, g, ZZ) == r raises(ExactQuotientFailed, lambda: dup_exquo(f, g, ZZ)) f, g, q, r = [5, 4, 3, 2, 1, 0], [1, 2, 0, 0, 9], [5, -6], [15, 2, -44, 54] assert dup_div(f, g, ZZ) == (q, r) assert dup_quo(f, g, ZZ) == q assert dup_rem(f, g, ZZ) == r raises(ExactQuotientFailed, lambda: dup_exquo(f, g, ZZ)) def test_dmp_div(): f, g, q, r = [5, 4, 3, 2, 1], [1, 2, 3], [5, -6, 0], [20, 1] assert dmp_div(f, g, 0, ZZ) == (q, r) assert dmp_quo(f, g, 0, ZZ) == q assert dmp_rem(f, g, 0, ZZ) == r raises(ExactQuotientFailed, lambda: dmp_exquo(f, g, 0, ZZ)) f, g, q, r = [[[1]]], [[[2]], [1]], [[[]]], [[[1]]] assert dmp_div(f, g, 2, ZZ) == (q, r) assert dmp_quo(f, g, 2, ZZ) == q assert dmp_rem(f, g, 2, ZZ) == r raises(ExactQuotientFailed, lambda: dmp_exquo(f, g, 2, ZZ)) def test_dup_max_norm(): assert dup_max_norm([], ZZ) == 0 assert dup_max_norm([1], ZZ) == 1 assert dup_max_norm([1, 4, 2, 3], ZZ) == 4 def test_dmp_max_norm(): assert dmp_max_norm([[[]]], 2, ZZ) == 0 assert dmp_max_norm([[[1]]], 2, ZZ) == 1 assert dmp_max_norm(f_0, 2, ZZ) == 6 def test_dup_l1_norm(): assert dup_l1_norm([], ZZ) == 0 assert dup_l1_norm([1], ZZ) == 1 assert dup_l1_norm([1, 4, 2, 3], ZZ) == 10 def test_dmp_l1_norm(): assert dmp_l1_norm([[[]]], 2, ZZ) == 0 assert dmp_l1_norm([[[1]]], 2, ZZ) == 1 assert dmp_l1_norm(f_0, 2, ZZ) == 31 def test_dup_expand(): assert dup_expand((), ZZ) == [1] assert dup_expand(([1, 2, 3], [1, 2], [7, 5, 4, 3]), ZZ) == \ dup_mul([1, 2, 3], dup_mul([1, 2], [7, 5, 4, 3], ZZ), ZZ) def test_dmp_expand(): assert dmp_expand((), 1, ZZ) == [[1]] assert dmp_expand(([[1], [2], [3]], [[1], [2]], [[7], [5], [4], [3]]), 1, ZZ) == \ dmp_mul([[1], [2], [3]], dmp_mul([[1], [2]], [[7], [5], [ 4], [3]], 1, ZZ), 1, ZZ)
60343b39725030c76b0ba4be5254d1860172f33b719e30d8921dea43202b4610
"""Tests for dense recursive polynomials' tools. """ from sympy.polys.densebasic import ( dup_normal, dmp_normal, dup_from_raw_dict, dmp_convert, dmp_swap, ) from sympy.polys.densearith import dmp_mul_ground from sympy.polys.densetools import ( dup_clear_denoms, dmp_clear_denoms, dup_integrate, dmp_integrate, dmp_integrate_in, dup_diff, dmp_diff, dmp_diff_in, dup_eval, dmp_eval, dmp_eval_in, dmp_eval_tail, dmp_diff_eval_in, dup_trunc, dmp_trunc, dmp_ground_trunc, dup_monic, dmp_ground_monic, dup_content, dmp_ground_content, dup_primitive, dmp_ground_primitive, dup_extract, dmp_ground_extract, dup_real_imag, dup_mirror, dup_scale, dup_shift, dup_transform, dup_compose, dmp_compose, dup_decompose, dmp_lift, dup_sign_variations, dup_revert, dmp_revert, ) from sympy.polys.polyclasses import ANP from sympy.polys.polyerrors import ( MultivariatePolynomialError, ExactQuotientFailed, NotReversible, DomainError, ) from sympy.polys.specialpolys import f_polys from sympy.polys.domains import FF, ZZ, QQ, EX from sympy.polys.rings import ring from sympy import S, I, sin from sympy.abc import x from sympy.testing.pytest import raises f_0, f_1, f_2, f_3, f_4, f_5, f_6 = [ f.to_dense() for f in f_polys() ] def test_dup_integrate(): assert dup_integrate([], 1, QQ) == [] assert dup_integrate([], 2, QQ) == [] assert dup_integrate([QQ(1)], 1, QQ) == [QQ(1), QQ(0)] assert dup_integrate([QQ(1)], 2, QQ) == [QQ(1, 2), QQ(0), QQ(0)] assert dup_integrate([QQ(1), QQ(2), QQ(3)], 0, QQ) == \ [QQ(1), QQ(2), QQ(3)] assert dup_integrate([QQ(1), QQ(2), QQ(3)], 1, QQ) == \ [QQ(1, 3), QQ(1), QQ(3), QQ(0)] assert dup_integrate([QQ(1), QQ(2), QQ(3)], 2, QQ) == \ [QQ(1, 12), QQ(1, 3), QQ(3, 2), QQ(0), QQ(0)] assert dup_integrate([QQ(1), QQ(2), QQ(3)], 3, QQ) == \ [QQ(1, 60), QQ(1, 12), QQ(1, 2), QQ(0), QQ(0), QQ(0)] assert dup_integrate(dup_from_raw_dict({29: QQ(17)}, QQ), 3, QQ) == \ dup_from_raw_dict({32: QQ(17, 29760)}, QQ) assert dup_integrate(dup_from_raw_dict({29: QQ(17), 5: QQ(1, 2)}, QQ), 3, QQ) == \ dup_from_raw_dict({32: QQ(17, 29760), 8: QQ(1, 672)}, QQ) def test_dmp_integrate(): assert dmp_integrate([[[]]], 1, 2, QQ) == [[[]]] assert dmp_integrate([[[]]], 2, 2, QQ) == [[[]]] assert dmp_integrate([[[QQ(1)]]], 1, 2, QQ) == [[[QQ(1)]], [[]]] assert dmp_integrate([[[QQ(1)]]], 2, 2, QQ) == [[[QQ(1, 2)]], [[]], [[]]] assert dmp_integrate([[QQ(1)], [QQ(2)], [QQ(3)]], 0, 1, QQ) == \ [[QQ(1)], [QQ(2)], [QQ(3)]] assert dmp_integrate([[QQ(1)], [QQ(2)], [QQ(3)]], 1, 1, QQ) == \ [[QQ(1, 3)], [QQ(1)], [QQ(3)], []] assert dmp_integrate([[QQ(1)], [QQ(2)], [QQ(3)]], 2, 1, QQ) == \ [[QQ(1, 12)], [QQ(1, 3)], [QQ(3, 2)], [], []] assert dmp_integrate([[QQ(1)], [QQ(2)], [QQ(3)]], 3, 1, QQ) == \ [[QQ(1, 60)], [QQ(1, 12)], [QQ(1, 2)], [], [], []] def test_dmp_integrate_in(): f = dmp_convert(f_6, 3, ZZ, QQ) assert dmp_integrate_in(f, 2, 1, 3, QQ) == \ dmp_swap( dmp_integrate(dmp_swap(f, 0, 1, 3, QQ), 2, 3, QQ), 0, 1, 3, QQ) assert dmp_integrate_in(f, 3, 1, 3, QQ) == \ dmp_swap( dmp_integrate(dmp_swap(f, 0, 1, 3, QQ), 3, 3, QQ), 0, 1, 3, QQ) assert dmp_integrate_in(f, 2, 2, 3, QQ) == \ dmp_swap( dmp_integrate(dmp_swap(f, 0, 2, 3, QQ), 2, 3, QQ), 0, 2, 3, QQ) assert dmp_integrate_in(f, 3, 2, 3, QQ) == \ dmp_swap( dmp_integrate(dmp_swap(f, 0, 2, 3, QQ), 3, 3, QQ), 0, 2, 3, QQ) def test_dup_diff(): assert dup_diff([], 1, ZZ) == [] assert dup_diff([7], 1, ZZ) == [] assert dup_diff([2, 7], 1, ZZ) == [2] assert dup_diff([1, 2, 1], 1, ZZ) == [2, 2] assert dup_diff([1, 2, 3, 4], 1, ZZ) == [3, 4, 3] assert dup_diff([1, -1, 0, 0, 2], 1, ZZ) == [4, -3, 0, 0] f = dup_normal([17, 34, 56, -345, 23, 76, 0, 0, 12, 3, 7], ZZ) assert dup_diff(f, 0, ZZ) == f assert dup_diff(f, 1, ZZ) == [170, 306, 448, -2415, 138, 380, 0, 0, 24, 3] assert dup_diff(f, 2, ZZ) == dup_diff(dup_diff(f, 1, ZZ), 1, ZZ) assert dup_diff( f, 3, ZZ) == dup_diff(dup_diff(dup_diff(f, 1, ZZ), 1, ZZ), 1, ZZ) K = FF(3) f = dup_normal([17, 34, 56, -345, 23, 76, 0, 0, 12, 3, 7], K) assert dup_diff(f, 1, K) == dup_normal([2, 0, 1, 0, 0, 2, 0, 0, 0, 0], K) assert dup_diff(f, 2, K) == dup_normal([1, 0, 0, 2, 0, 0, 0], K) assert dup_diff(f, 3, K) == dup_normal([], K) assert dup_diff(f, 0, K) == f assert dup_diff(f, 2, K) == dup_diff(dup_diff(f, 1, K), 1, K) assert dup_diff( f, 3, K) == dup_diff(dup_diff(dup_diff(f, 1, K), 1, K), 1, K) def test_dmp_diff(): assert dmp_diff([], 1, 0, ZZ) == [] assert dmp_diff([[]], 1, 1, ZZ) == [[]] assert dmp_diff([[[]]], 1, 2, ZZ) == [[[]]] assert dmp_diff([[[1], [2]]], 1, 2, ZZ) == [[[]]] assert dmp_diff([[[1]], [[]]], 1, 2, ZZ) == [[[1]]] assert dmp_diff([[[3]], [[1]], [[]]], 1, 2, ZZ) == [[[6]], [[1]]] assert dmp_diff([1, -1, 0, 0, 2], 1, 0, ZZ) == \ dup_diff([1, -1, 0, 0, 2], 1, ZZ) assert dmp_diff(f_6, 0, 3, ZZ) == f_6 assert dmp_diff(f_6, 1, 3, ZZ) == [[[[8460]], [[]]], [[[135, 0, 0], [], [], [-135, 0, 0]]], [[[]]], [[[-423]], [[-47]], [[]], [[141], [], [94, 0], []], [[]]]] assert dmp_diff( f_6, 2, 3, ZZ) == dmp_diff(dmp_diff(f_6, 1, 3, ZZ), 1, 3, ZZ) assert dmp_diff(f_6, 3, 3, ZZ) == dmp_diff( dmp_diff(dmp_diff(f_6, 1, 3, ZZ), 1, 3, ZZ), 1, 3, ZZ) K = FF(23) F_6 = dmp_normal(f_6, 3, K) assert dmp_diff(F_6, 0, 3, K) == F_6 assert dmp_diff(F_6, 1, 3, K) == dmp_diff(F_6, 1, 3, K) assert dmp_diff(F_6, 2, 3, K) == dmp_diff(dmp_diff(F_6, 1, 3, K), 1, 3, K) assert dmp_diff(F_6, 3, 3, K) == dmp_diff( dmp_diff(dmp_diff(F_6, 1, 3, K), 1, 3, K), 1, 3, K) def test_dmp_diff_in(): assert dmp_diff_in(f_6, 2, 1, 3, ZZ) == \ dmp_swap(dmp_diff(dmp_swap(f_6, 0, 1, 3, ZZ), 2, 3, ZZ), 0, 1, 3, ZZ) assert dmp_diff_in(f_6, 3, 1, 3, ZZ) == \ dmp_swap(dmp_diff(dmp_swap(f_6, 0, 1, 3, ZZ), 3, 3, ZZ), 0, 1, 3, ZZ) assert dmp_diff_in(f_6, 2, 2, 3, ZZ) == \ dmp_swap(dmp_diff(dmp_swap(f_6, 0, 2, 3, ZZ), 2, 3, ZZ), 0, 2, 3, ZZ) assert dmp_diff_in(f_6, 3, 2, 3, ZZ) == \ dmp_swap(dmp_diff(dmp_swap(f_6, 0, 2, 3, ZZ), 3, 3, ZZ), 0, 2, 3, ZZ) def test_dup_eval(): assert dup_eval([], 7, ZZ) == 0 assert dup_eval([1, 2], 0, ZZ) == 2 assert dup_eval([1, 2, 3], 7, ZZ) == 66 def test_dmp_eval(): assert dmp_eval([], 3, 0, ZZ) == 0 assert dmp_eval([[]], 3, 1, ZZ) == [] assert dmp_eval([[[]]], 3, 2, ZZ) == [[]] assert dmp_eval([[1, 2]], 0, 1, ZZ) == [1, 2] assert dmp_eval([[[1]]], 3, 2, ZZ) == [[1]] assert dmp_eval([[[1, 2]]], 3, 2, ZZ) == [[1, 2]] assert dmp_eval([[3, 2], [1, 2]], 3, 1, ZZ) == [10, 8] assert dmp_eval([[[3, 2]], [[1, 2]]], 3, 2, ZZ) == [[10, 8]] def test_dmp_eval_in(): assert dmp_eval_in( f_6, -2, 1, 3, ZZ) == dmp_eval(dmp_swap(f_6, 0, 1, 3, ZZ), -2, 3, ZZ) assert dmp_eval_in( f_6, 7, 1, 3, ZZ) == dmp_eval(dmp_swap(f_6, 0, 1, 3, ZZ), 7, 3, ZZ) assert dmp_eval_in(f_6, -2, 2, 3, ZZ) == dmp_swap( dmp_eval(dmp_swap(f_6, 0, 2, 3, ZZ), -2, 3, ZZ), 0, 1, 2, ZZ) assert dmp_eval_in(f_6, 7, 2, 3, ZZ) == dmp_swap( dmp_eval(dmp_swap(f_6, 0, 2, 3, ZZ), 7, 3, ZZ), 0, 1, 2, ZZ) f = [[[int(45)]], [[]], [[]], [[int(-9)], [-1], [], [int(3), int(0), int(10), int(0)]]] assert dmp_eval_in(f, -2, 2, 2, ZZ) == \ [[45], [], [], [-9, -1, 0, -44]] def test_dmp_eval_tail(): assert dmp_eval_tail([[]], [1], 1, ZZ) == [] assert dmp_eval_tail([[[]]], [1], 2, ZZ) == [[]] assert dmp_eval_tail([[[]]], [1, 2], 2, ZZ) == [] assert dmp_eval_tail(f_0, [], 2, ZZ) == f_0 assert dmp_eval_tail(f_0, [1, -17, 8], 2, ZZ) == 84496 assert dmp_eval_tail(f_0, [-17, 8], 2, ZZ) == [-1409, 3, 85902] assert dmp_eval_tail(f_0, [8], 2, ZZ) == [[83, 2], [3], [302, 81, 1]] assert dmp_eval_tail(f_1, [-17, 8], 2, ZZ) == [-136, 15699, 9166, -27144] assert dmp_eval_tail( f_2, [-12, 3], 2, ZZ) == [-1377, 0, -702, -1224, 0, -624] assert dmp_eval_tail( f_3, [-12, 3], 2, ZZ) == [144, 82, -5181, -28872, -14868, -540] assert dmp_eval_tail( f_4, [25, -1], 2, ZZ) == [152587890625, 9765625, -59605407714843750, -3839159765625, -1562475, 9536712644531250, 610349546750, -4, 24414375000, 1562520] assert dmp_eval_tail(f_5, [25, -1], 2, ZZ) == [-1, -78, -2028, -17576] assert dmp_eval_tail(f_6, [0, 2, 4], 3, ZZ) == [5040, 0, 0, 4480] def test_dmp_diff_eval_in(): assert dmp_diff_eval_in(f_6, 2, 7, 1, 3, ZZ) == \ dmp_eval(dmp_diff(dmp_swap(f_6, 0, 1, 3, ZZ), 2, 3, ZZ), 7, 3, ZZ) def test_dup_revert(): f = [-QQ(1, 720), QQ(0), QQ(1, 24), QQ(0), -QQ(1, 2), QQ(0), QQ(1)] g = [QQ(61, 720), QQ(0), QQ(5, 24), QQ(0), QQ(1, 2), QQ(0), QQ(1)] assert dup_revert(f, 8, QQ) == g raises(NotReversible, lambda: dup_revert([QQ(1), QQ(0)], 3, QQ)) def test_dmp_revert(): f = [-QQ(1, 720), QQ(0), QQ(1, 24), QQ(0), -QQ(1, 2), QQ(0), QQ(1)] g = [QQ(61, 720), QQ(0), QQ(5, 24), QQ(0), QQ(1, 2), QQ(0), QQ(1)] assert dmp_revert(f, 8, 0, QQ) == g raises(MultivariatePolynomialError, lambda: dmp_revert([[1]], 2, 1, QQ)) def test_dup_trunc(): assert dup_trunc([1, 2, 3, 4, 5, 6], ZZ(3), ZZ) == [1, -1, 0, 1, -1, 0] assert dup_trunc([6, 5, 4, 3, 2, 1], ZZ(3), ZZ) == [-1, 1, 0, -1, 1] def test_dmp_trunc(): assert dmp_trunc([[]], [1, 2], 2, ZZ) == [[]] assert dmp_trunc([[1, 2], [1, 4, 1], [1]], [1, 2], 1, ZZ) == [[-3], [1]] def test_dmp_ground_trunc(): assert dmp_ground_trunc(f_0, ZZ(3), 2, ZZ) == \ dmp_normal( [[[1, -1, 0], [-1]], [[]], [[1, -1, 0], [1, -1, 1], [1]]], 2, ZZ) def test_dup_monic(): assert dup_monic([3, 6, 9], ZZ) == [1, 2, 3] raises(ExactQuotientFailed, lambda: dup_monic([3, 4, 5], ZZ)) assert dup_monic([], QQ) == [] assert dup_monic([QQ(1)], QQ) == [QQ(1)] assert dup_monic([QQ(7), QQ(1), QQ(21)], QQ) == [QQ(1), QQ(1, 7), QQ(3)] def test_dmp_ground_monic(): assert dmp_ground_monic([[3], [6], [9]], 1, ZZ) == [[1], [2], [3]] raises( ExactQuotientFailed, lambda: dmp_ground_monic([[3], [4], [5]], 1, ZZ)) assert dmp_ground_monic([[]], 1, QQ) == [[]] assert dmp_ground_monic([[QQ(1)]], 1, QQ) == [[QQ(1)]] assert dmp_ground_monic( [[QQ(7)], [QQ(1)], [QQ(21)]], 1, QQ) == [[QQ(1)], [QQ(1, 7)], [QQ(3)]] def test_dup_content(): assert dup_content([], ZZ) == ZZ(0) assert dup_content([1], ZZ) == ZZ(1) assert dup_content([-1], ZZ) == ZZ(1) assert dup_content([1, 1], ZZ) == ZZ(1) assert dup_content([2, 2], ZZ) == ZZ(2) assert dup_content([1, 2, 1], ZZ) == ZZ(1) assert dup_content([2, 4, 2], ZZ) == ZZ(2) assert dup_content([QQ(2, 3), QQ(4, 9)], QQ) == QQ(2, 9) assert dup_content([QQ(2, 3), QQ(4, 5)], QQ) == QQ(2, 15) def test_dmp_ground_content(): assert dmp_ground_content([[]], 1, ZZ) == ZZ(0) assert dmp_ground_content([[]], 1, QQ) == QQ(0) assert dmp_ground_content([[1]], 1, ZZ) == ZZ(1) assert dmp_ground_content([[-1]], 1, ZZ) == ZZ(1) assert dmp_ground_content([[1], [1]], 1, ZZ) == ZZ(1) assert dmp_ground_content([[2], [2]], 1, ZZ) == ZZ(2) assert dmp_ground_content([[1], [2], [1]], 1, ZZ) == ZZ(1) assert dmp_ground_content([[2], [4], [2]], 1, ZZ) == ZZ(2) assert dmp_ground_content([[QQ(2, 3)], [QQ(4, 9)]], 1, QQ) == QQ(2, 9) assert dmp_ground_content([[QQ(2, 3)], [QQ(4, 5)]], 1, QQ) == QQ(2, 15) assert dmp_ground_content(f_0, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_0, ZZ(2), 2, ZZ), 2, ZZ) == ZZ(2) assert dmp_ground_content(f_1, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_1, ZZ(3), 2, ZZ), 2, ZZ) == ZZ(3) assert dmp_ground_content(f_2, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_2, ZZ(4), 2, ZZ), 2, ZZ) == ZZ(4) assert dmp_ground_content(f_3, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_3, ZZ(5), 2, ZZ), 2, ZZ) == ZZ(5) assert dmp_ground_content(f_4, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_4, ZZ(6), 2, ZZ), 2, ZZ) == ZZ(6) assert dmp_ground_content(f_5, 2, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_5, ZZ(7), 2, ZZ), 2, ZZ) == ZZ(7) assert dmp_ground_content(f_6, 3, ZZ) == ZZ(1) assert dmp_ground_content( dmp_mul_ground(f_6, ZZ(8), 3, ZZ), 3, ZZ) == ZZ(8) def test_dup_primitive(): assert dup_primitive([], ZZ) == (ZZ(0), []) assert dup_primitive([ZZ(1)], ZZ) == (ZZ(1), [ZZ(1)]) assert dup_primitive([ZZ(1), ZZ(1)], ZZ) == (ZZ(1), [ZZ(1), ZZ(1)]) assert dup_primitive([ZZ(2), ZZ(2)], ZZ) == (ZZ(2), [ZZ(1), ZZ(1)]) assert dup_primitive( [ZZ(1), ZZ(2), ZZ(1)], ZZ) == (ZZ(1), [ZZ(1), ZZ(2), ZZ(1)]) assert dup_primitive( [ZZ(2), ZZ(4), ZZ(2)], ZZ) == (ZZ(2), [ZZ(1), ZZ(2), ZZ(1)]) assert dup_primitive([], QQ) == (QQ(0), []) assert dup_primitive([QQ(1)], QQ) == (QQ(1), [QQ(1)]) assert dup_primitive([QQ(1), QQ(1)], QQ) == (QQ(1), [QQ(1), QQ(1)]) assert dup_primitive([QQ(2), QQ(2)], QQ) == (QQ(2), [QQ(1), QQ(1)]) assert dup_primitive( [QQ(1), QQ(2), QQ(1)], QQ) == (QQ(1), [QQ(1), QQ(2), QQ(1)]) assert dup_primitive( [QQ(2), QQ(4), QQ(2)], QQ) == (QQ(2), [QQ(1), QQ(2), QQ(1)]) assert dup_primitive( [QQ(2, 3), QQ(4, 9)], QQ) == (QQ(2, 9), [QQ(3), QQ(2)]) assert dup_primitive( [QQ(2, 3), QQ(4, 5)], QQ) == (QQ(2, 15), [QQ(5), QQ(6)]) def test_dmp_ground_primitive(): assert dmp_ground_primitive([[]], 1, ZZ) == (ZZ(0), [[]]) assert dmp_ground_primitive(f_0, 2, ZZ) == (ZZ(1), f_0) assert dmp_ground_primitive( dmp_mul_ground(f_0, ZZ(2), 2, ZZ), 2, ZZ) == (ZZ(2), f_0) assert dmp_ground_primitive(f_1, 2, ZZ) == (ZZ(1), f_1) assert dmp_ground_primitive( dmp_mul_ground(f_1, ZZ(3), 2, ZZ), 2, ZZ) == (ZZ(3), f_1) assert dmp_ground_primitive(f_2, 2, ZZ) == (ZZ(1), f_2) assert dmp_ground_primitive( dmp_mul_ground(f_2, ZZ(4), 2, ZZ), 2, ZZ) == (ZZ(4), f_2) assert dmp_ground_primitive(f_3, 2, ZZ) == (ZZ(1), f_3) assert dmp_ground_primitive( dmp_mul_ground(f_3, ZZ(5), 2, ZZ), 2, ZZ) == (ZZ(5), f_3) assert dmp_ground_primitive(f_4, 2, ZZ) == (ZZ(1), f_4) assert dmp_ground_primitive( dmp_mul_ground(f_4, ZZ(6), 2, ZZ), 2, ZZ) == (ZZ(6), f_4) assert dmp_ground_primitive(f_5, 2, ZZ) == (ZZ(1), f_5) assert dmp_ground_primitive( dmp_mul_ground(f_5, ZZ(7), 2, ZZ), 2, ZZ) == (ZZ(7), f_5) assert dmp_ground_primitive(f_6, 3, ZZ) == (ZZ(1), f_6) assert dmp_ground_primitive( dmp_mul_ground(f_6, ZZ(8), 3, ZZ), 3, ZZ) == (ZZ(8), f_6) assert dmp_ground_primitive([[ZZ(2)]], 1, ZZ) == (ZZ(2), [[ZZ(1)]]) assert dmp_ground_primitive([[QQ(2)]], 1, QQ) == (QQ(2), [[QQ(1)]]) assert dmp_ground_primitive( [[QQ(2, 3)], [QQ(4, 9)]], 1, QQ) == (QQ(2, 9), [[QQ(3)], [QQ(2)]]) assert dmp_ground_primitive( [[QQ(2, 3)], [QQ(4, 5)]], 1, QQ) == (QQ(2, 15), [[QQ(5)], [QQ(6)]]) def test_dup_extract(): f = dup_normal([2930944, 0, 2198208, 0, 549552, 0, 45796], ZZ) g = dup_normal([17585664, 0, 8792832, 0, 1099104, 0], ZZ) F = dup_normal([64, 0, 48, 0, 12, 0, 1], ZZ) G = dup_normal([384, 0, 192, 0, 24, 0], ZZ) assert dup_extract(f, g, ZZ) == (45796, F, G) def test_dmp_ground_extract(): f = dmp_normal( [[2930944], [], [2198208], [], [549552], [], [45796]], 1, ZZ) g = dmp_normal([[17585664], [], [8792832], [], [1099104], []], 1, ZZ) F = dmp_normal([[64], [], [48], [], [12], [], [1]], 1, ZZ) G = dmp_normal([[384], [], [192], [], [24], []], 1, ZZ) assert dmp_ground_extract(f, g, 1, ZZ) == (45796, F, G) def test_dup_real_imag(): assert dup_real_imag([], ZZ) == ([[]], [[]]) assert dup_real_imag([1], ZZ) == ([[1]], [[]]) assert dup_real_imag([1, 1], ZZ) == ([[1], [1]], [[1, 0]]) assert dup_real_imag([1, 2], ZZ) == ([[1], [2]], [[1, 0]]) assert dup_real_imag( [1, 2, 3], ZZ) == ([[1], [2], [-1, 0, 3]], [[2, 0], [2, 0]]) raises(DomainError, lambda: dup_real_imag([EX(1), EX(2)], EX)) def test_dup_mirror(): assert dup_mirror([], ZZ) == [] assert dup_mirror([1], ZZ) == [1] assert dup_mirror([1, 2, 3, 4, 5], ZZ) == [1, -2, 3, -4, 5] assert dup_mirror([1, 2, 3, 4, 5, 6], ZZ) == [-1, 2, -3, 4, -5, 6] def test_dup_scale(): assert dup_scale([], -1, ZZ) == [] assert dup_scale([1], -1, ZZ) == [1] assert dup_scale([1, 2, 3, 4, 5], -1, ZZ) == [1, -2, 3, -4, 5] assert dup_scale([1, 2, 3, 4, 5], -7, ZZ) == [2401, -686, 147, -28, 5] def test_dup_shift(): assert dup_shift([], 1, ZZ) == [] assert dup_shift([1], 1, ZZ) == [1] assert dup_shift([1, 2, 3, 4, 5], 1, ZZ) == [1, 6, 15, 20, 15] assert dup_shift([1, 2, 3, 4, 5], 7, ZZ) == [1, 30, 339, 1712, 3267] def test_dup_transform(): assert dup_transform([], [], [1, 1], ZZ) == [] assert dup_transform([], [1], [1, 1], ZZ) == [] assert dup_transform([], [1, 2], [1, 1], ZZ) == [] assert dup_transform([6, -5, 4, -3, 17], [1, -3, 4], [2, -3], ZZ) == \ [6, -82, 541, -2205, 6277, -12723, 17191, -13603, 4773] def test_dup_compose(): assert dup_compose([], [], ZZ) == [] assert dup_compose([], [1], ZZ) == [] assert dup_compose([], [1, 2], ZZ) == [] assert dup_compose([1], [], ZZ) == [1] assert dup_compose([1, 2, 0], [], ZZ) == [] assert dup_compose([1, 2, 1], [], ZZ) == [1] assert dup_compose([1, 2, 1], [1], ZZ) == [4] assert dup_compose([1, 2, 1], [7], ZZ) == [64] assert dup_compose([1, 2, 1], [1, -1], ZZ) == [1, 0, 0] assert dup_compose([1, 2, 1], [1, 1], ZZ) == [1, 4, 4] assert dup_compose([1, 2, 1], [1, 2, 1], ZZ) == [1, 4, 8, 8, 4] def test_dmp_compose(): assert dmp_compose([1, 2, 1], [1, 2, 1], 0, ZZ) == [1, 4, 8, 8, 4] assert dmp_compose([[[]]], [[[]]], 2, ZZ) == [[[]]] assert dmp_compose([[[]]], [[[1]]], 2, ZZ) == [[[]]] assert dmp_compose([[[]]], [[[1]], [[2]]], 2, ZZ) == [[[]]] assert dmp_compose([[[1]]], [], 2, ZZ) == [[[1]]] assert dmp_compose([[1], [2], [ ]], [[]], 1, ZZ) == [[]] assert dmp_compose([[1], [2], [1]], [[]], 1, ZZ) == [[1]] assert dmp_compose([[1], [2], [1]], [[1]], 1, ZZ) == [[4]] assert dmp_compose([[1], [2], [1]], [[7]], 1, ZZ) == [[64]] assert dmp_compose([[1], [2], [1]], [[1], [-1]], 1, ZZ) == [[1], [ ], [ ]] assert dmp_compose([[1], [2], [1]], [[1], [ 1]], 1, ZZ) == [[1], [4], [4]] assert dmp_compose( [[1], [2], [1]], [[1], [2], [1]], 1, ZZ) == [[1], [4], [8], [8], [4]] def test_dup_decompose(): assert dup_decompose([1], ZZ) == [[1]] assert dup_decompose([1, 0], ZZ) == [[1, 0]] assert dup_decompose([1, 0, 0, 0], ZZ) == [[1, 0, 0, 0]] assert dup_decompose([1, 0, 0, 0, 0], ZZ) == [[1, 0, 0], [1, 0, 0]] assert dup_decompose( [1, 0, 0, 0, 0, 0, 0], ZZ) == [[1, 0, 0, 0], [1, 0, 0]] assert dup_decompose([7, 0, 0, 0, 1], ZZ) == [[7, 0, 1], [1, 0, 0]] assert dup_decompose([4, 0, 3, 0, 2], ZZ) == [[4, 3, 2], [1, 0, 0]] f = [1, 0, 20, 0, 150, 0, 500, 0, 625, -2, 0, -10, 9] assert dup_decompose(f, ZZ) == [[1, 0, 0, -2, 9], [1, 0, 5, 0]] f = [2, 0, 40, 0, 300, 0, 1000, 0, 1250, -4, 0, -20, 18] assert dup_decompose(f, ZZ) == [[2, 0, 0, -4, 18], [1, 0, 5, 0]] f = [1, 0, 20, -8, 150, -120, 524, -600, 865, -1034, 600, -170, 29] assert dup_decompose(f, ZZ) == [[1, -8, 24, -34, 29], [1, 0, 5, 0]] R, t = ring("t", ZZ) f = [6*t**2 - 42, 48*t**2 + 96, 144*t**2 + 648*t + 288, 624*t**2 + 864*t + 384, 108*t**3 + 312*t**2 + 432*t + 192] assert dup_decompose(f, R.to_domain()) == [f] def test_dmp_lift(): q = [QQ(1, 1), QQ(0, 1), QQ(1, 1)] f = [ANP([QQ(1, 1)], q, QQ), ANP([], q, QQ), ANP([], q, QQ), ANP([QQ(1, 1), QQ(0, 1)], q, QQ), ANP([QQ(17, 1), QQ(0, 1)], q, QQ)] assert dmp_lift(f, 0, QQ.algebraic_field(I)) == \ [QQ(1), QQ(0), QQ(0), QQ(0), QQ(0), QQ(0), QQ(2), QQ(0), QQ(578), QQ(0), QQ(0), QQ(0), QQ(1), QQ(0), QQ(-578), QQ(0), QQ(83521)] raises(DomainError, lambda: dmp_lift([EX(1), EX(2)], 0, EX)) def test_dup_sign_variations(): assert dup_sign_variations([], ZZ) == 0 assert dup_sign_variations([1, 0], ZZ) == 0 assert dup_sign_variations([1, 0, 2], ZZ) == 0 assert dup_sign_variations([1, 0, 3, 0], ZZ) == 0 assert dup_sign_variations([1, 0, 4, 0, 5], ZZ) == 0 assert dup_sign_variations([-1, 0, 2], ZZ) == 1 assert dup_sign_variations([-1, 0, 3, 0], ZZ) == 1 assert dup_sign_variations([-1, 0, 4, 0, 5], ZZ) == 1 assert dup_sign_variations([-1, -4, -5], ZZ) == 0 assert dup_sign_variations([ 1, -4, -5], ZZ) == 1 assert dup_sign_variations([ 1, 4, -5], ZZ) == 1 assert dup_sign_variations([ 1, -4, 5], ZZ) == 2 assert dup_sign_variations([-1, 4, -5], ZZ) == 2 assert dup_sign_variations([-1, 4, 5], ZZ) == 1 assert dup_sign_variations([-1, -4, 5], ZZ) == 1 assert dup_sign_variations([ 1, 4, 5], ZZ) == 0 assert dup_sign_variations([-1, 0, -4, 0, -5], ZZ) == 0 assert dup_sign_variations([ 1, 0, -4, 0, -5], ZZ) == 1 assert dup_sign_variations([ 1, 0, 4, 0, -5], ZZ) == 1 assert dup_sign_variations([ 1, 0, -4, 0, 5], ZZ) == 2 assert dup_sign_variations([-1, 0, 4, 0, -5], ZZ) == 2 assert dup_sign_variations([-1, 0, 4, 0, 5], ZZ) == 1 assert dup_sign_variations([-1, 0, -4, 0, 5], ZZ) == 1 assert dup_sign_variations([ 1, 0, 4, 0, 5], ZZ) == 0 def test_dup_clear_denoms(): assert dup_clear_denoms([], QQ, ZZ) == (ZZ(1), []) assert dup_clear_denoms([QQ(1)], QQ, ZZ) == (ZZ(1), [QQ(1)]) assert dup_clear_denoms([QQ(7)], QQ, ZZ) == (ZZ(1), [QQ(7)]) assert dup_clear_denoms([QQ(7, 3)], QQ) == (ZZ(3), [QQ(7)]) assert dup_clear_denoms([QQ(7, 3)], QQ, ZZ) == (ZZ(3), [QQ(7)]) assert dup_clear_denoms( [QQ(3), QQ(1), QQ(0)], QQ, ZZ) == (ZZ(1), [QQ(3), QQ(1), QQ(0)]) assert dup_clear_denoms( [QQ(1), QQ(1, 2), QQ(0)], QQ, ZZ) == (ZZ(2), [QQ(2), QQ(1), QQ(0)]) assert dup_clear_denoms([QQ(3), QQ( 1), QQ(0)], QQ, ZZ, convert=True) == (ZZ(1), [ZZ(3), ZZ(1), ZZ(0)]) assert dup_clear_denoms([QQ(1), QQ( 1, 2), QQ(0)], QQ, ZZ, convert=True) == (ZZ(2), [ZZ(2), ZZ(1), ZZ(0)]) assert dup_clear_denoms( [EX(S(3)/2), EX(S(9)/4)], EX) == (EX(4), [EX(6), EX(9)]) assert dup_clear_denoms([EX(7)], EX) == (EX(1), [EX(7)]) assert dup_clear_denoms([EX(sin(x)/x), EX(0)], EX) == (EX(x), [EX(sin(x)), EX(0)]) def test_dmp_clear_denoms(): assert dmp_clear_denoms([[]], 1, QQ, ZZ) == (ZZ(1), [[]]) assert dmp_clear_denoms([[QQ(1)]], 1, QQ, ZZ) == (ZZ(1), [[QQ(1)]]) assert dmp_clear_denoms([[QQ(7)]], 1, QQ, ZZ) == (ZZ(1), [[QQ(7)]]) assert dmp_clear_denoms([[QQ(7, 3)]], 1, QQ) == (ZZ(3), [[QQ(7)]]) assert dmp_clear_denoms([[QQ(7, 3)]], 1, QQ, ZZ) == (ZZ(3), [[QQ(7)]]) assert dmp_clear_denoms( [[QQ(3)], [QQ(1)], []], 1, QQ, ZZ) == (ZZ(1), [[QQ(3)], [QQ(1)], []]) assert dmp_clear_denoms([[QQ( 1)], [QQ(1, 2)], []], 1, QQ, ZZ) == (ZZ(2), [[QQ(2)], [QQ(1)], []]) assert dmp_clear_denoms([QQ(3), QQ( 1), QQ(0)], 0, QQ, ZZ, convert=True) == (ZZ(1), [ZZ(3), ZZ(1), ZZ(0)]) assert dmp_clear_denoms([QQ(1), QQ(1, 2), QQ( 0)], 0, QQ, ZZ, convert=True) == (ZZ(2), [ZZ(2), ZZ(1), ZZ(0)]) assert dmp_clear_denoms([[QQ(3)], [QQ( 1)], []], 1, QQ, ZZ, convert=True) == (ZZ(1), [[QQ(3)], [QQ(1)], []]) assert dmp_clear_denoms([[QQ(1)], [QQ(1, 2)], []], 1, QQ, ZZ, convert=True) == (ZZ(2), [[QQ(2)], [QQ(1)], []]) assert dmp_clear_denoms( [[EX(S(3)/2)], [EX(S(9)/4)]], 1, EX) == (EX(4), [[EX(6)], [EX(9)]]) assert dmp_clear_denoms([[EX(7)]], 1, EX) == (EX(1), [[EX(7)]]) assert dmp_clear_denoms([[EX(sin(x)/x), EX(0)]], 1, EX) == (EX(x), [[EX(sin(x)), EX(0)]])
12a830d5e6235e9a16884a38a124308b45567e7e1fd865191a3c6a3a288c18c1
"""Tests for high-level polynomials manipulation functions. """ from sympy.polys.polyfuncs import ( symmetrize, horner, interpolate, rational_interpolate, viete, ) from sympy.polys.polyerrors import ( MultivariatePolynomialError, ) from sympy import symbols, S from sympy.testing.pytest import raises from sympy.abc import a, b, c, d, e, x, y, z def test_symmetrize(): assert symmetrize(0, x, y, z) == (0, 0) assert symmetrize(1, x, y, z) == (1, 0) s1 = x + y + z s2 = x*y + x*z + y*z assert symmetrize(1) == (1, 0) assert symmetrize(1, formal=True) == (1, 0, []) assert symmetrize(x) == (x, 0) assert symmetrize(x + 1) == (x + 1, 0) assert symmetrize(x, x, y) == (x + y, -y) assert symmetrize(x + 1, x, y) == (x + y + 1, -y) assert symmetrize(x, x, y, z) == (s1, -y - z) assert symmetrize(x + 1, x, y, z) == (s1 + 1, -y - z) assert symmetrize(x**2, x, y, z) == (s1**2 - 2*s2, -y**2 - z**2) assert symmetrize(x**2 + y**2) == (-2*x*y + (x + y)**2, 0) assert symmetrize(x**2 - y**2) == (-2*x*y + (x + y)**2, -2*y**2) assert symmetrize(x**3 + y**2 + a*x**2 + b*y**3, x, y) == \ (-3*x*y*(x + y) - 2*a*x*y + a*(x + y)**2 + (x + y)**3, y**2*(1 - a) + y**3*(b - 1)) U = [u0, u1, u2] = symbols('u:3') assert symmetrize(x + 1, x, y, z, formal=True, symbols=U) == \ (u0 + 1, -y - z, [(u0, x + y + z), (u1, x*y + x*z + y*z), (u2, x*y*z)]) assert symmetrize([1, 2, 3]) == [(1, 0), (2, 0), (3, 0)] assert symmetrize([1, 2, 3], formal=True) == ([(1, 0), (2, 0), (3, 0)], []) assert symmetrize([x + y, x - y]) == [(x + y, 0), (x + y, -2*y)] def test_horner(): assert horner(0) == 0 assert horner(1) == 1 assert horner(x) == x assert horner(x + 1) == x + 1 assert horner(x**2 + 1) == x**2 + 1 assert horner(x**2 + x) == (x + 1)*x assert horner(x**2 + x + 1) == (x + 1)*x + 1 assert horner( 9*x**4 + 8*x**3 + 7*x**2 + 6*x + 5) == (((9*x + 8)*x + 7)*x + 6)*x + 5 assert horner( a*x**4 + b*x**3 + c*x**2 + d*x + e) == (((a*x + b)*x + c)*x + d)*x + e assert horner(4*x**2*y**2 + 2*x**2*y + 2*x*y**2 + x*y, wrt=x) == (( 4*y + 2)*x*y + (2*y + 1)*y)*x assert horner(4*x**2*y**2 + 2*x**2*y + 2*x*y**2 + x*y, wrt=y) == (( 4*x + 2)*y*x + (2*x + 1)*x)*y def test_interpolate(): assert interpolate([1, 4, 9, 16], x) == x**2 assert interpolate([1, 4, 9, 25], x) == S(3)*x**3/2 - S(8)*x**2 + S(33)*x/2 - 9 assert interpolate([(1, 1), (2, 4), (3, 9)], x) == x**2 assert interpolate([(1, 2), (2, 5), (3, 10)], x) == 1 + x**2 assert interpolate({1: 2, 2: 5, 3: 10}, x) == 1 + x**2 assert interpolate({5: 2, 7: 5, 8: 10, 9: 13}, x) == \ -S(13)*x**3/24 + S(12)*x**2 - S(2003)*x/24 + 187 assert interpolate([(1, 3), (0, 6), (2, 5), (5, 7), (-2, 4)], x) == \ S(-61)*x**4/280 + S(247)*x**3/210 + S(139)*x**2/280 - S(1871)*x/420 + 6 assert interpolate((9, 4, 9), 3) == 9 assert interpolate((1, 9, 16), 1) is S.One assert interpolate(((x, 1), (2, 3)), x) is S.One assert interpolate(dict([(x, 1), (2, 3)]), x) is S.One assert interpolate(((2, x), (1, 3)), x) == x**2 - 4*x + 6 def test_rational_interpolate(): x, y = symbols('x,y') xdata = [1, 2, 3, 4, 5, 6] ydata1 = [120, 150, 200, 255, 312, 370] ydata2 = [-210, -35, 105, 231, 350, 465] assert rational_interpolate(list(zip(xdata, ydata1)), 2) == ( (60*x**2 + 60)/x ) assert rational_interpolate(list(zip(xdata, ydata1)), 3) == ( (60*x**2 + 60)/x ) assert rational_interpolate(list(zip(xdata, ydata2)), 2, X=y) == ( (105*y**2 - 525)/(y + 1) ) xdata = list(range(1,11)) ydata = [-1923885361858460, -5212158811973685, -9838050145867125, -15662936261217245, -22469424125057910, -30073793365223685, -38332297297028735, -47132954289530109, -56387719094026320, -66026548943876885] assert rational_interpolate(list(zip(xdata, ydata)), 5) == ( (-12986226192544605*x**4 + 8657484128363070*x**3 - 30301194449270745*x**2 + 4328742064181535*x - 4328742064181535)/(x**3 + 9*x**2 - 3*x + 11)) def test_viete(): r1, r2 = symbols('r1, r2') assert viete( a*x**2 + b*x + c, [r1, r2], x) == [(r1 + r2, -b/a), (r1*r2, c/a)] raises(ValueError, lambda: viete(1, [], x)) raises(ValueError, lambda: viete(x**2 + 1, [r1])) raises(MultivariatePolynomialError, lambda: viete(x + y, [r1]))
40974c2d5bd03a23e6f1962be0e11257bd5de4083d41c2b574c52462fde9639a
"""Tests for square-free decomposition algorithms and related tools. """ from sympy.polys.rings import ring from sympy.polys.domains import FF, ZZ, QQ from sympy.polys.specialpolys import f_polys from sympy.testing.pytest import raises f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_polys() def test_dup_sqf(): R, x = ring("x", ZZ) assert R.dup_sqf_part(0) == 0 assert R.dup_sqf_p(0) is True assert R.dup_sqf_part(7) == 1 assert R.dup_sqf_p(7) is True assert R.dup_sqf_part(2*x + 2) == x + 1 assert R.dup_sqf_p(2*x + 2) is True assert R.dup_sqf_part(x**3 + x + 1) == x**3 + x + 1 assert R.dup_sqf_p(x**3 + x + 1) is True assert R.dup_sqf_part(-x**3 + x + 1) == x**3 - x - 1 assert R.dup_sqf_p(-x**3 + x + 1) is True assert R.dup_sqf_part(2*x**3 + 3*x**2) == 2*x**2 + 3*x assert R.dup_sqf_p(2*x**3 + 3*x**2) is False assert R.dup_sqf_part(-2*x**3 + 3*x**2) == 2*x**2 - 3*x assert R.dup_sqf_p(-2*x**3 + 3*x**2) is False assert R.dup_sqf_list(0) == (0, []) assert R.dup_sqf_list(1) == (1, []) assert R.dup_sqf_list(x) == (1, [(x, 1)]) assert R.dup_sqf_list(2*x**2) == (2, [(x, 2)]) assert R.dup_sqf_list(3*x**3) == (3, [(x, 3)]) assert R.dup_sqf_list(-x**5 + x**4 + x - 1) == \ (-1, [(x**3 + x**2 + x + 1, 1), (x - 1, 2)]) assert R.dup_sqf_list(x**8 + 6*x**6 + 12*x**4 + 8*x**2) == \ ( 1, [(x, 2), (x**2 + 2, 3)]) assert R.dup_sqf_list(2*x**2 + 4*x + 2) == (2, [(x + 1, 2)]) R, x = ring("x", QQ) assert R.dup_sqf_list(2*x**2 + 4*x + 2) == (2, [(x + 1, 2)]) R, x = ring("x", FF(2)) assert R.dup_sqf_list(x**2 + 1) == (1, [(x + 1, 2)]) R, x = ring("x", FF(3)) assert R.dup_sqf_list(x**10 + 2*x**7 + 2*x**4 + x) == \ (1, [(x, 1), (x + 1, 3), (x + 2, 6)]) R1, x = ring("x", ZZ) R2, y = ring("y", FF(3)) f = x**3 + 1 g = y**3 + 1 assert R1.dup_sqf_part(f) == f assert R2.dup_sqf_part(g) == y + 1 assert R1.dup_sqf_p(f) is True assert R2.dup_sqf_p(g) is False R, x, y = ring("x,y", ZZ) A = x**4 - 3*x**2 + 6 D = x**6 - 5*x**4 + 5*x**2 + 4 f, g = D, R.dmp_sub(A, R.dmp_mul(R.dmp_diff(D, 1), y)) res = R.dmp_resultant(f, g) h = (4*y**2 + 1).drop(x) assert R.drop(x).dup_sqf_list(res) == (45796, [(h, 3)]) Rt, t = ring("t", ZZ) R, x = ring("x", Rt) assert R.dup_sqf_list_include(t**3*x**2) == [(t**3, 1), (x, 2)] def test_dmp_sqf(): R, x, y = ring("x,y", ZZ) assert R.dmp_sqf_part(0) == 0 assert R.dmp_sqf_p(0) is True assert R.dmp_sqf_part(7) == 1 assert R.dmp_sqf_p(7) is True assert R.dmp_sqf_list(3) == (3, []) assert R.dmp_sqf_list_include(3) == [(3, 1)] R, x, y, z = ring("x,y,z", ZZ) assert R.dmp_sqf_p(f_0) is True assert R.dmp_sqf_p(f_0**2) is False assert R.dmp_sqf_p(f_1) is True assert R.dmp_sqf_p(f_1**2) is False assert R.dmp_sqf_p(f_2) is True assert R.dmp_sqf_p(f_2**2) is False assert R.dmp_sqf_p(f_3) is True assert R.dmp_sqf_p(f_3**2) is False assert R.dmp_sqf_p(f_5) is False assert R.dmp_sqf_p(f_5**2) is False assert R.dmp_sqf_p(f_4) is True assert R.dmp_sqf_part(f_4) == -f_4 assert R.dmp_sqf_part(f_5) == x + y - z R, x, y, z, t = ring("x,y,z,t", ZZ) assert R.dmp_sqf_p(f_6) is True assert R.dmp_sqf_part(f_6) == f_6 R, x = ring("x", ZZ) f = -x**5 + x**4 + x - 1 assert R.dmp_sqf_list(f) == (-1, [(x**3 + x**2 + x + 1, 1), (x - 1, 2)]) assert R.dmp_sqf_list_include(f) == [(-x**3 - x**2 - x - 1, 1), (x - 1, 2)] R, x, y = ring("x,y", ZZ) f = -x**5 + x**4 + x - 1 assert R.dmp_sqf_list(f) == (-1, [(x**3 + x**2 + x + 1, 1), (x - 1, 2)]) assert R.dmp_sqf_list_include(f) == [(-x**3 - x**2 - x - 1, 1), (x - 1, 2)] f = -x**2 + 2*x - 1 assert R.dmp_sqf_list_include(f) == [(-1, 1), (x - 1, 2)] R, x, y = ring("x,y", FF(2)) raises(NotImplementedError, lambda: R.dmp_sqf_list(y**2 + 1)) def test_dup_gff_list(): R, x = ring("x", ZZ) f = x**5 + 2*x**4 - x**3 - 2*x**2 assert R.dup_gff_list(f) == [(x, 1), (x + 2, 4)] g = x**9 - 20*x**8 + 166*x**7 - 744*x**6 + 1965*x**5 - 3132*x**4 + 2948*x**3 - 1504*x**2 + 320*x assert R.dup_gff_list(g) == [(x**2 - 5*x + 4, 1), (x**2 - 5*x + 4, 2), (x, 3)] raises(ValueError, lambda: R.dup_gff_list(0))
7579a3868cd7e58cdbec3b2bb5b7454ea0318bd675519349bc6c63faf1ccedc3
"""Tests for sparse distributed modules. """ from sympy.polys.distributedmodules import ( sdm_monomial_mul, sdm_monomial_deg, sdm_monomial_divides, sdm_add, sdm_LM, sdm_LT, sdm_mul_term, sdm_zero, sdm_deg, sdm_LC, sdm_from_dict, sdm_spoly, sdm_ecart, sdm_nf_mora, sdm_groebner, sdm_from_vector, sdm_to_vector, sdm_monomial_lcm ) from sympy.polys.orderings import lex, grlex, InverseOrder from sympy.polys.domains import QQ from sympy.abc import x, y, z def test_sdm_monomial_mul(): assert sdm_monomial_mul((1, 1, 0), (1, 3)) == (1, 2, 3) def test_sdm_monomial_deg(): assert sdm_monomial_deg((5, 2, 1)) == 3 def test_sdm_monomial_lcm(): assert sdm_monomial_lcm((1, 2, 3), (1, 5, 0)) == (1, 5, 3) def test_sdm_monomial_divides(): assert sdm_monomial_divides((1, 0, 0), (1, 0, 0)) is True assert sdm_monomial_divides((1, 0, 0), (1, 2, 1)) is True assert sdm_monomial_divides((5, 1, 1), (5, 2, 1)) is True assert sdm_monomial_divides((1, 0, 0), (2, 0, 0)) is False assert sdm_monomial_divides((1, 1, 0), (1, 0, 0)) is False assert sdm_monomial_divides((5, 1, 2), (5, 0, 1)) is False def test_sdm_LC(): assert sdm_LC([((1, 2, 3), QQ(5))], QQ) == QQ(5) def test_sdm_from_dict(): dic = {(1, 2, 1, 1): QQ(1), (1, 1, 2, 1): QQ(1), (1, 0, 2, 1): QQ(1), (1, 0, 0, 3): QQ(1), (1, 1, 1, 0): QQ(1)} assert sdm_from_dict(dic, grlex) == \ [((1, 2, 1, 1), QQ(1)), ((1, 1, 2, 1), QQ(1)), ((1, 0, 2, 1), QQ(1)), ((1, 0, 0, 3), QQ(1)), ((1, 1, 1, 0), QQ(1))] # TODO test to_dict? def test_sdm_add(): assert sdm_add([((1, 1, 1), QQ(1))], [((2, 0, 0), QQ(1))], lex, QQ) == \ [((2, 0, 0), QQ(1)), ((1, 1, 1), QQ(1))] assert sdm_add([((1, 1, 1), QQ(1))], [((1, 1, 1), QQ(-1))], lex, QQ) == [] assert sdm_add([((1, 0, 0), QQ(1))], [((1, 0, 0), QQ(2))], lex, QQ) == \ [((1, 0, 0), QQ(3))] assert sdm_add([((1, 0, 1), QQ(1))], [((1, 1, 0), QQ(1))], lex, QQ) == \ [((1, 1, 0), QQ(1)), ((1, 0, 1), QQ(1))] def test_sdm_LM(): dic = {(1, 2, 3): QQ(1), (4, 0, 0): QQ(1), (4, 0, 1): QQ(1)} assert sdm_LM(sdm_from_dict(dic, lex)) == (4, 0, 1) def test_sdm_LT(): dic = {(1, 2, 3): QQ(1), (4, 0, 0): QQ(2), (4, 0, 1): QQ(3)} assert sdm_LT(sdm_from_dict(dic, lex)) == ((4, 0, 1), QQ(3)) def test_sdm_mul_term(): assert sdm_mul_term([((1, 0, 0), QQ(1))], ((0, 0), QQ(0)), lex, QQ) == [] assert sdm_mul_term([], ((1, 0), QQ(1)), lex, QQ) == [] assert sdm_mul_term([((1, 0, 0), QQ(1))], ((1, 0), QQ(1)), lex, QQ) == \ [((1, 1, 0), QQ(1))] f = [((2, 0, 1), QQ(4)), ((1, 1, 0), QQ(3))] assert sdm_mul_term(f, ((1, 1), QQ(2)), lex, QQ) == \ [((2, 1, 2), QQ(8)), ((1, 2, 1), QQ(6))] def test_sdm_zero(): assert sdm_zero() == [] def test_sdm_deg(): assert sdm_deg([((1, 2, 3), 1), ((10, 0, 1), 1), ((2, 3, 4), 4)]) == 7 def test_sdm_spoly(): f = [((2, 1, 1), QQ(1)), ((1, 0, 1), QQ(1))] g = [((2, 3, 0), QQ(1))] h = [((1, 2, 3), QQ(1))] assert sdm_spoly(f, h, lex, QQ) == [] assert sdm_spoly(f, g, lex, QQ) == [((1, 2, 1), QQ(1))] def test_sdm_ecart(): assert sdm_ecart([((1, 2, 3), 1), ((1, 0, 1), 1)]) == 0 assert sdm_ecart([((2, 2, 1), 1), ((1, 5, 1), 1)]) == 3 def test_sdm_nf_mora(): f = sdm_from_dict({(1, 2, 1, 1): QQ(1), (1, 1, 2, 1): QQ(1), (1, 0, 2, 1): QQ(1), (1, 0, 0, 3): QQ(1), (1, 1, 1, 0): QQ(1)}, grlex) f1 = sdm_from_dict({(1, 1, 1, 0): QQ(1), (1, 0, 2, 0): QQ(1), (1, 0, 0, 0): QQ(-1)}, grlex) f2 = sdm_from_dict({(1, 1, 1, 0): QQ(1)}, grlex) (id0, id1, id2) = [sdm_from_dict({(i, 0, 0, 0): QQ(1)}, grlex) for i in range(3)] assert sdm_nf_mora(f, [f1, f2], grlex, QQ, phantom=(id0, [id1, id2])) == \ ([((1, 0, 2, 1), QQ(1)), ((1, 0, 0, 3), QQ(1)), ((1, 1, 1, 0), QQ(1)), ((1, 1, 0, 1), QQ(1))], [((1, 1, 0, 1), QQ(-1)), ((0, 0, 0, 0), QQ(1))]) assert sdm_nf_mora(f, [f2, f1], grlex, QQ, phantom=(id0, [id2, id1])) == \ ([((1, 0, 2, 1), QQ(1)), ((1, 0, 0, 3), QQ(1)), ((1, 1, 1, 0), QQ(1))], [((2, 1, 0, 1), QQ(-1)), ((2, 0, 1, 1), QQ(-1)), ((0, 0, 0, 0), QQ(1))]) f = sdm_from_vector([x*z, y**2 + y*z - z, y], lex, QQ, gens=[x, y, z]) f1 = sdm_from_vector([x, y, 1], lex, QQ, gens=[x, y, z]) f2 = sdm_from_vector([x*y, z, z**2], lex, QQ, gens=[x, y, z]) assert sdm_nf_mora(f, [f1, f2], lex, QQ) == \ sdm_nf_mora(f, [f2, f1], lex, QQ) == \ [((1, 0, 1, 1), QQ(1)), ((1, 0, 0, 1), QQ(-1)), ((0, 1, 1, 0), QQ(-1)), ((0, 1, 0, 1), QQ(1))] def test_conversion(): f = [x**2 + y**2, 2*z] g = [((1, 0, 0, 1), QQ(2)), ((0, 2, 0, 0), QQ(1)), ((0, 0, 2, 0), QQ(1))] assert sdm_to_vector(g, [x, y, z], QQ) == f assert sdm_from_vector(f, lex, QQ) == g assert sdm_from_vector( [x, 1], lex, QQ) == [((1, 0), QQ(1)), ((0, 1), QQ(1))] assert sdm_to_vector([((1, 1, 0, 0), 1)], [x, y, z], QQ, n=3) == [0, x, 0] assert sdm_from_vector([0, 0], lex, QQ, gens=[x, y]) == sdm_zero() def test_nontrivial(): gens = [x, y, z] def contains(I, f): S = [sdm_from_vector([g], lex, QQ, gens=gens) for g in I] G = sdm_groebner(S, sdm_nf_mora, lex, QQ) return sdm_nf_mora(sdm_from_vector([f], lex, QQ, gens=gens), G, lex, QQ) == sdm_zero() assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**3) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4 + y**3 + 2*z*y*x) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y*z) assert contains([x, 1 + x + y, 5 - 7*y], 1) assert contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**3) assert not contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**2 + y**2) # compare local order assert not contains([x*(1 + x + y), y*(1 + z)], x) assert not contains([x*(1 + x + y), y*(1 + z)], x + y) def test_local(): igrlex = InverseOrder(grlex) gens = [x, y, z] def contains(I, f): S = [sdm_from_vector([g], igrlex, QQ, gens=gens) for g in I] G = sdm_groebner(S, sdm_nf_mora, igrlex, QQ) return sdm_nf_mora(sdm_from_vector([f], lex, QQ, gens=gens), G, lex, QQ) == sdm_zero() assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x*(1 + x + y), y*(1 + z)], x) assert contains([x*(1 + x + y), y*(1 + z)], x + y) def test_uncovered_line(): gens = [x, y] f1 = sdm_zero() f2 = sdm_from_vector([x, 0], lex, QQ, gens=gens) f3 = sdm_from_vector([0, y], lex, QQ, gens=gens) assert sdm_spoly(f1, f2, lex, QQ) == sdm_zero() assert sdm_spoly(f3, f2, lex, QQ) == sdm_zero() def test_chain_criterion(): gens = [x] f1 = sdm_from_vector([1, x], grlex, QQ, gens=gens) f2 = sdm_from_vector([0, x - 2], grlex, QQ, gens=gens) assert len(sdm_groebner([f1, f2], sdm_nf_mora, grlex, QQ)) == 2
8a4c704910035e8077c3ceb26b3d196a5844d485914f88e2cb070a201ce56645
"""Test sparse rational functions. """ from sympy.polys.fields import field, sfield, FracField, FracElement from sympy.polys.rings import ring from sympy.polys.domains import ZZ, QQ from sympy.polys.orderings import lex from sympy.testing.pytest import raises, XFAIL from sympy.core import symbols, E from sympy import sqrt, Rational, exp, log def test_FracField___init__(): F1 = FracField("x,y", ZZ, lex) F2 = FracField("x,y", ZZ, lex) F3 = FracField("x,y,z", ZZ, lex) assert F1.x == F1.gens[0] assert F1.y == F1.gens[1] assert F1.x == F2.x assert F1.y == F2.y assert F1.x != F3.x assert F1.y != F3.y def test_FracField___hash__(): F, x, y, z = field("x,y,z", QQ) assert hash(F) def test_FracField___eq__(): assert field("x,y,z", QQ)[0] == field("x,y,z", QQ)[0] assert field("x,y,z", QQ)[0] is field("x,y,z", QQ)[0] assert field("x,y,z", QQ)[0] != field("x,y,z", ZZ)[0] assert field("x,y,z", QQ)[0] is not field("x,y,z", ZZ)[0] assert field("x,y,z", ZZ)[0] != field("x,y,z", QQ)[0] assert field("x,y,z", ZZ)[0] is not field("x,y,z", QQ)[0] assert field("x,y,z", QQ)[0] != field("x,y", QQ)[0] assert field("x,y,z", QQ)[0] is not field("x,y", QQ)[0] assert field("x,y", QQ)[0] != field("x,y,z", QQ)[0] assert field("x,y", QQ)[0] is not field("x,y,z", QQ)[0] def test_sfield(): x = symbols("x") F = FracField((E, exp(exp(x)), exp(x)), ZZ, lex) e, exex, ex = F.gens assert sfield(exp(x)*exp(exp(x) + 1 + log(exp(x) + 3)/2)**2/(exp(x) + 3)) \ == (F, e**2*exex**2*ex) F = FracField((x, exp(1/x), log(x), x**QQ(1, 3)), ZZ, lex) _, ex, lg, x3 = F.gens assert sfield(((x-3)*log(x)+4*x**2)*exp(1/x+log(x)/3)/x**2) == \ (F, (4*F.x**2*ex + F.x*ex*lg - 3*ex*lg)/x3**5) F = FracField((x, log(x), sqrt(x + log(x))), ZZ, lex) _, lg, srt = F.gens assert sfield((x + 1) / (x * (x + log(x))**QQ(3, 2)) - 1/(x * log(x)**2)) \ == (F, (F.x*lg**2 - F.x*srt + lg**2 - lg*srt)/ (F.x**2*lg**2*srt + F.x*lg**3*srt)) def test_FracElement___hash__(): F, x, y, z = field("x,y,z", QQ) assert hash(x*y/z) def test_FracElement_copy(): F, x, y, z = field("x,y,z", ZZ) f = x*y/3*z g = f.copy() assert f == g g.numer[(1, 1, 1)] = 7 assert f != g def test_FracElement_as_expr(): F, x, y, z = field("x,y,z", ZZ) f = (3*x**2*y - x*y*z)/(7*z**3 + 1) X, Y, Z = F.symbols g = (3*X**2*Y - X*Y*Z)/(7*Z**3 + 1) assert f != g assert f.as_expr() == g X, Y, Z = symbols("x,y,z") g = (3*X**2*Y - X*Y*Z)/(7*Z**3 + 1) assert f != g assert f.as_expr(X, Y, Z) == g raises(ValueError, lambda: f.as_expr(X)) def test_FracElement_from_expr(): x, y, z = symbols("x,y,z") F, X, Y, Z = field((x, y, z), ZZ) f = F.from_expr(1) assert f == 1 and isinstance(f, F.dtype) f = F.from_expr(Rational(3, 7)) assert f == F(3)/7 and isinstance(f, F.dtype) f = F.from_expr(x) assert f == X and isinstance(f, F.dtype) f = F.from_expr(Rational(3,7)*x) assert f == X*Rational(3, 7) and isinstance(f, F.dtype) f = F.from_expr(1/x) assert f == 1/X and isinstance(f, F.dtype) f = F.from_expr(x*y*z) assert f == X*Y*Z and isinstance(f, F.dtype) f = F.from_expr(x*y/z) assert f == X*Y/Z and isinstance(f, F.dtype) f = F.from_expr(x*y*z + x*y + x) assert f == X*Y*Z + X*Y + X and isinstance(f, F.dtype) f = F.from_expr((x*y*z + x*y + x)/(x*y + 7)) assert f == (X*Y*Z + X*Y + X)/(X*Y + 7) and isinstance(f, F.dtype) f = F.from_expr(x**3*y*z + x**2*y**7 + 1) assert f == X**3*Y*Z + X**2*Y**7 + 1 and isinstance(f, F.dtype) raises(ValueError, lambda: F.from_expr(2**x)) raises(ValueError, lambda: F.from_expr(7*x + sqrt(2))) assert isinstance(ZZ[2**x].get_field().convert(2**(-x)), FracElement) assert isinstance(ZZ[x**2].get_field().convert(x**(-6)), FracElement) assert isinstance(ZZ[exp(Rational(1, 3))].get_field().convert(E), FracElement) def test_FracElement__lt_le_gt_ge__(): F, x, y = field("x,y", ZZ) assert F(1) < 1/x < 1/x**2 < 1/x**3 assert F(1) <= 1/x <= 1/x**2 <= 1/x**3 assert -7/x < 1/x < 3/x < y/x < 1/x**2 assert -7/x <= 1/x <= 3/x <= y/x <= 1/x**2 assert 1/x**3 > 1/x**2 > 1/x > F(1) assert 1/x**3 >= 1/x**2 >= 1/x >= F(1) assert 1/x**2 > y/x > 3/x > 1/x > -7/x assert 1/x**2 >= y/x >= 3/x >= 1/x >= -7/x def test_FracElement___neg__(): F, x,y = field("x,y", QQ) f = (7*x - 9)/y g = (-7*x + 9)/y assert -f == g assert -g == f def test_FracElement___add__(): F, x,y = field("x,y", QQ) f, g = 1/x, 1/y assert f + g == g + f == (x + y)/(x*y) assert x + F.ring.gens[0] == F.ring.gens[0] + x == 2*x F, x,y = field("x,y", ZZ) assert x + 3 == 3 + x assert x + QQ(3,7) == QQ(3,7) + x == (7*x + 3)/7 Fuv, u,v = field("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Fuv) f = (u*v + x)/(y + u*v) assert dict(f.numer) == {(1, 0, 0, 0): 1, (0, 0, 0, 0): u*v} assert dict(f.denom) == {(0, 1, 0, 0): 1, (0, 0, 0, 0): u*v} Ruv, u,v = ring("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Ruv) f = (u*v + x)/(y + u*v) assert dict(f.numer) == {(1, 0, 0, 0): 1, (0, 0, 0, 0): u*v} assert dict(f.denom) == {(0, 1, 0, 0): 1, (0, 0, 0, 0): u*v} def test_FracElement___sub__(): F, x,y = field("x,y", QQ) f, g = 1/x, 1/y assert f - g == (-x + y)/(x*y) assert x - F.ring.gens[0] == F.ring.gens[0] - x == 0 F, x,y = field("x,y", ZZ) assert x - 3 == -(3 - x) assert x - QQ(3,7) == -(QQ(3,7) - x) == (7*x - 3)/7 Fuv, u,v = field("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Fuv) f = (u*v - x)/(y - u*v) assert dict(f.numer) == {(1, 0, 0, 0):-1, (0, 0, 0, 0): u*v} assert dict(f.denom) == {(0, 1, 0, 0): 1, (0, 0, 0, 0):-u*v} Ruv, u,v = ring("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Ruv) f = (u*v - x)/(y - u*v) assert dict(f.numer) == {(1, 0, 0, 0):-1, (0, 0, 0, 0): u*v} assert dict(f.denom) == {(0, 1, 0, 0): 1, (0, 0, 0, 0):-u*v} def test_FracElement___mul__(): F, x,y = field("x,y", QQ) f, g = 1/x, 1/y assert f*g == g*f == 1/(x*y) assert x*F.ring.gens[0] == F.ring.gens[0]*x == x**2 F, x,y = field("x,y", ZZ) assert x*3 == 3*x assert x*QQ(3,7) == QQ(3,7)*x == x*Rational(3, 7) Fuv, u,v = field("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Fuv) f = ((u + 1)*x*y + 1)/((v - 1)*z - t*u*v - 1) assert dict(f.numer) == {(1, 1, 0, 0): u + 1, (0, 0, 0, 0): 1} assert dict(f.denom) == {(0, 0, 1, 0): v - 1, (0, 0, 0, 1): -u*v, (0, 0, 0, 0): -1} Ruv, u,v = ring("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Ruv) f = ((u + 1)*x*y + 1)/((v - 1)*z - t*u*v - 1) assert dict(f.numer) == {(1, 1, 0, 0): u + 1, (0, 0, 0, 0): 1} assert dict(f.denom) == {(0, 0, 1, 0): v - 1, (0, 0, 0, 1): -u*v, (0, 0, 0, 0): -1} def test_FracElement___div__(): F, x,y = field("x,y", QQ) f, g = 1/x, 1/y assert f/g == y/x assert x/F.ring.gens[0] == F.ring.gens[0]/x == 1 F, x,y = field("x,y", ZZ) assert x*3 == 3*x assert x/QQ(3,7) == (QQ(3,7)/x)**-1 == x*Rational(7, 3) raises(ZeroDivisionError, lambda: x/0) raises(ZeroDivisionError, lambda: 1/(x - x)) raises(ZeroDivisionError, lambda: x/(x - x)) Fuv, u,v = field("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Fuv) f = (u*v)/(x*y) assert dict(f.numer) == {(0, 0, 0, 0): u*v} assert dict(f.denom) == {(1, 1, 0, 0): 1} g = (x*y)/(u*v) assert dict(g.numer) == {(1, 1, 0, 0): 1} assert dict(g.denom) == {(0, 0, 0, 0): u*v} Ruv, u,v = ring("u,v", ZZ) Fxyzt, x,y,z,t = field("x,y,z,t", Ruv) f = (u*v)/(x*y) assert dict(f.numer) == {(0, 0, 0, 0): u*v} assert dict(f.denom) == {(1, 1, 0, 0): 1} g = (x*y)/(u*v) assert dict(g.numer) == {(1, 1, 0, 0): 1} assert dict(g.denom) == {(0, 0, 0, 0): u*v} def test_FracElement___pow__(): F, x,y = field("x,y", QQ) f, g = 1/x, 1/y assert f**3 == 1/x**3 assert g**3 == 1/y**3 assert (f*g)**3 == 1/(x**3*y**3) assert (f*g)**-3 == (x*y)**3 raises(ZeroDivisionError, lambda: (x - x)**-3) def test_FracElement_diff(): F, x,y,z = field("x,y,z", ZZ) assert ((x**2 + y)/(z + 1)).diff(x) == 2*x/(z + 1) @XFAIL def test_FracElement___call__(): F, x,y,z = field("x,y,z", ZZ) f = (x**2 + 3*y)/z r = f(1, 1, 1) assert r == 4 and not isinstance(r, FracElement) raises(ZeroDivisionError, lambda: f(1, 1, 0)) def test_FracElement_evaluate(): F, x,y,z = field("x,y,z", ZZ) Fyz = field("y,z", ZZ)[0] f = (x**2 + 3*y)/z assert f.evaluate(x, 0) == 3*Fyz.y/Fyz.z raises(ZeroDivisionError, lambda: f.evaluate(z, 0)) def test_FracElement_subs(): F, x,y,z = field("x,y,z", ZZ) f = (x**2 + 3*y)/z assert f.subs(x, 0) == 3*y/z raises(ZeroDivisionError, lambda: f.subs(z, 0)) def test_FracElement_compose(): pass
7fac22c4b323d782933291640fc0184ccce9d23adf1579a7acc0992497110cc0
"""Tests for the implementation of RootOf class and related tools. """ from sympy.polys.polytools import Poly from sympy.polys.rootoftools import (rootof, RootOf, CRootOf, RootSum, _pure_key_dict as D) from sympy.polys.polyerrors import ( MultivariatePolynomialError, GeneratorsNeeded, PolynomialError, ) from sympy import ( S, sqrt, I, Rational, Float, Lambda, log, exp, tan, Function, Eq, solve, legendre_poly, Integral ) from sympy.testing.pytest import raises, slow from sympy.core.expr import unchanged from sympy.abc import a, b, x, y, z, r def test_CRootOf___new__(): assert rootof(x, 0) == 0 assert rootof(x, -1) == 0 assert rootof(x, S.Zero) == 0 assert rootof(x - 1, 0) == 1 assert rootof(x - 1, -1) == 1 assert rootof(x + 1, 0) == -1 assert rootof(x + 1, -1) == -1 assert rootof(x**2 + 2*x + 3, 0) == -1 - I*sqrt(2) assert rootof(x**2 + 2*x + 3, 1) == -1 + I*sqrt(2) assert rootof(x**2 + 2*x + 3, -1) == -1 + I*sqrt(2) assert rootof(x**2 + 2*x + 3, -2) == -1 - I*sqrt(2) r = rootof(x**2 + 2*x + 3, 0, radicals=False) assert isinstance(r, RootOf) is True r = rootof(x**2 + 2*x + 3, 1, radicals=False) assert isinstance(r, RootOf) is True r = rootof(x**2 + 2*x + 3, -1, radicals=False) assert isinstance(r, RootOf) is True r = rootof(x**2 + 2*x + 3, -2, radicals=False) assert isinstance(r, RootOf) is True assert rootof((x - 1)*(x + 1), 0, radicals=False) == -1 assert rootof((x - 1)*(x + 1), 1, radicals=False) == 1 assert rootof((x - 1)*(x + 1), -1, radicals=False) == 1 assert rootof((x - 1)*(x + 1), -2, radicals=False) == -1 assert rootof((x - 1)*(x + 1), 0, radicals=True) == -1 assert rootof((x - 1)*(x + 1), 1, radicals=True) == 1 assert rootof((x - 1)*(x + 1), -1, radicals=True) == 1 assert rootof((x - 1)*(x + 1), -2, radicals=True) == -1 assert rootof((x - 1)*(x**3 + x + 3), 0) == rootof(x**3 + x + 3, 0) assert rootof((x - 1)*(x**3 + x + 3), 1) == 1 assert rootof((x - 1)*(x**3 + x + 3), 2) == rootof(x**3 + x + 3, 1) assert rootof((x - 1)*(x**3 + x + 3), 3) == rootof(x**3 + x + 3, 2) assert rootof((x - 1)*(x**3 + x + 3), -1) == rootof(x**3 + x + 3, 2) assert rootof((x - 1)*(x**3 + x + 3), -2) == rootof(x**3 + x + 3, 1) assert rootof((x - 1)*(x**3 + x + 3), -3) == 1 assert rootof((x - 1)*(x**3 + x + 3), -4) == rootof(x**3 + x + 3, 0) assert rootof(x**4 + 3*x**3, 0) == -3 assert rootof(x**4 + 3*x**3, 1) == 0 assert rootof(x**4 + 3*x**3, 2) == 0 assert rootof(x**4 + 3*x**3, 3) == 0 raises(GeneratorsNeeded, lambda: rootof(0, 0)) raises(GeneratorsNeeded, lambda: rootof(1, 0)) raises(PolynomialError, lambda: rootof(Poly(0, x), 0)) raises(PolynomialError, lambda: rootof(Poly(1, x), 0)) raises(PolynomialError, lambda: rootof(x - y, 0)) # issue 8617 raises(PolynomialError, lambda: rootof(exp(x), 0)) raises(NotImplementedError, lambda: rootof(x**3 - x + sqrt(2), 0)) raises(NotImplementedError, lambda: rootof(x**3 - x + I, 0)) raises(IndexError, lambda: rootof(x**2 - 1, -4)) raises(IndexError, lambda: rootof(x**2 - 1, -3)) raises(IndexError, lambda: rootof(x**2 - 1, 2)) raises(IndexError, lambda: rootof(x**2 - 1, 3)) raises(ValueError, lambda: rootof(x**2 - 1, x)) assert rootof(Poly(x - y, x), 0) == y assert rootof(Poly(x**2 - y, x), 0) == -sqrt(y) assert rootof(Poly(x**2 - y, x), 1) == sqrt(y) assert rootof(Poly(x**3 - y, x), 0) == y**Rational(1, 3) assert rootof(y*x**3 + y*x + 2*y, x, 0) == -1 raises(NotImplementedError, lambda: rootof(x**3 + x + 2*y, x, 0)) assert rootof(x**3 + x + 1, 0).is_commutative is True def test_CRootOf_attributes(): r = rootof(x**3 + x + 3, 0) assert r.is_number assert r.free_symbols == set() # if the following assertion fails then multivariate polynomials # are apparently supported and the RootOf.free_symbols routine # should be changed to return whatever symbols would not be # the PurePoly dummy symbol raises(NotImplementedError, lambda: rootof(Poly(x**3 + y*x + 1, x), 0)) def test_CRootOf___eq__(): assert (rootof(x**3 + x + 3, 0) == rootof(x**3 + x + 3, 0)) is True assert (rootof(x**3 + x + 3, 0) == rootof(x**3 + x + 3, 1)) is False assert (rootof(x**3 + x + 3, 1) == rootof(x**3 + x + 3, 1)) is True assert (rootof(x**3 + x + 3, 1) == rootof(x**3 + x + 3, 2)) is False assert (rootof(x**3 + x + 3, 2) == rootof(x**3 + x + 3, 2)) is True assert (rootof(x**3 + x + 3, 0) == rootof(y**3 + y + 3, 0)) is True assert (rootof(x**3 + x + 3, 0) == rootof(y**3 + y + 3, 1)) is False assert (rootof(x**3 + x + 3, 1) == rootof(y**3 + y + 3, 1)) is True assert (rootof(x**3 + x + 3, 1) == rootof(y**3 + y + 3, 2)) is False assert (rootof(x**3 + x + 3, 2) == rootof(y**3 + y + 3, 2)) is True def test_CRootOf___eval_Eq__(): f = Function('f') eq = x**3 + x + 3 r = rootof(eq, 2) r1 = rootof(eq, 1) assert Eq(r, r1) is S.false assert Eq(r, r) is S.true assert unchanged(Eq, r, x) assert Eq(r, 0) is S.false assert Eq(r, S.Infinity) is S.false assert Eq(r, I) is S.false assert unchanged(Eq, r, f(0)) sol = solve(eq) for s in sol: if s.is_real: assert Eq(r, s) is S.false r = rootof(eq, 0) for s in sol: if s.is_real: assert Eq(r, s) is S.true eq = x**3 + x + 1 sol = solve(eq) assert [Eq(rootof(eq, i), j) for i in range(3) for j in sol] == [ False, False, True, False, True, False, True, False, False] assert Eq(rootof(eq, 0), 1 + S.ImaginaryUnit) == False def test_CRootOf_is_real(): assert rootof(x**3 + x + 3, 0).is_real is True assert rootof(x**3 + x + 3, 1).is_real is False assert rootof(x**3 + x + 3, 2).is_real is False def test_CRootOf_is_complex(): assert rootof(x**3 + x + 3, 0).is_complex is True def test_CRootOf_subs(): assert rootof(x**3 + x + 1, 0).subs(x, y) == rootof(y**3 + y + 1, 0) def test_CRootOf_diff(): assert rootof(x**3 + x + 1, 0).diff(x) == 0 assert rootof(x**3 + x + 1, 0).diff(y) == 0 @slow def test_CRootOf_evalf(): real = rootof(x**3 + x + 3, 0).evalf(n=20) assert real.epsilon_eq(Float("-1.2134116627622296341")) re, im = rootof(x**3 + x + 3, 1).evalf(n=20).as_real_imag() assert re.epsilon_eq( Float("0.60670583138111481707")) assert im.epsilon_eq(-Float("1.45061224918844152650")) re, im = rootof(x**3 + x + 3, 2).evalf(n=20).as_real_imag() assert re.epsilon_eq(Float("0.60670583138111481707")) assert im.epsilon_eq(Float("1.45061224918844152650")) p = legendre_poly(4, x, polys=True) roots = [str(r.n(17)) for r in p.real_roots()] # magnitudes are given by # sqrt(3/S(7) - 2*sqrt(6/S(5))/7) # and # sqrt(3/S(7) + 2*sqrt(6/S(5))/7) assert roots == [ "-0.86113631159405258", "-0.33998104358485626", "0.33998104358485626", "0.86113631159405258", ] re = rootof(x**5 - 5*x + 12, 0).evalf(n=20) assert re.epsilon_eq(Float("-1.84208596619025438271")) re, im = rootof(x**5 - 5*x + 12, 1).evalf(n=20).as_real_imag() assert re.epsilon_eq(Float("-0.351854240827371999559")) assert im.epsilon_eq(Float("-1.709561043370328882010")) re, im = rootof(x**5 - 5*x + 12, 2).evalf(n=20).as_real_imag() assert re.epsilon_eq(Float("-0.351854240827371999559")) assert im.epsilon_eq(Float("+1.709561043370328882010")) re, im = rootof(x**5 - 5*x + 12, 3).evalf(n=20).as_real_imag() assert re.epsilon_eq(Float("+1.272897223922499190910")) assert im.epsilon_eq(Float("-0.719798681483861386681")) re, im = rootof(x**5 - 5*x + 12, 4).evalf(n=20).as_real_imag() assert re.epsilon_eq(Float("+1.272897223922499190910")) assert im.epsilon_eq(Float("+0.719798681483861386681")) # issue 6393 assert str(rootof(x**5 + 2*x**4 + x**3 - 68719476736, 0).n(3)) == '147.' eq = (531441*x**11 + 3857868*x**10 + 13730229*x**9 + 32597882*x**8 + 55077472*x**7 + 60452000*x**6 + 32172064*x**5 - 4383808*x**4 - 11942912*x**3 - 1506304*x**2 + 1453312*x + 512) a, b = rootof(eq, 1).n(2).as_real_imag() c, d = rootof(eq, 2).n(2).as_real_imag() assert a == c assert b < d assert b == -d # issue 6451 r = rootof(legendre_poly(64, x), 7) assert r.n(2) == r.n(100).n(2) # issue 9019 r0 = rootof(x**2 + 1, 0, radicals=False) r1 = rootof(x**2 + 1, 1, radicals=False) assert r0.n(4) == -1.0*I assert r1.n(4) == 1.0*I # make sure verification is used in case a max/min traps the "root" assert str(rootof(4*x**5 + 16*x**3 + 12*x**2 + 7, 0).n(3)) == '-0.976' # watch out for UnboundLocalError c = CRootOf(90720*x**6 - 4032*x**4 + 84*x**2 - 1, 0) assert c._eval_evalf(2) # doesn't fail # watch out for imaginary parts that don't want to evaluate assert str(RootOf(x**16 + 32*x**14 + 508*x**12 + 5440*x**10 + 39510*x**8 + 204320*x**6 + 755548*x**4 + 1434496*x**2 + 877969, 10).n(2)) == '-3.4*I' assert abs(RootOf(x**4 + 10*x**2 + 1, 0).n(2)) < 0.4 # check reset and args r = [RootOf(x**3 + x + 3, i) for i in range(3)] r[0]._reset() for ri in r: i = ri._get_interval() ri.n(2) assert i != ri._get_interval() ri._reset() assert i == ri._get_interval() assert i == i.func(*i.args) def test_CRootOf_evalf_caching_bug(): r = rootof(x**5 - 5*x + 12, 1) r.n() a = r._get_interval() r = rootof(x**5 - 5*x + 12, 1) r.n() b = r._get_interval() assert a == b def test_CRootOf_real_roots(): assert Poly(x**5 + x + 1).real_roots() == [rootof(x**3 - x**2 + 1, 0)] assert Poly(x**5 + x + 1).real_roots(radicals=False) == [rootof( x**3 - x**2 + 1, 0)] def test_CRootOf_all_roots(): assert Poly(x**5 + x + 1).all_roots() == [ rootof(x**3 - x**2 + 1, 0), Rational(-1, 2) - sqrt(3)*I/2, Rational(-1, 2) + sqrt(3)*I/2, rootof(x**3 - x**2 + 1, 1), rootof(x**3 - x**2 + 1, 2), ] assert Poly(x**5 + x + 1).all_roots(radicals=False) == [ rootof(x**3 - x**2 + 1, 0), rootof(x**2 + x + 1, 0, radicals=False), rootof(x**2 + x + 1, 1, radicals=False), rootof(x**3 - x**2 + 1, 1), rootof(x**3 - x**2 + 1, 2), ] def test_CRootOf_eval_rational(): p = legendre_poly(4, x, polys=True) roots = [r.eval_rational(n=18) for r in p.real_roots()] for root in roots: assert isinstance(root, Rational) roots = [str(root.n(17)) for root in roots] assert roots == [ "-0.86113631159405258", "-0.33998104358485626", "0.33998104358485626", "0.86113631159405258", ] def test_RootSum___new__(): f = x**3 + x + 3 g = Lambda(r, log(r*x)) s = RootSum(f, g) assert isinstance(s, RootSum) is True assert RootSum(f**2, g) == 2*RootSum(f, g) assert RootSum((x - 7)*f**3, g) == log(7*x) + 3*RootSum(f, g) # issue 5571 assert hash(RootSum((x - 7)*f**3, g)) == hash(log(7*x) + 3*RootSum(f, g)) raises(MultivariatePolynomialError, lambda: RootSum(x**3 + x + y)) raises(ValueError, lambda: RootSum(x**2 + 3, lambda x: x)) assert RootSum(f, exp) == RootSum(f, Lambda(x, exp(x))) assert RootSum(f, log) == RootSum(f, Lambda(x, log(x))) assert isinstance(RootSum(f, auto=False), RootSum) is True assert RootSum(f) == 0 assert RootSum(f, Lambda(x, x)) == 0 assert RootSum(f, Lambda(x, x**2)) == -2 assert RootSum(f, Lambda(x, 1)) == 3 assert RootSum(f, Lambda(x, 2)) == 6 assert RootSum(f, auto=False).is_commutative is True assert RootSum(f, Lambda(x, 1/(x + x**2))) == Rational(11, 3) assert RootSum(f, Lambda(x, y/(x + x**2))) == Rational(11, 3)*y assert RootSum(x**2 - 1, Lambda(x, 3*x**2), x) == 6 assert RootSum(x**2 - y, Lambda(x, 3*x**2), x) == 6*y assert RootSum(x**2 - 1, Lambda(x, z*x**2), x) == 2*z assert RootSum(x**2 - y, Lambda(x, z*x**2), x) == 2*z*y assert RootSum( x**2 - 1, Lambda(x, exp(x)), quadratic=True) == exp(-1) + exp(1) assert RootSum(x**3 + a*x + a**3, tan, x) == \ RootSum(x**3 + x + 1, Lambda(x, tan(a*x))) assert RootSum(a**3*x**3 + a*x + 1, tan, x) == \ RootSum(x**3 + x + 1, Lambda(x, tan(x/a))) def test_RootSum_free_symbols(): assert RootSum(x**3 + x + 3, Lambda(r, exp(r))).free_symbols == set() assert RootSum(x**3 + x + 3, Lambda(r, exp(a*r))).free_symbols == {a} assert RootSum( x**3 + x + y, Lambda(r, exp(a*r)), x).free_symbols == {a, y} def test_RootSum___eq__(): f = Lambda(x, exp(x)) assert (RootSum(x**3 + x + 1, f) == RootSum(x**3 + x + 1, f)) is True assert (RootSum(x**3 + x + 1, f) == RootSum(y**3 + y + 1, f)) is True assert (RootSum(x**3 + x + 1, f) == RootSum(x**3 + x + 2, f)) is False assert (RootSum(x**3 + x + 1, f) == RootSum(y**3 + y + 2, f)) is False def test_RootSum_doit(): rs = RootSum(x**2 + 1, exp) assert isinstance(rs, RootSum) is True assert rs.doit() == exp(-I) + exp(I) rs = RootSum(x**2 + a, exp, x) assert isinstance(rs, RootSum) is True assert rs.doit() == exp(-sqrt(-a)) + exp(sqrt(-a)) def test_RootSum_evalf(): rs = RootSum(x**2 + 1, exp) assert rs.evalf(n=20, chop=True).epsilon_eq(Float("1.0806046117362794348")) assert rs.evalf(n=15, chop=True).epsilon_eq(Float("1.08060461173628")) rs = RootSum(x**2 + a, exp, x) assert rs.evalf() == rs def test_RootSum_diff(): f = x**3 + x + 3 g = Lambda(r, exp(r*x)) h = Lambda(r, r*exp(r*x)) assert RootSum(f, g).diff(x) == RootSum(f, h) def test_RootSum_subs(): f = x**3 + x + 3 g = Lambda(r, exp(r*x)) F = y**3 + y + 3 G = Lambda(r, exp(r*y)) assert RootSum(f, g).subs(y, 1) == RootSum(f, g) assert RootSum(f, g).subs(x, y) == RootSum(F, G) def test_RootSum_rational(): assert RootSum( z**5 - z + 1, Lambda(z, z/(x - z))) == (4*x - 5)/(x**5 - x + 1) f = 161*z**3 + 115*z**2 + 19*z + 1 g = Lambda(z, z*log( -3381*z**4/4 - 3381*z**3/4 - 625*z**2/2 - z*Rational(125, 2) - 5 + exp(x))) assert RootSum(f, g).diff(x) == -( (5*exp(2*x) - 6*exp(x) + 4)*exp(x)/(exp(3*x) - exp(2*x) + 1))/7 def test_RootSum_independent(): f = (x**3 - a)**2*(x**4 - b)**3 g = Lambda(x, 5*tan(x) + 7) h = Lambda(x, tan(x)) r0 = RootSum(x**3 - a, h, x) r1 = RootSum(x**4 - b, h, x) assert RootSum(f, g, x).as_ordered_terms() == [10*r0, 15*r1, 126] def test_issue_7876(): l1 = Poly(x**6 - x + 1, x).all_roots() l2 = [rootof(x**6 - x + 1, i) for i in range(6)] assert frozenset(l1) == frozenset(l2) def test_issue_8316(): f = Poly(7*x**8 - 9) assert len(f.all_roots()) == 8 f = Poly(7*x**8 - 10) assert len(f.all_roots()) == 8 def test__imag_count(): from sympy.polys.rootoftools import _imag_count_of_factor def imag_count(p): return sum([_imag_count_of_factor(f)*m for f, m in p.factor_list()[1]]) assert imag_count(Poly(x**6 + 10*x**2 + 1)) == 2 assert imag_count(Poly(x**2)) == 0 assert imag_count(Poly([1]*3 + [-1], x)) == 0 assert imag_count(Poly(x**3 + 1)) == 0 assert imag_count(Poly(x**2 + 1)) == 2 assert imag_count(Poly(x**2 - 1)) == 0 assert imag_count(Poly(x**4 - 1)) == 2 assert imag_count(Poly(x**4 + 1)) == 0 assert imag_count(Poly([1, 2, 3], x)) == 0 assert imag_count(Poly(x**3 + x + 1)) == 0 assert imag_count(Poly(x**4 + x + 1)) == 0 def q(r1, r2, p): return Poly(((x - r1)*(x - r2)).subs(x, x**p), x) assert imag_count(q(-1, -2, 2)) == 4 assert imag_count(q(-1, 2, 2)) == 2 assert imag_count(q(1, 2, 2)) == 0 assert imag_count(q(1, 2, 4)) == 4 assert imag_count(q(-1, 2, 4)) == 2 assert imag_count(q(-1, -2, 4)) == 0 def test_RootOf_is_imaginary(): r = RootOf(x**4 + 4*x**2 + 1, 1) i = r._get_interval() assert r.is_imaginary and i.ax*i.bx <= 0 def test_is_disjoint(): eq = x**3 + 5*x + 1 ir = rootof(eq, 0)._get_interval() ii = rootof(eq, 1)._get_interval() assert ir.is_disjoint(ii) assert ii.is_disjoint(ir) def test_pure_key_dict(): p = D() assert (x in p) is False assert (1 in p) is False p[x] = 1 assert x in p assert y in p assert p[y] == 1 raises(KeyError, lambda: p[1]) def dont(k): p[k] = 2 raises(ValueError, lambda: dont(1)) @slow def test_eval_approx_relative(): CRootOf.clear_cache() t = [CRootOf(x**3 + 10*x + 1, i) for i in range(3)] assert [i.eval_rational(1e-1) for i in t] == [ Rational(-21, 220), Rational(15, 256) - I*Rational(805, 256), Rational(15, 256) + I*Rational(805, 256)] t[0]._reset() assert [i.eval_rational(1e-1, 1e-4) for i in t] == [ Rational(-21, 220), Rational(3275, 65536) - I*Rational(414645, 131072), Rational(3275, 65536) + I*Rational(414645, 131072)] assert S(t[0]._get_interval().dx) < 1e-1 assert S(t[1]._get_interval().dx) < 1e-1 assert S(t[1]._get_interval().dy) < 1e-4 assert S(t[2]._get_interval().dx) < 1e-1 assert S(t[2]._get_interval().dy) < 1e-4 t[0]._reset() assert [i.eval_rational(1e-4, 1e-4) for i in t] == [ Rational(-2001, 20020), Rational(6545, 131072) - I*Rational(414645, 131072), Rational(6545, 131072) + I*Rational(414645, 131072)] assert S(t[0]._get_interval().dx) < 1e-4 assert S(t[1]._get_interval().dx) < 1e-4 assert S(t[1]._get_interval().dy) < 1e-4 assert S(t[2]._get_interval().dx) < 1e-4 assert S(t[2]._get_interval().dy) < 1e-4 # in the following, the actual relative precision is # less than tested, but it should never be greater t[0]._reset() assert [i.eval_rational(n=2) for i in t] == [ Rational(-202201, 2024022), Rational(104755, 2097152) - I*Rational(6634255, 2097152), Rational(104755, 2097152) + I*Rational(6634255, 2097152)] assert abs(S(t[0]._get_interval().dx)/t[0]) < 1e-2 assert abs(S(t[1]._get_interval().dx)/t[1]).n() < 1e-2 assert abs(S(t[1]._get_interval().dy)/t[1]).n() < 1e-2 assert abs(S(t[2]._get_interval().dx)/t[2]).n() < 1e-2 assert abs(S(t[2]._get_interval().dy)/t[2]).n() < 1e-2 t[0]._reset() assert [i.eval_rational(n=3) for i in t] == [ Rational(-202201, 2024022), Rational(1676045, 33554432) - I*Rational(106148135, 33554432), Rational(1676045, 33554432) + I*Rational(106148135, 33554432)] assert abs(S(t[0]._get_interval().dx)/t[0]) < 1e-3 assert abs(S(t[1]._get_interval().dx)/t[1]).n() < 1e-3 assert abs(S(t[1]._get_interval().dy)/t[1]).n() < 1e-3 assert abs(S(t[2]._get_interval().dx)/t[2]).n() < 1e-3 assert abs(S(t[2]._get_interval().dy)/t[2]).n() < 1e-3 t[0]._reset() a = [i.eval_approx(2) for i in t] assert [str(i) for i in a] == [ '-0.10', '0.05 - 3.2*I', '0.05 + 3.2*I'] assert all(abs(((a[i] - t[i])/t[i]).n()) < 1e-2 for i in range(len(a))) def test_issue_15920(): r = rootof(x**5 - x + 1, 0) p = Integral(x, (x, 1, y)) assert unchanged(Eq, r, p)
e1b9376a2279d9f3a8ce373be2e2d9912f95a525fc53cdd7f461480362326c17
"""Tests for user-friendly public interface to polynomial functions. """ from sympy.polys.polytools import ( Poly, PurePoly, poly, parallel_poly_from_expr, degree, degree_list, total_degree, LC, LM, LT, pdiv, prem, pquo, pexquo, div, rem, quo, exquo, half_gcdex, gcdex, invert, subresultants, resultant, discriminant, terms_gcd, cofactors, gcd, gcd_list, lcm, lcm_list, trunc, monic, content, primitive, compose, decompose, sturm, gff_list, gff, sqf_norm, sqf_part, sqf_list, sqf, factor_list, factor, intervals, refine_root, count_roots, real_roots, nroots, ground_roots, nth_power_roots_poly, cancel, reduced, groebner, GroebnerBasis, is_zero_dimensional, _torational_factor_list, to_rational_coeffs) from sympy.polys.polyerrors import ( MultivariatePolynomialError, ExactQuotientFailed, PolificationFailed, ComputationFailed, UnificationFailed, RefinementFailed, GeneratorsNeeded, GeneratorsError, PolynomialError, CoercionFailed, DomainError, OptionError, FlagError) from sympy.polys.polyclasses import DMP from sympy.polys.fields import field from sympy.polys.domains import FF, ZZ, QQ, RR, EX from sympy.polys.domains.realfield import RealField from sympy.polys.orderings import lex, grlex, grevlex from sympy import ( S, Integer, Rational, Float, Mul, Symbol, sqrt, Piecewise, Derivative, exp, sin, tanh, expand, oo, I, pi, re, im, rootof, Eq, Tuple, Expr, diff) from sympy.core.basic import _aresame from sympy.core.compatibility import iterable from sympy.core.mul import _keep_coeff from sympy.testing.pytest import raises, XFAIL, warns_deprecated_sympy from sympy.abc import a, b, c, d, p, q, t, w, x, y, z from sympy import MatrixSymbol, Matrix def _epsilon_eq(a, b): for u, v in zip(a, b): if abs(u - v) > 1e-10: return False return True def _strict_eq(a, b): if type(a) == type(b): if iterable(a): if len(a) == len(b): return all(_strict_eq(c, d) for c, d in zip(a, b)) else: return False else: return isinstance(a, Poly) and a.eq(b, strict=True) else: return False def test_Poly_mixed_operations(): p = Poly(x, x) with warns_deprecated_sympy(): p * exp(x) with warns_deprecated_sympy(): p + exp(x) with warns_deprecated_sympy(): p - exp(x) def test_Poly_from_dict(): K = FF(3) assert Poly.from_dict( {0: 1, 1: 2}, gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_dict( {0: 1, 1: 5}, gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_dict( {(0,): 1, (1,): 2}, gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_dict( {(0,): 1, (1,): 5}, gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_dict({(0, 0): 1, (1, 1): 2}, gens=( x, y), domain=K).rep == DMP([[K(2), K(0)], [K(1)]], K) assert Poly.from_dict({0: 1, 1: 2}, gens=x).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_dict( {0: 1, 1: 2}, gens=x, field=True).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_dict( {0: 1, 1: 2}, gens=x, domain=ZZ).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_dict( {0: 1, 1: 2}, gens=x, domain=QQ).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_dict( {(0,): 1, (1,): 2}, gens=x).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_dict( {(0,): 1, (1,): 2}, gens=x, field=True).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_dict( {(0,): 1, (1,): 2}, gens=x, domain=ZZ).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_dict( {(0,): 1, (1,): 2}, gens=x, domain=QQ).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_dict({(1,): sin(y)}, gens=x, composite=False) == \ Poly(sin(y)*x, x, domain='EX') assert Poly.from_dict({(1,): y}, gens=x, composite=False) == \ Poly(y*x, x, domain='EX') assert Poly.from_dict({(1, 1): 1}, gens=(x, y), composite=False) == \ Poly(x*y, x, y, domain='ZZ') assert Poly.from_dict({(1, 0): y}, gens=(x, z), composite=False) == \ Poly(y*x, x, z, domain='EX') def test_Poly_from_list(): K = FF(3) assert Poly.from_list([2, 1], gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_list([5, 1], gens=x, domain=K).rep == DMP([K(2), K(1)], K) assert Poly.from_list([2, 1], gens=x).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_list([2, 1], gens=x, field=True).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_list([2, 1], gens=x, domain=ZZ).rep == DMP([ZZ(2), ZZ(1)], ZZ) assert Poly.from_list([2, 1], gens=x, domain=QQ).rep == DMP([QQ(2), QQ(1)], QQ) assert Poly.from_list([0, 1.0], gens=x).rep == DMP([RR(1.0)], RR) assert Poly.from_list([1.0, 0], gens=x).rep == DMP([RR(1.0), RR(0.0)], RR) raises(MultivariatePolynomialError, lambda: Poly.from_list([[]], gens=(x, y))) def test_Poly_from_poly(): f = Poly(x + 7, x, domain=ZZ) g = Poly(x + 2, x, modulus=3) h = Poly(x + y, x, y, domain=ZZ) K = FF(3) assert Poly.from_poly(f) == f assert Poly.from_poly(f, domain=K).rep == DMP([K(1), K(1)], K) assert Poly.from_poly(f, domain=ZZ).rep == DMP([1, 7], ZZ) assert Poly.from_poly(f, domain=QQ).rep == DMP([1, 7], QQ) assert Poly.from_poly(f, gens=x) == f assert Poly.from_poly(f, gens=x, domain=K).rep == DMP([K(1), K(1)], K) assert Poly.from_poly(f, gens=x, domain=ZZ).rep == DMP([1, 7], ZZ) assert Poly.from_poly(f, gens=x, domain=QQ).rep == DMP([1, 7], QQ) assert Poly.from_poly(f, gens=y) == Poly(x + 7, y, domain='ZZ[x]') raises(CoercionFailed, lambda: Poly.from_poly(f, gens=y, domain=K)) raises(CoercionFailed, lambda: Poly.from_poly(f, gens=y, domain=ZZ)) raises(CoercionFailed, lambda: Poly.from_poly(f, gens=y, domain=QQ)) assert Poly.from_poly(f, gens=(x, y)) == Poly(x + 7, x, y, domain='ZZ') assert Poly.from_poly( f, gens=(x, y), domain=ZZ) == Poly(x + 7, x, y, domain='ZZ') assert Poly.from_poly( f, gens=(x, y), domain=QQ) == Poly(x + 7, x, y, domain='QQ') assert Poly.from_poly( f, gens=(x, y), modulus=3) == Poly(x + 7, x, y, domain='FF(3)') K = FF(2) assert Poly.from_poly(g) == g assert Poly.from_poly(g, domain=ZZ).rep == DMP([1, -1], ZZ) raises(CoercionFailed, lambda: Poly.from_poly(g, domain=QQ)) assert Poly.from_poly(g, domain=K).rep == DMP([K(1), K(0)], K) assert Poly.from_poly(g, gens=x) == g assert Poly.from_poly(g, gens=x, domain=ZZ).rep == DMP([1, -1], ZZ) raises(CoercionFailed, lambda: Poly.from_poly(g, gens=x, domain=QQ)) assert Poly.from_poly(g, gens=x, domain=K).rep == DMP([K(1), K(0)], K) K = FF(3) assert Poly.from_poly(h) == h assert Poly.from_poly( h, domain=ZZ).rep == DMP([[ZZ(1)], [ZZ(1), ZZ(0)]], ZZ) assert Poly.from_poly( h, domain=QQ).rep == DMP([[QQ(1)], [QQ(1), QQ(0)]], QQ) assert Poly.from_poly(h, domain=K).rep == DMP([[K(1)], [K(1), K(0)]], K) assert Poly.from_poly(h, gens=x) == Poly(x + y, x, domain=ZZ[y]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=x, domain=ZZ)) assert Poly.from_poly( h, gens=x, domain=ZZ[y]) == Poly(x + y, x, domain=ZZ[y]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=x, domain=QQ)) assert Poly.from_poly( h, gens=x, domain=QQ[y]) == Poly(x + y, x, domain=QQ[y]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=x, modulus=3)) assert Poly.from_poly(h, gens=y) == Poly(x + y, y, domain=ZZ[x]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=y, domain=ZZ)) assert Poly.from_poly( h, gens=y, domain=ZZ[x]) == Poly(x + y, y, domain=ZZ[x]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=y, domain=QQ)) assert Poly.from_poly( h, gens=y, domain=QQ[x]) == Poly(x + y, y, domain=QQ[x]) raises(CoercionFailed, lambda: Poly.from_poly(h, gens=y, modulus=3)) assert Poly.from_poly(h, gens=(x, y)) == h assert Poly.from_poly( h, gens=(x, y), domain=ZZ).rep == DMP([[ZZ(1)], [ZZ(1), ZZ(0)]], ZZ) assert Poly.from_poly( h, gens=(x, y), domain=QQ).rep == DMP([[QQ(1)], [QQ(1), QQ(0)]], QQ) assert Poly.from_poly( h, gens=(x, y), domain=K).rep == DMP([[K(1)], [K(1), K(0)]], K) assert Poly.from_poly( h, gens=(y, x)).rep == DMP([[ZZ(1)], [ZZ(1), ZZ(0)]], ZZ) assert Poly.from_poly( h, gens=(y, x), domain=ZZ).rep == DMP([[ZZ(1)], [ZZ(1), ZZ(0)]], ZZ) assert Poly.from_poly( h, gens=(y, x), domain=QQ).rep == DMP([[QQ(1)], [QQ(1), QQ(0)]], QQ) assert Poly.from_poly( h, gens=(y, x), domain=K).rep == DMP([[K(1)], [K(1), K(0)]], K) assert Poly.from_poly( h, gens=(x, y), field=True).rep == DMP([[QQ(1)], [QQ(1), QQ(0)]], QQ) assert Poly.from_poly( h, gens=(x, y), field=True).rep == DMP([[QQ(1)], [QQ(1), QQ(0)]], QQ) def test_Poly_from_expr(): raises(GeneratorsNeeded, lambda: Poly.from_expr(S.Zero)) raises(GeneratorsNeeded, lambda: Poly.from_expr(S(7))) F3 = FF(3) assert Poly.from_expr(x + 5, domain=F3).rep == DMP([F3(1), F3(2)], F3) assert Poly.from_expr(y + 5, domain=F3).rep == DMP([F3(1), F3(2)], F3) assert Poly.from_expr(x + 5, x, domain=F3).rep == DMP([F3(1), F3(2)], F3) assert Poly.from_expr(y + 5, y, domain=F3).rep == DMP([F3(1), F3(2)], F3) assert Poly.from_expr(x + y, domain=F3).rep == DMP([[F3(1)], [F3(1), F3(0)]], F3) assert Poly.from_expr(x + y, x, y, domain=F3).rep == DMP([[F3(1)], [F3(1), F3(0)]], F3) assert Poly.from_expr(x + 5).rep == DMP([1, 5], ZZ) assert Poly.from_expr(y + 5).rep == DMP([1, 5], ZZ) assert Poly.from_expr(x + 5, x).rep == DMP([1, 5], ZZ) assert Poly.from_expr(y + 5, y).rep == DMP([1, 5], ZZ) assert Poly.from_expr(x + 5, domain=ZZ).rep == DMP([1, 5], ZZ) assert Poly.from_expr(y + 5, domain=ZZ).rep == DMP([1, 5], ZZ) assert Poly.from_expr(x + 5, x, domain=ZZ).rep == DMP([1, 5], ZZ) assert Poly.from_expr(y + 5, y, domain=ZZ).rep == DMP([1, 5], ZZ) assert Poly.from_expr(x + 5, x, y, domain=ZZ).rep == DMP([[1], [5]], ZZ) assert Poly.from_expr(y + 5, x, y, domain=ZZ).rep == DMP([[1, 5]], ZZ) def test_Poly__new__(): raises(GeneratorsError, lambda: Poly(x + 1, x, x)) raises(GeneratorsError, lambda: Poly(x + y, x, y, domain=ZZ[x])) raises(GeneratorsError, lambda: Poly(x + y, x, y, domain=ZZ[y])) raises(OptionError, lambda: Poly(x, x, symmetric=True)) raises(OptionError, lambda: Poly(x + 2, x, modulus=3, domain=QQ)) raises(OptionError, lambda: Poly(x + 2, x, domain=ZZ, gaussian=True)) raises(OptionError, lambda: Poly(x + 2, x, modulus=3, gaussian=True)) raises(OptionError, lambda: Poly(x + 2, x, domain=ZZ, extension=[sqrt(3)])) raises(OptionError, lambda: Poly(x + 2, x, modulus=3, extension=[sqrt(3)])) raises(OptionError, lambda: Poly(x + 2, x, domain=ZZ, extension=True)) raises(OptionError, lambda: Poly(x + 2, x, modulus=3, extension=True)) raises(OptionError, lambda: Poly(x + 2, x, domain=ZZ, greedy=True)) raises(OptionError, lambda: Poly(x + 2, x, domain=QQ, field=True)) raises(OptionError, lambda: Poly(x + 2, x, domain=ZZ, greedy=False)) raises(OptionError, lambda: Poly(x + 2, x, domain=QQ, field=False)) raises(NotImplementedError, lambda: Poly(x + 1, x, modulus=3, order='grlex')) raises(NotImplementedError, lambda: Poly(x + 1, x, order='grlex')) raises(GeneratorsNeeded, lambda: Poly({1: 2, 0: 1})) raises(GeneratorsNeeded, lambda: Poly([2, 1])) raises(GeneratorsNeeded, lambda: Poly((2, 1))) raises(GeneratorsNeeded, lambda: Poly(1)) f = a*x**2 + b*x + c assert Poly({2: a, 1: b, 0: c}, x) == f assert Poly(iter([a, b, c]), x) == f assert Poly([a, b, c], x) == f assert Poly((a, b, c), x) == f f = Poly({}, x, y, z) assert f.gens == (x, y, z) and f.as_expr() == 0 assert Poly(Poly(a*x + b*y, x, y), x) == Poly(a*x + b*y, x) assert Poly(3*x**2 + 2*x + 1, domain='ZZ').all_coeffs() == [3, 2, 1] assert Poly(3*x**2 + 2*x + 1, domain='QQ').all_coeffs() == [3, 2, 1] assert Poly(3*x**2 + 2*x + 1, domain='RR').all_coeffs() == [3.0, 2.0, 1.0] raises(CoercionFailed, lambda: Poly(3*x**2/5 + x*Rational(2, 5) + 1, domain='ZZ')) assert Poly( 3*x**2/5 + x*Rational(2, 5) + 1, domain='QQ').all_coeffs() == [Rational(3, 5), Rational(2, 5), 1] assert _epsilon_eq( Poly(3*x**2/5 + x*Rational(2, 5) + 1, domain='RR').all_coeffs(), [0.6, 0.4, 1.0]) assert Poly(3.0*x**2 + 2.0*x + 1, domain='ZZ').all_coeffs() == [3, 2, 1] assert Poly(3.0*x**2 + 2.0*x + 1, domain='QQ').all_coeffs() == [3, 2, 1] assert Poly( 3.0*x**2 + 2.0*x + 1, domain='RR').all_coeffs() == [3.0, 2.0, 1.0] raises(CoercionFailed, lambda: Poly(3.1*x**2 + 2.1*x + 1, domain='ZZ')) assert Poly(3.1*x**2 + 2.1*x + 1, domain='QQ').all_coeffs() == [Rational(31, 10), Rational(21, 10), 1] assert Poly(3.1*x**2 + 2.1*x + 1, domain='RR').all_coeffs() == [3.1, 2.1, 1.0] assert Poly({(2, 1): 1, (1, 2): 2, (1, 1): 3}, x, y) == \ Poly(x**2*y + 2*x*y**2 + 3*x*y, x, y) assert Poly(x**2 + 1, extension=I).get_domain() == QQ.algebraic_field(I) f = 3*x**5 - x**4 + x**3 - x** 2 + 65538 assert Poly(f, x, modulus=65537, symmetric=True) == \ Poly(3*x**5 - x**4 + x**3 - x** 2 + 1, x, modulus=65537, symmetric=True) assert Poly(f, x, modulus=65537, symmetric=False) == \ Poly(3*x**5 + 65536*x**4 + x**3 + 65536*x** 2 + 1, x, modulus=65537, symmetric=False) assert isinstance(Poly(x**2 + x + 1.0).get_domain(), RealField) def test_Poly__args(): assert Poly(x**2 + 1).args == (x**2 + 1, x) def test_Poly__gens(): assert Poly((x - p)*(x - q), x).gens == (x,) assert Poly((x - p)*(x - q), p).gens == (p,) assert Poly((x - p)*(x - q), q).gens == (q,) assert Poly((x - p)*(x - q), x, p).gens == (x, p) assert Poly((x - p)*(x - q), x, q).gens == (x, q) assert Poly((x - p)*(x - q), x, p, q).gens == (x, p, q) assert Poly((x - p)*(x - q), p, x, q).gens == (p, x, q) assert Poly((x - p)*(x - q), p, q, x).gens == (p, q, x) assert Poly((x - p)*(x - q)).gens == (x, p, q) assert Poly((x - p)*(x - q), sort='x > p > q').gens == (x, p, q) assert Poly((x - p)*(x - q), sort='p > x > q').gens == (p, x, q) assert Poly((x - p)*(x - q), sort='p > q > x').gens == (p, q, x) assert Poly((x - p)*(x - q), x, p, q, sort='p > q > x').gens == (x, p, q) assert Poly((x - p)*(x - q), wrt='x').gens == (x, p, q) assert Poly((x - p)*(x - q), wrt='p').gens == (p, x, q) assert Poly((x - p)*(x - q), wrt='q').gens == (q, x, p) assert Poly((x - p)*(x - q), wrt=x).gens == (x, p, q) assert Poly((x - p)*(x - q), wrt=p).gens == (p, x, q) assert Poly((x - p)*(x - q), wrt=q).gens == (q, x, p) assert Poly((x - p)*(x - q), x, p, q, wrt='p').gens == (x, p, q) assert Poly((x - p)*(x - q), wrt='p', sort='q > x').gens == (p, q, x) assert Poly((x - p)*(x - q), wrt='q', sort='p > x').gens == (q, p, x) def test_Poly_zero(): assert Poly(x).zero == Poly(0, x, domain=ZZ) assert Poly(x/2).zero == Poly(0, x, domain=QQ) def test_Poly_one(): assert Poly(x).one == Poly(1, x, domain=ZZ) assert Poly(x/2).one == Poly(1, x, domain=QQ) def test_Poly__unify(): raises(UnificationFailed, lambda: Poly(x)._unify(y)) F3 = FF(3) F5 = FF(5) assert Poly(x, x, modulus=3)._unify(Poly(y, y, modulus=3))[2:] == ( DMP([[F3(1)], []], F3), DMP([[F3(1), F3(0)]], F3)) assert Poly(x, x, modulus=3)._unify(Poly(y, y, modulus=5))[2:] == ( DMP([[F5(1)], []], F5), DMP([[F5(1), F5(0)]], F5)) assert Poly(y, x, y)._unify(Poly(x, x, modulus=3))[2:] == (DMP([[F3(1), F3(0)]], F3), DMP([[F3(1)], []], F3)) assert Poly(x, x, modulus=3)._unify(Poly(y, x, y))[2:] == (DMP([[F3(1)], []], F3), DMP([[F3(1), F3(0)]], F3)) assert Poly(x + 1, x)._unify(Poly(x + 2, x))[2:] == (DMP([1, 1], ZZ), DMP([1, 2], ZZ)) assert Poly(x + 1, x, domain='QQ')._unify(Poly(x + 2, x))[2:] == (DMP([1, 1], QQ), DMP([1, 2], QQ)) assert Poly(x + 1, x)._unify(Poly(x + 2, x, domain='QQ'))[2:] == (DMP([1, 1], QQ), DMP([1, 2], QQ)) assert Poly(x + 1, x)._unify(Poly(x + 2, x, y))[2:] == (DMP([[1], [1]], ZZ), DMP([[1], [2]], ZZ)) assert Poly(x + 1, x, domain='QQ')._unify(Poly(x + 2, x, y))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x)._unify(Poly(x + 2, x, y, domain='QQ'))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, x))[2:] == (DMP([[1], [1]], ZZ), DMP([[1], [2]], ZZ)) assert Poly(x + 1, x, y, domain='QQ')._unify(Poly(x + 2, x))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, x, domain='QQ'))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, x, y))[2:] == (DMP([[1], [1]], ZZ), DMP([[1], [2]], ZZ)) assert Poly(x + 1, x, y, domain='QQ')._unify(Poly(x + 2, x, y))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, x, y, domain='QQ'))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x)._unify(Poly(x + 2, y, x))[2:] == (DMP([[1, 1]], ZZ), DMP([[1, 2]], ZZ)) assert Poly(x + 1, x, domain='QQ')._unify(Poly(x + 2, y, x))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) assert Poly(x + 1, x)._unify(Poly(x + 2, y, x, domain='QQ'))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) assert Poly(x + 1, y, x)._unify(Poly(x + 2, x))[2:] == (DMP([[1, 1]], ZZ), DMP([[1, 2]], ZZ)) assert Poly(x + 1, y, x, domain='QQ')._unify(Poly(x + 2, x))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) assert Poly(x + 1, y, x)._unify(Poly(x + 2, x, domain='QQ'))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, y, x))[2:] == (DMP([[1], [1]], ZZ), DMP([[1], [2]], ZZ)) assert Poly(x + 1, x, y, domain='QQ')._unify(Poly(x + 2, y, x))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, x, y)._unify(Poly(x + 2, y, x, domain='QQ'))[2:] == (DMP([[1], [1]], QQ), DMP([[1], [2]], QQ)) assert Poly(x + 1, y, x)._unify(Poly(x + 2, x, y))[2:] == (DMP([[1, 1]], ZZ), DMP([[1, 2]], ZZ)) assert Poly(x + 1, y, x, domain='QQ')._unify(Poly(x + 2, x, y))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) assert Poly(x + 1, y, x)._unify(Poly(x + 2, x, y, domain='QQ'))[2:] == (DMP([[1, 1]], QQ), DMP([[1, 2]], QQ)) F, A, B = field("a,b", ZZ) assert Poly(a*x, x, domain='ZZ[a]')._unify(Poly(a*b*x, x, domain='ZZ(a,b)'))[2:] == \ (DMP([A, F(0)], F.to_domain()), DMP([A*B, F(0)], F.to_domain())) assert Poly(a*x, x, domain='ZZ(a)')._unify(Poly(a*b*x, x, domain='ZZ(a,b)'))[2:] == \ (DMP([A, F(0)], F.to_domain()), DMP([A*B, F(0)], F.to_domain())) raises(CoercionFailed, lambda: Poly(Poly(x**2 + x**2*z, y, field=True), domain='ZZ(x)')) f = Poly(t**2 + t/3 + x, t, domain='QQ(x)') g = Poly(t**2 + t/3 + x, t, domain='QQ[x]') assert f._unify(g)[2:] == (f.rep, f.rep) def test_Poly_free_symbols(): assert Poly(x**2 + 1).free_symbols == {x} assert Poly(x**2 + y*z).free_symbols == {x, y, z} assert Poly(x**2 + y*z, x).free_symbols == {x, y, z} assert Poly(x**2 + sin(y*z)).free_symbols == {x, y, z} assert Poly(x**2 + sin(y*z), x).free_symbols == {x, y, z} assert Poly(x**2 + sin(y*z), x, domain=EX).free_symbols == {x, y, z} assert Poly(1 + x + x**2, x, y, z).free_symbols == {x} assert Poly(x + sin(y), z).free_symbols == {x, y} def test_PurePoly_free_symbols(): assert PurePoly(x**2 + 1).free_symbols == set([]) assert PurePoly(x**2 + y*z).free_symbols == set([]) assert PurePoly(x**2 + y*z, x).free_symbols == {y, z} assert PurePoly(x**2 + sin(y*z)).free_symbols == set([]) assert PurePoly(x**2 + sin(y*z), x).free_symbols == {y, z} assert PurePoly(x**2 + sin(y*z), x, domain=EX).free_symbols == {y, z} def test_Poly__eq__(): assert (Poly(x, x) == Poly(x, x)) is True assert (Poly(x, x, domain=QQ) == Poly(x, x)) is False assert (Poly(x, x) == Poly(x, x, domain=QQ)) is False assert (Poly(x, x, domain=ZZ[a]) == Poly(x, x)) is False assert (Poly(x, x) == Poly(x, x, domain=ZZ[a])) is False assert (Poly(x*y, x, y) == Poly(x, x)) is False assert (Poly(x, x, y) == Poly(x, x)) is False assert (Poly(x, x) == Poly(x, x, y)) is False assert (Poly(x**2 + 1, x) == Poly(y**2 + 1, y)) is False assert (Poly(y**2 + 1, y) == Poly(x**2 + 1, x)) is False f = Poly(x, x, domain=ZZ) g = Poly(x, x, domain=QQ) assert f.eq(g) is False assert f.ne(g) is True assert f.eq(g, strict=True) is False assert f.ne(g, strict=True) is True t0 = Symbol('t0') f = Poly((t0/2 + x**2)*t**2 - x**2*t, t, domain='QQ[x,t0]') g = Poly((t0/2 + x**2)*t**2 - x**2*t, t, domain='ZZ(x,t0)') assert (f == g) is False def test_PurePoly__eq__(): assert (PurePoly(x, x) == PurePoly(x, x)) is True assert (PurePoly(x, x, domain=QQ) == PurePoly(x, x)) is True assert (PurePoly(x, x) == PurePoly(x, x, domain=QQ)) is True assert (PurePoly(x, x, domain=ZZ[a]) == PurePoly(x, x)) is True assert (PurePoly(x, x) == PurePoly(x, x, domain=ZZ[a])) is True assert (PurePoly(x*y, x, y) == PurePoly(x, x)) is False assert (PurePoly(x, x, y) == PurePoly(x, x)) is False assert (PurePoly(x, x) == PurePoly(x, x, y)) is False assert (PurePoly(x**2 + 1, x) == PurePoly(y**2 + 1, y)) is True assert (PurePoly(y**2 + 1, y) == PurePoly(x**2 + 1, x)) is True f = PurePoly(x, x, domain=ZZ) g = PurePoly(x, x, domain=QQ) assert f.eq(g) is True assert f.ne(g) is False assert f.eq(g, strict=True) is False assert f.ne(g, strict=True) is True f = PurePoly(x, x, domain=ZZ) g = PurePoly(y, y, domain=QQ) assert f.eq(g) is True assert f.ne(g) is False assert f.eq(g, strict=True) is False assert f.ne(g, strict=True) is True def test_PurePoly_Poly(): assert isinstance(PurePoly(Poly(x**2 + 1)), PurePoly) is True assert isinstance(Poly(PurePoly(x**2 + 1)), Poly) is True def test_Poly_get_domain(): assert Poly(2*x).get_domain() == ZZ assert Poly(2*x, domain='ZZ').get_domain() == ZZ assert Poly(2*x, domain='QQ').get_domain() == QQ assert Poly(x/2).get_domain() == QQ raises(CoercionFailed, lambda: Poly(x/2, domain='ZZ')) assert Poly(x/2, domain='QQ').get_domain() == QQ assert isinstance(Poly(0.2*x).get_domain(), RealField) def test_Poly_set_domain(): assert Poly(2*x + 1).set_domain(ZZ) == Poly(2*x + 1) assert Poly(2*x + 1).set_domain('ZZ') == Poly(2*x + 1) assert Poly(2*x + 1).set_domain(QQ) == Poly(2*x + 1, domain='QQ') assert Poly(2*x + 1).set_domain('QQ') == Poly(2*x + 1, domain='QQ') assert Poly(Rational(2, 10)*x + Rational(1, 10)).set_domain('RR') == Poly(0.2*x + 0.1) assert Poly(0.2*x + 0.1).set_domain('QQ') == Poly(Rational(2, 10)*x + Rational(1, 10)) raises(CoercionFailed, lambda: Poly(x/2 + 1).set_domain(ZZ)) raises(CoercionFailed, lambda: Poly(x + 1, modulus=2).set_domain(QQ)) raises(GeneratorsError, lambda: Poly(x*y, x, y).set_domain(ZZ[y])) def test_Poly_get_modulus(): assert Poly(x**2 + 1, modulus=2).get_modulus() == 2 raises(PolynomialError, lambda: Poly(x**2 + 1).get_modulus()) def test_Poly_set_modulus(): assert Poly( x**2 + 1, modulus=2).set_modulus(7) == Poly(x**2 + 1, modulus=7) assert Poly( x**2 + 5, modulus=7).set_modulus(2) == Poly(x**2 + 1, modulus=2) assert Poly(x**2 + 1).set_modulus(2) == Poly(x**2 + 1, modulus=2) raises(CoercionFailed, lambda: Poly(x/2 + 1).set_modulus(2)) def test_Poly_add_ground(): assert Poly(x + 1).add_ground(2) == Poly(x + 3) def test_Poly_sub_ground(): assert Poly(x + 1).sub_ground(2) == Poly(x - 1) def test_Poly_mul_ground(): assert Poly(x + 1).mul_ground(2) == Poly(2*x + 2) def test_Poly_quo_ground(): assert Poly(2*x + 4).quo_ground(2) == Poly(x + 2) assert Poly(2*x + 3).quo_ground(2) == Poly(x + 1) def test_Poly_exquo_ground(): assert Poly(2*x + 4).exquo_ground(2) == Poly(x + 2) raises(ExactQuotientFailed, lambda: Poly(2*x + 3).exquo_ground(2)) def test_Poly_abs(): assert Poly(-x + 1, x).abs() == abs(Poly(-x + 1, x)) == Poly(x + 1, x) def test_Poly_neg(): assert Poly(-x + 1, x).neg() == -Poly(-x + 1, x) == Poly(x - 1, x) def test_Poly_add(): assert Poly(0, x).add(Poly(0, x)) == Poly(0, x) assert Poly(0, x) + Poly(0, x) == Poly(0, x) assert Poly(1, x).add(Poly(0, x)) == Poly(1, x) assert Poly(1, x, y) + Poly(0, x) == Poly(1, x, y) assert Poly(0, x).add(Poly(1, x, y)) == Poly(1, x, y) assert Poly(0, x, y) + Poly(1, x, y) == Poly(1, x, y) assert Poly(1, x) + x == Poly(x + 1, x) with warns_deprecated_sympy(): Poly(1, x) + sin(x) assert Poly(x, x) + 1 == Poly(x + 1, x) assert 1 + Poly(x, x) == Poly(x + 1, x) def test_Poly_sub(): assert Poly(0, x).sub(Poly(0, x)) == Poly(0, x) assert Poly(0, x) - Poly(0, x) == Poly(0, x) assert Poly(1, x).sub(Poly(0, x)) == Poly(1, x) assert Poly(1, x, y) - Poly(0, x) == Poly(1, x, y) assert Poly(0, x).sub(Poly(1, x, y)) == Poly(-1, x, y) assert Poly(0, x, y) - Poly(1, x, y) == Poly(-1, x, y) assert Poly(1, x) - x == Poly(1 - x, x) with warns_deprecated_sympy(): Poly(1, x) - sin(x) assert Poly(x, x) - 1 == Poly(x - 1, x) assert 1 - Poly(x, x) == Poly(1 - x, x) def test_Poly_mul(): assert Poly(0, x).mul(Poly(0, x)) == Poly(0, x) assert Poly(0, x) * Poly(0, x) == Poly(0, x) assert Poly(2, x).mul(Poly(4, x)) == Poly(8, x) assert Poly(2, x, y) * Poly(4, x) == Poly(8, x, y) assert Poly(4, x).mul(Poly(2, x, y)) == Poly(8, x, y) assert Poly(4, x, y) * Poly(2, x, y) == Poly(8, x, y) assert Poly(1, x) * x == Poly(x, x) with warns_deprecated_sympy(): Poly(1, x) * sin(x) assert Poly(x, x) * 2 == Poly(2*x, x) assert 2 * Poly(x, x) == Poly(2*x, x) def test_issue_13079(): assert Poly(x)*x == Poly(x**2, x, domain='ZZ') assert x*Poly(x) == Poly(x**2, x, domain='ZZ') assert -2*Poly(x) == Poly(-2*x, x, domain='ZZ') assert S(-2)*Poly(x) == Poly(-2*x, x, domain='ZZ') assert Poly(x)*S(-2) == Poly(-2*x, x, domain='ZZ') def test_Poly_sqr(): assert Poly(x*y, x, y).sqr() == Poly(x**2*y**2, x, y) def test_Poly_pow(): assert Poly(x, x).pow(10) == Poly(x**10, x) assert Poly(x, x).pow(Integer(10)) == Poly(x**10, x) assert Poly(2*y, x, y).pow(4) == Poly(16*y**4, x, y) assert Poly(2*y, x, y).pow(Integer(4)) == Poly(16*y**4, x, y) assert Poly(7*x*y, x, y)**3 == Poly(343*x**3*y**3, x, y) raises(TypeError, lambda: Poly(x*y + 1, x, y)**(-1)) raises(TypeError, lambda: Poly(x*y + 1, x, y)**x) def test_Poly_divmod(): f, g = Poly(x**2), Poly(x) q, r = g, Poly(0, x) assert divmod(f, g) == (q, r) assert f // g == q assert f % g == r assert divmod(f, x) == (q, r) assert f // x == q assert f % x == r q, r = Poly(0, x), Poly(2, x) assert divmod(2, g) == (q, r) assert 2 // g == q assert 2 % g == r assert Poly(x)/Poly(x) == 1 assert Poly(x**2)/Poly(x) == x assert Poly(x)/Poly(x**2) == 1/x def test_Poly_eq_ne(): assert (Poly(x + y, x, y) == Poly(x + y, x, y)) is True assert (Poly(x + y, x) == Poly(x + y, x, y)) is False assert (Poly(x + y, x, y) == Poly(x + y, x)) is False assert (Poly(x + y, x) == Poly(x + y, x)) is True assert (Poly(x + y, y) == Poly(x + y, y)) is True assert (Poly(x + y, x, y) == x + y) is True assert (Poly(x + y, x) == x + y) is True assert (Poly(x + y, x, y) == x + y) is True assert (Poly(x + y, x) == x + y) is True assert (Poly(x + y, y) == x + y) is True assert (Poly(x + y, x, y) != Poly(x + y, x, y)) is False assert (Poly(x + y, x) != Poly(x + y, x, y)) is True assert (Poly(x + y, x, y) != Poly(x + y, x)) is True assert (Poly(x + y, x) != Poly(x + y, x)) is False assert (Poly(x + y, y) != Poly(x + y, y)) is False assert (Poly(x + y, x, y) != x + y) is False assert (Poly(x + y, x) != x + y) is False assert (Poly(x + y, x, y) != x + y) is False assert (Poly(x + y, x) != x + y) is False assert (Poly(x + y, y) != x + y) is False assert (Poly(x, x) == sin(x)) is False assert (Poly(x, x) != sin(x)) is True def test_Poly_nonzero(): assert not bool(Poly(0, x)) is True assert not bool(Poly(1, x)) is False def test_Poly_properties(): assert Poly(0, x).is_zero is True assert Poly(1, x).is_zero is False assert Poly(1, x).is_one is True assert Poly(2, x).is_one is False assert Poly(x - 1, x).is_sqf is True assert Poly((x - 1)**2, x).is_sqf is False assert Poly(x - 1, x).is_monic is True assert Poly(2*x - 1, x).is_monic is False assert Poly(3*x + 2, x).is_primitive is True assert Poly(4*x + 2, x).is_primitive is False assert Poly(1, x).is_ground is True assert Poly(x, x).is_ground is False assert Poly(x + y + z + 1).is_linear is True assert Poly(x*y*z + 1).is_linear is False assert Poly(x*y + z + 1).is_quadratic is True assert Poly(x*y*z + 1).is_quadratic is False assert Poly(x*y).is_monomial is True assert Poly(x*y + 1).is_monomial is False assert Poly(x**2 + x*y).is_homogeneous is True assert Poly(x**3 + x*y).is_homogeneous is False assert Poly(x).is_univariate is True assert Poly(x*y).is_univariate is False assert Poly(x*y).is_multivariate is True assert Poly(x).is_multivariate is False assert Poly( x**16 + x**14 - x**10 + x**8 - x**6 + x**2 + 1).is_cyclotomic is False assert Poly( x**16 + x**14 - x**10 - x**8 - x**6 + x**2 + 1).is_cyclotomic is True def test_Poly_is_irreducible(): assert Poly(x**2 + x + 1).is_irreducible is True assert Poly(x**2 + 2*x + 1).is_irreducible is False assert Poly(7*x + 3, modulus=11).is_irreducible is True assert Poly(7*x**2 + 3*x + 1, modulus=11).is_irreducible is False def test_Poly_subs(): assert Poly(x + 1).subs(x, 0) == 1 assert Poly(x + 1).subs(x, x) == Poly(x + 1) assert Poly(x + 1).subs(x, y) == Poly(y + 1) assert Poly(x*y, x).subs(y, x) == x**2 assert Poly(x*y, x).subs(x, y) == y**2 def test_Poly_replace(): assert Poly(x + 1).replace(x) == Poly(x + 1) assert Poly(x + 1).replace(y) == Poly(y + 1) raises(PolynomialError, lambda: Poly(x + y).replace(z)) assert Poly(x + 1).replace(x, x) == Poly(x + 1) assert Poly(x + 1).replace(x, y) == Poly(y + 1) assert Poly(x + y).replace(x, x) == Poly(x + y) assert Poly(x + y).replace(x, z) == Poly(z + y, z, y) assert Poly(x + y).replace(y, y) == Poly(x + y) assert Poly(x + y).replace(y, z) == Poly(x + z, x, z) assert Poly(x + y).replace(z, t) == Poly(x + y) raises(PolynomialError, lambda: Poly(x + y).replace(x, y)) assert Poly(x + y, x).replace(x, z) == Poly(z + y, z) assert Poly(x + y, y).replace(y, z) == Poly(x + z, z) raises(PolynomialError, lambda: Poly(x + y, x).replace(x, y)) raises(PolynomialError, lambda: Poly(x + y, y).replace(y, x)) def test_Poly_reorder(): raises(PolynomialError, lambda: Poly(x + y).reorder(x, z)) assert Poly(x + y, x, y).reorder(x, y) == Poly(x + y, x, y) assert Poly(x + y, x, y).reorder(y, x) == Poly(x + y, y, x) assert Poly(x + y, y, x).reorder(x, y) == Poly(x + y, x, y) assert Poly(x + y, y, x).reorder(y, x) == Poly(x + y, y, x) assert Poly(x + y, x, y).reorder(wrt=x) == Poly(x + y, x, y) assert Poly(x + y, x, y).reorder(wrt=y) == Poly(x + y, y, x) def test_Poly_ltrim(): f = Poly(y**2 + y*z**2, x, y, z).ltrim(y) assert f.as_expr() == y**2 + y*z**2 and f.gens == (y, z) assert Poly(x*y - x, z, x, y).ltrim(1) == Poly(x*y - x, x, y) raises(PolynomialError, lambda: Poly(x*y**2 + y**2, x, y).ltrim(y)) raises(PolynomialError, lambda: Poly(x*y - x, x, y).ltrim(-1)) def test_Poly_has_only_gens(): assert Poly(x*y + 1, x, y, z).has_only_gens(x, y) is True assert Poly(x*y + z, x, y, z).has_only_gens(x, y) is False raises(GeneratorsError, lambda: Poly(x*y**2 + y**2, x, y).has_only_gens(t)) def test_Poly_to_ring(): assert Poly(2*x + 1, domain='ZZ').to_ring() == Poly(2*x + 1, domain='ZZ') assert Poly(2*x + 1, domain='QQ').to_ring() == Poly(2*x + 1, domain='ZZ') raises(CoercionFailed, lambda: Poly(x/2 + 1).to_ring()) raises(DomainError, lambda: Poly(2*x + 1, modulus=3).to_ring()) def test_Poly_to_field(): assert Poly(2*x + 1, domain='ZZ').to_field() == Poly(2*x + 1, domain='QQ') assert Poly(2*x + 1, domain='QQ').to_field() == Poly(2*x + 1, domain='QQ') assert Poly(x/2 + 1, domain='QQ').to_field() == Poly(x/2 + 1, domain='QQ') assert Poly(2*x + 1, modulus=3).to_field() == Poly(2*x + 1, modulus=3) assert Poly(2.0*x + 1.0).to_field() == Poly(2.0*x + 1.0) def test_Poly_to_exact(): assert Poly(2*x).to_exact() == Poly(2*x) assert Poly(x/2).to_exact() == Poly(x/2) assert Poly(0.1*x).to_exact() == Poly(x/10) def test_Poly_retract(): f = Poly(x**2 + 1, x, domain=QQ[y]) assert f.retract() == Poly(x**2 + 1, x, domain='ZZ') assert f.retract(field=True) == Poly(x**2 + 1, x, domain='QQ') assert Poly(0, x, y).retract() == Poly(0, x, y) def test_Poly_slice(): f = Poly(x**3 + 2*x**2 + 3*x + 4) assert f.slice(0, 0) == Poly(0, x) assert f.slice(0, 1) == Poly(4, x) assert f.slice(0, 2) == Poly(3*x + 4, x) assert f.slice(0, 3) == Poly(2*x**2 + 3*x + 4, x) assert f.slice(0, 4) == Poly(x**3 + 2*x**2 + 3*x + 4, x) assert f.slice(x, 0, 0) == Poly(0, x) assert f.slice(x, 0, 1) == Poly(4, x) assert f.slice(x, 0, 2) == Poly(3*x + 4, x) assert f.slice(x, 0, 3) == Poly(2*x**2 + 3*x + 4, x) assert f.slice(x, 0, 4) == Poly(x**3 + 2*x**2 + 3*x + 4, x) def test_Poly_coeffs(): assert Poly(0, x).coeffs() == [0] assert Poly(1, x).coeffs() == [1] assert Poly(2*x + 1, x).coeffs() == [2, 1] assert Poly(7*x**2 + 2*x + 1, x).coeffs() == [7, 2, 1] assert Poly(7*x**4 + 2*x + 1, x).coeffs() == [7, 2, 1] assert Poly(x*y**7 + 2*x**2*y**3).coeffs('lex') == [2, 1] assert Poly(x*y**7 + 2*x**2*y**3).coeffs('grlex') == [1, 2] def test_Poly_monoms(): assert Poly(0, x).monoms() == [(0,)] assert Poly(1, x).monoms() == [(0,)] assert Poly(2*x + 1, x).monoms() == [(1,), (0,)] assert Poly(7*x**2 + 2*x + 1, x).monoms() == [(2,), (1,), (0,)] assert Poly(7*x**4 + 2*x + 1, x).monoms() == [(4,), (1,), (0,)] assert Poly(x*y**7 + 2*x**2*y**3).monoms('lex') == [(2, 3), (1, 7)] assert Poly(x*y**7 + 2*x**2*y**3).monoms('grlex') == [(1, 7), (2, 3)] def test_Poly_terms(): assert Poly(0, x).terms() == [((0,), 0)] assert Poly(1, x).terms() == [((0,), 1)] assert Poly(2*x + 1, x).terms() == [((1,), 2), ((0,), 1)] assert Poly(7*x**2 + 2*x + 1, x).terms() == [((2,), 7), ((1,), 2), ((0,), 1)] assert Poly(7*x**4 + 2*x + 1, x).terms() == [((4,), 7), ((1,), 2), ((0,), 1)] assert Poly( x*y**7 + 2*x**2*y**3).terms('lex') == [((2, 3), 2), ((1, 7), 1)] assert Poly( x*y**7 + 2*x**2*y**3).terms('grlex') == [((1, 7), 1), ((2, 3), 2)] def test_Poly_all_coeffs(): assert Poly(0, x).all_coeffs() == [0] assert Poly(1, x).all_coeffs() == [1] assert Poly(2*x + 1, x).all_coeffs() == [2, 1] assert Poly(7*x**2 + 2*x + 1, x).all_coeffs() == [7, 2, 1] assert Poly(7*x**4 + 2*x + 1, x).all_coeffs() == [7, 0, 0, 2, 1] def test_Poly_all_monoms(): assert Poly(0, x).all_monoms() == [(0,)] assert Poly(1, x).all_monoms() == [(0,)] assert Poly(2*x + 1, x).all_monoms() == [(1,), (0,)] assert Poly(7*x**2 + 2*x + 1, x).all_monoms() == [(2,), (1,), (0,)] assert Poly(7*x**4 + 2*x + 1, x).all_monoms() == [(4,), (3,), (2,), (1,), (0,)] def test_Poly_all_terms(): assert Poly(0, x).all_terms() == [((0,), 0)] assert Poly(1, x).all_terms() == [((0,), 1)] assert Poly(2*x + 1, x).all_terms() == [((1,), 2), ((0,), 1)] assert Poly(7*x**2 + 2*x + 1, x).all_terms() == \ [((2,), 7), ((1,), 2), ((0,), 1)] assert Poly(7*x**4 + 2*x + 1, x).all_terms() == \ [((4,), 7), ((3,), 0), ((2,), 0), ((1,), 2), ((0,), 1)] def test_Poly_termwise(): f = Poly(x**2 + 20*x + 400) g = Poly(x**2 + 2*x + 4) def func(monom, coeff): (k,) = monom return coeff//10**(2 - k) assert f.termwise(func) == g def func(monom, coeff): (k,) = monom return (k,), coeff//10**(2 - k) assert f.termwise(func) == g def test_Poly_length(): assert Poly(0, x).length() == 0 assert Poly(1, x).length() == 1 assert Poly(x, x).length() == 1 assert Poly(x + 1, x).length() == 2 assert Poly(x**2 + 1, x).length() == 2 assert Poly(x**2 + x + 1, x).length() == 3 def test_Poly_as_dict(): assert Poly(0, x).as_dict() == {} assert Poly(0, x, y, z).as_dict() == {} assert Poly(1, x).as_dict() == {(0,): 1} assert Poly(1, x, y, z).as_dict() == {(0, 0, 0): 1} assert Poly(x**2 + 3, x).as_dict() == {(2,): 1, (0,): 3} assert Poly(x**2 + 3, x, y, z).as_dict() == {(2, 0, 0): 1, (0, 0, 0): 3} assert Poly(3*x**2*y*z**3 + 4*x*y + 5*x*z).as_dict() == {(2, 1, 3): 3, (1, 1, 0): 4, (1, 0, 1): 5} def test_Poly_as_expr(): assert Poly(0, x).as_expr() == 0 assert Poly(0, x, y, z).as_expr() == 0 assert Poly(1, x).as_expr() == 1 assert Poly(1, x, y, z).as_expr() == 1 assert Poly(x**2 + 3, x).as_expr() == x**2 + 3 assert Poly(x**2 + 3, x, y, z).as_expr() == x**2 + 3 assert Poly( 3*x**2*y*z**3 + 4*x*y + 5*x*z).as_expr() == 3*x**2*y*z**3 + 4*x*y + 5*x*z f = Poly(x**2 + 2*x*y**2 - y, x, y) assert f.as_expr() == -y + x**2 + 2*x*y**2 assert f.as_expr({x: 5}) == 25 - y + 10*y**2 assert f.as_expr({y: 6}) == -6 + 72*x + x**2 assert f.as_expr({x: 5, y: 6}) == 379 assert f.as_expr(5, 6) == 379 raises(GeneratorsError, lambda: f.as_expr({z: 7})) def test_Poly_lift(): assert Poly(x**4 - I*x + 17*I, x, gaussian=True).lift() == \ Poly(x**16 + 2*x**10 + 578*x**8 + x**4 - 578*x**2 + 83521, x, domain='QQ') def test_Poly_deflate(): assert Poly(0, x).deflate() == ((1,), Poly(0, x)) assert Poly(1, x).deflate() == ((1,), Poly(1, x)) assert Poly(x, x).deflate() == ((1,), Poly(x, x)) assert Poly(x**2, x).deflate() == ((2,), Poly(x, x)) assert Poly(x**17, x).deflate() == ((17,), Poly(x, x)) assert Poly( x**2*y*z**11 + x**4*z**11).deflate() == ((2, 1, 11), Poly(x*y*z + x**2*z)) def test_Poly_inject(): f = Poly(x**2*y + x*y**3 + x*y + 1, x) assert f.inject() == Poly(x**2*y + x*y**3 + x*y + 1, x, y) assert f.inject(front=True) == Poly(y**3*x + y*x**2 + y*x + 1, y, x) def test_Poly_eject(): f = Poly(x**2*y + x*y**3 + x*y + 1, x, y) assert f.eject(x) == Poly(x*y**3 + (x**2 + x)*y + 1, y, domain='ZZ[x]') assert f.eject(y) == Poly(y*x**2 + (y**3 + y)*x + 1, x, domain='ZZ[y]') ex = x + y + z + t + w g = Poly(ex, x, y, z, t, w) assert g.eject(x) == Poly(ex, y, z, t, w, domain='ZZ[x]') assert g.eject(x, y) == Poly(ex, z, t, w, domain='ZZ[x, y]') assert g.eject(x, y, z) == Poly(ex, t, w, domain='ZZ[x, y, z]') assert g.eject(w) == Poly(ex, x, y, z, t, domain='ZZ[w]') assert g.eject(t, w) == Poly(ex, x, y, z, domain='ZZ[t, w]') assert g.eject(z, t, w) == Poly(ex, x, y, domain='ZZ[z, t, w]') raises(DomainError, lambda: Poly(x*y, x, y, domain=ZZ[z]).eject(y)) raises(NotImplementedError, lambda: Poly(x*y, x, y, z).eject(y)) def test_Poly_exclude(): assert Poly(x, x, y).exclude() == Poly(x, x) assert Poly(x*y, x, y).exclude() == Poly(x*y, x, y) assert Poly(1, x, y).exclude() == Poly(1, x, y) def test_Poly__gen_to_level(): assert Poly(1, x, y)._gen_to_level(-2) == 0 assert Poly(1, x, y)._gen_to_level(-1) == 1 assert Poly(1, x, y)._gen_to_level( 0) == 0 assert Poly(1, x, y)._gen_to_level( 1) == 1 raises(PolynomialError, lambda: Poly(1, x, y)._gen_to_level(-3)) raises(PolynomialError, lambda: Poly(1, x, y)._gen_to_level( 2)) assert Poly(1, x, y)._gen_to_level(x) == 0 assert Poly(1, x, y)._gen_to_level(y) == 1 assert Poly(1, x, y)._gen_to_level('x') == 0 assert Poly(1, x, y)._gen_to_level('y') == 1 raises(PolynomialError, lambda: Poly(1, x, y)._gen_to_level(z)) raises(PolynomialError, lambda: Poly(1, x, y)._gen_to_level('z')) def test_Poly_degree(): assert Poly(0, x).degree() is -oo assert Poly(1, x).degree() == 0 assert Poly(x, x).degree() == 1 assert Poly(0, x).degree(gen=0) is -oo assert Poly(1, x).degree(gen=0) == 0 assert Poly(x, x).degree(gen=0) == 1 assert Poly(0, x).degree(gen=x) is -oo assert Poly(1, x).degree(gen=x) == 0 assert Poly(x, x).degree(gen=x) == 1 assert Poly(0, x).degree(gen='x') is -oo assert Poly(1, x).degree(gen='x') == 0 assert Poly(x, x).degree(gen='x') == 1 raises(PolynomialError, lambda: Poly(1, x).degree(gen=1)) raises(PolynomialError, lambda: Poly(1, x).degree(gen=y)) raises(PolynomialError, lambda: Poly(1, x).degree(gen='y')) assert Poly(1, x, y).degree() == 0 assert Poly(2*y, x, y).degree() == 0 assert Poly(x*y, x, y).degree() == 1 assert Poly(1, x, y).degree(gen=x) == 0 assert Poly(2*y, x, y).degree(gen=x) == 0 assert Poly(x*y, x, y).degree(gen=x) == 1 assert Poly(1, x, y).degree(gen=y) == 0 assert Poly(2*y, x, y).degree(gen=y) == 1 assert Poly(x*y, x, y).degree(gen=y) == 1 assert degree(0, x) is -oo assert degree(1, x) == 0 assert degree(x, x) == 1 assert degree(x*y**2, x) == 1 assert degree(x*y**2, y) == 2 assert degree(x*y**2, z) == 0 assert degree(pi) == 1 raises(TypeError, lambda: degree(y**2 + x**3)) raises(TypeError, lambda: degree(y**2 + x**3, 1)) raises(PolynomialError, lambda: degree(x, 1.1)) raises(PolynomialError, lambda: degree(x**2/(x**3 + 1), x)) assert degree(Poly(0,x),z) is -oo assert degree(Poly(1,x),z) == 0 assert degree(Poly(x**2+y**3,y)) == 3 assert degree(Poly(y**2 + x**3, y, x), 1) == 3 assert degree(Poly(y**2 + x**3, x), z) == 0 assert degree(Poly(y**2 + x**3 + z**4, x), z) == 4 def test_Poly_degree_list(): assert Poly(0, x).degree_list() == (-oo,) assert Poly(0, x, y).degree_list() == (-oo, -oo) assert Poly(0, x, y, z).degree_list() == (-oo, -oo, -oo) assert Poly(1, x).degree_list() == (0,) assert Poly(1, x, y).degree_list() == (0, 0) assert Poly(1, x, y, z).degree_list() == (0, 0, 0) assert Poly(x**2*y + x**3*z**2 + 1).degree_list() == (3, 1, 2) assert degree_list(1, x) == (0,) assert degree_list(x, x) == (1,) assert degree_list(x*y**2) == (1, 2) raises(ComputationFailed, lambda: degree_list(1)) def test_Poly_total_degree(): assert Poly(x**2*y + x**3*z**2 + 1).total_degree() == 5 assert Poly(x**2 + z**3).total_degree() == 3 assert Poly(x*y*z + z**4).total_degree() == 4 assert Poly(x**3 + x + 1).total_degree() == 3 assert total_degree(x*y + z**3) == 3 assert total_degree(x*y + z**3, x, y) == 2 assert total_degree(1) == 0 assert total_degree(Poly(y**2 + x**3 + z**4)) == 4 assert total_degree(Poly(y**2 + x**3 + z**4, x)) == 3 assert total_degree(Poly(y**2 + x**3 + z**4, x), z) == 4 assert total_degree(Poly(x**9 + x*z*y + x**3*z**2 + z**7,x), z) == 7 def test_Poly_homogenize(): assert Poly(x**2+y).homogenize(z) == Poly(x**2+y*z) assert Poly(x+y).homogenize(z) == Poly(x+y, x, y, z) assert Poly(x+y**2).homogenize(y) == Poly(x*y+y**2) def test_Poly_homogeneous_order(): assert Poly(0, x, y).homogeneous_order() is -oo assert Poly(1, x, y).homogeneous_order() == 0 assert Poly(x, x, y).homogeneous_order() == 1 assert Poly(x*y, x, y).homogeneous_order() == 2 assert Poly(x + 1, x, y).homogeneous_order() is None assert Poly(x*y + x, x, y).homogeneous_order() is None assert Poly(x**5 + 2*x**3*y**2 + 9*x*y**4).homogeneous_order() == 5 assert Poly(x**5 + 2*x**3*y**3 + 9*x*y**4).homogeneous_order() is None def test_Poly_LC(): assert Poly(0, x).LC() == 0 assert Poly(1, x).LC() == 1 assert Poly(2*x**2 + x, x).LC() == 2 assert Poly(x*y**7 + 2*x**2*y**3).LC('lex') == 2 assert Poly(x*y**7 + 2*x**2*y**3).LC('grlex') == 1 assert LC(x*y**7 + 2*x**2*y**3, order='lex') == 2 assert LC(x*y**7 + 2*x**2*y**3, order='grlex') == 1 def test_Poly_TC(): assert Poly(0, x).TC() == 0 assert Poly(1, x).TC() == 1 assert Poly(2*x**2 + x, x).TC() == 0 def test_Poly_EC(): assert Poly(0, x).EC() == 0 assert Poly(1, x).EC() == 1 assert Poly(2*x**2 + x, x).EC() == 1 assert Poly(x*y**7 + 2*x**2*y**3).EC('lex') == 1 assert Poly(x*y**7 + 2*x**2*y**3).EC('grlex') == 2 def test_Poly_coeff(): assert Poly(0, x).coeff_monomial(1) == 0 assert Poly(0, x).coeff_monomial(x) == 0 assert Poly(1, x).coeff_monomial(1) == 1 assert Poly(1, x).coeff_monomial(x) == 0 assert Poly(x**8, x).coeff_monomial(1) == 0 assert Poly(x**8, x).coeff_monomial(x**7) == 0 assert Poly(x**8, x).coeff_monomial(x**8) == 1 assert Poly(x**8, x).coeff_monomial(x**9) == 0 assert Poly(3*x*y**2 + 1, x, y).coeff_monomial(1) == 1 assert Poly(3*x*y**2 + 1, x, y).coeff_monomial(x*y**2) == 3 p = Poly(24*x*y*exp(8) + 23*x, x, y) assert p.coeff_monomial(x) == 23 assert p.coeff_monomial(y) == 0 assert p.coeff_monomial(x*y) == 24*exp(8) assert p.as_expr().coeff(x) == 24*y*exp(8) + 23 raises(NotImplementedError, lambda: p.coeff(x)) raises(ValueError, lambda: Poly(x + 1).coeff_monomial(0)) raises(ValueError, lambda: Poly(x + 1).coeff_monomial(3*x)) raises(ValueError, lambda: Poly(x + 1).coeff_monomial(3*x*y)) def test_Poly_nth(): assert Poly(0, x).nth(0) == 0 assert Poly(0, x).nth(1) == 0 assert Poly(1, x).nth(0) == 1 assert Poly(1, x).nth(1) == 0 assert Poly(x**8, x).nth(0) == 0 assert Poly(x**8, x).nth(7) == 0 assert Poly(x**8, x).nth(8) == 1 assert Poly(x**8, x).nth(9) == 0 assert Poly(3*x*y**2 + 1, x, y).nth(0, 0) == 1 assert Poly(3*x*y**2 + 1, x, y).nth(1, 2) == 3 raises(ValueError, lambda: Poly(x*y + 1, x, y).nth(1)) def test_Poly_LM(): assert Poly(0, x).LM() == (0,) assert Poly(1, x).LM() == (0,) assert Poly(2*x**2 + x, x).LM() == (2,) assert Poly(x*y**7 + 2*x**2*y**3).LM('lex') == (2, 3) assert Poly(x*y**7 + 2*x**2*y**3).LM('grlex') == (1, 7) assert LM(x*y**7 + 2*x**2*y**3, order='lex') == x**2*y**3 assert LM(x*y**7 + 2*x**2*y**3, order='grlex') == x*y**7 def test_Poly_LM_custom_order(): f = Poly(x**2*y**3*z + x**2*y*z**3 + x*y*z + 1) rev_lex = lambda monom: tuple(reversed(monom)) assert f.LM(order='lex') == (2, 3, 1) assert f.LM(order=rev_lex) == (2, 1, 3) def test_Poly_EM(): assert Poly(0, x).EM() == (0,) assert Poly(1, x).EM() == (0,) assert Poly(2*x**2 + x, x).EM() == (1,) assert Poly(x*y**7 + 2*x**2*y**3).EM('lex') == (1, 7) assert Poly(x*y**7 + 2*x**2*y**3).EM('grlex') == (2, 3) def test_Poly_LT(): assert Poly(0, x).LT() == ((0,), 0) assert Poly(1, x).LT() == ((0,), 1) assert Poly(2*x**2 + x, x).LT() == ((2,), 2) assert Poly(x*y**7 + 2*x**2*y**3).LT('lex') == ((2, 3), 2) assert Poly(x*y**7 + 2*x**2*y**3).LT('grlex') == ((1, 7), 1) assert LT(x*y**7 + 2*x**2*y**3, order='lex') == 2*x**2*y**3 assert LT(x*y**7 + 2*x**2*y**3, order='grlex') == x*y**7 def test_Poly_ET(): assert Poly(0, x).ET() == ((0,), 0) assert Poly(1, x).ET() == ((0,), 1) assert Poly(2*x**2 + x, x).ET() == ((1,), 1) assert Poly(x*y**7 + 2*x**2*y**3).ET('lex') == ((1, 7), 1) assert Poly(x*y**7 + 2*x**2*y**3).ET('grlex') == ((2, 3), 2) def test_Poly_max_norm(): assert Poly(-1, x).max_norm() == 1 assert Poly( 0, x).max_norm() == 0 assert Poly( 1, x).max_norm() == 1 def test_Poly_l1_norm(): assert Poly(-1, x).l1_norm() == 1 assert Poly( 0, x).l1_norm() == 0 assert Poly( 1, x).l1_norm() == 1 def test_Poly_clear_denoms(): coeff, poly = Poly(x + 2, x).clear_denoms() assert coeff == 1 and poly == Poly( x + 2, x, domain='ZZ') and poly.get_domain() == ZZ coeff, poly = Poly(x/2 + 1, x).clear_denoms() assert coeff == 2 and poly == Poly( x + 2, x, domain='QQ') and poly.get_domain() == QQ coeff, poly = Poly(x/2 + 1, x).clear_denoms(convert=True) assert coeff == 2 and poly == Poly( x + 2, x, domain='ZZ') and poly.get_domain() == ZZ coeff, poly = Poly(x/y + 1, x).clear_denoms(convert=True) assert coeff == y and poly == Poly( x + y, x, domain='ZZ[y]') and poly.get_domain() == ZZ[y] coeff, poly = Poly(x/3 + sqrt(2), x, domain='EX').clear_denoms() assert coeff == 3 and poly == Poly( x + 3*sqrt(2), x, domain='EX') and poly.get_domain() == EX coeff, poly = Poly( x/3 + sqrt(2), x, domain='EX').clear_denoms(convert=True) assert coeff == 3 and poly == Poly( x + 3*sqrt(2), x, domain='EX') and poly.get_domain() == EX def test_Poly_rat_clear_denoms(): f = Poly(x**2/y + 1, x) g = Poly(x**3 + y, x) assert f.rat_clear_denoms(g) == \ (Poly(x**2 + y, x), Poly(y*x**3 + y**2, x)) f = f.set_domain(EX) g = g.set_domain(EX) assert f.rat_clear_denoms(g) == (f, g) def test_Poly_integrate(): assert Poly(x + 1).integrate() == Poly(x**2/2 + x) assert Poly(x + 1).integrate(x) == Poly(x**2/2 + x) assert Poly(x + 1).integrate((x, 1)) == Poly(x**2/2 + x) assert Poly(x*y + 1).integrate(x) == Poly(x**2*y/2 + x) assert Poly(x*y + 1).integrate(y) == Poly(x*y**2/2 + y) assert Poly(x*y + 1).integrate(x, x) == Poly(x**3*y/6 + x**2/2) assert Poly(x*y + 1).integrate(y, y) == Poly(x*y**3/6 + y**2/2) assert Poly(x*y + 1).integrate((x, 2)) == Poly(x**3*y/6 + x**2/2) assert Poly(x*y + 1).integrate((y, 2)) == Poly(x*y**3/6 + y**2/2) assert Poly(x*y + 1).integrate(x, y) == Poly(x**2*y**2/4 + x*y) assert Poly(x*y + 1).integrate(y, x) == Poly(x**2*y**2/4 + x*y) def test_Poly_diff(): assert Poly(x**2 + x).diff() == Poly(2*x + 1) assert Poly(x**2 + x).diff(x) == Poly(2*x + 1) assert Poly(x**2 + x).diff((x, 1)) == Poly(2*x + 1) assert Poly(x**2*y**2 + x*y).diff(x) == Poly(2*x*y**2 + y) assert Poly(x**2*y**2 + x*y).diff(y) == Poly(2*x**2*y + x) assert Poly(x**2*y**2 + x*y).diff(x, x) == Poly(2*y**2, x, y) assert Poly(x**2*y**2 + x*y).diff(y, y) == Poly(2*x**2, x, y) assert Poly(x**2*y**2 + x*y).diff((x, 2)) == Poly(2*y**2, x, y) assert Poly(x**2*y**2 + x*y).diff((y, 2)) == Poly(2*x**2, x, y) assert Poly(x**2*y**2 + x*y).diff(x, y) == Poly(4*x*y + 1) assert Poly(x**2*y**2 + x*y).diff(y, x) == Poly(4*x*y + 1) def test_issue_9585(): assert diff(Poly(x**2 + x)) == Poly(2*x + 1) assert diff(Poly(x**2 + x), x, evaluate=False) == \ Derivative(Poly(x**2 + x), x) assert Derivative(Poly(x**2 + x), x).doit() == Poly(2*x + 1) def test_Poly_eval(): assert Poly(0, x).eval(7) == 0 assert Poly(1, x).eval(7) == 1 assert Poly(x, x).eval(7) == 7 assert Poly(0, x).eval(0, 7) == 0 assert Poly(1, x).eval(0, 7) == 1 assert Poly(x, x).eval(0, 7) == 7 assert Poly(0, x).eval(x, 7) == 0 assert Poly(1, x).eval(x, 7) == 1 assert Poly(x, x).eval(x, 7) == 7 assert Poly(0, x).eval('x', 7) == 0 assert Poly(1, x).eval('x', 7) == 1 assert Poly(x, x).eval('x', 7) == 7 raises(PolynomialError, lambda: Poly(1, x).eval(1, 7)) raises(PolynomialError, lambda: Poly(1, x).eval(y, 7)) raises(PolynomialError, lambda: Poly(1, x).eval('y', 7)) assert Poly(123, x, y).eval(7) == Poly(123, y) assert Poly(2*y, x, y).eval(7) == Poly(2*y, y) assert Poly(x*y, x, y).eval(7) == Poly(7*y, y) assert Poly(123, x, y).eval(x, 7) == Poly(123, y) assert Poly(2*y, x, y).eval(x, 7) == Poly(2*y, y) assert Poly(x*y, x, y).eval(x, 7) == Poly(7*y, y) assert Poly(123, x, y).eval(y, 7) == Poly(123, x) assert Poly(2*y, x, y).eval(y, 7) == Poly(14, x) assert Poly(x*y, x, y).eval(y, 7) == Poly(7*x, x) assert Poly(x*y + y, x, y).eval({x: 7}) == Poly(8*y, y) assert Poly(x*y + y, x, y).eval({y: 7}) == Poly(7*x + 7, x) assert Poly(x*y + y, x, y).eval({x: 6, y: 7}) == 49 assert Poly(x*y + y, x, y).eval({x: 7, y: 6}) == 48 assert Poly(x*y + y, x, y).eval((6, 7)) == 49 assert Poly(x*y + y, x, y).eval([6, 7]) == 49 assert Poly(x + 1, domain='ZZ').eval(S.Half) == Rational(3, 2) assert Poly(x + 1, domain='ZZ').eval(sqrt(2)) == sqrt(2) + 1 raises(ValueError, lambda: Poly(x*y + y, x, y).eval((6, 7, 8))) raises(DomainError, lambda: Poly(x + 1, domain='ZZ').eval(S.Half, auto=False)) # issue 6344 alpha = Symbol('alpha') result = (2*alpha*z - 2*alpha + z**2 + 3)/(z**2 - 2*z + 1) f = Poly(x**2 + (alpha - 1)*x - alpha + 1, x, domain='ZZ[alpha]') assert f.eval((z + 1)/(z - 1)) == result g = Poly(x**2 + (alpha - 1)*x - alpha + 1, x, y, domain='ZZ[alpha]') assert g.eval((z + 1)/(z - 1)) == Poly(result, y, domain='ZZ(alpha,z)') def test_Poly___call__(): f = Poly(2*x*y + 3*x + y + 2*z) assert f(2) == Poly(5*y + 2*z + 6) assert f(2, 5) == Poly(2*z + 31) assert f(2, 5, 7) == 45 def test_parallel_poly_from_expr(): assert parallel_poly_from_expr( [x - 1, x**2 - 1], x)[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [Poly(x - 1, x), x**2 - 1], x)[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [x - 1, Poly(x**2 - 1, x)], x)[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr([Poly( x - 1, x), Poly(x**2 - 1, x)], x)[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [x - 1, x**2 - 1], x, y)[0] == [Poly(x - 1, x, y), Poly(x**2 - 1, x, y)] assert parallel_poly_from_expr([Poly( x - 1, x), x**2 - 1], x, y)[0] == [Poly(x - 1, x, y), Poly(x**2 - 1, x, y)] assert parallel_poly_from_expr([x - 1, Poly( x**2 - 1, x)], x, y)[0] == [Poly(x - 1, x, y), Poly(x**2 - 1, x, y)] assert parallel_poly_from_expr([Poly(x - 1, x), Poly( x**2 - 1, x)], x, y)[0] == [Poly(x - 1, x, y), Poly(x**2 - 1, x, y)] assert parallel_poly_from_expr( [x - 1, x**2 - 1])[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [Poly(x - 1, x), x**2 - 1])[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [x - 1, Poly(x**2 - 1, x)])[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [Poly(x - 1, x), Poly(x**2 - 1, x)])[0] == [Poly(x - 1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [1, x**2 - 1])[0] == [Poly(1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [1, x**2 - 1])[0] == [Poly(1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [1, Poly(x**2 - 1, x)])[0] == [Poly(1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [1, Poly(x**2 - 1, x)])[0] == [Poly(1, x), Poly(x**2 - 1, x)] assert parallel_poly_from_expr( [x**2 - 1, 1])[0] == [Poly(x**2 - 1, x), Poly(1, x)] assert parallel_poly_from_expr( [x**2 - 1, 1])[0] == [Poly(x**2 - 1, x), Poly(1, x)] assert parallel_poly_from_expr( [Poly(x**2 - 1, x), 1])[0] == [Poly(x**2 - 1, x), Poly(1, x)] assert parallel_poly_from_expr( [Poly(x**2 - 1, x), 1])[0] == [Poly(x**2 - 1, x), Poly(1, x)] assert parallel_poly_from_expr([Poly(x, x, y), Poly(y, x, y)], x, y, order='lex')[0] == \ [Poly(x, x, y, domain='ZZ'), Poly(y, x, y, domain='ZZ')] raises(PolificationFailed, lambda: parallel_poly_from_expr([0, 1])) def test_pdiv(): f, g = x**2 - y**2, x - y q, r = x + y, 0 F, G, Q, R = [ Poly(h, x, y) for h in (f, g, q, r) ] assert F.pdiv(G) == (Q, R) assert F.prem(G) == R assert F.pquo(G) == Q assert F.pexquo(G) == Q assert pdiv(f, g) == (q, r) assert prem(f, g) == r assert pquo(f, g) == q assert pexquo(f, g) == q assert pdiv(f, g, x, y) == (q, r) assert prem(f, g, x, y) == r assert pquo(f, g, x, y) == q assert pexquo(f, g, x, y) == q assert pdiv(f, g, (x, y)) == (q, r) assert prem(f, g, (x, y)) == r assert pquo(f, g, (x, y)) == q assert pexquo(f, g, (x, y)) == q assert pdiv(F, G) == (Q, R) assert prem(F, G) == R assert pquo(F, G) == Q assert pexquo(F, G) == Q assert pdiv(f, g, polys=True) == (Q, R) assert prem(f, g, polys=True) == R assert pquo(f, g, polys=True) == Q assert pexquo(f, g, polys=True) == Q assert pdiv(F, G, polys=False) == (q, r) assert prem(F, G, polys=False) == r assert pquo(F, G, polys=False) == q assert pexquo(F, G, polys=False) == q raises(ComputationFailed, lambda: pdiv(4, 2)) raises(ComputationFailed, lambda: prem(4, 2)) raises(ComputationFailed, lambda: pquo(4, 2)) raises(ComputationFailed, lambda: pexquo(4, 2)) def test_div(): f, g = x**2 - y**2, x - y q, r = x + y, 0 F, G, Q, R = [ Poly(h, x, y) for h in (f, g, q, r) ] assert F.div(G) == (Q, R) assert F.rem(G) == R assert F.quo(G) == Q assert F.exquo(G) == Q assert div(f, g) == (q, r) assert rem(f, g) == r assert quo(f, g) == q assert exquo(f, g) == q assert div(f, g, x, y) == (q, r) assert rem(f, g, x, y) == r assert quo(f, g, x, y) == q assert exquo(f, g, x, y) == q assert div(f, g, (x, y)) == (q, r) assert rem(f, g, (x, y)) == r assert quo(f, g, (x, y)) == q assert exquo(f, g, (x, y)) == q assert div(F, G) == (Q, R) assert rem(F, G) == R assert quo(F, G) == Q assert exquo(F, G) == Q assert div(f, g, polys=True) == (Q, R) assert rem(f, g, polys=True) == R assert quo(f, g, polys=True) == Q assert exquo(f, g, polys=True) == Q assert div(F, G, polys=False) == (q, r) assert rem(F, G, polys=False) == r assert quo(F, G, polys=False) == q assert exquo(F, G, polys=False) == q raises(ComputationFailed, lambda: div(4, 2)) raises(ComputationFailed, lambda: rem(4, 2)) raises(ComputationFailed, lambda: quo(4, 2)) raises(ComputationFailed, lambda: exquo(4, 2)) f, g = x**2 + 1, 2*x - 4 qz, rz = 0, x**2 + 1 qq, rq = x/2 + 1, 5 assert div(f, g) == (qq, rq) assert div(f, g, auto=True) == (qq, rq) assert div(f, g, auto=False) == (qz, rz) assert div(f, g, domain=ZZ) == (qz, rz) assert div(f, g, domain=QQ) == (qq, rq) assert div(f, g, domain=ZZ, auto=True) == (qq, rq) assert div(f, g, domain=ZZ, auto=False) == (qz, rz) assert div(f, g, domain=QQ, auto=True) == (qq, rq) assert div(f, g, domain=QQ, auto=False) == (qq, rq) assert rem(f, g) == rq assert rem(f, g, auto=True) == rq assert rem(f, g, auto=False) == rz assert rem(f, g, domain=ZZ) == rz assert rem(f, g, domain=QQ) == rq assert rem(f, g, domain=ZZ, auto=True) == rq assert rem(f, g, domain=ZZ, auto=False) == rz assert rem(f, g, domain=QQ, auto=True) == rq assert rem(f, g, domain=QQ, auto=False) == rq assert quo(f, g) == qq assert quo(f, g, auto=True) == qq assert quo(f, g, auto=False) == qz assert quo(f, g, domain=ZZ) == qz assert quo(f, g, domain=QQ) == qq assert quo(f, g, domain=ZZ, auto=True) == qq assert quo(f, g, domain=ZZ, auto=False) == qz assert quo(f, g, domain=QQ, auto=True) == qq assert quo(f, g, domain=QQ, auto=False) == qq f, g, q = x**2, 2*x, x/2 assert exquo(f, g) == q assert exquo(f, g, auto=True) == q raises(ExactQuotientFailed, lambda: exquo(f, g, auto=False)) raises(ExactQuotientFailed, lambda: exquo(f, g, domain=ZZ)) assert exquo(f, g, domain=QQ) == q assert exquo(f, g, domain=ZZ, auto=True) == q raises(ExactQuotientFailed, lambda: exquo(f, g, domain=ZZ, auto=False)) assert exquo(f, g, domain=QQ, auto=True) == q assert exquo(f, g, domain=QQ, auto=False) == q f, g = Poly(x**2), Poly(x) q, r = f.div(g) assert q.get_domain().is_ZZ and r.get_domain().is_ZZ r = f.rem(g) assert r.get_domain().is_ZZ q = f.quo(g) assert q.get_domain().is_ZZ q = f.exquo(g) assert q.get_domain().is_ZZ f, g = Poly(x+y, x), Poly(2*x+y, x) q, r = f.div(g) assert q.get_domain().is_Frac and r.get_domain().is_Frac def test_issue_7864(): q, r = div(a, .408248290463863*a) assert abs(q - 2.44948974278318) < 1e-14 assert r == 0 def test_gcdex(): f, g = 2*x, x**2 - 16 s, t, h = x/32, Rational(-1, 16), 1 F, G, S, T, H = [ Poly(u, x, domain='QQ') for u in (f, g, s, t, h) ] assert F.half_gcdex(G) == (S, H) assert F.gcdex(G) == (S, T, H) assert F.invert(G) == S assert half_gcdex(f, g) == (s, h) assert gcdex(f, g) == (s, t, h) assert invert(f, g) == s assert half_gcdex(f, g, x) == (s, h) assert gcdex(f, g, x) == (s, t, h) assert invert(f, g, x) == s assert half_gcdex(f, g, (x,)) == (s, h) assert gcdex(f, g, (x,)) == (s, t, h) assert invert(f, g, (x,)) == s assert half_gcdex(F, G) == (S, H) assert gcdex(F, G) == (S, T, H) assert invert(F, G) == S assert half_gcdex(f, g, polys=True) == (S, H) assert gcdex(f, g, polys=True) == (S, T, H) assert invert(f, g, polys=True) == S assert half_gcdex(F, G, polys=False) == (s, h) assert gcdex(F, G, polys=False) == (s, t, h) assert invert(F, G, polys=False) == s assert half_gcdex(100, 2004) == (-20, 4) assert gcdex(100, 2004) == (-20, 1, 4) assert invert(3, 7) == 5 raises(DomainError, lambda: half_gcdex(x + 1, 2*x + 1, auto=False)) raises(DomainError, lambda: gcdex(x + 1, 2*x + 1, auto=False)) raises(DomainError, lambda: invert(x + 1, 2*x + 1, auto=False)) def test_revert(): f = Poly(1 - x**2/2 + x**4/24 - x**6/720) g = Poly(61*x**6/720 + 5*x**4/24 + x**2/2 + 1) assert f.revert(8) == g def test_subresultants(): f, g, h = x**2 - 2*x + 1, x**2 - 1, 2*x - 2 F, G, H = Poly(f), Poly(g), Poly(h) assert F.subresultants(G) == [F, G, H] assert subresultants(f, g) == [f, g, h] assert subresultants(f, g, x) == [f, g, h] assert subresultants(f, g, (x,)) == [f, g, h] assert subresultants(F, G) == [F, G, H] assert subresultants(f, g, polys=True) == [F, G, H] assert subresultants(F, G, polys=False) == [f, g, h] raises(ComputationFailed, lambda: subresultants(4, 2)) def test_resultant(): f, g, h = x**2 - 2*x + 1, x**2 - 1, 0 F, G = Poly(f), Poly(g) assert F.resultant(G) == h assert resultant(f, g) == h assert resultant(f, g, x) == h assert resultant(f, g, (x,)) == h assert resultant(F, G) == h assert resultant(f, g, polys=True) == h assert resultant(F, G, polys=False) == h assert resultant(f, g, includePRS=True) == (h, [f, g, 2*x - 2]) f, g, h = x - a, x - b, a - b F, G, H = Poly(f), Poly(g), Poly(h) assert F.resultant(G) == H assert resultant(f, g) == h assert resultant(f, g, x) == h assert resultant(f, g, (x,)) == h assert resultant(F, G) == H assert resultant(f, g, polys=True) == H assert resultant(F, G, polys=False) == h raises(ComputationFailed, lambda: resultant(4, 2)) def test_discriminant(): f, g = x**3 + 3*x**2 + 9*x - 13, -11664 F = Poly(f) assert F.discriminant() == g assert discriminant(f) == g assert discriminant(f, x) == g assert discriminant(f, (x,)) == g assert discriminant(F) == g assert discriminant(f, polys=True) == g assert discriminant(F, polys=False) == g f, g = a*x**2 + b*x + c, b**2 - 4*a*c F, G = Poly(f), Poly(g) assert F.discriminant() == G assert discriminant(f) == g assert discriminant(f, x, a, b, c) == g assert discriminant(f, (x, a, b, c)) == g assert discriminant(F) == G assert discriminant(f, polys=True) == G assert discriminant(F, polys=False) == g raises(ComputationFailed, lambda: discriminant(4)) def test_dispersion(): # We test only the API here. For more mathematical # tests see the dedicated test file. fp = poly((x + 1)*(x + 2), x) assert sorted(fp.dispersionset()) == [0, 1] assert fp.dispersion() == 1 fp = poly(x**4 - 3*x**2 + 1, x) gp = fp.shift(-3) assert sorted(fp.dispersionset(gp)) == [2, 3, 4] assert fp.dispersion(gp) == 4 def test_gcd_list(): F = [x**3 - 1, x**2 - 1, x**2 - 3*x + 2] assert gcd_list(F) == x - 1 assert gcd_list(F, polys=True) == Poly(x - 1) assert gcd_list([]) == 0 assert gcd_list([1, 2]) == 1 assert gcd_list([4, 6, 8]) == 2 assert gcd_list([x*(y + 42) - x*y - x*42]) == 0 gcd = gcd_list([], x) assert gcd.is_Number and gcd is S.Zero gcd = gcd_list([], x, polys=True) assert gcd.is_Poly and gcd.is_zero raises(ComputationFailed, lambda: gcd_list([], polys=True)) def test_lcm_list(): F = [x**3 - 1, x**2 - 1, x**2 - 3*x + 2] assert lcm_list(F) == x**5 - x**4 - 2*x**3 - x**2 + x + 2 assert lcm_list(F, polys=True) == Poly(x**5 - x**4 - 2*x**3 - x**2 + x + 2) assert lcm_list([]) == 1 assert lcm_list([1, 2]) == 2 assert lcm_list([4, 6, 8]) == 24 assert lcm_list([x*(y + 42) - x*y - x*42]) == 0 lcm = lcm_list([], x) assert lcm.is_Number and lcm is S.One lcm = lcm_list([], x, polys=True) assert lcm.is_Poly and lcm.is_one raises(ComputationFailed, lambda: lcm_list([], polys=True)) def test_gcd(): f, g = x**3 - 1, x**2 - 1 s, t = x**2 + x + 1, x + 1 h, r = x - 1, x**4 + x**3 - x - 1 F, G, S, T, H, R = [ Poly(u) for u in (f, g, s, t, h, r) ] assert F.cofactors(G) == (H, S, T) assert F.gcd(G) == H assert F.lcm(G) == R assert cofactors(f, g) == (h, s, t) assert gcd(f, g) == h assert lcm(f, g) == r assert cofactors(f, g, x) == (h, s, t) assert gcd(f, g, x) == h assert lcm(f, g, x) == r assert cofactors(f, g, (x,)) == (h, s, t) assert gcd(f, g, (x,)) == h assert lcm(f, g, (x,)) == r assert cofactors(F, G) == (H, S, T) assert gcd(F, G) == H assert lcm(F, G) == R assert cofactors(f, g, polys=True) == (H, S, T) assert gcd(f, g, polys=True) == H assert lcm(f, g, polys=True) == R assert cofactors(F, G, polys=False) == (h, s, t) assert gcd(F, G, polys=False) == h assert lcm(F, G, polys=False) == r f, g = 1.0*x**2 - 1.0, 1.0*x - 1.0 h, s, t = g, 1.0*x + 1.0, 1.0 assert cofactors(f, g) == (h, s, t) assert gcd(f, g) == h assert lcm(f, g) == f f, g = 1.0*x**2 - 1.0, 1.0*x - 1.0 h, s, t = g, 1.0*x + 1.0, 1.0 assert cofactors(f, g) == (h, s, t) assert gcd(f, g) == h assert lcm(f, g) == f assert cofactors(8, 6) == (2, 4, 3) assert gcd(8, 6) == 2 assert lcm(8, 6) == 24 f, g = x**2 - 3*x - 4, x**3 - 4*x**2 + x - 4 l = x**4 - 3*x**3 - 3*x**2 - 3*x - 4 h, s, t = x - 4, x + 1, x**2 + 1 assert cofactors(f, g, modulus=11) == (h, s, t) assert gcd(f, g, modulus=11) == h assert lcm(f, g, modulus=11) == l f, g = x**2 + 8*x + 7, x**3 + 7*x**2 + x + 7 l = x**4 + 8*x**3 + 8*x**2 + 8*x + 7 h, s, t = x + 7, x + 1, x**2 + 1 assert cofactors(f, g, modulus=11, symmetric=False) == (h, s, t) assert gcd(f, g, modulus=11, symmetric=False) == h assert lcm(f, g, modulus=11, symmetric=False) == l raises(TypeError, lambda: gcd(x)) raises(TypeError, lambda: lcm(x)) def test_gcd_numbers_vs_polys(): assert isinstance(gcd(3, 9), Integer) assert isinstance(gcd(3*x, 9), Integer) assert gcd(3, 9) == 3 assert gcd(3*x, 9) == 3 assert isinstance(gcd(Rational(3, 2), Rational(9, 4)), Rational) assert isinstance(gcd(Rational(3, 2)*x, Rational(9, 4)), Rational) assert gcd(Rational(3, 2), Rational(9, 4)) == Rational(3, 4) assert gcd(Rational(3, 2)*x, Rational(9, 4)) == 1 assert isinstance(gcd(3.0, 9.0), Float) assert isinstance(gcd(3.0*x, 9.0), Float) assert gcd(3.0, 9.0) == 1.0 assert gcd(3.0*x, 9.0) == 1.0 def test_terms_gcd(): assert terms_gcd(1) == 1 assert terms_gcd(1, x) == 1 assert terms_gcd(x - 1) == x - 1 assert terms_gcd(-x - 1) == -x - 1 assert terms_gcd(2*x + 3) == 2*x + 3 assert terms_gcd(6*x + 4) == Mul(2, 3*x + 2, evaluate=False) assert terms_gcd(x**3*y + x*y**3) == x*y*(x**2 + y**2) assert terms_gcd(2*x**3*y + 2*x*y**3) == 2*x*y*(x**2 + y**2) assert terms_gcd(x**3*y/2 + x*y**3/2) == x*y/2*(x**2 + y**2) assert terms_gcd(x**3*y + 2*x*y**3) == x*y*(x**2 + 2*y**2) assert terms_gcd(2*x**3*y + 4*x*y**3) == 2*x*y*(x**2 + 2*y**2) assert terms_gcd(2*x**3*y/3 + 4*x*y**3/5) == x*y*Rational(2, 15)*(5*x**2 + 6*y**2) assert terms_gcd(2.0*x**3*y + 4.1*x*y**3) == x*y*(2.0*x**2 + 4.1*y**2) assert _aresame(terms_gcd(2.0*x + 3), 2.0*x + 3) assert terms_gcd((3 + 3*x)*(x + x*y), expand=False) == \ (3*x + 3)*(x*y + x) assert terms_gcd((3 + 3*x)*(x + x*sin(3 + 3*y)), expand=False, deep=True) == \ 3*x*(x + 1)*(sin(Mul(3, y + 1, evaluate=False)) + 1) assert terms_gcd(sin(x + x*y), deep=True) == \ sin(x*(y + 1)) eq = Eq(2*x, 2*y + 2*z*y) assert terms_gcd(eq) == Eq(2*x, 2*y*(z + 1)) assert terms_gcd(eq, deep=True) == Eq(2*x, 2*y*(z + 1)) raises(TypeError, lambda: terms_gcd(x < 2)) def test_trunc(): f, g = x**5 + 2*x**4 + 3*x**3 + 4*x**2 + 5*x + 6, x**5 - x**4 + x**2 - x F, G = Poly(f), Poly(g) assert F.trunc(3) == G assert trunc(f, 3) == g assert trunc(f, 3, x) == g assert trunc(f, 3, (x,)) == g assert trunc(F, 3) == G assert trunc(f, 3, polys=True) == G assert trunc(F, 3, polys=False) == g f, g = 6*x**5 + 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1, -x**4 + x**3 - x + 1 F, G = Poly(f), Poly(g) assert F.trunc(3) == G assert trunc(f, 3) == g assert trunc(f, 3, x) == g assert trunc(f, 3, (x,)) == g assert trunc(F, 3) == G assert trunc(f, 3, polys=True) == G assert trunc(F, 3, polys=False) == g f = Poly(x**2 + 2*x + 3, modulus=5) assert f.trunc(2) == Poly(x**2 + 1, modulus=5) def test_monic(): f, g = 2*x - 1, x - S.Half F, G = Poly(f, domain='QQ'), Poly(g) assert F.monic() == G assert monic(f) == g assert monic(f, x) == g assert monic(f, (x,)) == g assert monic(F) == G assert monic(f, polys=True) == G assert monic(F, polys=False) == g raises(ComputationFailed, lambda: monic(4)) assert monic(2*x**2 + 6*x + 4, auto=False) == x**2 + 3*x + 2 raises(ExactQuotientFailed, lambda: monic(2*x + 6*x + 1, auto=False)) assert monic(2.0*x**2 + 6.0*x + 4.0) == 1.0*x**2 + 3.0*x + 2.0 assert monic(2*x**2 + 3*x + 4, modulus=5) == x**2 - x + 2 def test_content(): f, F = 4*x + 2, Poly(4*x + 2) assert F.content() == 2 assert content(f) == 2 raises(ComputationFailed, lambda: content(4)) f = Poly(2*x, modulus=3) assert f.content() == 1 def test_primitive(): f, g = 4*x + 2, 2*x + 1 F, G = Poly(f), Poly(g) assert F.primitive() == (2, G) assert primitive(f) == (2, g) assert primitive(f, x) == (2, g) assert primitive(f, (x,)) == (2, g) assert primitive(F) == (2, G) assert primitive(f, polys=True) == (2, G) assert primitive(F, polys=False) == (2, g) raises(ComputationFailed, lambda: primitive(4)) f = Poly(2*x, modulus=3) g = Poly(2.0*x, domain=RR) assert f.primitive() == (1, f) assert g.primitive() == (1.0, g) assert primitive(S('-3*x/4 + y + 11/8')) == \ S('(1/8, -6*x + 8*y + 11)') def test_compose(): f = x**12 + 20*x**10 + 150*x**8 + 500*x**6 + 625*x**4 - 2*x**3 - 10*x + 9 g = x**4 - 2*x + 9 h = x**3 + 5*x F, G, H = map(Poly, (f, g, h)) assert G.compose(H) == F assert compose(g, h) == f assert compose(g, h, x) == f assert compose(g, h, (x,)) == f assert compose(G, H) == F assert compose(g, h, polys=True) == F assert compose(G, H, polys=False) == f assert F.decompose() == [G, H] assert decompose(f) == [g, h] assert decompose(f, x) == [g, h] assert decompose(f, (x,)) == [g, h] assert decompose(F) == [G, H] assert decompose(f, polys=True) == [G, H] assert decompose(F, polys=False) == [g, h] raises(ComputationFailed, lambda: compose(4, 2)) raises(ComputationFailed, lambda: decompose(4)) assert compose(x**2 - y**2, x - y, x, y) == x**2 - 2*x*y assert compose(x**2 - y**2, x - y, y, x) == -y**2 + 2*x*y def test_shift(): assert Poly(x**2 - 2*x + 1, x).shift(2) == Poly(x**2 + 2*x + 1, x) def test_transform(): # Also test that 3-way unification is done correctly assert Poly(x**2 - 2*x + 1, x).transform(Poly(x + 1), Poly(x - 1)) == \ Poly(4, x) == \ cancel((x - 1)**2*(x**2 - 2*x + 1).subs(x, (x + 1)/(x - 1))) assert Poly(x**2 - x/2 + 1, x).transform(Poly(x + 1), Poly(x - 1)) == \ Poly(3*x**2/2 + Rational(5, 2), x) == \ cancel((x - 1)**2*(x**2 - x/2 + 1).subs(x, (x + 1)/(x - 1))) assert Poly(x**2 - 2*x + 1, x).transform(Poly(x + S.Half), Poly(x - 1)) == \ Poly(Rational(9, 4), x) == \ cancel((x - 1)**2*(x**2 - 2*x + 1).subs(x, (x + S.Half)/(x - 1))) assert Poly(x**2 - 2*x + 1, x).transform(Poly(x + 1), Poly(x - S.Half)) == \ Poly(Rational(9, 4), x) == \ cancel((x - S.Half)**2*(x**2 - 2*x + 1).subs(x, (x + 1)/(x - S.Half))) # Unify ZZ, QQ, and RR assert Poly(x**2 - 2*x + 1, x).transform(Poly(x + 1.0), Poly(x - S.Half)) == \ Poly(Rational(9, 4), x, domain='RR') == \ cancel((x - S.Half)**2*(x**2 - 2*x + 1).subs(x, (x + 1.0)/(x - S.Half))) raises(ValueError, lambda: Poly(x*y).transform(Poly(x + 1), Poly(x - 1))) raises(ValueError, lambda: Poly(x).transform(Poly(y + 1), Poly(x - 1))) raises(ValueError, lambda: Poly(x).transform(Poly(x + 1), Poly(y - 1))) raises(ValueError, lambda: Poly(x).transform(Poly(x*y + 1), Poly(x - 1))) raises(ValueError, lambda: Poly(x).transform(Poly(x + 1), Poly(x*y - 1))) def test_sturm(): f, F = x, Poly(x, domain='QQ') g, G = 1, Poly(1, x, domain='QQ') assert F.sturm() == [F, G] assert sturm(f) == [f, g] assert sturm(f, x) == [f, g] assert sturm(f, (x,)) == [f, g] assert sturm(F) == [F, G] assert sturm(f, polys=True) == [F, G] assert sturm(F, polys=False) == [f, g] raises(ComputationFailed, lambda: sturm(4)) raises(DomainError, lambda: sturm(f, auto=False)) f = Poly(S(1024)/(15625*pi**8)*x**5 - S(4096)/(625*pi**8)*x**4 + S(32)/(15625*pi**4)*x**3 - S(128)/(625*pi**4)*x**2 + Rational(1, 62500)*x - Rational(1, 625), x, domain='ZZ(pi)') assert sturm(f) == \ [Poly(x**3 - 100*x**2 + pi**4/64*x - 25*pi**4/16, x, domain='ZZ(pi)'), Poly(3*x**2 - 200*x + pi**4/64, x, domain='ZZ(pi)'), Poly((Rational(20000, 9) - pi**4/96)*x + 25*pi**4/18, x, domain='ZZ(pi)'), Poly((-3686400000000*pi**4 - 11520000*pi**8 - 9*pi**12)/(26214400000000 - 245760000*pi**4 + 576*pi**8), x, domain='ZZ(pi)')] def test_gff(): f = x**5 + 2*x**4 - x**3 - 2*x**2 assert Poly(f).gff_list() == [(Poly(x), 1), (Poly(x + 2), 4)] assert gff_list(f) == [(x, 1), (x + 2, 4)] raises(NotImplementedError, lambda: gff(f)) f = x*(x - 1)**3*(x - 2)**2*(x - 4)**2*(x - 5) assert Poly(f).gff_list() == [( Poly(x**2 - 5*x + 4), 1), (Poly(x**2 - 5*x + 4), 2), (Poly(x), 3)] assert gff_list(f) == [(x**2 - 5*x + 4, 1), (x**2 - 5*x + 4, 2), (x, 3)] raises(NotImplementedError, lambda: gff(f)) def test_norm(): a, b = sqrt(2), sqrt(3) f = Poly(a*x + b*y, x, y, extension=(a, b)) assert f.norm() == Poly(4*x**4 - 12*x**2*y**2 + 9*y**4, x, y, domain='QQ') def test_sqf_norm(): assert sqf_norm(x**2 - 2, extension=sqrt(3)) == \ (1, x**2 - 2*sqrt(3)*x + 1, x**4 - 10*x**2 + 1) assert sqf_norm(x**2 - 3, extension=sqrt(2)) == \ (1, x**2 - 2*sqrt(2)*x - 1, x**4 - 10*x**2 + 1) assert Poly(x**2 - 2, extension=sqrt(3)).sqf_norm() == \ (1, Poly(x**2 - 2*sqrt(3)*x + 1, x, extension=sqrt(3)), Poly(x**4 - 10*x**2 + 1, x, domain='QQ')) assert Poly(x**2 - 3, extension=sqrt(2)).sqf_norm() == \ (1, Poly(x**2 - 2*sqrt(2)*x - 1, x, extension=sqrt(2)), Poly(x**4 - 10*x**2 + 1, x, domain='QQ')) def test_sqf(): f = x**5 - x**3 - x**2 + 1 g = x**3 + 2*x**2 + 2*x + 1 h = x - 1 p = x**4 + x**3 - x - 1 F, G, H, P = map(Poly, (f, g, h, p)) assert F.sqf_part() == P assert sqf_part(f) == p assert sqf_part(f, x) == p assert sqf_part(f, (x,)) == p assert sqf_part(F) == P assert sqf_part(f, polys=True) == P assert sqf_part(F, polys=False) == p assert F.sqf_list() == (1, [(G, 1), (H, 2)]) assert sqf_list(f) == (1, [(g, 1), (h, 2)]) assert sqf_list(f, x) == (1, [(g, 1), (h, 2)]) assert sqf_list(f, (x,)) == (1, [(g, 1), (h, 2)]) assert sqf_list(F) == (1, [(G, 1), (H, 2)]) assert sqf_list(f, polys=True) == (1, [(G, 1), (H, 2)]) assert sqf_list(F, polys=False) == (1, [(g, 1), (h, 2)]) assert F.sqf_list_include() == [(G, 1), (H, 2)] raises(ComputationFailed, lambda: sqf_part(4)) assert sqf(1) == 1 assert sqf_list(1) == (1, []) assert sqf((2*x**2 + 2)**7) == 128*(x**2 + 1)**7 assert sqf(f) == g*h**2 assert sqf(f, x) == g*h**2 assert sqf(f, (x,)) == g*h**2 d = x**2 + y**2 assert sqf(f/d) == (g*h**2)/d assert sqf(f/d, x) == (g*h**2)/d assert sqf(f/d, (x,)) == (g*h**2)/d assert sqf(x - 1) == x - 1 assert sqf(-x - 1) == -x - 1 assert sqf(x - 1) == x - 1 assert sqf(6*x - 10) == Mul(2, 3*x - 5, evaluate=False) assert sqf((6*x - 10)/(3*x - 6)) == Rational(2, 3)*((3*x - 5)/(x - 2)) assert sqf(Poly(x**2 - 2*x + 1)) == (x - 1)**2 f = 3 + x - x*(1 + x) + x**2 assert sqf(f) == 3 f = (x**2 + 2*x + 1)**20000000000 assert sqf(f) == (x + 1)**40000000000 assert sqf_list(f) == (1, [(x + 1, 40000000000)]) def test_factor(): f = x**5 - x**3 - x**2 + 1 u = x + 1 v = x - 1 w = x**2 + x + 1 F, U, V, W = map(Poly, (f, u, v, w)) assert F.factor_list() == (1, [(U, 1), (V, 2), (W, 1)]) assert factor_list(f) == (1, [(u, 1), (v, 2), (w, 1)]) assert factor_list(f, x) == (1, [(u, 1), (v, 2), (w, 1)]) assert factor_list(f, (x,)) == (1, [(u, 1), (v, 2), (w, 1)]) assert factor_list(F) == (1, [(U, 1), (V, 2), (W, 1)]) assert factor_list(f, polys=True) == (1, [(U, 1), (V, 2), (W, 1)]) assert factor_list(F, polys=False) == (1, [(u, 1), (v, 2), (w, 1)]) assert F.factor_list_include() == [(U, 1), (V, 2), (W, 1)] assert factor_list(1) == (1, []) assert factor_list(6) == (6, []) assert factor_list(sqrt(3), x) == (sqrt(3), []) assert factor_list((-1)**x, x) == (1, [(-1, x)]) assert factor_list((2*x)**y, x) == (1, [(2, y), (x, y)]) assert factor_list(sqrt(x*y), x) == (1, [(x*y, S.Half)]) assert factor(6) == 6 and factor(6).is_Integer assert factor_list(3*x) == (3, [(x, 1)]) assert factor_list(3*x**2) == (3, [(x, 2)]) assert factor(3*x) == 3*x assert factor(3*x**2) == 3*x**2 assert factor((2*x**2 + 2)**7) == 128*(x**2 + 1)**7 assert factor(f) == u*v**2*w assert factor(f, x) == u*v**2*w assert factor(f, (x,)) == u*v**2*w g, p, q, r = x**2 - y**2, x - y, x + y, x**2 + 1 assert factor(f/g) == (u*v**2*w)/(p*q) assert factor(f/g, x) == (u*v**2*w)/(p*q) assert factor(f/g, (x,)) == (u*v**2*w)/(p*q) p = Symbol('p', positive=True) i = Symbol('i', integer=True) r = Symbol('r', real=True) assert factor(sqrt(x*y)).is_Pow is True assert factor(sqrt(3*x**2 - 3)) == sqrt(3)*sqrt((x - 1)*(x + 1)) assert factor(sqrt(3*x**2 + 3)) == sqrt(3)*sqrt(x**2 + 1) assert factor((y*x**2 - y)**i) == y**i*(x - 1)**i*(x + 1)**i assert factor((y*x**2 + y)**i) == y**i*(x**2 + 1)**i assert factor((y*x**2 - y)**t) == (y*(x - 1)*(x + 1))**t assert factor((y*x**2 + y)**t) == (y*(x**2 + 1))**t f = sqrt(expand((r**2 + 1)*(p + 1)*(p - 1)*(p - 2)**3)) g = sqrt((p - 2)**3*(p - 1))*sqrt(p + 1)*sqrt(r**2 + 1) assert factor(f) == g assert factor(g) == g g = (x - 1)**5*(r**2 + 1) f = sqrt(expand(g)) assert factor(f) == sqrt(g) f = Poly(sin(1)*x + 1, x, domain=EX) assert f.factor_list() == (1, [(f, 1)]) f = x**4 + 1 assert factor(f) == f assert factor(f, extension=I) == (x**2 - I)*(x**2 + I) assert factor(f, gaussian=True) == (x**2 - I)*(x**2 + I) assert factor( f, extension=sqrt(2)) == (x**2 + sqrt(2)*x + 1)*(x**2 - sqrt(2)*x + 1) f = x**2 + 2*sqrt(2)*x + 2 assert factor(f, extension=sqrt(2)) == (x + sqrt(2))**2 assert factor(f**3, extension=sqrt(2)) == (x + sqrt(2))**6 assert factor(x**2 - 2*y**2, extension=sqrt(2)) == \ (x + sqrt(2)*y)*(x - sqrt(2)*y) assert factor(2*x**2 - 4*y**2, extension=sqrt(2)) == \ 2*((x + sqrt(2)*y)*(x - sqrt(2)*y)) assert factor(x - 1) == x - 1 assert factor(-x - 1) == -x - 1 assert factor(x - 1) == x - 1 assert factor(6*x - 10) == Mul(2, 3*x - 5, evaluate=False) assert factor(x**11 + x + 1, modulus=65537, symmetric=True) == \ (x**2 + x + 1)*(x**9 - x**8 + x**6 - x**5 + x**3 - x** 2 + 1) assert factor(x**11 + x + 1, modulus=65537, symmetric=False) == \ (x**2 + x + 1)*(x**9 + 65536*x**8 + x**6 + 65536*x**5 + x**3 + 65536*x** 2 + 1) f = x/pi + x*sin(x)/pi g = y/(pi**2 + 2*pi + 1) + y*sin(x)/(pi**2 + 2*pi + 1) assert factor(f) == x*(sin(x) + 1)/pi assert factor(g) == y*(sin(x) + 1)/(pi + 1)**2 assert factor(Eq( x**2 + 2*x + 1, x**3 + 1)) == Eq((x + 1)**2, (x + 1)*(x**2 - x + 1)) f = (x**2 - 1)/(x**2 + 4*x + 4) assert factor(f) == (x + 1)*(x - 1)/(x + 2)**2 assert factor(f, x) == (x + 1)*(x - 1)/(x + 2)**2 f = 3 + x - x*(1 + x) + x**2 assert factor(f) == 3 assert factor(f, x) == 3 assert factor(1/(x**2 + 2*x + 1/x) - 1) == -((1 - x + 2*x**2 + x**3)/(1 + 2*x**2 + x**3)) assert factor(f, expand=False) == f raises(PolynomialError, lambda: factor(f, x, expand=False)) raises(FlagError, lambda: factor(x**2 - 1, polys=True)) assert factor([x, Eq(x**2 - y**2, Tuple(x**2 - z**2, 1/x + 1/y))]) == \ [x, Eq((x - y)*(x + y), Tuple((x - z)*(x + z), (x + y)/x/y))] assert not isinstance( Poly(x**3 + x + 1).factor_list()[1][0][0], PurePoly) is True assert isinstance( PurePoly(x**3 + x + 1).factor_list()[1][0][0], PurePoly) is True assert factor(sqrt(-x)) == sqrt(-x) # issue 5917 e = (-2*x*(-x + 1)*(x - 1)*(-x*(-x + 1)*(x - 1) - x*(x - 1)**2)*(x**2*(x - 1) - x*(x - 1) - x) - (-2*x**2*(x - 1)**2 - x*(-x + 1)*(-x*(-x + 1) + x*(x - 1)))*(x**2*(x - 1)**4 - x*(-x*(-x + 1)*(x - 1) - x*(x - 1)**2))) assert factor(e) == 0 # deep option assert factor(sin(x**2 + x) + x, deep=True) == sin(x*(x + 1)) + x assert factor(sin(x**2 + x)*x, deep=True) == sin(x*(x + 1))*x assert factor(sqrt(x**2)) == sqrt(x**2) # issue 13149 assert factor(expand((0.5*x+1)*(0.5*y+1))) == Mul(1.0, 0.5*x + 1.0, 0.5*y + 1.0, evaluate = False) assert factor(expand((0.5*x+0.5)**2)) == 0.25*(1.0*x + 1.0)**2 eq = x**2*y**2 + 11*x**2*y + 30*x**2 + 7*x*y**2 + 77*x*y + 210*x + 12*y**2 + 132*y + 360 assert factor(eq, x) == (x + 3)*(x + 4)*(y**2 + 11*y + 30) assert factor(eq, x, deep=True) == (x + 3)*(x + 4)*(y**2 + 11*y + 30) assert factor(eq, y, deep=True) == (y + 5)*(y + 6)*(x**2 + 7*x + 12) # fraction option f = 5*x + 3*exp(2 - 7*x) assert factor(f, deep=True) == factor(f, deep=True, fraction=True) assert factor(f, deep=True, fraction=False) == 5*x + 3*exp(2)*exp(-7*x) def test_factor_large(): f = (x**2 + 4*x + 4)**10000000*(x**2 + 1)*(x**2 + 2*x + 1)**1234567 g = ((x**2 + 2*x + 1)**3000*y**2 + (x**2 + 2*x + 1)**3000*2*y + ( x**2 + 2*x + 1)**3000) assert factor(f) == (x + 2)**20000000*(x**2 + 1)*(x + 1)**2469134 assert factor(g) == (x + 1)**6000*(y + 1)**2 assert factor_list( f) == (1, [(x + 1, 2469134), (x + 2, 20000000), (x**2 + 1, 1)]) assert factor_list(g) == (1, [(y + 1, 2), (x + 1, 6000)]) f = (x**2 - y**2)**200000*(x**7 + 1) g = (x**2 + y**2)**200000*(x**7 + 1) assert factor(f) == \ (x + 1)*(x - y)**200000*(x + y)**200000*(x**6 - x**5 + x**4 - x**3 + x**2 - x + 1) assert factor(g, gaussian=True) == \ (x + 1)*(x - I*y)**200000*(x + I*y)**200000*(x**6 - x**5 + x**4 - x**3 + x**2 - x + 1) assert factor_list(f) == \ (1, [(x + 1, 1), (x - y, 200000), (x + y, 200000), (x**6 - x**5 + x**4 - x**3 + x**2 - x + 1, 1)]) assert factor_list(g, gaussian=True) == \ (1, [(x + 1, 1), (x - I*y, 200000), (x + I*y, 200000), ( x**6 - x**5 + x**4 - x**3 + x**2 - x + 1, 1)]) def test_factor_noeval(): assert factor(6*x - 10) == Mul(2, 3*x - 5, evaluate=False) assert factor((6*x - 10)/(3*x - 6)) == Mul(Rational(2, 3), 3*x - 5, 1/(x - 2)) def test_intervals(): assert intervals(0) == [] assert intervals(1) == [] assert intervals(x, sqf=True) == [(0, 0)] assert intervals(x) == [((0, 0), 1)] assert intervals(x**128) == [((0, 0), 128)] assert intervals([x**2, x**4]) == [((0, 0), {0: 2, 1: 4})] f = Poly((x*Rational(2, 5) - Rational(17, 3))*(4*x + Rational(1, 257))) assert f.intervals(sqf=True) == [(-1, 0), (14, 15)] assert f.intervals() == [((-1, 0), 1), ((14, 15), 1)] assert f.intervals(fast=True, sqf=True) == [(-1, 0), (14, 15)] assert f.intervals(fast=True) == [((-1, 0), 1), ((14, 15), 1)] assert f.intervals(eps=Rational(1, 10)) == f.intervals(eps=0.1) == \ [((Rational(-1, 258), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert f.intervals(eps=Rational(1, 100)) == f.intervals(eps=0.01) == \ [((Rational(-1, 258), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert f.intervals(eps=Rational(1, 1000)) == f.intervals(eps=0.001) == \ [((Rational(-1, 1002), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert f.intervals(eps=Rational(1, 10000)) == f.intervals(eps=0.0001) == \ [((Rational(-1, 1028), Rational(-1, 1028)), 1), ((Rational(85, 6), Rational(85, 6)), 1)] f = (x*Rational(2, 5) - Rational(17, 3))*(4*x + Rational(1, 257)) assert intervals(f, sqf=True) == [(-1, 0), (14, 15)] assert intervals(f) == [((-1, 0), 1), ((14, 15), 1)] assert intervals(f, eps=Rational(1, 10)) == intervals(f, eps=0.1) == \ [((Rational(-1, 258), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert intervals(f, eps=Rational(1, 100)) == intervals(f, eps=0.01) == \ [((Rational(-1, 258), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert intervals(f, eps=Rational(1, 1000)) == intervals(f, eps=0.001) == \ [((Rational(-1, 1002), 0), 1), ((Rational(85, 6), Rational(85, 6)), 1)] assert intervals(f, eps=Rational(1, 10000)) == intervals(f, eps=0.0001) == \ [((Rational(-1, 1028), Rational(-1, 1028)), 1), ((Rational(85, 6), Rational(85, 6)), 1)] f = Poly((x**2 - 2)*(x**2 - 3)**7*(x + 1)*(7*x + 3)**3) assert f.intervals() == \ [((-2, Rational(-3, 2)), 7), ((Rational(-3, 2), -1), 1), ((-1, -1), 1), ((-1, 0), 3), ((1, Rational(3, 2)), 1), ((Rational(3, 2), 2), 7)] assert intervals([x**5 - 200, x**5 - 201]) == \ [((Rational(75, 26), Rational(101, 35)), {0: 1}), ((Rational(309, 107), Rational(26, 9)), {1: 1})] assert intervals([x**5 - 200, x**5 - 201], fast=True) == \ [((Rational(75, 26), Rational(101, 35)), {0: 1}), ((Rational(309, 107), Rational(26, 9)), {1: 1})] assert intervals([x**2 - 200, x**2 - 201]) == \ [((Rational(-71, 5), Rational(-85, 6)), {1: 1}), ((Rational(-85, 6), -14), {0: 1}), ((14, Rational(85, 6)), {0: 1}), ((Rational(85, 6), Rational(71, 5)), {1: 1})] assert intervals([x + 1, x + 2, x - 1, x + 1, 1, x - 1, x - 1, (x - 2)**2]) == \ [((-2, -2), {1: 1}), ((-1, -1), {0: 1, 3: 1}), ((1, 1), {2: 1, 5: 1, 6: 1}), ((2, 2), {7: 2})] f, g, h = x**2 - 2, x**4 - 4*x**2 + 4, x - 1 assert intervals(f, inf=Rational(7, 4), sqf=True) == [] assert intervals(f, inf=Rational(7, 5), sqf=True) == [(Rational(7, 5), Rational(3, 2))] assert intervals(f, sup=Rational(7, 4), sqf=True) == [(-2, -1), (1, Rational(3, 2))] assert intervals(f, sup=Rational(7, 5), sqf=True) == [(-2, -1)] assert intervals(g, inf=Rational(7, 4)) == [] assert intervals(g, inf=Rational(7, 5)) == [((Rational(7, 5), Rational(3, 2)), 2)] assert intervals(g, sup=Rational(7, 4)) == [((-2, -1), 2), ((1, Rational(3, 2)), 2)] assert intervals(g, sup=Rational(7, 5)) == [((-2, -1), 2)] assert intervals([g, h], inf=Rational(7, 4)) == [] assert intervals([g, h], inf=Rational(7, 5)) == [((Rational(7, 5), Rational(3, 2)), {0: 2})] assert intervals([g, h], sup=S( 7)/4) == [((-2, -1), {0: 2}), ((1, 1), {1: 1}), ((1, Rational(3, 2)), {0: 2})] assert intervals( [g, h], sup=Rational(7, 5)) == [((-2, -1), {0: 2}), ((1, 1), {1: 1})] assert intervals([x + 2, x**2 - 2]) == \ [((-2, -2), {0: 1}), ((-2, -1), {1: 1}), ((1, 2), {1: 1})] assert intervals([x + 2, x**2 - 2], strict=True) == \ [((-2, -2), {0: 1}), ((Rational(-3, 2), -1), {1: 1}), ((1, 2), {1: 1})] f = 7*z**4 - 19*z**3 + 20*z**2 + 17*z + 20 assert intervals(f) == [] real_part, complex_part = intervals(f, all=True, sqf=True) assert real_part == [] assert all(re(a) < re(r) < re(b) and im( a) < im(r) < im(b) for (a, b), r in zip(complex_part, nroots(f))) assert complex_part == [(Rational(-40, 7) - I*Rational(40, 7), 0), (Rational(-40, 7), I*Rational(40, 7)), (I*Rational(-40, 7), Rational(40, 7)), (0, Rational(40, 7) + I*Rational(40, 7))] real_part, complex_part = intervals(f, all=True, sqf=True, eps=Rational(1, 10)) assert real_part == [] assert all(re(a) < re(r) < re(b) and im( a) < im(r) < im(b) for (a, b), r in zip(complex_part, nroots(f))) raises(ValueError, lambda: intervals(x**2 - 2, eps=10**-100000)) raises(ValueError, lambda: Poly(x**2 - 2).intervals(eps=10**-100000)) raises( ValueError, lambda: intervals([x**2 - 2, x**2 - 3], eps=10**-100000)) def test_refine_root(): f = Poly(x**2 - 2) assert f.refine_root(1, 2, steps=0) == (1, 2) assert f.refine_root(-2, -1, steps=0) == (-2, -1) assert f.refine_root(1, 2, steps=None) == (1, Rational(3, 2)) assert f.refine_root(-2, -1, steps=None) == (Rational(-3, 2), -1) assert f.refine_root(1, 2, steps=1) == (1, Rational(3, 2)) assert f.refine_root(-2, -1, steps=1) == (Rational(-3, 2), -1) assert f.refine_root(1, 2, steps=1, fast=True) == (1, Rational(3, 2)) assert f.refine_root(-2, -1, steps=1, fast=True) == (Rational(-3, 2), -1) assert f.refine_root(1, 2, eps=Rational(1, 100)) == (Rational(24, 17), Rational(17, 12)) assert f.refine_root(1, 2, eps=1e-2) == (Rational(24, 17), Rational(17, 12)) raises(PolynomialError, lambda: (f**2).refine_root(1, 2, check_sqf=True)) raises(RefinementFailed, lambda: (f**2).refine_root(1, 2)) raises(RefinementFailed, lambda: (f**2).refine_root(2, 3)) f = x**2 - 2 assert refine_root(f, 1, 2, steps=1) == (1, Rational(3, 2)) assert refine_root(f, -2, -1, steps=1) == (Rational(-3, 2), -1) assert refine_root(f, 1, 2, steps=1, fast=True) == (1, Rational(3, 2)) assert refine_root(f, -2, -1, steps=1, fast=True) == (Rational(-3, 2), -1) assert refine_root(f, 1, 2, eps=Rational(1, 100)) == (Rational(24, 17), Rational(17, 12)) assert refine_root(f, 1, 2, eps=1e-2) == (Rational(24, 17), Rational(17, 12)) raises(PolynomialError, lambda: refine_root(1, 7, 8, eps=Rational(1, 100))) raises(ValueError, lambda: Poly(f).refine_root(1, 2, eps=10**-100000)) raises(ValueError, lambda: refine_root(f, 1, 2, eps=10**-100000)) def test_count_roots(): assert count_roots(x**2 - 2) == 2 assert count_roots(x**2 - 2, inf=-oo) == 2 assert count_roots(x**2 - 2, sup=+oo) == 2 assert count_roots(x**2 - 2, inf=-oo, sup=+oo) == 2 assert count_roots(x**2 - 2, inf=-2) == 2 assert count_roots(x**2 - 2, inf=-1) == 1 assert count_roots(x**2 - 2, sup=1) == 1 assert count_roots(x**2 - 2, sup=2) == 2 assert count_roots(x**2 - 2, inf=-1, sup=1) == 0 assert count_roots(x**2 - 2, inf=-2, sup=2) == 2 assert count_roots(x**2 - 2, inf=-1, sup=1) == 0 assert count_roots(x**2 - 2, inf=-2, sup=2) == 2 assert count_roots(x**2 + 2) == 0 assert count_roots(x**2 + 2, inf=-2*I) == 2 assert count_roots(x**2 + 2, sup=+2*I) == 2 assert count_roots(x**2 + 2, inf=-2*I, sup=+2*I) == 2 assert count_roots(x**2 + 2, inf=0) == 0 assert count_roots(x**2 + 2, sup=0) == 0 assert count_roots(x**2 + 2, inf=-I) == 1 assert count_roots(x**2 + 2, sup=+I) == 1 assert count_roots(x**2 + 2, inf=+I/2, sup=+I) == 0 assert count_roots(x**2 + 2, inf=-I, sup=-I/2) == 0 raises(PolynomialError, lambda: count_roots(1)) def test_Poly_root(): f = Poly(2*x**3 - 7*x**2 + 4*x + 4) assert f.root(0) == Rational(-1, 2) assert f.root(1) == 2 assert f.root(2) == 2 raises(IndexError, lambda: f.root(3)) assert Poly(x**5 + x + 1).root(0) == rootof(x**3 - x**2 + 1, 0) def test_real_roots(): assert real_roots(x) == [0] assert real_roots(x, multiple=False) == [(0, 1)] assert real_roots(x**3) == [0, 0, 0] assert real_roots(x**3, multiple=False) == [(0, 3)] assert real_roots(x*(x**3 + x + 3)) == [rootof(x**3 + x + 3, 0), 0] assert real_roots(x*(x**3 + x + 3), multiple=False) == [(rootof( x**3 + x + 3, 0), 1), (0, 1)] assert real_roots( x**3*(x**3 + x + 3)) == [rootof(x**3 + x + 3, 0), 0, 0, 0] assert real_roots(x**3*(x**3 + x + 3), multiple=False) == [(rootof( x**3 + x + 3, 0), 1), (0, 3)] f = 2*x**3 - 7*x**2 + 4*x + 4 g = x**3 + x + 1 assert Poly(f).real_roots() == [Rational(-1, 2), 2, 2] assert Poly(g).real_roots() == [rootof(g, 0)] def test_all_roots(): f = 2*x**3 - 7*x**2 + 4*x + 4 g = x**3 + x + 1 assert Poly(f).all_roots() == [Rational(-1, 2), 2, 2] assert Poly(g).all_roots() == [rootof(g, 0), rootof(g, 1), rootof(g, 2)] def test_nroots(): assert Poly(0, x).nroots() == [] assert Poly(1, x).nroots() == [] assert Poly(x**2 - 1, x).nroots() == [-1.0, 1.0] assert Poly(x**2 + 1, x).nroots() == [-1.0*I, 1.0*I] roots = Poly(x**2 - 1, x).nroots() assert roots == [-1.0, 1.0] roots = Poly(x**2 + 1, x).nroots() assert roots == [-1.0*I, 1.0*I] roots = Poly(x**2/3 - Rational(1, 3), x).nroots() assert roots == [-1.0, 1.0] roots = Poly(x**2/3 + Rational(1, 3), x).nroots() assert roots == [-1.0*I, 1.0*I] assert Poly(x**2 + 2*I, x).nroots() == [-1.0 + 1.0*I, 1.0 - 1.0*I] assert Poly( x**2 + 2*I, x, extension=I).nroots() == [-1.0 + 1.0*I, 1.0 - 1.0*I] assert Poly(0.2*x + 0.1).nroots() == [-0.5] roots = nroots(x**5 + x + 1, n=5) eps = Float("1e-5") assert re(roots[0]).epsilon_eq(-0.75487, eps) is S.true assert im(roots[0]) == 0.0 assert re(roots[1]) == -0.5 assert im(roots[1]).epsilon_eq(-0.86602, eps) is S.true assert re(roots[2]) == -0.5 assert im(roots[2]).epsilon_eq(+0.86602, eps) is S.true assert re(roots[3]).epsilon_eq(+0.87743, eps) is S.true assert im(roots[3]).epsilon_eq(-0.74486, eps) is S.true assert re(roots[4]).epsilon_eq(+0.87743, eps) is S.true assert im(roots[4]).epsilon_eq(+0.74486, eps) is S.true eps = Float("1e-6") assert re(roots[0]).epsilon_eq(-0.75487, eps) is S.false assert im(roots[0]) == 0.0 assert re(roots[1]) == -0.5 assert im(roots[1]).epsilon_eq(-0.86602, eps) is S.false assert re(roots[2]) == -0.5 assert im(roots[2]).epsilon_eq(+0.86602, eps) is S.false assert re(roots[3]).epsilon_eq(+0.87743, eps) is S.false assert im(roots[3]).epsilon_eq(-0.74486, eps) is S.false assert re(roots[4]).epsilon_eq(+0.87743, eps) is S.false assert im(roots[4]).epsilon_eq(+0.74486, eps) is S.false raises(DomainError, lambda: Poly(x + y, x).nroots()) raises(MultivariatePolynomialError, lambda: Poly(x + y).nroots()) assert nroots(x**2 - 1) == [-1.0, 1.0] roots = nroots(x**2 - 1) assert roots == [-1.0, 1.0] assert nroots(x + I) == [-1.0*I] assert nroots(x + 2*I) == [-2.0*I] raises(PolynomialError, lambda: nroots(0)) # issue 8296 f = Poly(x**4 - 1) assert f.nroots(2) == [w.n(2) for w in f.all_roots()] assert str(Poly(x**16 + 32*x**14 + 508*x**12 + 5440*x**10 + 39510*x**8 + 204320*x**6 + 755548*x**4 + 1434496*x**2 + 877969).nroots(2)) == ('[-1.7 - 1.9*I, -1.7 + 1.9*I, -1.7 ' '- 2.5*I, -1.7 + 2.5*I, -1.0*I, 1.0*I, -1.7*I, 1.7*I, -2.8*I, ' '2.8*I, -3.4*I, 3.4*I, 1.7 - 1.9*I, 1.7 + 1.9*I, 1.7 - 2.5*I, ' '1.7 + 2.5*I]') def test_ground_roots(): f = x**6 - 4*x**4 + 4*x**3 - x**2 assert Poly(f).ground_roots() == {S.One: 2, S.Zero: 2} assert ground_roots(f) == {S.One: 2, S.Zero: 2} def test_nth_power_roots_poly(): f = x**4 - x**2 + 1 f_2 = (x**2 - x + 1)**2 f_3 = (x**2 + 1)**2 f_4 = (x**2 + x + 1)**2 f_12 = (x - 1)**4 assert nth_power_roots_poly(f, 1) == f raises(ValueError, lambda: nth_power_roots_poly(f, 0)) raises(ValueError, lambda: nth_power_roots_poly(f, x)) assert factor(nth_power_roots_poly(f, 2)) == f_2 assert factor(nth_power_roots_poly(f, 3)) == f_3 assert factor(nth_power_roots_poly(f, 4)) == f_4 assert factor(nth_power_roots_poly(f, 12)) == f_12 raises(MultivariatePolynomialError, lambda: nth_power_roots_poly( x + y, 2, x, y)) def test_torational_factor_list(): p = expand(((x**2-1)*(x-2)).subs({x:x*(1 + sqrt(2))})) assert _torational_factor_list(p, x) == (-2, [ (-x*(1 + sqrt(2))/2 + 1, 1), (-x*(1 + sqrt(2)) - 1, 1), (-x*(1 + sqrt(2)) + 1, 1)]) p = expand(((x**2-1)*(x-2)).subs({x:x*(1 + 2**Rational(1, 4))})) assert _torational_factor_list(p, x) is None def test_cancel(): assert cancel(0) == 0 assert cancel(7) == 7 assert cancel(x) == x assert cancel(oo) is oo assert cancel((2, 3)) == (1, 2, 3) assert cancel((1, 0), x) == (1, 1, 0) assert cancel((0, 1), x) == (1, 0, 1) f, g, p, q = 4*x**2 - 4, 2*x - 2, 2*x + 2, 1 F, G, P, Q = [ Poly(u, x) for u in (f, g, p, q) ] assert F.cancel(G) == (1, P, Q) assert cancel((f, g)) == (1, p, q) assert cancel((f, g), x) == (1, p, q) assert cancel((f, g), (x,)) == (1, p, q) assert cancel((F, G)) == (1, P, Q) assert cancel((f, g), polys=True) == (1, P, Q) assert cancel((F, G), polys=False) == (1, p, q) f = (x**2 - 2)/(x + sqrt(2)) assert cancel(f) == f assert cancel(f, greedy=False) == x - sqrt(2) f = (x**2 - 2)/(x - sqrt(2)) assert cancel(f) == f assert cancel(f, greedy=False) == x + sqrt(2) assert cancel((x**2/4 - 1, x/2 - 1)) == (S.Half, x + 2, 1) assert cancel((x**2 - y)/(x - y)) == 1/(x - y)*(x**2 - y) assert cancel((x**2 - y**2)/(x - y), x) == x + y assert cancel((x**2 - y**2)/(x - y), y) == x + y assert cancel((x**2 - y**2)/(x - y)) == x + y assert cancel((x**3 - 1)/(x**2 - 1)) == (x**2 + x + 1)/(x + 1) assert cancel((x**3/2 - S.Half)/(x**2 - 1)) == (x**2 + x + 1)/(2*x + 2) assert cancel((exp(2*x) + 2*exp(x) + 1)/(exp(x) + 1)) == exp(x) + 1 f = Poly(x**2 - a**2, x) g = Poly(x - a, x) F = Poly(x + a, x, domain='ZZ[a]') G = Poly(1, x, domain='ZZ[a]') assert cancel((f, g)) == (1, F, G) f = x**3 + (sqrt(2) - 2)*x**2 - (2*sqrt(2) + 3)*x - 3*sqrt(2) g = x**2 - 2 assert cancel((f, g), extension=True) == (1, x**2 - 2*x - 3, x - sqrt(2)) f = Poly(-2*x + 3, x) g = Poly(-x**9 + x**8 + x**6 - x**5 + 2*x**2 - 3*x + 1, x) assert cancel((f, g)) == (1, -f, -g) f = Poly(y, y, domain='ZZ(x)') g = Poly(1, y, domain='ZZ[x]') assert f.cancel( g) == (1, Poly(y, y, domain='ZZ(x)'), Poly(1, y, domain='ZZ(x)')) assert f.cancel(g, include=True) == ( Poly(y, y, domain='ZZ(x)'), Poly(1, y, domain='ZZ(x)')) f = Poly(5*x*y + x, y, domain='ZZ(x)') g = Poly(2*x**2*y, y, domain='ZZ(x)') assert f.cancel(g, include=True) == ( Poly(5*y + 1, y, domain='ZZ(x)'), Poly(2*x*y, y, domain='ZZ(x)')) f = -(-2*x - 4*y + 0.005*(z - y)**2)/((z - y)*(-z + y + 2)) assert cancel(f).is_Mul == True P = tanh(x - 3.0) Q = tanh(x + 3.0) f = ((-2*P**2 + 2)*(-P**2 + 1)*Q**2/2 + (-2*P**2 + 2)*(-2*Q**2 + 2)*P*Q - (-2*P**2 + 2)*P**2*Q**2 + (-2*Q**2 + 2)*(-Q**2 + 1)*P**2/2 - (-2*Q**2 + 2)*P**2*Q**2)/(2*sqrt(P**2*Q**2 + 0.0001)) \ + (-(-2*P**2 + 2)*P*Q**2/2 - (-2*Q**2 + 2)*P**2*Q/2)*((-2*P**2 + 2)*P*Q**2/2 + (-2*Q**2 + 2)*P**2*Q/2)/(2*(P**2*Q**2 + 0.0001)**Rational(3, 2)) assert cancel(f).is_Mul == True # issue 7022 A = Symbol('A', commutative=False) p1 = Piecewise((A*(x**2 - 1)/(x + 1), x > 1), ((x + 2)/(x**2 + 2*x), True)) p2 = Piecewise((A*(x - 1), x > 1), (1/x, True)) assert cancel(p1) == p2 assert cancel(2*p1) == 2*p2 assert cancel(1 + p1) == 1 + p2 assert cancel((x**2 - 1)/(x + 1)*p1) == (x - 1)*p2 assert cancel((x**2 - 1)/(x + 1) + p1) == (x - 1) + p2 p3 = Piecewise(((x**2 - 1)/(x + 1), x > 1), ((x + 2)/(x**2 + 2*x), True)) p4 = Piecewise(((x - 1), x > 1), (1/x, True)) assert cancel(p3) == p4 assert cancel(2*p3) == 2*p4 assert cancel(1 + p3) == 1 + p4 assert cancel((x**2 - 1)/(x + 1)*p3) == (x - 1)*p4 assert cancel((x**2 - 1)/(x + 1) + p3) == (x - 1) + p4 # issue 9363 M = MatrixSymbol('M', 5, 5) assert cancel(M[0,0] + 7) == M[0,0] + 7 expr = sin(M[1, 4] + M[2, 1] * 5 * M[4, 0]) - 5 * M[1, 2] / z assert cancel(expr) == (z*sin(M[1, 4] + M[2, 1] * 5 * M[4, 0]) - 5 * M[1, 2]) / z def test_reduced(): f = 2*x**4 + y**2 - x**2 + y**3 G = [x**3 - x, y**3 - y] Q = [2*x, 1] r = x**2 + y**2 + y assert reduced(f, G) == (Q, r) assert reduced(f, G, x, y) == (Q, r) H = groebner(G) assert H.reduce(f) == (Q, r) Q = [Poly(2*x, x, y), Poly(1, x, y)] r = Poly(x**2 + y**2 + y, x, y) assert _strict_eq(reduced(f, G, polys=True), (Q, r)) assert _strict_eq(reduced(f, G, x, y, polys=True), (Q, r)) H = groebner(G, polys=True) assert _strict_eq(H.reduce(f), (Q, r)) f = 2*x**3 + y**3 + 3*y G = groebner([x**2 + y**2 - 1, x*y - 2]) Q = [x**2 - x*y**3/2 + x*y/2 + y**6/4 - y**4/2 + y**2/4, -y**5/4 + y**3/2 + y*Rational(3, 4)] r = 0 assert reduced(f, G) == (Q, r) assert G.reduce(f) == (Q, r) assert reduced(f, G, auto=False)[1] != 0 assert G.reduce(f, auto=False)[1] != 0 assert G.contains(f) is True assert G.contains(f + 1) is False assert reduced(1, [1], x) == ([1], 0) raises(ComputationFailed, lambda: reduced(1, [1])) def test_groebner(): assert groebner([], x, y, z) == [] assert groebner([x**2 + 1, y**4*x + x**3], x, y, order='lex') == [1 + x**2, -1 + y**4] assert groebner([x**2 + 1, y**4*x + x**3, x*y*z**3], x, y, z, order='grevlex') == [-1 + y**4, z**3, 1 + x**2] assert groebner([x**2 + 1, y**4*x + x**3], x, y, order='lex', polys=True) == \ [Poly(1 + x**2, x, y), Poly(-1 + y**4, x, y)] assert groebner([x**2 + 1, y**4*x + x**3, x*y*z**3], x, y, z, order='grevlex', polys=True) == \ [Poly(-1 + y**4, x, y, z), Poly(z**3, x, y, z), Poly(1 + x**2, x, y, z)] assert groebner([x**3 - 1, x**2 - 1]) == [x - 1] assert groebner([Eq(x**3, 1), Eq(x**2, 1)]) == [x - 1] F = [3*x**2 + y*z - 5*x - 1, 2*x + 3*x*y + y**2, x - 3*y + x*z - 2*z**2] f = z**9 - x**2*y**3 - 3*x*y**2*z + 11*y*z**2 + x**2*z**2 - 5 G = groebner(F, x, y, z, modulus=7, symmetric=False) assert G == [1 + x + y + 3*z + 2*z**2 + 2*z**3 + 6*z**4 + z**5, 1 + 3*y + y**2 + 6*z**2 + 3*z**3 + 3*z**4 + 3*z**5 + 4*z**6, 1 + 4*y + 4*z + y*z + 4*z**3 + z**4 + z**6, 6 + 6*z + z**2 + 4*z**3 + 3*z**4 + 6*z**5 + 3*z**6 + z**7] Q, r = reduced(f, G, x, y, z, modulus=7, symmetric=False, polys=True) assert sum([ q*g for q, g in zip(Q, G.polys)], r) == Poly(f, modulus=7) F = [x*y - 2*y, 2*y**2 - x**2] assert groebner(F, x, y, order='grevlex') == \ [y**3 - 2*y, x**2 - 2*y**2, x*y - 2*y] assert groebner(F, y, x, order='grevlex') == \ [x**3 - 2*x**2, -x**2 + 2*y**2, x*y - 2*y] assert groebner(F, order='grevlex', field=True) == \ [y**3 - 2*y, x**2 - 2*y**2, x*y - 2*y] assert groebner([1], x) == [1] assert groebner([x**2 + 2.0*y], x, y) == [1.0*x**2 + 2.0*y] raises(ComputationFailed, lambda: groebner([1])) assert groebner([x**2 - 1, x**3 + 1], method='buchberger') == [x + 1] assert groebner([x**2 - 1, x**3 + 1], method='f5b') == [x + 1] raises(ValueError, lambda: groebner([x, y], method='unknown')) def test_fglm(): F = [a + b + c + d, a*b + a*d + b*c + b*d, a*b*c + a*b*d + a*c*d + b*c*d, a*b*c*d - 1] G = groebner(F, a, b, c, d, order=grlex) B = [ 4*a + 3*d**9 - 4*d**5 - 3*d, 4*b + 4*c - 3*d**9 + 4*d**5 + 7*d, 4*c**2 + 3*d**10 - 4*d**6 - 3*d**2, 4*c*d**4 + 4*c - d**9 + 4*d**5 + 5*d, d**12 - d**8 - d**4 + 1, ] assert groebner(F, a, b, c, d, order=lex) == B assert G.fglm(lex) == B F = [9*x**8 + 36*x**7 - 32*x**6 - 252*x**5 - 78*x**4 + 468*x**3 + 288*x**2 - 108*x + 9, -72*t*x**7 - 252*t*x**6 + 192*t*x**5 + 1260*t*x**4 + 312*t*x**3 - 404*t*x**2 - 576*t*x + \ 108*t - 72*x**7 - 256*x**6 + 192*x**5 + 1280*x**4 + 312*x**3 - 576*x + 96] G = groebner(F, t, x, order=grlex) B = [ 203577793572507451707*t + 627982239411707112*x**7 - 666924143779443762*x**6 - \ 10874593056632447619*x**5 + 5119998792707079562*x**4 + 72917161949456066376*x**3 + \ 20362663855832380362*x**2 - 142079311455258371571*x + 183756699868981873194, 9*x**8 + 36*x**7 - 32*x**6 - 252*x**5 - 78*x**4 + 468*x**3 + 288*x**2 - 108*x + 9, ] assert groebner(F, t, x, order=lex) == B assert G.fglm(lex) == B F = [x**2 - x - 3*y + 1, -2*x + y**2 + y - 1] G = groebner(F, x, y, order=lex) B = [ x**2 - x - 3*y + 1, y**2 - 2*x + y - 1, ] assert groebner(F, x, y, order=grlex) == B assert G.fglm(grlex) == B def test_is_zero_dimensional(): assert is_zero_dimensional([x, y], x, y) is True assert is_zero_dimensional([x**3 + y**2], x, y) is False assert is_zero_dimensional([x, y, z], x, y, z) is True assert is_zero_dimensional([x, y, z], x, y, z, t) is False F = [x*y - z, y*z - x, x*y - y] assert is_zero_dimensional(F, x, y, z) is True F = [x**2 - 2*x*z + 5, x*y**2 + y*z**3, 3*y**2 - 8*z**2] assert is_zero_dimensional(F, x, y, z) is True def test_GroebnerBasis(): F = [x*y - 2*y, 2*y**2 - x**2] G = groebner(F, x, y, order='grevlex') H = [y**3 - 2*y, x**2 - 2*y**2, x*y - 2*y] P = [ Poly(h, x, y) for h in H ] assert groebner(F + [0], x, y, order='grevlex') == G assert isinstance(G, GroebnerBasis) is True assert len(G) == 3 assert G[0] == H[0] and not G[0].is_Poly assert G[1] == H[1] and not G[1].is_Poly assert G[2] == H[2] and not G[2].is_Poly assert G[1:] == H[1:] and not any(g.is_Poly for g in G[1:]) assert G[:2] == H[:2] and not any(g.is_Poly for g in G[1:]) assert G.exprs == H assert G.polys == P assert G.gens == (x, y) assert G.domain == ZZ assert G.order == grevlex assert G == H assert G == tuple(H) assert G == P assert G == tuple(P) assert G != [] G = groebner(F, x, y, order='grevlex', polys=True) assert G[0] == P[0] and G[0].is_Poly assert G[1] == P[1] and G[1].is_Poly assert G[2] == P[2] and G[2].is_Poly assert G[1:] == P[1:] and all(g.is_Poly for g in G[1:]) assert G[:2] == P[:2] and all(g.is_Poly for g in G[1:]) def test_poly(): assert poly(x) == Poly(x, x) assert poly(y) == Poly(y, y) assert poly(x + y) == Poly(x + y, x, y) assert poly(x + sin(x)) == Poly(x + sin(x), x, sin(x)) assert poly(x + y, wrt=y) == Poly(x + y, y, x) assert poly(x + sin(x), wrt=sin(x)) == Poly(x + sin(x), sin(x), x) assert poly(x*y + 2*x*z**2 + 17) == Poly(x*y + 2*x*z**2 + 17, x, y, z) assert poly(2*(y + z)**2 - 1) == Poly(2*y**2 + 4*y*z + 2*z**2 - 1, y, z) assert poly( x*(y + z)**2 - 1) == Poly(x*y**2 + 2*x*y*z + x*z**2 - 1, x, y, z) assert poly(2*x*( y + z)**2 - 1) == Poly(2*x*y**2 + 4*x*y*z + 2*x*z**2 - 1, x, y, z) assert poly(2*( y + z)**2 - x - 1) == Poly(2*y**2 + 4*y*z + 2*z**2 - x - 1, x, y, z) assert poly(x*( y + z)**2 - x - 1) == Poly(x*y**2 + 2*x*y*z + x*z**2 - x - 1, x, y, z) assert poly(2*x*(y + z)**2 - x - 1) == Poly(2*x*y**2 + 4*x*y*z + 2* x*z**2 - x - 1, x, y, z) assert poly(x*y + (x + y)**2 + (x + z)**2) == \ Poly(2*x*z + 3*x*y + y**2 + z**2 + 2*x**2, x, y, z) assert poly(x*y*(x + y)*(x + z)**2) == \ Poly(x**3*y**2 + x*y**2*z**2 + y*x**2*z**2 + 2*z*x**2* y**2 + 2*y*z*x**3 + y*x**4, x, y, z) assert poly(Poly(x + y + z, y, x, z)) == Poly(x + y + z, y, x, z) assert poly((x + y)**2, x) == Poly(x**2 + 2*x*y + y**2, x, domain=ZZ[y]) assert poly((x + y)**2, y) == Poly(x**2 + 2*x*y + y**2, y, domain=ZZ[x]) assert poly(1, x) == Poly(1, x) raises(GeneratorsNeeded, lambda: poly(1)) # issue 6184 assert poly(x + y, x, y) == Poly(x + y, x, y) assert poly(x + y, y, x) == Poly(x + y, y, x) def test_keep_coeff(): u = Mul(2, x + 1, evaluate=False) assert _keep_coeff(S.One, x) == x assert _keep_coeff(S.NegativeOne, x) == -x assert _keep_coeff(S(1.0), x) == 1.0*x assert _keep_coeff(S(-1.0), x) == -1.0*x assert _keep_coeff(S.One, 2*x) == 2*x assert _keep_coeff(S(2), x/2) == x assert _keep_coeff(S(2), sin(x)) == 2*sin(x) assert _keep_coeff(S(2), x + 1) == u assert _keep_coeff(x, 1/x) == 1 assert _keep_coeff(x + 1, S(2)) == u def test_poly_matching_consistency(): # Test for this issue: # https://github.com/sympy/sympy/issues/5514 assert I * Poly(x, x) == Poly(I*x, x) assert Poly(x, x) * I == Poly(I*x, x) @XFAIL def test_issue_5786(): assert expand(factor(expand( (x - I*y)*(z - I*t)), extension=[I])) == -I*t*x - t*y + x*z - I*y*z def test_noncommutative(): class foo(Expr): is_commutative=False e = x/(x + x*y) c = 1/( 1 + y) assert cancel(foo(e)) == foo(c) assert cancel(e + foo(e)) == c + foo(c) assert cancel(e*foo(c)) == c*foo(c) def test_to_rational_coeffs(): assert to_rational_coeffs( Poly(x**3 + y*x**2 + sqrt(y), x, domain='EX')) is None def test_factor_terms(): # issue 7067 assert factor_list(x*(x + y)) == (1, [(x, 1), (x + y, 1)]) assert sqf_list(x*(x + y)) == (1, [(x, 1), (x + y, 1)]) def test_as_list(): # issue 14496 assert Poly(x**3 + 2, x, domain='ZZ').as_list() == [1, 0, 0, 2] assert Poly(x**2 + y + 1, x, y, domain='ZZ').as_list() == [[1], [], [1, 1]] assert Poly(x**2 + y + 1, x, y, z, domain='ZZ').as_list() == \ [[[1]], [[]], [[1], [1]]] def test_issue_11198(): assert factor_list(sqrt(2)*x) == (sqrt(2), [(x, 1)]) assert factor_list(sqrt(2)*sin(x), sin(x)) == (sqrt(2), [(sin(x), 1)]) def test_Poly_precision(): # Make sure Poly doesn't lose precision p = Poly(pi.evalf(100)*x) assert p.as_expr() == pi.evalf(100)*x def test_issue_12400(): # Correction of check for negative exponents assert poly(1/(1+sqrt(2)), x) == \ Poly(1/(1+sqrt(2)), x , domain='EX') def test_issue_14364(): assert gcd(S(6)*(1 + sqrt(3))/5, S(3)*(1 + sqrt(3))/10) == Rational(3, 10) * (1 + sqrt(3)) assert gcd(sqrt(5)*Rational(4, 7), sqrt(5)*Rational(2, 3)) == sqrt(5)*Rational(2, 21) assert lcm(Rational(2, 3)*sqrt(3), Rational(5, 6)*sqrt(3)) == S(10)*sqrt(3)/3 assert lcm(3*sqrt(3), 4/sqrt(3)) == 12*sqrt(3) assert lcm(S(5)*(1 + 2**Rational(1, 3))/6, S(3)*(1 + 2**Rational(1, 3))/8) == Rational(15, 2) * (1 + 2**Rational(1, 3)) assert gcd(Rational(2, 3)*sqrt(3), Rational(5, 6)/sqrt(3)) == sqrt(3)/18 assert gcd(S(4)*sqrt(13)/7, S(3)*sqrt(13)/14) == sqrt(13)/14 # gcd_list and lcm_list assert gcd([S(2)*sqrt(47)/7, S(6)*sqrt(47)/5, S(8)*sqrt(47)/5]) == sqrt(47)*Rational(2, 35) assert gcd([S(6)*(1 + sqrt(7))/5, S(2)*(1 + sqrt(7))/7, S(4)*(1 + sqrt(7))/13]) == (1 + sqrt(7))*Rational(2, 455) assert lcm((Rational(7, 2)/sqrt(15), Rational(5, 6)/sqrt(15), Rational(5, 8)/sqrt(15))) == Rational(35, 2)/sqrt(15) assert lcm([S(5)*(2 + 2**Rational(5, 7))/6, S(7)*(2 + 2**Rational(5, 7))/2, S(13)*(2 + 2**Rational(5, 7))/4]) == Rational(455, 2) * (2 + 2**Rational(5, 7)) def test_issue_15669(): x = Symbol("x", positive=True) expr = (16*x**3/(-x**2 + sqrt(8*x**2 + (x**2 - 2)**2) + 2)**2 - 2*2**Rational(4, 5)*x*(-x**2 + sqrt(8*x**2 + (x**2 - 2)**2) + 2)**Rational(3, 5) + 10*x) assert factor(expr, deep=True) == x*(x**2 + 2) def test_issue_17988(): x = Symbol('x') p = poly(x - 1) M = Matrix([[poly(x + 1), poly(x + 1)]]) assert p * M == M * p == Matrix([[poly(x**2 - 1), poly(x**2 - 1)]]) def test_issue_18205(): assert cancel((2 + I)*(3 - I)) == 7 + I assert cancel((2 + I)*(2 - I)) == 5
bc4ca3e3c7888e6ebe29142d4e135f23889cfd50cd07a97b8cca2ec49005f471
"""Tests for Euclidean algorithms, GCDs, LCMs and polynomial remainder sequences. """ from sympy.polys.rings import ring from sympy.polys.domains import ZZ, QQ, RR from sympy.polys.specialpolys import ( f_polys, dmp_fateman_poly_F_1, dmp_fateman_poly_F_2, dmp_fateman_poly_F_3) f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_polys() def test_dup_gcdex(): R, x = ring("x", QQ) f = x**4 - 2*x**3 - 6*x**2 + 12*x + 15 g = x**3 + x**2 - 4*x - 4 s = -QQ(1,5)*x + QQ(3,5) t = QQ(1,5)*x**2 - QQ(6,5)*x + 2 h = x + 1 assert R.dup_half_gcdex(f, g) == (s, h) assert R.dup_gcdex(f, g) == (s, t, h) f = x**4 + 4*x**3 - x + 1 g = x**3 - x + 1 s, t, h = R.dup_gcdex(f, g) S, T, H = R.dup_gcdex(g, f) assert R.dup_add(R.dup_mul(s, f), R.dup_mul(t, g)) == h assert R.dup_add(R.dup_mul(S, g), R.dup_mul(T, f)) == H f = 2*x g = x**2 - 16 s = QQ(1,32)*x t = -QQ(1,16) h = 1 assert R.dup_half_gcdex(f, g) == (s, h) assert R.dup_gcdex(f, g) == (s, t, h) def test_dup_invert(): R, x = ring("x", QQ) assert R.dup_invert(2*x, x**2 - 16) == QQ(1,32)*x def test_dup_euclidean_prs(): R, x = ring("x", QQ) f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 assert R.dup_euclidean_prs(f, g) == [ f, g, -QQ(5,9)*x**4 + QQ(1,9)*x**2 - QQ(1,3), -QQ(117,25)*x**2 - 9*x + QQ(441,25), QQ(233150,19773)*x - QQ(102500,6591), -QQ(1288744821,543589225)] def test_dup_primitive_prs(): R, x = ring("x", ZZ) f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 assert R.dup_primitive_prs(f, g) == [ f, g, -5*x**4 + x**2 - 3, 13*x**2 + 25*x - 49, 4663*x - 6150, 1] def test_dup_subresultants(): R, x = ring("x", ZZ) assert R.dup_resultant(0, 0) == 0 assert R.dup_resultant(1, 0) == 0 assert R.dup_resultant(0, 1) == 0 f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 a = 15*x**4 - 3*x**2 + 9 b = 65*x**2 + 125*x - 245 c = 9326*x - 12300 d = 260708 assert R.dup_subresultants(f, g) == [f, g, a, b, c, d] assert R.dup_resultant(f, g) == R.dup_LC(d) f = x**2 - 2*x + 1 g = x**2 - 1 a = 2*x - 2 assert R.dup_subresultants(f, g) == [f, g, a] assert R.dup_resultant(f, g) == 0 f = x**2 + 1 g = x**2 - 1 a = -2 assert R.dup_subresultants(f, g) == [f, g, a] assert R.dup_resultant(f, g) == 4 f = x**2 - 1 g = x**3 - x**2 + 2 assert R.dup_resultant(f, g) == 0 f = 3*x**3 - x g = 5*x**2 + 1 assert R.dup_resultant(f, g) == 64 f = x**2 - 2*x + 7 g = x**3 - x + 5 assert R.dup_resultant(f, g) == 265 f = x**3 - 6*x**2 + 11*x - 6 g = x**3 - 15*x**2 + 74*x - 120 assert R.dup_resultant(f, g) == -8640 f = x**3 - 6*x**2 + 11*x - 6 g = x**3 - 10*x**2 + 29*x - 20 assert R.dup_resultant(f, g) == 0 f = x**3 - 1 g = x**3 + 2*x**2 + 2*x - 1 assert R.dup_resultant(f, g) == 16 f = x**8 - 2 g = x - 1 assert R.dup_resultant(f, g) == -1 def test_dmp_subresultants(): R, x, y = ring("x,y", ZZ) assert R.dmp_resultant(0, 0) == 0 assert R.dmp_prs_resultant(0, 0)[0] == 0 assert R.dmp_zz_collins_resultant(0, 0) == 0 assert R.dmp_qq_collins_resultant(0, 0) == 0 assert R.dmp_resultant(1, 0) == 0 assert R.dmp_resultant(1, 0) == 0 assert R.dmp_resultant(1, 0) == 0 assert R.dmp_resultant(0, 1) == 0 assert R.dmp_prs_resultant(0, 1)[0] == 0 assert R.dmp_zz_collins_resultant(0, 1) == 0 assert R.dmp_qq_collins_resultant(0, 1) == 0 f = 3*x**2*y - y**3 - 4 g = x**2 + x*y**3 - 9 a = 3*x*y**4 + y**3 - 27*y + 4 b = -3*y**10 - 12*y**7 + y**6 - 54*y**4 + 8*y**3 + 729*y**2 - 216*y + 16 r = R.dmp_LC(b) assert R.dmp_subresultants(f, g) == [f, g, a, b] assert R.dmp_resultant(f, g) == r assert R.dmp_prs_resultant(f, g)[0] == r assert R.dmp_zz_collins_resultant(f, g) == r assert R.dmp_qq_collins_resultant(f, g) == r f = -x**3 + 5 g = 3*x**2*y + x**2 a = 45*y**2 + 30*y + 5 b = 675*y**3 + 675*y**2 + 225*y + 25 r = R.dmp_LC(b) assert R.dmp_subresultants(f, g) == [f, g, a] assert R.dmp_resultant(f, g) == r assert R.dmp_prs_resultant(f, g)[0] == r assert R.dmp_zz_collins_resultant(f, g) == r assert R.dmp_qq_collins_resultant(f, g) == r R, x, y, z, u, v = ring("x,y,z,u,v", ZZ) f = 6*x**2 - 3*x*y - 2*x*z + y*z g = x**2 - x*u - x*v + u*v r = y**2*z**2 - 3*y**2*z*u - 3*y**2*z*v + 9*y**2*u*v - 2*y*z**2*u \ - 2*y*z**2*v + 6*y*z*u**2 + 12*y*z*u*v + 6*y*z*v**2 - 18*y*u**2*v \ - 18*y*u*v**2 + 4*z**2*u*v - 12*z*u**2*v - 12*z*u*v**2 + 36*u**2*v**2 assert R.dmp_zz_collins_resultant(f, g) == r.drop(x) R, x, y, z, u, v = ring("x,y,z,u,v", QQ) f = x**2 - QQ(1,2)*x*y - QQ(1,3)*x*z + QQ(1,6)*y*z g = x**2 - x*u - x*v + u*v r = QQ(1,36)*y**2*z**2 - QQ(1,12)*y**2*z*u - QQ(1,12)*y**2*z*v + QQ(1,4)*y**2*u*v \ - QQ(1,18)*y*z**2*u - QQ(1,18)*y*z**2*v + QQ(1,6)*y*z*u**2 + QQ(1,3)*y*z*u*v \ + QQ(1,6)*y*z*v**2 - QQ(1,2)*y*u**2*v - QQ(1,2)*y*u*v**2 + QQ(1,9)*z**2*u*v \ - QQ(1,3)*z*u**2*v - QQ(1,3)*z*u*v**2 + u**2*v**2 assert R.dmp_qq_collins_resultant(f, g) == r.drop(x) Rt, t = ring("t", ZZ) Rx, x = ring("x", Rt) f = x**6 - 5*x**4 + 5*x**2 + 4 g = -6*t*x**5 + x**4 + 20*t*x**3 - 3*x**2 - 10*t*x + 6 assert Rx.dup_resultant(f, g) == 2930944*t**6 + 2198208*t**4 + 549552*t**2 + 45796 def test_dup_discriminant(): R, x = ring("x", ZZ) assert R.dup_discriminant(0) == 0 assert R.dup_discriminant(x) == 1 assert R.dup_discriminant(x**3 + 3*x**2 + 9*x - 13) == -11664 assert R.dup_discriminant(5*x**5 + x**3 + 2) == 31252160 assert R.dup_discriminant(x**4 + 2*x**3 + 6*x**2 - 22*x + 13) == 0 assert R.dup_discriminant(12*x**7 + 15*x**4 + 30*x**3 + x**2 + 1) == -220289699947514112 def test_dmp_discriminant(): R, x = ring("x", ZZ) assert R.dmp_discriminant(0) == 0 R, x, y = ring("x,y", ZZ) assert R.dmp_discriminant(0) == 0 assert R.dmp_discriminant(y) == 0 assert R.dmp_discriminant(x**3 + 3*x**2 + 9*x - 13) == -11664 assert R.dmp_discriminant(5*x**5 + x**3 + 2) == 31252160 assert R.dmp_discriminant(x**4 + 2*x**3 + 6*x**2 - 22*x + 13) == 0 assert R.dmp_discriminant(12*x**7 + 15*x**4 + 30*x**3 + x**2 + 1) == -220289699947514112 assert R.dmp_discriminant(x**2*y + 2*y) == (-8*y**2).drop(x) assert R.dmp_discriminant(x*y**2 + 2*x) == 1 R, x, y, z = ring("x,y,z", ZZ) assert R.dmp_discriminant(x*y + z) == 1 R, x, y, z, u = ring("x,y,z,u", ZZ) assert R.dmp_discriminant(x**2*y + x*z + u) == (-4*y*u + z**2).drop(x) R, x, y, z, u, v = ring("x,y,z,u,v", ZZ) assert R.dmp_discriminant(x**3*y + x**2*z + x*u + v) == \ (-27*y**2*v**2 + 18*y*z*u*v - 4*y*u**3 - 4*z**3*v + z**2*u**2).drop(x) def test_dup_gcd(): R, x = ring("x", ZZ) f, g = 0, 0 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (0, 0, 0) f, g = 2, 0 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, 1, 0) f, g = -2, 0 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, -1, 0) f, g = 0, -2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, 0, -1) f, g = 0, 2*x + 4 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2*x + 4, 0, 1) f, g = 2*x + 4, 0 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2*x + 4, 1, 0) f, g = 2, 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, 1, 1) f, g = -2, 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, -1, 1) f, g = 2, -2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, 1, -1) f, g = -2, -2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, -1, -1) f, g = x**2 + 2*x + 1, 1 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (1, x**2 + 2*x + 1, 1) f, g = x**2 + 2*x + 1, 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (1, x**2 + 2*x + 1, 2) f, g = 2*x**2 + 4*x + 2, 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, x**2 + 2*x + 1, 1) f, g = 2, 2*x**2 + 4*x + 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (2, 1, x**2 + 2*x + 1) f, g = 2*x**2 + 4*x + 2, x + 1 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (x + 1, 2*x + 2, 1) f, g = x + 1, 2*x**2 + 4*x + 2 assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (x + 1, 1, 2*x + 2) f, g = x - 31, x assert R.dup_zz_heu_gcd(f, g) == R.dup_rr_prs_gcd(f, g) == (1, f, g) f = x**4 + 8*x**3 + 21*x**2 + 22*x + 8 g = x**3 + 6*x**2 + 11*x + 6 h = x**2 + 3*x + 2 cff = x**2 + 5*x + 4 cfg = x + 3 assert R.dup_zz_heu_gcd(f, g) == (h, cff, cfg) assert R.dup_rr_prs_gcd(f, g) == (h, cff, cfg) f = x**4 - 4 g = x**4 + 4*x**2 + 4 h = x**2 + 2 cff = x**2 - 2 cfg = x**2 + 2 assert R.dup_zz_heu_gcd(f, g) == (h, cff, cfg) assert R.dup_rr_prs_gcd(f, g) == (h, cff, cfg) f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 h = 1 cff = f cfg = g assert R.dup_zz_heu_gcd(f, g) == (h, cff, cfg) assert R.dup_rr_prs_gcd(f, g) == (h, cff, cfg) R, x = ring("x", QQ) f = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5 g = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21 h = 1 cff = f cfg = g assert R.dup_qq_heu_gcd(f, g) == (h, cff, cfg) assert R.dup_ff_prs_gcd(f, g) == (h, cff, cfg) R, x = ring("x", ZZ) f = - 352518131239247345597970242177235495263669787845475025293906825864749649589178600387510272*x**49 \ + 46818041807522713962450042363465092040687472354933295397472942006618953623327997952*x**42 \ + 378182690892293941192071663536490788434899030680411695933646320291525827756032*x**35 \ + 112806468807371824947796775491032386836656074179286744191026149539708928*x**28 \ - 12278371209708240950316872681744825481125965781519138077173235712*x**21 \ + 289127344604779611146960547954288113529690984687482920704*x**14 \ + 19007977035740498977629742919480623972236450681*x**7 \ + 311973482284542371301330321821976049 g = 365431878023781158602430064717380211405897160759702125019136*x**21 \ + 197599133478719444145775798221171663643171734081650688*x**14 \ - 9504116979659010018253915765478924103928886144*x**7 \ - 311973482284542371301330321821976049 assert R.dup_zz_heu_gcd(f, R.dup_diff(f, 1))[0] == g assert R.dup_rr_prs_gcd(f, R.dup_diff(f, 1))[0] == g R, x = ring("x", QQ) f = QQ(1,2)*x**2 + x + QQ(1,2) g = QQ(1,2)*x + QQ(1,2) h = x + 1 assert R.dup_qq_heu_gcd(f, g) == (h, g, QQ(1,2)) assert R.dup_ff_prs_gcd(f, g) == (h, g, QQ(1,2)) R, x = ring("x", ZZ) f = 1317378933230047068160*x + 2945748836994210856960 g = 120352542776360960*x + 269116466014453760 h = 120352542776360960*x + 269116466014453760 cff = 10946 cfg = 1 assert R.dup_zz_heu_gcd(f, g) == (h, cff, cfg) def test_dmp_gcd(): R, x, y = ring("x,y", ZZ) f, g = 0, 0 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (0, 0, 0) f, g = 2, 0 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, 0) f, g = -2, 0 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, -1, 0) f, g = 0, -2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 0, -1) f, g = 0, 2*x + 4 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2*x + 4, 0, 1) f, g = 2*x + 4, 0 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2*x + 4, 1, 0) f, g = 2, 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, 1) f, g = -2, 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, -1, 1) f, g = 2, -2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, -1) f, g = -2, -2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, -1, -1) f, g = x**2 + 2*x + 1, 1 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (1, x**2 + 2*x + 1, 1) f, g = x**2 + 2*x + 1, 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (1, x**2 + 2*x + 1, 2) f, g = 2*x**2 + 4*x + 2, 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, x**2 + 2*x + 1, 1) f, g = 2, 2*x**2 + 4*x + 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, x**2 + 2*x + 1) f, g = 2*x**2 + 4*x + 2, x + 1 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (x + 1, 2*x + 2, 1) f, g = x + 1, 2*x**2 + 4*x + 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (x + 1, 1, 2*x + 2) R, x, y, z, u = ring("x,y,z,u", ZZ) f, g = u**2 + 2*u + 1, 2*u + 2 assert R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (u + 1, u + 1, 2) f, g = z**2*u**2 + 2*z**2*u + z**2 + z*u + z, u**2 + 2*u + 1 h, cff, cfg = u + 1, z**2*u + z**2 + z, u + 1 assert R.dmp_zz_heu_gcd(f, g) == (h, cff, cfg) assert R.dmp_rr_prs_gcd(f, g) == (h, cff, cfg) assert R.dmp_zz_heu_gcd(g, f) == (h, cfg, cff) assert R.dmp_rr_prs_gcd(g, f) == (h, cfg, cff) R, x, y, z = ring("x,y,z", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(2, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g H, cff, cfg = R.dmp_rr_prs_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y, z, u, v = ring("x,y,z,u,v", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(4, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y, z, u, v, a, b = ring("x,y,z,u,v,a,b", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(6, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y, z, u, v, a, b, c, d = ring("x,y,z,u,v,a,b,c,d", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(8, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y, z = ring("x,y,z", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_2(2, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g H, cff, cfg = R.dmp_rr_prs_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g f, g, h = map(R.from_dense, dmp_fateman_poly_F_3(2, ZZ)) H, cff, cfg = R.dmp_zz_heu_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g H, cff, cfg = R.dmp_rr_prs_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y, z, u, v = ring("x,y,z,u,v", ZZ) f, g, h = map(R.from_dense, dmp_fateman_poly_F_3(4, ZZ)) H, cff, cfg = R.dmp_inner_gcd(f, g) assert H == h and R.dmp_mul(H, cff) == f \ and R.dmp_mul(H, cfg) == g R, x, y = ring("x,y", QQ) f = QQ(1,2)*x**2 + x + QQ(1,2) g = QQ(1,2)*x + QQ(1,2) h = x + 1 assert R.dmp_qq_heu_gcd(f, g) == (h, g, QQ(1,2)) assert R.dmp_ff_prs_gcd(f, g) == (h, g, QQ(1,2)) R, x, y = ring("x,y", RR) f = 2.1*x*y**2 - 2.2*x*y + 2.1*x g = 1.0*x**3 assert R.dmp_ff_prs_gcd(f, g) == \ (1.0*x, 2.1*y**2 - 2.2*y + 2.1, 1.0*x**2) def test_dup_lcm(): R, x = ring("x", ZZ) assert R.dup_lcm(2, 6) == 6 assert R.dup_lcm(2*x**3, 6*x) == 6*x**3 assert R.dup_lcm(2*x**3, 3*x) == 6*x**3 assert R.dup_lcm(x**2 + x, x) == x**2 + x assert R.dup_lcm(x**2 + x, 2*x) == 2*x**2 + 2*x assert R.dup_lcm(x**2 + 2*x, x) == x**2 + 2*x assert R.dup_lcm(2*x**2 + x, x) == 2*x**2 + x assert R.dup_lcm(2*x**2 + x, 2*x) == 4*x**2 + 2*x def test_dmp_lcm(): R, x, y = ring("x,y", ZZ) assert R.dmp_lcm(2, 6) == 6 assert R.dmp_lcm(x, y) == x*y assert R.dmp_lcm(2*x**3, 6*x*y**2) == 6*x**3*y**2 assert R.dmp_lcm(2*x**3, 3*x*y**2) == 6*x**3*y**2 assert R.dmp_lcm(x**2*y, x*y**2) == x**2*y**2 f = 2*x*y**5 - 3*x*y**4 - 2*x*y**3 + 3*x*y**2 g = y**5 - 2*y**3 + y h = 2*x*y**7 - 3*x*y**6 - 4*x*y**5 + 6*x*y**4 + 2*x*y**3 - 3*x*y**2 assert R.dmp_lcm(f, g) == h f = x**3 - 3*x**2*y - 9*x*y**2 - 5*y**3 g = x**4 + 6*x**3*y + 12*x**2*y**2 + 10*x*y**3 + 3*y**4 h = x**5 + x**4*y - 18*x**3*y**2 - 50*x**2*y**3 - 47*x*y**4 - 15*y**5 assert R.dmp_lcm(f, g) == h def test_dmp_content(): R, x,y = ring("x,y", ZZ) assert R.dmp_content(-2) == 2 f, g, F = 3*y**2 + 2*y + 1, 1, 0 for i in range(0, 5): g *= f F += x**i*g assert R.dmp_content(F) == f.drop(x) R, x,y,z = ring("x,y,z", ZZ) assert R.dmp_content(f_4) == 1 assert R.dmp_content(f_5) == 1 R, x,y,z,t = ring("x,y,z,t", ZZ) assert R.dmp_content(f_6) == 1 def test_dmp_primitive(): R, x,y = ring("x,y", ZZ) assert R.dmp_primitive(0) == (0, 0) assert R.dmp_primitive(1) == (1, 1) f, g, F = 3*y**2 + 2*y + 1, 1, 0 for i in range(0, 5): g *= f F += x**i*g assert R.dmp_primitive(F) == (f.drop(x), F / f) R, x,y,z = ring("x,y,z", ZZ) cont, f = R.dmp_primitive(f_4) assert cont == 1 and f == f_4 cont, f = R.dmp_primitive(f_5) assert cont == 1 and f == f_5 R, x,y,z,t = ring("x,y,z,t", ZZ) cont, f = R.dmp_primitive(f_6) assert cont == 1 and f == f_6 def test_dup_cancel(): R, x = ring("x", ZZ) f = 2*x**2 - 2 g = x**2 - 2*x + 1 p = 2*x + 2 q = x - 1 assert R.dup_cancel(f, g) == (p, q) assert R.dup_cancel(f, g, include=False) == (1, 1, p, q) f = -x - 2 g = 3*x - 4 F = x + 2 G = -3*x + 4 assert R.dup_cancel(f, g) == (f, g) assert R.dup_cancel(F, G) == (f, g) assert R.dup_cancel(0, 0) == (0, 0) assert R.dup_cancel(0, 0, include=False) == (1, 1, 0, 0) assert R.dup_cancel(x, 0) == (1, 0) assert R.dup_cancel(x, 0, include=False) == (1, 1, 1, 0) assert R.dup_cancel(0, x) == (0, 1) assert R.dup_cancel(0, x, include=False) == (1, 1, 0, 1) f = 0 g = x one = 1 assert R.dup_cancel(f, g, include=True) == (f, one) def test_dmp_cancel(): R, x, y = ring("x,y", ZZ) f = 2*x**2 - 2 g = x**2 - 2*x + 1 p = 2*x + 2 q = x - 1 assert R.dmp_cancel(f, g) == (p, q) assert R.dmp_cancel(f, g, include=False) == (1, 1, p, q) assert R.dmp_cancel(0, 0) == (0, 0) assert R.dmp_cancel(0, 0, include=False) == (1, 1, 0, 0) assert R.dmp_cancel(y, 0) == (1, 0) assert R.dmp_cancel(y, 0, include=False) == (1, 1, 1, 0) assert R.dmp_cancel(0, y) == (0, 1) assert R.dmp_cancel(0, y, include=False) == (1, 1, 0, 1)
c57e248fb97939a4a077b6b102314452b9e49c65c8c7c7aaf41e7644238964a5
from sympy.polys.galoistools import ( gf_crt, gf_crt1, gf_crt2, gf_int, gf_degree, gf_strip, gf_trunc, gf_normal, gf_from_dict, gf_to_dict, gf_from_int_poly, gf_to_int_poly, gf_neg, gf_add_ground, gf_sub_ground, gf_mul_ground, gf_add, gf_sub, gf_add_mul, gf_sub_mul, gf_mul, gf_sqr, gf_div, gf_rem, gf_quo, gf_exquo, gf_lshift, gf_rshift, gf_expand, gf_pow, gf_pow_mod, gf_gcdex, gf_gcd, gf_lcm, gf_cofactors, gf_LC, gf_TC, gf_monic, gf_eval, gf_multi_eval, gf_compose, gf_compose_mod, gf_trace_map, gf_diff, gf_irreducible, gf_irreducible_p, gf_irred_p_ben_or, gf_irred_p_rabin, gf_sqf_list, gf_sqf_part, gf_sqf_p, gf_Qmatrix, gf_Qbasis, gf_ddf_zassenhaus, gf_ddf_shoup, gf_edf_zassenhaus, gf_edf_shoup, gf_berlekamp, gf_factor_sqf, gf_factor, gf_value, linear_congruence, csolve_prime, gf_csolve, gf_frobenius_map, gf_frobenius_monomial_base ) from sympy.polys.polyerrors import ( ExactQuotientFailed, ) from sympy.polys import polyconfig as config from sympy.polys.domains import ZZ from sympy import pi, nextprime from sympy.testing.pytest import raises def test_gf_crt(): U = [49, 76, 65] M = [99, 97, 95] p = 912285 u = 639985 assert gf_crt(U, M, ZZ) == u E = [9215, 9405, 9603] S = [62, 24, 12] assert gf_crt1(M, ZZ) == (p, E, S) assert gf_crt2(U, M, p, E, S, ZZ) == u def test_gf_int(): assert gf_int(0, 5) == 0 assert gf_int(1, 5) == 1 assert gf_int(2, 5) == 2 assert gf_int(3, 5) == -2 assert gf_int(4, 5) == -1 assert gf_int(5, 5) == 0 def test_gf_degree(): assert gf_degree([]) == -1 assert gf_degree([1]) == 0 assert gf_degree([1, 0]) == 1 assert gf_degree([1, 0, 0, 0, 1]) == 4 def test_gf_strip(): assert gf_strip([]) == [] assert gf_strip([0]) == [] assert gf_strip([0, 0, 0]) == [] assert gf_strip([1]) == [1] assert gf_strip([0, 1]) == [1] assert gf_strip([0, 0, 0, 1]) == [1] assert gf_strip([1, 2, 0]) == [1, 2, 0] assert gf_strip([0, 1, 2, 0]) == [1, 2, 0] assert gf_strip([0, 0, 0, 1, 2, 0]) == [1, 2, 0] def test_gf_trunc(): assert gf_trunc([], 11) == [] assert gf_trunc([1], 11) == [1] assert gf_trunc([22], 11) == [] assert gf_trunc([12], 11) == [1] assert gf_trunc([11, 22, 17, 1, 0], 11) == [6, 1, 0] assert gf_trunc([12, 23, 17, 1, 0], 11) == [1, 1, 6, 1, 0] def test_gf_normal(): assert gf_normal([11, 22, 17, 1, 0], 11, ZZ) == [6, 1, 0] def test_gf_from_to_dict(): f = {11: 12, 6: 2, 0: 25} F = {11: 1, 6: 2, 0: 3} g = [1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3] assert gf_from_dict(f, 11, ZZ) == g assert gf_to_dict(g, 11) == F f = {11: -5, 4: 0, 3: 1, 0: 12} F = {11: -5, 3: 1, 0: 1} g = [6, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1] assert gf_from_dict(f, 11, ZZ) == g assert gf_to_dict(g, 11) == F assert gf_to_dict([10], 11, symmetric=True) == {0: -1} assert gf_to_dict([10], 11, symmetric=False) == {0: 10} def test_gf_from_to_int_poly(): assert gf_from_int_poly([1, 0, 7, 2, 20], 5) == [1, 0, 2, 2, 0] assert gf_to_int_poly([1, 0, 4, 2, 3], 5) == [1, 0, -1, 2, -2] assert gf_to_int_poly([10], 11, symmetric=True) == [-1] assert gf_to_int_poly([10], 11, symmetric=False) == [10] def test_gf_LC(): assert gf_LC([], ZZ) == 0 assert gf_LC([1], ZZ) == 1 assert gf_LC([1, 2], ZZ) == 1 def test_gf_TC(): assert gf_TC([], ZZ) == 0 assert gf_TC([1], ZZ) == 1 assert gf_TC([1, 2], ZZ) == 2 def test_gf_monic(): assert gf_monic(ZZ.map([]), 11, ZZ) == (0, []) assert gf_monic(ZZ.map([1]), 11, ZZ) == (1, [1]) assert gf_monic(ZZ.map([2]), 11, ZZ) == (2, [1]) assert gf_monic(ZZ.map([1, 2, 3, 4]), 11, ZZ) == (1, [1, 2, 3, 4]) assert gf_monic(ZZ.map([2, 3, 4, 5]), 11, ZZ) == (2, [1, 7, 2, 8]) def test_gf_arith(): assert gf_neg([], 11, ZZ) == [] assert gf_neg([1], 11, ZZ) == [10] assert gf_neg([1, 2, 3], 11, ZZ) == [10, 9, 8] assert gf_add_ground([], 0, 11, ZZ) == [] assert gf_sub_ground([], 0, 11, ZZ) == [] assert gf_add_ground([], 3, 11, ZZ) == [3] assert gf_sub_ground([], 3, 11, ZZ) == [8] assert gf_add_ground([1], 3, 11, ZZ) == [4] assert gf_sub_ground([1], 3, 11, ZZ) == [9] assert gf_add_ground([8], 3, 11, ZZ) == [] assert gf_sub_ground([3], 3, 11, ZZ) == [] assert gf_add_ground([1, 2, 3], 3, 11, ZZ) == [1, 2, 6] assert gf_sub_ground([1, 2, 3], 3, 11, ZZ) == [1, 2, 0] assert gf_mul_ground([], 0, 11, ZZ) == [] assert gf_mul_ground([], 1, 11, ZZ) == [] assert gf_mul_ground([1], 0, 11, ZZ) == [] assert gf_mul_ground([1], 1, 11, ZZ) == [1] assert gf_mul_ground([1, 2, 3], 0, 11, ZZ) == [] assert gf_mul_ground([1, 2, 3], 1, 11, ZZ) == [1, 2, 3] assert gf_mul_ground([1, 2, 3], 7, 11, ZZ) == [7, 3, 10] assert gf_add([], [], 11, ZZ) == [] assert gf_add([1], [], 11, ZZ) == [1] assert gf_add([], [1], 11, ZZ) == [1] assert gf_add([1], [1], 11, ZZ) == [2] assert gf_add([1], [2], 11, ZZ) == [3] assert gf_add([1, 2], [1], 11, ZZ) == [1, 3] assert gf_add([1], [1, 2], 11, ZZ) == [1, 3] assert gf_add([1, 2, 3], [8, 9, 10], 11, ZZ) == [9, 0, 2] assert gf_sub([], [], 11, ZZ) == [] assert gf_sub([1], [], 11, ZZ) == [1] assert gf_sub([], [1], 11, ZZ) == [10] assert gf_sub([1], [1], 11, ZZ) == [] assert gf_sub([1], [2], 11, ZZ) == [10] assert gf_sub([1, 2], [1], 11, ZZ) == [1, 1] assert gf_sub([1], [1, 2], 11, ZZ) == [10, 10] assert gf_sub([3, 2, 1], [8, 9, 10], 11, ZZ) == [6, 4, 2] assert gf_add_mul( [1, 5, 6], [7, 3], [8, 0, 6, 1], 11, ZZ) == [1, 2, 10, 8, 9] assert gf_sub_mul( [1, 5, 6], [7, 3], [8, 0, 6, 1], 11, ZZ) == [10, 9, 3, 2, 3] assert gf_mul([], [], 11, ZZ) == [] assert gf_mul([], [1], 11, ZZ) == [] assert gf_mul([1], [], 11, ZZ) == [] assert gf_mul([1], [1], 11, ZZ) == [1] assert gf_mul([5], [7], 11, ZZ) == [2] assert gf_mul([3, 0, 0, 6, 1, 2], [4, 0, 1, 0], 11, ZZ) == [1, 0, 3, 2, 4, 3, 1, 2, 0] assert gf_mul([4, 0, 1, 0], [3, 0, 0, 6, 1, 2], 11, ZZ) == [1, 0, 3, 2, 4, 3, 1, 2, 0] assert gf_mul([2, 0, 0, 1, 7], [2, 0, 0, 1, 7], 11, ZZ) == [4, 0, 0, 4, 6, 0, 1, 3, 5] assert gf_sqr([], 11, ZZ) == [] assert gf_sqr([2], 11, ZZ) == [4] assert gf_sqr([1, 2], 11, ZZ) == [1, 4, 4] assert gf_sqr([2, 0, 0, 1, 7], 11, ZZ) == [4, 0, 0, 4, 6, 0, 1, 3, 5] def test_gf_division(): raises(ZeroDivisionError, lambda: gf_div([1, 2, 3], [], 11, ZZ)) raises(ZeroDivisionError, lambda: gf_rem([1, 2, 3], [], 11, ZZ)) raises(ZeroDivisionError, lambda: gf_quo([1, 2, 3], [], 11, ZZ)) raises(ZeroDivisionError, lambda: gf_quo([1, 2, 3], [], 11, ZZ)) assert gf_div([1], [1, 2, 3], 7, ZZ) == ([], [1]) assert gf_rem([1], [1, 2, 3], 7, ZZ) == [1] assert gf_quo([1], [1, 2, 3], 7, ZZ) == [] f = ZZ.map([5, 4, 3, 2, 1, 0]) g = ZZ.map([1, 2, 3]) q = [5, 1, 0, 6] r = [3, 3] assert gf_div(f, g, 7, ZZ) == (q, r) assert gf_rem(f, g, 7, ZZ) == r assert gf_quo(f, g, 7, ZZ) == q raises(ExactQuotientFailed, lambda: gf_exquo(f, g, 7, ZZ)) f = ZZ.map([5, 4, 3, 2, 1, 0]) g = ZZ.map([1, 2, 3, 0]) q = [5, 1, 0] r = [6, 1, 0] assert gf_div(f, g, 7, ZZ) == (q, r) assert gf_rem(f, g, 7, ZZ) == r assert gf_quo(f, g, 7, ZZ) == q raises(ExactQuotientFailed, lambda: gf_exquo(f, g, 7, ZZ)) assert gf_quo(ZZ.map([1, 2, 1]), ZZ.map([1, 1]), 11, ZZ) == [1, 1] def test_gf_shift(): f = [1, 2, 3, 4, 5] assert gf_lshift([], 5, ZZ) == [] assert gf_rshift([], 5, ZZ) == ([], []) assert gf_lshift(f, 1, ZZ) == [1, 2, 3, 4, 5, 0] assert gf_lshift(f, 2, ZZ) == [1, 2, 3, 4, 5, 0, 0] assert gf_rshift(f, 0, ZZ) == (f, []) assert gf_rshift(f, 1, ZZ) == ([1, 2, 3, 4], [5]) assert gf_rshift(f, 3, ZZ) == ([1, 2], [3, 4, 5]) assert gf_rshift(f, 5, ZZ) == ([], f) def test_gf_expand(): F = [([1, 1], 2), ([1, 2], 3)] assert gf_expand(F, 11, ZZ) == [1, 8, 3, 5, 6, 8] assert gf_expand((4, F), 11, ZZ) == [4, 10, 1, 9, 2, 10] def test_gf_powering(): assert gf_pow([1, 0, 0, 1, 8], 0, 11, ZZ) == [1] assert gf_pow([1, 0, 0, 1, 8], 1, 11, ZZ) == [1, 0, 0, 1, 8] assert gf_pow([1, 0, 0, 1, 8], 2, 11, ZZ) == [1, 0, 0, 2, 5, 0, 1, 5, 9] assert gf_pow([1, 0, 0, 1, 8], 5, 11, ZZ) == \ [1, 0, 0, 5, 7, 0, 10, 6, 2, 10, 9, 6, 10, 6, 6, 0, 5, 2, 5, 9, 10] assert gf_pow([1, 0, 0, 1, 8], 8, 11, ZZ) == \ [1, 0, 0, 8, 9, 0, 6, 8, 10, 1, 2, 5, 10, 7, 7, 9, 1, 2, 0, 0, 6, 2, 5, 2, 5, 7, 7, 9, 10, 10, 7, 5, 5] assert gf_pow([1, 0, 0, 1, 8], 45, 11, ZZ) == \ [ 1, 0, 0, 1, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 10, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 6, 4, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 3, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 10, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 9, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 3, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 3, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 10] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 0, ZZ.map([2, 0, 7]), 11, ZZ) == [1] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 1, ZZ.map([2, 0, 7]), 11, ZZ) == [1, 1] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 2, ZZ.map([2, 0, 7]), 11, ZZ) == [2, 3] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 5, ZZ.map([2, 0, 7]), 11, ZZ) == [7, 8] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 8, ZZ.map([2, 0, 7]), 11, ZZ) == [1, 5] assert gf_pow_mod(ZZ.map([1, 0, 0, 1, 8]), 45, ZZ.map([2, 0, 7]), 11, ZZ) == [5, 4] def test_gf_gcdex(): assert gf_gcdex(ZZ.map([]), ZZ.map([]), 11, ZZ) == ([1], [], []) assert gf_gcdex(ZZ.map([2]), ZZ.map([]), 11, ZZ) == ([6], [], [1]) assert gf_gcdex(ZZ.map([]), ZZ.map([2]), 11, ZZ) == ([], [6], [1]) assert gf_gcdex(ZZ.map([2]), ZZ.map([2]), 11, ZZ) == ([], [6], [1]) assert gf_gcdex(ZZ.map([]), ZZ.map([3, 0]), 11, ZZ) == ([], [4], [1, 0]) assert gf_gcdex(ZZ.map([3, 0]), ZZ.map([]), 11, ZZ) == ([4], [], [1, 0]) assert gf_gcdex(ZZ.map([3, 0]), ZZ.map([3, 0]), 11, ZZ) == ([], [4], [1, 0]) assert gf_gcdex(ZZ.map([1, 8, 7]), ZZ.map([1, 7, 1, 7]), 11, ZZ) == ([5, 6], [6], [1, 7]) def test_gf_gcd(): assert gf_gcd(ZZ.map([]), ZZ.map([]), 11, ZZ) == [] assert gf_gcd(ZZ.map([2]), ZZ.map([]), 11, ZZ) == [1] assert gf_gcd(ZZ.map([]), ZZ.map([2]), 11, ZZ) == [1] assert gf_gcd(ZZ.map([2]), ZZ.map([2]), 11, ZZ) == [1] assert gf_gcd(ZZ.map([]), ZZ.map([1, 0]), 11, ZZ) == [1, 0] assert gf_gcd(ZZ.map([1, 0]), ZZ.map([]), 11, ZZ) == [1, 0] assert gf_gcd(ZZ.map([3, 0]), ZZ.map([3, 0]), 11, ZZ) == [1, 0] assert gf_gcd(ZZ.map([1, 8, 7]), ZZ.map([1, 7, 1, 7]), 11, ZZ) == [1, 7] def test_gf_lcm(): assert gf_lcm(ZZ.map([]), ZZ.map([]), 11, ZZ) == [] assert gf_lcm(ZZ.map([2]), ZZ.map([]), 11, ZZ) == [] assert gf_lcm(ZZ.map([]), ZZ.map([2]), 11, ZZ) == [] assert gf_lcm(ZZ.map([2]), ZZ.map([2]), 11, ZZ) == [1] assert gf_lcm(ZZ.map([]), ZZ.map([1, 0]), 11, ZZ) == [] assert gf_lcm(ZZ.map([1, 0]), ZZ.map([]), 11, ZZ) == [] assert gf_lcm(ZZ.map([3, 0]), ZZ.map([3, 0]), 11, ZZ) == [1, 0] assert gf_lcm(ZZ.map([1, 8, 7]), ZZ.map([1, 7, 1, 7]), 11, ZZ) == [1, 8, 8, 8, 7] def test_gf_cofactors(): assert gf_cofactors(ZZ.map([]), ZZ.map([]), 11, ZZ) == ([], [], []) assert gf_cofactors(ZZ.map([2]), ZZ.map([]), 11, ZZ) == ([1], [2], []) assert gf_cofactors(ZZ.map([]), ZZ.map([2]), 11, ZZ) == ([1], [], [2]) assert gf_cofactors(ZZ.map([2]), ZZ.map([2]), 11, ZZ) == ([1], [2], [2]) assert gf_cofactors(ZZ.map([]), ZZ.map([1, 0]), 11, ZZ) == ([1, 0], [], [1]) assert gf_cofactors(ZZ.map([1, 0]), ZZ.map([]), 11, ZZ) == ([1, 0], [1], []) assert gf_cofactors(ZZ.map([3, 0]), ZZ.map([3, 0]), 11, ZZ) == ( [1, 0], [3], [3]) assert gf_cofactors(ZZ.map([1, 8, 7]), ZZ.map([1, 7, 1, 7]), 11, ZZ) == ( ([1, 7], [1, 1], [1, 0, 1])) def test_gf_diff(): assert gf_diff([], 11, ZZ) == [] assert gf_diff([7], 11, ZZ) == [] assert gf_diff([7, 3], 11, ZZ) == [7] assert gf_diff([7, 3, 1], 11, ZZ) == [3, 3] assert gf_diff([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 11, ZZ) == [] def test_gf_eval(): assert gf_eval([], 4, 11, ZZ) == 0 assert gf_eval([], 27, 11, ZZ) == 0 assert gf_eval([7], 4, 11, ZZ) == 7 assert gf_eval([7], 27, 11, ZZ) == 7 assert gf_eval([1, 0, 3, 2, 4, 3, 1, 2, 0], 0, 11, ZZ) == 0 assert gf_eval([1, 0, 3, 2, 4, 3, 1, 2, 0], 4, 11, ZZ) == 9 assert gf_eval([1, 0, 3, 2, 4, 3, 1, 2, 0], 27, 11, ZZ) == 5 assert gf_eval([4, 0, 0, 4, 6, 0, 1, 3, 5], 0, 11, ZZ) == 5 assert gf_eval([4, 0, 0, 4, 6, 0, 1, 3, 5], 4, 11, ZZ) == 3 assert gf_eval([4, 0, 0, 4, 6, 0, 1, 3, 5], 27, 11, ZZ) == 9 assert gf_multi_eval([3, 2, 1], [0, 1, 2, 3], 11, ZZ) == [1, 6, 6, 1] def test_gf_compose(): assert gf_compose([], [1, 0], 11, ZZ) == [] assert gf_compose_mod([], [1, 0], [1, 0], 11, ZZ) == [] assert gf_compose([1], [], 11, ZZ) == [1] assert gf_compose([1, 0], [], 11, ZZ) == [] assert gf_compose([1, 0], [1, 0], 11, ZZ) == [1, 0] f = ZZ.map([1, 1, 4, 9, 1]) g = ZZ.map([1, 1, 1]) h = ZZ.map([1, 0, 0, 2]) assert gf_compose(g, h, 11, ZZ) == [1, 0, 0, 5, 0, 0, 7] assert gf_compose_mod(g, h, f, 11, ZZ) == [3, 9, 6, 10] def test_gf_trace_map(): f = ZZ.map([1, 1, 4, 9, 1]) a = [1, 1, 1] c = ZZ.map([1, 0]) b = gf_pow_mod(c, 11, f, 11, ZZ) assert gf_trace_map(a, b, c, 0, f, 11, ZZ) == \ ([1, 1, 1], [1, 1, 1]) assert gf_trace_map(a, b, c, 1, f, 11, ZZ) == \ ([5, 2, 10, 3], [5, 3, 0, 4]) assert gf_trace_map(a, b, c, 2, f, 11, ZZ) == \ ([5, 9, 5, 3], [10, 1, 5, 7]) assert gf_trace_map(a, b, c, 3, f, 11, ZZ) == \ ([1, 10, 6, 0], [7]) assert gf_trace_map(a, b, c, 4, f, 11, ZZ) == \ ([1, 1, 1], [1, 1, 8]) assert gf_trace_map(a, b, c, 5, f, 11, ZZ) == \ ([5, 2, 10, 3], [5, 3, 0, 0]) assert gf_trace_map(a, b, c, 11, f, 11, ZZ) == \ ([1, 10, 6, 0], [10]) def test_gf_irreducible(): assert gf_irreducible_p(gf_irreducible(1, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(2, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(3, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(4, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(5, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(6, 11, ZZ), 11, ZZ) is True assert gf_irreducible_p(gf_irreducible(7, 11, ZZ), 11, ZZ) is True def test_gf_irreducible_p(): assert gf_irred_p_ben_or(ZZ.map([7]), 11, ZZ) is True assert gf_irred_p_ben_or(ZZ.map([7, 3]), 11, ZZ) is True assert gf_irred_p_ben_or(ZZ.map([7, 3, 1]), 11, ZZ) is False assert gf_irred_p_rabin(ZZ.map([7]), 11, ZZ) is True assert gf_irred_p_rabin(ZZ.map([7, 3]), 11, ZZ) is True assert gf_irred_p_rabin(ZZ.map([7, 3, 1]), 11, ZZ) is False config.setup('GF_IRRED_METHOD', 'ben-or') assert gf_irreducible_p(ZZ.map([7]), 11, ZZ) is True assert gf_irreducible_p(ZZ.map([7, 3]), 11, ZZ) is True assert gf_irreducible_p(ZZ.map([7, 3, 1]), 11, ZZ) is False config.setup('GF_IRRED_METHOD', 'rabin') assert gf_irreducible_p(ZZ.map([7]), 11, ZZ) is True assert gf_irreducible_p(ZZ.map([7, 3]), 11, ZZ) is True assert gf_irreducible_p(ZZ.map([7, 3, 1]), 11, ZZ) is False config.setup('GF_IRRED_METHOD', 'other') raises(KeyError, lambda: gf_irreducible_p([7], 11, ZZ)) config.setup('GF_IRRED_METHOD') f = ZZ.map([1, 9, 9, 13, 16, 15, 6, 7, 7, 7, 10]) g = ZZ.map([1, 7, 16, 7, 15, 13, 13, 11, 16, 10, 9]) h = gf_mul(f, g, 17, ZZ) assert gf_irred_p_ben_or(f, 17, ZZ) is True assert gf_irred_p_ben_or(g, 17, ZZ) is True assert gf_irred_p_ben_or(h, 17, ZZ) is False assert gf_irred_p_rabin(f, 17, ZZ) is True assert gf_irred_p_rabin(g, 17, ZZ) is True assert gf_irred_p_rabin(h, 17, ZZ) is False def test_gf_squarefree(): assert gf_sqf_list([], 11, ZZ) == (0, []) assert gf_sqf_list([1], 11, ZZ) == (1, []) assert gf_sqf_list([1, 1], 11, ZZ) == (1, [([1, 1], 1)]) assert gf_sqf_p([], 11, ZZ) is True assert gf_sqf_p([1], 11, ZZ) is True assert gf_sqf_p([1, 1], 11, ZZ) is True f = gf_from_dict({11: 1, 0: 1}, 11, ZZ) assert gf_sqf_p(f, 11, ZZ) is False assert gf_sqf_list(f, 11, ZZ) == \ (1, [([1, 1], 11)]) f = [1, 5, 8, 4] assert gf_sqf_p(f, 11, ZZ) is False assert gf_sqf_list(f, 11, ZZ) == \ (1, [([1, 1], 1), ([1, 2], 2)]) assert gf_sqf_part(f, 11, ZZ) == [1, 3, 2] f = [1, 0, 0, 2, 0, 0, 2, 0, 0, 1, 0] assert gf_sqf_list(f, 3, ZZ) == \ (1, [([1, 0], 1), ([1, 1], 3), ([1, 2], 6)]) def test_gf_frobenius_map(): f = ZZ.map([2, 0, 1, 0, 2, 2, 0, 2, 2, 2]) g = ZZ.map([1,1,0,2,0,1,0,2,0,1]) p = 3 b = gf_frobenius_monomial_base(g, p, ZZ) h = gf_frobenius_map(f, g, b, p, ZZ) h1 = gf_pow_mod(f, p, g, p, ZZ) assert h == h1 def test_gf_berlekamp(): f = gf_from_int_poly([1, -3, 1, -3, -1, -3, 1], 11) Q = [[1, 0, 0, 0, 0, 0], [3, 5, 8, 8, 6, 5], [3, 6, 6, 1, 10, 0], [9, 4, 10, 3, 7, 9], [7, 8, 10, 0, 0, 8], [8, 10, 7, 8, 10, 8]] V = [[1, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 0], [0, 0, 7, 9, 0, 1]] assert gf_Qmatrix(f, 11, ZZ) == Q assert gf_Qbasis(Q, 11, ZZ) == V assert gf_berlekamp(f, 11, ZZ) == \ [[1, 1], [1, 5, 3], [1, 2, 3, 4]] f = ZZ.map([1, 0, 1, 0, 10, 10, 8, 2, 8]) Q = ZZ.map([[1, 0, 0, 0, 0, 0, 0, 0], [2, 1, 7, 11, 10, 12, 5, 11], [3, 6, 4, 3, 0, 4, 7, 2], [4, 3, 6, 5, 1, 6, 2, 3], [2, 11, 8, 8, 3, 1, 3, 11], [6, 11, 8, 6, 2, 7, 10, 9], [5, 11, 7, 10, 0, 11, 7, 12], [3, 3, 12, 5, 0, 11, 9, 12]]) V = [[1, 0, 0, 0, 0, 0, 0, 0], [0, 5, 5, 0, 9, 5, 1, 0], [0, 9, 11, 9, 10, 12, 0, 1]] assert gf_Qmatrix(f, 13, ZZ) == Q assert gf_Qbasis(Q, 13, ZZ) == V assert gf_berlekamp(f, 13, ZZ) == \ [[1, 3], [1, 8, 4, 12], [1, 2, 3, 4, 6]] def test_gf_ddf(): f = gf_from_dict({15: ZZ(1), 0: ZZ(-1)}, 11, ZZ) g = [([1, 0, 0, 0, 0, 10], 1), ([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2)] assert gf_ddf_zassenhaus(f, 11, ZZ) == g assert gf_ddf_shoup(f, 11, ZZ) == g f = gf_from_dict({63: ZZ(1), 0: ZZ(1)}, 2, ZZ) g = [([1, 1], 1), ([1, 1, 1], 2), ([1, 1, 1, 1, 1, 1, 1], 3), ([1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1], 6)] assert gf_ddf_zassenhaus(f, 2, ZZ) == g assert gf_ddf_shoup(f, 2, ZZ) == g f = gf_from_dict({6: ZZ(1), 5: ZZ(-1), 4: ZZ(1), 3: ZZ(1), 1: ZZ(-1)}, 3, ZZ) g = [([1, 1, 0], 1), ([1, 1, 0, 1, 2], 2)] assert gf_ddf_zassenhaus(f, 3, ZZ) == g assert gf_ddf_shoup(f, 3, ZZ) == g f = ZZ.map([1, 2, 5, 26, 677, 436, 791, 325, 456, 24, 577]) g = [([1, 701], 1), ([1, 110, 559, 532, 694, 151, 110, 70, 735, 122], 9)] assert gf_ddf_zassenhaus(f, 809, ZZ) == g assert gf_ddf_shoup(f, 809, ZZ) == g p = ZZ(nextprime(int((2**15 * pi).evalf()))) f = gf_from_dict({15: 1, 1: 1, 0: 1}, p, ZZ) g = [([1, 22730, 68144], 2), ([1, 64876, 83977, 10787, 12561, 68608, 52650, 88001, 84356], 4), ([1, 15347, 95022, 84569, 94508, 92335], 5)] assert gf_ddf_zassenhaus(f, p, ZZ) == g assert gf_ddf_shoup(f, p, ZZ) == g def test_gf_edf(): f = ZZ.map([1, 1, 0, 1, 2]) g = ZZ.map([[1, 0, 1], [1, 1, 2]]) assert gf_edf_zassenhaus(f, 2, 3, ZZ) == g assert gf_edf_shoup(f, 2, 3, ZZ) == g def test_gf_factor(): assert gf_factor([], 11, ZZ) == (0, []) assert gf_factor([1], 11, ZZ) == (1, []) assert gf_factor([1, 1], 11, ZZ) == (1, [([1, 1], 1)]) assert gf_factor_sqf([], 11, ZZ) == (0, []) assert gf_factor_sqf([1], 11, ZZ) == (1, []) assert gf_factor_sqf([1, 1], 11, ZZ) == (1, [[1, 1]]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor_sqf([], 11, ZZ) == (0, []) assert gf_factor_sqf([1], 11, ZZ) == (1, []) assert gf_factor_sqf([1, 1], 11, ZZ) == (1, [[1, 1]]) config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor_sqf([], 11, ZZ) == (0, []) assert gf_factor_sqf([1], 11, ZZ) == (1, []) assert gf_factor_sqf([1, 1], 11, ZZ) == (1, [[1, 1]]) config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor_sqf(ZZ.map([]), 11, ZZ) == (0, []) assert gf_factor_sqf(ZZ.map([1]), 11, ZZ) == (1, []) assert gf_factor_sqf(ZZ.map([1, 1]), 11, ZZ) == (1, [[1, 1]]) f, p = ZZ.map([1, 0, 0, 1, 0]), 2 g = (1, [([1, 0], 1), ([1, 1], 1), ([1, 1, 1], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g g = (1, [[1, 0], [1, 1], [1, 1, 1]]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor_sqf(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor_sqf(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor_sqf(f, p, ZZ) == g f, p = gf_from_int_poly([1, -3, 1, -3, -1, -3, 1], 11), 11 g = (1, [([1, 1], 1), ([1, 5, 3], 1), ([1, 2, 3, 4], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g f, p = [1, 5, 8, 4], 11 g = (1, [([1, 1], 1), ([1, 2], 2)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g f, p = [1, 1, 10, 1, 0, 10, 10, 10, 0, 0], 11 g = (1, [([1, 0], 2), ([1, 9, 5], 1), ([1, 3, 0, 8, 5, 2], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g f, p = gf_from_dict({32: 1, 0: 1}, 11, ZZ), 11 g = (1, [([1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 10], 1), ([1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 10], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g f, p = gf_from_dict({32: ZZ(8), 0: ZZ(5)}, 11, ZZ), 11 g = (8, [([1, 3], 1), ([1, 8], 1), ([1, 0, 9], 1), ([1, 2, 2], 1), ([1, 9, 2], 1), ([1, 0, 5, 0, 7], 1), ([1, 0, 6, 0, 7], 1), ([1, 0, 0, 0, 1, 0, 0, 0, 6], 1), ([1, 0, 0, 0, 10, 0, 0, 0, 6], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g f, p = gf_from_dict({63: ZZ(8), 0: ZZ(5)}, 11, ZZ), 11 g = (8, [([1, 7], 1), ([1, 4, 5], 1), ([1, 6, 8, 2], 1), ([1, 9, 9, 2], 1), ([1, 0, 0, 9, 0, 0, 4], 1), ([1, 2, 0, 8, 4, 6, 4], 1), ([1, 2, 3, 8, 0, 6, 4], 1), ([1, 2, 6, 0, 8, 4, 4], 1), ([1, 3, 3, 1, 6, 8, 4], 1), ([1, 5, 6, 0, 8, 6, 4], 1), ([1, 6, 2, 7, 9, 8, 4], 1), ([1, 10, 4, 7, 10, 7, 4], 1), ([1, 10, 10, 1, 4, 9, 4], 1)]) config.setup('GF_FACTOR_METHOD', 'berlekamp') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g # Gathen polynomials: x**n + x + 1 (mod p > 2**n * pi) p = ZZ(nextprime(int((2**15 * pi).evalf()))) f = gf_from_dict({15: 1, 1: 1, 0: 1}, p, ZZ) assert gf_sqf_p(f, p, ZZ) is True g = (1, [([1, 22730, 68144], 1), ([1, 81553, 77449, 86810, 4724], 1), ([1, 86276, 56779, 14859, 31575], 1), ([1, 15347, 95022, 84569, 94508, 92335], 1)]) config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g g = (1, [[1, 22730, 68144], [1, 81553, 77449, 86810, 4724], [1, 86276, 56779, 14859, 31575], [1, 15347, 95022, 84569, 94508, 92335]]) config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor_sqf(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor_sqf(f, p, ZZ) == g # Shoup polynomials: f = a_0 x**n + a_1 x**(n-1) + ... + a_n # (mod p > 2**(n-2) * pi), where a_n = a_{n-1}**2 + 1, a_0 = 1 p = ZZ(nextprime(int((2**4 * pi).evalf()))) f = ZZ.map([1, 2, 5, 26, 41, 39, 38]) assert gf_sqf_p(f, p, ZZ) is True g = (1, [([1, 44, 26], 1), ([1, 11, 25, 18, 30], 1)]) config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor(f, p, ZZ) == g g = (1, [[1, 44, 26], [1, 11, 25, 18, 30]]) config.setup('GF_FACTOR_METHOD', 'zassenhaus') assert gf_factor_sqf(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'shoup') assert gf_factor_sqf(f, p, ZZ) == g config.setup('GF_FACTOR_METHOD', 'other') raises(KeyError, lambda: gf_factor([1, 1], 11, ZZ)) config.setup('GF_FACTOR_METHOD') def test_gf_csolve(): assert gf_value([1, 7, 2, 4], 11) == 2204 assert linear_congruence(4, 3, 5) == [2] assert linear_congruence(0, 3, 5) == [] assert linear_congruence(6, 1, 4) == [] assert linear_congruence(0, 5, 5) == [0, 1, 2, 3, 4] assert linear_congruence(3, 12, 15) == [4, 9, 14] assert linear_congruence(6, 0, 18) == [0, 3, 6, 9, 12, 15] # with power = 1 assert csolve_prime([1, 3, 2, 17], 7) == [3] assert csolve_prime([1, 3, 1, 5], 5) == [0, 1] assert csolve_prime([3, 6, 9, 3], 3) == [0, 1, 2] # with power > 1 assert csolve_prime( [1, 1, 223], 3, 4) == [4, 13, 22, 31, 40, 49, 58, 67, 76] assert csolve_prime([3, 5, 2, 25], 5, 3) == [16, 50, 99] assert csolve_prime([3, 2, 2, 49], 7, 3) == [147, 190, 234] assert gf_csolve([1, 1, 7], 189) == [13, 49, 76, 112, 139, 175] assert gf_csolve([1, 3, 4, 1, 30], 60) == [10, 30] assert gf_csolve([1, 1, 7], 15) == []
a7b0ad2491f08073bffdda57913eb8d39abe3d33fdfcb8e8cf43dc1d600df426
"""Tests for PythonRational type. """ from sympy.polys.domains import PythonRational as QQ from sympy.testing.pytest import raises def test_PythonRational__init__(): assert QQ(0).p == 0 assert QQ(0).q == 1 assert QQ(0, 1).p == 0 assert QQ(0, 1).q == 1 assert QQ(0, -1).p == 0 assert QQ(0, -1).q == 1 assert QQ(1).p == 1 assert QQ(1).q == 1 assert QQ(1, 1).p == 1 assert QQ(1, 1).q == 1 assert QQ(-1, -1).p == 1 assert QQ(-1, -1).q == 1 assert QQ(-1).p == -1 assert QQ(-1).q == 1 assert QQ(-1, 1).p == -1 assert QQ(-1, 1).q == 1 assert QQ( 1, -1).p == -1 assert QQ( 1, -1).q == 1 assert QQ(1, 2).p == 1 assert QQ(1, 2).q == 2 assert QQ(3, 4).p == 3 assert QQ(3, 4).q == 4 assert QQ(2, 2).p == 1 assert QQ(2, 2).q == 1 assert QQ(2, 4).p == 1 assert QQ(2, 4).q == 2 def test_PythonRational__hash__(): assert hash(QQ(0)) == hash(0) assert hash(QQ(1)) == hash(1) assert hash(QQ(117)) == hash(117) def test_PythonRational__int__(): assert int(QQ(-1, 4)) == 0 assert int(QQ( 1, 4)) == 0 assert int(QQ(-5, 4)) == -1 assert int(QQ( 5, 4)) == 1 def test_PythonRational__float__(): assert float(QQ(-1, 2)) == -0.5 assert float(QQ( 1, 2)) == 0.5 def test_PythonRational__abs__(): assert abs(QQ(-1, 2)) == QQ(1, 2) assert abs(QQ( 1, 2)) == QQ(1, 2) def test_PythonRational__pos__(): assert +QQ(-1, 2) == QQ(-1, 2) assert +QQ( 1, 2) == QQ( 1, 2) def test_PythonRational__neg__(): assert -QQ(-1, 2) == QQ( 1, 2) assert -QQ( 1, 2) == QQ(-1, 2) def test_PythonRational__add__(): assert QQ(-1, 2) + QQ( 1, 2) == QQ(0) assert QQ( 1, 2) + QQ(-1, 2) == QQ(0) assert QQ(1, 2) + QQ(1, 2) == QQ(1) assert QQ(1, 2) + QQ(3, 2) == QQ(2) assert QQ(3, 2) + QQ(1, 2) == QQ(2) assert QQ(3, 2) + QQ(3, 2) == QQ(3) assert 1 + QQ(1, 2) == QQ(3, 2) assert QQ(1, 2) + 1 == QQ(3, 2) def test_PythonRational__sub__(): assert QQ(-1, 2) - QQ( 1, 2) == QQ(-1) assert QQ( 1, 2) - QQ(-1, 2) == QQ( 1) assert QQ(1, 2) - QQ(1, 2) == QQ( 0) assert QQ(1, 2) - QQ(3, 2) == QQ(-1) assert QQ(3, 2) - QQ(1, 2) == QQ( 1) assert QQ(3, 2) - QQ(3, 2) == QQ( 0) assert 1 - QQ(1, 2) == QQ( 1, 2) assert QQ(1, 2) - 1 == QQ(-1, 2) def test_PythonRational__mul__(): assert QQ(-1, 2) * QQ( 1, 2) == QQ(-1, 4) assert QQ( 1, 2) * QQ(-1, 2) == QQ(-1, 4) assert QQ(1, 2) * QQ(1, 2) == QQ(1, 4) assert QQ(1, 2) * QQ(3, 2) == QQ(3, 4) assert QQ(3, 2) * QQ(1, 2) == QQ(3, 4) assert QQ(3, 2) * QQ(3, 2) == QQ(9, 4) assert 2 * QQ(1, 2) == QQ(1) assert QQ(1, 2) * 2 == QQ(1) def test_PythonRational__div__(): assert QQ(-1, 2) / QQ( 1, 2) == QQ(-1) assert QQ( 1, 2) / QQ(-1, 2) == QQ(-1) assert QQ(1, 2) / QQ(1, 2) == QQ(1) assert QQ(1, 2) / QQ(3, 2) == QQ(1, 3) assert QQ(3, 2) / QQ(1, 2) == QQ(3) assert QQ(3, 2) / QQ(3, 2) == QQ(1) assert 2 / QQ(1, 2) == QQ(4) assert QQ(1, 2) / 2 == QQ(1, 4) raises(ZeroDivisionError, lambda: QQ(1, 2) / QQ(0)) raises(ZeroDivisionError, lambda: QQ(1, 2) / 0) def test_PythonRational__pow__(): assert QQ(1)**10 == QQ(1) assert QQ(2)**10 == QQ(1024) assert QQ(1)**(-10) == QQ(1) assert QQ(2)**(-10) == QQ(1, 1024) def test_PythonRational__eq__(): assert (QQ(1, 2) == QQ(1, 2)) is True assert (QQ(1, 2) != QQ(1, 2)) is False assert (QQ(1, 2) == QQ(1, 3)) is False assert (QQ(1, 2) != QQ(1, 3)) is True def test_PythonRational__lt_le_gt_ge__(): assert (QQ(1, 2) < QQ(1, 4)) is False assert (QQ(1, 2) <= QQ(1, 4)) is False assert (QQ(1, 2) > QQ(1, 4)) is True assert (QQ(1, 2) >= QQ(1, 4)) is True assert (QQ(1, 4) < QQ(1, 2)) is True assert (QQ(1, 4) <= QQ(1, 2)) is True assert (QQ(1, 4) > QQ(1, 2)) is False assert (QQ(1, 4) >= QQ(1, 2)) is False
d9603a85e563561a822153bf52a0a2d755c361aadfd0bf962f201e5839c7300e
"""Tests for real and complex root isolation and refinement algorithms. """ from sympy.polys.rings import ring from sympy.polys.domains import ZZ, QQ, EX from sympy.polys.polyerrors import DomainError, RefinementFailed from sympy.testing.pytest import raises def test_dup_sturm(): R, x = ring("x", QQ) assert R.dup_sturm(5) == [1] assert R.dup_sturm(x) == [x, 1] f = x**3 - 2*x**2 + 3*x - 5 assert R.dup_sturm(f) == [f, 3*x**2 - 4*x + 3, -QQ(10,9)*x + QQ(13,3), -QQ(3303,100)] def test_dup_refine_real_root(): R, x = ring("x", ZZ) f = x**2 - 2 assert R.dup_refine_real_root(f, QQ(1), QQ(1), steps=1) == (QQ(1), QQ(1)) assert R.dup_refine_real_root(f, QQ(1), QQ(1), steps=9) == (QQ(1), QQ(1)) raises(ValueError, lambda: R.dup_refine_real_root(f, QQ(-2), QQ(2))) s, t = QQ(1, 1), QQ(2, 1) assert R.dup_refine_real_root(f, s, t, steps=0) == (QQ(1, 1), QQ(2, 1)) assert R.dup_refine_real_root(f, s, t, steps=1) == (QQ(1, 1), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=2) == (QQ(4, 3), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=3) == (QQ(7, 5), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=4) == (QQ(7, 5), QQ(10, 7)) s, t = QQ(1, 1), QQ(3, 2) assert R.dup_refine_real_root(f, s, t, steps=0) == (QQ(1, 1), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=1) == (QQ(4, 3), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=2) == (QQ(7, 5), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=3) == (QQ(7, 5), QQ(10, 7)) assert R.dup_refine_real_root(f, s, t, steps=4) == (QQ(7, 5), QQ(17, 12)) s, t = QQ(1, 1), QQ(5, 3) assert R.dup_refine_real_root(f, s, t, steps=0) == (QQ(1, 1), QQ(5, 3)) assert R.dup_refine_real_root(f, s, t, steps=1) == (QQ(1, 1), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=2) == (QQ(7, 5), QQ(3, 2)) assert R.dup_refine_real_root(f, s, t, steps=3) == (QQ(7, 5), QQ(13, 9)) assert R.dup_refine_real_root(f, s, t, steps=4) == (QQ(7, 5), QQ(27, 19)) s, t = QQ(-1, 1), QQ(-2, 1) assert R.dup_refine_real_root(f, s, t, steps=0) == (-QQ(2, 1), -QQ(1, 1)) assert R.dup_refine_real_root(f, s, t, steps=1) == (-QQ(3, 2), -QQ(1, 1)) assert R.dup_refine_real_root(f, s, t, steps=2) == (-QQ(3, 2), -QQ(4, 3)) assert R.dup_refine_real_root(f, s, t, steps=3) == (-QQ(3, 2), -QQ(7, 5)) assert R.dup_refine_real_root(f, s, t, steps=4) == (-QQ(10, 7), -QQ(7, 5)) raises(RefinementFailed, lambda: R.dup_refine_real_root(f, QQ(0), QQ(1))) s, t, u, v, w = QQ(1), QQ(2), QQ(24, 17), QQ(17, 12), QQ(7, 5) assert R.dup_refine_real_root(f, s, t, eps=QQ(1, 100)) == (u, v) assert R.dup_refine_real_root(f, s, t, steps=6) == (u, v) assert R.dup_refine_real_root(f, s, t, eps=QQ(1, 100), steps=5) == (w, v) assert R.dup_refine_real_root(f, s, t, eps=QQ(1, 100), steps=6) == (u, v) assert R.dup_refine_real_root(f, s, t, eps=QQ(1, 100), steps=7) == (u, v) s, t, u, v = QQ(-2), QQ(-1), QQ(-3, 2), QQ(-4, 3) assert R.dup_refine_real_root(f, s, t, disjoint=QQ(-5)) == (s, t) assert R.dup_refine_real_root(f, s, t, disjoint=-v) == (s, t) assert R.dup_refine_real_root(f, s, t, disjoint=v) == (u, v) s, t, u, v = QQ(1), QQ(2), QQ(4, 3), QQ(3, 2) assert R.dup_refine_real_root(f, s, t, disjoint=QQ(5)) == (s, t) assert R.dup_refine_real_root(f, s, t, disjoint=-u) == (s, t) assert R.dup_refine_real_root(f, s, t, disjoint=u) == (u, v) def test_dup_isolate_real_roots_sqf(): R, x = ring("x", ZZ) assert R.dup_isolate_real_roots_sqf(0) == [] assert R.dup_isolate_real_roots_sqf(5) == [] assert R.dup_isolate_real_roots_sqf(x**2 + x) == [(-1, -1), (0, 0)] assert R.dup_isolate_real_roots_sqf(x**2 - x) == [( 0, 0), (1, 1)] assert R.dup_isolate_real_roots_sqf(x**4 + x + 1) == [] I = [(-2, -1), (1, 2)] assert R.dup_isolate_real_roots_sqf(x**2 - 2) == I assert R.dup_isolate_real_roots_sqf(-x**2 + 2) == I assert R.dup_isolate_real_roots_sqf(x - 1) == \ [(1, 1)] assert R.dup_isolate_real_roots_sqf(x**2 - 3*x + 2) == \ [(1, 1), (2, 2)] assert R.dup_isolate_real_roots_sqf(x**3 - 6*x**2 + 11*x - 6) == \ [(1, 1), (2, 2), (3, 3)] assert R.dup_isolate_real_roots_sqf(x**4 - 10*x**3 + 35*x**2 - 50*x + 24) == \ [(1, 1), (2, 2), (3, 3), (4, 4)] assert R.dup_isolate_real_roots_sqf(x**5 - 15*x**4 + 85*x**3 - 225*x**2 + 274*x - 120) == \ [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)] assert R.dup_isolate_real_roots_sqf(x - 10) == \ [(10, 10)] assert R.dup_isolate_real_roots_sqf(x**2 - 30*x + 200) == \ [(10, 10), (20, 20)] assert R.dup_isolate_real_roots_sqf(x**3 - 60*x**2 + 1100*x - 6000) == \ [(10, 10), (20, 20), (30, 30)] assert R.dup_isolate_real_roots_sqf(x**4 - 100*x**3 + 3500*x**2 - 50000*x + 240000) == \ [(10, 10), (20, 20), (30, 30), (40, 40)] assert R.dup_isolate_real_roots_sqf(x**5 - 150*x**4 + 8500*x**3 - 225000*x**2 + 2740000*x - 12000000) == \ [(10, 10), (20, 20), (30, 30), (40, 40), (50, 50)] assert R.dup_isolate_real_roots_sqf(x + 1) == \ [(-1, -1)] assert R.dup_isolate_real_roots_sqf(x**2 + 3*x + 2) == \ [(-2, -2), (-1, -1)] assert R.dup_isolate_real_roots_sqf(x**3 + 6*x**2 + 11*x + 6) == \ [(-3, -3), (-2, -2), (-1, -1)] assert R.dup_isolate_real_roots_sqf(x**4 + 10*x**3 + 35*x**2 + 50*x + 24) == \ [(-4, -4), (-3, -3), (-2, -2), (-1, -1)] assert R.dup_isolate_real_roots_sqf(x**5 + 15*x**4 + 85*x**3 + 225*x**2 + 274*x + 120) == \ [(-5, -5), (-4, -4), (-3, -3), (-2, -2), (-1, -1)] assert R.dup_isolate_real_roots_sqf(x + 10) == \ [(-10, -10)] assert R.dup_isolate_real_roots_sqf(x**2 + 30*x + 200) == \ [(-20, -20), (-10, -10)] assert R.dup_isolate_real_roots_sqf(x**3 + 60*x**2 + 1100*x + 6000) == \ [(-30, -30), (-20, -20), (-10, -10)] assert R.dup_isolate_real_roots_sqf(x**4 + 100*x**3 + 3500*x**2 + 50000*x + 240000) == \ [(-40, -40), (-30, -30), (-20, -20), (-10, -10)] assert R.dup_isolate_real_roots_sqf(x**5 + 150*x**4 + 8500*x**3 + 225000*x**2 + 2740000*x + 12000000) == \ [(-50, -50), (-40, -40), (-30, -30), (-20, -20), (-10, -10)] assert R.dup_isolate_real_roots_sqf(x**2 - 5) == [(-3, -2), (2, 3)] assert R.dup_isolate_real_roots_sqf(x**3 - 5) == [(1, 2)] assert R.dup_isolate_real_roots_sqf(x**4 - 5) == [(-2, -1), (1, 2)] assert R.dup_isolate_real_roots_sqf(x**5 - 5) == [(1, 2)] assert R.dup_isolate_real_roots_sqf(x**6 - 5) == [(-2, -1), (1, 2)] assert R.dup_isolate_real_roots_sqf(x**7 - 5) == [(1, 2)] assert R.dup_isolate_real_roots_sqf(x**8 - 5) == [(-2, -1), (1, 2)] assert R.dup_isolate_real_roots_sqf(x**9 - 5) == [(1, 2)] assert R.dup_isolate_real_roots_sqf(x**2 - 1) == \ [(-1, -1), (1, 1)] assert R.dup_isolate_real_roots_sqf(x**3 + 2*x**2 - x - 2) == \ [(-2, -2), (-1, -1), (1, 1)] assert R.dup_isolate_real_roots_sqf(x**4 - 5*x**2 + 4) == \ [(-2, -2), (-1, -1), (1, 1), (2, 2)] assert R.dup_isolate_real_roots_sqf(x**5 + 3*x**4 - 5*x**3 - 15*x**2 + 4*x + 12) == \ [(-3, -3), (-2, -2), (-1, -1), (1, 1), (2, 2)] assert R.dup_isolate_real_roots_sqf(x**6 - 14*x**4 + 49*x**2 - 36) == \ [(-3, -3), (-2, -2), (-1, -1), (1, 1), (2, 2), (3, 3)] assert R.dup_isolate_real_roots_sqf(2*x**7 + x**6 - 28*x**5 - 14*x**4 + 98*x**3 + 49*x**2 - 72*x - 36) == \ [(-3, -3), (-2, -2), (-1, -1), (-1, 0), (1, 1), (2, 2), (3, 3)] assert R.dup_isolate_real_roots_sqf(4*x**8 - 57*x**6 + 210*x**4 - 193*x**2 + 36) == \ [(-3, -3), (-2, -2), (-1, -1), (-1, 0), (0, 1), (1, 1), (2, 2), (3, 3)] f = 9*x**2 - 2 assert R.dup_isolate_real_roots_sqf(f) == \ [(-1, 0), (0, 1)] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 10)) == \ [(QQ(-1, 2), QQ(-3, 7)), (QQ(3, 7), QQ(1, 2))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 100)) == \ [(QQ(-9, 19), QQ(-8, 17)), (QQ(8, 17), QQ(9, 19))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 1000)) == \ [(QQ(-33, 70), QQ(-8, 17)), (QQ(8, 17), QQ(33, 70))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 10000)) == \ [(QQ(-33, 70), QQ(-107, 227)), (QQ(107, 227), QQ(33, 70))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 100000)) == \ [(QQ(-305, 647), QQ(-272, 577)), (QQ(272, 577), QQ(305, 647))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 1000000)) == \ [(QQ(-1121, 2378), QQ(-272, 577)), (QQ(272, 577), QQ(1121, 2378))] f = 200100012*x**5 - 700390052*x**4 + 700490079*x**3 - 200240054*x**2 + 40017*x - 2 assert R.dup_isolate_real_roots_sqf(f) == \ [(QQ(0), QQ(1, 10002)), (QQ(1, 10002), QQ(1, 10002)), (QQ(1, 2), QQ(1, 2)), (QQ(1), QQ(1)), (QQ(2), QQ(2))] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 100000)) == \ [(QQ(1, 10003), QQ(1, 10003)), (QQ(1, 10002), QQ(1, 10002)), (QQ(1, 2), QQ(1, 2)), (QQ(1), QQ(1)), (QQ(2), QQ(2))] a, b, c, d = 10000090000001, 2000100003, 10000300007, 10000005000008 f = 20001600074001600021*x**4 \ + 1700135866278935491773999857*x**3 \ - 2000179008931031182161141026995283662899200197*x**2 \ - 800027600594323913802305066986600025*x \ + 100000950000540000725000008 assert R.dup_isolate_real_roots_sqf(f) == \ [(-a, -a), (-1, 0), (0, 1), (d, d)] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 100000000000)) == \ [(-QQ(a), -QQ(a)), (-QQ(1, b), -QQ(1, b)), (QQ(1, c), QQ(1, c)), (QQ(d), QQ(d))] (u, v), B, C, (s, t) = R.dup_isolate_real_roots_sqf(f, fast=True) assert u < -a < v and B == (-QQ(1), QQ(0)) and C == (QQ(0), QQ(1)) and s < d < t assert R.dup_isolate_real_roots_sqf(f, fast=True, eps=QQ(1, 100000000000000000000000000000)) == \ [(-QQ(a), -QQ(a)), (-QQ(1, b), -QQ(1, b)), (QQ(1, c), QQ(1, c)), (QQ(d), QQ(d))] f = -10*x**4 + 8*x**3 + 80*x**2 - 32*x - 160 assert R.dup_isolate_real_roots_sqf(f) == \ [(-2, -2), (-2, -1), (2, 2), (2, 3)] assert R.dup_isolate_real_roots_sqf(f, eps=QQ(1, 100)) == \ [(-QQ(2), -QQ(2)), (-QQ(23, 14), -QQ(18, 11)), (QQ(2), QQ(2)), (QQ(39, 16), QQ(22, 9))] f = x - 1 assert R.dup_isolate_real_roots_sqf(f, inf=2) == [] assert R.dup_isolate_real_roots_sqf(f, sup=0) == [] assert R.dup_isolate_real_roots_sqf(f) == [(1, 1)] assert R.dup_isolate_real_roots_sqf(f, inf=1) == [(1, 1)] assert R.dup_isolate_real_roots_sqf(f, sup=1) == [(1, 1)] assert R.dup_isolate_real_roots_sqf(f, inf=1, sup=1) == [(1, 1)] f = x**2 - 2 assert R.dup_isolate_real_roots_sqf(f, inf=QQ(7, 4)) == [] assert R.dup_isolate_real_roots_sqf(f, inf=QQ(7, 5)) == [(QQ(7, 5), QQ(3, 2))] assert R.dup_isolate_real_roots_sqf(f, sup=QQ(7, 5)) == [(-2, -1)] assert R.dup_isolate_real_roots_sqf(f, sup=QQ(7, 4)) == [(-2, -1), (1, QQ(3, 2))] assert R.dup_isolate_real_roots_sqf(f, sup=-QQ(7, 4)) == [] assert R.dup_isolate_real_roots_sqf(f, sup=-QQ(7, 5)) == [(-QQ(3, 2), -QQ(7, 5))] assert R.dup_isolate_real_roots_sqf(f, inf=-QQ(7, 5)) == [(1, 2)] assert R.dup_isolate_real_roots_sqf(f, inf=-QQ(7, 4)) == [(-QQ(3, 2), -1), (1, 2)] I = [(-2, -1), (1, 2)] assert R.dup_isolate_real_roots_sqf(f, inf=-2) == I assert R.dup_isolate_real_roots_sqf(f, sup=+2) == I assert R.dup_isolate_real_roots_sqf(f, inf=-2, sup=2) == I R, x = ring("x", QQ) f = QQ(8, 5)*x**2 - QQ(87374, 3855)*x - QQ(17, 771) assert R.dup_isolate_real_roots_sqf(f) == [(-1, 0), (14, 15)] R, x = ring("x", EX) raises(DomainError, lambda: R.dup_isolate_real_roots_sqf(x + 3)) def test_dup_isolate_real_roots(): R, x = ring("x", ZZ) assert R.dup_isolate_real_roots(0) == [] assert R.dup_isolate_real_roots(3) == [] assert R.dup_isolate_real_roots(5*x) == [((0, 0), 1)] assert R.dup_isolate_real_roots(7*x**4) == [((0, 0), 4)] assert R.dup_isolate_real_roots(x**2 + x) == [((-1, -1), 1), ((0, 0), 1)] assert R.dup_isolate_real_roots(x**2 - x) == [((0, 0), 1), ((1, 1), 1)] assert R.dup_isolate_real_roots(x**4 + x + 1) == [] I = [((-2, -1), 1), ((1, 2), 1)] assert R.dup_isolate_real_roots(x**2 - 2) == I assert R.dup_isolate_real_roots(-x**2 + 2) == I f = 16*x**14 - 96*x**13 + 24*x**12 + 936*x**11 - 1599*x**10 - 2880*x**9 + 9196*x**8 \ + 552*x**7 - 21831*x**6 + 13968*x**5 + 21690*x**4 - 26784*x**3 - 2916*x**2 + 15552*x - 5832 g = R.dup_sqf_part(f) assert R.dup_isolate_real_roots(f) == \ [((-QQ(2), -QQ(3, 2)), 2), ((-QQ(3, 2), -QQ(1, 1)), 3), ((QQ(1), QQ(3, 2)), 3), ((QQ(3, 2), QQ(3, 2)), 4), ((QQ(5, 3), QQ(2)), 2)] assert R.dup_isolate_real_roots_sqf(g) == \ [(-QQ(2), -QQ(3, 2)), (-QQ(3, 2), -QQ(1, 1)), (QQ(1), QQ(3, 2)), (QQ(3, 2), QQ(3, 2)), (QQ(3, 2), QQ(2))] assert R.dup_isolate_real_roots(g) == \ [((-QQ(2), -QQ(3, 2)), 1), ((-QQ(3, 2), -QQ(1, 1)), 1), ((QQ(1), QQ(3, 2)), 1), ((QQ(3, 2), QQ(3, 2)), 1), ((QQ(3, 2), QQ(2)), 1)] f = x - 1 assert R.dup_isolate_real_roots(f, inf=2) == [] assert R.dup_isolate_real_roots(f, sup=0) == [] assert R.dup_isolate_real_roots(f) == [((1, 1), 1)] assert R.dup_isolate_real_roots(f, inf=1) == [((1, 1), 1)] assert R.dup_isolate_real_roots(f, sup=1) == [((1, 1), 1)] assert R.dup_isolate_real_roots(f, inf=1, sup=1) == [((1, 1), 1)] f = x**4 - 4*x**2 + 4 assert R.dup_isolate_real_roots(f, inf=QQ(7, 4)) == [] assert R.dup_isolate_real_roots(f, inf=QQ(7, 5)) == [((QQ(7, 5), QQ(3, 2)), 2)] assert R.dup_isolate_real_roots(f, sup=QQ(7, 5)) == [((-2, -1), 2)] assert R.dup_isolate_real_roots(f, sup=QQ(7, 4)) == [((-2, -1), 2), ((1, QQ(3, 2)), 2)] assert R.dup_isolate_real_roots(f, sup=-QQ(7, 4)) == [] assert R.dup_isolate_real_roots(f, sup=-QQ(7, 5)) == [((-QQ(3, 2), -QQ(7, 5)), 2)] assert R.dup_isolate_real_roots(f, inf=-QQ(7, 5)) == [((1, 2), 2)] assert R.dup_isolate_real_roots(f, inf=-QQ(7, 4)) == [((-QQ(3, 2), -1), 2), ((1, 2), 2)] I = [((-2, -1), 2), ((1, 2), 2)] assert R.dup_isolate_real_roots(f, inf=-2) == I assert R.dup_isolate_real_roots(f, sup=+2) == I assert R.dup_isolate_real_roots(f, inf=-2, sup=2) == I f = x**11 - 3*x**10 - x**9 + 11*x**8 - 8*x**7 - 8*x**6 + 12*x**5 - 4*x**4 assert R.dup_isolate_real_roots(f, basis=False) == \ [((-2, -1), 2), ((0, 0), 4), ((1, 1), 3), ((1, 2), 2)] assert R.dup_isolate_real_roots(f, basis=True) == \ [((-2, -1), 2, [1, 0, -2]), ((0, 0), 4, [1, 0]), ((1, 1), 3, [1, -1]), ((1, 2), 2, [1, 0, -2])] f = (x**45 - 45*x**44 + 990*x**43 - 1) g = (x**46 - 15180*x**43 + 9366819*x**40 - 53524680*x**39 + 260932815*x**38 - 1101716330*x**37 + 4076350421*x**36 - 13340783196*x**35 + 38910617655*x**34 - 101766230790*x**33 + 239877544005*x**32 - 511738760544*x**31 + 991493848554*x**30 - 1749695026860*x**29 + 2818953098830*x**28 - 4154246671960*x**27 + 5608233007146*x**26 - 6943526580276*x**25 + 7890371113950*x**24 - 8233430727600*x**23 + 7890371113950*x**22 - 6943526580276*x**21 + 5608233007146*x**20 - 4154246671960*x**19 + 2818953098830*x**18 - 1749695026860*x**17 + 991493848554*x**16 - 511738760544*x**15 + 239877544005*x**14 - 101766230790*x**13 + 38910617655*x**12 - 13340783196*x**11 + 4076350421*x**10 - 1101716330*x**9 + 260932815*x**8 - 53524680*x**7 + 9366819*x**6 - 1370754*x**5 + 163185*x**4 - 15180*x**3 + 1035*x**2 - 47*x + 1) assert R.dup_isolate_real_roots(f*g) == \ [((0, QQ(1, 2)), 1), ((QQ(2, 3), QQ(3, 4)), 1), ((QQ(3, 4), 1), 1), ((6, 7), 1), ((24, 25), 1)] R, x = ring("x", EX) raises(DomainError, lambda: R.dup_isolate_real_roots(x + 3)) def test_dup_isolate_real_roots_list(): R, x = ring("x", ZZ) assert R.dup_isolate_real_roots_list([x**2 + x, x]) == \ [((-1, -1), {0: 1}), ((0, 0), {0: 1, 1: 1})] assert R.dup_isolate_real_roots_list([x**2 - x, x]) == \ [((0, 0), {0: 1, 1: 1}), ((1, 1), {0: 1})] assert R.dup_isolate_real_roots_list([x + 1, x + 2, x - 1, x + 1, x - 1, x - 1]) == \ [((-QQ(2), -QQ(2)), {1: 1}), ((-QQ(1), -QQ(1)), {0: 1, 3: 1}), ((QQ(1), QQ(1)), {2: 1, 4: 1, 5: 1})] assert R.dup_isolate_real_roots_list([x + 1, x + 2, x - 1, x + 1, x - 1, x + 2]) == \ [((-QQ(2), -QQ(2)), {1: 1, 5: 1}), ((-QQ(1), -QQ(1)), {0: 1, 3: 1}), ((QQ(1), QQ(1)), {2: 1, 4: 1})] f, g = x**4 - 4*x**2 + 4, x - 1 assert R.dup_isolate_real_roots_list([f, g], inf=QQ(7, 4)) == [] assert R.dup_isolate_real_roots_list([f, g], inf=QQ(7, 5)) == \ [((QQ(7, 5), QQ(3, 2)), {0: 2})] assert R.dup_isolate_real_roots_list([f, g], sup=QQ(7, 5)) == \ [((-2, -1), {0: 2}), ((1, 1), {1: 1})] assert R.dup_isolate_real_roots_list([f, g], sup=QQ(7, 4)) == \ [((-2, -1), {0: 2}), ((1, 1), {1: 1}), ((1, QQ(3, 2)), {0: 2})] assert R.dup_isolate_real_roots_list([f, g], sup=-QQ(7, 4)) == [] assert R.dup_isolate_real_roots_list([f, g], sup=-QQ(7, 5)) == \ [((-QQ(3, 2), -QQ(7, 5)), {0: 2})] assert R.dup_isolate_real_roots_list([f, g], inf=-QQ(7, 5)) == \ [((1, 1), {1: 1}), ((1, 2), {0: 2})] assert R.dup_isolate_real_roots_list([f, g], inf=-QQ(7, 4)) == \ [((-QQ(3, 2), -1), {0: 2}), ((1, 1), {1: 1}), ((1, 2), {0: 2})] f, g = 2*x**2 - 1, x**2 - 2 assert R.dup_isolate_real_roots_list([f, g]) == \ [((-QQ(2), -QQ(1)), {1: 1}), ((-QQ(1), QQ(0)), {0: 1}), ((QQ(0), QQ(1)), {0: 1}), ((QQ(1), QQ(2)), {1: 1})] assert R.dup_isolate_real_roots_list([f, g], strict=True) == \ [((-QQ(3, 2), -QQ(4, 3)), {1: 1}), ((-QQ(1), -QQ(2, 3)), {0: 1}), ((QQ(2, 3), QQ(1)), {0: 1}), ((QQ(4, 3), QQ(3, 2)), {1: 1})] f, g = x**2 - 2, x**3 - x**2 - 2*x + 2 assert R.dup_isolate_real_roots_list([f, g]) == \ [((-QQ(2), -QQ(1)), {1: 1, 0: 1}), ((QQ(1), QQ(1)), {1: 1}), ((QQ(1), QQ(2)), {1: 1, 0: 1})] f, g = x**3 - 2*x, x**5 - x**4 - 2*x**3 + 2*x**2 assert R.dup_isolate_real_roots_list([f, g]) == \ [((-QQ(2), -QQ(1)), {1: 1, 0: 1}), ((QQ(0), QQ(0)), {0: 1, 1: 2}), ((QQ(1), QQ(1)), {1: 1}), ((QQ(1), QQ(2)), {1: 1, 0: 1})] f, g = x**9 - 3*x**8 - x**7 + 11*x**6 - 8*x**5 - 8*x**4 + 12*x**3 - 4*x**2, x**5 - 2*x**4 + 3*x**3 - 4*x**2 + 2*x assert R.dup_isolate_real_roots_list([f, g], basis=False) == \ [((-2, -1), {0: 2}), ((0, 0), {0: 2, 1: 1}), ((1, 1), {0: 3, 1: 2}), ((1, 2), {0: 2})] assert R.dup_isolate_real_roots_list([f, g], basis=True) == \ [((-2, -1), {0: 2}, [1, 0, -2]), ((0, 0), {0: 2, 1: 1}, [1, 0]), ((1, 1), {0: 3, 1: 2}, [1, -1]), ((1, 2), {0: 2}, [1, 0, -2])] R, x = ring("x", EX) raises(DomainError, lambda: R.dup_isolate_real_roots_list([x + 3])) def test_dup_isolate_real_roots_list_QQ(): R, x = ring("x", ZZ) f = x**5 - 200 g = x**5 - 201 assert R.dup_isolate_real_roots_list([f, g]) == \ [((QQ(75, 26), QQ(101, 35)), {0: 1}), ((QQ(309, 107), QQ(26, 9)), {1: 1})] R, x = ring("x", QQ) f = -QQ(1, 200)*x**5 + 1 g = -QQ(1, 201)*x**5 + 1 assert R.dup_isolate_real_roots_list([f, g]) == \ [((QQ(75, 26), QQ(101, 35)), {0: 1}), ((QQ(309, 107), QQ(26, 9)), {1: 1})] def test_dup_count_real_roots(): R, x = ring("x", ZZ) assert R.dup_count_real_roots(0) == 0 assert R.dup_count_real_roots(7) == 0 f = x - 1 assert R.dup_count_real_roots(f) == 1 assert R.dup_count_real_roots(f, inf=1) == 1 assert R.dup_count_real_roots(f, sup=0) == 0 assert R.dup_count_real_roots(f, sup=1) == 1 assert R.dup_count_real_roots(f, inf=0, sup=1) == 1 assert R.dup_count_real_roots(f, inf=0, sup=2) == 1 assert R.dup_count_real_roots(f, inf=1, sup=2) == 1 f = x**2 - 2 assert R.dup_count_real_roots(f) == 2 assert R.dup_count_real_roots(f, sup=0) == 1 assert R.dup_count_real_roots(f, inf=-1, sup=1) == 0 # parameters for test_dup_count_complex_roots_n(): n = 1..8 a, b = (-QQ(1), -QQ(1)), (QQ(1), QQ(1)) c, d = ( QQ(0), QQ(0)), (QQ(1), QQ(1)) def test_dup_count_complex_roots_1(): R, x = ring("x", ZZ) # z-1 f = x - 1 assert R.dup_count_complex_roots(f, a, b) == 1 assert R.dup_count_complex_roots(f, c, d) == 1 # z+1 f = x + 1 assert R.dup_count_complex_roots(f, a, b) == 1 assert R.dup_count_complex_roots(f, c, d) == 0 def test_dup_count_complex_roots_2(): R, x = ring("x", ZZ) # (z-1)*(z) f = x**2 - x assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-1)*(-z) f = -x**2 + x assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 2 # (z+1)*(z) f = x**2 + x assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 1 # (z+1)*(-z) f = -x**2 - x assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 1 def test_dup_count_complex_roots_3(): R, x = ring("x", ZZ) # (z-1)*(z+1) f = x**2 - 1 assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-1)*(z+1)*(z) f = x**3 - x assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-1)*(z+1)*(-z) f = -x**3 + x assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 def test_dup_count_complex_roots_4(): R, x = ring("x", ZZ) # (z-I)*(z+I) f = x**2 + 1 assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I)*(z+I)*(z) f = x**3 + x assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I)*(z+I)*(-z) f = -x**3 - x assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I)*(z+I)*(z-1) f = x**3 - x**2 + x - 1 assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I)*(z+I)*(z-1)*(z) f = x**4 - x**3 + x**2 - x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I)*(z+I)*(z-1)*(-z) f = -x**4 + x**3 - x**2 + x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I)*(z+I)*(z-1)*(z+1) f = x**4 - 1 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I)*(z+I)*(z-1)*(z+1)*(z) f = x**5 - x assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I)*(z+I)*(z-1)*(z+1)*(-z) f = -x**5 + x assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 3 def test_dup_count_complex_roots_5(): R, x = ring("x", ZZ) # (z-I+1)*(z+I+1) f = x**2 + 2*x + 2 assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 0 # (z-I+1)*(z+I+1)*(z-1) f = x**3 + x**2 - 2 assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I+1)*(z+I+1)*(z-1)*z f = x**4 + x**3 - 2*x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I+1)*(z+I+1)*(z+1) f = x**3 + 3*x**2 + 4*x + 2 assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 0 # (z-I+1)*(z+I+1)*(z+1)*z f = x**4 + 3*x**3 + 4*x**2 + 2*x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I+1)*(z+I+1)*(z-1)*(z+1) f = x**4 + 2*x**3 + x**2 - 2*x - 2 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I+1)*(z+I+1)*(z-1)*(z+1)*z f = x**5 + 2*x**4 + x**3 - 2*x**2 - 2*x assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 2 def test_dup_count_complex_roots_6(): R, x = ring("x", ZZ) # (z-I-1)*(z+I-1) f = x**2 - 2*x + 2 assert R.dup_count_complex_roots(f, a, b) == 2 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z-1) f = x**3 - 3*x**2 + 4*x - 2 assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-1)*z f = x**4 - 3*x**3 + 4*x**2 - 2*x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I-1)*(z+I-1)*(z+1) f = x**3 - x**2 + 2 assert R.dup_count_complex_roots(f, a, b) == 3 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z+1)*z f = x**4 - x**3 + 2*x assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-1)*(z+1) f = x**4 - 2*x**3 + x**2 + 2*x - 2 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-1)*(z+1)*z f = x**5 - 2*x**4 + x**3 + 2*x**2 - 2*x assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 3 def test_dup_count_complex_roots_7(): R, x = ring("x", ZZ) # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1) f = x**4 + 4 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-2) f = x**5 - 2*x**4 + 4*x - 8 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z**2-2) f = x**6 - 2*x**4 + 4*x**2 - 8 assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1) f = x**5 - x**4 + 4*x - 4 assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*z f = x**6 - x**5 + 4*x**2 - 4*x assert R.dup_count_complex_roots(f, a, b) == 6 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z+1) f = x**5 + x**4 + 4*x + 4 assert R.dup_count_complex_roots(f, a, b) == 5 assert R.dup_count_complex_roots(f, c, d) == 1 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z+1)*z f = x**6 + x**5 + 4*x**2 + 4*x assert R.dup_count_complex_roots(f, a, b) == 6 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1) f = x**6 - x**4 + 4*x**2 - 4 assert R.dup_count_complex_roots(f, a, b) == 6 assert R.dup_count_complex_roots(f, c, d) == 2 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*z f = x**7 - x**5 + 4*x**3 - 4*x assert R.dup_count_complex_roots(f, a, b) == 7 assert R.dup_count_complex_roots(f, c, d) == 3 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*(z-I)*(z+I) f = x**8 + 3*x**4 - 4 assert R.dup_count_complex_roots(f, a, b) == 8 assert R.dup_count_complex_roots(f, c, d) == 3 def test_dup_count_complex_roots_8(): R, x = ring("x", ZZ) # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*(z-I)*(z+I)*z f = x**9 + 3*x**5 - 4*x assert R.dup_count_complex_roots(f, a, b) == 9 assert R.dup_count_complex_roots(f, c, d) == 4 # (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*(z-I)*(z+I)*(z**2-2)*z f = x**11 - 2*x**9 + 3*x**7 - 6*x**5 - 4*x**3 + 8*x assert R.dup_count_complex_roots(f, a, b) == 9 assert R.dup_count_complex_roots(f, c, d) == 4 def test_dup_count_complex_roots_implicit(): R, x = ring("x", ZZ) # z*(z-1)*(z+1)*(z-I)*(z+I) f = x**5 - x assert R.dup_count_complex_roots(f) == 5 assert R.dup_count_complex_roots(f, sup=(0, 0)) == 3 assert R.dup_count_complex_roots(f, inf=(0, 0)) == 3 def test_dup_count_complex_roots_exclude(): R, x = ring("x", ZZ) # z*(z-1)*(z+1)*(z-I)*(z+I) f = x**5 - x a, b = (-QQ(1), QQ(0)), (QQ(1), QQ(1)) assert R.dup_count_complex_roots(f, a, b) == 4 assert R.dup_count_complex_roots(f, a, b, exclude=['S']) == 3 assert R.dup_count_complex_roots(f, a, b, exclude=['N']) == 3 assert R.dup_count_complex_roots(f, a, b, exclude=['S', 'N']) == 2 assert R.dup_count_complex_roots(f, a, b, exclude=['E']) == 4 assert R.dup_count_complex_roots(f, a, b, exclude=['W']) == 4 assert R.dup_count_complex_roots(f, a, b, exclude=['E', 'W']) == 4 assert R.dup_count_complex_roots(f, a, b, exclude=['N', 'S', 'E', 'W']) == 2 assert R.dup_count_complex_roots(f, a, b, exclude=['SW']) == 3 assert R.dup_count_complex_roots(f, a, b, exclude=['SE']) == 3 assert R.dup_count_complex_roots(f, a, b, exclude=['SW', 'SE']) == 2 assert R.dup_count_complex_roots(f, a, b, exclude=['SW', 'SE', 'S']) == 1 assert R.dup_count_complex_roots(f, a, b, exclude=['SW', 'SE', 'S', 'N']) == 0 a, b = (QQ(0), QQ(0)), (QQ(1), QQ(1)) assert R.dup_count_complex_roots(f, a, b, exclude=True) == 1 def test_dup_isolate_complex_roots_sqf(): R, x = ring("x", ZZ) f = x**2 - 2*x + 3 assert R.dup_isolate_complex_roots_sqf(f) == \ [((0, -6), (6, 0)), ((0, 0), (6, 6))] assert [ r.as_tuple() for r in R.dup_isolate_complex_roots_sqf(f, blackbox=True) ] == \ [((0, -6), (6, 0)), ((0, 0), (6, 6))] assert R.dup_isolate_complex_roots_sqf(f, eps=QQ(1, 10)) == \ [((QQ(15, 16), -QQ(3, 2)), (QQ(33, 32), -QQ(45, 32))), ((QQ(15, 16), QQ(45, 32)), (QQ(33, 32), QQ(3, 2)))] assert R.dup_isolate_complex_roots_sqf(f, eps=QQ(1, 100)) == \ [((QQ(255, 256), -QQ(363, 256)), (QQ(513, 512), -QQ(723, 512))), ((QQ(255, 256), QQ(723, 512)), (QQ(513, 512), QQ(363, 256)))] f = 7*x**4 - 19*x**3 + 20*x**2 + 17*x + 20 assert R.dup_isolate_complex_roots_sqf(f) == \ [((-QQ(40, 7), -QQ(40, 7)), (0, 0)), ((-QQ(40, 7), 0), (0, QQ(40, 7))), ((0, -QQ(40, 7)), (QQ(40, 7), 0)), ((0, 0), (QQ(40, 7), QQ(40, 7)))] def test_dup_isolate_all_roots_sqf(): R, x = ring("x", ZZ) f = 4*x**4 - x**3 + 2*x**2 + 5*x assert R.dup_isolate_all_roots_sqf(f) == \ ([(-1, 0), (0, 0)], [((0, -QQ(5, 2)), (QQ(5, 2), 0)), ((0, 0), (QQ(5, 2), QQ(5, 2)))]) assert R.dup_isolate_all_roots_sqf(f, eps=QQ(1, 10)) == \ ([(QQ(-7, 8), QQ(-6, 7)), (0, 0)], [((QQ(35, 64), -QQ(35, 32)), (QQ(5, 8), -QQ(65, 64))), ((QQ(35, 64), QQ(65, 64)), (QQ(5, 8), QQ(35, 32)))]) def test_dup_isolate_all_roots(): R, x = ring("x", ZZ) f = 4*x**4 - x**3 + 2*x**2 + 5*x assert R.dup_isolate_all_roots(f) == \ ([((-1, 0), 1), ((0, 0), 1)], [(((0, -QQ(5, 2)), (QQ(5, 2), 0)), 1), (((0, 0), (QQ(5, 2), QQ(5, 2))), 1)]) assert R.dup_isolate_all_roots(f, eps=QQ(1, 10)) == \ ([((QQ(-7, 8), QQ(-6, 7)), 1), ((0, 0), 1)], [(((QQ(35, 64), -QQ(35, 32)), (QQ(5, 8), -QQ(65, 64))), 1), (((QQ(35, 64), QQ(65, 64)), (QQ(5, 8), QQ(35, 32))), 1)]) f = x**5 + x**4 - 2*x**3 - 2*x**2 + x + 1 raises(NotImplementedError, lambda: R.dup_isolate_all_roots(f))
4a2b1533631b14ef55f8c869632963f399eaa5f4fff642a1fe9f4ba880147433
"""Tests for functions for generating interesting polynomials. """ from sympy import Poly, ZZ, symbols, sqrt, prime, Add from sympy.utilities.iterables import permute_signs from sympy.testing.pytest import raises from sympy.polys.specialpolys import ( swinnerton_dyer_poly, cyclotomic_poly, symmetric_poly, random_poly, interpolating_poly, fateman_poly_F_1, dmp_fateman_poly_F_1, fateman_poly_F_2, dmp_fateman_poly_F_2, fateman_poly_F_3, dmp_fateman_poly_F_3, ) from sympy.abc import x, y, z def test_swinnerton_dyer_poly(): raises(ValueError, lambda: swinnerton_dyer_poly(0, x)) assert swinnerton_dyer_poly(1, x, polys=True) == Poly(x**2 - 2) assert swinnerton_dyer_poly(1, x) == x**2 - 2 assert swinnerton_dyer_poly(2, x) == x**4 - 10*x**2 + 1 assert swinnerton_dyer_poly( 3, x) == x**8 - 40*x**6 + 352*x**4 - 960*x**2 + 576 # we only need to check that the polys arg works but # we may as well test that the roots are correct p = [sqrt(prime(i)) for i in range(1, 5)] assert str([i.n(3) for i in swinnerton_dyer_poly(4, polys=True).all_roots()] ) == str(sorted([Add(*i).n(3) for i in permute_signs(p)])) def test_cyclotomic_poly(): raises(ValueError, lambda: cyclotomic_poly(0, x)) assert cyclotomic_poly(1, x, polys=True) == Poly(x - 1) assert cyclotomic_poly(1, x) == x - 1 assert cyclotomic_poly(2, x) == x + 1 assert cyclotomic_poly(3, x) == x**2 + x + 1 assert cyclotomic_poly(4, x) == x**2 + 1 assert cyclotomic_poly(5, x) == x**4 + x**3 + x**2 + x + 1 assert cyclotomic_poly(6, x) == x**2 - x + 1 def test_symmetric_poly(): raises(ValueError, lambda: symmetric_poly(-1, x, y, z)) raises(ValueError, lambda: symmetric_poly(5, x, y, z)) assert symmetric_poly(1, x, y, z, polys=True) == Poly(x + y + z) assert symmetric_poly(1, (x, y, z), polys=True) == Poly(x + y + z) assert symmetric_poly(0, x, y, z) == 1 assert symmetric_poly(1, x, y, z) == x + y + z assert symmetric_poly(2, x, y, z) == x*y + x*z + y*z assert symmetric_poly(3, x, y, z) == x*y*z def test_random_poly(): poly = random_poly(x, 10, -100, 100, polys=False) assert Poly(poly).degree() == 10 assert all(-100 <= coeff <= 100 for coeff in Poly(poly).coeffs()) is True poly = random_poly(x, 10, -100, 100, polys=True) assert poly.degree() == 10 assert all(-100 <= coeff <= 100 for coeff in poly.coeffs()) is True def test_interpolating_poly(): x0, x1, x2, x3, y0, y1, y2, y3 = symbols('x:4, y:4') assert interpolating_poly(0, x) == 0 assert interpolating_poly(1, x) == y0 assert interpolating_poly(2, x) == \ y0*(x - x1)/(x0 - x1) + y1*(x - x0)/(x1 - x0) assert interpolating_poly(3, x) == \ y0*(x - x1)*(x - x2)/((x0 - x1)*(x0 - x2)) + \ y1*(x - x0)*(x - x2)/((x1 - x0)*(x1 - x2)) + \ y2*(x - x0)*(x - x1)/((x2 - x0)*(x2 - x1)) assert interpolating_poly(4, x) == \ y0*(x - x1)*(x - x2)*(x - x3)/((x0 - x1)*(x0 - x2)*(x0 - x3)) + \ y1*(x - x0)*(x - x2)*(x - x3)/((x1 - x0)*(x1 - x2)*(x1 - x3)) + \ y2*(x - x0)*(x - x1)*(x - x3)/((x2 - x0)*(x2 - x1)*(x2 - x3)) + \ y3*(x - x0)*(x - x1)*(x - x2)/((x3 - x0)*(x3 - x1)*(x3 - x2)) raises(ValueError, lambda: interpolating_poly(2, x, (x, 2), (1, 3))) raises(ValueError, lambda: interpolating_poly(2, x, (x + y, 2), (1, 3))) raises(ValueError, lambda: interpolating_poly(2, x + y, (x, 2), (1, 3))) raises(ValueError, lambda: interpolating_poly(2, 3, (4, 5), (6, 7))) raises(ValueError, lambda: interpolating_poly(2, 3, (4, 5), (6, 7, 8))) assert interpolating_poly(0, x, (1, 2), (3, 4)) == 0 assert interpolating_poly(1, x, (1, 2), (3, 4)) == 3 assert interpolating_poly(2, x, (1, 2), (3, 4)) == x + 2 def test_fateman_poly_F_1(): f, g, h = fateman_poly_F_1(1) F, G, H = dmp_fateman_poly_F_1(1, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H] f, g, h = fateman_poly_F_1(3) F, G, H = dmp_fateman_poly_F_1(3, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H] def test_fateman_poly_F_2(): f, g, h = fateman_poly_F_2(1) F, G, H = dmp_fateman_poly_F_2(1, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H] f, g, h = fateman_poly_F_2(3) F, G, H = dmp_fateman_poly_F_2(3, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H] def test_fateman_poly_F_3(): f, g, h = fateman_poly_F_3(1) F, G, H = dmp_fateman_poly_F_3(1, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H] f, g, h = fateman_poly_F_3(3) F, G, H = dmp_fateman_poly_F_3(3, ZZ) assert [ t.rep.rep for t in [f, g, h] ] == [F, G, H]
6561c170208e54dc03c6e25683558fa3492b4c7c759b5c133e2d9c3983ec013e
"""Tests for Groebner bases. """ from sympy.polys.groebnertools import ( groebner, sig, sig_key, lbp, lbp_key, critical_pair, cp_key, is_rewritable_or_comparable, Sign, Polyn, Num, s_poly, f5_reduce, groebner_lcm, groebner_gcd, is_groebner, is_reduced ) from sympy.polys.fglmtools import _representing_matrices from sympy.polys.orderings import lex, grlex from sympy.polys.rings import ring, xring from sympy.polys.domains import ZZ, QQ from sympy.testing.pytest import slow from sympy.polys import polyconfig as config def _do_test_groebner(): R, x,y = ring("x,y", QQ, lex) f = x**2 + 2*x*y**2 g = x*y + 2*y**3 - 1 assert groebner([f, g], R) == [x, y**3 - QQ(1,2)] R, y,x = ring("y,x", QQ, lex) f = 2*x**2*y + y**2 g = 2*x**3 + x*y - 1 assert groebner([f, g], R) == [y, x**3 - QQ(1,2)] R, x,y,z = ring("x,y,z", QQ, lex) f = x - z**2 g = y - z**3 assert groebner([f, g], R) == [f, g] R, x,y = ring("x,y", QQ, grlex) f = x**3 - 2*x*y g = x**2*y + x - 2*y**2 assert groebner([f, g], R) == [x**2, x*y, -QQ(1,2)*x + y**2] R, x,y,z = ring("x,y,z", QQ, lex) f = -x**2 + y g = -x**3 + z assert groebner([f, g], R) == [x**2 - y, x*y - z, x*z - y**2, y**3 - z**2] R, x,y,z = ring("x,y,z", QQ, grlex) f = -x**2 + y g = -x**3 + z assert groebner([f, g], R) == [y**3 - z**2, x**2 - y, x*y - z, x*z - y**2] R, x,y,z = ring("x,y,z", QQ, lex) f = -x**2 + z g = -x**3 + y assert groebner([f, g], R) == [x**2 - z, x*y - z**2, x*z - y, y**2 - z**3] R, x,y,z = ring("x,y,z", QQ, grlex) f = -x**2 + z g = -x**3 + y assert groebner([f, g], R) == [-y**2 + z**3, x**2 - z, x*y - z**2, x*z - y] R, x,y,z = ring("x,y,z", QQ, lex) f = x - y**2 g = -y**3 + z assert groebner([f, g], R) == [x - y**2, y**3 - z] R, x,y,z = ring("x,y,z", QQ, grlex) f = x - y**2 g = -y**3 + z assert groebner([f, g], R) == [x**2 - y*z, x*y - z, -x + y**2] R, x,y,z = ring("x,y,z", QQ, lex) f = x - z**2 g = y - z**3 assert groebner([f, g], R) == [x - z**2, y - z**3] R, x,y,z = ring("x,y,z", QQ, grlex) f = x - z**2 g = y - z**3 assert groebner([f, g], R) == [x**2 - y*z, x*z - y, -x + z**2] R, x,y,z = ring("x,y,z", QQ, lex) f = -y**2 + z g = x - y**3 assert groebner([f, g], R) == [x - y*z, y**2 - z] R, x,y,z = ring("x,y,z", QQ, grlex) f = -y**2 + z g = x - y**3 assert groebner([f, g], R) == [-x**2 + z**3, x*y - z**2, y**2 - z, -x + y*z] R, x,y,z = ring("x,y,z", QQ, lex) f = y - z**2 g = x - z**3 assert groebner([f, g], R) == [x - z**3, y - z**2] R, x,y,z = ring("x,y,z", QQ, grlex) f = y - z**2 g = x - z**3 assert groebner([f, g], R) == [-x**2 + y**3, x*z - y**2, -x + y*z, -y + z**2] R, x,y,z = ring("x,y,z", QQ, lex) f = 4*x**2*y**2 + 4*x*y + 1 g = x**2 + y**2 - 1 assert groebner([f, g], R) == [ x - 4*y**7 + 8*y**5 - 7*y**3 + 3*y, y**8 - 2*y**6 + QQ(3,2)*y**4 - QQ(1,2)*y**2 + QQ(1,16), ] def test_groebner_buchberger(): with config.using(groebner='buchberger'): _do_test_groebner() def test_groebner_f5b(): with config.using(groebner='f5b'): _do_test_groebner() def _do_test_benchmark_minpoly(): R, x,y,z = ring("x,y,z", QQ, lex) F = [x**3 + x + 1, y**2 + y + 1, (x + y) * z - (x**2 + y)] G = [x + QQ(155,2067)*z**5 - QQ(355,689)*z**4 + QQ(6062,2067)*z**3 - QQ(3687,689)*z**2 + QQ(6878,2067)*z - QQ(25,53), y + QQ(4,53)*z**5 - QQ(91,159)*z**4 + QQ(523,159)*z**3 - QQ(387,53)*z**2 + QQ(1043,159)*z - QQ(308,159), z**6 - 7*z**5 + 41*z**4 - 82*z**3 + 89*z**2 - 46*z + 13] assert groebner(F, R) == G def test_benchmark_minpoly_buchberger(): with config.using(groebner='buchberger'): _do_test_benchmark_minpoly() def test_benchmark_minpoly_f5b(): with config.using(groebner='f5b'): _do_test_benchmark_minpoly() def test_benchmark_coloring(): V = range(1, 12 + 1) E = [(1, 2), (2, 3), (1, 4), (1, 6), (1, 12), (2, 5), (2, 7), (3, 8), (3, 10), (4, 11), (4, 9), (5, 6), (6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (5, 12), (5, 9), (6, 10), (7, 11), (8, 12), (3, 4)] R, V = xring([ "x%d" % v for v in V ], QQ, lex) E = [(V[i - 1], V[j - 1]) for i, j in E] x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12 = V I3 = [x**3 - 1 for x in V] Ig = [x**2 + x*y + y**2 for x, y in E] I = I3 + Ig assert groebner(I[:-1], R) == [ x1 + x11 + x12, x2 - x11, x3 - x12, x4 - x12, x5 + x11 + x12, x6 - x11, x7 - x12, x8 + x11 + x12, x9 - x11, x10 + x11 + x12, x11**2 + x11*x12 + x12**2, x12**3 - 1, ] assert groebner(I, R) == [1] def _do_test_benchmark_katsura_3(): R, x0,x1,x2 = ring("x:3", ZZ, lex) I = [x0 + 2*x1 + 2*x2 - 1, x0**2 + 2*x1**2 + 2*x2**2 - x0, 2*x0*x1 + 2*x1*x2 - x1] assert groebner(I, R) == [ -7 + 7*x0 + 8*x2 + 158*x2**2 - 420*x2**3, 7*x1 + 3*x2 - 79*x2**2 + 210*x2**3, x2 + x2**2 - 40*x2**3 + 84*x2**4, ] R, x0,x1,x2 = ring("x:3", ZZ, grlex) I = [ i.set_ring(R) for i in I ] assert groebner(I, R) == [ 7*x1 + 3*x2 - 79*x2**2 + 210*x2**3, -x1 + x2 - 3*x2**2 + 5*x1**2, -x1 - 4*x2 + 10*x1*x2 + 12*x2**2, -1 + x0 + 2*x1 + 2*x2, ] def test_benchmark_katsura3_buchberger(): with config.using(groebner='buchberger'): _do_test_benchmark_katsura_3() def test_benchmark_katsura3_f5b(): with config.using(groebner='f5b'): _do_test_benchmark_katsura_3() def _do_test_benchmark_katsura_4(): R, x0,x1,x2,x3 = ring("x:4", ZZ, lex) I = [x0 + 2*x1 + 2*x2 + 2*x3 - 1, x0**2 + 2*x1**2 + 2*x2**2 + 2*x3**2 - x0, 2*x0*x1 + 2*x1*x2 + 2*x2*x3 - x1, x1**2 + 2*x0*x2 + 2*x1*x3 - x2] assert groebner(I, R) == [ 5913075*x0 - 159690237696*x3**7 + 31246269696*x3**6 + 27439610544*x3**5 - 6475723368*x3**4 - 838935856*x3**3 + 275119624*x3**2 + 4884038*x3 - 5913075, 1971025*x1 - 97197721632*x3**7 + 73975630752*x3**6 - 12121915032*x3**5 - 2760941496*x3**4 + 814792828*x3**3 - 1678512*x3**2 - 9158924*x3, 5913075*x2 + 371438283744*x3**7 - 237550027104*x3**6 + 22645939824*x3**5 + 11520686172*x3**4 - 2024910556*x3**3 - 132524276*x3**2 + 30947828*x3, 128304*x3**8 - 93312*x3**7 + 15552*x3**6 + 3144*x3**5 - 1120*x3**4 + 36*x3**3 + 15*x3**2 - x3, ] R, x0,x1,x2,x3 = ring("x:4", ZZ, grlex) I = [ i.set_ring(R) for i in I ] assert groebner(I, R) == [ 393*x1 - 4662*x2**2 + 4462*x2*x3 - 59*x2 + 224532*x3**4 - 91224*x3**3 - 678*x3**2 + 2046*x3, -x1 + 196*x2**3 - 21*x2**2 + 60*x2*x3 - 18*x2 - 168*x3**3 + 83*x3**2 - 9*x3, -6*x1 + 1134*x2**2*x3 - 189*x2**2 - 466*x2*x3 + 32*x2 - 630*x3**3 + 57*x3**2 + 51*x3, 33*x1 + 63*x2**2 + 2268*x2*x3**2 - 188*x2*x3 + 34*x2 + 2520*x3**3 - 849*x3**2 + 3*x3, 7*x1**2 - x1 - 7*x2**2 - 24*x2*x3 + 3*x2 - 15*x3**2 + 5*x3, 14*x1*x2 - x1 + 14*x2**2 + 18*x2*x3 - 4*x2 + 6*x3**2 - 2*x3, 14*x1*x3 - x1 + 7*x2**2 + 32*x2*x3 - 4*x2 + 27*x3**2 - 9*x3, x0 + 2*x1 + 2*x2 + 2*x3 - 1, ] def test_benchmark_kastura_4_buchberger(): with config.using(groebner='buchberger'): _do_test_benchmark_katsura_4() def test_benchmark_kastura_4_f5b(): with config.using(groebner='f5b'): _do_test_benchmark_katsura_4() def _do_test_benchmark_czichowski(): R, x,t = ring("x,t", ZZ, lex) I = [9*x**8 + 36*x**7 - 32*x**6 - 252*x**5 - 78*x**4 + 468*x**3 + 288*x**2 - 108*x + 9, (-72 - 72*t)*x**7 + (-256 - 252*t)*x**6 + (192 + 192*t)*x**5 + (1280 + 1260*t)*x**4 + (312 + 312*t)*x**3 + (-404*t)*x**2 + (-576 - 576*t)*x + 96 + 108*t] assert groebner(I, R) == [ 3725588592068034903797967297424801242396746870413359539263038139343329273586196480000*x - 160420835591776763325581422211936558925462474417709511019228211783493866564923546661604487873*t**7 - 1406108495478033395547109582678806497509499966197028487131115097902188374051595011248311352864*t**6 - 5241326875850889518164640374668786338033653548841427557880599579174438246266263602956254030352*t**5 - 10758917262823299139373269714910672770004760114329943852726887632013485035262879510837043892416*t**4 - 13119383576444715672578819534846747735372132018341964647712009275306635391456880068261130581248*t**3 - 9491412317016197146080450036267011389660653495578680036574753839055748080962214787557853941760*t**2 - 3767520915562795326943800040277726397326609797172964377014046018280260848046603967211258368000*t - 632314652371226552085897259159210286886724229880266931574701654721512325555116066073245696000, 610733380717522355121*t**8 + 6243748742141230639968*t**7 + 27761407182086143225024*t**6 + 70066148869420956398592*t**5 + 109701225644313784229376*t**4 + 109009005495588442152960*t**3 + 67072101084384786432000*t**2 + 23339979742629593088000*t + 3513592776846090240000, ] R, x,t = ring("x,t", ZZ, grlex) I = [ i.set_ring(R) for i in I ] assert groebner(I, R) == [ 16996618586000601590732959134095643086442*t**3*x - 32936701459297092865176560282688198064839*t**3 + 78592411049800639484139414821529525782364*t**2*x - 120753953358671750165454009478961405619916*t**2 + 120988399875140799712152158915653654637280*t*x - 144576390266626470824138354942076045758736*t + 60017634054270480831259316163620768960*x**2 + 61976058033571109604821862786675242894400*x - 56266268491293858791834120380427754600960, 576689018321912327136790519059646508441672750656050290242749*t**4 + 2326673103677477425562248201573604572527893938459296513327336*t**3 + 110743790416688497407826310048520299245819959064297990236000*t**2*x + 3308669114229100853338245486174247752683277925010505284338016*t**2 + 323150205645687941261103426627818874426097912639158572428800*t*x + 1914335199925152083917206349978534224695445819017286960055680*t + 861662882561803377986838989464278045397192862768588480000*x**2 + 235296483281783440197069672204341465480107019878814196672000*x + 361850798943225141738895123621685122544503614946436727532800, -117584925286448670474763406733005510014188341867*t**3 + 68566565876066068463853874568722190223721653044*t**2*x - 435970731348366266878180788833437896139920683940*t**2 + 196297602447033751918195568051376792491869233408*t*x - 525011527660010557871349062870980202067479780112*t + 517905853447200553360289634770487684447317120*x**3 + 569119014870778921949288951688799397569321920*x**2 + 138877356748142786670127389526667463202210102080*x - 205109210539096046121625447192779783475018619520, -3725142681462373002731339445216700112264527*t**3 + 583711207282060457652784180668273817487940*t**2*x - 12381382393074485225164741437227437062814908*t**2 + 151081054097783125250959636747516827435040*t*x**2 + 1814103857455163948531448580501928933873280*t*x - 13353115629395094645843682074271212731433648*t + 236415091385250007660606958022544983766080*x**2 + 1390443278862804663728298060085399578417600*x - 4716885828494075789338754454248931750698880, ] # NOTE: This is very slow (> 2 minutes on 3.4 GHz) without GMPY @slow def test_benchmark_czichowski_buchberger(): with config.using(groebner='buchberger'): _do_test_benchmark_czichowski() def test_benchmark_czichowski_f5b(): with config.using(groebner='f5b'): _do_test_benchmark_czichowski() def _do_test_benchmark_cyclic_4(): R, a,b,c,d = ring("a,b,c,d", ZZ, lex) I = [a + b + c + d, a*b + a*d + b*c + b*d, a*b*c + a*b*d + a*c*d + b*c*d, a*b*c*d - 1] assert groebner(I, R) == [ 4*a + 3*d**9 - 4*d**5 - 3*d, 4*b + 4*c - 3*d**9 + 4*d**5 + 7*d, 4*c**2 + 3*d**10 - 4*d**6 - 3*d**2, 4*c*d**4 + 4*c - d**9 + 4*d**5 + 5*d, d**12 - d**8 - d**4 + 1 ] R, a,b,c,d = ring("a,b,c,d", ZZ, grlex) I = [ i.set_ring(R) for i in I ] assert groebner(I, R) == [ 3*b*c - c**2 + d**6 - 3*d**2, -b + 3*c**2*d**3 - c - d**5 - 4*d, -b + 3*c*d**4 + 2*c + 2*d**5 + 2*d, c**4 + 2*c**2*d**2 - d**4 - 2, c**3*d + c*d**3 + d**4 + 1, b*c**2 - c**3 - c**2*d - 2*c*d**2 - d**3, b**2 - c**2, b*d + c**2 + c*d + d**2, a + b + c + d ] def test_benchmark_cyclic_4_buchberger(): with config.using(groebner='buchberger'): _do_test_benchmark_cyclic_4() def test_benchmark_cyclic_4_f5b(): with config.using(groebner='f5b'): _do_test_benchmark_cyclic_4() def test_sig_key(): s1 = sig((0,) * 3, 2) s2 = sig((1,) * 3, 4) s3 = sig((2,) * 3, 2) assert sig_key(s1, lex) > sig_key(s2, lex) assert sig_key(s2, lex) < sig_key(s3, lex) def test_lbp_key(): R, x,y,z,t = ring("x,y,z,t", ZZ, lex) p1 = lbp(sig((0,) * 4, 3), R.zero, 12) p2 = lbp(sig((0,) * 4, 4), R.zero, 13) p3 = lbp(sig((0,) * 4, 4), R.zero, 12) assert lbp_key(p1) > lbp_key(p2) assert lbp_key(p2) < lbp_key(p3) def test_critical_pair(): # from cyclic4 with grlex R, x,y,z,t = ring("x,y,z,t", QQ, grlex) p1 = (((0, 0, 0, 0), 4), y*z*t**2 + z**2*t**2 - t**4 - 1, 4) q1 = (((0, 0, 0, 0), 2), -y**2 - y*t - z*t - t**2, 2) p2 = (((0, 0, 0, 2), 3), z**3*t**2 + z**2*t**3 - z - t, 5) q2 = (((0, 0, 2, 2), 2), y*z + z*t**5 + z*t + t**6, 13) assert critical_pair(p1, q1, R) == ( ((0, 0, 1, 2), 2), ((0, 0, 1, 2), QQ(-1, 1)), (((0, 0, 0, 0), 2), -y**2 - y*t - z*t - t**2, 2), ((0, 1, 0, 0), 4), ((0, 1, 0, 0), QQ(1, 1)), (((0, 0, 0, 0), 4), y*z*t**2 + z**2*t**2 - t**4 - 1, 4) ) assert critical_pair(p2, q2, R) == ( ((0, 0, 4, 2), 2), ((0, 0, 2, 0), QQ(1, 1)), (((0, 0, 2, 2), 2), y*z + z*t**5 + z*t + t**6, 13), ((0, 0, 0, 5), 3), ((0, 0, 0, 3), QQ(1, 1)), (((0, 0, 0, 2), 3), z**3*t**2 + z**2*t**3 - z - t, 5) ) def test_cp_key(): # from cyclic4 with grlex R, x,y,z,t = ring("x,y,z,t", QQ, grlex) p1 = (((0, 0, 0, 0), 4), y*z*t**2 + z**2*t**2 - t**4 - 1, 4) q1 = (((0, 0, 0, 0), 2), -y**2 - y*t - z*t - t**2, 2) p2 = (((0, 0, 0, 2), 3), z**3*t**2 + z**2*t**3 - z - t, 5) q2 = (((0, 0, 2, 2), 2), y*z + z*t**5 + z*t + t**6, 13) cp1 = critical_pair(p1, q1, R) cp2 = critical_pair(p2, q2, R) assert cp_key(cp1, R) < cp_key(cp2, R) cp1 = critical_pair(p1, p2, R) cp2 = critical_pair(q1, q2, R) assert cp_key(cp1, R) < cp_key(cp2, R) def test_is_rewritable_or_comparable(): # from katsura4 with grlex R, x,y,z,t = ring("x,y,z,t", QQ, grlex) p = lbp(sig((0, 0, 2, 1), 2), R.zero, 2) B = [lbp(sig((0, 0, 0, 1), 2), QQ(2,45)*y**2 + QQ(1,5)*y*z + QQ(5,63)*y*t + z**2*t + QQ(4,45)*z**2 + QQ(76,35)*z*t**2 - QQ(32,105)*z*t + QQ(13,7)*t**3 - QQ(13,21)*t**2, 6)] # rewritable: assert is_rewritable_or_comparable(Sign(p), Num(p), B) is True p = lbp(sig((0, 1, 1, 0), 2), R.zero, 7) B = [lbp(sig((0, 0, 0, 0), 3), QQ(10,3)*y*z + QQ(4,3)*y*t - QQ(1,3)*y + 4*z**2 + QQ(22,3)*z*t - QQ(4,3)*z + 4*t**2 - QQ(4,3)*t, 3)] # comparable: assert is_rewritable_or_comparable(Sign(p), Num(p), B) is True def test_f5_reduce(): # katsura3 with lex R, x,y,z = ring("x,y,z", QQ, lex) F = [(((0, 0, 0), 1), x + 2*y + 2*z - 1, 1), (((0, 0, 0), 2), 6*y**2 + 8*y*z - 2*y + 6*z**2 - 2*z, 2), (((0, 0, 0), 3), QQ(10,3)*y*z - QQ(1,3)*y + 4*z**2 - QQ(4,3)*z, 3), (((0, 0, 1), 2), y + 30*z**3 - QQ(79,7)*z**2 + QQ(3,7)*z, 4), (((0, 0, 2), 2), z**4 - QQ(10,21)*z**3 + QQ(1,84)*z**2 + QQ(1,84)*z, 5)] cp = critical_pair(F[0], F[1], R) s = s_poly(cp) assert f5_reduce(s, F) == (((0, 2, 0), 1), R.zero, 1) s = lbp(sig(Sign(s)[0], 100), Polyn(s), Num(s)) assert f5_reduce(s, F) == s def test_representing_matrices(): R, x,y = ring("x,y", QQ, grlex) basis = [(0, 0), (0, 1), (1, 0), (1, 1)] F = [x**2 - x - 3*y + 1, -2*x + y**2 + y - 1] assert _representing_matrices(basis, F, R) == [ [[QQ(0, 1), QQ(0, 1),-QQ(1, 1), QQ(3, 1)], [QQ(0, 1), QQ(0, 1), QQ(3, 1),-QQ(4, 1)], [QQ(1, 1), QQ(0, 1), QQ(1, 1), QQ(6, 1)], [QQ(0, 1), QQ(1, 1), QQ(0, 1), QQ(1, 1)]], [[QQ(0, 1), QQ(1, 1), QQ(0, 1),-QQ(2, 1)], [QQ(1, 1),-QQ(1, 1), QQ(0, 1), QQ(6, 1)], [QQ(0, 1), QQ(2, 1), QQ(0, 1), QQ(3, 1)], [QQ(0, 1), QQ(0, 1), QQ(1, 1),-QQ(1, 1)]]] def test_groebner_lcm(): R, x,y,z = ring("x,y,z", ZZ) assert groebner_lcm(x**2 - y**2, x - y) == x**2 - y**2 assert groebner_lcm(2*x**2 - 2*y**2, 2*x - 2*y) == 2*x**2 - 2*y**2 R, x,y,z = ring("x,y,z", QQ) assert groebner_lcm(x**2 - y**2, x - y) == x**2 - y**2 assert groebner_lcm(2*x**2 - 2*y**2, 2*x - 2*y) == 2*x**2 - 2*y**2 R, x,y = ring("x,y", ZZ) assert groebner_lcm(x**2*y, x*y**2) == x**2*y**2 f = 2*x*y**5 - 3*x*y**4 - 2*x*y**3 + 3*x*y**2 g = y**5 - 2*y**3 + y h = 2*x*y**7 - 3*x*y**6 - 4*x*y**5 + 6*x*y**4 + 2*x*y**3 - 3*x*y**2 assert groebner_lcm(f, g) == h f = x**3 - 3*x**2*y - 9*x*y**2 - 5*y**3 g = x**4 + 6*x**3*y + 12*x**2*y**2 + 10*x*y**3 + 3*y**4 h = x**5 + x**4*y - 18*x**3*y**2 - 50*x**2*y**3 - 47*x*y**4 - 15*y**5 assert groebner_lcm(f, g) == h def test_groebner_gcd(): R, x,y,z = ring("x,y,z", ZZ) assert groebner_gcd(x**2 - y**2, x - y) == x - y assert groebner_gcd(2*x**2 - 2*y**2, 2*x - 2*y) == 2*x - 2*y R, x,y,z = ring("x,y,z", QQ) assert groebner_gcd(x**2 - y**2, x - y) == x - y assert groebner_gcd(2*x**2 - 2*y**2, 2*x - 2*y) == x - y def test_is_groebner(): R, x,y = ring("x,y", QQ, grlex) valid_groebner = [x**2, x*y, -QQ(1,2)*x + y**2] invalid_groebner = [x**3, x*y, -QQ(1,2)*x + y**2] assert is_groebner(valid_groebner, R) is True assert is_groebner(invalid_groebner, R) is False def test_is_reduced(): R, x, y = ring("x,y", QQ, lex) f = x**2 + 2*x*y**2 g = x*y + 2*y**3 - 1 assert is_reduced([f, g], R) == False G = groebner([f, g], R) assert is_reduced(G, R) == True
2834fc787005bdee4a5e64e3e4d74f40f08d6dd44ff2414855646db7225e6422
"""Tests for efficient functions for generating orthogonal polynomials. """ from sympy import Poly, S, Rational as Q from sympy.testing.pytest import raises from sympy.polys.orthopolys import ( jacobi_poly, gegenbauer_poly, chebyshevt_poly, chebyshevu_poly, hermite_poly, legendre_poly, laguerre_poly, ) from sympy.abc import x, a, b def test_jacobi_poly(): raises(ValueError, lambda: jacobi_poly(-1, a, b, x)) assert jacobi_poly(1, a, b, x, polys=True) == Poly( (a/2 + b/2 + 1)*x + a/2 - b/2, x, domain='ZZ(a,b)') assert jacobi_poly(0, a, b, x) == 1 assert jacobi_poly(1, a, b, x) == a/2 - b/2 + x*(a/2 + b/2 + 1) assert jacobi_poly(2, a, b, x) == (a**2/8 - a*b/4 - a/8 + b**2/8 - b/8 + x**2*(a**2/8 + a*b/4 + a*Q(7, 8) + b**2/8 + b*Q(7, 8) + Q(3, 2)) + x*(a**2/4 + a*Q(3, 4) - b**2/4 - b*Q(3, 4)) - S.Half) assert jacobi_poly(1, a, b, polys=True) == Poly( (a/2 + b/2 + 1)*x + a/2 - b/2, x, domain='ZZ(a,b)') def test_gegenbauer_poly(): raises(ValueError, lambda: gegenbauer_poly(-1, a, x)) assert gegenbauer_poly( 1, a, x, polys=True) == Poly(2*a*x, x, domain='ZZ(a)') assert gegenbauer_poly(0, a, x) == 1 assert gegenbauer_poly(1, a, x) == 2*a*x assert gegenbauer_poly(2, a, x) == -a + x**2*(2*a**2 + 2*a) assert gegenbauer_poly( 3, a, x) == x**3*(4*a**3/3 + 4*a**2 + a*Q(8, 3)) + x*(-2*a**2 - 2*a) assert gegenbauer_poly(1, S.Half).dummy_eq(x) assert gegenbauer_poly(1, a, polys=True) == Poly(2*a*x, x, domain='ZZ(a)') def test_chebyshevt_poly(): raises(ValueError, lambda: chebyshevt_poly(-1, x)) assert chebyshevt_poly(1, x, polys=True) == Poly(x) assert chebyshevt_poly(0, x) == 1 assert chebyshevt_poly(1, x) == x assert chebyshevt_poly(2, x) == 2*x**2 - 1 assert chebyshevt_poly(3, x) == 4*x**3 - 3*x assert chebyshevt_poly(4, x) == 8*x**4 - 8*x**2 + 1 assert chebyshevt_poly(5, x) == 16*x**5 - 20*x**3 + 5*x assert chebyshevt_poly(6, x) == 32*x**6 - 48*x**4 + 18*x**2 - 1 assert chebyshevt_poly(1).dummy_eq(x) assert chebyshevt_poly(1, polys=True) == Poly(x) def test_chebyshevu_poly(): raises(ValueError, lambda: chebyshevu_poly(-1, x)) assert chebyshevu_poly(1, x, polys=True) == Poly(2*x) assert chebyshevu_poly(0, x) == 1 assert chebyshevu_poly(1, x) == 2*x assert chebyshevu_poly(2, x) == 4*x**2 - 1 assert chebyshevu_poly(3, x) == 8*x**3 - 4*x assert chebyshevu_poly(4, x) == 16*x**4 - 12*x**2 + 1 assert chebyshevu_poly(5, x) == 32*x**5 - 32*x**3 + 6*x assert chebyshevu_poly(6, x) == 64*x**6 - 80*x**4 + 24*x**2 - 1 assert chebyshevu_poly(1).dummy_eq(2*x) assert chebyshevu_poly(1, polys=True) == Poly(2*x) def test_hermite_poly(): raises(ValueError, lambda: hermite_poly(-1, x)) assert hermite_poly(1, x, polys=True) == Poly(2*x) assert hermite_poly(0, x) == 1 assert hermite_poly(1, x) == 2*x assert hermite_poly(2, x) == 4*x**2 - 2 assert hermite_poly(3, x) == 8*x**3 - 12*x assert hermite_poly(4, x) == 16*x**4 - 48*x**2 + 12 assert hermite_poly(5, x) == 32*x**5 - 160*x**3 + 120*x assert hermite_poly(6, x) == 64*x**6 - 480*x**4 + 720*x**2 - 120 assert hermite_poly(1).dummy_eq(2*x) assert hermite_poly(1, polys=True) == Poly(2*x) def test_legendre_poly(): raises(ValueError, lambda: legendre_poly(-1, x)) assert legendre_poly(1, x, polys=True) == Poly(x, domain='QQ') assert legendre_poly(0, x) == 1 assert legendre_poly(1, x) == x assert legendre_poly(2, x) == Q(3, 2)*x**2 - Q(1, 2) assert legendre_poly(3, x) == Q(5, 2)*x**3 - Q(3, 2)*x assert legendre_poly(4, x) == Q(35, 8)*x**4 - Q(30, 8)*x**2 + Q(3, 8) assert legendre_poly(5, x) == Q(63, 8)*x**5 - Q(70, 8)*x**3 + Q(15, 8)*x assert legendre_poly(6, x) == Q( 231, 16)*x**6 - Q(315, 16)*x**4 + Q(105, 16)*x**2 - Q(5, 16) assert legendre_poly(1).dummy_eq(x) assert legendre_poly(1, polys=True) == Poly(x) def test_laguerre_poly(): raises(ValueError, lambda: laguerre_poly(-1, x)) assert laguerre_poly(1, x, polys=True) == Poly(-x + 1, domain='QQ') assert laguerre_poly(0, x) == 1 assert laguerre_poly(1, x) == -x + 1 assert laguerre_poly(2, x) == Q(1, 2)*x**2 - Q(4, 2)*x + 1 assert laguerre_poly(3, x) == -Q(1, 6)*x**3 + Q(9, 6)*x**2 - Q(18, 6)*x + 1 assert laguerre_poly(4, x) == Q( 1, 24)*x**4 - Q(16, 24)*x**3 + Q(72, 24)*x**2 - Q(96, 24)*x + 1 assert laguerre_poly(5, x) == -Q(1, 120)*x**5 + Q(25, 120)*x**4 - Q( 200, 120)*x**3 + Q(600, 120)*x**2 - Q(600, 120)*x + 1 assert laguerre_poly(6, x) == Q(1, 720)*x**6 - Q(36, 720)*x**5 + Q(450, 720)*x**4 - Q(2400, 720)*x**3 + Q(5400, 720)*x**2 - Q(4320, 720)*x + 1 assert laguerre_poly(0, x, a) == 1 assert laguerre_poly(1, x, a) == -x + a + 1 assert laguerre_poly(2, x, a) == x**2/2 + (-a - 2)*x + a**2/2 + a*Q(3, 2) + 1 assert laguerre_poly(3, x, a) == -x**3/6 + (a/2 + Q( 3)/2)*x**2 + (-a**2/2 - a*Q(5, 2) - 3)*x + a**3/6 + a**2 + a*Q(11, 6) + 1 assert laguerre_poly(1).dummy_eq(-x + 1) assert laguerre_poly(1, polys=True) == Poly(-x + 1)
32c4eddf9c21aae125b1b2ff8e28051247be16c05b7629641e23c3b9630332bf
"""Tests for OO layer of several polynomial representations. """ from sympy.polys.domains import ZZ, QQ from sympy.polys.polyclasses import DMP, DMF, ANP from sympy.polys.polyerrors import ExactQuotientFailed, NotInvertible from sympy.polys.specialpolys import f_polys from sympy.testing.pytest import raises f_0, f_1, f_2, f_3, f_4, f_5, f_6 = [ f.to_dense() for f in f_polys() ] def test_DMP___init__(): f = DMP([[0], [], [0, 1, 2], [3]], ZZ) assert f.rep == [[1, 2], [3]] assert f.dom == ZZ assert f.lev == 1 f = DMP([[1, 2], [3]], ZZ, 1) assert f.rep == [[1, 2], [3]] assert f.dom == ZZ assert f.lev == 1 f = DMP({(1, 1): 1, (0, 0): 2}, ZZ, 1) assert f.rep == [[1, 0], [2]] assert f.dom == ZZ assert f.lev == 1 def test_DMP___eq__(): assert DMP([[ZZ(1), ZZ(2)], [ZZ(3)]], ZZ) == \ DMP([[ZZ(1), ZZ(2)], [ZZ(3)]], ZZ) assert DMP([[ZZ(1), ZZ(2)], [ZZ(3)]], ZZ) == \ DMP([[QQ(1), QQ(2)], [QQ(3)]], QQ) assert DMP([[QQ(1), QQ(2)], [QQ(3)]], QQ) == \ DMP([[ZZ(1), ZZ(2)], [ZZ(3)]], ZZ) assert DMP([[[ZZ(1)]]], ZZ) != DMP([[ZZ(1)]], ZZ) assert DMP([[ZZ(1)]], ZZ) != DMP([[[ZZ(1)]]], ZZ) def test_DMP___bool__(): assert bool(DMP([[]], ZZ)) is False assert bool(DMP([[1]], ZZ)) is True def test_DMP_to_dict(): f = DMP([[3], [], [2], [], [8]], ZZ) assert f.to_dict() == \ {(4, 0): 3, (2, 0): 2, (0, 0): 8} assert f.to_sympy_dict() == \ {(4, 0): ZZ.to_sympy(3), (2, 0): ZZ.to_sympy(2), (0, 0): ZZ.to_sympy(8)} def test_DMP_properties(): assert DMP([[]], ZZ).is_zero is True assert DMP([[1]], ZZ).is_zero is False assert DMP([[1]], ZZ).is_one is True assert DMP([[2]], ZZ).is_one is False assert DMP([[1]], ZZ).is_ground is True assert DMP([[1], [2], [1]], ZZ).is_ground is False assert DMP([[1], [2, 0], [1, 0]], ZZ).is_sqf is True assert DMP([[1], [2, 0], [1, 0, 0]], ZZ).is_sqf is False assert DMP([[1, 2], [3]], ZZ).is_monic is True assert DMP([[2, 2], [3]], ZZ).is_monic is False assert DMP([[1, 2], [3]], ZZ).is_primitive is True assert DMP([[2, 4], [6]], ZZ).is_primitive is False def test_DMP_arithmetics(): f = DMP([[2], [2, 0]], ZZ) assert f.mul_ground(2) == DMP([[4], [4, 0]], ZZ) assert f.quo_ground(2) == DMP([[1], [1, 0]], ZZ) raises(ExactQuotientFailed, lambda: f.exquo_ground(3)) f = DMP([[-5]], ZZ) g = DMP([[5]], ZZ) assert f.abs() == g assert abs(f) == g assert g.neg() == f assert -g == f h = DMP([[]], ZZ) assert f.add(g) == h assert f + g == h assert g + f == h assert f + 5 == h assert 5 + f == h h = DMP([[-10]], ZZ) assert f.sub(g) == h assert f - g == h assert g - f == -h assert f - 5 == h assert 5 - f == -h h = DMP([[-25]], ZZ) assert f.mul(g) == h assert f * g == h assert g * f == h assert f * 5 == h assert 5 * f == h h = DMP([[25]], ZZ) assert f.sqr() == h assert f.pow(2) == h assert f**2 == h raises(TypeError, lambda: f.pow('x')) f = DMP([[1], [], [1, 0, 0]], ZZ) g = DMP([[2], [-2, 0]], ZZ) q = DMP([[2], [2, 0]], ZZ) r = DMP([[8, 0, 0]], ZZ) assert f.pdiv(g) == (q, r) assert f.pquo(g) == q assert f.prem(g) == r raises(ExactQuotientFailed, lambda: f.pexquo(g)) f = DMP([[1], [], [1, 0, 0]], ZZ) g = DMP([[1], [-1, 0]], ZZ) q = DMP([[1], [1, 0]], ZZ) r = DMP([[2, 0, 0]], ZZ) assert f.div(g) == (q, r) assert f.quo(g) == q assert f.rem(g) == r assert divmod(f, g) == (q, r) assert f // g == q assert f % g == r raises(ExactQuotientFailed, lambda: f.exquo(g)) def test_DMP_functionality(): f = DMP([[1], [2, 0], [1, 0, 0]], ZZ) g = DMP([[1], [1, 0]], ZZ) h = DMP([[1]], ZZ) assert f.degree() == 2 assert f.degree_list() == (2, 2) assert f.total_degree() == 2 assert f.LC() == ZZ(1) assert f.TC() == ZZ(0) assert f.nth(1, 1) == ZZ(2) raises(TypeError, lambda: f.nth(0, 'x')) assert f.max_norm() == 2 assert f.l1_norm() == 4 u = DMP([[2], [2, 0]], ZZ) assert f.diff(m=1, j=0) == u assert f.diff(m=1, j=1) == u raises(TypeError, lambda: f.diff(m='x', j=0)) u = DMP([1, 2, 1], ZZ) v = DMP([1, 2, 1], ZZ) assert f.eval(a=1, j=0) == u assert f.eval(a=1, j=1) == v assert f.eval(1).eval(1) == ZZ(4) assert f.cofactors(g) == (g, g, h) assert f.gcd(g) == g assert f.lcm(g) == f u = DMP([[QQ(45), QQ(30), QQ(5)]], QQ) v = DMP([[QQ(1), QQ(2, 3), QQ(1, 9)]], QQ) assert u.monic() == v assert (4*f).content() == ZZ(4) assert (4*f).primitive() == (ZZ(4), f) f = DMP([[1], [2], [3], [4], [5], [6]], ZZ) assert f.trunc(3) == DMP([[1], [-1], [], [1], [-1], []], ZZ) f = DMP(f_4, ZZ) assert f.sqf_part() == -f assert f.sqf_list() == (ZZ(-1), [(-f, 1)]) f = DMP([[-1], [], [], [5]], ZZ) g = DMP([[3, 1], [], []], ZZ) h = DMP([[45, 30, 5]], ZZ) r = DMP([675, 675, 225, 25], ZZ) assert f.subresultants(g) == [f, g, h] assert f.resultant(g) == r f = DMP([1, 3, 9, -13], ZZ) assert f.discriminant() == -11664 f = DMP([QQ(2), QQ(0)], QQ) g = DMP([QQ(1), QQ(0), QQ(-16)], QQ) s = DMP([QQ(1, 32), QQ(0)], QQ) t = DMP([QQ(-1, 16)], QQ) h = DMP([QQ(1)], QQ) assert f.half_gcdex(g) == (s, h) assert f.gcdex(g) == (s, t, h) assert f.invert(g) == s f = DMP([[1], [2], [3]], QQ) raises(ValueError, lambda: f.half_gcdex(f)) raises(ValueError, lambda: f.gcdex(f)) raises(ValueError, lambda: f.invert(f)) f = DMP([1, 0, 20, 0, 150, 0, 500, 0, 625, -2, 0, -10, 9], ZZ) g = DMP([1, 0, 0, -2, 9], ZZ) h = DMP([1, 0, 5, 0], ZZ) assert g.compose(h) == f assert f.decompose() == [g, h] f = DMP([[1], [2], [3]], QQ) raises(ValueError, lambda: f.decompose()) raises(ValueError, lambda: f.sturm()) def test_DMP_exclude(): f = [[[[[[[[[[[[[[[[[[[[[[[[[[1]], [[]]]]]]]]]]]]]]]]]]]]]]]]]] J = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25] assert DMP(f, ZZ).exclude() == (J, DMP([1, 0], ZZ)) assert DMP([[1], [1, 0]], ZZ).exclude() == ([], DMP([[1], [1, 0]], ZZ)) def test_DMF__init__(): f = DMF(([[0], [], [0, 1, 2], [3]], [[1, 2, 3]]), ZZ) assert f.num == [[1, 2], [3]] assert f.den == [[1, 2, 3]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[1, 2], [3]], [[1, 2, 3]]), ZZ, 1) assert f.num == [[1, 2], [3]] assert f.den == [[1, 2, 3]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[-1], [-2]], [[3], [-4]]), ZZ) assert f.num == [[-1], [-2]] assert f.den == [[3], [-4]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[1], [2]], [[-3], [4]]), ZZ) assert f.num == [[-1], [-2]] assert f.den == [[3], [-4]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[1], [2]], [[-3], [4]]), ZZ) assert f.num == [[-1], [-2]] assert f.den == [[3], [-4]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[]], [[-3], [4]]), ZZ) assert f.num == [[]] assert f.den == [[1]] assert f.lev == 1 assert f.dom == ZZ f = DMF(17, ZZ, 1) assert f.num == [[17]] assert f.den == [[1]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[1], [2]]), ZZ) assert f.num == [[1], [2]] assert f.den == [[1]] assert f.lev == 1 assert f.dom == ZZ f = DMF([[0], [], [0, 1, 2], [3]], ZZ) assert f.num == [[1, 2], [3]] assert f.den == [[1]] assert f.lev == 1 assert f.dom == ZZ f = DMF({(1, 1): 1, (0, 0): 2}, ZZ, 1) assert f.num == [[1, 0], [2]] assert f.den == [[1]] assert f.lev == 1 assert f.dom == ZZ f = DMF(([[QQ(1)], [QQ(2)]], [[-QQ(3)], [QQ(4)]]), QQ) assert f.num == [[-QQ(1)], [-QQ(2)]] assert f.den == [[QQ(3)], [-QQ(4)]] assert f.lev == 1 assert f.dom == QQ f = DMF(([[QQ(1, 5)], [QQ(2, 5)]], [[-QQ(3, 7)], [QQ(4, 7)]]), QQ) assert f.num == [[-QQ(7)], [-QQ(14)]] assert f.den == [[QQ(15)], [-QQ(20)]] assert f.lev == 1 assert f.dom == QQ raises(ValueError, lambda: DMF(([1], [[1]]), ZZ)) raises(ZeroDivisionError, lambda: DMF(([1], []), ZZ)) def test_DMF__bool__(): assert bool(DMF([[]], ZZ)) is False assert bool(DMF([[1]], ZZ)) is True def test_DMF_properties(): assert DMF([[]], ZZ).is_zero is True assert DMF([[]], ZZ).is_one is False assert DMF([[1]], ZZ).is_zero is False assert DMF([[1]], ZZ).is_one is True assert DMF(([[1]], [[2]]), ZZ).is_one is False def test_DMF_arithmetics(): f = DMF([[7], [-9]], ZZ) g = DMF([[-7], [9]], ZZ) assert f.neg() == -f == g f = DMF(([[1]], [[1], []]), ZZ) g = DMF(([[1]], [[1, 0]]), ZZ) h = DMF(([[1], [1, 0]], [[1, 0], []]), ZZ) assert f.add(g) == f + g == h assert g.add(f) == g + f == h h = DMF(([[-1], [1, 0]], [[1, 0], []]), ZZ) assert f.sub(g) == f - g == h h = DMF(([[1]], [[1, 0], []]), ZZ) assert f.mul(g) == f*g == h assert g.mul(f) == g*f == h h = DMF(([[1, 0]], [[1], []]), ZZ) assert f.quo(g) == f/g == h h = DMF(([[1]], [[1], [], [], []]), ZZ) assert f.pow(3) == f**3 == h h = DMF(([[1]], [[1, 0, 0, 0]]), ZZ) assert g.pow(3) == g**3 == h def test_ANP___init__(): rep = [QQ(1), QQ(1)] mod = [QQ(1), QQ(0), QQ(1)] f = ANP(rep, mod, QQ) assert f.rep == [QQ(1), QQ(1)] assert f.mod == [QQ(1), QQ(0), QQ(1)] assert f.dom == QQ rep = {1: QQ(1), 0: QQ(1)} mod = {2: QQ(1), 0: QQ(1)} f = ANP(rep, mod, QQ) assert f.rep == [QQ(1), QQ(1)] assert f.mod == [QQ(1), QQ(0), QQ(1)] assert f.dom == QQ f = ANP(1, mod, QQ) assert f.rep == [QQ(1)] assert f.mod == [QQ(1), QQ(0), QQ(1)] assert f.dom == QQ def test_ANP___eq__(): a = ANP([QQ(1), QQ(1)], [QQ(1), QQ(0), QQ(1)], QQ) b = ANP([QQ(1), QQ(1)], [QQ(1), QQ(0), QQ(2)], QQ) assert (a == a) is True assert (a != a) is False assert (a == b) is False assert (a != b) is True b = ANP([QQ(1), QQ(2)], [QQ(1), QQ(0), QQ(1)], QQ) assert (a == b) is False assert (a != b) is True def test_ANP___bool__(): assert bool(ANP([], [QQ(1), QQ(0), QQ(1)], QQ)) is False assert bool(ANP([QQ(1)], [QQ(1), QQ(0), QQ(1)], QQ)) is True def test_ANP_properties(): mod = [QQ(1), QQ(0), QQ(1)] assert ANP([QQ(0)], mod, QQ).is_zero is True assert ANP([QQ(1)], mod, QQ).is_zero is False assert ANP([QQ(1)], mod, QQ).is_one is True assert ANP([QQ(2)], mod, QQ).is_one is False def test_ANP_arithmetics(): mod = [QQ(1), QQ(0), QQ(0), QQ(-2)] a = ANP([QQ(2), QQ(-1), QQ(1)], mod, QQ) b = ANP([QQ(1), QQ(2)], mod, QQ) c = ANP([QQ(-2), QQ(1), QQ(-1)], mod, QQ) assert a.neg() == -a == c c = ANP([QQ(2), QQ(0), QQ(3)], mod, QQ) assert a.add(b) == a + b == c assert b.add(a) == b + a == c c = ANP([QQ(2), QQ(-2), QQ(-1)], mod, QQ) assert a.sub(b) == a - b == c c = ANP([QQ(-2), QQ(2), QQ(1)], mod, QQ) assert b.sub(a) == b - a == c c = ANP([QQ(3), QQ(-1), QQ(6)], mod, QQ) assert a.mul(b) == a*b == c assert b.mul(a) == b*a == c c = ANP([QQ(-1, 43), QQ(9, 43), QQ(5, 43)], mod, QQ) assert a.pow(0) == a**(0) == ANP(1, mod, QQ) assert a.pow(1) == a**(1) == a assert a.pow(-1) == a**(-1) == c assert a.quo(a) == a.mul(a.pow(-1)) == a*a**(-1) == ANP(1, mod, QQ) c = ANP([], [1, 0, 0, -2], QQ) r1 = a.rem(b) (q, r2) = a.div(b) assert r1 == r2 == c == a % b raises(NotInvertible, lambda: a.div(c)) raises(NotInvertible, lambda: a.rem(c)) # Comparison with "hard-coded" value fails despite looking identical # from sympy import Rational # c = ANP([Rational(11, 10), Rational(-1, 5), Rational(-3, 5)], [1, 0, 0, -2], QQ) assert q == a/b # == c def test_ANP_unify(): mod = [QQ(1), QQ(0), QQ(-2)] a = ANP([QQ(1)], mod, QQ) b = ANP([ZZ(1)], mod, ZZ) assert a.unify(b)[0] == QQ assert b.unify(a)[0] == QQ assert a.unify(a)[0] == QQ assert b.unify(b)[0] == ZZ def test___hash__(): # issue 5571 # Make sure int vs. long doesn't affect hashing with Python ground types assert DMP([[1, 2], [3]], ZZ) == DMP([[int(1), int(2)], [int(3)]], ZZ) assert hash(DMP([[1, 2], [3]], ZZ)) == hash(DMP([[int(1), int(2)], [int(3)]], ZZ)) assert DMF( ([[1, 2], [3]], [[1]]), ZZ) == DMF(([[int(1), int(2)], [int(3)]], [[int(1)]]), ZZ) assert hash(DMF(([[1, 2], [3]], [[1]]), ZZ)) == hash(DMF(([[int(1), int(2)], [int(3)]], [[int(1)]]), ZZ)) assert ANP([1, 1], [1, 0, 1], ZZ) == ANP([int(1), int(1)], [int(1), int(0), int(1)], ZZ) assert hash( ANP([1, 1], [1, 0, 1], ZZ)) == hash(ANP([int(1), int(1)], [int(1), int(0), int(1)], ZZ))
27d2d38f69baf2faa4717b7984cde4d714c8045c8215e947859136910d60923e
"""Tests for options manager for :class:`Poly` and public API functions. """ from sympy.polys.polyoptions import ( Options, Expand, Gens, Wrt, Sort, Order, Field, Greedy, Domain, Split, Gaussian, Extension, Modulus, Symmetric, Strict, Auto, Frac, Formal, Polys, Include, All, Gen, Symbols, Method) from sympy.polys.orderings import lex from sympy.polys.domains import FF, GF, ZZ, QQ, RR, CC, EX from sympy.polys.polyerrors import OptionError, GeneratorsError from sympy import Integer, Symbol, I, sqrt from sympy.testing.pytest import raises from sympy.abc import x, y, z def test_Options_clone(): opt = Options((x, y, z), {'domain': 'ZZ'}) assert opt.gens == (x, y, z) assert opt.domain == ZZ assert ('order' in opt) is False new_opt = opt.clone({'gens': (x, y), 'order': 'lex'}) assert opt.gens == (x, y, z) assert opt.domain == ZZ assert ('order' in opt) is False assert new_opt.gens == (x, y) assert new_opt.domain == ZZ assert ('order' in new_opt) is True def test_Expand_preprocess(): assert Expand.preprocess(False) is False assert Expand.preprocess(True) is True assert Expand.preprocess(0) is False assert Expand.preprocess(1) is True raises(OptionError, lambda: Expand.preprocess(x)) def test_Expand_postprocess(): opt = {'expand': True} Expand.postprocess(opt) assert opt == {'expand': True} def test_Gens_preprocess(): assert Gens.preprocess((None,)) == () assert Gens.preprocess((x, y, z)) == (x, y, z) assert Gens.preprocess(((x, y, z),)) == (x, y, z) a = Symbol('a', commutative=False) raises(GeneratorsError, lambda: Gens.preprocess((x, x, y))) raises(GeneratorsError, lambda: Gens.preprocess((x, y, a))) def test_Gens_postprocess(): opt = {'gens': (x, y)} Gens.postprocess(opt) assert opt == {'gens': (x, y)} def test_Wrt_preprocess(): assert Wrt.preprocess(x) == ['x'] assert Wrt.preprocess('') == [] assert Wrt.preprocess(' ') == [] assert Wrt.preprocess('x,y') == ['x', 'y'] assert Wrt.preprocess('x y') == ['x', 'y'] assert Wrt.preprocess('x, y') == ['x', 'y'] assert Wrt.preprocess('x , y') == ['x', 'y'] assert Wrt.preprocess(' x, y') == ['x', 'y'] assert Wrt.preprocess(' x, y') == ['x', 'y'] assert Wrt.preprocess([x, y]) == ['x', 'y'] raises(OptionError, lambda: Wrt.preprocess(',')) raises(OptionError, lambda: Wrt.preprocess(0)) def test_Wrt_postprocess(): opt = {'wrt': ['x']} Wrt.postprocess(opt) assert opt == {'wrt': ['x']} def test_Sort_preprocess(): assert Sort.preprocess([x, y, z]) == ['x', 'y', 'z'] assert Sort.preprocess((x, y, z)) == ['x', 'y', 'z'] assert Sort.preprocess('x > y > z') == ['x', 'y', 'z'] assert Sort.preprocess('x>y>z') == ['x', 'y', 'z'] raises(OptionError, lambda: Sort.preprocess(0)) raises(OptionError, lambda: Sort.preprocess({x, y, z})) def test_Sort_postprocess(): opt = {'sort': 'x > y'} Sort.postprocess(opt) assert opt == {'sort': 'x > y'} def test_Order_preprocess(): assert Order.preprocess('lex') == lex def test_Order_postprocess(): opt = {'order': True} Order.postprocess(opt) assert opt == {'order': True} def test_Field_preprocess(): assert Field.preprocess(False) is False assert Field.preprocess(True) is True assert Field.preprocess(0) is False assert Field.preprocess(1) is True raises(OptionError, lambda: Field.preprocess(x)) def test_Field_postprocess(): opt = {'field': True} Field.postprocess(opt) assert opt == {'field': True} def test_Greedy_preprocess(): assert Greedy.preprocess(False) is False assert Greedy.preprocess(True) is True assert Greedy.preprocess(0) is False assert Greedy.preprocess(1) is True raises(OptionError, lambda: Greedy.preprocess(x)) def test_Greedy_postprocess(): opt = {'greedy': True} Greedy.postprocess(opt) assert opt == {'greedy': True} def test_Domain_preprocess(): assert Domain.preprocess(ZZ) == ZZ assert Domain.preprocess(QQ) == QQ assert Domain.preprocess(EX) == EX assert Domain.preprocess(FF(2)) == FF(2) assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y] assert Domain.preprocess('Z') == ZZ assert Domain.preprocess('Q') == QQ assert Domain.preprocess('ZZ') == ZZ assert Domain.preprocess('QQ') == QQ assert Domain.preprocess('EX') == EX assert Domain.preprocess('FF(23)') == FF(23) assert Domain.preprocess('GF(23)') == GF(23) raises(OptionError, lambda: Domain.preprocess('Z[]')) assert Domain.preprocess('Z[x]') == ZZ[x] assert Domain.preprocess('Q[x]') == QQ[x] assert Domain.preprocess('R[x]') == RR[x] assert Domain.preprocess('C[x]') == CC[x] assert Domain.preprocess('ZZ[x]') == ZZ[x] assert Domain.preprocess('QQ[x]') == QQ[x] assert Domain.preprocess('RR[x]') == RR[x] assert Domain.preprocess('CC[x]') == CC[x] assert Domain.preprocess('Z[x,y]') == ZZ[x, y] assert Domain.preprocess('Q[x,y]') == QQ[x, y] assert Domain.preprocess('R[x,y]') == RR[x, y] assert Domain.preprocess('C[x,y]') == CC[x, y] assert Domain.preprocess('ZZ[x,y]') == ZZ[x, y] assert Domain.preprocess('QQ[x,y]') == QQ[x, y] assert Domain.preprocess('RR[x,y]') == RR[x, y] assert Domain.preprocess('CC[x,y]') == CC[x, y] raises(OptionError, lambda: Domain.preprocess('Z()')) assert Domain.preprocess('Z(x)') == ZZ.frac_field(x) assert Domain.preprocess('Q(x)') == QQ.frac_field(x) assert Domain.preprocess('ZZ(x)') == ZZ.frac_field(x) assert Domain.preprocess('QQ(x)') == QQ.frac_field(x) assert Domain.preprocess('Z(x,y)') == ZZ.frac_field(x, y) assert Domain.preprocess('Q(x,y)') == QQ.frac_field(x, y) assert Domain.preprocess('ZZ(x,y)') == ZZ.frac_field(x, y) assert Domain.preprocess('QQ(x,y)') == QQ.frac_field(x, y) assert Domain.preprocess('Q<I>') == QQ.algebraic_field(I) assert Domain.preprocess('QQ<I>') == QQ.algebraic_field(I) assert Domain.preprocess('Q<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I) assert Domain.preprocess( 'QQ<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I) raises(OptionError, lambda: Domain.preprocess('abc')) def test_Domain_postprocess(): raises(GeneratorsError, lambda: Domain.postprocess({'gens': (x, y), 'domain': ZZ[y, z]})) raises(GeneratorsError, lambda: Domain.postprocess({'gens': (), 'domain': EX})) raises(GeneratorsError, lambda: Domain.postprocess({'domain': EX})) def test_Split_preprocess(): assert Split.preprocess(False) is False assert Split.preprocess(True) is True assert Split.preprocess(0) is False assert Split.preprocess(1) is True raises(OptionError, lambda: Split.preprocess(x)) def test_Split_postprocess(): raises(NotImplementedError, lambda: Split.postprocess({'split': True})) def test_Gaussian_preprocess(): assert Gaussian.preprocess(False) is False assert Gaussian.preprocess(True) is True assert Gaussian.preprocess(0) is False assert Gaussian.preprocess(1) is True raises(OptionError, lambda: Gaussian.preprocess(x)) def test_Gaussian_postprocess(): opt = {'gaussian': True} Gaussian.postprocess(opt) assert opt == { 'gaussian': True, 'extension': {I}, 'domain': QQ.algebraic_field(I), } def test_Extension_preprocess(): assert Extension.preprocess(True) is True assert Extension.preprocess(1) is True assert Extension.preprocess([]) is None assert Extension.preprocess(sqrt(2)) == {sqrt(2)} assert Extension.preprocess([sqrt(2)]) == {sqrt(2)} assert Extension.preprocess([sqrt(2), I]) == {sqrt(2), I} raises(OptionError, lambda: Extension.preprocess(False)) raises(OptionError, lambda: Extension.preprocess(0)) def test_Extension_postprocess(): opt = {'extension': {sqrt(2)}} Extension.postprocess(opt) assert opt == { 'extension': {sqrt(2)}, 'domain': QQ.algebraic_field(sqrt(2)), } opt = {'extension': True} Extension.postprocess(opt) assert opt == {'extension': True} def test_Modulus_preprocess(): assert Modulus.preprocess(23) == 23 assert Modulus.preprocess(Integer(23)) == 23 raises(OptionError, lambda: Modulus.preprocess(0)) raises(OptionError, lambda: Modulus.preprocess(x)) def test_Modulus_postprocess(): opt = {'modulus': 5} Modulus.postprocess(opt) assert opt == { 'modulus': 5, 'domain': FF(5), } opt = {'modulus': 5, 'symmetric': False} Modulus.postprocess(opt) assert opt == { 'modulus': 5, 'domain': FF(5, False), 'symmetric': False, } def test_Symmetric_preprocess(): assert Symmetric.preprocess(False) is False assert Symmetric.preprocess(True) is True assert Symmetric.preprocess(0) is False assert Symmetric.preprocess(1) is True raises(OptionError, lambda: Symmetric.preprocess(x)) def test_Symmetric_postprocess(): opt = {'symmetric': True} Symmetric.postprocess(opt) assert opt == {'symmetric': True} def test_Strict_preprocess(): assert Strict.preprocess(False) is False assert Strict.preprocess(True) is True assert Strict.preprocess(0) is False assert Strict.preprocess(1) is True raises(OptionError, lambda: Strict.preprocess(x)) def test_Strict_postprocess(): opt = {'strict': True} Strict.postprocess(opt) assert opt == {'strict': True} def test_Auto_preprocess(): assert Auto.preprocess(False) is False assert Auto.preprocess(True) is True assert Auto.preprocess(0) is False assert Auto.preprocess(1) is True raises(OptionError, lambda: Auto.preprocess(x)) def test_Auto_postprocess(): opt = {'auto': True} Auto.postprocess(opt) assert opt == {'auto': True} def test_Frac_preprocess(): assert Frac.preprocess(False) is False assert Frac.preprocess(True) is True assert Frac.preprocess(0) is False assert Frac.preprocess(1) is True raises(OptionError, lambda: Frac.preprocess(x)) def test_Frac_postprocess(): opt = {'frac': True} Frac.postprocess(opt) assert opt == {'frac': True} def test_Formal_preprocess(): assert Formal.preprocess(False) is False assert Formal.preprocess(True) is True assert Formal.preprocess(0) is False assert Formal.preprocess(1) is True raises(OptionError, lambda: Formal.preprocess(x)) def test_Formal_postprocess(): opt = {'formal': True} Formal.postprocess(opt) assert opt == {'formal': True} def test_Polys_preprocess(): assert Polys.preprocess(False) is False assert Polys.preprocess(True) is True assert Polys.preprocess(0) is False assert Polys.preprocess(1) is True raises(OptionError, lambda: Polys.preprocess(x)) def test_Polys_postprocess(): opt = {'polys': True} Polys.postprocess(opt) assert opt == {'polys': True} def test_Include_preprocess(): assert Include.preprocess(False) is False assert Include.preprocess(True) is True assert Include.preprocess(0) is False assert Include.preprocess(1) is True raises(OptionError, lambda: Include.preprocess(x)) def test_Include_postprocess(): opt = {'include': True} Include.postprocess(opt) assert opt == {'include': True} def test_All_preprocess(): assert All.preprocess(False) is False assert All.preprocess(True) is True assert All.preprocess(0) is False assert All.preprocess(1) is True raises(OptionError, lambda: All.preprocess(x)) def test_All_postprocess(): opt = {'all': True} All.postprocess(opt) assert opt == {'all': True} def test_Gen_postprocess(): opt = {'gen': x} Gen.postprocess(opt) assert opt == {'gen': x} def test_Symbols_preprocess(): raises(OptionError, lambda: Symbols.preprocess(x)) def test_Symbols_postprocess(): opt = {'symbols': [x, y, z]} Symbols.postprocess(opt) assert opt == {'symbols': [x, y, z]} def test_Method_preprocess(): raises(OptionError, lambda: Method.preprocess(10)) def test_Method_postprocess(): opt = {'method': 'f5b'} Method.postprocess(opt) assert opt == {'method': 'f5b'}
8266cc9f6f9be816f1a083b7bdbeeb1b7c7049ea77ca260ff9ced3d7361b03b1
"""Tests for dense recursive polynomials' basic tools. """ from sympy.polys.densebasic import ( dup_LC, dmp_LC, dup_TC, dmp_TC, dmp_ground_LC, dmp_ground_TC, dmp_true_LT, dup_degree, dmp_degree, dmp_degree_in, dmp_degree_list, dup_strip, dmp_strip, dmp_validate, dup_reverse, dup_copy, dmp_copy, dup_normal, dmp_normal, dup_convert, dmp_convert, dup_from_sympy, dmp_from_sympy, dup_nth, dmp_nth, dmp_ground_nth, dmp_zero_p, dmp_zero, dmp_one_p, dmp_one, dmp_ground_p, dmp_ground, dmp_negative_p, dmp_positive_p, dmp_zeros, dmp_grounds, dup_from_dict, dup_from_raw_dict, dup_to_dict, dup_to_raw_dict, dmp_from_dict, dmp_to_dict, dmp_swap, dmp_permute, dmp_nest, dmp_raise, dup_deflate, dmp_deflate, dup_multi_deflate, dmp_multi_deflate, dup_inflate, dmp_inflate, dmp_exclude, dmp_include, dmp_inject, dmp_eject, dup_terms_gcd, dmp_terms_gcd, dmp_list_terms, dmp_apply_pairs, dup_slice, dup_random, ) from sympy.polys.specialpolys import f_polys from sympy.polys.domains import ZZ, QQ from sympy.polys.rings import ring from sympy.core.singleton import S from sympy.testing.pytest import raises from sympy import oo f_0, f_1, f_2, f_3, f_4, f_5, f_6 = [ f.to_dense() for f in f_polys() ] def test_dup_LC(): assert dup_LC([], ZZ) == 0 assert dup_LC([2, 3, 4, 5], ZZ) == 2 def test_dup_TC(): assert dup_TC([], ZZ) == 0 assert dup_TC([2, 3, 4, 5], ZZ) == 5 def test_dmp_LC(): assert dmp_LC([[]], ZZ) == [] assert dmp_LC([[2, 3, 4], [5]], ZZ) == [2, 3, 4] assert dmp_LC([[[]]], ZZ) == [[]] assert dmp_LC([[[2], [3, 4]], [[5]]], ZZ) == [[2], [3, 4]] def test_dmp_TC(): assert dmp_TC([[]], ZZ) == [] assert dmp_TC([[2, 3, 4], [5]], ZZ) == [5] assert dmp_TC([[[]]], ZZ) == [[]] assert dmp_TC([[[2], [3, 4]], [[5]]], ZZ) == [[5]] def test_dmp_ground_LC(): assert dmp_ground_LC([[]], 1, ZZ) == 0 assert dmp_ground_LC([[2, 3, 4], [5]], 1, ZZ) == 2 assert dmp_ground_LC([[[]]], 2, ZZ) == 0 assert dmp_ground_LC([[[2], [3, 4]], [[5]]], 2, ZZ) == 2 def test_dmp_ground_TC(): assert dmp_ground_TC([[]], 1, ZZ) == 0 assert dmp_ground_TC([[2, 3, 4], [5]], 1, ZZ) == 5 assert dmp_ground_TC([[[]]], 2, ZZ) == 0 assert dmp_ground_TC([[[2], [3, 4]], [[5]]], 2, ZZ) == 5 def test_dmp_true_LT(): assert dmp_true_LT([[]], 1, ZZ) == ((0, 0), 0) assert dmp_true_LT([[7]], 1, ZZ) == ((0, 0), 7) assert dmp_true_LT([[1, 0]], 1, ZZ) == ((0, 1), 1) assert dmp_true_LT([[1], []], 1, ZZ) == ((1, 0), 1) assert dmp_true_LT([[1, 0], []], 1, ZZ) == ((1, 1), 1) def test_dup_degree(): assert dup_degree([]) is -oo assert dup_degree([1]) == 0 assert dup_degree([1, 0]) == 1 assert dup_degree([1, 0, 0, 0, 1]) == 4 def test_dmp_degree(): assert dmp_degree([[]], 1) is -oo assert dmp_degree([[[]]], 2) is -oo assert dmp_degree([[1]], 1) == 0 assert dmp_degree([[2], [1]], 1) == 1 def test_dmp_degree_in(): assert dmp_degree_in([[[]]], 0, 2) is -oo assert dmp_degree_in([[[]]], 1, 2) is -oo assert dmp_degree_in([[[]]], 2, 2) is -oo assert dmp_degree_in([[[1]]], 0, 2) == 0 assert dmp_degree_in([[[1]]], 1, 2) == 0 assert dmp_degree_in([[[1]]], 2, 2) == 0 assert dmp_degree_in(f_4, 0, 2) == 9 assert dmp_degree_in(f_4, 1, 2) == 12 assert dmp_degree_in(f_4, 2, 2) == 8 assert dmp_degree_in(f_6, 0, 2) == 4 assert dmp_degree_in(f_6, 1, 2) == 4 assert dmp_degree_in(f_6, 2, 2) == 6 assert dmp_degree_in(f_6, 3, 3) == 3 raises(IndexError, lambda: dmp_degree_in([[1]], -5, 1)) def test_dmp_degree_list(): assert dmp_degree_list([[[[ ]]]], 3) == (-oo, -oo, -oo, -oo) assert dmp_degree_list([[[[1]]]], 3) == ( 0, 0, 0, 0) assert dmp_degree_list(f_0, 2) == (2, 2, 2) assert dmp_degree_list(f_1, 2) == (3, 3, 3) assert dmp_degree_list(f_2, 2) == (5, 3, 3) assert dmp_degree_list(f_3, 2) == (5, 4, 7) assert dmp_degree_list(f_4, 2) == (9, 12, 8) assert dmp_degree_list(f_5, 2) == (3, 3, 3) assert dmp_degree_list(f_6, 3) == (4, 4, 6, 3) def test_dup_strip(): assert dup_strip([]) == [] assert dup_strip([0]) == [] assert dup_strip([0, 0, 0]) == [] assert dup_strip([1]) == [1] assert dup_strip([0, 1]) == [1] assert dup_strip([0, 0, 0, 1]) == [1] assert dup_strip([1, 2, 0]) == [1, 2, 0] assert dup_strip([0, 1, 2, 0]) == [1, 2, 0] assert dup_strip([0, 0, 0, 1, 2, 0]) == [1, 2, 0] def test_dmp_strip(): assert dmp_strip([0, 1, 0], 0) == [1, 0] assert dmp_strip([[]], 1) == [[]] assert dmp_strip([[], []], 1) == [[]] assert dmp_strip([[], [], []], 1) == [[]] assert dmp_strip([[[]]], 2) == [[[]]] assert dmp_strip([[[]], [[]]], 2) == [[[]]] assert dmp_strip([[[]], [[]], [[]]], 2) == [[[]]] assert dmp_strip([[[1]]], 2) == [[[1]]] assert dmp_strip([[[]], [[1]]], 2) == [[[1]]] assert dmp_strip([[[]], [[1]], [[]]], 2) == [[[1]], [[]]] def test_dmp_validate(): assert dmp_validate([]) == ([], 0) assert dmp_validate([0, 0, 0, 1, 0]) == ([1, 0], 0) assert dmp_validate([[[]]]) == ([[[]]], 2) assert dmp_validate([[0], [], [0], [1], [0]]) == ([[1], []], 1) raises(ValueError, lambda: dmp_validate([[0], 0, [0], [1], [0]])) def test_dup_reverse(): assert dup_reverse([1, 2, 0, 3]) == [3, 0, 2, 1] assert dup_reverse([1, 2, 3, 0]) == [3, 2, 1] def test_dup_copy(): f = [ZZ(1), ZZ(0), ZZ(2)] g = dup_copy(f) g[0], g[2] = ZZ(7), ZZ(0) assert f != g def test_dmp_copy(): f = [[ZZ(1)], [ZZ(2), ZZ(0)]] g = dmp_copy(f, 1) g[0][0], g[1][1] = ZZ(7), ZZ(1) assert f != g def test_dup_normal(): assert dup_normal([0, 0, 2, 1, 0, 11, 0], ZZ) == \ [ZZ(2), ZZ(1), ZZ(0), ZZ(11), ZZ(0)] def test_dmp_normal(): assert dmp_normal([[0], [], [0, 2, 1], [0], [11], []], 1, ZZ) == \ [[ZZ(2), ZZ(1)], [], [ZZ(11)], []] def test_dup_convert(): K0, K1 = ZZ['x'], ZZ f = [K0(1), K0(2), K0(0), K0(3)] assert dup_convert(f, K0, K1) == \ [ZZ(1), ZZ(2), ZZ(0), ZZ(3)] def test_dmp_convert(): K0, K1 = ZZ['x'], ZZ f = [[K0(1)], [K0(2)], [], [K0(3)]] assert dmp_convert(f, 1, K0, K1) == \ [[ZZ(1)], [ZZ(2)], [], [ZZ(3)]] def test_dup_from_sympy(): assert dup_from_sympy([S.One, S(2)], ZZ) == \ [ZZ(1), ZZ(2)] assert dup_from_sympy([S.Half, S(3)], QQ) == \ [QQ(1, 2), QQ(3, 1)] def test_dmp_from_sympy(): assert dmp_from_sympy([[S.One, S(2)], [S.Zero]], 1, ZZ) == \ [[ZZ(1), ZZ(2)], []] assert dmp_from_sympy([[S.Half, S(2)]], 1, QQ) == \ [[QQ(1, 2), QQ(2, 1)]] def test_dup_nth(): assert dup_nth([1, 2, 3], 0, ZZ) == 3 assert dup_nth([1, 2, 3], 1, ZZ) == 2 assert dup_nth([1, 2, 3], 2, ZZ) == 1 assert dup_nth([1, 2, 3], 9, ZZ) == 0 raises(IndexError, lambda: dup_nth([3, 4, 5], -1, ZZ)) def test_dmp_nth(): assert dmp_nth([[1], [2], [3]], 0, 1, ZZ) == [3] assert dmp_nth([[1], [2], [3]], 1, 1, ZZ) == [2] assert dmp_nth([[1], [2], [3]], 2, 1, ZZ) == [1] assert dmp_nth([[1], [2], [3]], 9, 1, ZZ) == [] raises(IndexError, lambda: dmp_nth([[3], [4], [5]], -1, 1, ZZ)) def test_dmp_ground_nth(): assert dmp_ground_nth([[]], (0, 0), 1, ZZ) == 0 assert dmp_ground_nth([[1], [2], [3]], (0, 0), 1, ZZ) == 3 assert dmp_ground_nth([[1], [2], [3]], (1, 0), 1, ZZ) == 2 assert dmp_ground_nth([[1], [2], [3]], (2, 0), 1, ZZ) == 1 assert dmp_ground_nth([[1], [2], [3]], (2, 1), 1, ZZ) == 0 assert dmp_ground_nth([[1], [2], [3]], (3, 0), 1, ZZ) == 0 raises(IndexError, lambda: dmp_ground_nth([[3], [4], [5]], (2, -1), 1, ZZ)) def test_dmp_zero_p(): assert dmp_zero_p([], 0) is True assert dmp_zero_p([[]], 1) is True assert dmp_zero_p([[[]]], 2) is True assert dmp_zero_p([[[1]]], 2) is False def test_dmp_zero(): assert dmp_zero(0) == [] assert dmp_zero(2) == [[[]]] def test_dmp_one_p(): assert dmp_one_p([1], 0, ZZ) is True assert dmp_one_p([[1]], 1, ZZ) is True assert dmp_one_p([[[1]]], 2, ZZ) is True assert dmp_one_p([[[12]]], 2, ZZ) is False def test_dmp_one(): assert dmp_one(0, ZZ) == [ZZ(1)] assert dmp_one(2, ZZ) == [[[ZZ(1)]]] def test_dmp_ground_p(): assert dmp_ground_p([], 0, 0) is True assert dmp_ground_p([[]], 0, 1) is True assert dmp_ground_p([[]], 1, 1) is False assert dmp_ground_p([[ZZ(1)]], 1, 1) is True assert dmp_ground_p([[[ZZ(2)]]], 2, 2) is True assert dmp_ground_p([[[ZZ(2)]]], 3, 2) is False assert dmp_ground_p([[[ZZ(3)], []]], 3, 2) is False assert dmp_ground_p([], None, 0) is True assert dmp_ground_p([[]], None, 1) is True assert dmp_ground_p([ZZ(1)], None, 0) is True assert dmp_ground_p([[[ZZ(1)]]], None, 2) is True assert dmp_ground_p([[[ZZ(3)], []]], None, 2) is False def test_dmp_ground(): assert dmp_ground(ZZ(0), 2) == [[[]]] assert dmp_ground(ZZ(7), -1) == ZZ(7) assert dmp_ground(ZZ(7), 0) == [ZZ(7)] assert dmp_ground(ZZ(7), 2) == [[[ZZ(7)]]] def test_dmp_zeros(): assert dmp_zeros(4, 0, ZZ) == [[], [], [], []] assert dmp_zeros(0, 2, ZZ) == [] assert dmp_zeros(1, 2, ZZ) == [[[[]]]] assert dmp_zeros(2, 2, ZZ) == [[[[]]], [[[]]]] assert dmp_zeros(3, 2, ZZ) == [[[[]]], [[[]]], [[[]]]] assert dmp_zeros(3, -1, ZZ) == [0, 0, 0] def test_dmp_grounds(): assert dmp_grounds(ZZ(7), 0, 2) == [] assert dmp_grounds(ZZ(7), 1, 2) == [[[[7]]]] assert dmp_grounds(ZZ(7), 2, 2) == [[[[7]]], [[[7]]]] assert dmp_grounds(ZZ(7), 3, 2) == [[[[7]]], [[[7]]], [[[7]]]] assert dmp_grounds(ZZ(7), 3, -1) == [7, 7, 7] def test_dmp_negative_p(): assert dmp_negative_p([[[]]], 2, ZZ) is False assert dmp_negative_p([[[1], [2]]], 2, ZZ) is False assert dmp_negative_p([[[-1], [2]]], 2, ZZ) is True def test_dmp_positive_p(): assert dmp_positive_p([[[]]], 2, ZZ) is False assert dmp_positive_p([[[1], [2]]], 2, ZZ) is True assert dmp_positive_p([[[-1], [2]]], 2, ZZ) is False def test_dup_from_to_dict(): assert dup_from_raw_dict({}, ZZ) == [] assert dup_from_dict({}, ZZ) == [] assert dup_to_raw_dict([]) == {} assert dup_to_dict([]) == {} assert dup_to_raw_dict([], ZZ, zero=True) == {0: ZZ(0)} assert dup_to_dict([], ZZ, zero=True) == {(0,): ZZ(0)} f = [3, 0, 0, 2, 0, 0, 0, 0, 8] g = {8: 3, 5: 2, 0: 8} h = {(8,): 3, (5,): 2, (0,): 8} assert dup_from_raw_dict(g, ZZ) == f assert dup_from_dict(h, ZZ) == f assert dup_to_raw_dict(f) == g assert dup_to_dict(f) == h R, x,y = ring("x,y", ZZ) K = R.to_domain() f = [R(3), R(0), R(2), R(0), R(0), R(8)] g = {5: R(3), 3: R(2), 0: R(8)} h = {(5,): R(3), (3,): R(2), (0,): R(8)} assert dup_from_raw_dict(g, K) == f assert dup_from_dict(h, K) == f assert dup_to_raw_dict(f) == g assert dup_to_dict(f) == h def test_dmp_from_to_dict(): assert dmp_from_dict({}, 1, ZZ) == [[]] assert dmp_to_dict([[]], 1) == {} assert dmp_to_dict([], 0, ZZ, zero=True) == {(0,): ZZ(0)} assert dmp_to_dict([[]], 1, ZZ, zero=True) == {(0, 0): ZZ(0)} f = [[3], [], [], [2], [], [], [], [], [8]] g = {(8, 0): 3, (5, 0): 2, (0, 0): 8} assert dmp_from_dict(g, 1, ZZ) == f assert dmp_to_dict(f, 1) == g def test_dmp_swap(): f = dmp_normal([[1, 0, 0], [], [1, 0], [], [1]], 1, ZZ) g = dmp_normal([[1, 0, 0, 0, 0], [1, 0, 0], [1]], 1, ZZ) assert dmp_swap(f, 1, 1, 1, ZZ) == f assert dmp_swap(f, 0, 1, 1, ZZ) == g assert dmp_swap(g, 0, 1, 1, ZZ) == f raises(IndexError, lambda: dmp_swap(f, -1, -7, 1, ZZ)) def test_dmp_permute(): f = dmp_normal([[1, 0, 0], [], [1, 0], [], [1]], 1, ZZ) g = dmp_normal([[1, 0, 0, 0, 0], [1, 0, 0], [1]], 1, ZZ) assert dmp_permute(f, [0, 1], 1, ZZ) == f assert dmp_permute(g, [0, 1], 1, ZZ) == g assert dmp_permute(f, [1, 0], 1, ZZ) == g assert dmp_permute(g, [1, 0], 1, ZZ) == f def test_dmp_nest(): assert dmp_nest(ZZ(1), 2, ZZ) == [[[1]]] assert dmp_nest([[1]], 0, ZZ) == [[1]] assert dmp_nest([[1]], 1, ZZ) == [[[1]]] assert dmp_nest([[1]], 2, ZZ) == [[[[1]]]] def test_dmp_raise(): assert dmp_raise([], 2, 0, ZZ) == [[[]]] assert dmp_raise([[1]], 0, 1, ZZ) == [[1]] assert dmp_raise([[1, 2, 3], [], [2, 3]], 2, 1, ZZ) == \ [[[[1]], [[2]], [[3]]], [[[]]], [[[2]], [[3]]]] def test_dup_deflate(): assert dup_deflate([], ZZ) == (1, []) assert dup_deflate([2], ZZ) == (1, [2]) assert dup_deflate([1, 2, 3], ZZ) == (1, [1, 2, 3]) assert dup_deflate([1, 0, 2, 0, 3], ZZ) == (2, [1, 2, 3]) assert dup_deflate(dup_from_raw_dict({7: 1, 1: 1}, ZZ), ZZ) == \ (1, [1, 0, 0, 0, 0, 0, 1, 0]) assert dup_deflate(dup_from_raw_dict({7: 1, 0: 1}, ZZ), ZZ) == \ (7, [1, 1]) assert dup_deflate(dup_from_raw_dict({7: 1, 3: 1}, ZZ), ZZ) == \ (1, [1, 0, 0, 0, 1, 0, 0, 0]) assert dup_deflate(dup_from_raw_dict({7: 1, 4: 1}, ZZ), ZZ) == \ (1, [1, 0, 0, 1, 0, 0, 0, 0]) assert dup_deflate(dup_from_raw_dict({8: 1, 4: 1}, ZZ), ZZ) == \ (4, [1, 1, 0]) assert dup_deflate(dup_from_raw_dict({8: 1}, ZZ), ZZ) == \ (8, [1, 0]) assert dup_deflate(dup_from_raw_dict({7: 1}, ZZ), ZZ) == \ (7, [1, 0]) assert dup_deflate(dup_from_raw_dict({1: 1}, ZZ), ZZ) == \ (1, [1, 0]) def test_dmp_deflate(): assert dmp_deflate([[]], 1, ZZ) == ((1, 1), [[]]) assert dmp_deflate([[2]], 1, ZZ) == ((1, 1), [[2]]) f = [[1, 0, 0], [], [1, 0], [], [1]] assert dmp_deflate(f, 1, ZZ) == ((2, 1), [[1, 0, 0], [1, 0], [1]]) def test_dup_multi_deflate(): assert dup_multi_deflate(([2],), ZZ) == (1, ([2],)) assert dup_multi_deflate(([], []), ZZ) == (1, ([], [])) assert dup_multi_deflate(([1, 2, 3],), ZZ) == (1, ([1, 2, 3],)) assert dup_multi_deflate(([1, 0, 2, 0, 3],), ZZ) == (2, ([1, 2, 3],)) assert dup_multi_deflate(([1, 0, 2, 0, 3], [2, 0, 0]), ZZ) == \ (2, ([1, 2, 3], [2, 0])) assert dup_multi_deflate(([1, 0, 2, 0, 3], [2, 1, 0]), ZZ) == \ (1, ([1, 0, 2, 0, 3], [2, 1, 0])) def test_dmp_multi_deflate(): assert dmp_multi_deflate(([[]],), 1, ZZ) == \ ((1, 1), ([[]],)) assert dmp_multi_deflate(([[]], [[]]), 1, ZZ) == \ ((1, 1), ([[]], [[]])) assert dmp_multi_deflate(([[1]], [[]]), 1, ZZ) == \ ((1, 1), ([[1]], [[]])) assert dmp_multi_deflate(([[1]], [[2]]), 1, ZZ) == \ ((1, 1), ([[1]], [[2]])) assert dmp_multi_deflate(([[1]], [[2, 0]]), 1, ZZ) == \ ((1, 1), ([[1]], [[2, 0]])) assert dmp_multi_deflate(([[2, 0]], [[2, 0]]), 1, ZZ) == \ ((1, 1), ([[2, 0]], [[2, 0]])) assert dmp_multi_deflate( ([[2]], [[2, 0, 0]]), 1, ZZ) == ((1, 2), ([[2]], [[2, 0]])) assert dmp_multi_deflate( ([[2, 0, 0]], [[2, 0, 0]]), 1, ZZ) == ((1, 2), ([[2, 0]], [[2, 0]])) assert dmp_multi_deflate(([2, 0, 0], [1, 0, 4, 0, 1]), 0, ZZ) == \ ((2,), ([2, 0], [1, 4, 1])) f = [[1, 0, 0], [], [1, 0], [], [1]] g = [[1, 0, 1, 0], [], [1]] assert dmp_multi_deflate((f,), 1, ZZ) == \ ((2, 1), ([[1, 0, 0], [1, 0], [1]],)) assert dmp_multi_deflate((f, g), 1, ZZ) == \ ((2, 1), ([[1, 0, 0], [1, 0], [1]], [[1, 0, 1, 0], [1]])) def test_dup_inflate(): assert dup_inflate([], 17, ZZ) == [] assert dup_inflate([1, 2, 3], 1, ZZ) == [1, 2, 3] assert dup_inflate([1, 2, 3], 2, ZZ) == [1, 0, 2, 0, 3] assert dup_inflate([1, 2, 3], 3, ZZ) == [1, 0, 0, 2, 0, 0, 3] assert dup_inflate([1, 2, 3], 4, ZZ) == [1, 0, 0, 0, 2, 0, 0, 0, 3] raises(IndexError, lambda: dup_inflate([1, 2, 3], 0, ZZ)) def test_dmp_inflate(): assert dmp_inflate([1], (3,), 0, ZZ) == [1] assert dmp_inflate([[]], (3, 7), 1, ZZ) == [[]] assert dmp_inflate([[2]], (1, 2), 1, ZZ) == [[2]] assert dmp_inflate([[2, 0]], (1, 1), 1, ZZ) == [[2, 0]] assert dmp_inflate([[2, 0]], (1, 2), 1, ZZ) == [[2, 0, 0]] assert dmp_inflate([[2, 0]], (1, 3), 1, ZZ) == [[2, 0, 0, 0]] assert dmp_inflate([[1, 0, 0], [1], [1, 0]], (2, 1), 1, ZZ) == \ [[1, 0, 0], [], [1], [], [1, 0]] raises(IndexError, lambda: dmp_inflate([[]], (-3, 7), 1, ZZ)) def test_dmp_exclude(): assert dmp_exclude([[[]]], 2, ZZ) == ([], [[[]]], 2) assert dmp_exclude([[[7]]], 2, ZZ) == ([], [[[7]]], 2) assert dmp_exclude([1, 2, 3], 0, ZZ) == ([], [1, 2, 3], 0) assert dmp_exclude([[1], [2, 3]], 1, ZZ) == ([], [[1], [2, 3]], 1) assert dmp_exclude([[1, 2, 3]], 1, ZZ) == ([0], [1, 2, 3], 0) assert dmp_exclude([[1], [2], [3]], 1, ZZ) == ([1], [1, 2, 3], 0) assert dmp_exclude([[[1, 2, 3]]], 2, ZZ) == ([0, 1], [1, 2, 3], 0) assert dmp_exclude([[[1]], [[2]], [[3]]], 2, ZZ) == ([1, 2], [1, 2, 3], 0) def test_dmp_include(): assert dmp_include([1, 2, 3], [], 0, ZZ) == [1, 2, 3] assert dmp_include([1, 2, 3], [0], 0, ZZ) == [[1, 2, 3]] assert dmp_include([1, 2, 3], [1], 0, ZZ) == [[1], [2], [3]] assert dmp_include([1, 2, 3], [0, 1], 0, ZZ) == [[[1, 2, 3]]] assert dmp_include([1, 2, 3], [1, 2], 0, ZZ) == [[[1]], [[2]], [[3]]] def test_dmp_inject(): R, x,y = ring("x,y", ZZ) K = R.to_domain() assert dmp_inject([], 0, K) == ([[[]]], 2) assert dmp_inject([[]], 1, K) == ([[[[]]]], 3) assert dmp_inject([R(1)], 0, K) == ([[[1]]], 2) assert dmp_inject([[R(1)]], 1, K) == ([[[[1]]]], 3) assert dmp_inject([R(1), 2*x + 3*y + 4], 0, K) == ([[[1]], [[2], [3, 4]]], 2) f = [3*x**2 + 7*x*y + 5*y**2, 2*x, R(0), x*y**2 + 11] g = [[[3], [7, 0], [5, 0, 0]], [[2], []], [[]], [[1, 0, 0], [11]]] assert dmp_inject(f, 0, K) == (g, 2) def test_dmp_eject(): R, x,y = ring("x,y", ZZ) K = R.to_domain() assert dmp_eject([[[]]], 2, K) == [] assert dmp_eject([[[[]]]], 3, K) == [[]] assert dmp_eject([[[1]]], 2, K) == [R(1)] assert dmp_eject([[[[1]]]], 3, K) == [[R(1)]] assert dmp_eject([[[1]], [[2], [3, 4]]], 2, K) == [R(1), 2*x + 3*y + 4] f = [3*x**2 + 7*x*y + 5*y**2, 2*x, R(0), x*y**2 + 11] g = [[[3], [7, 0], [5, 0, 0]], [[2], []], [[]], [[1, 0, 0], [11]]] assert dmp_eject(g, 2, K) == f def test_dup_terms_gcd(): assert dup_terms_gcd([], ZZ) == (0, []) assert dup_terms_gcd([1, 0, 1], ZZ) == (0, [1, 0, 1]) assert dup_terms_gcd([1, 0, 1, 0], ZZ) == (1, [1, 0, 1]) def test_dmp_terms_gcd(): assert dmp_terms_gcd([[]], 1, ZZ) == ((0, 0), [[]]) assert dmp_terms_gcd([1, 0, 1, 0], 0, ZZ) == ((1,), [1, 0, 1]) assert dmp_terms_gcd([[1], [], [1], []], 1, ZZ) == ((1, 0), [[1], [], [1]]) assert dmp_terms_gcd( [[1, 0], [], [1]], 1, ZZ) == ((0, 0), [[1, 0], [], [1]]) assert dmp_terms_gcd( [[1, 0], [1, 0, 0], [], []], 1, ZZ) == ((2, 1), [[1], [1, 0]]) def test_dmp_list_terms(): assert dmp_list_terms([[[]]], 2, ZZ) == [((0, 0, 0), 0)] assert dmp_list_terms([[[1]]], 2, ZZ) == [((0, 0, 0), 1)] assert dmp_list_terms([1, 2, 4, 3, 5], 0, ZZ) == \ [((4,), 1), ((3,), 2), ((2,), 4), ((1,), 3), ((0,), 5)] assert dmp_list_terms([[1], [2, 4], [3, 5, 0]], 1, ZZ) == \ [((2, 0), 1), ((1, 1), 2), ((1, 0), 4), ((0, 2), 3), ((0, 1), 5)] f = [[2, 0, 0, 0], [1, 0, 0], []] assert dmp_list_terms(f, 1, ZZ, order='lex') == [((2, 3), 2), ((1, 2), 1)] assert dmp_list_terms( f, 1, ZZ, order='grlex') == [((2, 3), 2), ((1, 2), 1)] f = [[2, 0, 0, 0], [1, 0, 0, 0, 0, 0], []] assert dmp_list_terms(f, 1, ZZ, order='lex') == [((2, 3), 2), ((1, 5), 1)] assert dmp_list_terms( f, 1, ZZ, order='grlex') == [((1, 5), 1), ((2, 3), 2)] def test_dmp_apply_pairs(): h = lambda a, b: a*b assert dmp_apply_pairs([1, 2, 3], [4, 5, 6], h, [], 0, ZZ) == [4, 10, 18] assert dmp_apply_pairs([2, 3], [4, 5, 6], h, [], 0, ZZ) == [10, 18] assert dmp_apply_pairs([1, 2, 3], [5, 6], h, [], 0, ZZ) == [10, 18] assert dmp_apply_pairs( [[1, 2], [3]], [[4, 5], [6]], h, [], 1, ZZ) == [[4, 10], [18]] assert dmp_apply_pairs( [[1, 2], [3]], [[4], [5, 6]], h, [], 1, ZZ) == [[8], [18]] assert dmp_apply_pairs( [[1], [2, 3]], [[4, 5], [6]], h, [], 1, ZZ) == [[5], [18]] def test_dup_slice(): f = [1, 2, 3, 4] assert dup_slice(f, 0, 0, ZZ) == [] assert dup_slice(f, 0, 1, ZZ) == [4] assert dup_slice(f, 0, 2, ZZ) == [3, 4] assert dup_slice(f, 0, 3, ZZ) == [2, 3, 4] assert dup_slice(f, 0, 4, ZZ) == [1, 2, 3, 4] assert dup_slice(f, 0, 4, ZZ) == f assert dup_slice(f, 0, 9, ZZ) == f assert dup_slice(f, 1, 0, ZZ) == [] assert dup_slice(f, 1, 1, ZZ) == [] assert dup_slice(f, 1, 2, ZZ) == [3, 0] assert dup_slice(f, 1, 3, ZZ) == [2, 3, 0] assert dup_slice(f, 1, 4, ZZ) == [1, 2, 3, 0] assert dup_slice([1, 2], 0, 3, ZZ) == [1, 2] def test_dup_random(): f = dup_random(0, -10, 10, ZZ) assert dup_degree(f) == 0 assert all(-10 <= c <= 10 for c in f) f = dup_random(1, -20, 20, ZZ) assert dup_degree(f) == 1 assert all(-20 <= c <= 20 for c in f) f = dup_random(2, -30, 30, ZZ) assert dup_degree(f) == 2 assert all(-30 <= c <= 30 for c in f) f = dup_random(3, -40, 40, ZZ) assert dup_degree(f) == 3 assert all(-40 <= c <= 40 for c in f)
6ddb08b2a253149095c993513001950d7564efd95dc3dae60067a34bf97028fd
"""Tests of monomial orderings. """ from sympy.polys.orderings import ( monomial_key, lex, grlex, grevlex, ilex, igrlex, LexOrder, InverseOrder, ProductOrder, build_product_order, ) from sympy.abc import x, y, z, t from sympy.core import S from sympy.testing.pytest import raises def test_lex_order(): assert lex((1, 2, 3)) == (1, 2, 3) assert str(lex) == 'lex' assert lex((1, 2, 3)) == lex((1, 2, 3)) assert lex((2, 2, 3)) > lex((1, 2, 3)) assert lex((1, 3, 3)) > lex((1, 2, 3)) assert lex((1, 2, 4)) > lex((1, 2, 3)) assert lex((0, 2, 3)) < lex((1, 2, 3)) assert lex((1, 1, 3)) < lex((1, 2, 3)) assert lex((1, 2, 2)) < lex((1, 2, 3)) assert lex.is_global is True assert lex == LexOrder() assert lex != grlex def test_grlex_order(): assert grlex((1, 2, 3)) == (6, (1, 2, 3)) assert str(grlex) == 'grlex' assert grlex((1, 2, 3)) == grlex((1, 2, 3)) assert grlex((2, 2, 3)) > grlex((1, 2, 3)) assert grlex((1, 3, 3)) > grlex((1, 2, 3)) assert grlex((1, 2, 4)) > grlex((1, 2, 3)) assert grlex((0, 2, 3)) < grlex((1, 2, 3)) assert grlex((1, 1, 3)) < grlex((1, 2, 3)) assert grlex((1, 2, 2)) < grlex((1, 2, 3)) assert grlex((2, 2, 3)) > grlex((1, 2, 4)) assert grlex((1, 3, 3)) > grlex((1, 2, 4)) assert grlex((0, 2, 3)) < grlex((1, 2, 2)) assert grlex((1, 1, 3)) < grlex((1, 2, 2)) assert grlex((0, 1, 1)) > grlex((0, 0, 2)) assert grlex((0, 3, 1)) < grlex((2, 2, 1)) assert grlex.is_global is True def test_grevlex_order(): assert grevlex((1, 2, 3)) == (6, (-3, -2, -1)) assert str(grevlex) == 'grevlex' assert grevlex((1, 2, 3)) == grevlex((1, 2, 3)) assert grevlex((2, 2, 3)) > grevlex((1, 2, 3)) assert grevlex((1, 3, 3)) > grevlex((1, 2, 3)) assert grevlex((1, 2, 4)) > grevlex((1, 2, 3)) assert grevlex((0, 2, 3)) < grevlex((1, 2, 3)) assert grevlex((1, 1, 3)) < grevlex((1, 2, 3)) assert grevlex((1, 2, 2)) < grevlex((1, 2, 3)) assert grevlex((2, 2, 3)) > grevlex((1, 2, 4)) assert grevlex((1, 3, 3)) > grevlex((1, 2, 4)) assert grevlex((0, 2, 3)) < grevlex((1, 2, 2)) assert grevlex((1, 1, 3)) < grevlex((1, 2, 2)) assert grevlex((0, 1, 1)) > grevlex((0, 0, 2)) assert grevlex((0, 3, 1)) < grevlex((2, 2, 1)) assert grevlex.is_global is True def test_InverseOrder(): ilex = InverseOrder(lex) igrlex = InverseOrder(grlex) assert ilex((1, 2, 3)) > ilex((2, 0, 3)) assert igrlex((1, 2, 3)) < igrlex((0, 2, 3)) assert str(ilex) == "ilex" assert str(igrlex) == "igrlex" assert ilex.is_global is False assert igrlex.is_global is False assert ilex != igrlex assert ilex == InverseOrder(LexOrder()) def test_ProductOrder(): P = ProductOrder((grlex, lambda m: m[:2]), (grlex, lambda m: m[2:])) assert P((1, 3, 3, 4, 5)) > P((2, 1, 5, 5, 5)) assert str(P) == "ProductOrder(grlex, grlex)" assert P.is_global is True assert ProductOrder((grlex, None), (ilex, None)).is_global is None assert ProductOrder((igrlex, None), (ilex, None)).is_global is False def test_monomial_key(): assert monomial_key() == lex assert monomial_key('lex') == lex assert monomial_key('grlex') == grlex assert monomial_key('grevlex') == grevlex raises(ValueError, lambda: monomial_key('foo')) raises(ValueError, lambda: monomial_key(1)) M = [x, x**2*z**2, x*y, x**2, S.One, y**2, x**3, y, z, x*y**2*z, x**2*y**2] assert sorted(M, key=monomial_key('lex', [z, y, x])) == \ [S.One, x, x**2, x**3, y, x*y, y**2, x**2*y**2, z, x*y**2*z, x**2*z**2] assert sorted(M, key=monomial_key('grlex', [z, y, x])) == \ [S.One, x, y, z, x**2, x*y, y**2, x**3, x**2*y**2, x*y**2*z, x**2*z**2] assert sorted(M, key=monomial_key('grevlex', [z, y, x])) == \ [S.One, x, y, z, x**2, x*y, y**2, x**3, x**2*y**2, x**2*z**2, x*y**2*z] def test_build_product_order(): assert build_product_order((("grlex", x, y), ("grlex", z, t)), [x, y, z, t])((4, 5, 6, 7)) == \ ((9, (4, 5)), (13, (6, 7))) assert build_product_order((("grlex", x, y), ("grlex", z, t)), [x, y, z, t]) == \ build_product_order((("grlex", x, y), ("grlex", z, t)), [x, y, z, t])
deeb98316ce3f420781b36a61aeaac80cc328824740531b5a42dbefd637a276d
"""Tests for useful utilities for higher level polynomial classes. """ from sympy import (S, Integer, sin, cos, sqrt, symbols, pi, Eq, Integral, exp, Mul) from sympy.testing.pytest import raises from sympy.polys.polyutils import ( _nsort, _sort_gens, _unify_gens, _analyze_gens, _sort_factors, parallel_dict_from_expr, dict_from_expr, ) from sympy.polys.polyerrors import PolynomialError from sympy.polys.domains import ZZ x, y, z, p, q, r, s, t, u, v, w = symbols('x,y,z,p,q,r,s,t,u,v,w') A, B = symbols('A,B', commutative=False) def test__nsort(): # issue 6137 r = S('''[3/2 + sqrt(-14/3 - 2*(-415/216 + 13*I/12)**(1/3) - 4/sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3)) - 61/(18*(-415/216 + 13*I/12)**(1/3)))/2 - sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3))/2, 3/2 - sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3))/2 - sqrt(-14/3 - 2*(-415/216 + 13*I/12)**(1/3) - 4/sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3)) - 61/(18*(-415/216 + 13*I/12)**(1/3)))/2, 3/2 + sqrt(-14/3 - 2*(-415/216 + 13*I/12)**(1/3) + 4/sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3)) - 61/(18*(-415/216 + 13*I/12)**(1/3)))/2 + sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3))/2, 3/2 + sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3))/2 - sqrt(-14/3 - 2*(-415/216 + 13*I/12)**(1/3) + 4/sqrt(-7/3 + 61/(18*(-415/216 + 13*I/12)**(1/3)) + 2*(-415/216 + 13*I/12)**(1/3)) - 61/(18*(-415/216 + 13*I/12)**(1/3)))/2]''') ans = [r[1], r[0], r[-1], r[-2]] assert _nsort(r) == ans assert len(_nsort(r, separated=True)[0]) == 0 b, c, a = exp(-1000), exp(-999), exp(-1001) assert _nsort((b, c, a)) == [a, b, c] def test__sort_gens(): assert _sort_gens([]) == () assert _sort_gens([x]) == (x,) assert _sort_gens([p]) == (p,) assert _sort_gens([q]) == (q,) assert _sort_gens([x, p]) == (x, p) assert _sort_gens([p, x]) == (x, p) assert _sort_gens([q, p]) == (p, q) assert _sort_gens([q, p, x]) == (x, p, q) assert _sort_gens([x, p, q], wrt=x) == (x, p, q) assert _sort_gens([x, p, q], wrt=p) == (p, x, q) assert _sort_gens([x, p, q], wrt=q) == (q, x, p) assert _sort_gens([x, p, q], wrt='x') == (x, p, q) assert _sort_gens([x, p, q], wrt='p') == (p, x, q) assert _sort_gens([x, p, q], wrt='q') == (q, x, p) assert _sort_gens([x, p, q], wrt='x,q') == (x, q, p) assert _sort_gens([x, p, q], wrt='q,x') == (q, x, p) assert _sort_gens([x, p, q], wrt='p,q') == (p, q, x) assert _sort_gens([x, p, q], wrt='q,p') == (q, p, x) assert _sort_gens([x, p, q], wrt='x, q') == (x, q, p) assert _sort_gens([x, p, q], wrt='q, x') == (q, x, p) assert _sort_gens([x, p, q], wrt='p, q') == (p, q, x) assert _sort_gens([x, p, q], wrt='q, p') == (q, p, x) assert _sort_gens([x, p, q], wrt=[x, 'q']) == (x, q, p) assert _sort_gens([x, p, q], wrt=[q, 'x']) == (q, x, p) assert _sort_gens([x, p, q], wrt=[p, 'q']) == (p, q, x) assert _sort_gens([x, p, q], wrt=[q, 'p']) == (q, p, x) assert _sort_gens([x, p, q], wrt=['x', 'q']) == (x, q, p) assert _sort_gens([x, p, q], wrt=['q', 'x']) == (q, x, p) assert _sort_gens([x, p, q], wrt=['p', 'q']) == (p, q, x) assert _sort_gens([x, p, q], wrt=['q', 'p']) == (q, p, x) assert _sort_gens([x, p, q], sort='x > p > q') == (x, p, q) assert _sort_gens([x, p, q], sort='p > x > q') == (p, x, q) assert _sort_gens([x, p, q], sort='p > q > x') == (p, q, x) assert _sort_gens([x, p, q], wrt='x', sort='q > p') == (x, q, p) assert _sort_gens([x, p, q], wrt='p', sort='q > x') == (p, q, x) assert _sort_gens([x, p, q], wrt='q', sort='p > x') == (q, p, x) X = symbols('x0,x1,x2,x10,x11,x12,x20,x21,x22') assert _sort_gens(X) == X def test__unify_gens(): assert _unify_gens([], []) == () assert _unify_gens([x], [x]) == (x,) assert _unify_gens([y], [y]) == (y,) assert _unify_gens([x, y], [x]) == (x, y) assert _unify_gens([x], [x, y]) == (x, y) assert _unify_gens([x, y], [x, y]) == (x, y) assert _unify_gens([y, x], [y, x]) == (y, x) assert _unify_gens([x], [y]) == (x, y) assert _unify_gens([y], [x]) == (y, x) assert _unify_gens([x], [y, x]) == (y, x) assert _unify_gens([y, x], [x]) == (y, x) assert _unify_gens([x, y, z], [x, y, z]) == (x, y, z) assert _unify_gens([z, y, x], [x, y, z]) == (z, y, x) assert _unify_gens([x, y, z], [z, y, x]) == (x, y, z) assert _unify_gens([z, y, x], [z, y, x]) == (z, y, x) assert _unify_gens([x, y, z], [t, x, p, q, z]) == (t, x, y, p, q, z) def test__analyze_gens(): assert _analyze_gens((x, y, z)) == (x, y, z) assert _analyze_gens([x, y, z]) == (x, y, z) assert _analyze_gens(([x, y, z],)) == (x, y, z) assert _analyze_gens(((x, y, z),)) == (x, y, z) def test__sort_factors(): assert _sort_factors([], multiple=True) == [] assert _sort_factors([], multiple=False) == [] F = [[1, 2, 3], [1, 2], [1]] G = [[1], [1, 2], [1, 2, 3]] assert _sort_factors(F, multiple=False) == G F = [[1, 2], [1, 2, 3], [1, 2], [1]] G = [[1], [1, 2], [1, 2], [1, 2, 3]] assert _sort_factors(F, multiple=False) == G F = [[2, 2], [1, 2, 3], [1, 2], [1]] G = [[1], [1, 2], [2, 2], [1, 2, 3]] assert _sort_factors(F, multiple=False) == G F = [([1, 2, 3], 1), ([1, 2], 1), ([1], 1)] G = [([1], 1), ([1, 2], 1), ([1, 2, 3], 1)] assert _sort_factors(F, multiple=True) == G F = [([1, 2], 1), ([1, 2, 3], 1), ([1, 2], 1), ([1], 1)] G = [([1], 1), ([1, 2], 1), ([1, 2], 1), ([1, 2, 3], 1)] assert _sort_factors(F, multiple=True) == G F = [([2, 2], 1), ([1, 2, 3], 1), ([1, 2], 1), ([1], 1)] G = [([1], 1), ([1, 2], 1), ([2, 2], 1), ([1, 2, 3], 1)] assert _sort_factors(F, multiple=True) == G F = [([2, 2], 1), ([1, 2, 3], 1), ([1, 2], 2), ([1], 1)] G = [([1], 1), ([2, 2], 1), ([1, 2], 2), ([1, 2, 3], 1)] assert _sort_factors(F, multiple=True) == G def test__dict_from_expr_if_gens(): assert dict_from_expr( Integer(17), gens=(x,)) == ({(0,): Integer(17)}, (x,)) assert dict_from_expr( Integer(17), gens=(x, y)) == ({(0, 0): Integer(17)}, (x, y)) assert dict_from_expr( Integer(17), gens=(x, y, z)) == ({(0, 0, 0): Integer(17)}, (x, y, z)) assert dict_from_expr( Integer(-17), gens=(x,)) == ({(0,): Integer(-17)}, (x,)) assert dict_from_expr( Integer(-17), gens=(x, y)) == ({(0, 0): Integer(-17)}, (x, y)) assert dict_from_expr(Integer( -17), gens=(x, y, z)) == ({(0, 0, 0): Integer(-17)}, (x, y, z)) assert dict_from_expr( Integer(17)*x, gens=(x,)) == ({(1,): Integer(17)}, (x,)) assert dict_from_expr( Integer(17)*x, gens=(x, y)) == ({(1, 0): Integer(17)}, (x, y)) assert dict_from_expr(Integer( 17)*x, gens=(x, y, z)) == ({(1, 0, 0): Integer(17)}, (x, y, z)) assert dict_from_expr( Integer(17)*x**7, gens=(x,)) == ({(7,): Integer(17)}, (x,)) assert dict_from_expr( Integer(17)*x**7*y, gens=(x, y)) == ({(7, 1): Integer(17)}, (x, y)) assert dict_from_expr(Integer(17)*x**7*y*z**12, gens=( x, y, z)) == ({(7, 1, 12): Integer(17)}, (x, y, z)) assert dict_from_expr(x + 2*y + 3*z, gens=(x,)) == \ ({(1,): Integer(1), (0,): 2*y + 3*z}, (x,)) assert dict_from_expr(x + 2*y + 3*z, gens=(x, y)) == \ ({(1, 0): Integer(1), (0, 1): Integer(2), (0, 0): 3*z}, (x, y)) assert dict_from_expr(x + 2*y + 3*z, gens=(x, y, z)) == \ ({(1, 0, 0): Integer( 1), (0, 1, 0): Integer(2), (0, 0, 1): Integer(3)}, (x, y, z)) assert dict_from_expr(x*y + 2*x*z + 3*y*z, gens=(x,)) == \ ({(1,): y + 2*z, (0,): 3*y*z}, (x,)) assert dict_from_expr(x*y + 2*x*z + 3*y*z, gens=(x, y)) == \ ({(1, 1): Integer(1), (1, 0): 2*z, (0, 1): 3*z}, (x, y)) assert dict_from_expr(x*y + 2*x*z + 3*y*z, gens=(x, y, z)) == \ ({(1, 1, 0): Integer( 1), (1, 0, 1): Integer(2), (0, 1, 1): Integer(3)}, (x, y, z)) assert dict_from_expr(2**y*x, gens=(x,)) == ({(1,): 2**y}, (x,)) assert dict_from_expr(Integral(x, (x, 1, 2)) + x) == ( {(0, 1): 1, (1, 0): 1}, (x, Integral(x, (x, 1, 2)))) raises(PolynomialError, lambda: dict_from_expr(2**y*x, gens=(x, y))) def test__dict_from_expr_no_gens(): assert dict_from_expr(Integer(17)) == ({(): Integer(17)}, ()) assert dict_from_expr(x) == ({(1,): Integer(1)}, (x,)) assert dict_from_expr(y) == ({(1,): Integer(1)}, (y,)) assert dict_from_expr(x*y) == ({(1, 1): Integer(1)}, (x, y)) assert dict_from_expr( x + y) == ({(1, 0): Integer(1), (0, 1): Integer(1)}, (x, y)) assert dict_from_expr(sqrt(2)) == ({(1,): Integer(1)}, (sqrt(2),)) assert dict_from_expr(sqrt(2), greedy=False) == ({(): sqrt(2)}, ()) assert dict_from_expr(x*y, domain=ZZ[x]) == ({(1,): x}, (y,)) assert dict_from_expr(x*y, domain=ZZ[y]) == ({(1,): y}, (x,)) assert dict_from_expr(3*sqrt( 2)*pi*x*y, extension=None) == ({(1, 1, 1, 1): 3}, (x, y, pi, sqrt(2))) assert dict_from_expr(3*sqrt( 2)*pi*x*y, extension=True) == ({(1, 1, 1): 3*sqrt(2)}, (x, y, pi)) assert dict_from_expr(3*sqrt( 2)*pi*x*y, extension=True) == ({(1, 1, 1): 3*sqrt(2)}, (x, y, pi)) f = cos(x)*sin(x) + cos(x)*sin(y) + cos(y)*sin(x) + cos(y)*sin(y) assert dict_from_expr(f) == ({(0, 1, 0, 1): 1, (0, 1, 1, 0): 1, (1, 0, 0, 1): 1, (1, 0, 1, 0): 1}, (cos(x), cos(y), sin(x), sin(y))) def test__parallel_dict_from_expr_if_gens(): assert parallel_dict_from_expr([x + 2*y + 3*z, Integer(7)], gens=(x,)) == \ ([{(1,): Integer(1), (0,): 2*y + 3*z}, {(0,): Integer(7)}], (x,)) def test__parallel_dict_from_expr_no_gens(): assert parallel_dict_from_expr([x*y, Integer(3)]) == \ ([{(1, 1): Integer(1)}, {(0, 0): Integer(3)}], (x, y)) assert parallel_dict_from_expr([x*y, 2*z, Integer(3)]) == \ ([{(1, 1, 0): Integer( 1)}, {(0, 0, 1): Integer(2)}, {(0, 0, 0): Integer(3)}], (x, y, z)) assert parallel_dict_from_expr((Mul(x, x**2, evaluate=False),)) == \ ([{(3,): 1}], (x,)) def test_parallel_dict_from_expr(): assert parallel_dict_from_expr([Eq(x, 1), Eq( x**2, 2)]) == ([{(0,): -Integer(1), (1,): Integer(1)}, {(0,): -Integer(2), (2,): Integer(1)}], (x,)) raises(PolynomialError, lambda: parallel_dict_from_expr([A*B - B*A])) def test_dict_from_expr(): assert dict_from_expr(Eq(x, 1)) == \ ({(0,): -Integer(1), (1,): Integer(1)}, (x,)) raises(PolynomialError, lambda: dict_from_expr(A*B - B*A)) raises(PolynomialError, lambda: dict_from_expr(S.true))
9b833f3d22e5a9c8b8f15bd81a7321353a20c531e2cde685e1a8a2fdc26cbc76
"""Tests for algorithms for computing symbolic roots of polynomials. """ from sympy import (S, symbols, Symbol, Wild, Rational, sqrt, powsimp, sin, cos, pi, I, Interval, re, im, exp, ZZ, Piecewise, acos, root, conjugate) from sympy.polys import Poly, cyclotomic_poly, intervals, nroots, rootof from sympy.polys.polyroots import (root_factors, roots_linear, roots_quadratic, roots_cubic, roots_quartic, roots_cyclotomic, roots_binomial, preprocess_roots, roots) from sympy.polys.orthopolys import legendre_poly from sympy.polys.polyutils import _nsort from sympy.utilities.iterables import cartes from sympy.testing.pytest import raises, slow from sympy.testing.randtest import verify_numerically import mpmath a, b, c, d, e, q, t, x, y, z = symbols('a,b,c,d,e,q,t,x,y,z') def _check(roots): # this is the desired invariant for roots returned # by all_roots. It is trivially true for linear # polynomials. nreal = sum([1 if i.is_real else 0 for i in roots]) assert list(sorted(roots[:nreal])) == list(roots[:nreal]) for ix in range(nreal, len(roots), 2): if not ( roots[ix + 1] == roots[ix] or roots[ix + 1] == conjugate(roots[ix])): return False return True def test_roots_linear(): assert roots_linear(Poly(2*x + 1, x)) == [Rational(-1, 2)] def test_roots_quadratic(): assert roots_quadratic(Poly(2*x**2, x)) == [0, 0] assert roots_quadratic(Poly(2*x**2 + 3*x, x)) == [Rational(-3, 2), 0] assert roots_quadratic(Poly(2*x**2 + 3, x)) == [-I*sqrt(6)/2, I*sqrt(6)/2] assert roots_quadratic(Poly(2*x**2 + 4*x + 3, x)) == [-1 - I*sqrt(2)/2, -1 + I*sqrt(2)/2] _check(Poly(2*x**2 + 4*x + 3, x).all_roots()) f = x**2 + (2*a*e + 2*c*e)/(a - c)*x + (d - b + a*e**2 - c*e**2)/(a - c) assert roots_quadratic(Poly(f, x)) == \ [-e*(a + c)/(a - c) - sqrt((a*b + c*d - a*d - b*c + 4*a*c*e**2))/(a - c), -e*(a + c)/(a - c) + sqrt((a*b + c*d - a*d - b*c + 4*a*c*e**2))/(a - c)] # check for simplification f = Poly(y*x**2 - 2*x - 2*y, x) assert roots_quadratic(f) == \ [-sqrt(2*y**2 + 1)/y + 1/y, sqrt(2*y**2 + 1)/y + 1/y] f = Poly(x**2 + (-y**2 - 2)*x + y**2 + 1, x) assert roots_quadratic(f) == \ [1,y**2 + 1] f = Poly(sqrt(2)*x**2 - 1, x) r = roots_quadratic(f) assert r == _nsort(r) # issue 8255 f = Poly(-24*x**2 - 180*x + 264) assert [w.n(2) for w in f.all_roots(radicals=True)] == \ [w.n(2) for w in f.all_roots(radicals=False)] for _a, _b, _c in cartes((-2, 2), (-2, 2), (0, -1)): f = Poly(_a*x**2 + _b*x + _c) roots = roots_quadratic(f) assert roots == _nsort(roots) def test_issue_7724(): eq = Poly(x**4*I + x**2 + I, x) assert roots(eq) == { sqrt(I/2 + sqrt(5)*I/2): 1, sqrt(-sqrt(5)*I/2 + I/2): 1, -sqrt(I/2 + sqrt(5)*I/2): 1, -sqrt(-sqrt(5)*I/2 + I/2): 1} def test_issue_8438(): p = Poly([1, y, -2, -3], x).as_expr() roots = roots_cubic(Poly(p, x), x) z = Rational(-3, 2) - I*Rational(7, 2) # this will fail in code given in commit msg post = [r.subs(y, z) for r in roots] assert set(post) == \ set(roots_cubic(Poly(p.subs(y, z), x))) # /!\ if p is not made an expression, this is *very* slow assert all(p.subs({y: z, x: i}).n(2, chop=True) == 0 for i in post) def test_issue_8285(): roots = (Poly(4*x**8 - 1, x)*Poly(x**2 + 1)).all_roots() assert _check(roots) f = Poly(x**4 + 5*x**2 + 6, x) ro = [rootof(f, i) for i in range(4)] roots = Poly(x**4 + 5*x**2 + 6, x).all_roots() assert roots == ro assert _check(roots) # more than 2 complex roots from which to identify the # imaginary ones roots = Poly(2*x**8 - 1).all_roots() assert _check(roots) assert len(Poly(2*x**10 - 1).all_roots()) == 10 # doesn't fail def test_issue_8289(): roots = (Poly(x**2 + 2)*Poly(x**4 + 2)).all_roots() assert _check(roots) roots = Poly(x**6 + 3*x**3 + 2, x).all_roots() assert _check(roots) roots = Poly(x**6 - x + 1).all_roots() assert _check(roots) # all imaginary roots with multiplicity of 2 roots = Poly(x**4 + 4*x**2 + 4, x).all_roots() assert _check(roots) def test_issue_14291(): assert Poly(((x - 1)**2 + 1)*((x - 1)**2 + 2)*(x - 1) ).all_roots() == [1, 1 - I, 1 + I, 1 - sqrt(2)*I, 1 + sqrt(2)*I] p = x**4 + 10*x**2 + 1 ans = [rootof(p, i) for i in range(4)] assert Poly(p).all_roots() == ans _check(ans) def test_issue_13340(): eq = Poly(y**3 + exp(x)*y + x, y, domain='EX') roots_d = roots(eq) assert len(roots_d) == 3 def test_issue_14522(): eq = Poly(x**4 + x**3*(16 + 32*I) + x**2*(-285 + 386*I) + x*(-2824 - 448*I) - 2058 - 6053*I, x) roots_eq = roots(eq) assert all(eq(r) == 0 for r in roots_eq) def test_issue_15076(): sol = roots_quartic(Poly(t**4 - 6*t**2 + t/x - 3, t)) assert sol[0].has(x) def test_issue_16589(): eq = Poly(x**4 - 8*sqrt(2)*x**3 + 4*x**3 - 64*sqrt(2)*x**2 + 1024*x, x) roots_eq = roots(eq) assert 0 in roots_eq def test_roots_cubic(): assert roots_cubic(Poly(2*x**3, x)) == [0, 0, 0] assert roots_cubic(Poly(x**3 - 3*x**2 + 3*x - 1, x)) == [1, 1, 1] assert roots_cubic(Poly(x**3 + 1, x)) == \ [-1, S.Half - I*sqrt(3)/2, S.Half + I*sqrt(3)/2] assert roots_cubic(Poly(2*x**3 - 3*x**2 - 3*x - 1, x))[0] == \ S.Half + 3**Rational(1, 3)/2 + 3**Rational(2, 3)/2 eq = -x**3 + 2*x**2 + 3*x - 2 assert roots(eq, trig=True, multiple=True) == \ roots_cubic(Poly(eq, x), trig=True) == [ Rational(2, 3) + 2*sqrt(13)*cos(acos(8*sqrt(13)/169)/3)/3, -2*sqrt(13)*sin(-acos(8*sqrt(13)/169)/3 + pi/6)/3 + Rational(2, 3), -2*sqrt(13)*cos(-acos(8*sqrt(13)/169)/3 + pi/3)/3 + Rational(2, 3), ] def test_roots_quartic(): assert roots_quartic(Poly(x**4, x)) == [0, 0, 0, 0] assert roots_quartic(Poly(x**4 + x**3, x)) in [ [-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, -1] ] assert roots_quartic(Poly(x**4 - x**3, x)) in [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ] lhs = roots_quartic(Poly(x**4 + x, x)) rhs = [S.Half + I*sqrt(3)/2, S.Half - I*sqrt(3)/2, S.Zero, -S.One] assert sorted(lhs, key=hash) == sorted(rhs, key=hash) # test of all branches of roots quartic for i, (a, b, c, d) in enumerate([(1, 2, 3, 0), (3, -7, -9, 9), (1, 2, 3, 4), (1, 2, 3, 4), (-7, -3, 3, -6), (-3, 5, -6, -4), (6, -5, -10, -3)]): if i == 2: c = -a*(a**2/S(8) - b/S(2)) elif i == 3: d = a*(a*(a**2*Rational(3, 256) - b/S(16)) + c/S(4)) eq = x**4 + a*x**3 + b*x**2 + c*x + d ans = roots_quartic(Poly(eq, x)) assert all(eq.subs(x, ai).n(chop=True) == 0 for ai in ans) # not all symbolic quartics are unresolvable eq = Poly(q*x + q/4 + x**4 + x**3 + 2*x**2 - Rational(1, 3), x) sol = roots_quartic(eq) assert all(verify_numerically(eq.subs(x, i), 0) for i in sol) z = symbols('z', negative=True) eq = x**4 + 2*x**3 + 3*x**2 + x*(z + 11) + 5 zans = roots_quartic(Poly(eq, x)) assert all([verify_numerically(eq.subs(((x, i), (z, -1))), 0) for i in zans]) # but some are (see also issue 4989) # it's ok if the solution is not Piecewise, but the tests below should pass eq = Poly(y*x**4 + x**3 - x + z, x) ans = roots_quartic(eq) assert all(type(i) == Piecewise for i in ans) reps = ( dict(y=Rational(-1, 3), z=Rational(-1, 4)), # 4 real dict(y=Rational(-1, 3), z=Rational(-1, 2)), # 2 real dict(y=Rational(-1, 3), z=-2)) # 0 real for rep in reps: sol = roots_quartic(Poly(eq.subs(rep), x)) assert all([verify_numerically(w.subs(rep) - s, 0) for w, s in zip(ans, sol)]) def test_roots_cyclotomic(): assert roots_cyclotomic(cyclotomic_poly(1, x, polys=True)) == [1] assert roots_cyclotomic(cyclotomic_poly(2, x, polys=True)) == [-1] assert roots_cyclotomic(cyclotomic_poly( 3, x, polys=True)) == [Rational(-1, 2) - I*sqrt(3)/2, Rational(-1, 2) + I*sqrt(3)/2] assert roots_cyclotomic(cyclotomic_poly(4, x, polys=True)) == [-I, I] assert roots_cyclotomic(cyclotomic_poly( 6, x, polys=True)) == [S.Half - I*sqrt(3)/2, S.Half + I*sqrt(3)/2] assert roots_cyclotomic(cyclotomic_poly(7, x, polys=True)) == [ -cos(pi/7) - I*sin(pi/7), -cos(pi/7) + I*sin(pi/7), -cos(pi*Rational(3, 7)) - I*sin(pi*Rational(3, 7)), -cos(pi*Rational(3, 7)) + I*sin(pi*Rational(3, 7)), cos(pi*Rational(2, 7)) - I*sin(pi*Rational(2, 7)), cos(pi*Rational(2, 7)) + I*sin(pi*Rational(2, 7)), ] assert roots_cyclotomic(cyclotomic_poly(8, x, polys=True)) == [ -sqrt(2)/2 - I*sqrt(2)/2, -sqrt(2)/2 + I*sqrt(2)/2, sqrt(2)/2 - I*sqrt(2)/2, sqrt(2)/2 + I*sqrt(2)/2, ] assert roots_cyclotomic(cyclotomic_poly(12, x, polys=True)) == [ -sqrt(3)/2 - I/2, -sqrt(3)/2 + I/2, sqrt(3)/2 - I/2, sqrt(3)/2 + I/2, ] assert roots_cyclotomic( cyclotomic_poly(1, x, polys=True), factor=True) == [1] assert roots_cyclotomic( cyclotomic_poly(2, x, polys=True), factor=True) == [-1] assert roots_cyclotomic(cyclotomic_poly(3, x, polys=True), factor=True) == \ [-root(-1, 3), -1 + root(-1, 3)] assert roots_cyclotomic(cyclotomic_poly(4, x, polys=True), factor=True) == \ [-I, I] assert roots_cyclotomic(cyclotomic_poly(5, x, polys=True), factor=True) == \ [-root(-1, 5), -root(-1, 5)**3, root(-1, 5)**2, -1 - root(-1, 5)**2 + root(-1, 5) + root(-1, 5)**3] assert roots_cyclotomic(cyclotomic_poly(6, x, polys=True), factor=True) == \ [1 - root(-1, 3), root(-1, 3)] def test_roots_binomial(): assert roots_binomial(Poly(5*x, x)) == [0] assert roots_binomial(Poly(5*x**4, x)) == [0, 0, 0, 0] assert roots_binomial(Poly(5*x + 2, x)) == [Rational(-2, 5)] A = 10**Rational(3, 4)/10 assert roots_binomial(Poly(5*x**4 + 2, x)) == \ [-A - A*I, -A + A*I, A - A*I, A + A*I] _check(roots_binomial(Poly(x**8 - 2))) a1 = Symbol('a1', nonnegative=True) b1 = Symbol('b1', nonnegative=True) r0 = roots_quadratic(Poly(a1*x**2 + b1, x)) r1 = roots_binomial(Poly(a1*x**2 + b1, x)) assert powsimp(r0[0]) == powsimp(r1[0]) assert powsimp(r0[1]) == powsimp(r1[1]) for a, b, s, n in cartes((1, 2), (1, 2), (-1, 1), (2, 3, 4, 5)): if a == b and a != 1: # a == b == 1 is sufficient continue p = Poly(a*x**n + s*b) ans = roots_binomial(p) assert ans == _nsort(ans) # issue 8813 assert roots(Poly(2*x**3 - 16*y**3, x)) == { 2*y*(Rational(-1, 2) - sqrt(3)*I/2): 1, 2*y: 1, 2*y*(Rational(-1, 2) + sqrt(3)*I/2): 1} def test_roots_preprocessing(): f = a*y*x**2 + y - b coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 1 assert poly == Poly(a*y*x**2 + y - b, x) f = c**3*x**3 + c**2*x**2 + c*x + a coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 1/c assert poly == Poly(x**3 + x**2 + x + a, x) f = c**3*x**3 + c**2*x**2 + a coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 1/c assert poly == Poly(x**3 + x**2 + a, x) f = c**3*x**3 + c*x + a coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 1/c assert poly == Poly(x**3 + x + a, x) f = c**3*x**3 + a coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 1/c assert poly == Poly(x**3 + a, x) E, F, J, L = symbols("E,F,J,L") f = -21601054687500000000*E**8*J**8/L**16 + \ 508232812500000000*F*x*E**7*J**7/L**14 - \ 4269543750000000*E**6*F**2*J**6*x**2/L**12 + \ 16194716250000*E**5*F**3*J**5*x**3/L**10 - \ 27633173750*E**4*F**4*J**4*x**4/L**8 + \ 14840215*E**3*F**5*J**3*x**5/L**6 + \ 54794*E**2*F**6*J**2*x**6/(5*L**4) - \ 1153*E*J*F**7*x**7/(80*L**2) + \ 633*F**8*x**8/160000 coeff, poly = preprocess_roots(Poly(f, x)) assert coeff == 20*E*J/(F*L**2) assert poly == 633*x**8 - 115300*x**7 + 4383520*x**6 + 296804300*x**5 - 27633173750*x**4 + \ 809735812500*x**3 - 10673859375000*x**2 + 63529101562500*x - 135006591796875 f = Poly(-y**2 + x**2*exp(x), y, domain=ZZ[x, exp(x)]) g = Poly(-y**2 + exp(x), y, domain=ZZ[exp(x)]) assert preprocess_roots(f) == (x, g) def test_roots0(): assert roots(1, x) == {} assert roots(x, x) == {S.Zero: 1} assert roots(x**9, x) == {S.Zero: 9} assert roots(((x - 2)*(x + 3)*(x - 4)).expand(), x) == {-S(3): 1, S(2): 1, S(4): 1} assert roots(2*x + 1, x) == {Rational(-1, 2): 1} assert roots((2*x + 1)**2, x) == {Rational(-1, 2): 2} assert roots((2*x + 1)**5, x) == {Rational(-1, 2): 5} assert roots((2*x + 1)**10, x) == {Rational(-1, 2): 10} assert roots(x**4 - 1, x) == {I: 1, S.One: 1, -S.One: 1, -I: 1} assert roots((x**4 - 1)**2, x) == {I: 2, S.One: 2, -S.One: 2, -I: 2} assert roots(((2*x - 3)**2).expand(), x) == {Rational( 3, 2): 2} assert roots(((2*x + 3)**2).expand(), x) == {Rational(-3, 2): 2} assert roots(((2*x - 3)**3).expand(), x) == {Rational( 3, 2): 3} assert roots(((2*x + 3)**3).expand(), x) == {Rational(-3, 2): 3} assert roots(((2*x - 3)**5).expand(), x) == {Rational( 3, 2): 5} assert roots(((2*x + 3)**5).expand(), x) == {Rational(-3, 2): 5} assert roots(((a*x - b)**5).expand(), x) == { b/a: 5} assert roots(((a*x + b)**5).expand(), x) == {-b/a: 5} assert roots(x**2 + (-a - 1)*x + a, x) == {a: 1, S.One: 1} assert roots(x**4 - 2*x**2 + 1, x) == {S.One: 2, S.NegativeOne: 2} assert roots(x**6 - 4*x**4 + 4*x**3 - x**2, x) == \ {S.One: 2, -1 - sqrt(2): 1, S.Zero: 2, -1 + sqrt(2): 1} assert roots(x**8 - 1, x) == { sqrt(2)/2 + I*sqrt(2)/2: 1, sqrt(2)/2 - I*sqrt(2)/2: 1, -sqrt(2)/2 + I*sqrt(2)/2: 1, -sqrt(2)/2 - I*sqrt(2)/2: 1, S.One: 1, -S.One: 1, I: 1, -I: 1 } f = -2016*x**2 - 5616*x**3 - 2056*x**4 + 3324*x**5 + 2176*x**6 - \ 224*x**7 - 384*x**8 - 64*x**9 assert roots(f) == {S.Zero: 2, -S(2): 2, S(2): 1, Rational(-7, 2): 1, Rational(-3, 2): 1, Rational(-1, 2): 1, Rational(3, 2): 1} assert roots((a + b + c)*x - (a + b + c + d), x) == {(a + b + c + d)/(a + b + c): 1} assert roots(x**3 + x**2 - x + 1, x, cubics=False) == {} assert roots(((x - 2)*( x + 3)*(x - 4)).expand(), x, cubics=False) == {-S(3): 1, S(2): 1, S(4): 1} assert roots(((x - 2)*(x + 3)*(x - 4)*(x - 5)).expand(), x, cubics=False) == \ {-S(3): 1, S(2): 1, S(4): 1, S(5): 1} assert roots(x**3 + 2*x**2 + 4*x + 8, x) == {-S(2): 1, -2*I: 1, 2*I: 1} assert roots(x**3 + 2*x**2 + 4*x + 8, x, cubics=True) == \ {-2*I: 1, 2*I: 1, -S(2): 1} assert roots((x**2 - x)*(x**3 + 2*x**2 + 4*x + 8), x ) == \ {S.One: 1, S.Zero: 1, -S(2): 1, -2*I: 1, 2*I: 1} r1_2, r1_3 = S.Half, Rational(1, 3) x0 = (3*sqrt(33) + 19)**r1_3 x1 = 4/x0/3 x2 = x0/3 x3 = sqrt(3)*I/2 x4 = x3 - r1_2 x5 = -x3 - r1_2 assert roots(x**3 + x**2 - x + 1, x, cubics=True) == { -x1 - x2 - r1_3: 1, -x1/x4 - x2*x4 - r1_3: 1, -x1/x5 - x2*x5 - r1_3: 1, } f = (x**2 + 2*x + 3).subs(x, 2*x**2 + 3*x).subs(x, 5*x - 4) r13_20, r1_20 = [ Rational(*r) for r in ((13, 20), (1, 20)) ] s2 = sqrt(2) assert roots(f, x) == { r13_20 + r1_20*sqrt(1 - 8*I*s2): 1, r13_20 - r1_20*sqrt(1 - 8*I*s2): 1, r13_20 + r1_20*sqrt(1 + 8*I*s2): 1, r13_20 - r1_20*sqrt(1 + 8*I*s2): 1, } f = x**4 + x**3 + x**2 + x + 1 r1_4, r1_8, r5_8 = [ Rational(*r) for r in ((1, 4), (1, 8), (5, 8)) ] assert roots(f, x) == { -r1_4 + r1_4*5**r1_2 + I*(r5_8 + r1_8*5**r1_2)**r1_2: 1, -r1_4 + r1_4*5**r1_2 - I*(r5_8 + r1_8*5**r1_2)**r1_2: 1, -r1_4 - r1_4*5**r1_2 + I*(r5_8 - r1_8*5**r1_2)**r1_2: 1, -r1_4 - r1_4*5**r1_2 - I*(r5_8 - r1_8*5**r1_2)**r1_2: 1, } f = z**3 + (-2 - y)*z**2 + (1 + 2*y - 2*x**2)*z - y + 2*x**2 assert roots(f, z) == { S.One: 1, S.Half + S.Half*y + S.Half*sqrt(1 - 2*y + y**2 + 8*x**2): 1, S.Half + S.Half*y - S.Half*sqrt(1 - 2*y + y**2 + 8*x**2): 1, } assert roots(a*b*c*x**3 + 2*x**2 + 4*x + 8, x, cubics=False) == {} assert roots(a*b*c*x**3 + 2*x**2 + 4*x + 8, x, cubics=True) != {} assert roots(x**4 - 1, x, filter='Z') == {S.One: 1, -S.One: 1} assert roots(x**4 - 1, x, filter='I') == {I: 1, -I: 1} assert roots((x - 1)*(x + 1), x) == {S.One: 1, -S.One: 1} assert roots( (x - 1)*(x + 1), x, predicate=lambda r: r.is_positive) == {S.One: 1} assert roots(x**4 - 1, x, filter='Z', multiple=True) == [-S.One, S.One] assert roots(x**4 - 1, x, filter='I', multiple=True) == [I, -I] ar, br = symbols('a, b', real=True) p = x**2*(ar-br)**2 + 2*x*(br-ar) + 1 assert roots(p, x, filter='R') == {1/(ar - br): 2} assert roots(x**3, x, multiple=True) == [S.Zero, S.Zero, S.Zero] assert roots(1234, x, multiple=True) == [] f = x**6 - x**5 + x**4 - x**3 + x**2 - x + 1 assert roots(f) == { -I*sin(pi/7) + cos(pi/7): 1, -I*sin(pi*Rational(2, 7)) - cos(pi*Rational(2, 7)): 1, -I*sin(pi*Rational(3, 7)) + cos(pi*Rational(3, 7)): 1, I*sin(pi/7) + cos(pi/7): 1, I*sin(pi*Rational(2, 7)) - cos(pi*Rational(2, 7)): 1, I*sin(pi*Rational(3, 7)) + cos(pi*Rational(3, 7)): 1, } g = ((x**2 + 1)*f**2).expand() assert roots(g) == { -I*sin(pi/7) + cos(pi/7): 2, -I*sin(pi*Rational(2, 7)) - cos(pi*Rational(2, 7)): 2, -I*sin(pi*Rational(3, 7)) + cos(pi*Rational(3, 7)): 2, I*sin(pi/7) + cos(pi/7): 2, I*sin(pi*Rational(2, 7)) - cos(pi*Rational(2, 7)): 2, I*sin(pi*Rational(3, 7)) + cos(pi*Rational(3, 7)): 2, -I: 1, I: 1, } r = roots(x**3 + 40*x + 64) real_root = [rx for rx in r if rx.is_real][0] cr = 108 + 6*sqrt(1074) assert real_root == -2*root(cr, 3)/3 + 20/root(cr, 3) eq = Poly((7 + 5*sqrt(2))*x**3 + (-6 - 4*sqrt(2))*x**2 + (-sqrt(2) - 1)*x + 2, x, domain='EX') assert roots(eq) == {-1 + sqrt(2): 1, -2 + 2*sqrt(2): 1, -sqrt(2) + 1: 1} eq = Poly(41*x**5 + 29*sqrt(2)*x**5 - 153*x**4 - 108*sqrt(2)*x**4 + 175*x**3 + 125*sqrt(2)*x**3 - 45*x**2 - 30*sqrt(2)*x**2 - 26*sqrt(2)*x - 26*x + 24, x, domain='EX') assert roots(eq) == {-sqrt(2) + 1: 1, -2 + 2*sqrt(2): 1, -1 + sqrt(2): 1, -4 + 4*sqrt(2): 1, -3 + 3*sqrt(2): 1} eq = Poly(x**3 - 2*x**2 + 6*sqrt(2)*x**2 - 8*sqrt(2)*x + 23*x - 14 + 14*sqrt(2), x, domain='EX') assert roots(eq) == {-2*sqrt(2) + 2: 1, -2*sqrt(2) + 1: 1, -2*sqrt(2) - 1: 1} assert roots(Poly((x + sqrt(2))**3 - 7, x, domain='EX')) == \ {-sqrt(2) - root(7, 3)/2 - sqrt(3)*root(7, 3)*I/2: 1, -sqrt(2) - root(7, 3)/2 + sqrt(3)*root(7, 3)*I/2: 1, -sqrt(2) + root(7, 3): 1} def test_roots_slow(): """Just test that calculating these roots does not hang. """ a, b, c, d, x = symbols("a,b,c,d,x") f1 = x**2*c + (a/b) + x*c*d - a f2 = x**2*(a + b*(c - d)*a) + x*a*b*c/(b*d - d) + (a*d - c/d) assert list(roots(f1, x).values()) == [1, 1] assert list(roots(f2, x).values()) == [1, 1] (zz, yy, xx, zy, zx, yx, k) = symbols("zz,yy,xx,zy,zx,yx,k") e1 = (zz - k)*(yy - k)*(xx - k) + zy*yx*zx + zx - zy - yx e2 = (zz - k)*yx*yx + zx*(yy - k)*zx + zy*zy*(xx - k) assert list(roots(e1 - e2, k).values()) == [1, 1, 1] f = x**3 + 2*x**2 + 8 R = list(roots(f).keys()) assert not any(i for i in [f.subs(x, ri).n(chop=True) for ri in R]) def test_roots_inexact(): R1 = roots(x**2 + x + 1, x, multiple=True) R2 = roots(x**2 + x + 1.0, x, multiple=True) for r1, r2 in zip(R1, R2): assert abs(r1 - r2) < 1e-12 f = x**4 + 3.0*sqrt(2.0)*x**3 - (78.0 + 24.0*sqrt(3.0))*x**2 \ + 144.0*(2*sqrt(3.0) + 9.0) R1 = roots(f, multiple=True) R2 = (-12.7530479110482, -3.85012393732929, 4.89897948556636, 7.46155167569183) for r1, r2 in zip(R1, R2): assert abs(r1 - r2) < 1e-10 def test_roots_preprocessed(): E, F, J, L = symbols("E,F,J,L") f = -21601054687500000000*E**8*J**8/L**16 + \ 508232812500000000*F*x*E**7*J**7/L**14 - \ 4269543750000000*E**6*F**2*J**6*x**2/L**12 + \ 16194716250000*E**5*F**3*J**5*x**3/L**10 - \ 27633173750*E**4*F**4*J**4*x**4/L**8 + \ 14840215*E**3*F**5*J**3*x**5/L**6 + \ 54794*E**2*F**6*J**2*x**6/(5*L**4) - \ 1153*E*J*F**7*x**7/(80*L**2) + \ 633*F**8*x**8/160000 assert roots(f, x) == {} R1 = roots(f.evalf(), x, multiple=True) R2 = [-1304.88375606366, 97.1168816800648, 186.946430171876, 245.526792947065, 503.441004174773, 791.549343830097, 1273.16678129348, 1850.10650616851] w = Wild('w') p = w*E*J/(F*L**2) assert len(R1) == len(R2) for r1, r2 in zip(R1, R2): match = r1.match(p) assert match is not None and abs(match[w] - r2) < 1e-10 def test_roots_mixed(): f = -1936 - 5056*x - 7592*x**2 + 2704*x**3 - 49*x**4 _re, _im = intervals(f, all=True) _nroots = nroots(f) _sroots = roots(f, multiple=True) _re = [ Interval(a, b) for (a, b), _ in _re ] _im = [ Interval(re(a), re(b))*Interval(im(a), im(b)) for (a, b), _ in _im ] _intervals = _re + _im _sroots = [ r.evalf() for r in _sroots ] _nroots = sorted(_nroots, key=lambda x: x.sort_key()) _sroots = sorted(_sroots, key=lambda x: x.sort_key()) for _roots in (_nroots, _sroots): for i, r in zip(_intervals, _roots): if r.is_real: assert r in i else: assert (re(r), im(r)) in i def test_root_factors(): assert root_factors(Poly(1, x)) == [Poly(1, x)] assert root_factors(Poly(x, x)) == [Poly(x, x)] assert root_factors(x**2 - 1, x) == [x + 1, x - 1] assert root_factors(x**2 - y, x) == [x - sqrt(y), x + sqrt(y)] assert root_factors((x**4 - 1)**2) == \ [x + 1, x + 1, x - 1, x - 1, x - I, x - I, x + I, x + I] assert root_factors(Poly(x**4 - 1, x), filter='Z') == \ [Poly(x + 1, x), Poly(x - 1, x), Poly(x**2 + 1, x)] assert root_factors(8*x**2 + 12*x**4 + 6*x**6 + x**8, x, filter='Q') == \ [x, x, x**6 + 6*x**4 + 12*x**2 + 8] @slow def test_nroots1(): n = 64 p = legendre_poly(n, x, polys=True) raises(mpmath.mp.NoConvergence, lambda: p.nroots(n=3, maxsteps=5)) roots = p.nroots(n=3) # The order of roots matters. They are ordered from smallest to the # largest. assert [str(r) for r in roots] == \ ['-0.999', '-0.996', '-0.991', '-0.983', '-0.973', '-0.961', '-0.946', '-0.930', '-0.911', '-0.889', '-0.866', '-0.841', '-0.813', '-0.784', '-0.753', '-0.720', '-0.685', '-0.649', '-0.611', '-0.572', '-0.531', '-0.489', '-0.446', '-0.402', '-0.357', '-0.311', '-0.265', '-0.217', '-0.170', '-0.121', '-0.0730', '-0.0243', '0.0243', '0.0730', '0.121', '0.170', '0.217', '0.265', '0.311', '0.357', '0.402', '0.446', '0.489', '0.531', '0.572', '0.611', '0.649', '0.685', '0.720', '0.753', '0.784', '0.813', '0.841', '0.866', '0.889', '0.911', '0.930', '0.946', '0.961', '0.973', '0.983', '0.991', '0.996', '0.999'] def test_nroots2(): p = Poly(x**5 + 3*x + 1, x) roots = p.nroots(n=3) # The order of roots matters. The roots are ordered by their real # components (if they agree, then by their imaginary components), # with real roots appearing first. assert [str(r) for r in roots] == \ ['-0.332', '-0.839 - 0.944*I', '-0.839 + 0.944*I', '1.01 - 0.937*I', '1.01 + 0.937*I'] roots = p.nroots(n=5) assert [str(r) for r in roots] == \ ['-0.33199', '-0.83907 - 0.94385*I', '-0.83907 + 0.94385*I', '1.0051 - 0.93726*I', '1.0051 + 0.93726*I'] def test_roots_composite(): assert len(roots(Poly(y**3 + y**2*sqrt(x) + y + x, y, composite=True))) == 3
e8dcd28d6e5d8a97570e1cd6c91d8b235f7b246422c444724867d3b0b687e65e
""" Computations with modules over polynomial rings. This module implements various classes that encapsulate groebner basis computations for modules. Most of them should not be instantiated by hand. Instead, use the constructing routines on objects you already have. For example, to construct a free module over ``QQ[x, y]``, call ``QQ[x, y].free_module(rank)`` instead of the ``FreeModule`` constructor. In fact ``FreeModule`` is an abstract base class that should not be instantiated, the ``free_module`` method instead returns the implementing class ``FreeModulePolyRing``. In general, the abstract base classes implement most functionality in terms of a few non-implemented methods. The concrete base classes supply only these non-implemented methods. They may also supply new implementations of the convenience methods, for example if there are faster algorithms available. """ from __future__ import print_function, division from copy import copy from sympy.core.compatibility import iterable, reduce from sympy.polys.agca.ideals import Ideal from sympy.polys.domains.field import Field from sympy.polys.orderings import ProductOrder, monomial_key from sympy.polys.polyerrors import CoercionFailed from sympy.core.basic import _aresame # TODO # - module saturation # - module quotient/intersection for quotient rings # - free resoltutions / syzygies # - finding small/minimal generating sets # - ... ########################################################################## ## Abstract base classes ################################################# ########################################################################## class Module(object): """ Abstract base class for modules. Do not instantiate - use ring explicit constructors instead: >>> from sympy import QQ >>> from sympy.abc import x >>> QQ.old_poly_ring(x).free_module(2) QQ[x]**2 Attributes: - dtype - type of elements - ring - containing ring Non-implemented methods: - submodule - quotient_module - is_zero - is_submodule - multiply_ideal The method convert likely needs to be changed in subclasses. """ def __init__(self, ring): self.ring = ring def convert(self, elem, M=None): """ Convert ``elem`` into internal representation of this module. If ``M`` is not None, it should be a module containing it. """ if not isinstance(elem, self.dtype): raise CoercionFailed return elem def submodule(self, *gens): """Generate a submodule.""" raise NotImplementedError def quotient_module(self, other): """Generate a quotient module.""" raise NotImplementedError def __div__(self, e): if not isinstance(e, Module): e = self.submodule(*e) return self.quotient_module(e) __truediv__ = __div__ def contains(self, elem): """Return True if ``elem`` is an element of this module.""" try: self.convert(elem) return True except CoercionFailed: return False def __contains__(self, elem): return self.contains(elem) def subset(self, other): """ Returns True if ``other`` is is a subset of ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.subset([(1, x), (x, 2)]) True >>> F.subset([(1/x, x), (x, 2)]) False """ return all(self.contains(x) for x in other) def __eq__(self, other): return self.is_submodule(other) and other.is_submodule(self) def __ne__(self, other): return not (self == other) def is_zero(self): """Returns True if ``self`` is a zero module.""" raise NotImplementedError def is_submodule(self, other): """Returns True if ``other`` is a submodule of ``self``.""" raise NotImplementedError def multiply_ideal(self, other): """ Multiply ``self`` by the ideal ``other``. """ raise NotImplementedError def __mul__(self, e): if not isinstance(e, Ideal): try: e = self.ring.ideal(e) except (CoercionFailed, NotImplementedError): return NotImplemented return self.multiply_ideal(e) __rmul__ = __mul__ def identity_hom(self): """Return the identity homomorphism on ``self``.""" raise NotImplementedError class ModuleElement(object): """ Base class for module element wrappers. Use this class to wrap primitive data types as module elements. It stores a reference to the containing module, and implements all the arithmetic operators. Attributes: - module - containing module - data - internal data Methods that likely need change in subclasses: - add - mul - div - eq """ def __init__(self, module, data): self.module = module self.data = data def add(self, d1, d2): """Add data ``d1`` and ``d2``.""" return d1 + d2 def mul(self, m, d): """Multiply module data ``m`` by coefficient d.""" return m * d def div(self, m, d): """Divide module data ``m`` by coefficient d.""" return m / d def eq(self, d1, d2): """Return true if d1 and d2 represent the same element.""" return d1 == d2 def __add__(self, om): if not isinstance(om, self.__class__) or om.module != self.module: try: om = self.module.convert(om) except CoercionFailed: return NotImplemented return self.__class__(self.module, self.add(self.data, om.data)) __radd__ = __add__ def __neg__(self): return self.__class__(self.module, self.mul(self.data, self.module.ring.convert(-1))) def __sub__(self, om): if not isinstance(om, self.__class__) or om.module != self.module: try: om = self.module.convert(om) except CoercionFailed: return NotImplemented return self.__add__(-om) def __rsub__(self, om): return (-self).__add__(om) def __mul__(self, o): if not isinstance(o, self.module.ring.dtype): try: o = self.module.ring.convert(o) except CoercionFailed: return NotImplemented return self.__class__(self.module, self.mul(self.data, o)) __rmul__ = __mul__ def __div__(self, o): if not isinstance(o, self.module.ring.dtype): try: o = self.module.ring.convert(o) except CoercionFailed: return NotImplemented return self.__class__(self.module, self.div(self.data, o)) __truediv__ = __div__ def __eq__(self, om): if not isinstance(om, self.__class__) or om.module != self.module: try: om = self.module.convert(om) except CoercionFailed: return False return self.eq(self.data, om.data) def __ne__(self, om): return not self == om ########################################################################## ## Free Modules ########################################################## ########################################################################## class FreeModuleElement(ModuleElement): """Element of a free module. Data stored as a tuple.""" def add(self, d1, d2): return tuple(x + y for x, y in zip(d1, d2)) def mul(self, d, p): return tuple(x * p for x in d) def div(self, d, p): return tuple(x / p for x in d) def __repr__(self): from sympy import sstr return '[' + ', '.join(sstr(x) for x in self.data) + ']' def __iter__(self): return self.data.__iter__() def __getitem__(self, idx): return self.data[idx] class FreeModule(Module): """ Abstract base class for free modules. Additional attributes: - rank - rank of the free module Non-implemented methods: - submodule """ dtype = FreeModuleElement def __init__(self, ring, rank): Module.__init__(self, ring) self.rank = rank def __repr__(self): return repr(self.ring) + "**" + repr(self.rank) def is_submodule(self, other): """ Returns True if ``other`` is a submodule of ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> M = F.submodule([2, x]) >>> F.is_submodule(F) True >>> F.is_submodule(M) True >>> M.is_submodule(F) False """ if isinstance(other, SubModule): return other.container == self if isinstance(other, FreeModule): return other.ring == self.ring and other.rank == self.rank return False def convert(self, elem, M=None): """ Convert ``elem`` into the internal representation. This method is called implicitly whenever computations involve elements not in the internal representation. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.convert([1, 0]) [1, 0] """ if isinstance(elem, FreeModuleElement): if elem.module is self: return elem if elem.module.rank != self.rank: raise CoercionFailed return FreeModuleElement(self, tuple(self.ring.convert(x, elem.module.ring) for x in elem.data)) elif iterable(elem): tpl = tuple(self.ring.convert(x) for x in elem) if len(tpl) != self.rank: raise CoercionFailed return FreeModuleElement(self, tpl) elif _aresame(elem, 0): return FreeModuleElement(self, (self.ring.convert(0),)*self.rank) else: raise CoercionFailed def is_zero(self): """ Returns True if ``self`` is a zero module. (If, as this implementation assumes, the coefficient ring is not the zero ring, then this is equivalent to the rank being zero.) Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(0).is_zero() True >>> QQ.old_poly_ring(x).free_module(1).is_zero() False """ return self.rank == 0 def basis(self): """ Return a set of basis elements. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(3).basis() ([1, 0, 0], [0, 1, 0], [0, 0, 1]) """ from sympy.matrices import eye M = eye(self.rank) return tuple(self.convert(M.row(i)) for i in range(self.rank)) def quotient_module(self, submodule): """ Return a quotient module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = QQ.old_poly_ring(x).free_module(2) >>> M.quotient_module(M.submodule([1, x], [x, 2])) QQ[x]**2/<[1, x], [x, 2]> Or more conicisely, using the overloaded division operator: >>> QQ.old_poly_ring(x).free_module(2) / [[1, x], [x, 2]] QQ[x]**2/<[1, x], [x, 2]> """ return QuotientModule(self.ring, self, submodule) def multiply_ideal(self, other): """ Multiply ``self`` by the ideal ``other``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> I = QQ.old_poly_ring(x).ideal(x) >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.multiply_ideal(I) <[x, 0], [0, x]> """ return self.submodule(*self.basis()).multiply_ideal(other) def identity_hom(self): """ Return the identity homomorphism on ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(2).identity_hom() Matrix([ [1, 0], : QQ[x]**2 -> QQ[x]**2 [0, 1]]) """ from sympy.polys.agca.homomorphisms import homomorphism return homomorphism(self, self, self.basis()) class FreeModulePolyRing(FreeModule): """ Free module over a generalized polynomial ring. Do not instantiate this, use the constructor method of the ring instead: Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(3) >>> F QQ[x]**3 >>> F.contains([x, 1, 0]) True >>> F.contains([1/x, 0, 1]) False """ def __init__(self, ring, rank): from sympy.polys.domains.old_polynomialring import PolynomialRingBase FreeModule.__init__(self, ring, rank) if not isinstance(ring, PolynomialRingBase): raise NotImplementedError('This implementation only works over ' + 'polynomial rings, got %s' % ring) if not isinstance(ring.dom, Field): raise NotImplementedError('Ground domain must be a field, ' + 'got %s' % ring.dom) def submodule(self, *gens, **opts): """ Generate a submodule. Examples ======== >>> from sympy.abc import x, y >>> from sympy import QQ >>> M = QQ.old_poly_ring(x, y).free_module(2).submodule([x, x + y]) >>> M <[x, x + y]> >>> M.contains([2*x, 2*x + 2*y]) True >>> M.contains([x, y]) False """ return SubModulePolyRing(gens, self, **opts) class FreeModuleQuotientRing(FreeModule): """ Free module over a quotient ring. Do not instantiate this, use the constructor method of the ring instead: Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(3) >>> F (QQ[x]/<x**2 + 1>)**3 Attributes - quot - the quotient module `R^n / IR^n`, where `R/I` is our ring """ def __init__(self, ring, rank): from sympy.polys.domains.quotientring import QuotientRing FreeModule.__init__(self, ring, rank) if not isinstance(ring, QuotientRing): raise NotImplementedError('This implementation only works over ' + 'quotient rings, got %s' % ring) F = self.ring.ring.free_module(self.rank) self.quot = F / (self.ring.base_ideal*F) def __repr__(self): return "(" + repr(self.ring) + ")" + "**" + repr(self.rank) def submodule(self, *gens, **opts): """ Generate a submodule. Examples ======== >>> from sympy.abc import x, y >>> from sympy import QQ >>> M = (QQ.old_poly_ring(x, y)/[x**2 - y**2]).free_module(2).submodule([x, x + y]) >>> M <[x + <x**2 - y**2>, x + y + <x**2 - y**2>]> >>> M.contains([y**2, x**2 + x*y]) True >>> M.contains([x, y]) False """ return SubModuleQuotientRing(gens, self, **opts) def lift(self, elem): """ Lift the element ``elem`` of self to the module self.quot. Note that self.quot is the same set as self, just as an R-module and not as an R/I-module, so this makes sense. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2) >>> e = F.convert([1, 0]) >>> e [1 + <x**2 + 1>, 0 + <x**2 + 1>] >>> L = F.quot >>> l = F.lift(e) >>> l [1, 0] + <[x**2 + 1, 0], [0, x**2 + 1]> >>> L.contains(l) True """ return self.quot.convert([x.data for x in elem]) def unlift(self, elem): """ Push down an element of self.quot to self. This undoes ``lift``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = (QQ.old_poly_ring(x)/[x**2 + 1]).free_module(2) >>> e = F.convert([1, 0]) >>> l = F.lift(e) >>> e == l False >>> e == F.unlift(l) True """ return self.convert(elem.data) ########################################################################## ## Submodules and subquotients ########################################### ########################################################################## class SubModule(Module): """ Base class for submodules. Attributes: - container - containing module - gens - generators (subset of containing module) - rank - rank of containing module Non-implemented methods: - _contains - _syzygies - _in_terms_of_generators - _intersect - _module_quotient Methods that likely need change in subclasses: - reduce_element """ def __init__(self, gens, container): Module.__init__(self, container.ring) self.gens = tuple(container.convert(x) for x in gens) self.container = container self.rank = container.rank self.ring = container.ring self.dtype = container.dtype def __repr__(self): return "<" + ", ".join(repr(x) for x in self.gens) + ">" def _contains(self, other): """Implementation of containment. Other is guaranteed to be FreeModuleElement.""" raise NotImplementedError def _syzygies(self): """Implementation of syzygy computation wrt self generators.""" raise NotImplementedError def _in_terms_of_generators(self, e): """Implementation of expression in terms of generators.""" raise NotImplementedError def convert(self, elem, M=None): """ Convert ``elem`` into the internal represantition. Mostly called implicitly. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = QQ.old_poly_ring(x).free_module(2).submodule([1, x]) >>> M.convert([2, 2*x]) [2, 2*x] """ if isinstance(elem, self.container.dtype) and elem.module is self: return elem r = copy(self.container.convert(elem, M)) r.module = self if not self._contains(r): raise CoercionFailed return r def _intersect(self, other): """Implementation of intersection. Other is guaranteed to be a submodule of same free module.""" raise NotImplementedError def _module_quotient(self, other): """Implementation of quotient. Other is guaranteed to be a submodule of same free module.""" raise NotImplementedError def intersect(self, other, **options): """ Returns the intersection of ``self`` with submodule ``other``. Examples ======== >>> from sympy.abc import x, y >>> from sympy import QQ >>> F = QQ.old_poly_ring(x, y).free_module(2) >>> F.submodule([x, x]).intersect(F.submodule([y, y])) <[x*y, x*y]> Some implementation allow further options to be passed. Currently, to only one implemented is ``relations=True``, in which case the function will return a triple ``(res, rela, relb)``, where ``res`` is the intersection module, and ``rela`` and ``relb`` are lists of coefficient vectors, expressing the generators of ``res`` in terms of the generators of ``self`` (``rela``) and ``other`` (``relb``). >>> F.submodule([x, x]).intersect(F.submodule([y, y]), relations=True) (<[x*y, x*y]>, [(y,)], [(x,)]) The above result says: the intersection module is generated by the single element `(-xy, -xy) = -y (x, x) = -x (y, y)`, where `(x, x)` and `(y, y)` respectively are the unique generators of the two modules being intersected. """ if not isinstance(other, SubModule): raise TypeError('%s is not a SubModule' % other) if other.container != self.container: raise ValueError( '%s is contained in a different free module' % other) return self._intersect(other, **options) def module_quotient(self, other, **options): r""" Returns the module quotient of ``self`` by submodule ``other``. That is, if ``self`` is the module `M` and ``other`` is `N`, then return the ideal `\{f \in R | fN \subset M\}`. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x, y >>> F = QQ.old_poly_ring(x, y).free_module(2) >>> S = F.submodule([x*y, x*y]) >>> T = F.submodule([x, x]) >>> S.module_quotient(T) <y> Some implementations allow further options to be passed. Currently, the only one implemented is ``relations=True``, which may only be passed if ``other`` is principal. In this case the function will return a pair ``(res, rel)`` where ``res`` is the ideal, and ``rel`` is a list of coefficient vectors, expressing the generators of the ideal, multiplied by the generator of ``other`` in terms of generators of ``self``. >>> S.module_quotient(T, relations=True) (<y>, [[1]]) This means that the quotient ideal is generated by the single element `y`, and that `y (x, x) = 1 (xy, xy)`, `(x, x)` and `(xy, xy)` being the generators of `T` and `S`, respectively. """ if not isinstance(other, SubModule): raise TypeError('%s is not a SubModule' % other) if other.container != self.container: raise ValueError( '%s is contained in a different free module' % other) return self._module_quotient(other, **options) def union(self, other): """ Returns the module generated by the union of ``self`` and ``other``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(1) >>> M = F.submodule([x**2 + x]) # <x(x+1)> >>> N = F.submodule([x**2 - 1]) # <(x-1)(x+1)> >>> M.union(N) == F.submodule([x+1]) True """ if not isinstance(other, SubModule): raise TypeError('%s is not a SubModule' % other) if other.container != self.container: raise ValueError( '%s is contained in a different free module' % other) return self.__class__(self.gens + other.gens, self.container) def is_zero(self): """ Return True if ``self`` is a zero module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.submodule([x, 1]).is_zero() False >>> F.submodule([0, 0]).is_zero() True """ return all(x == 0 for x in self.gens) def submodule(self, *gens): """ Generate a submodule. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = QQ.old_poly_ring(x).free_module(2).submodule([x, 1]) >>> M.submodule([x**2, x]) <[x**2, x]> """ if not self.subset(gens): raise ValueError('%s not a subset of %s' % (gens, self)) return self.__class__(gens, self.container) def is_full_module(self): """ Return True if ``self`` is the entire free module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.submodule([x, 1]).is_full_module() False >>> F.submodule([1, 1], [1, 2]).is_full_module() True """ return all(self.contains(x) for x in self.container.basis()) def is_submodule(self, other): """ Returns True if ``other`` is a submodule of ``self``. >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> M = F.submodule([2, x]) >>> N = M.submodule([2*x, x**2]) >>> M.is_submodule(M) True >>> M.is_submodule(N) True >>> N.is_submodule(M) False """ if isinstance(other, SubModule): return self.container == other.container and \ all(self.contains(x) for x in other.gens) if isinstance(other, (FreeModule, QuotientModule)): return self.container == other and self.is_full_module() return False def syzygy_module(self, **opts): r""" Compute the syzygy module of the generators of ``self``. Suppose `M` is generated by `f_1, \ldots, f_n` over the ring `R`. Consider the homomorphism `\phi: R^n \to M`, given by sending `(r_1, \ldots, r_n) \to r_1 f_1 + \cdots + r_n f_n`. The syzygy module is defined to be the kernel of `\phi`. Examples ======== The syzygy module is zero iff the generators generate freely a free submodule: >>> from sympy.abc import x, y >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(2).submodule([1, 0], [1, 1]).syzygy_module().is_zero() True A slightly more interesting example: >>> M = QQ.old_poly_ring(x, y).free_module(2).submodule([x, 2*x], [y, 2*y]) >>> S = QQ.old_poly_ring(x, y).free_module(2).submodule([y, -x]) >>> M.syzygy_module() == S True """ F = self.ring.free_module(len(self.gens)) # NOTE we filter out zero syzygies. This is for convenience of the # _syzygies function and not meant to replace any real "generating set # reduction" algorithm return F.submodule(*[x for x in self._syzygies() if F.convert(x) != 0], **opts) def in_terms_of_generators(self, e): """ Express element ``e`` of ``self`` in terms of the generators. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> M = F.submodule([1, 0], [1, 1]) >>> M.in_terms_of_generators([x, x**2]) [-x**2 + x, x**2] """ try: e = self.convert(e) except CoercionFailed: raise ValueError('%s is not an element of %s' % (e, self)) return self._in_terms_of_generators(e) def reduce_element(self, x): """ Reduce the element ``x`` of our ring modulo the ideal ``self``. Here "reduce" has no specific meaning, it could return a unique normal form, simplify the expression a bit, or just do nothing. """ return x def quotient_module(self, other, **opts): """ Return a quotient module. This is the same as taking a submodule of a quotient of the containing module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> S1 = F.submodule([x, 1]) >>> S2 = F.submodule([x**2, x]) >>> S1.quotient_module(S2) <[x, 1] + <[x**2, x]>> Or more coincisely, using the overloaded division operator: >>> F.submodule([x, 1]) / [(x**2, x)] <[x, 1] + <[x**2, x]>> """ if not self.is_submodule(other): raise ValueError('%s not a submodule of %s' % (other, self)) return SubQuotientModule(self.gens, self.container.quotient_module(other), **opts) def __add__(self, oth): return self.container.quotient_module(self).convert(oth) __radd__ = __add__ def multiply_ideal(self, I): """ Multiply ``self`` by the ideal ``I``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> I = QQ.old_poly_ring(x).ideal(x**2) >>> M = QQ.old_poly_ring(x).free_module(2).submodule([1, 1]) >>> I*M <[x**2, x**2]> """ return self.submodule(*[x*g for [x] in I._module.gens for g in self.gens]) def inclusion_hom(self): """ Return a homomorphism representing the inclusion map of ``self``. That is, the natural map from ``self`` to ``self.container``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(2).submodule([x, x]).inclusion_hom() Matrix([ [1, 0], : <[x, x]> -> QQ[x]**2 [0, 1]]) """ return self.container.identity_hom().restrict_domain(self) def identity_hom(self): """ Return the identity homomorphism on ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> QQ.old_poly_ring(x).free_module(2).submodule([x, x]).identity_hom() Matrix([ [1, 0], : <[x, x]> -> <[x, x]> [0, 1]]) """ return self.container.identity_hom().restrict_domain( self).restrict_codomain(self) class SubQuotientModule(SubModule): """ Submodule of a quotient module. Equivalently, quotient module of a submodule. Do not instantiate this, instead use the submodule or quotient_module constructing methods: >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> S = F.submodule([1, 0], [1, x]) >>> Q = F/[(1, 0)] >>> S/[(1, 0)] == Q.submodule([5, x]) True Attributes: - base - base module we are quotient of - killed_module - submodule used to form the quotient """ def __init__(self, gens, container, **opts): SubModule.__init__(self, gens, container) self.killed_module = self.container.killed_module # XXX it is important for some code below that the generators of base # are in this particular order! self.base = self.container.base.submodule( *[x.data for x in self.gens], **opts).union(self.killed_module) def _contains(self, elem): return self.base.contains(elem.data) def _syzygies(self): # let N = self.killed_module be generated by e_1, ..., e_r # let F = self.base be generated by f_1, ..., f_s and e_1, ..., e_r # Then self = F/N. # Let phi: R**s --> self be the evident surjection. # Similarly psi: R**(s + r) --> F. # We need to find generators for ker(phi). Let chi: R**s --> F be the # evident lift of phi. For X in R**s, phi(X) = 0 iff chi(X) is # contained in N, iff there exists Y in R**r such that # psi(X, Y) = 0. # Hence if alpha: R**(s + r) --> R**s is the projection map, then # ker(phi) = alpha ker(psi). return [X[:len(self.gens)] for X in self.base._syzygies()] def _in_terms_of_generators(self, e): return self.base._in_terms_of_generators(e.data)[:len(self.gens)] def is_full_module(self): """ Return True if ``self`` is the entire free module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> F.submodule([x, 1]).is_full_module() False >>> F.submodule([1, 1], [1, 2]).is_full_module() True """ return self.base.is_full_module() def quotient_hom(self): """ Return the quotient homomorphism to self. That is, return the natural map from ``self.base`` to ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = (QQ.old_poly_ring(x).free_module(2) / [(1, x)]).submodule([1, 0]) >>> M.quotient_hom() Matrix([ [1, 0], : <[1, 0], [1, x]> -> <[1, 0] + <[1, x]>, [1, x] + <[1, x]>> [0, 1]]) """ return self.base.identity_hom().quotient_codomain(self.killed_module) _subs0 = lambda x: x[0] _subs1 = lambda x: x[1:] class ModuleOrder(ProductOrder): """A product monomial order with a zeroth term as module index.""" def __init__(self, o1, o2, TOP): if TOP: ProductOrder.__init__(self, (o2, _subs1), (o1, _subs0)) else: ProductOrder.__init__(self, (o1, _subs0), (o2, _subs1)) class SubModulePolyRing(SubModule): """ Submodule of a free module over a generalized polynomial ring. Do not instantiate this, use the constructor method of FreeModule instead: >>> from sympy.abc import x, y >>> from sympy import QQ >>> F = QQ.old_poly_ring(x, y).free_module(2) >>> F.submodule([x, y], [1, 0]) <[x, y], [1, 0]> Attributes: - order - monomial order used """ #self._gb - cached groebner basis #self._gbe - cached groebner basis relations def __init__(self, gens, container, order="lex", TOP=True): SubModule.__init__(self, gens, container) if not isinstance(container, FreeModulePolyRing): raise NotImplementedError('This implementation is for submodules of ' + 'FreeModulePolyRing, got %s' % container) self.order = ModuleOrder(monomial_key(order), self.ring.order, TOP) self._gb = None self._gbe = None def __eq__(self, other): if isinstance(other, SubModulePolyRing) and self.order != other.order: return False return SubModule.__eq__(self, other) def _groebner(self, extended=False): """Returns a standard basis in sdm form.""" from sympy.polys.distributedmodules import sdm_groebner, sdm_nf_mora if self._gbe is None and extended: gb, gbe = sdm_groebner( [self.ring._vector_to_sdm(x, self.order) for x in self.gens], sdm_nf_mora, self.order, self.ring.dom, extended=True) self._gb, self._gbe = tuple(gb), tuple(gbe) if self._gb is None: self._gb = tuple(sdm_groebner( [self.ring._vector_to_sdm(x, self.order) for x in self.gens], sdm_nf_mora, self.order, self.ring.dom)) if extended: return self._gb, self._gbe else: return self._gb def _groebner_vec(self, extended=False): """Returns a standard basis in element form.""" if not extended: return [self.convert(self.ring._sdm_to_vector(x, self.rank)) for x in self._groebner()] gb, gbe = self._groebner(extended=True) return ([self.convert(self.ring._sdm_to_vector(x, self.rank)) for x in gb], [self.ring._sdm_to_vector(x, len(self.gens)) for x in gbe]) def _contains(self, x): from sympy.polys.distributedmodules import sdm_zero, sdm_nf_mora return sdm_nf_mora(self.ring._vector_to_sdm(x, self.order), self._groebner(), self.order, self.ring.dom) == \ sdm_zero() def _syzygies(self): """Compute syzygies. See [SCA, algorithm 2.5.4].""" # NOTE if self.gens is a standard basis, this can be done more # efficiently using Schreyer's theorem from sympy.matrices import eye # First bullet point k = len(self.gens) r = self.rank im = eye(k) Rkr = self.ring.free_module(r + k) newgens = [] for j, f in enumerate(self.gens): m = [0]*(r + k) for i, v in enumerate(f): m[i] = f[i] for i in range(k): m[r + i] = im[j, i] newgens.append(Rkr.convert(m)) # Note: we need *descending* order on module index, and TOP=False to # get an elimination order F = Rkr.submodule(*newgens, order='ilex', TOP=False) # Second bullet point: standard basis of F G = F._groebner_vec() # Third bullet point: G0 = G intersect the new k components G0 = [x[r:] for x in G if all(y == self.ring.convert(0) for y in x[:r])] # Fourth and fifth bullet points: we are done return G0 def _in_terms_of_generators(self, e): """Expression in terms of generators. See [SCA, 2.8.1].""" # NOTE: if gens is a standard basis, this can be done more efficiently M = self.ring.free_module(self.rank).submodule(*((e,) + self.gens)) S = M.syzygy_module( order="ilex", TOP=False) # We want decreasing order! G = S._groebner_vec() # This list cannot not be empty since e is an element e = [x for x in G if self.ring.is_unit(x[0])][0] return [-x/e[0] for x in e[1:]] def reduce_element(self, x, NF=None): """ Reduce the element ``x`` of our container modulo ``self``. This applies the normal form ``NF`` to ``x``. If ``NF`` is passed as none, the default Mora normal form is used (which is not unique!). """ from sympy.polys.distributedmodules import sdm_nf_mora if NF is None: NF = sdm_nf_mora return self.container.convert(self.ring._sdm_to_vector(NF( self.ring._vector_to_sdm(x, self.order), self._groebner(), self.order, self.ring.dom), self.rank)) def _intersect(self, other, relations=False): # See: [SCA, section 2.8.2] fi = self.gens hi = other.gens r = self.rank ci = [[0]*(2*r) for _ in range(r)] for k in range(r): ci[k][k] = 1 ci[k][r + k] = 1 di = [list(f) + [0]*r for f in fi] ei = [[0]*r + list(h) for h in hi] syz = self.ring.free_module(2*r).submodule(*(ci + di + ei))._syzygies() nonzero = [x for x in syz if any(y != self.ring.zero for y in x[:r])] res = self.container.submodule(*([-y for y in x[:r]] for x in nonzero)) reln1 = [x[r:r + len(fi)] for x in nonzero] reln2 = [x[r + len(fi):] for x in nonzero] if relations: return res, reln1, reln2 return res def _module_quotient(self, other, relations=False): # See: [SCA, section 2.8.4] if relations and len(other.gens) != 1: raise NotImplementedError if len(other.gens) == 0: return self.ring.ideal(1) elif len(other.gens) == 1: # We do some trickery. Let f be the (vector!) generating ``other`` # and f1, .., fn be the (vectors) generating self. # Consider the submodule of R^{r+1} generated by (f, 1) and # {(fi, 0) | i}. Then the intersection with the last module # component yields the quotient. g1 = list(other.gens[0]) + [1] gi = [list(x) + [0] for x in self.gens] # NOTE: We *need* to use an elimination order M = self.ring.free_module(self.rank + 1).submodule(*([g1] + gi), order='ilex', TOP=False) if not relations: return self.ring.ideal(*[x[-1] for x in M._groebner_vec() if all(y == self.ring.zero for y in x[:-1])]) else: G, R = M._groebner_vec(extended=True) indices = [i for i, x in enumerate(G) if all(y == self.ring.zero for y in x[:-1])] return (self.ring.ideal(*[G[i][-1] for i in indices]), [[-x for x in R[i][1:]] for i in indices]) # For more generators, we use I : <h1, .., hn> = intersection of # {I : <hi> | i} # TODO this can be done more efficiently return reduce(lambda x, y: x.intersect(y), (self._module_quotient(self.container.submodule(x)) for x in other.gens)) class SubModuleQuotientRing(SubModule): """ Class for submodules of free modules over quotient rings. Do not instantiate this. Instead use the submodule methods. >>> from sympy.abc import x, y >>> from sympy import QQ >>> M = (QQ.old_poly_ring(x, y)/[x**2 - y**2]).free_module(2).submodule([x, x + y]) >>> M <[x + <x**2 - y**2>, x + y + <x**2 - y**2>]> >>> M.contains([y**2, x**2 + x*y]) True >>> M.contains([x, y]) False Attributes: - quot - the subquotient of `R^n/IR^n` generated by lifts of our generators """ def __init__(self, gens, container): SubModule.__init__(self, gens, container) self.quot = self.container.quot.submodule( *[self.container.lift(x) for x in self.gens]) def _contains(self, elem): return self.quot._contains(self.container.lift(elem)) def _syzygies(self): return [tuple(self.ring.convert(y, self.quot.ring) for y in x) for x in self.quot._syzygies()] def _in_terms_of_generators(self, elem): return [self.ring.convert(x, self.quot.ring) for x in self.quot._in_terms_of_generators(self.container.lift(elem))] ########################################################################## ## Quotient Modules ###################################################### ########################################################################## class QuotientModuleElement(ModuleElement): """Element of a quotient module.""" def eq(self, d1, d2): """Equality comparison.""" return self.module.killed_module.contains(d1 - d2) def __repr__(self): return repr(self.data) + " + " + repr(self.module.killed_module) class QuotientModule(Module): """ Class for quotient modules. Do not instantiate this directly. For subquotients, see the SubQuotientModule class. Attributes: - base - the base module we are a quotient of - killed_module - the submodule used to form the quotient - rank of the base """ dtype = QuotientModuleElement def __init__(self, ring, base, submodule): Module.__init__(self, ring) if not base.is_submodule(submodule): raise ValueError('%s is not a submodule of %s' % (submodule, base)) self.base = base self.killed_module = submodule self.rank = base.rank def __repr__(self): return repr(self.base) + "/" + repr(self.killed_module) def is_zero(self): """ Return True if ``self`` is a zero module. This happens if and only if the base module is the same as the submodule being killed. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) >>> (F/[(1, 0)]).is_zero() False >>> (F/[(1, 0), (0, 1)]).is_zero() True """ return self.base == self.killed_module def is_submodule(self, other): """ Return True if ``other`` is a submodule of ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)] >>> S = Q.submodule([1, 0]) >>> Q.is_submodule(S) True >>> S.is_submodule(Q) False """ if isinstance(other, QuotientModule): return self.killed_module == other.killed_module and \ self.base.is_submodule(other.base) if isinstance(other, SubQuotientModule): return other.container == self return False def submodule(self, *gens, **opts): """ Generate a submodule. This is the same as taking a quotient of a submodule of the base module. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)] >>> Q.submodule([x, 0]) <[x, 0] + <[x, x]>> """ return SubQuotientModule(gens, self, **opts) def convert(self, elem, M=None): """ Convert ``elem`` into the internal representation. This method is called implicitly whenever computations involve elements not in the internal representation. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> F = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)] >>> F.convert([1, 0]) [1, 0] + <[1, 2], [1, x]> """ if isinstance(elem, QuotientModuleElement): if elem.module is self: return elem if self.killed_module.is_submodule(elem.module.killed_module): return QuotientModuleElement(self, self.base.convert(elem.data)) raise CoercionFailed return QuotientModuleElement(self, self.base.convert(elem)) def identity_hom(self): """ Return the identity homomorphism on ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)] >>> M.identity_hom() Matrix([ [1, 0], : QQ[x]**2/<[1, 2], [1, x]> -> QQ[x]**2/<[1, 2], [1, x]> [0, 1]]) """ return self.base.identity_hom().quotient_codomain( self.killed_module).quotient_domain(self.killed_module) def quotient_hom(self): """ Return the quotient homomorphism to ``self``. That is, return a homomorphism representing the natural map from ``self.base`` to ``self``. Examples ======== >>> from sympy.abc import x >>> from sympy import QQ >>> M = QQ.old_poly_ring(x).free_module(2) / [(1, 2), (1, x)] >>> M.quotient_hom() Matrix([ [1, 0], : QQ[x]**2 -> QQ[x]**2/<[1, 2], [1, x]> [0, 1]]) """ return self.base.identity_hom().quotient_codomain( self.killed_module)
30b6b054d3e9387b837146b96e04b1f525992b3cf250d70880e4c9d9524d8433
""" Computations with homomorphisms of modules and rings. This module implements classes for representing homomorphisms of rings and their modules. Instead of instantiating the classes directly, you should use the function ``homomorphism(from, to, matrix)`` to create homomorphism objects. """ from __future__ import print_function, division from sympy.polys.agca.modules import (Module, FreeModule, QuotientModule, SubModule, SubQuotientModule) from sympy.polys.polyerrors import CoercionFailed # The main computational task for module homomorphisms is kernels. # For this reason, the concrete classes are organised by domain module type. class ModuleHomomorphism(object): """ Abstract base class for module homomoprhisms. Do not instantiate. Instead, use the ``homomorphism`` function: >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> homomorphism(F, F, [[1, 0], [0, 1]]) Matrix([ [1, 0], : QQ[x]**2 -> QQ[x]**2 [0, 1]]) Attributes: - ring - the ring over which we are considering modules - domain - the domain module - codomain - the codomain module - _ker - cached kernel - _img - cached image Non-implemented methods: - _kernel - _image - _restrict_domain - _restrict_codomain - _quotient_domain - _quotient_codomain - _apply - _mul_scalar - _compose - _add """ def __init__(self, domain, codomain): if not isinstance(domain, Module): raise TypeError('Source must be a module, got %s' % domain) if not isinstance(codomain, Module): raise TypeError('Target must be a module, got %s' % codomain) if domain.ring != codomain.ring: raise ValueError('Source and codomain must be over same ring, ' 'got %s != %s' % (domain, codomain)) self.domain = domain self.codomain = codomain self.ring = domain.ring self._ker = None self._img = None def kernel(self): r""" Compute the kernel of ``self``. That is, if ``self`` is the homomorphism `\phi: M \to N`, then compute `ker(\phi) = \{x \in M | \phi(x) = 0\}`. This is a submodule of `M`. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> homomorphism(F, F, [[1, 0], [x, 0]]).kernel() <[x, -1]> """ if self._ker is None: self._ker = self._kernel() return self._ker def image(self): r""" Compute the image of ``self``. That is, if ``self`` is the homomorphism `\phi: M \to N`, then compute `im(\phi) = \{\phi(x) | x \in M \}`. This is a submodule of `N`. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> homomorphism(F, F, [[1, 0], [x, 0]]).image() == F.submodule([1, 0]) True """ if self._img is None: self._img = self._image() return self._img def _kernel(self): """Compute the kernel of ``self``.""" raise NotImplementedError def _image(self): """Compute the image of ``self``.""" raise NotImplementedError def _restrict_domain(self, sm): """Implementation of domain restriction.""" raise NotImplementedError def _restrict_codomain(self, sm): """Implementation of codomain restriction.""" raise NotImplementedError def _quotient_domain(self, sm): """Implementation of domain quotient.""" raise NotImplementedError def _quotient_codomain(self, sm): """Implementation of codomain quotient.""" raise NotImplementedError def restrict_domain(self, sm): """ Return ``self``, with the domain restricted to ``sm``. Here ``sm`` has to be a submodule of ``self.domain``. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2 [0, 0]]) >>> h.restrict_domain(F.submodule([1, 0])) Matrix([ [1, x], : <[1, 0]> -> QQ[x]**2 [0, 0]]) This is the same as just composing on the right with the submodule inclusion: >>> h * F.submodule([1, 0]).inclusion_hom() Matrix([ [1, x], : <[1, 0]> -> QQ[x]**2 [0, 0]]) """ if not self.domain.is_submodule(sm): raise ValueError('sm must be a submodule of %s, got %s' % (self.domain, sm)) if sm == self.domain: return self return self._restrict_domain(sm) def restrict_codomain(self, sm): """ Return ``self``, with codomain restricted to to ``sm``. Here ``sm`` has to be a submodule of ``self.codomain`` containing the image. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2 [0, 0]]) >>> h.restrict_codomain(F.submodule([1, 0])) Matrix([ [1, x], : QQ[x]**2 -> <[1, 0]> [0, 0]]) """ if not sm.is_submodule(self.image()): raise ValueError('the image %s must contain sm, got %s' % (self.image(), sm)) if sm == self.codomain: return self return self._restrict_codomain(sm) def quotient_domain(self, sm): """ Return ``self`` with domain replaced by ``domain/sm``. Here ``sm`` must be a submodule of ``self.kernel()``. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2 [0, 0]]) >>> h.quotient_domain(F.submodule([-x, 1])) Matrix([ [1, x], : QQ[x]**2/<[-x, 1]> -> QQ[x]**2 [0, 0]]) """ if not self.kernel().is_submodule(sm): raise ValueError('kernel %s must contain sm, got %s' % (self.kernel(), sm)) if sm.is_zero(): return self return self._quotient_domain(sm) def quotient_codomain(self, sm): """ Return ``self`` with codomain replaced by ``codomain/sm``. Here ``sm`` must be a submodule of ``self.codomain``. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2 [0, 0]]) >>> h.quotient_codomain(F.submodule([1, 1])) Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2/<[1, 1]> [0, 0]]) This is the same as composing with the quotient map on the left: >>> (F/[(1, 1)]).quotient_hom() * h Matrix([ [1, x], : QQ[x]**2 -> QQ[x]**2/<[1, 1]> [0, 0]]) """ if not self.codomain.is_submodule(sm): raise ValueError('sm must be a submodule of codomain %s, got %s' % (self.codomain, sm)) if sm.is_zero(): return self return self._quotient_codomain(sm) def _apply(self, elem): """Apply ``self`` to ``elem``.""" raise NotImplementedError def __call__(self, elem): return self.codomain.convert(self._apply(self.domain.convert(elem))) def _compose(self, oth): """ Compose ``self`` with ``oth``, that is, return the homomorphism obtained by first applying then ``self``, then ``oth``. (This method is private since in this syntax, it is non-obvious which homomorphism is executed first.) """ raise NotImplementedError def _mul_scalar(self, c): """Scalar multiplication. ``c`` is guaranteed in self.ring.""" raise NotImplementedError def _add(self, oth): """ Homomorphism addition. ``oth`` is guaranteed to be a homomorphism with same domain/codomain. """ raise NotImplementedError def _check_hom(self, oth): """Helper to check that oth is a homomorphism with same domain/codomain.""" if not isinstance(oth, ModuleHomomorphism): return False return oth.domain == self.domain and oth.codomain == self.codomain def __mul__(self, oth): if isinstance(oth, ModuleHomomorphism) and self.domain == oth.codomain: return oth._compose(self) try: return self._mul_scalar(self.ring.convert(oth)) except CoercionFailed: return NotImplemented # NOTE: _compose will never be called from rmul __rmul__ = __mul__ def __div__(self, oth): try: return self._mul_scalar(1/self.ring.convert(oth)) except CoercionFailed: return NotImplemented __truediv__ = __div__ def __add__(self, oth): if self._check_hom(oth): return self._add(oth) return NotImplemented def __sub__(self, oth): if self._check_hom(oth): return self._add(oth._mul_scalar(self.ring.convert(-1))) return NotImplemented def is_injective(self): """ Return True if ``self`` is injective. That is, check if the elements of the domain are mapped to the same codomain element. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h.is_injective() False >>> h.quotient_domain(h.kernel()).is_injective() True """ return self.kernel().is_zero() def is_surjective(self): """ Return True if ``self`` is surjective. That is, check if every element of the codomain has at least one preimage. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h.is_surjective() False >>> h.restrict_codomain(h.image()).is_surjective() True """ return self.image() == self.codomain def is_isomorphism(self): """ Return True if ``self`` is an isomorphism. That is, check if every element of the codomain has precisely one preimage. Equivalently, ``self`` is both injective and surjective. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h = h.restrict_codomain(h.image()) >>> h.is_isomorphism() False >>> h.quotient_domain(h.kernel()).is_isomorphism() True """ return self.is_injective() and self.is_surjective() def is_zero(self): """ Return True if ``self`` is a zero morphism. That is, check if every element of the domain is mapped to zero under self. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> h = homomorphism(F, F, [[1, 0], [x, 0]]) >>> h.is_zero() False >>> h.restrict_domain(F.submodule()).is_zero() True >>> h.quotient_codomain(h.image()).is_zero() True """ return self.image().is_zero() def __eq__(self, oth): try: return (self - oth).is_zero() except TypeError: return False def __ne__(self, oth): return not (self == oth) class MatrixHomomorphism(ModuleHomomorphism): r""" Helper class for all homomoprhisms which are expressed via a matrix. That is, for such homomorphisms ``domain`` is contained in a module generated by finitely many elements `e_1, \ldots, e_n`, so that the homomorphism is determined uniquely by its action on the `e_i`. It can thus be represented as a vector of elements of the codomain module, or potentially a supermodule of the codomain module (and hence conventionally as a matrix, if there is a similar interpretation for elements of the codomain module). Note that this class does *not* assume that the `e_i` freely generate a submodule, nor that ``domain`` is even all of this submodule. It exists only to unify the interface. Do not instantiate. Attributes: - matrix - the list of images determining the homomorphism. NOTE: the elements of matrix belong to either self.codomain or self.codomain.container Still non-implemented methods: - kernel - _apply """ def __init__(self, domain, codomain, matrix): ModuleHomomorphism.__init__(self, domain, codomain) if len(matrix) != domain.rank: raise ValueError('Need to provide %s elements, got %s' % (domain.rank, len(matrix))) converter = self.codomain.convert if isinstance(self.codomain, (SubModule, SubQuotientModule)): converter = self.codomain.container.convert self.matrix = tuple(converter(x) for x in matrix) def _sympy_matrix(self): """Helper function which returns a sympy matrix ``self.matrix``.""" from sympy.matrices import Matrix c = lambda x: x if isinstance(self.codomain, (QuotientModule, SubQuotientModule)): c = lambda x: x.data return Matrix([[self.ring.to_sympy(y) for y in c(x)] for x in self.matrix]).T def __repr__(self): lines = repr(self._sympy_matrix()).split('\n') t = " : %s -> %s" % (self.domain, self.codomain) s = ' '*len(t) n = len(lines) for i in range(n // 2): lines[i] += s lines[n // 2] += t for i in range(n//2 + 1, n): lines[i] += s return '\n'.join(lines) def _restrict_domain(self, sm): """Implementation of domain restriction.""" return SubModuleHomomorphism(sm, self.codomain, self.matrix) def _restrict_codomain(self, sm): """Implementation of codomain restriction.""" return self.__class__(self.domain, sm, self.matrix) def _quotient_domain(self, sm): """Implementation of domain quotient.""" return self.__class__(self.domain/sm, self.codomain, self.matrix) def _quotient_codomain(self, sm): """Implementation of codomain quotient.""" Q = self.codomain/sm converter = Q.convert if isinstance(self.codomain, SubModule): converter = Q.container.convert return self.__class__(self.domain, self.codomain/sm, [converter(x) for x in self.matrix]) def _add(self, oth): return self.__class__(self.domain, self.codomain, [x + y for x, y in zip(self.matrix, oth.matrix)]) def _mul_scalar(self, c): return self.__class__(self.domain, self.codomain, [c*x for x in self.matrix]) def _compose(self, oth): return self.__class__(self.domain, oth.codomain, [oth(x) for x in self.matrix]) class FreeModuleHomomorphism(MatrixHomomorphism): """ Concrete class for homomorphisms with domain a free module or a quotient thereof. Do not instantiate; the constructor does not check that your data is well defined. Use the ``homomorphism`` function instead: >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> F = QQ.old_poly_ring(x).free_module(2) >>> homomorphism(F, F, [[1, 0], [0, 1]]) Matrix([ [1, 0], : QQ[x]**2 -> QQ[x]**2 [0, 1]]) """ def _apply(self, elem): if isinstance(self.domain, QuotientModule): elem = elem.data return sum(x * e for x, e in zip(elem, self.matrix)) def _image(self): return self.codomain.submodule(*self.matrix) def _kernel(self): # The domain is either a free module or a quotient thereof. # It does not matter if it is a quotient, because that won't increase # the kernel. # Our generators {e_i} are sent to the matrix entries {b_i}. # The kernel is essentially the syzygy module of these {b_i}. syz = self.image().syzygy_module() return self.domain.submodule(*syz.gens) class SubModuleHomomorphism(MatrixHomomorphism): """ Concrete class for homomorphism with domain a submodule of a free module or a quotient thereof. Do not instantiate; the constructor does not check that your data is well defined. Use the ``homomorphism`` function instead: >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> M = QQ.old_poly_ring(x).free_module(2)*x >>> homomorphism(M, M, [[1, 0], [0, 1]]) Matrix([ [1, 0], : <[x, 0], [0, x]> -> <[x, 0], [0, x]> [0, 1]]) """ def _apply(self, elem): if isinstance(self.domain, SubQuotientModule): elem = elem.data return sum(x * e for x, e in zip(elem, self.matrix)) def _image(self): return self.codomain.submodule(*[self(x) for x in self.domain.gens]) def _kernel(self): syz = self.image().syzygy_module() return self.domain.submodule( *[sum(xi*gi for xi, gi in zip(s, self.domain.gens)) for s in syz.gens]) def homomorphism(domain, codomain, matrix): r""" Create a homomorphism object. This function tries to build a homomorphism from ``domain`` to ``codomain`` via the matrix ``matrix``. Examples ======== >>> from sympy import QQ >>> from sympy.abc import x >>> from sympy.polys.agca import homomorphism >>> R = QQ.old_poly_ring(x) >>> T = R.free_module(2) If ``domain`` is a free module generated by `e_1, \ldots, e_n`, then ``matrix`` should be an n-element iterable `(b_1, \ldots, b_n)` where the `b_i` are elements of ``codomain``. The constructed homomorphism is the unique homomorphism sending `e_i` to `b_i`. >>> F = R.free_module(2) >>> h = homomorphism(F, T, [[1, x], [x**2, 0]]) >>> h Matrix([ [1, x**2], : QQ[x]**2 -> QQ[x]**2 [x, 0]]) >>> h([1, 0]) [1, x] >>> h([0, 1]) [x**2, 0] >>> h([1, 1]) [x**2 + 1, x] If ``domain`` is a submodule of a free module, them ``matrix`` determines a homomoprhism from the containing free module to ``codomain``, and the homomorphism returned is obtained by restriction to ``domain``. >>> S = F.submodule([1, 0], [0, x]) >>> homomorphism(S, T, [[1, x], [x**2, 0]]) Matrix([ [1, x**2], : <[1, 0], [0, x]> -> QQ[x]**2 [x, 0]]) If ``domain`` is a (sub)quotient `N/K`, then ``matrix`` determines a homomorphism from `N` to ``codomain``. If the kernel contains `K`, this homomorphism descends to ``domain`` and is returned; otherwise an exception is raised. >>> homomorphism(S/[(1, 0)], T, [0, [x**2, 0]]) Matrix([ [0, x**2], : <[1, 0] + <[1, 0]>, [0, x] + <[1, 0]>, [1, 0] + <[1, 0]>> -> QQ[x]**2 [0, 0]]) >>> homomorphism(S/[(0, x)], T, [0, [x**2, 0]]) Traceback (most recent call last): ... ValueError: kernel <[1, 0], [0, 0]> must contain sm, got <[0,x]> """ def freepres(module): """ Return a tuple ``(F, S, Q, c)`` where ``F`` is a free module, ``S`` is a submodule of ``F``, and ``Q`` a submodule of ``S``, such that ``module = S/Q``, and ``c`` is a conversion function. """ if isinstance(module, FreeModule): return module, module, module.submodule(), lambda x: module.convert(x) if isinstance(module, QuotientModule): return (module.base, module.base, module.killed_module, lambda x: module.convert(x).data) if isinstance(module, SubQuotientModule): return (module.base.container, module.base, module.killed_module, lambda x: module.container.convert(x).data) # an ordinary submodule return (module.container, module, module.submodule(), lambda x: module.container.convert(x)) SF, SS, SQ, _ = freepres(domain) TF, TS, TQ, c = freepres(codomain) # NOTE this is probably a bit inefficient (redundant checks) return FreeModuleHomomorphism(SF, TF, [c(x) for x in matrix] ).restrict_domain(SS).restrict_codomain(TS ).quotient_codomain(TQ).quotient_domain(SQ)
4104b878a07c0bf0c15ca3aa1e3d34851fd5227bfcc39b448dba17712b02046e
"""Finite extensions of ring domains.""" from __future__ import print_function, division from sympy.polys.polyerrors import CoercionFailed from sympy.polys.polytools import Poly class ExtensionElement(object): """ Element of a finite extension. A class of univariate polynomials modulo the ``modulus`` of the extension ``ext``. It is represented by the unique polynomial ``rep`` of lowest degree. Both ``rep`` and the representation ``mod`` of ``modulus`` are of class DMP. """ __slots__ = ('rep', 'ext') def __init__(self, rep, ext): self.rep = rep self.ext = ext def __neg__(f): return ExtElem(-f.rep, f.ext) def _get_rep(f, g): if isinstance(g, ExtElem): if g.ext == f.ext: return g.rep else: return None else: try: g = f.ext.convert(g) return g.rep except CoercionFailed: return None def __add__(f, g): rep = f._get_rep(g) if rep is not None: return ExtElem(f.rep + rep, f.ext) else: return NotImplemented __radd__ = __add__ def __sub__(f, g): rep = f._get_rep(g) if rep is not None: return ExtElem(f.rep - rep, f.ext) else: return NotImplemented def __rsub__(f, g): rep = f._get_rep(g) if rep is not None: return ExtElem(rep - f.rep, f.ext) else: return NotImplemented def __mul__(f, g): rep = f._get_rep(g) if rep is not None: return ExtElem((f.rep*rep) % f.ext.mod, f.ext) else: return NotImplemented __rmul__ = __mul__ def __pow__(f, n): if not isinstance(n, int): raise TypeError("exponent of type 'int' expected") if n < 0: raise ValueError("negative powers are not defined") b = f.rep m = f.ext.mod r = f.ext.one.rep while n > 0: if n % 2: r = (r*b) % m b = (b*b) % m n //= 2 return ExtElem(r, f.ext) def __eq__(f, g): if isinstance(g, ExtElem): return f.rep == g.rep and f.ext == g.ext else: return NotImplemented def __ne__(f, g): return not f == g def __hash__(f): return hash((f.rep, f.ext)) def __str__(f): from sympy.printing.str import sstr return sstr(f.rep) __repr__ = __str__ ExtElem = ExtensionElement class MonogenicFiniteExtension(object): """ Finite extension generated by an integral element. The generator is defined by a monic univariate polynomial derived from the argument ``mod``. """ def __init__(self, mod): if not (isinstance(mod, Poly) and mod.is_univariate): raise TypeError("modulus must be a univariate Poly") mod, rem = mod.div(mod.LC()) if not rem.is_zero: raise ValueError("modulus could not be made monic") self.rank = mod.degree() self.modulus = mod self.mod = mod.rep # DMP representation self.domain = dom = mod.domain self.ring = mod.rep.ring or dom.old_poly_ring(*mod.gens) self.zero = self.convert(self.ring.zero) self.one = self.convert(self.ring.one) gen = self.ring.gens[0] self.generator = self.convert(gen) self.basis = tuple(self.convert(gen**i) for i in range(self.rank)) def convert(self, f): rep = self.ring.convert(f) return ExtElem(rep % self.mod, self) __call__ = convert def __str__(self): return "%s/(%s)" % (self.ring, self.modulus.as_expr()) __repr__ = __str__ FiniteExtension = MonogenicFiniteExtension
220dab0b90648b707d4b72db150c73fb91ff76dc7a755ec3ebf4f465da1f0da5
"""Tests for quotient rings.""" from sympy import QQ, ZZ from sympy.abc import x, y from sympy.polys.polyerrors import NotReversible from sympy.testing.pytest import raises def test_QuotientRingElement(): R = QQ.old_poly_ring(x)/[x**10] X = R.convert(x) assert X*(X + 1) == R.convert(x**2 + x) assert X*x == R.convert(x**2) assert x*X == R.convert(x**2) assert X + x == R.convert(2*x) assert x + X == 2*X assert X**2 == R.convert(x**2) assert 1/(1 - X) == R.convert(sum(x**i for i in range(10))) assert X**10 == R.zero assert X != x raises(NotReversible, lambda: 1/X) def test_QuotientRing(): I = QQ.old_poly_ring(x).ideal(x**2 + 1) R = QQ.old_poly_ring(x)/I assert R == QQ.old_poly_ring(x)/[x**2 + 1] assert R == QQ.old_poly_ring(x)/QQ.old_poly_ring(x).ideal(x**2 + 1) assert R != QQ.old_poly_ring(x) assert R.convert(1)/x == -x + I assert -1 + I == x**2 + I assert R.convert(ZZ(1), ZZ) == 1 + I assert R.convert(R.convert(x), R) == R.convert(x) X = R.convert(x) Y = QQ.old_poly_ring(x).convert(x) assert -1 + I == X**2 + I assert -1 + I == Y**2 + I assert R.to_sympy(X) == x raises(ValueError, lambda: QQ.old_poly_ring(x)/QQ.old_poly_ring(x, y).ideal(x)) R = QQ.old_poly_ring(x, order="ilex") I = R.ideal(x) assert R.convert(1) + I == (R/I).convert(1)
816f368dcc4bd89e672ab0388830ae93cf0ad5baa97c01bbcf7d98f75f7598a5
"""Tests for the PolynomialRing classes. """ from sympy.polys.domains import QQ, ZZ from sympy.polys.polyerrors import ExactQuotientFailed, CoercionFailed, NotReversible from sympy.abc import x, y from sympy.testing.pytest import raises def test_build_order(): R = QQ.old_poly_ring(x, y, order=(("lex", x), ("ilex", y))) assert R.order((1, 5)) == ((1,), (-5,)) def test_globalring(): Qxy = QQ.old_frac_field(x, y) R = QQ.old_poly_ring(x, y) X = R.convert(x) Y = R.convert(y) assert x in R assert 1/x not in R assert 1/(1 + x) not in R assert Y in R assert X.ring == R assert X * (Y**2 + 1) == R.convert(x * (y**2 + 1)) assert X * y == X * Y == R.convert(x * y) == x * Y assert X + y == X + Y == R.convert(x + y) == x + Y assert X - y == X - Y == R.convert(x - y) == x - Y assert X + 1 == R.convert(x + 1) raises(ExactQuotientFailed, lambda: X/Y) raises(ExactQuotientFailed, lambda: x/Y) raises(ExactQuotientFailed, lambda: X/y) assert X**2 / X == X assert R.from_GlobalPolynomialRing(ZZ.old_poly_ring(x, y).convert(x), ZZ.old_poly_ring(x, y)) == X assert R.from_FractionField(Qxy.convert(x), Qxy) == X assert R.from_FractionField(Qxy.convert(x)/y, Qxy) is None assert R._sdm_to_vector(R._vector_to_sdm([X, Y], R.order), 2) == [X, Y] def test_localring(): Qxy = QQ.old_frac_field(x, y) R = QQ.old_poly_ring(x, y, order="ilex") X = R.convert(x) Y = R.convert(y) assert x in R assert 1/x not in R assert 1/(1 + x) in R assert Y in R assert X.ring == R assert X*(Y**2 + 1)/(1 + X) == R.convert(x*(y**2 + 1)/(1 + x)) assert X*y == X*Y raises(ExactQuotientFailed, lambda: X/Y) raises(ExactQuotientFailed, lambda: x/Y) raises(ExactQuotientFailed, lambda: X/y) assert X + y == X + Y == R.convert(x + y) == x + Y assert X - y == X - Y == R.convert(x - y) == x - Y assert X + 1 == R.convert(x + 1) assert X**2 / X == X assert R.from_GlobalPolynomialRing(ZZ.old_poly_ring(x, y).convert(x), ZZ.old_poly_ring(x, y)) == X assert R.from_FractionField(Qxy.convert(x), Qxy) == X raises(CoercionFailed, lambda: R.from_FractionField(Qxy.convert(x)/y, Qxy)) raises(ExactQuotientFailed, lambda: X/Y) raises(NotReversible, lambda: X.invert()) assert R._sdm_to_vector( R._vector_to_sdm([X/(X + 1), Y/(1 + X*Y)], R.order), 2) == \ [X*(1 + X*Y), Y*(1 + X)] def test_conversion(): L = QQ.old_poly_ring(x, y, order="ilex") G = QQ.old_poly_ring(x, y) assert L.convert(x) == L.convert(G.convert(x), G) assert G.convert(x) == G.convert(L.convert(x), L) raises(CoercionFailed, lambda: G.convert(L.convert(1/(1 + x)), L)) def test_units(): R = QQ.old_poly_ring(x) assert R.is_unit(R.convert(1)) assert R.is_unit(R.convert(2)) assert not R.is_unit(R.convert(x)) assert not R.is_unit(R.convert(1 + x)) R = QQ.old_poly_ring(x, order='ilex') assert R.is_unit(R.convert(1)) assert R.is_unit(R.convert(2)) assert not R.is_unit(R.convert(x)) assert R.is_unit(R.convert(1 + x)) R = ZZ.old_poly_ring(x) assert R.is_unit(R.convert(1)) assert not R.is_unit(R.convert(2)) assert not R.is_unit(R.convert(x)) assert not R.is_unit(R.convert(1 + x))
dd436001adeed54daa5a8eca27aa7caf0b854ffe0694db7f51e0a0c72b72362d
"""Tests for classes defining properties of ground domains, e.g. ZZ, QQ, ZZ[x] ... """ from sympy import S, sqrt, sin, oo, Poly, Float, Rational from sympy.abc import x, y, z from sympy.polys.domains import ZZ, QQ, RR, CC, FF, GF, EX from sympy.polys.domains.realfield import RealField from sympy.polys.rings import ring from sympy.polys.fields import field from sympy.polys.polyerrors import ( UnificationFailed, GeneratorsError, CoercionFailed, NotInvertible, DomainError) from sympy.polys.polyutils import illegal from sympy.testing.pytest import raises ALG = QQ.algebraic_field(sqrt(2), sqrt(3)) def unify(K0, K1): return K0.unify(K1) def test_Domain_unify(): F3 = GF(3) assert unify(F3, F3) == F3 assert unify(F3, ZZ) == ZZ assert unify(F3, QQ) == QQ assert unify(F3, ALG) == ALG assert unify(F3, RR) == RR assert unify(F3, CC) == CC assert unify(F3, ZZ[x]) == ZZ[x] assert unify(F3, ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(F3, EX) == EX assert unify(ZZ, F3) == ZZ assert unify(ZZ, ZZ) == ZZ assert unify(ZZ, QQ) == QQ assert unify(ZZ, ALG) == ALG assert unify(ZZ, RR) == RR assert unify(ZZ, CC) == CC assert unify(ZZ, ZZ[x]) == ZZ[x] assert unify(ZZ, ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(ZZ, EX) == EX assert unify(QQ, F3) == QQ assert unify(QQ, ZZ) == QQ assert unify(QQ, QQ) == QQ assert unify(QQ, ALG) == ALG assert unify(QQ, RR) == RR assert unify(QQ, CC) == CC assert unify(QQ, ZZ[x]) == QQ[x] assert unify(QQ, ZZ.frac_field(x)) == QQ.frac_field(x) assert unify(QQ, EX) == EX assert unify(RR, F3) == RR assert unify(RR, ZZ) == RR assert unify(RR, QQ) == RR assert unify(RR, ALG) == RR assert unify(RR, RR) == RR assert unify(RR, CC) == CC assert unify(RR, ZZ[x]) == RR[x] assert unify(RR, ZZ.frac_field(x)) == RR.frac_field(x) assert unify(RR, EX) == EX assert RR[x].unify(ZZ.frac_field(y)) == RR.frac_field(x, y) assert unify(CC, F3) == CC assert unify(CC, ZZ) == CC assert unify(CC, QQ) == CC assert unify(CC, ALG) == CC assert unify(CC, RR) == CC assert unify(CC, CC) == CC assert unify(CC, ZZ[x]) == CC[x] assert unify(CC, ZZ.frac_field(x)) == CC.frac_field(x) assert unify(CC, EX) == EX assert unify(ZZ[x], F3) == ZZ[x] assert unify(ZZ[x], ZZ) == ZZ[x] assert unify(ZZ[x], QQ) == QQ[x] assert unify(ZZ[x], ALG) == ALG[x] assert unify(ZZ[x], RR) == RR[x] assert unify(ZZ[x], CC) == CC[x] assert unify(ZZ[x], ZZ[x]) == ZZ[x] assert unify(ZZ[x], ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(ZZ[x], EX) == EX assert unify(ZZ.frac_field(x), F3) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), ZZ) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), QQ) == QQ.frac_field(x) assert unify(ZZ.frac_field(x), ALG) == ALG.frac_field(x) assert unify(ZZ.frac_field(x), RR) == RR.frac_field(x) assert unify(ZZ.frac_field(x), CC) == CC.frac_field(x) assert unify(ZZ.frac_field(x), ZZ[x]) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), EX) == EX assert unify(EX, F3) == EX assert unify(EX, ZZ) == EX assert unify(EX, QQ) == EX assert unify(EX, ALG) == EX assert unify(EX, RR) == EX assert unify(EX, CC) == EX assert unify(EX, ZZ[x]) == EX assert unify(EX, ZZ.frac_field(x)) == EX assert unify(EX, EX) == EX def test_Domain_unify_composite(): assert unify(ZZ.poly_ring(x), ZZ) == ZZ.poly_ring(x) assert unify(ZZ.poly_ring(x), QQ) == QQ.poly_ring(x) assert unify(QQ.poly_ring(x), ZZ) == QQ.poly_ring(x) assert unify(QQ.poly_ring(x), QQ) == QQ.poly_ring(x) assert unify(ZZ, ZZ.poly_ring(x)) == ZZ.poly_ring(x) assert unify(QQ, ZZ.poly_ring(x)) == QQ.poly_ring(x) assert unify(ZZ, QQ.poly_ring(x)) == QQ.poly_ring(x) assert unify(QQ, QQ.poly_ring(x)) == QQ.poly_ring(x) assert unify(ZZ.poly_ring(x, y), ZZ) == ZZ.poly_ring(x, y) assert unify(ZZ.poly_ring(x, y), QQ) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x, y), ZZ) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x, y), QQ) == QQ.poly_ring(x, y) assert unify(ZZ, ZZ.poly_ring(x, y)) == ZZ.poly_ring(x, y) assert unify(QQ, ZZ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(ZZ, QQ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(QQ, QQ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(ZZ.frac_field(x), ZZ) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), QQ) == QQ.frac_field(x) assert unify(QQ.frac_field(x), ZZ) == QQ.frac_field(x) assert unify(QQ.frac_field(x), QQ) == QQ.frac_field(x) assert unify(ZZ, ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(QQ, ZZ.frac_field(x)) == QQ.frac_field(x) assert unify(ZZ, QQ.frac_field(x)) == QQ.frac_field(x) assert unify(QQ, QQ.frac_field(x)) == QQ.frac_field(x) assert unify(ZZ.frac_field(x, y), ZZ) == ZZ.frac_field(x, y) assert unify(ZZ.frac_field(x, y), QQ) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x, y), ZZ) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x, y), QQ) == QQ.frac_field(x, y) assert unify(ZZ, ZZ.frac_field(x, y)) == ZZ.frac_field(x, y) assert unify(QQ, ZZ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(ZZ, QQ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(QQ, QQ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(ZZ.poly_ring(x), ZZ.poly_ring(x)) == ZZ.poly_ring(x) assert unify(ZZ.poly_ring(x), QQ.poly_ring(x)) == QQ.poly_ring(x) assert unify(QQ.poly_ring(x), ZZ.poly_ring(x)) == QQ.poly_ring(x) assert unify(QQ.poly_ring(x), QQ.poly_ring(x)) == QQ.poly_ring(x) assert unify(ZZ.poly_ring(x, y), ZZ.poly_ring(x)) == ZZ.poly_ring(x, y) assert unify(ZZ.poly_ring(x, y), QQ.poly_ring(x)) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x, y), ZZ.poly_ring(x)) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x, y), QQ.poly_ring(x)) == QQ.poly_ring(x, y) assert unify(ZZ.poly_ring(x), ZZ.poly_ring(x, y)) == ZZ.poly_ring(x, y) assert unify(ZZ.poly_ring(x), QQ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x), ZZ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(QQ.poly_ring(x), QQ.poly_ring(x, y)) == QQ.poly_ring(x, y) assert unify(ZZ.poly_ring(x, y), ZZ.poly_ring(x, z)) == ZZ.poly_ring(x, y, z) assert unify(ZZ.poly_ring(x, y), QQ.poly_ring(x, z)) == QQ.poly_ring(x, y, z) assert unify(QQ.poly_ring(x, y), ZZ.poly_ring(x, z)) == QQ.poly_ring(x, y, z) assert unify(QQ.poly_ring(x, y), QQ.poly_ring(x, z)) == QQ.poly_ring(x, y, z) assert unify(ZZ.frac_field(x), ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), QQ.frac_field(x)) == QQ.frac_field(x) assert unify(QQ.frac_field(x), ZZ.frac_field(x)) == QQ.frac_field(x) assert unify(QQ.frac_field(x), QQ.frac_field(x)) == QQ.frac_field(x) assert unify(ZZ.frac_field(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y) assert unify(ZZ.frac_field(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x, y), ZZ.frac_field(x)) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y) assert unify(ZZ.frac_field(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y) assert unify(ZZ.frac_field(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x), ZZ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(QQ.frac_field(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(ZZ.frac_field(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z) assert unify(ZZ.frac_field(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z) assert unify(QQ.frac_field(x, y), ZZ.frac_field(x, z)) == QQ.frac_field(x, y, z) assert unify(QQ.frac_field(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z) assert unify(ZZ.poly_ring(x), ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(ZZ.poly_ring(x), QQ.frac_field(x)) == ZZ.frac_field(x) assert unify(QQ.poly_ring(x), ZZ.frac_field(x)) == ZZ.frac_field(x) assert unify(QQ.poly_ring(x), QQ.frac_field(x)) == QQ.frac_field(x) assert unify(ZZ.poly_ring(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y) assert unify(ZZ.poly_ring(x, y), QQ.frac_field(x)) == ZZ.frac_field(x, y) assert unify(QQ.poly_ring(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y) assert unify(QQ.poly_ring(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y) assert unify(ZZ.poly_ring(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y) assert unify(ZZ.poly_ring(x), QQ.frac_field(x, y)) == ZZ.frac_field(x, y) assert unify(QQ.poly_ring(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y) assert unify(QQ.poly_ring(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y) assert unify(ZZ.poly_ring(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z) assert unify(ZZ.poly_ring(x, y), QQ.frac_field(x, z)) == ZZ.frac_field(x, y, z) assert unify(QQ.poly_ring(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z) assert unify(QQ.poly_ring(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z) assert unify(ZZ.frac_field(x), ZZ.poly_ring(x)) == ZZ.frac_field(x) assert unify(ZZ.frac_field(x), QQ.poly_ring(x)) == ZZ.frac_field(x) assert unify(QQ.frac_field(x), ZZ.poly_ring(x)) == ZZ.frac_field(x) assert unify(QQ.frac_field(x), QQ.poly_ring(x)) == QQ.frac_field(x) assert unify(ZZ.frac_field(x, y), ZZ.poly_ring(x)) == ZZ.frac_field(x, y) assert unify(ZZ.frac_field(x, y), QQ.poly_ring(x)) == ZZ.frac_field(x, y) assert unify(QQ.frac_field(x, y), ZZ.poly_ring(x)) == ZZ.frac_field(x, y) assert unify(QQ.frac_field(x, y), QQ.poly_ring(x)) == QQ.frac_field(x, y) assert unify(ZZ.frac_field(x), ZZ.poly_ring(x, y)) == ZZ.frac_field(x, y) assert unify(ZZ.frac_field(x), QQ.poly_ring(x, y)) == ZZ.frac_field(x, y) assert unify(QQ.frac_field(x), ZZ.poly_ring(x, y)) == ZZ.frac_field(x, y) assert unify(QQ.frac_field(x), QQ.poly_ring(x, y)) == QQ.frac_field(x, y) assert unify(ZZ.frac_field(x, y), ZZ.poly_ring(x, z)) == ZZ.frac_field(x, y, z) assert unify(ZZ.frac_field(x, y), QQ.poly_ring(x, z)) == ZZ.frac_field(x, y, z) assert unify(QQ.frac_field(x, y), ZZ.poly_ring(x, z)) == ZZ.frac_field(x, y, z) assert unify(QQ.frac_field(x, y), QQ.poly_ring(x, z)) == QQ.frac_field(x, y, z) def test_Domain_unify_algebraic(): sqrt5 = QQ.algebraic_field(sqrt(5)) sqrt7 = QQ.algebraic_field(sqrt(7)) sqrt57 = QQ.algebraic_field(sqrt(5), sqrt(7)) assert sqrt5.unify(sqrt7) == sqrt57 assert sqrt5.unify(sqrt5[x, y]) == sqrt5[x, y] assert sqrt5[x, y].unify(sqrt5) == sqrt5[x, y] assert sqrt5.unify(sqrt5.frac_field(x, y)) == sqrt5.frac_field(x, y) assert sqrt5.frac_field(x, y).unify(sqrt5) == sqrt5.frac_field(x, y) assert sqrt5.unify(sqrt7[x, y]) == sqrt57[x, y] assert sqrt5[x, y].unify(sqrt7) == sqrt57[x, y] assert sqrt5.unify(sqrt7.frac_field(x, y)) == sqrt57.frac_field(x, y) assert sqrt5.frac_field(x, y).unify(sqrt7) == sqrt57.frac_field(x, y) def test_Domain_unify_with_symbols(): raises(UnificationFailed, lambda: ZZ[x, y].unify_with_symbols(ZZ, (y, z))) raises(UnificationFailed, lambda: ZZ.unify_with_symbols(ZZ[x, y], (y, z))) def test_Domain__contains__(): assert (0 in EX) is True assert (0 in ZZ) is True assert (0 in QQ) is True assert (0 in RR) is True assert (0 in CC) is True assert (0 in ALG) is True assert (0 in ZZ[x, y]) is True assert (0 in QQ[x, y]) is True assert (0 in RR[x, y]) is True assert (-7 in EX) is True assert (-7 in ZZ) is True assert (-7 in QQ) is True assert (-7 in RR) is True assert (-7 in CC) is True assert (-7 in ALG) is True assert (-7 in ZZ[x, y]) is True assert (-7 in QQ[x, y]) is True assert (-7 in RR[x, y]) is True assert (17 in EX) is True assert (17 in ZZ) is True assert (17 in QQ) is True assert (17 in RR) is True assert (17 in CC) is True assert (17 in ALG) is True assert (17 in ZZ[x, y]) is True assert (17 in QQ[x, y]) is True assert (17 in RR[x, y]) is True assert (Rational(-1, 7) in EX) is True assert (Rational(-1, 7) in ZZ) is False assert (Rational(-1, 7) in QQ) is True assert (Rational(-1, 7) in RR) is True assert (Rational(-1, 7) in CC) is True assert (Rational(-1, 7) in ALG) is True assert (Rational(-1, 7) in ZZ[x, y]) is False assert (Rational(-1, 7) in QQ[x, y]) is True assert (Rational(-1, 7) in RR[x, y]) is True assert (Rational(3, 5) in EX) is True assert (Rational(3, 5) in ZZ) is False assert (Rational(3, 5) in QQ) is True assert (Rational(3, 5) in RR) is True assert (Rational(3, 5) in CC) is True assert (Rational(3, 5) in ALG) is True assert (Rational(3, 5) in ZZ[x, y]) is False assert (Rational(3, 5) in QQ[x, y]) is True assert (Rational(3, 5) in RR[x, y]) is True assert (3.0 in EX) is True assert (3.0 in ZZ) is True assert (3.0 in QQ) is True assert (3.0 in RR) is True assert (3.0 in CC) is True assert (3.0 in ALG) is True assert (3.0 in ZZ[x, y]) is True assert (3.0 in QQ[x, y]) is True assert (3.0 in RR[x, y]) is True assert (3.14 in EX) is True assert (3.14 in ZZ) is False assert (3.14 in QQ) is True assert (3.14 in RR) is True assert (3.14 in CC) is True assert (3.14 in ALG) is True assert (3.14 in ZZ[x, y]) is False assert (3.14 in QQ[x, y]) is True assert (3.14 in RR[x, y]) is True assert (oo in ALG) is False assert (oo in ZZ[x, y]) is False assert (oo in QQ[x, y]) is False assert (-oo in ZZ) is False assert (-oo in QQ) is False assert (-oo in ALG) is False assert (-oo in ZZ[x, y]) is False assert (-oo in QQ[x, y]) is False assert (sqrt(7) in EX) is True assert (sqrt(7) in ZZ) is False assert (sqrt(7) in QQ) is False assert (sqrt(7) in RR) is True assert (sqrt(7) in CC) is True assert (sqrt(7) in ALG) is False assert (sqrt(7) in ZZ[x, y]) is False assert (sqrt(7) in QQ[x, y]) is False assert (sqrt(7) in RR[x, y]) is True assert (2*sqrt(3) + 1 in EX) is True assert (2*sqrt(3) + 1 in ZZ) is False assert (2*sqrt(3) + 1 in QQ) is False assert (2*sqrt(3) + 1 in RR) is True assert (2*sqrt(3) + 1 in CC) is True assert (2*sqrt(3) + 1 in ALG) is True assert (2*sqrt(3) + 1 in ZZ[x, y]) is False assert (2*sqrt(3) + 1 in QQ[x, y]) is False assert (2*sqrt(3) + 1 in RR[x, y]) is True assert (sin(1) in EX) is True assert (sin(1) in ZZ) is False assert (sin(1) in QQ) is False assert (sin(1) in RR) is True assert (sin(1) in CC) is True assert (sin(1) in ALG) is False assert (sin(1) in ZZ[x, y]) is False assert (sin(1) in QQ[x, y]) is False assert (sin(1) in RR[x, y]) is True assert (x**2 + 1 in EX) is True assert (x**2 + 1 in ZZ) is False assert (x**2 + 1 in QQ) is False assert (x**2 + 1 in RR) is False assert (x**2 + 1 in CC) is False assert (x**2 + 1 in ALG) is False assert (x**2 + 1 in ZZ[x]) is True assert (x**2 + 1 in QQ[x]) is True assert (x**2 + 1 in RR[x]) is True assert (x**2 + 1 in ZZ[x, y]) is True assert (x**2 + 1 in QQ[x, y]) is True assert (x**2 + 1 in RR[x, y]) is True assert (x**2 + y**2 in EX) is True assert (x**2 + y**2 in ZZ) is False assert (x**2 + y**2 in QQ) is False assert (x**2 + y**2 in RR) is False assert (x**2 + y**2 in CC) is False assert (x**2 + y**2 in ALG) is False assert (x**2 + y**2 in ZZ[x]) is False assert (x**2 + y**2 in QQ[x]) is False assert (x**2 + y**2 in RR[x]) is False assert (x**2 + y**2 in ZZ[x, y]) is True assert (x**2 + y**2 in QQ[x, y]) is True assert (x**2 + y**2 in RR[x, y]) is True assert (Rational(3, 2)*x/(y + 1) - z in QQ[x, y, z]) is False def test_Domain_get_ring(): assert ZZ.has_assoc_Ring is True assert QQ.has_assoc_Ring is True assert ZZ[x].has_assoc_Ring is True assert QQ[x].has_assoc_Ring is True assert ZZ[x, y].has_assoc_Ring is True assert QQ[x, y].has_assoc_Ring is True assert ZZ.frac_field(x).has_assoc_Ring is True assert QQ.frac_field(x).has_assoc_Ring is True assert ZZ.frac_field(x, y).has_assoc_Ring is True assert QQ.frac_field(x, y).has_assoc_Ring is True assert EX.has_assoc_Ring is False assert RR.has_assoc_Ring is False assert ALG.has_assoc_Ring is False assert ZZ.get_ring() == ZZ assert QQ.get_ring() == ZZ assert ZZ[x].get_ring() == ZZ[x] assert QQ[x].get_ring() == QQ[x] assert ZZ[x, y].get_ring() == ZZ[x, y] assert QQ[x, y].get_ring() == QQ[x, y] assert ZZ.frac_field(x).get_ring() == ZZ[x] assert QQ.frac_field(x).get_ring() == QQ[x] assert ZZ.frac_field(x, y).get_ring() == ZZ[x, y] assert QQ.frac_field(x, y).get_ring() == QQ[x, y] assert EX.get_ring() == EX assert RR.get_ring() == RR # XXX: This should also be like RR raises(DomainError, lambda: ALG.get_ring()) def test_Domain_get_field(): assert EX.has_assoc_Field is True assert ZZ.has_assoc_Field is True assert QQ.has_assoc_Field is True assert RR.has_assoc_Field is True assert ALG.has_assoc_Field is True assert ZZ[x].has_assoc_Field is True assert QQ[x].has_assoc_Field is True assert ZZ[x, y].has_assoc_Field is True assert QQ[x, y].has_assoc_Field is True assert EX.get_field() == EX assert ZZ.get_field() == QQ assert QQ.get_field() == QQ assert RR.get_field() == RR assert ALG.get_field() == ALG assert ZZ[x].get_field() == ZZ.frac_field(x) assert QQ[x].get_field() == QQ.frac_field(x) assert ZZ[x, y].get_field() == ZZ.frac_field(x, y) assert QQ[x, y].get_field() == QQ.frac_field(x, y) def test_Domain_get_exact(): assert EX.get_exact() == EX assert ZZ.get_exact() == ZZ assert QQ.get_exact() == QQ assert RR.get_exact() == QQ assert ALG.get_exact() == ALG assert ZZ[x].get_exact() == ZZ[x] assert QQ[x].get_exact() == QQ[x] assert ZZ[x, y].get_exact() == ZZ[x, y] assert QQ[x, y].get_exact() == QQ[x, y] assert ZZ.frac_field(x).get_exact() == ZZ.frac_field(x) assert QQ.frac_field(x).get_exact() == QQ.frac_field(x) assert ZZ.frac_field(x, y).get_exact() == ZZ.frac_field(x, y) assert QQ.frac_field(x, y).get_exact() == QQ.frac_field(x, y) def test_Domain_convert(): assert QQ.convert(10e-52) == QQ(1684996666696915, 1684996666696914987166688442938726917102321526408785780068975640576) R, x = ring("x", ZZ) assert ZZ.convert(x - x) == 0 assert ZZ.convert(x - x, R.to_domain()) == 0 def test_PolynomialRing__init(): R, = ring("", ZZ) assert ZZ.poly_ring() == R.to_domain() def test_FractionField__init(): F, = field("", ZZ) assert ZZ.frac_field() == F.to_domain() def test_inject(): assert ZZ.inject(x, y, z) == ZZ[x, y, z] assert ZZ[x].inject(y, z) == ZZ[x, y, z] assert ZZ.frac_field(x).inject(y, z) == ZZ.frac_field(x, y, z) raises(GeneratorsError, lambda: ZZ[x].inject(x)) def test_Domain_map(): seq = ZZ.map([1, 2, 3, 4]) assert all(ZZ.of_type(elt) for elt in seq) seq = ZZ.map([[1, 2, 3, 4]]) assert all(ZZ.of_type(elt) for elt in seq[0]) and len(seq) == 1 def test_Domain___eq__(): assert (ZZ[x, y] == ZZ[x, y]) is True assert (QQ[x, y] == QQ[x, y]) is True assert (ZZ[x, y] == QQ[x, y]) is False assert (QQ[x, y] == ZZ[x, y]) is False assert (ZZ.frac_field(x, y) == ZZ.frac_field(x, y)) is True assert (QQ.frac_field(x, y) == QQ.frac_field(x, y)) is True assert (ZZ.frac_field(x, y) == QQ.frac_field(x, y)) is False assert (QQ.frac_field(x, y) == ZZ.frac_field(x, y)) is False assert RealField()[x] == RR[x] def test_Domain__algebraic_field(): alg = ZZ.algebraic_field(sqrt(2)) assert alg.ext.minpoly == Poly(x**2 - 2) assert alg.dom == QQ alg = QQ.algebraic_field(sqrt(2)) assert alg.ext.minpoly == Poly(x**2 - 2) assert alg.dom == QQ alg = alg.algebraic_field(sqrt(3)) assert alg.ext.minpoly == Poly(x**4 - 10*x**2 + 1) assert alg.dom == QQ def test_PolynomialRing_from_FractionField(): F, x,y = field("x,y", ZZ) R, X,Y = ring("x,y", ZZ) f = (x**2 + y**2)/(x + 1) g = (x**2 + y**2)/4 h = x**2 + y**2 assert R.to_domain().from_FractionField(f, F.to_domain()) is None assert R.to_domain().from_FractionField(g, F.to_domain()) == X**2/4 + Y**2/4 assert R.to_domain().from_FractionField(h, F.to_domain()) == X**2 + Y**2 F, x,y = field("x,y", QQ) R, X,Y = ring("x,y", QQ) f = (x**2 + y**2)/(x + 1) g = (x**2 + y**2)/4 h = x**2 + y**2 assert R.to_domain().from_FractionField(f, F.to_domain()) is None assert R.to_domain().from_FractionField(g, F.to_domain()) == X**2/4 + Y**2/4 assert R.to_domain().from_FractionField(h, F.to_domain()) == X**2 + Y**2 def test_FractionField_from_PolynomialRing(): R, x,y = ring("x,y", QQ) F, X,Y = field("x,y", ZZ) f = 3*x**2 + 5*y**2 g = x**2/3 + y**2/5 assert F.to_domain().from_PolynomialRing(f, R.to_domain()) == 3*X**2 + 5*Y**2 assert F.to_domain().from_PolynomialRing(g, R.to_domain()) == (5*X**2 + 3*Y**2)/15 def test_FF_of_type(): assert FF(3).of_type(FF(3)(1)) is True assert FF(5).of_type(FF(5)(3)) is True assert FF(5).of_type(FF(7)(3)) is False def test___eq__(): assert not QQ[x] == ZZ[x] assert not QQ.frac_field(x) == ZZ.frac_field(x) def test_RealField_from_sympy(): assert RR.convert(S.Zero) == RR.dtype(0) assert RR.convert(S(0.0)) == RR.dtype(0.0) assert RR.convert(S.One) == RR.dtype(1) assert RR.convert(S(1.0)) == RR.dtype(1.0) assert RR.convert(sin(1)) == RR.dtype(sin(1).evalf()) def test_not_in_any_domain(): check = illegal + [x] + [ float(i) for i in illegal if i != S.ComplexInfinity] for dom in (ZZ, QQ, RR, CC, EX): for i in check: if i == x and dom == EX: continue assert i not in dom, (i, dom) raises(CoercionFailed, lambda: dom.convert(i)) def test_ModularInteger(): F3 = FF(3) a = F3(0) assert isinstance(a, F3.dtype) and a == 0 a = F3(1) assert isinstance(a, F3.dtype) and a == 1 a = F3(2) assert isinstance(a, F3.dtype) and a == 2 a = F3(3) assert isinstance(a, F3.dtype) and a == 0 a = F3(4) assert isinstance(a, F3.dtype) and a == 1 a = F3(F3(0)) assert isinstance(a, F3.dtype) and a == 0 a = F3(F3(1)) assert isinstance(a, F3.dtype) and a == 1 a = F3(F3(2)) assert isinstance(a, F3.dtype) and a == 2 a = F3(F3(3)) assert isinstance(a, F3.dtype) and a == 0 a = F3(F3(4)) assert isinstance(a, F3.dtype) and a == 1 a = -F3(1) assert isinstance(a, F3.dtype) and a == 2 a = -F3(2) assert isinstance(a, F3.dtype) and a == 1 a = 2 + F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2) + 2 assert isinstance(a, F3.dtype) and a == 1 a = F3(2) + F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2) + F3(2) assert isinstance(a, F3.dtype) and a == 1 a = 3 - F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(3) - 2 assert isinstance(a, F3.dtype) and a == 1 a = F3(3) - F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(3) - F3(2) assert isinstance(a, F3.dtype) and a == 1 a = 2*F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2)*2 assert isinstance(a, F3.dtype) and a == 1 a = F3(2)*F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2)*F3(2) assert isinstance(a, F3.dtype) and a == 1 a = 2/F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2)/2 assert isinstance(a, F3.dtype) and a == 1 a = F3(2)/F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2)/F3(2) assert isinstance(a, F3.dtype) and a == 1 a = 1 % F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(1) % 2 assert isinstance(a, F3.dtype) and a == 1 a = F3(1) % F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(1) % F3(2) assert isinstance(a, F3.dtype) and a == 1 a = F3(2)**0 assert isinstance(a, F3.dtype) and a == 1 a = F3(2)**1 assert isinstance(a, F3.dtype) and a == 2 a = F3(2)**2 assert isinstance(a, F3.dtype) and a == 1 F7 = FF(7) a = F7(3)**100000000000 assert isinstance(a, F7.dtype) and a == 4 a = F7(3)**-100000000000 assert isinstance(a, F7.dtype) and a == 2 a = F7(3)**S(2) assert isinstance(a, F7.dtype) and a == 2 assert bool(F3(3)) is False assert bool(F3(4)) is True F5 = FF(5) a = F5(1)**(-1) assert isinstance(a, F5.dtype) and a == 1 a = F5(2)**(-1) assert isinstance(a, F5.dtype) and a == 3 a = F5(3)**(-1) assert isinstance(a, F5.dtype) and a == 2 a = F5(4)**(-1) assert isinstance(a, F5.dtype) and a == 4 assert (F5(1) < F5(2)) is True assert (F5(1) <= F5(2)) is True assert (F5(1) > F5(2)) is False assert (F5(1) >= F5(2)) is False assert (F5(3) < F5(2)) is False assert (F5(3) <= F5(2)) is False assert (F5(3) > F5(2)) is True assert (F5(3) >= F5(2)) is True assert (F5(1) < F5(7)) is True assert (F5(1) <= F5(7)) is True assert (F5(1) > F5(7)) is False assert (F5(1) >= F5(7)) is False assert (F5(3) < F5(7)) is False assert (F5(3) <= F5(7)) is False assert (F5(3) > F5(7)) is True assert (F5(3) >= F5(7)) is True assert (F5(1) < 2) is True assert (F5(1) <= 2) is True assert (F5(1) > 2) is False assert (F5(1) >= 2) is False assert (F5(3) < 2) is False assert (F5(3) <= 2) is False assert (F5(3) > 2) is True assert (F5(3) >= 2) is True assert (F5(1) < 7) is True assert (F5(1) <= 7) is True assert (F5(1) > 7) is False assert (F5(1) >= 7) is False assert (F5(3) < 7) is False assert (F5(3) <= 7) is False assert (F5(3) > 7) is True assert (F5(3) >= 7) is True raises(NotInvertible, lambda: F5(0)**(-1)) raises(NotInvertible, lambda: F5(5)**(-1)) raises(ValueError, lambda: FF(0)) raises(ValueError, lambda: FF(2.1)) def test_QQ_int(): assert int(QQ(2**2000, 3**1250)) == 455431 assert int(QQ(2**100, 3)) == 422550200076076467165567735125 def test_RR_double(): assert RR(3.14) > 1e-50 assert RR(1e-13) > 1e-50 assert RR(1e-14) > 1e-50 assert RR(1e-15) > 1e-50 assert RR(1e-20) > 1e-50 assert RR(1e-40) > 1e-50 def test_RR_Float(): f1 = Float("1.01") f2 = Float("1.0000000000000000000001") assert f1._prec == 53 assert f2._prec == 80 assert RR(f1)-1 > 1e-50 assert RR(f2)-1 < 1e-50 # RR's precision is lower than f2's RR2 = RealField(prec=f2._prec) assert RR2(f1)-1 > 1e-50 assert RR2(f2)-1 > 1e-50 # RR's precision is equal to f2's def test_CC_double(): assert CC(3.14).real > 1e-50 assert CC(1e-13).real > 1e-50 assert CC(1e-14).real > 1e-50 assert CC(1e-15).real > 1e-50 assert CC(1e-20).real > 1e-50 assert CC(1e-40).real > 1e-50 assert CC(3.14j).imag > 1e-50 assert CC(1e-13j).imag > 1e-50 assert CC(1e-14j).imag > 1e-50 assert CC(1e-15j).imag > 1e-50 assert CC(1e-20j).imag > 1e-50 assert CC(1e-40j).imag > 1e-50 def test_issue_18278(): assert str(RR(2).parent()) == 'RR' assert str(CC(2).parent()) == 'CC'
c3beaa5cefbf1cde8b41b57b97787b80966c33e0d9da2a365fe90f5a21d844dc
"""Test ideals.py code.""" from sympy.polys import QQ, ilex from sympy.abc import x, y, z from sympy.testing.pytest import raises def test_ideal_operations(): R = QQ.old_poly_ring(x, y) I = R.ideal(x) J = R.ideal(y) S = R.ideal(x*y) T = R.ideal(x, y) assert not (I == J) assert I == I assert I.union(J) == T assert I + J == T assert I + T == T assert not I.subset(T) assert T.subset(I) assert I.product(J) == S assert I*J == S assert x*J == S assert I*y == S assert R.convert(x)*J == S assert I*R.convert(y) == S assert not I.is_zero() assert not J.is_whole_ring() assert R.ideal(x**2 + 1, x).is_whole_ring() assert R.ideal() == R.ideal(0) assert R.ideal().is_zero() assert T.contains(x*y) assert T.subset([x, y]) assert T.in_terms_of_generators(x) == [R(1), R(0)] assert T**0 == R.ideal(1) assert T**1 == T assert T**2 == R.ideal(x**2, y**2, x*y) assert I**5 == R.ideal(x**5) def test_exceptions(): I = QQ.old_poly_ring(x).ideal(x) J = QQ.old_poly_ring(y).ideal(1) raises(ValueError, lambda: I.union(x)) raises(ValueError, lambda: I + J) raises(ValueError, lambda: I * J) raises(ValueError, lambda: I.union(J)) assert (I == J) is False assert I != J def test_nontriv_global(): R = QQ.old_poly_ring(x, y, z) def contains(I, f): return R.ideal(*I).contains(f) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**3) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4 + y**3 + 2*z*y*x) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y*z) assert contains([x, 1 + x + y, 5 - 7*y], 1) assert contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**3) assert not contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**2 + y**2) # compare local order assert not contains([x*(1 + x + y), y*(1 + z)], x) assert not contains([x*(1 + x + y), y*(1 + z)], x + y) def test_nontriv_local(): R = QQ.old_poly_ring(x, y, z, order=ilex) def contains(I, f): return R.ideal(*I).contains(f) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x*(1 + x + y), y*(1 + z)], x) assert contains([x*(1 + x + y), y*(1 + z)], x + y) def test_intersection(): R = QQ.old_poly_ring(x, y, z) # SCA, example 1.8.11 assert R.ideal(x, y).intersect(R.ideal(y**2, z)) == R.ideal(y**2, y*z, x*z) assert R.ideal(x, y).intersect(R.ideal()).is_zero() R = QQ.old_poly_ring(x, y, z, order="ilex") assert R.ideal(x, y).intersect(R.ideal(y**2 + y**2*z, z + z*x**3*y)) == \ R.ideal(y**2, y*z, x*z) def test_quotient(): # SCA, example 1.8.13 R = QQ.old_poly_ring(x, y, z) assert R.ideal(x, y).quotient(R.ideal(y**2, z)) == R.ideal(x, y) def test_reduction(): from sympy.polys.distributedmodules import sdm_nf_buchberger_reduced R = QQ.old_poly_ring(x, y) I = R.ideal(x**5, y) e = R.convert(x**3 + y**2) assert I.reduce_element(e) == e assert I.reduce_element(e, NF=sdm_nf_buchberger_reduced) == R.convert(x**3)
4b9a8aa24da2130df1818e02a858d840fbc146dcee5f4199b4ea9198a1ff4036
"""Test modules.py code.""" from sympy.polys.agca.modules import FreeModule, ModuleOrder, FreeModulePolyRing from sympy.polys import CoercionFailed, QQ, lex, grlex, ilex, ZZ from sympy.abc import x, y, z from sympy.testing.pytest import raises from sympy import Rational def test_FreeModuleElement(): M = QQ.old_poly_ring(x).free_module(3) e = M.convert([1, x, x**2]) f = [QQ.old_poly_ring(x).convert(1), QQ.old_poly_ring(x).convert(x), QQ.old_poly_ring(x).convert(x**2)] assert list(e) == f assert f[0] == e[0] assert f[1] == e[1] assert f[2] == e[2] raises(IndexError, lambda: e[3]) g = M.convert([x, 0, 0]) assert e + g == M.convert([x + 1, x, x**2]) assert f + g == M.convert([x + 1, x, x**2]) assert -e == M.convert([-1, -x, -x**2]) assert e - g == M.convert([1 - x, x, x**2]) assert e != g assert M.convert([x, x, x]) / QQ.old_poly_ring(x).convert(x) == [1, 1, 1] R = QQ.old_poly_ring(x, order="ilex") assert R.free_module(1).convert([x]) / R.convert(x) == [1] def test_FreeModule(): M1 = FreeModule(QQ.old_poly_ring(x), 2) assert M1 == FreeModule(QQ.old_poly_ring(x), 2) assert M1 != FreeModule(QQ.old_poly_ring(y), 2) assert M1 != FreeModule(QQ.old_poly_ring(x), 3) M2 = FreeModule(QQ.old_poly_ring(x, order="ilex"), 2) assert [x, 1] in M1 assert [x] not in M1 assert [2, y] not in M1 assert [1/(x + 1), 2] not in M1 e = M1.convert([x, x**2 + 1]) X = QQ.old_poly_ring(x).convert(x) assert e == [X, X**2 + 1] assert e == [x, x**2 + 1] assert 2*e == [2*x, 2*x**2 + 2] assert e*2 == [2*x, 2*x**2 + 2] assert e/2 == [x/2, (x**2 + 1)/2] assert x*e == [x**2, x**3 + x] assert e*x == [x**2, x**3 + x] assert X*e == [x**2, x**3 + x] assert e*X == [x**2, x**3 + x] assert [x, 1] in M2 assert [x] not in M2 assert [2, y] not in M2 assert [1/(x + 1), 2] in M2 e = M2.convert([x, x**2 + 1]) X = QQ.old_poly_ring(x, order="ilex").convert(x) assert e == [X, X**2 + 1] assert e == [x, x**2 + 1] assert 2*e == [2*x, 2*x**2 + 2] assert e*2 == [2*x, 2*x**2 + 2] assert e/2 == [x/2, (x**2 + 1)/2] assert x*e == [x**2, x**3 + x] assert e*x == [x**2, x**3 + x] assert e/(1 + x) == [x/(1 + x), (x**2 + 1)/(1 + x)] assert X*e == [x**2, x**3 + x] assert e*X == [x**2, x**3 + x] M3 = FreeModule(QQ.old_poly_ring(x, y), 2) assert M3.convert(e) == M3.convert([x, x**2 + 1]) assert not M3.is_submodule(0) assert not M3.is_zero() raises(NotImplementedError, lambda: ZZ.old_poly_ring(x).free_module(2)) raises(NotImplementedError, lambda: FreeModulePolyRing(ZZ, 2)) raises(CoercionFailed, lambda: M1.convert(QQ.old_poly_ring(x).free_module(3) .convert([1, 2, 3]))) raises(CoercionFailed, lambda: M3.convert(1)) def test_ModuleOrder(): o1 = ModuleOrder(lex, grlex, False) o2 = ModuleOrder(ilex, lex, False) assert o1 == ModuleOrder(lex, grlex, False) assert (o1 != ModuleOrder(lex, grlex, False)) is False assert o1 != o2 assert o1((1, 2, 3)) == (1, (5, (2, 3))) assert o2((1, 2, 3)) == (-1, (2, 3)) def test_SubModulePolyRing_global(): R = QQ.old_poly_ring(x, y) F = R.free_module(3) Fd = F.submodule([1, 0, 0], [1, 2, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, 1 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert not F.submodule([1 + x, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule([1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1])) == F assert not M.is_submodule(0) m = F.convert([x**2 + y**2, 1, 0]) n = M.convert(m) assert m.module is F assert n.module is M raises(ValueError, lambda: M.submodule([1, 0, 0])) raises(TypeError, lambda: M.union(1)) raises(ValueError, lambda: M.union(R.free_module(1).submodule([x]))) assert F.submodule([x, x, x]) != F.submodule([x, x, x], order="ilex") def test_SubModulePolyRing_local(): R = QQ.old_poly_ring(x, y, order=ilex) F = R.free_module(3) Fd = F.submodule([1 + x, 0, 0], [1 + y, 2 + 2*y, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, 1 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert F.submodule([1 + x, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule( [1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1 + x*y])) == F raises(ValueError, lambda: M.submodule([1, 0, 0])) def test_SubModulePolyRing_nontriv_global(): R = QQ.old_poly_ring(x, y, z) F = R.free_module(1) def contains(I, f): return F.submodule(*[[g] for g in I]).contains([f]) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**3) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y**2) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x**4 + y**3 + 2*z*y*x) assert contains([x + y + z, x*y + x*z + y*z, x*y*z], x*y*z) assert contains([x, 1 + x + y, 5 - 7*y], 1) assert contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**3) assert not contains( [x**3 + y**3, y**3 + z**3, z**3 + x**3, x**2*y + x**2*z + y**2*z], x**2 + y**2) # compare local order assert not contains([x*(1 + x + y), y*(1 + z)], x) assert not contains([x*(1 + x + y), y*(1 + z)], x + y) def test_SubModulePolyRing_nontriv_local(): R = QQ.old_poly_ring(x, y, z, order=ilex) F = R.free_module(1) def contains(I, f): return F.submodule(*[[g] for g in I]).contains([f]) assert contains([x, y], x) assert contains([x, y], x + y) assert not contains([x, y], 1) assert not contains([x, y], z) assert contains([x**2 + y, x**2 + x], x - y) assert not contains([x + y + z, x*y + x*z + y*z, x*y*z], x**2) assert contains([x*(1 + x + y), y*(1 + z)], x) assert contains([x*(1 + x + y), y*(1 + z)], x + y) def test_syzygy(): R = QQ.old_poly_ring(x, y, z) M = R.free_module(1).submodule([x*y], [y*z], [x*z]) S = R.free_module(3).submodule([0, x, -y], [z, -x, 0]) assert M.syzygy_module() == S M2 = M / ([x*y*z],) S2 = R.free_module(3).submodule([z, 0, 0], [0, x, 0], [0, 0, y]) assert M2.syzygy_module() == S2 F = R.free_module(3) assert F.submodule(*F.basis()).syzygy_module() == F.submodule() R2 = QQ.old_poly_ring(x, y, z) / [x*y*z] M3 = R2.free_module(1).submodule([x*y], [y*z], [x*z]) S3 = R2.free_module(3).submodule([z, 0, 0], [0, x, 0], [0, 0, y]) assert M3.syzygy_module() == S3 def test_in_terms_of_generators(): R = QQ.old_poly_ring(x, order="ilex") M = R.free_module(2).submodule([2*x, 0], [1, 2]) assert M.in_terms_of_generators( [x, x]) == [R.convert(Rational(1, 4)), R.convert(x/2)] raises(ValueError, lambda: M.in_terms_of_generators([1, 0])) M = R.free_module(2) / ([x, 0], [1, 1]) SM = M.submodule([1, x]) assert SM.in_terms_of_generators([2, 0]) == [R.convert(-2/(x - 1))] R = QQ.old_poly_ring(x, y) / [x**2 - y**2] M = R.free_module(2) SM = M.submodule([x, 0], [0, y]) assert SM.in_terms_of_generators( [x**2, x**2]) == [R.convert(x), R.convert(y)] def test_QuotientModuleElement(): R = QQ.old_poly_ring(x) F = R.free_module(3) N = F.submodule([1, x, x**2]) M = F/N e = M.convert([x**2, 2, 0]) assert M.convert([x + 1, x**2 + x, x**3 + x**2]) == 0 assert e == [x**2, 2, 0] + N == F.convert([x**2, 2, 0]) + N == \ M.convert(F.convert([x**2, 2, 0])) assert M.convert([x**2 + 1, 2*x + 2, x**2]) == e + [0, x, 0] == \ e + M.convert([0, x, 0]) == e + F.convert([0, x, 0]) assert M.convert([x**2 + 1, 2, x**2]) == e - [0, x, 0] == \ e - M.convert([0, x, 0]) == e - F.convert([0, x, 0]) assert M.convert([0, 2, 0]) == M.convert([x**2, 4, 0]) - e == \ [x**2, 4, 0] - e == F.convert([x**2, 4, 0]) - e assert M.convert([x**3 + x**2, 2*x + 2, 0]) == (1 + x)*e == \ R.convert(1 + x)*e == e*(1 + x) == e*R.convert(1 + x) assert -e == [-x**2, -2, 0] f = [x, x, 0] + N assert M.convert([1, 1, 0]) == f / x == f / R.convert(x) M2 = F/[(2, 2*x, 2*x**2), (0, 0, 1)] G = R.free_module(2) M3 = G/[[1, x]] M4 = F.submodule([1, x, x**2], [1, 0, 0]) / N raises(CoercionFailed, lambda: M.convert(G.convert([1, x]))) raises(CoercionFailed, lambda: M.convert(M3.convert([1, x]))) raises(CoercionFailed, lambda: M.convert(M2.convert([1, x, x]))) assert M2.convert(M.convert([2, x, x**2])) == [2, x, 0] assert M.convert(M4.convert([2, 0, 0])) == [2, 0, 0] def test_QuotientModule(): R = QQ.old_poly_ring(x) F = R.free_module(3) N = F.submodule([1, x, x**2]) M = F/N assert M != F assert M != N assert M == F / [(1, x, x**2)] assert not M.is_zero() assert (F / F.basis()).is_zero() SQ = F.submodule([1, x, x**2], [2, 0, 0]) / N assert SQ == M.submodule([2, x, x**2]) assert SQ != M.submodule([2, 1, 0]) assert SQ != M assert M.is_submodule(SQ) assert not SQ.is_full_module() raises(ValueError, lambda: N/F) raises(ValueError, lambda: F.submodule([2, 0, 0]) / N) raises(ValueError, lambda: R.free_module(2)/F) raises(CoercionFailed, lambda: F.convert(M.convert([1, x, x**2]))) M1 = F / [[1, 1, 1]] M2 = M1.submodule([1, 0, 0], [0, 1, 0]) assert M1 == M2 def test_ModulesQuotientRing(): R = QQ.old_poly_ring(x, y, order=(("lex", x), ("ilex", y))) / [x**2 + 1] M1 = R.free_module(2) assert M1 == R.free_module(2) assert M1 != QQ.old_poly_ring(x).free_module(2) assert M1 != R.free_module(3) assert [x, 1] in M1 assert [x] not in M1 assert [1/(R.convert(x) + 1), 2] in M1 assert [1, 2/(1 + y)] in M1 assert [1, 2/y] not in M1 assert M1.convert([x**2, y]) == [-1, y] F = R.free_module(3) Fd = F.submodule([x**2, 0, 0], [1, 2, 0], [1, 2, 3]) M = F.submodule([x**2 + y**2, 1, 0], [x, y, 1]) assert F == Fd assert Fd == F assert F != M assert M != F assert Fd != M assert M != Fd assert Fd == F.submodule(*F.basis()) assert Fd.is_full_module() assert not M.is_full_module() assert not Fd.is_zero() assert not M.is_zero() assert Fd.submodule().is_zero() assert M.contains([x**2 + y**2 + x, -x**2 + y, 1]) assert not M.contains([x**2 + y**2 + x, 1 + y, 2]) assert M.contains([y**2, 1 - x*y, -x]) assert F.submodule([x, 0, 0]) == F.submodule([1, 0, 0]) assert not F.submodule([y, 0, 0]) == F.submodule([1, 0, 0]) assert F.submodule([1, 0, 0], [0, 1, 0]).union(F.submodule([0, 0, 1])) == F assert not M.is_submodule(0) def test_module_mul(): R = QQ.old_poly_ring(x) M = R.free_module(2) S1 = M.submodule([x, 0], [0, x]) S2 = M.submodule([x**2, 0], [0, x**2]) I = R.ideal(x) assert I*M == M*I == S1 == x*M == M*x assert I*S1 == S2 == x*S1 def test_intersection(): # SCA, example 2.8.5 F = QQ.old_poly_ring(x, y).free_module(2) M1 = F.submodule([x, y], [y, 1]) M2 = F.submodule([0, y - 1], [x, 1], [y, x]) I = F.submodule([x, y], [y**2 - y, y - 1], [x*y + y, x + 1]) I1, rel1, rel2 = M1.intersect(M2, relations=True) assert I1 == M2.intersect(M1) == I for i, g in enumerate(I1.gens): assert g == sum(c*x for c, x in zip(rel1[i], M1.gens)) \ == sum(d*y for d, y in zip(rel2[i], M2.gens)) assert F.submodule([x, y]).intersect(F.submodule([y, x])).is_zero() def test_quotient(): # SCA, example 2.8.6 R = QQ.old_poly_ring(x, y, z) F = R.free_module(2) assert F.submodule([x*y, x*z], [y*z, x*y]).module_quotient( F.submodule([y, z], [z, y])) == QQ.old_poly_ring(x, y, z).ideal(x**2*y**2 - x*y*z**2) assert F.submodule([x, y]).module_quotient(F.submodule()).is_whole_ring() M = F.submodule([x**2, x**2], [y**2, y**2]) N = F.submodule([x + y, x + y]) q, rel = M.module_quotient(N, relations=True) assert q == R.ideal(y**2, x - y) for i, g in enumerate(q.gens): assert g*N.gens[0] == sum(c*x for c, x in zip(rel[i], M.gens)) def test_groebner_extendend(): M = QQ.old_poly_ring(x, y, z).free_module(3).submodule([x + 1, y, 1], [x*y, z, z**2]) G, R = M._groebner_vec(extended=True) for i, g in enumerate(G): assert g == sum(c*gen for c, gen in zip(R[i], M.gens))
e661fe858128cd4bccdf3e5e1fe0f6015272cdfa9feb88b197ba9d325302a9ab
"""Tests for homomorphisms.""" from sympy import QQ, S from sympy.abc import x, y from sympy.polys.agca import homomorphism from sympy.testing.pytest import raises def test_printing(): R = QQ.old_poly_ring(x) assert str(homomorphism(R.free_module(1), R.free_module(1), [0])) == \ 'Matrix([[0]]) : QQ[x]**1 -> QQ[x]**1' assert str(homomorphism(R.free_module(2), R.free_module(2), [0, 0])) == \ 'Matrix([ \n[0, 0], : QQ[x]**2 -> QQ[x]**2\n[0, 0]]) ' assert str(homomorphism(R.free_module(1), R.free_module(1) / [[x]], [0])) == \ 'Matrix([[0]]) : QQ[x]**1 -> QQ[x]**1/<[x]>' assert str(R.free_module(0).identity_hom()) == 'Matrix(0, 0, []) : QQ[x]**0 -> QQ[x]**0' def test_operations(): F = QQ.old_poly_ring(x).free_module(2) G = QQ.old_poly_ring(x).free_module(3) f = F.identity_hom() g = homomorphism(F, F, [0, [1, x]]) h = homomorphism(F, F, [[1, 0], 0]) i = homomorphism(F, G, [[1, 0, 0], [0, 1, 0]]) assert f == f assert f != g assert f != i assert (f != F.identity_hom()) is False assert 2*f == f*2 == homomorphism(F, F, [[2, 0], [0, 2]]) assert f/2 == homomorphism(F, F, [[S.Half, 0], [0, S.Half]]) assert f + g == homomorphism(F, F, [[1, 0], [1, x + 1]]) assert f - g == homomorphism(F, F, [[1, 0], [-1, 1 - x]]) assert f*g == g == g*f assert h*g == homomorphism(F, F, [0, [1, 0]]) assert g*h == homomorphism(F, F, [0, 0]) assert i*f == i assert f([1, 2]) == [1, 2] assert g([1, 2]) == [2, 2*x] assert i.restrict_domain(F.submodule([x, x]))([x, x]) == i([x, x]) h1 = h.quotient_domain(F.submodule([0, 1])) assert h1([1, 0]) == h([1, 0]) assert h1.restrict_domain(h1.domain.submodule([x, 0]))([x, 0]) == h([x, 0]) raises(TypeError, lambda: f/g) raises(TypeError, lambda: f + 1) raises(TypeError, lambda: f + i) raises(TypeError, lambda: f - 1) raises(TypeError, lambda: f*i) def test_creation(): F = QQ.old_poly_ring(x).free_module(3) G = QQ.old_poly_ring(x).free_module(2) SM = F.submodule([1, 1, 1]) Q = F / SM SQ = Q.submodule([1, 0, 0]) matrix = [[1, 0], [0, 1], [-1, -1]] h = homomorphism(F, G, matrix) h2 = homomorphism(Q, G, matrix) assert h.quotient_domain(SM) == h2 raises(ValueError, lambda: h.quotient_domain(F.submodule([1, 0, 0]))) assert h2.restrict_domain(SQ) == homomorphism(SQ, G, matrix) raises(ValueError, lambda: h.restrict_domain(G)) raises(ValueError, lambda: h.restrict_codomain(G.submodule([1, 0]))) raises(ValueError, lambda: h.quotient_codomain(F)) im = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] for M in [F, SM, Q, SQ]: assert M.identity_hom() == homomorphism(M, M, im) assert SM.inclusion_hom() == homomorphism(SM, F, im) assert SQ.inclusion_hom() == homomorphism(SQ, Q, im) assert Q.quotient_hom() == homomorphism(F, Q, im) assert SQ.quotient_hom() == homomorphism(SQ.base, SQ, im) class conv(object): def convert(x, y=None): return x class dummy(object): container = conv() def submodule(*args): return None raises(TypeError, lambda: homomorphism(dummy(), G, matrix)) raises(TypeError, lambda: homomorphism(F, dummy(), matrix)) raises( ValueError, lambda: homomorphism(QQ.old_poly_ring(x, y).free_module(3), G, matrix)) raises(ValueError, lambda: homomorphism(F, G, [0, 0])) def test_properties(): R = QQ.old_poly_ring(x, y) F = R.free_module(2) h = homomorphism(F, F, [[x, 0], [y, 0]]) assert h.kernel() == F.submodule([-y, x]) assert h.image() == F.submodule([x, 0], [y, 0]) assert not h.is_injective() assert not h.is_surjective() assert h.restrict_codomain(h.image()).is_surjective() assert h.restrict_domain(F.submodule([1, 0])).is_injective() assert h.quotient_domain( h.kernel()).restrict_codomain(h.image()).is_isomorphism() R2 = QQ.old_poly_ring(x, y, order=(("lex", x), ("ilex", y))) / [x**2 + 1] F = R2.free_module(2) h = homomorphism(F, F, [[x, 0], [y, y + 1]]) assert h.is_isomorphism()
d0ef32dc3412e03af23a984427f3ffc649950b142ce4c18efbd2cdef9269150a
""" Checks that SymPy does not contain indirect imports. An indirect import is importing a symbol from a module that itself imported the symbol from elsewhere. Such a constellation makes it harder to diagnose inter-module dependencies and import order problems, and is therefore strongly discouraged. (Indirect imports from end-user code is fine and in fact a best practice.) Implementation note: Forcing Python into actually unloading already-imported submodules is a tricky and partly undocumented process. To avoid these issues, the actual diagnostic code is in bin/diagnose_imports, which is run as a separate, pristine Python process. """ from __future__ import print_function import subprocess import sys from os.path import abspath, dirname, join, normpath import inspect from sympy.testing.pytest import XFAIL @XFAIL def test_module_imports_are_direct(): my_filename = abspath(inspect.getfile(inspect.currentframe())) my_dirname = dirname(my_filename) diagnose_imports_filename = join(my_dirname, 'diagnose_imports.py') diagnose_imports_filename = normpath(diagnose_imports_filename) process = subprocess.Popen( [ sys.executable, normpath(diagnose_imports_filename), '--problems', '--by-importer' ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1) output, _ = process.communicate() assert output == '', "There are import problems:\n" + output.decode()
6864e181e14ec3c1a722998769ff4133b319d926a9f4b8689c5da2f48dd4c45e
#!/usr/bin/env python """ Import diagnostics. Run bin/diagnose_imports.py --help for details. """ from __future__ import print_function from typing import Dict if __name__ == "__main__": import sys import inspect from sympy.core.compatibility import builtins import optparse from os.path import abspath, dirname, join, normpath this_file = abspath(__file__) sympy_dir = join(dirname(this_file), '..', '..', '..') sympy_dir = normpath(sympy_dir) sys.path.insert(0, sympy_dir) option_parser = optparse.OptionParser( usage= "Usage: %prog option [options]\n" "\n" "Import analysis for imports between SymPy modules.") option_group = optparse.OptionGroup( option_parser, 'Analysis options', 'Options that define what to do. Exactly one of these must be given.') option_group.add_option( '--problems', help= 'Print all import problems, that is: ' 'If an import pulls in a package instead of a module ' '(e.g. sympy.core instead of sympy.core.add); ' # see ##PACKAGE## 'if it imports a symbol that is already present; ' # see ##DUPLICATE## 'if it imports a symbol ' 'from somewhere other than the defining module.', # see ##ORIGIN## action='count') option_group.add_option( '--origins', help= 'For each imported symbol in each module, ' 'print the module that defined it. ' '(This is useful for import refactoring.)', action='count') option_parser.add_option_group(option_group) option_group = optparse.OptionGroup( option_parser, 'Sort options', 'These options define the sort order for output lines. ' 'At most one of these options is allowed. ' 'Unsorted output will reflect the order in which imports happened.') option_group.add_option( '--by-importer', help='Sort output lines by name of importing module.', action='count') option_group.add_option( '--by-origin', help='Sort output lines by name of imported module.', action='count') option_parser.add_option_group(option_group) (options, args) = option_parser.parse_args() if args: option_parser.error( 'Unexpected arguments %s (try %s --help)' % (args, sys.argv[0])) if options.problems > 1: option_parser.error('--problems must not be given more than once.') if options.origins > 1: option_parser.error('--origins must not be given more than once.') if options.by_importer > 1: option_parser.error('--by-importer must not be given more than once.') if options.by_origin > 1: option_parser.error('--by-origin must not be given more than once.') options.problems = options.problems == 1 options.origins = options.origins == 1 options.by_importer = options.by_importer == 1 options.by_origin = options.by_origin == 1 if not options.problems and not options.origins: option_parser.error( 'At least one of --problems and --origins is required') if options.problems and options.origins: option_parser.error( 'At most one of --problems and --origins is allowed') if options.by_importer and options.by_origin: option_parser.error( 'At most one of --by-importer and --by-origin is allowed') options.by_process = not options.by_importer and not options.by_origin builtin_import = builtins.__import__ class Definition(object): """Information about a symbol's definition.""" def __init__(self, name, value, definer): self.name = name self.value = value self.definer = definer def __hash__(self): return hash(self.name) def __eq__(self, other): return self.name == other.name and self.value == other.value def __ne__(self, other): return not (self == other) def __repr__(self): return 'Definition(%s, ..., %s)' % ( repr(self.name), repr(self.definer)) # Maps each function/variable to name of module to define it symbol_definers = {} # type: Dict[Definition, str] def in_module(a, b): """Is a the same module as or a submodule of b?""" return a == b or a != None and b != None and a.startswith(b + '.') def relevant(module): """Is module relevant for import checking? Only imports between relevant modules will be checked.""" return in_module(module, 'sympy') sorted_messages = [] def msg(msg, *args): global options, sorted_messages if options.by_process: print(msg % args) else: sorted_messages.append(msg % args) def tracking_import(module, globals=globals(), locals=[], fromlist=None, level=-1): """__import__ wrapper - does not change imports at all, but tracks them. Default order is implemented by doing output directly. All other orders are implemented by collecting output information into a sorted list that will be emitted after all imports are processed. Indirect imports can only occur after the requested symbol has been imported directly (because the indirect import would not have a module to pick the symbol up from). So this code detects indirect imports by checking whether the symbol in question was already imported. Keeps the semantics of __import__ unchanged.""" global options, symbol_definers caller_frame = inspect.getframeinfo(sys._getframe(1)) importer_filename = caller_frame.filename importer_module = globals['__name__'] if importer_filename == caller_frame.filename: importer_reference = '%s line %s' % ( importer_filename, str(caller_frame.lineno)) else: importer_reference = importer_filename result = builtin_import(module, globals, locals, fromlist, level) importee_module = result.__name__ # We're only interested if importer and importee are in SymPy if relevant(importer_module) and relevant(importee_module): for symbol in result.__dict__.iterkeys(): definition = Definition( symbol, result.__dict__[symbol], importer_module) if not definition in symbol_definers: symbol_definers[definition] = importee_module if hasattr(result, '__path__'): ##PACKAGE## # The existence of __path__ is documented in the tutorial on modules. # Python 3.3 documents this in http://docs.python.org/3.3/reference/import.html if options.by_origin: msg('Error: %s (a package) is imported by %s', module, importer_reference) else: msg('Error: %s contains package import %s', importer_reference, module) if fromlist != None: symbol_list = fromlist if '*' in symbol_list: if (importer_filename.endswith('__init__.py') or importer_filename.endswith('__init__.pyc') or importer_filename.endswith('__init__.pyo')): # We do not check starred imports inside __init__ # That's the normal "please copy over its imports to my namespace" symbol_list = [] else: symbol_list = result.__dict__.iterkeys() for symbol in symbol_list: if not symbol in result.__dict__: if options.by_origin: msg('Error: %s.%s is not defined (yet), but %s tries to import it', importee_module, symbol, importer_reference) else: msg('Error: %s tries to import %s.%s, which did not define it (yet)', importer_reference, importee_module, symbol) else: definition = Definition( symbol, result.__dict__[symbol], importer_module) symbol_definer = symbol_definers[definition] if symbol_definer == importee_module: ##DUPLICATE## if options.by_origin: msg('Error: %s.%s is imported again into %s', importee_module, symbol, importer_reference) else: msg('Error: %s imports %s.%s again', importer_reference, importee_module, symbol) else: ##ORIGIN## if options.by_origin: msg('Error: %s.%s is imported by %s, which should import %s.%s instead', importee_module, symbol, importer_reference, symbol_definer, symbol) else: msg('Error: %s imports %s.%s but should import %s.%s instead', importer_reference, importee_module, symbol, symbol_definer, symbol) return result builtins.__import__ = tracking_import __import__('sympy') sorted_messages.sort() for message in sorted_messages: print(message)
1937dd52ab30a55d383de5d987772cd9ad4b673f95cd2c8b31d8cfe3bbca73b9
import warnings from sympy.testing.pytest import (raises, warns, ignore_warnings, warns_deprecated_sympy, Failed) from sympy.utilities.exceptions import SymPyDeprecationWarning # Test callables def test_expected_exception_is_silent_callable(): def f(): raise ValueError() raises(ValueError, f) # Under pytest raises will raise Failed rather than AssertionError def test_lack_of_exception_triggers_AssertionError_callable(): try: raises(Exception, lambda: 1 + 1) assert False except Failed as e: assert "DID NOT RAISE" in str(e) def test_unexpected_exception_is_passed_through_callable(): def f(): raise ValueError("some error message") try: raises(TypeError, f) assert False except ValueError as e: assert str(e) == "some error message" # Test with statement def test_expected_exception_is_silent_with(): with raises(ValueError): raise ValueError() def test_lack_of_exception_triggers_AssertionError_with(): try: with raises(Exception): 1 + 1 assert False except Failed as e: assert "DID NOT RAISE" in str(e) def test_unexpected_exception_is_passed_through_with(): try: with raises(TypeError): raise ValueError("some error message") assert False except ValueError as e: assert str(e) == "some error message" # Now we can use raises() instead of try/catch # to test that a specific exception class is raised def test_second_argument_should_be_callable_or_string(): raises(TypeError, lambda: raises("irrelevant", 42)) def test_warns_catches_warning(): with warnings.catch_warnings(record=True) as w: with warns(UserWarning): warnings.warn('this is the warning message') assert len(w) == 0 def test_warns_raises_without_warning(): with raises(Failed): with warns(UserWarning): pass def test_warns_hides_other_warnings(): # This isn't ideal but it's what pytest's warns does: with warnings.catch_warnings(record=True) as w: with warns(UserWarning): warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) assert len(w) == 0 def test_warns_continues_after_warning(): with warnings.catch_warnings(record=True) as w: finished = False with warns(UserWarning): warnings.warn('this is the warning message') finished = True assert finished assert len(w) == 0 def test_warns_many_warnings(): # This isn't ideal but it's what pytest's warns does: with warnings.catch_warnings(record=True) as w: finished = False with warns(UserWarning): warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) warnings.warn('this is the other message', RuntimeWarning) finished = True assert finished assert len(w) == 0 def test_warns_match_matching(): with warnings.catch_warnings(record=True) as w: with warns(UserWarning, match='this is the warning message'): warnings.warn('this is the warning message', UserWarning) assert len(w) == 0 def test_warns_match_non_matching(): with warnings.catch_warnings(record=True) as w: with raises(Failed): with warns(UserWarning, match='this is the warning message'): warnings.warn('this is not the expected warning message', UserWarning) assert len(w) == 0 def _warn_sympy_deprecation(): SymPyDeprecationWarning( feature="foo", useinstead="bar", issue=1, deprecated_since_version="0.0.0").warn() def test_warns_deprecated_sympy_catches_warning(): with warnings.catch_warnings(record=True) as w: with warns_deprecated_sympy(): _warn_sympy_deprecation() assert len(w) == 0 def test_warns_deprecated_sympy_raises_without_warning(): with raises(Failed): with warns_deprecated_sympy(): pass def test_warns_deprecated_sympy_hides_other_warnings(): # This isn't ideal but it's what pytest's deprecated_call does: with warnings.catch_warnings(record=True) as w: with warns_deprecated_sympy(): _warn_sympy_deprecation() warnings.warn('this is the other message', RuntimeWarning) assert len(w) == 0 def test_warns_deprecated_sympy_continues_after_warning(): with warnings.catch_warnings(record=True) as w: finished = False with warns_deprecated_sympy(): _warn_sympy_deprecation() finished = True assert finished assert len(w) == 0 def test_warns_deprecated_sympy_many_warnings(): # This isn't ideal but it's what pytest's warns_deprecated_sympy does: with warnings.catch_warnings(record=True) as w: finished = False with warns_deprecated_sympy(): _warn_sympy_deprecation() warnings.warn('this is the other message', RuntimeWarning) _warn_sympy_deprecation() warnings.warn('this is the other message', RuntimeWarning) warnings.warn('this is the other message', RuntimeWarning) finished = True assert finished assert len(w) == 0 def test_ignore_ignores_warning(): with warnings.catch_warnings(record=True) as w: with ignore_warnings(UserWarning): warnings.warn('this is the warning message') assert len(w) == 0 def test_ignore_does_not_raise_without_warning(): with warnings.catch_warnings(record=True) as w: with ignore_warnings(UserWarning): pass assert len(w) == 0 def test_ignore_allows_other_warnings(): with warnings.catch_warnings(record=True) as w: # This is needed when pytest is run as -Werror # the setting is reverted at the end of the catch_Warnings block. warnings.simplefilter("always") with ignore_warnings(UserWarning): warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) assert len(w) == 1 assert isinstance(w[0].message, RuntimeWarning) assert str(w[0].message) == 'this is the other message' def test_ignore_continues_after_warning(): with warnings.catch_warnings(record=True) as w: finished = False with ignore_warnings(UserWarning): warnings.warn('this is the warning message') finished = True assert finished assert len(w) == 0 def test_ignore_many_warnings(): with warnings.catch_warnings(record=True) as w: # This is needed when pytest is run as -Werror # the setting is reverted at the end of the catch_Warnings block. warnings.simplefilter("always") with ignore_warnings(UserWarning): warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) warnings.warn('this is the warning message', UserWarning) warnings.warn('this is the other message', RuntimeWarning) warnings.warn('this is the other message', RuntimeWarning) assert len(w) == 3 for wi in w: assert isinstance(wi.message, RuntimeWarning) assert str(wi.message) == 'this is the other message'
3dfc3e44f96e3c5b17ab6b4a6502a8d4e51f92ecb8cc8363ba7bf766a3c167b2
# coding=utf-8 from os import walk, sep, pardir from os.path import split, join, abspath, exists, isfile from glob import glob import re import random import ast from sympy.testing.pytest import raises from sympy.testing.quality_unicode import test_this_file_encoding # System path separator (usually slash or backslash) to be # used with excluded files, e.g. # exclude = set([ # "%(sep)smpmath%(sep)s" % sepd, # ]) sepd = {"sep": sep} # path and sympy_path SYMPY_PATH = abspath(join(split(__file__)[0], pardir, pardir)) # go to sympy/ assert exists(SYMPY_PATH) TOP_PATH = abspath(join(SYMPY_PATH, pardir)) BIN_PATH = join(TOP_PATH, "bin") EXAMPLES_PATH = join(TOP_PATH, "examples") # Error messages message_space = "File contains trailing whitespace: %s, line %s." message_implicit = "File contains an implicit import: %s, line %s." message_tabs = "File contains tabs instead of spaces: %s, line %s." message_carriage = "File contains carriage returns at end of line: %s, line %s" message_str_raise = "File contains string exception: %s, line %s" message_gen_raise = "File contains generic exception: %s, line %s" message_old_raise = "File contains old-style raise statement: %s, line %s, \"%s\"" message_eof = "File does not end with a newline: %s, line %s" message_multi_eof = "File ends with more than 1 newline: %s, line %s" message_test_suite_def = "Function should start with 'test_' or '_': %s, line %s" message_duplicate_test = "This is a duplicate test function: %s, line %s" message_self_assignments = "File contains assignments to self/cls: %s, line %s." message_func_is = "File contains '.func is': %s, line %s." implicit_test_re = re.compile(r'^\s*(>>> )?(\.\.\. )?from .* import .*\*') str_raise_re = re.compile( r'^\s*(>>> )?(\.\.\. )?raise(\s+(\'|\")|\s*(\(\s*)+(\'|\"))') gen_raise_re = re.compile( r'^\s*(>>> )?(\.\.\. )?raise(\s+Exception|\s*(\(\s*)+Exception)') old_raise_re = re.compile(r'^\s*(>>> )?(\.\.\. )?raise((\s*\(\s*)|\s+)\w+\s*,') test_suite_def_re = re.compile(r'^def\s+(?!(_|test))[^(]*\(\s*\)\s*:$') test_ok_def_re = re.compile(r'^def\s+test_.*:$') test_file_re = re.compile(r'.*[/\\]test_.*\.py$') func_is_re = re.compile(r'\.\s*func\s+is') def tab_in_leading(s): """Returns True if there are tabs in the leading whitespace of a line, including the whitespace of docstring code samples.""" n = len(s) - len(s.lstrip()) if not s[n:n + 3] in ['...', '>>>']: check = s[:n] else: smore = s[n + 3:] check = s[:n] + smore[:len(smore) - len(smore.lstrip())] return not (check.expandtabs() == check) def find_self_assignments(s): """Returns a list of "bad" assignments: if there are instances of assigning to the first argument of the class method (except for staticmethod's). """ t = [n for n in ast.parse(s).body if isinstance(n, ast.ClassDef)] bad = [] for c in t: for n in c.body: if not isinstance(n, ast.FunctionDef): continue if any(d.id == 'staticmethod' for d in n.decorator_list if isinstance(d, ast.Name)): continue if n.name == '__new__': continue if not n.args.args: continue first_arg = n.args.args[0].arg for m in ast.walk(n): if isinstance(m, ast.Assign): for a in m.targets: if isinstance(a, ast.Name) and a.id == first_arg: bad.append(m) elif (isinstance(a, ast.Tuple) and any(q.id == first_arg for q in a.elts if isinstance(q, ast.Name))): bad.append(m) return bad def check_directory_tree(base_path, file_check, exclusions=set(), pattern="*.py"): """ Checks all files in the directory tree (with base_path as starting point) with the file_check function provided, skipping files that contain any of the strings in the set provided by exclusions. """ if not base_path: return for root, dirs, files in walk(base_path): check_files(glob(join(root, pattern)), file_check, exclusions) def check_files(files, file_check, exclusions=set(), pattern=None): """ Checks all files with the file_check function provided, skipping files that contain any of the strings in the set provided by exclusions. """ if not files: return for fname in files: if not exists(fname) or not isfile(fname): continue if any(ex in fname for ex in exclusions): continue if pattern is None or re.match(pattern, fname): file_check(fname) def test_files(): """ This test tests all files in sympy and checks that: o no lines contains a trailing whitespace o no lines end with \r\n o no line uses tabs instead of spaces o that the file ends with a single newline o there are no general or string exceptions o there are no old style raise statements o name of arg-less test suite functions start with _ or test_ o no duplicate function names that start with test_ o no assignments to self variable in class methods o no lines contain ".func is" except in the test suite """ def test(fname): with open(fname, "rt", encoding="utf8") as test_file: test_this_file(fname, test_file) with open(fname, 'rt', encoding='utf8') as test_file: test_this_file_encoding(fname, test_file) def test_this_file(fname, test_file): line = None # to flag the case where there were no lines in file tests = 0 test_set = set() for idx, line in enumerate(test_file): if test_file_re.match(fname): if test_suite_def_re.match(line): assert False, message_test_suite_def % (fname, idx + 1) if test_ok_def_re.match(line): tests += 1 test_set.add(line[3:].split('(')[0].strip()) if len(test_set) != tests: assert False, message_duplicate_test % (fname, idx + 1) if line.endswith(" \n") or line.endswith("\t\n"): assert False, message_space % (fname, idx + 1) if line.endswith("\r\n"): assert False, message_carriage % (fname, idx + 1) if tab_in_leading(line): assert False, message_tabs % (fname, idx + 1) if str_raise_re.search(line): assert False, message_str_raise % (fname, idx + 1) if gen_raise_re.search(line): assert False, message_gen_raise % (fname, idx + 1) if (implicit_test_re.search(line) and not list(filter(lambda ex: ex in fname, import_exclude))): assert False, message_implicit % (fname, idx + 1) if func_is_re.search(line) and not test_file_re.search(fname): assert False, message_func_is % (fname, idx + 1) result = old_raise_re.search(line) if result is not None: assert False, message_old_raise % ( fname, idx + 1, result.group(2)) if line is not None: if line == '\n' and idx > 0: assert False, message_multi_eof % (fname, idx + 1) elif not line.endswith('\n'): # eof newline check assert False, message_eof % (fname, idx + 1) # Files to test at top level top_level_files = [join(TOP_PATH, file) for file in [ "isympy.py", "build.py", "setup.py", "setupegg.py", ]] # Files to exclude from all tests exclude = set([ "%(sep)ssympy%(sep)sparsing%(sep)sautolev%(sep)s_antlr%(sep)sautolevparser.py" % sepd, "%(sep)ssympy%(sep)sparsing%(sep)sautolev%(sep)s_antlr%(sep)sautolevlexer.py" % sepd, "%(sep)ssympy%(sep)sparsing%(sep)sautolev%(sep)s_antlr%(sep)sautolevlistener.py" % sepd, "%(sep)ssympy%(sep)sparsing%(sep)slatex%(sep)s_antlr%(sep)slatexparser.py" % sepd, "%(sep)ssympy%(sep)sparsing%(sep)slatex%(sep)s_antlr%(sep)slatexlexer.py" % sepd, ]) # Files to exclude from the implicit import test import_exclude = set([ # glob imports are allowed in top-level __init__.py: "%(sep)ssympy%(sep)s__init__.py" % sepd, # these __init__.py should be fixed: # XXX: not really, they use useful import pattern (DRY) "%(sep)svector%(sep)s__init__.py" % sepd, "%(sep)smechanics%(sep)s__init__.py" % sepd, "%(sep)squantum%(sep)s__init__.py" % sepd, "%(sep)spolys%(sep)s__init__.py" % sepd, "%(sep)spolys%(sep)sdomains%(sep)s__init__.py" % sepd, # interactive sympy executes ``from sympy import *``: "%(sep)sinteractive%(sep)ssession.py" % sepd, # isympy.py executes ``from sympy import *``: "%(sep)sisympy.py" % sepd, # these two are import timing tests: "%(sep)sbin%(sep)ssympy_time.py" % sepd, "%(sep)sbin%(sep)ssympy_time_cache.py" % sepd, # Taken from Python stdlib: "%(sep)sparsing%(sep)ssympy_tokenize.py" % sepd, # this one should be fixed: "%(sep)splotting%(sep)spygletplot%(sep)s" % sepd, # False positive in the docstring "%(sep)sbin%(sep)stest_external_imports.py" % sepd, # These are deprecated stubs that can be removed at some point: "%(sep)sutilities%(sep)sruntests.py" % sepd, "%(sep)sutilities%(sep)spytest.py" % sepd, "%(sep)sutilities%(sep)srandtest.py" % sepd, "%(sep)sutilities%(sep)stmpfiles.py" % sepd, "%(sep)sutilities%(sep)squality_unicode.py" % sepd, "%(sep)sutilities%(sep)sbenchmarking.py" % sepd, ]) check_files(top_level_files, test) check_directory_tree(BIN_PATH, test, set(["~", ".pyc", ".sh"]), "*") check_directory_tree(SYMPY_PATH, test, exclude) check_directory_tree(EXAMPLES_PATH, test, exclude) def _with_space(c): # return c with a random amount of leading space return random.randint(0, 10)*' ' + c def test_raise_statement_regular_expression(): candidates_ok = [ "some text # raise Exception, 'text'", "raise ValueError('text') # raise Exception, 'text'", "raise ValueError('text')", "raise ValueError", "raise ValueError('text')", "raise ValueError('text') #,", # Talking about an exception in a docstring ''''"""This function will raise ValueError, except when it doesn't"""''', "raise (ValueError('text')", ] str_candidates_fail = [ "raise 'exception'", "raise 'Exception'", 'raise "exception"', 'raise "Exception"', "raise 'ValueError'", ] gen_candidates_fail = [ "raise Exception('text') # raise Exception, 'text'", "raise Exception('text')", "raise Exception", "raise Exception('text')", "raise Exception('text') #,", "raise Exception, 'text'", "raise Exception, 'text' # raise Exception('text')", "raise Exception, 'text' # raise Exception, 'text'", ">>> raise Exception, 'text'", ">>> raise Exception, 'text' # raise Exception('text')", ">>> raise Exception, 'text' # raise Exception, 'text'", ] old_candidates_fail = [ "raise Exception, 'text'", "raise Exception, 'text' # raise Exception('text')", "raise Exception, 'text' # raise Exception, 'text'", ">>> raise Exception, 'text'", ">>> raise Exception, 'text' # raise Exception('text')", ">>> raise Exception, 'text' # raise Exception, 'text'", "raise ValueError, 'text'", "raise ValueError, 'text' # raise Exception('text')", "raise ValueError, 'text' # raise Exception, 'text'", ">>> raise ValueError, 'text'", ">>> raise ValueError, 'text' # raise Exception('text')", ">>> raise ValueError, 'text' # raise Exception, 'text'", "raise(ValueError,", "raise (ValueError,", "raise( ValueError,", "raise ( ValueError,", "raise(ValueError ,", "raise (ValueError ,", "raise( ValueError ,", "raise ( ValueError ,", ] for c in candidates_ok: assert str_raise_re.search(_with_space(c)) is None, c assert gen_raise_re.search(_with_space(c)) is None, c assert old_raise_re.search(_with_space(c)) is None, c for c in str_candidates_fail: assert str_raise_re.search(_with_space(c)) is not None, c for c in gen_candidates_fail: assert gen_raise_re.search(_with_space(c)) is not None, c for c in old_candidates_fail: assert old_raise_re.search(_with_space(c)) is not None, c def test_implicit_imports_regular_expression(): candidates_ok = [ "from sympy import something", ">>> from sympy import something", "from sympy.somewhere import something", ">>> from sympy.somewhere import something", "import sympy", ">>> import sympy", "import sympy.something.something", "... import sympy", "... import sympy.something.something", "... from sympy import something", "... from sympy.somewhere import something", ">> from sympy import *", # To allow 'fake' docstrings "# from sympy import *", "some text # from sympy import *", ] candidates_fail = [ "from sympy import *", ">>> from sympy import *", "from sympy.somewhere import *", ">>> from sympy.somewhere import *", "... from sympy import *", "... from sympy.somewhere import *", ] for c in candidates_ok: assert implicit_test_re.search(_with_space(c)) is None, c for c in candidates_fail: assert implicit_test_re.search(_with_space(c)) is not None, c def test_test_suite_defs(): candidates_ok = [ " def foo():\n", "def foo(arg):\n", "def _foo():\n", "def test_foo():\n", ] candidates_fail = [ "def foo():\n", "def foo() :\n", "def foo( ):\n", "def foo():\n", ] for c in candidates_ok: assert test_suite_def_re.search(c) is None, c for c in candidates_fail: assert test_suite_def_re.search(c) is not None, c def test_test_duplicate_defs(): candidates_ok = [ "def foo():\ndef foo():\n", "def test():\ndef test_():\n", "def test_():\ndef test__():\n", ] candidates_fail = [ "def test_():\ndef test_ ():\n", "def test_1():\ndef test_1():\n", ] ok = (None, 'check') def check(file): tests = 0 test_set = set() for idx, line in enumerate(file.splitlines()): if test_ok_def_re.match(line): tests += 1 test_set.add(line[3:].split('(')[0].strip()) if len(test_set) != tests: return False, message_duplicate_test % ('check', idx + 1) return None, 'check' for c in candidates_ok: assert check(c) == ok for c in candidates_fail: assert check(c) != ok def test_find_self_assignments(): candidates_ok = [ "class A(object):\n def foo(self, arg): arg = self\n", "class A(object):\n def foo(self, arg): self.prop = arg\n", "class A(object):\n def foo(self, arg): obj, obj2 = arg, self\n", "class A(object):\n @classmethod\n def bar(cls, arg): arg = cls\n", "class A(object):\n def foo(var, arg): arg = var\n", ] candidates_fail = [ "class A(object):\n def foo(self, arg): self = arg\n", "class A(object):\n def foo(self, arg): obj, self = arg, arg\n", "class A(object):\n def foo(self, arg):\n if arg: self = arg", "class A(object):\n @classmethod\n def foo(cls, arg): cls = arg\n", "class A(object):\n def foo(var, arg): var = arg\n", ] for c in candidates_ok: assert find_self_assignments(c) == [] for c in candidates_fail: assert find_self_assignments(c) != [] def test_test_unicode_encoding(): unicode_whitelist = ['foo'] unicode_strict_whitelist = ['bar'] fname = 'abc' test_file = ['α'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'abc' test_file = ['# coding=utf-8', 'α'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'abc' test_file = ['# coding=utf-8', 'abc'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'abc' test_file = ['abc'] test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist) fname = 'foo' test_file = ['α'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'foo' test_file = ['# coding=utf-8', 'α'] test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist) fname = 'foo' test_file = ['# coding=utf-8', 'abc'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'foo' test_file = ['abc'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'bar' test_file = ['α'] raises(AssertionError, lambda: test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)) fname = 'bar' test_file = ['# coding=utf-8', 'α'] test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist) fname = 'bar' test_file = ['# coding=utf-8', 'abc'] test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist) fname = 'bar' test_file = ['abc'] test_this_file_encoding( fname, test_file, unicode_whitelist, unicode_strict_whitelist)
831594f02b8c52008e0643389f6c686ea5715691627862f57afe8faf8302776f
from sympy.vector.vector import Vector from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.functions import express, matrix_to_vector, orthogonalize from sympy import symbols, S, sqrt, sin, cos, ImmutableMatrix as Matrix, Rational from sympy.testing.pytest import raises N = CoordSys3D('N') q1, q2, q3, q4, q5 = symbols('q1 q2 q3 q4 q5') A = N.orient_new_axis('A', q1, N.k) # type: ignore B = A.orient_new_axis('B', q2, A.i) C = B.orient_new_axis('C', q3, B.j) def test_express(): assert express(Vector.zero, N) == Vector.zero assert express(S.Zero, N) is S.Zero assert express(A.i, C) == cos(q3)*C.i + sin(q3)*C.k assert express(A.j, C) == sin(q2)*sin(q3)*C.i + cos(q2)*C.j - \ sin(q2)*cos(q3)*C.k assert express(A.k, C) == -sin(q3)*cos(q2)*C.i + sin(q2)*C.j + \ cos(q2)*cos(q3)*C.k assert express(A.i, N) == cos(q1)*N.i + sin(q1)*N.j assert express(A.j, N) == -sin(q1)*N.i + cos(q1)*N.j assert express(A.k, N) == N.k assert express(A.i, A) == A.i assert express(A.j, A) == A.j assert express(A.k, A) == A.k assert express(A.i, B) == B.i assert express(A.j, B) == cos(q2)*B.j - sin(q2)*B.k assert express(A.k, B) == sin(q2)*B.j + cos(q2)*B.k assert express(A.i, C) == cos(q3)*C.i + sin(q3)*C.k assert express(A.j, C) == sin(q2)*sin(q3)*C.i + cos(q2)*C.j - \ sin(q2)*cos(q3)*C.k assert express(A.k, C) == -sin(q3)*cos(q2)*C.i + sin(q2)*C.j + \ cos(q2)*cos(q3)*C.k # Check to make sure UnitVectors get converted properly assert express(N.i, N) == N.i assert express(N.j, N) == N.j assert express(N.k, N) == N.k assert express(N.i, A) == (cos(q1)*A.i - sin(q1)*A.j) assert express(N.j, A) == (sin(q1)*A.i + cos(q1)*A.j) assert express(N.k, A) == A.k assert express(N.i, B) == (cos(q1)*B.i - sin(q1)*cos(q2)*B.j + sin(q1)*sin(q2)*B.k) assert express(N.j, B) == (sin(q1)*B.i + cos(q1)*cos(q2)*B.j - sin(q2)*cos(q1)*B.k) assert express(N.k, B) == (sin(q2)*B.j + cos(q2)*B.k) assert express(N.i, C) == ( (cos(q1)*cos(q3) - sin(q1)*sin(q2)*sin(q3))*C.i - sin(q1)*cos(q2)*C.j + (sin(q3)*cos(q1) + sin(q1)*sin(q2)*cos(q3))*C.k) assert express(N.j, C) == ( (sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1))*C.i + cos(q1)*cos(q2)*C.j + (sin(q1)*sin(q3) - sin(q2)*cos(q1)*cos(q3))*C.k) assert express(N.k, C) == (-sin(q3)*cos(q2)*C.i + sin(q2)*C.j + cos(q2)*cos(q3)*C.k) assert express(A.i, N) == (cos(q1)*N.i + sin(q1)*N.j) assert express(A.j, N) == (-sin(q1)*N.i + cos(q1)*N.j) assert express(A.k, N) == N.k assert express(A.i, A) == A.i assert express(A.j, A) == A.j assert express(A.k, A) == A.k assert express(A.i, B) == B.i assert express(A.j, B) == (cos(q2)*B.j - sin(q2)*B.k) assert express(A.k, B) == (sin(q2)*B.j + cos(q2)*B.k) assert express(A.i, C) == (cos(q3)*C.i + sin(q3)*C.k) assert express(A.j, C) == (sin(q2)*sin(q3)*C.i + cos(q2)*C.j - sin(q2)*cos(q3)*C.k) assert express(A.k, C) == (-sin(q3)*cos(q2)*C.i + sin(q2)*C.j + cos(q2)*cos(q3)*C.k) assert express(B.i, N) == (cos(q1)*N.i + sin(q1)*N.j) assert express(B.j, N) == (-sin(q1)*cos(q2)*N.i + cos(q1)*cos(q2)*N.j + sin(q2)*N.k) assert express(B.k, N) == (sin(q1)*sin(q2)*N.i - sin(q2)*cos(q1)*N.j + cos(q2)*N.k) assert express(B.i, A) == A.i assert express(B.j, A) == (cos(q2)*A.j + sin(q2)*A.k) assert express(B.k, A) == (-sin(q2)*A.j + cos(q2)*A.k) assert express(B.i, B) == B.i assert express(B.j, B) == B.j assert express(B.k, B) == B.k assert express(B.i, C) == (cos(q3)*C.i + sin(q3)*C.k) assert express(B.j, C) == C.j assert express(B.k, C) == (-sin(q3)*C.i + cos(q3)*C.k) assert express(C.i, N) == ( (cos(q1)*cos(q3) - sin(q1)*sin(q2)*sin(q3))*N.i + (sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1))*N.j - sin(q3)*cos(q2)*N.k) assert express(C.j, N) == ( -sin(q1)*cos(q2)*N.i + cos(q1)*cos(q2)*N.j + sin(q2)*N.k) assert express(C.k, N) == ( (sin(q3)*cos(q1) + sin(q1)*sin(q2)*cos(q3))*N.i + (sin(q1)*sin(q3) - sin(q2)*cos(q1)*cos(q3))*N.j + cos(q2)*cos(q3)*N.k) assert express(C.i, A) == (cos(q3)*A.i + sin(q2)*sin(q3)*A.j - sin(q3)*cos(q2)*A.k) assert express(C.j, A) == (cos(q2)*A.j + sin(q2)*A.k) assert express(C.k, A) == (sin(q3)*A.i - sin(q2)*cos(q3)*A.j + cos(q2)*cos(q3)*A.k) assert express(C.i, B) == (cos(q3)*B.i - sin(q3)*B.k) assert express(C.j, B) == B.j assert express(C.k, B) == (sin(q3)*B.i + cos(q3)*B.k) assert express(C.i, C) == C.i assert express(C.j, C) == C.j assert express(C.k, C) == C.k == (C.k) # Check to make sure Vectors get converted back to UnitVectors assert N.i == express((cos(q1)*A.i - sin(q1)*A.j), N).simplify() assert N.j == express((sin(q1)*A.i + cos(q1)*A.j), N).simplify() assert N.i == express((cos(q1)*B.i - sin(q1)*cos(q2)*B.j + sin(q1)*sin(q2)*B.k), N).simplify() assert N.j == express((sin(q1)*B.i + cos(q1)*cos(q2)*B.j - sin(q2)*cos(q1)*B.k), N).simplify() assert N.k == express((sin(q2)*B.j + cos(q2)*B.k), N).simplify() assert A.i == express((cos(q1)*N.i + sin(q1)*N.j), A).simplify() assert A.j == express((-sin(q1)*N.i + cos(q1)*N.j), A).simplify() assert A.j == express((cos(q2)*B.j - sin(q2)*B.k), A).simplify() assert A.k == express((sin(q2)*B.j + cos(q2)*B.k), A).simplify() assert A.i == express((cos(q3)*C.i + sin(q3)*C.k), A).simplify() assert A.j == express((sin(q2)*sin(q3)*C.i + cos(q2)*C.j - sin(q2)*cos(q3)*C.k), A).simplify() assert A.k == express((-sin(q3)*cos(q2)*C.i + sin(q2)*C.j + cos(q2)*cos(q3)*C.k), A).simplify() assert B.i == express((cos(q1)*N.i + sin(q1)*N.j), B).simplify() assert B.j == express((-sin(q1)*cos(q2)*N.i + cos(q1)*cos(q2)*N.j + sin(q2)*N.k), B).simplify() assert B.k == express((sin(q1)*sin(q2)*N.i - sin(q2)*cos(q1)*N.j + cos(q2)*N.k), B).simplify() assert B.j == express((cos(q2)*A.j + sin(q2)*A.k), B).simplify() assert B.k == express((-sin(q2)*A.j + cos(q2)*A.k), B).simplify() assert B.i == express((cos(q3)*C.i + sin(q3)*C.k), B).simplify() assert B.k == express((-sin(q3)*C.i + cos(q3)*C.k), B).simplify() assert C.i == express((cos(q3)*A.i + sin(q2)*sin(q3)*A.j - sin(q3)*cos(q2)*A.k), C).simplify() assert C.j == express((cos(q2)*A.j + sin(q2)*A.k), C).simplify() assert C.k == express((sin(q3)*A.i - sin(q2)*cos(q3)*A.j + cos(q2)*cos(q3)*A.k), C).simplify() assert C.i == express((cos(q3)*B.i - sin(q3)*B.k), C).simplify() assert C.k == express((sin(q3)*B.i + cos(q3)*B.k), C).simplify() def test_matrix_to_vector(): m = Matrix([[1], [2], [3]]) assert matrix_to_vector(m, C) == C.i + 2*C.j + 3*C.k m = Matrix([[0], [0], [0]]) assert matrix_to_vector(m, N) == matrix_to_vector(m, C) == \ Vector.zero m = Matrix([[q1], [q2], [q3]]) assert matrix_to_vector(m, N) == q1*N.i + q2*N.j + q3*N.k def test_orthogonalize(): C = CoordSys3D('C') a, b = symbols('a b', integer=True) i, j, k = C.base_vectors() v1 = i + 2*j v2 = 2*i + 3*j v3 = 3*i + 5*j v4 = 3*i + j v5 = 2*i + 2*j v6 = a*i + b*j v7 = 4*a*i + 4*b*j assert orthogonalize(v1, v2) == [C.i + 2*C.j, C.i*Rational(2, 5) + -C.j/5] # from wikipedia assert orthogonalize(v4, v5, orthonormal=True) == \ [(3*sqrt(10))*C.i/10 + (sqrt(10))*C.j/10, (-sqrt(10))*C.i/10 + (3*sqrt(10))*C.j/10] raises(ValueError, lambda: orthogonalize(v1, v2, v3)) raises(ValueError, lambda: orthogonalize(v6, v7))
ecb8c39ca7d065e836472dc31804b733459f57a84c71573aa582ac859da4b657
from sympy.core import Rational from sympy.simplify import simplify, trigsimp from sympy import pi, sqrt, symbols, ImmutableMatrix as Matrix, \ sin, cos, Function, Integral, Derivative, diff from sympy.vector.vector import Vector, BaseVector, VectorAdd, \ VectorMul, VectorZero from sympy.vector.coordsysrect import CoordSys3D from sympy.vector.vector import Cross, Dot, cross from sympy.testing.pytest import raises C = CoordSys3D('C') i, j, k = C.base_vectors() a, b, c = symbols('a b c') def test_cross(): v1 = C.x * i + C.z * C.z * j v2 = C.x * i + C.y * j + C.z * k assert Cross(v1, v2) == Cross(C.x*C.i + C.z**2*C.j, C.x*C.i + C.y*C.j + C.z*C.k) assert Cross(v1, v2).doit() == C.z**3*C.i + (-C.x*C.z)*C.j + (C.x*C.y - C.x*C.z**2)*C.k assert cross(v1, v2) == C.z**3*C.i + (-C.x*C.z)*C.j + (C.x*C.y - C.x*C.z**2)*C.k assert Cross(v1, v2) == -Cross(v2, v1) assert Cross(v1, v2) + Cross(v2, v1) == Vector.zero def test_dot(): v1 = C.x * i + C.z * C.z * j v2 = C.x * i + C.y * j + C.z * k assert Dot(v1, v2) == Dot(C.x*C.i + C.z**2*C.j, C.x*C.i + C.y*C.j + C.z*C.k) assert Dot(v1, v2).doit() == C.x**2 + C.y*C.z**2 assert Dot(v1, v2).doit() == C.x**2 + C.y*C.z**2 assert Dot(v1, v2) == Dot(v2, v1) def test_vector_sympy(): """ Test whether the Vector framework confirms to the hashing and equality testing properties of SymPy. """ v1 = 3*j assert v1 == j*3 assert v1.components == {j: 3} v2 = 3*i + 4*j + 5*k v3 = 2*i + 4*j + i + 4*k + k assert v3 == v2 assert v3.__hash__() == v2.__hash__() def test_vector(): assert isinstance(i, BaseVector) assert i != j assert j != k assert k != i assert i - i == Vector.zero assert i + Vector.zero == i assert i - Vector.zero == i assert Vector.zero != 0 assert -Vector.zero == Vector.zero v1 = a*i + b*j + c*k v2 = a**2*i + b**2*j + c**2*k v3 = v1 + v2 v4 = 2 * v1 v5 = a * i assert isinstance(v1, VectorAdd) assert v1 - v1 == Vector.zero assert v1 + Vector.zero == v1 assert v1.dot(i) == a assert v1.dot(j) == b assert v1.dot(k) == c assert i.dot(v2) == a**2 assert j.dot(v2) == b**2 assert k.dot(v2) == c**2 assert v3.dot(i) == a**2 + a assert v3.dot(j) == b**2 + b assert v3.dot(k) == c**2 + c assert v1 + v2 == v2 + v1 assert v1 - v2 == -1 * (v2 - v1) assert a * v1 == v1 * a assert isinstance(v5, VectorMul) assert v5.base_vector == i assert v5.measure_number == a assert isinstance(v4, Vector) assert isinstance(v4, VectorAdd) assert isinstance(v4, Vector) assert isinstance(Vector.zero, VectorZero) assert isinstance(Vector.zero, Vector) assert isinstance(v1 * 0, VectorZero) assert v1.to_matrix(C) == Matrix([[a], [b], [c]]) assert i.components == {i: 1} assert v5.components == {i: a} assert v1.components == {i: a, j: b, k: c} assert VectorAdd(v1, Vector.zero) == v1 assert VectorMul(a, v1) == v1*a assert VectorMul(1, i) == i assert VectorAdd(v1, Vector.zero) == v1 assert VectorMul(0, Vector.zero) == Vector.zero raises(TypeError, lambda: v1.outer(1)) raises(TypeError, lambda: v1.dot(1)) def test_vector_magnitude_normalize(): assert Vector.zero.magnitude() == 0 assert Vector.zero.normalize() == Vector.zero assert i.magnitude() == 1 assert j.magnitude() == 1 assert k.magnitude() == 1 assert i.normalize() == i assert j.normalize() == j assert k.normalize() == k v1 = a * i assert v1.normalize() == (a/sqrt(a**2))*i assert v1.magnitude() == sqrt(a**2) v2 = a*i + b*j + c*k assert v2.magnitude() == sqrt(a**2 + b**2 + c**2) assert v2.normalize() == v2 / v2.magnitude() v3 = i + j assert v3.normalize() == (sqrt(2)/2)*C.i + (sqrt(2)/2)*C.j def test_vector_simplify(): A, s, k, m = symbols('A, s, k, m') test1 = (1 / a + 1 / b) * i assert (test1 & i) != (a + b) / (a * b) test1 = simplify(test1) assert (test1 & i) == (a + b) / (a * b) assert test1.simplify() == simplify(test1) test2 = (A**2 * s**4 / (4 * pi * k * m**3)) * i test2 = simplify(test2) assert (test2 & i) == (A**2 * s**4 / (4 * pi * k * m**3)) test3 = ((4 + 4 * a - 2 * (2 + 2 * a)) / (2 + 2 * a)) * i test3 = simplify(test3) assert (test3 & i) == 0 test4 = ((-4 * a * b**2 - 2 * b**3 - 2 * a**2 * b) / (a + b)**2) * i test4 = simplify(test4) assert (test4 & i) == -2 * b v = (sin(a)+cos(a))**2*i - j assert trigsimp(v) == (2*sin(a + pi/4)**2)*i + (-1)*j assert trigsimp(v) == v.trigsimp() assert simplify(Vector.zero) == Vector.zero def test_vector_dot(): assert i.dot(Vector.zero) == 0 assert Vector.zero.dot(i) == 0 assert i & Vector.zero == 0 assert i.dot(i) == 1 assert i.dot(j) == 0 assert i.dot(k) == 0 assert i & i == 1 assert i & j == 0 assert i & k == 0 assert j.dot(i) == 0 assert j.dot(j) == 1 assert j.dot(k) == 0 assert j & i == 0 assert j & j == 1 assert j & k == 0 assert k.dot(i) == 0 assert k.dot(j) == 0 assert k.dot(k) == 1 assert k & i == 0 assert k & j == 0 assert k & k == 1 raises(TypeError, lambda: k.dot(1)) def test_vector_cross(): assert i.cross(Vector.zero) == Vector.zero assert Vector.zero.cross(i) == Vector.zero assert i.cross(i) == Vector.zero assert i.cross(j) == k assert i.cross(k) == -j assert i ^ i == Vector.zero assert i ^ j == k assert i ^ k == -j assert j.cross(i) == -k assert j.cross(j) == Vector.zero assert j.cross(k) == i assert j ^ i == -k assert j ^ j == Vector.zero assert j ^ k == i assert k.cross(i) == j assert k.cross(j) == -i assert k.cross(k) == Vector.zero assert k ^ i == j assert k ^ j == -i assert k ^ k == Vector.zero assert k.cross(1) == Cross(k, 1) def test_projection(): v1 = i + j + k v2 = 3*i + 4*j v3 = 0*i + 0*j assert v1.projection(v1) == i + j + k assert v1.projection(v2) == Rational(7, 3)*C.i + Rational(7, 3)*C.j + Rational(7, 3)*C.k assert v1.projection(v1, scalar=True) == 1 assert v1.projection(v2, scalar=True) == Rational(7, 3) assert v3.projection(v1) == Vector.zero def test_vector_diff_integrate(): f = Function('f') v = f(a)*C.i + a**2*C.j - C.k assert Derivative(v, a) == Derivative((f(a))*C.i + a**2*C.j + (-1)*C.k, a) assert (diff(v, a) == v.diff(a) == Derivative(v, a).doit() == (Derivative(f(a), a))*C.i + 2*a*C.j) assert (Integral(v, a) == (Integral(f(a), a))*C.i + (Integral(a**2, a))*C.j + (Integral(-1, a))*C.k) def test_vector_args(): raises(ValueError, lambda: BaseVector(3, C)) raises(TypeError, lambda: BaseVector(0, Vector.zero))
ff9a2093bf43383cacc96ff03af57997369b7d7a1bb781cc7ae6c9039bd5fb61
from sympy import sin, cos, symbols, pi, ImmutableMatrix as Matrix, \ simplify from sympy.vector import (CoordSys3D, Vector, Dyadic, DyadicAdd, DyadicMul, DyadicZero, BaseDyadic, express) A = CoordSys3D('A') def test_dyadic(): a, b = symbols('a, b') assert Dyadic.zero != 0 assert isinstance(Dyadic.zero, DyadicZero) assert BaseDyadic(A.i, A.j) != BaseDyadic(A.j, A.i) assert (BaseDyadic(Vector.zero, A.i) == BaseDyadic(A.i, Vector.zero) == Dyadic.zero) d1 = A.i | A.i d2 = A.j | A.j d3 = A.i | A.j assert isinstance(d1, BaseDyadic) d_mul = a*d1 assert isinstance(d_mul, DyadicMul) assert d_mul.base_dyadic == d1 assert d_mul.measure_number == a assert isinstance(a*d1 + b*d3, DyadicAdd) assert d1 == A.i.outer(A.i) assert d3 == A.i.outer(A.j) v1 = a*A.i - A.k v2 = A.i + b*A.j assert v1 | v2 == v1.outer(v2) == a * (A.i|A.i) + (a*b) * (A.i|A.j) +\ - (A.k|A.i) - b * (A.k|A.j) assert d1 * 0 == Dyadic.zero assert d1 != Dyadic.zero assert d1 * 2 == 2 * (A.i | A.i) assert d1 / 2. == 0.5 * d1 assert d1.dot(0 * d1) == Vector.zero assert d1 & d2 == Dyadic.zero assert d1.dot(A.i) == A.i == d1 & A.i assert d1.cross(Vector.zero) == Dyadic.zero assert d1.cross(A.i) == Dyadic.zero assert d1 ^ A.j == d1.cross(A.j) assert d1.cross(A.k) == - A.i | A.j assert d2.cross(A.i) == - A.j | A.k == d2 ^ A.i assert A.i ^ d1 == Dyadic.zero assert A.j.cross(d1) == - A.k | A.i == A.j ^ d1 assert Vector.zero.cross(d1) == Dyadic.zero assert A.k ^ d1 == A.j | A.i assert A.i.dot(d1) == A.i & d1 == A.i assert A.j.dot(d1) == Vector.zero assert Vector.zero.dot(d1) == Vector.zero assert A.j & d2 == A.j assert d1.dot(d3) == d1 & d3 == A.i | A.j == d3 assert d3 & d1 == Dyadic.zero q = symbols('q') B = A.orient_new_axis('B', q, A.k) assert express(d1, B) == express(d1, B, B) expr1 = ((cos(q)**2) * (B.i | B.i) + (-sin(q) * cos(q)) * (B.i | B.j) + (-sin(q) * cos(q)) * (B.j | B.i) + (sin(q)**2) * (B.j | B.j)) assert (express(d1, B) - expr1).simplify() == Dyadic.zero expr2 = (cos(q)) * (B.i | A.i) + (-sin(q)) * (B.j | A.i) assert (express(d1, B, A) - expr2).simplify() == Dyadic.zero expr3 = (cos(q)) * (A.i | B.i) + (-sin(q)) * (A.i | B.j) assert (express(d1, A, B) - expr3).simplify() == Dyadic.zero assert d1.to_matrix(A) == Matrix([[1, 0, 0], [0, 0, 0], [0, 0, 0]]) assert d1.to_matrix(A, B) == Matrix([[cos(q), -sin(q), 0], [0, 0, 0], [0, 0, 0]]) assert d3.to_matrix(A) == Matrix([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) a, b, c, d, e, f = symbols('a, b, c, d, e, f') v1 = a * A.i + b * A.j + c * A.k v2 = d * A.i + e * A.j + f * A.k d4 = v1.outer(v2) assert d4.to_matrix(A) == Matrix([[a * d, a * e, a * f], [b * d, b * e, b * f], [c * d, c * e, c * f]]) d5 = v1.outer(v1) C = A.orient_new_axis('C', q, A.i) for expected, actual in zip(C.rotation_matrix(A) * d5.to_matrix(A) * \ C.rotation_matrix(A).T, d5.to_matrix(C)): assert (expected - actual).simplify() == 0 def test_dyadic_simplify(): x, y, z, k, n, m, w, f, s, A = symbols('x, y, z, k, n, m, w, f, s, A') N = CoordSys3D('N') dy = N.i | N.i test1 = (1 / x + 1 / y) * dy assert (N.i & test1 & N.i) != (x + y) / (x * y) test1 = test1.simplify() assert test1.simplify() == simplify(test1) assert (N.i & test1 & N.i) == (x + y) / (x * y) test2 = (A**2 * s**4 / (4 * pi * k * m**3)) * dy test2 = test2.simplify() assert (N.i & test2 & N.i) == (A**2 * s**4 / (4 * pi * k * m**3)) test3 = ((4 + 4 * x - 2 * (2 + 2 * x)) / (2 + 2 * x)) * dy test3 = test3.simplify() assert (N.i & test3 & N.i) == 0 test4 = ((-4 * x * y**2 - 2 * y**3 - 2 * x**2 * y) / (x + y)**2) * dy test4 = test4.simplify() assert (N.i & test4 & N.i) == -2 * y
2052d1b28233d3d37dea9653340cd161dd7a3647f8dc872d1d3b908f2aa2c2b8
from sympy.core.function import Derivative from sympy.vector.vector import Vector from sympy.vector.coordsysrect import CoordSys3D from sympy.simplify import simplify from sympy.core.symbol import symbols from sympy.core import S from sympy import sin, cos from sympy.vector.vector import Dot from sympy.vector.operators import curl, divergence, gradient, Gradient, Divergence, Cross from sympy.vector.deloperator import Del from sympy.vector.functions import (is_conservative, is_solenoidal, scalar_potential, directional_derivative, laplacian, scalar_potential_difference) from sympy.testing.pytest import raises C = CoordSys3D('C') i, j, k = C.base_vectors() x, y, z = C.base_scalars() delop = Del() a, b, c, q = symbols('a b c q') def test_del_operator(): # Tests for curl assert delop ^ Vector.zero == Vector.zero assert ((delop ^ Vector.zero).doit() == Vector.zero == curl(Vector.zero)) assert delop.cross(Vector.zero) == delop ^ Vector.zero assert (delop ^ i).doit() == Vector.zero assert delop.cross(2*y**2*j, doit=True) == Vector.zero assert delop.cross(2*y**2*j) == delop ^ 2*y**2*j v = x*y*z * (i + j + k) assert ((delop ^ v).doit() == (-x*y + x*z)*i + (x*y - y*z)*j + (-x*z + y*z)*k == curl(v)) assert delop ^ v == delop.cross(v) assert (delop.cross(2*x**2*j) == (Derivative(0, C.y) - Derivative(2*C.x**2, C.z))*C.i + (-Derivative(0, C.x) + Derivative(0, C.z))*C.j + (-Derivative(0, C.y) + Derivative(2*C.x**2, C.x))*C.k) assert (delop.cross(2*x**2*j, doit=True) == 4*x*k == curl(2*x**2*j)) #Tests for divergence assert delop & Vector.zero is S.Zero == divergence(Vector.zero) assert (delop & Vector.zero).doit() is S.Zero assert delop.dot(Vector.zero) == delop & Vector.zero assert (delop & i).doit() is S.Zero assert (delop & x**2*i).doit() == 2*x == divergence(x**2*i) assert (delop.dot(v, doit=True) == x*y + y*z + z*x == divergence(v)) assert delop & v == delop.dot(v) assert delop.dot(1/(x*y*z) * (i + j + k), doit=True) == \ - 1 / (x*y*z**2) - 1 / (x*y**2*z) - 1 / (x**2*y*z) v = x*i + y*j + z*k assert (delop & v == Derivative(C.x, C.x) + Derivative(C.y, C.y) + Derivative(C.z, C.z)) assert delop.dot(v, doit=True) == 3 == divergence(v) assert delop & v == delop.dot(v) assert simplify((delop & v).doit()) == 3 #Tests for gradient assert (delop.gradient(0, doit=True) == Vector.zero == gradient(0)) assert delop.gradient(0) == delop(0) assert (delop(S.Zero)).doit() == Vector.zero assert (delop(x) == (Derivative(C.x, C.x))*C.i + (Derivative(C.x, C.y))*C.j + (Derivative(C.x, C.z))*C.k) assert (delop(x)).doit() == i == gradient(x) assert (delop(x*y*z) == (Derivative(C.x*C.y*C.z, C.x))*C.i + (Derivative(C.x*C.y*C.z, C.y))*C.j + (Derivative(C.x*C.y*C.z, C.z))*C.k) assert (delop.gradient(x*y*z, doit=True) == y*z*i + z*x*j + x*y*k == gradient(x*y*z)) assert delop(x*y*z) == delop.gradient(x*y*z) assert (delop(2*x**2)).doit() == 4*x*i assert ((delop(a*sin(y) / x)).doit() == -a*sin(y)/x**2 * i + a*cos(y)/x * j) #Tests for directional derivative assert (Vector.zero & delop)(a) is S.Zero assert ((Vector.zero & delop)(a)).doit() is S.Zero assert ((v & delop)(Vector.zero)).doit() == Vector.zero assert ((v & delop)(S.Zero)).doit() is S.Zero assert ((i & delop)(x)).doit() == 1 assert ((j & delop)(y)).doit() == 1 assert ((k & delop)(z)).doit() == 1 assert ((i & delop)(x*y*z)).doit() == y*z assert ((v & delop)(x)).doit() == x assert ((v & delop)(x*y*z)).doit() == 3*x*y*z assert (v & delop)(x + y + z) == C.x + C.y + C.z assert ((v & delop)(x + y + z)).doit() == x + y + z assert ((v & delop)(v)).doit() == v assert ((i & delop)(v)).doit() == i assert ((j & delop)(v)).doit() == j assert ((k & delop)(v)).doit() == k assert ((v & delop)(Vector.zero)).doit() == Vector.zero # Tests for laplacian on scalar fields assert laplacian(x*y*z) is S.Zero assert laplacian(x**2) == S(2) assert laplacian(x**2*y**2*z**2) == \ 2*y**2*z**2 + 2*x**2*z**2 + 2*x**2*y**2 A = CoordSys3D('A', transformation="spherical", variable_names=["r", "theta", "phi"]) B = CoordSys3D('B', transformation='cylindrical', variable_names=["r", "theta", "z"]) assert laplacian(A.r + A.theta + A.phi) == 2/A.r + cos(A.theta)/(A.r**2*sin(A.theta)) assert laplacian(B.r + B.theta + B.z) == 1/B.r # Tests for laplacian on vector fields assert laplacian(x*y*z*(i + j + k)) == Vector.zero assert laplacian(x*y**2*z*(i + j + k)) == \ 2*x*z*i + 2*x*z*j + 2*x*z*k def test_product_rules(): """ Tests the six product rules defined with respect to the Del operator References ========== .. [1] https://en.wikipedia.org/wiki/Del """ #Define the scalar and vector functions f = 2*x*y*z g = x*y + y*z + z*x u = x**2*i + 4*j - y**2*z*k v = 4*i + x*y*z*k # First product rule lhs = delop(f * g, doit=True) rhs = (f * delop(g) + g * delop(f)).doit() assert simplify(lhs) == simplify(rhs) # Second product rule lhs = delop(u & v).doit() rhs = ((u ^ (delop ^ v)) + (v ^ (delop ^ u)) + \ ((u & delop)(v)) + ((v & delop)(u))).doit() assert simplify(lhs) == simplify(rhs) # Third product rule lhs = (delop & (f*v)).doit() rhs = ((f * (delop & v)) + (v & (delop(f)))).doit() assert simplify(lhs) == simplify(rhs) # Fourth product rule lhs = (delop & (u ^ v)).doit() rhs = ((v & (delop ^ u)) - (u & (delop ^ v))).doit() assert simplify(lhs) == simplify(rhs) # Fifth product rule lhs = (delop ^ (f * v)).doit() rhs = (((delop(f)) ^ v) + (f * (delop ^ v))).doit() assert simplify(lhs) == simplify(rhs) # Sixth product rule lhs = (delop ^ (u ^ v)).doit() rhs = ((u * (delop & v) - v * (delop & u) + (v & delop)(u) - (u & delop)(v))).doit() assert simplify(lhs) == simplify(rhs) P = C.orient_new_axis('P', q, C.k) # type: ignore scalar_field = 2*x**2*y*z grad_field = gradient(scalar_field) vector_field = y**2*i + 3*x*j + 5*y*z*k curl_field = curl(vector_field) def test_conservative(): assert is_conservative(Vector.zero) is True assert is_conservative(i) is True assert is_conservative(2 * i + 3 * j + 4 * k) is True assert (is_conservative(y*z*i + x*z*j + x*y*k) is True) assert is_conservative(x * j) is False assert is_conservative(grad_field) is True assert is_conservative(curl_field) is False assert (is_conservative(4*x*y*z*i + 2*x**2*z*j) is False) assert is_conservative(z*P.i + P.x*k) is True def test_solenoidal(): assert is_solenoidal(Vector.zero) is True assert is_solenoidal(i) is True assert is_solenoidal(2 * i + 3 * j + 4 * k) is True assert (is_solenoidal(y*z*i + x*z*j + x*y*k) is True) assert is_solenoidal(y * j) is False assert is_solenoidal(grad_field) is False assert is_solenoidal(curl_field) is True assert is_solenoidal((-2*y + 3)*k) is True assert is_solenoidal(cos(q)*i + sin(q)*j + cos(q)*P.k) is True assert is_solenoidal(z*P.i + P.x*k) is True def test_directional_derivative(): assert directional_derivative(C.x*C.y*C.z, 3*C.i + 4*C.j + C.k) == C.x*C.y + 4*C.x*C.z + 3*C.y*C.z assert directional_derivative(5*C.x**2*C.z, 3*C.i + 4*C.j + C.k) == 5*C.x**2 + 30*C.x*C.z assert directional_derivative(5*C.x**2*C.z, 4*C.j) is S.Zero D = CoordSys3D("D", "spherical", variable_names=["r", "theta", "phi"], vector_names=["e_r", "e_theta", "e_phi"]) r, theta, phi = D.base_scalars() e_r, e_theta, e_phi = D.base_vectors() assert directional_derivative(r**2*e_r, e_r) == 2*r*e_r assert directional_derivative(5*r**2*phi, 3*e_r + 4*e_theta + e_phi) == 5*r**2 + 30*r*phi def test_scalar_potential(): assert scalar_potential(Vector.zero, C) == 0 assert scalar_potential(i, C) == x assert scalar_potential(j, C) == y assert scalar_potential(k, C) == z assert scalar_potential(y*z*i + x*z*j + x*y*k, C) == x*y*z assert scalar_potential(grad_field, C) == scalar_field assert scalar_potential(z*P.i + P.x*k, C) == x*z*cos(q) + y*z*sin(q) assert scalar_potential(z*P.i + P.x*k, P) == P.x*P.z raises(ValueError, lambda: scalar_potential(x*j, C)) def test_scalar_potential_difference(): point1 = C.origin.locate_new('P1', 1*i + 2*j + 3*k) point2 = C.origin.locate_new('P2', 4*i + 5*j + 6*k) genericpointC = C.origin.locate_new('RP', x*i + y*j + z*k) genericpointP = P.origin.locate_new('PP', P.x*P.i + P.y*P.j + P.z*P.k) assert scalar_potential_difference(S.Zero, C, point1, point2) == 0 assert (scalar_potential_difference(scalar_field, C, C.origin, genericpointC) == scalar_field) assert (scalar_potential_difference(grad_field, C, C.origin, genericpointC) == scalar_field) assert scalar_potential_difference(grad_field, C, point1, point2) == 948 assert (scalar_potential_difference(y*z*i + x*z*j + x*y*k, C, point1, genericpointC) == x*y*z - 6) potential_diff_P = (2*P.z*(P.x*sin(q) + P.y*cos(q))* (P.x*cos(q) - P.y*sin(q))**2) assert (scalar_potential_difference(grad_field, P, P.origin, genericpointP).simplify() == potential_diff_P.simplify()) def test_differential_operators_curvilinear_system(): A = CoordSys3D('A', transformation="spherical", variable_names=["r", "theta", "phi"]) B = CoordSys3D('B', transformation='cylindrical', variable_names=["r", "theta", "z"]) # Test for spherical coordinate system and gradient assert gradient(3*A.r + 4*A.theta) == 3*A.i + 4/A.r*A.j assert gradient(3*A.r*A.phi + 4*A.theta) == 3*A.phi*A.i + 4/A.r*A.j + (3/sin(A.theta))*A.k assert gradient(0*A.r + 0*A.theta+0*A.phi) == Vector.zero assert gradient(A.r*A.theta*A.phi) == A.theta*A.phi*A.i + A.phi*A.j + (A.theta/sin(A.theta))*A.k # Test for spherical coordinate system and divergence assert divergence(A.r * A.i + A.theta * A.j + A.phi * A.k) == \ (sin(A.theta)*A.r + cos(A.theta)*A.r*A.theta)/(sin(A.theta)*A.r**2) + 3 + 1/(sin(A.theta)*A.r) assert divergence(3*A.r*A.phi*A.i + A.theta*A.j + A.r*A.theta*A.phi*A.k) == \ (sin(A.theta)*A.r + cos(A.theta)*A.r*A.theta)/(sin(A.theta)*A.r**2) + 9*A.phi + A.theta/sin(A.theta) assert divergence(Vector.zero) == 0 assert divergence(0*A.i + 0*A.j + 0*A.k) == 0 # Test for spherical coordinate system and curl assert curl(A.r*A.i + A.theta*A.j + A.phi*A.k) == \ (cos(A.theta)*A.phi/(sin(A.theta)*A.r))*A.i + (-A.phi/A.r)*A.j + A.theta/A.r*A.k assert curl(A.r*A.j + A.phi*A.k) == (cos(A.theta)*A.phi/(sin(A.theta)*A.r))*A.i + (-A.phi/A.r)*A.j + 2*A.k # Test for cylindrical coordinate system and gradient assert gradient(0*B.r + 0*B.theta+0*B.z) == Vector.zero assert gradient(B.r*B.theta*B.z) == B.theta*B.z*B.i + B.z*B.j + B.r*B.theta*B.k assert gradient(3*B.r) == 3*B.i assert gradient(2*B.theta) == 2/B.r * B.j assert gradient(4*B.z) == 4*B.k # Test for cylindrical coordinate system and divergence assert divergence(B.r*B.i + B.theta*B.j + B.z*B.k) == 3 + 1/B.r assert divergence(B.r*B.j + B.z*B.k) == 1 # Test for cylindrical coordinate system and curl assert curl(B.r*B.j + B.z*B.k) == 2*B.k assert curl(3*B.i + 2/B.r*B.j + 4*B.k) == Vector.zero def test_mixed_coordinates(): # gradient a = CoordSys3D('a') b = CoordSys3D('b') c = CoordSys3D('c') assert gradient(a.x*b.y) == b.y*a.i + a.x*b.j assert gradient(3*cos(q)*a.x*b.x+a.y*(a.x+((cos(q)+b.x)))) ==\ (a.y + 3*b.x*cos(q))*a.i + (a.x + b.x + cos(q))*a.j + (3*a.x*cos(q) + a.y)*b.i # Some tests need further work: # assert gradient(a.x*(cos(a.x+b.x))) == (cos(a.x + b.x))*a.i + a.x*Gradient(cos(a.x + b.x)) # assert gradient(cos(a.x + b.x)*cos(a.x + b.z)) == Gradient(cos(a.x + b.x)*cos(a.x + b.z)) assert gradient(a.x**b.y) == Gradient(a.x**b.y) # assert gradient(cos(a.x+b.y)*a.z) == None assert gradient(cos(a.x*b.y)) == Gradient(cos(a.x*b.y)) assert gradient(3*cos(q)*a.x*b.x*a.z*a.y+ b.y*b.z + cos(a.x+a.y)*b.z) == \ (3*a.y*a.z*b.x*cos(q) - b.z*sin(a.x + a.y))*a.i + \ (3*a.x*a.z*b.x*cos(q) - b.z*sin(a.x + a.y))*a.j + (3*a.x*a.y*b.x*cos(q))*a.k + \ (3*a.x*a.y*a.z*cos(q))*b.i + b.z*b.j + (b.y + cos(a.x + a.y))*b.k # divergence assert divergence(a.i*a.x+a.j*a.y+a.z*a.k + b.i*b.x+b.j*b.y+b.z*b.k + c.i*c.x+c.j*c.y+c.z*c.k) == S(9) # assert divergence(3*a.i*a.x*cos(a.x+b.z) + a.j*b.x*c.z) == None assert divergence(3*a.i*a.x*a.z + b.j*b.x*c.z + 3*a.j*a.z*a.y) == \ 6*a.z + b.x*Dot(b.j, c.k) assert divergence(3*cos(q)*a.x*b.x*b.i*c.x) == \ 3*a.x*b.x*cos(q)*Dot(b.i, c.i) + 3*a.x*c.x*cos(q) + 3*b.x*c.x*cos(q)*Dot(b.i, a.i) assert divergence(a.x*b.x*c.x*Cross(a.x*a.i, a.y*b.j)) ==\ a.x*b.x*c.x*Divergence(Cross(a.x*a.i, a.y*b.j)) + \ b.x*c.x*Dot(Cross(a.x*a.i, a.y*b.j), a.i) + \ a.x*c.x*Dot(Cross(a.x*a.i, a.y*b.j), b.i) + \ a.x*b.x*Dot(Cross(a.x*a.i, a.y*b.j), c.i) assert divergence(a.x*b.x*c.x*(a.x*a.i + b.x*b.i)) == \ 4*a.x*b.x*c.x +\ a.x**2*c.x*Dot(a.i, b.i) +\ a.x**2*b.x*Dot(a.i, c.i) +\ b.x**2*c.x*Dot(b.i, a.i) +\ a.x*b.x**2*Dot(b.i, c.i)