text:
using Rubin
using Tests
using Elliptic
using HypergeometricFunctions
using Polylogarithms
using SpecialFunctions

@test integrate(x^3*(a+b*x)*cosh(c+d*x), x) == :(-6*a*d^-4*cosh(c+d*x)+24*b*d^-5*sinh(c+d*x)+a*d^-1*x^3*sinh(c+d*x)+b*d^-1*x^4*sinh(c+d*x)+-24*b*x*d^-4*cosh(c+d*x)+-4*b*d^-2*x^3*cosh(c+d*x)+-3*a*d^-2*x^2*cosh(c+d*x)+6*a*x*d^-3*sinh(c+d*x)+12*b*d^-3*x^2*sinh(c+d*x))
@test integrate(x^2*(a+b*x)*cosh(c+d*x), x) == :(-6*b*d^-4*cosh(c+d*x)+2*a*d^-3*sinh(c+d*x)+a*d^-1*x^2*sinh(c+d*x)+b*d^-1*x^3*sinh(c+d*x)+-3*b*d^-2*x^2*cosh(c+d*x)+-2*a*x*d^-2*cosh(c+d*x)+6*b*x*d^-3*sinh(c+d*x))
@test integrate(x*(a+b*x)*cosh(c+d*x), x) == :(-1*a*d^-2*cosh(c+d*x)+2*b*d^-3*sinh(c+d*x)+a*x*d^-1*sinh(c+d*x)+b*d^-1*x^2*sinh(c+d*x)+-2*b*x*d^-2*cosh(c+d*x))
@test integrate((a+b*x)*cosh(c+d*x), x) == :(d^-1*(a+b*x)*sinh(c+d*x)+-1*b*d^-2*cosh(c+d*x))
@test integrate(x^-1*(a+b*x)*cosh(c+d*x), x) == :(a*cosh(c)*coshintegral(d*x)+a*sinh(c)*sinhintegral(d*x)+b*d^-1*sinh(c+d*x))
@test integrate(x^-2*(a+b*x)*cosh(c+d*x), x) == :(b*cosh(c)*coshintegral(d*x)+b*sinh(c)*sinhintegral(d*x)+-1*a*x^-1*cosh(c+d*x)+a*d*cosh(c)*sinhintegral(d*x)+a*d*coshintegral(d*x)*sinh(c))
@test integrate(x^-3*(a+b*x)*cosh(c+d*x), x) == :(-1*b*x^-1*cosh(c+d*x)+-1//2*a*x^-2*cosh(c+d*x)+b*d*cosh(c)*sinhintegral(d*x)+b*d*coshintegral(d*x)*sinh(c)+(1/2)*a*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a*d^2*sinh(c)*sinhintegral(d*x)+-1//2*a*d*x^-1*sinh(c+d*x))
@test integrate(x^-4*(a+b*x)*cosh(c+d*x), x) == :(-1//2*b*x^-2*cosh(c+d*x)+-1//3*a*x^-3*cosh(c+d*x)+(1/2)*b*d^2*cosh(c)*coshintegral(d*x)+(1/2)*b*d^2*sinh(c)*sinhintegral(d*x)+-1//2*b*d*x^-1*sinh(c+d*x)+-1//6*a*d*x^-2*sinh(c+d*x)+-1//6*a*d^2*x^-1*cosh(c+d*x)+1//6*a*d^3*cosh(c)*sinhintegral(d*x)+1//6*a*d^3*coshintegral(d*x)*sinh(c))
@test integrate(x^-5*(a+b*x)*cosh(c+d*x), x) == :(-1//3*b*x^-3*cosh(c+d*x)+-1//4*a*x^-4*cosh(c+d*x)+-1//6*b*d*x^-2*sinh(c+d*x)+-1//6*b*d^2*x^-1*cosh(c+d*x)+-1//12*a*d*x^-3*sinh(c+d*x)+-1//24*a*d^2*x^-2*cosh(c+d*x)+-1//24*a*d^3*x^-1*sinh(c+d*x)+1//6*b*d^3*cosh(c)*sinhintegral(d*x)+1//6*b*d^3*coshintegral(d*x)*sinh(c)+1//24*a*d^4*cosh(c)*coshintegral(d*x)+1//24*a*d^4*sinh(c)*sinhintegral(d*x))
@test integrate(x^2*(a+b*x)^2*cosh(c+d*x), x) == :(2*a^2*d^-3*sinh(c+d*x)+24*b^2*d^-5*sinh(c+d*x)+a^2*d^-1*x^2*sinh(c+d*x)+b^2*d^-1*x^4*sinh(c+d*x)+-24*x*b^2*d^-4*cosh(c+d*x)+-12*a*b*d^-4*cosh(c+d*x)+-4*b^2*d^-2*x^3*cosh(c+d*x)+-2*x*a^2*d^-2*cosh(c+d*x)+12*b^2*d^-3*x^2*sinh(c+d*x)+-6*a*b*d^-2*x^2*cosh(c+d*x)+2*a*b*d^-1*x^3*sinh(c+d*x)+12*a*b*x*d^-3*sinh(c+d*x))
@test integrate(x*(a+b*x)^2*cosh(c+d*x), x) == :(-1*a^2*d^-2*cosh(c+d*x)+-6*b^2*d^-4*cosh(c+d*x)+x*a^2*d^-1*sinh(c+d*x)+b^2*d^-1*x^3*sinh(c+d*x)+-3*b^2*d^-2*x^2*cosh(c+d*x)+4*a*b*d^-3*sinh(c+d*x)+6*x*b^2*d^-3*sinh(c+d*x)+-4*a*b*x*d^-2*cosh(c+d*x)+2*a*b*d^-1*x^2*sinh(c+d*x))
@test integrate((a+b*x)^2*cosh(c+d*x), x) == :(d^-1*(a+b*x)^2*sinh(c+d*x)+2*b^2*d^-3*sinh(c+d*x)+-2*b*d^-2*(a+b*x)*cosh(c+d*x))
@test integrate(x^-1*(a+b*x)^2*cosh(c+d*x), x) == :(a^2*cosh(c)*coshintegral(d*x)+a^2*sinh(c)*sinhintegral(d*x)+-1*b^2*d^-2*cosh(c+d*x)+x*b^2*d^-1*sinh(c+d*x)+2*a*b*d^-1*sinh(c+d*x))
@test integrate(x^-2*(a+b*x)^2*cosh(c+d*x), x) == :(b^2*d^-1*sinh(c+d*x)+-1*a^2*x^-1*cosh(c+d*x)+d*a^2*cosh(c)*sinhintegral(d*x)+d*a^2*coshintegral(d*x)*sinh(c)+2*a*b*cosh(c)*coshintegral(d*x)+2*a*b*sinh(c)*sinhintegral(d*x))
@test integrate(x^-3*(a+b*x)^2*cosh(c+d*x), x) == :(b^2*cosh(c)*coshintegral(d*x)+b^2*sinh(c)*sinhintegral(d*x)+-1//2*a^2*x^-2*cosh(c+d*x)+(1/2)*a^2*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^2*d^2*sinh(c)*sinhintegral(d*x)+-2*a*b*x^-1*cosh(c+d*x)+-1//2*d*a^2*x^-1*sinh(c+d*x)+2*a*b*d*cosh(c)*sinhintegral(d*x)+2*a*b*d*coshintegral(d*x)*sinh(c))
@test integrate(x^-4*(a+b*x)^2*cosh(c+d*x), x) == :(-1*b^2*x^-1*cosh(c+d*x)+-1//3*a^2*x^-3*cosh(c+d*x)+d*b^2*cosh(c)*sinhintegral(d*x)+d*b^2*coshintegral(d*x)*sinh(c)+-1*a*b*x^-2*cosh(c+d*x)+-1//6*d*a^2*x^-2*sinh(c+d*x)+-1//6*a^2*d^2*x^-1*cosh(c+d*x)+1//6*a^2*d^3*cosh(c)*sinhintegral(d*x)+1//6*a^2*d^3*coshintegral(d*x)*sinh(c)+a*b*d^2*cosh(c)*coshintegral(d*x)+a*b*d^2*sinh(c)*sinhintegral(d*x)+-1*a*b*d*x^-1*sinh(c+d*x))
@test integrate(x^-5*(a+b*x)^2*cosh(c+d*x), x) == :(-1//2*b^2*x^-2*cosh(c+d*x)+-1//4*a^2*x^-4*cosh(c+d*x)+(1/2)*b^2*d^2*cosh(c)*coshintegral(d*x)+(1/2)*b^2*d^2*sinh(c)*sinhintegral(d*x)+-2//3*a*b*x^-3*cosh(c+d*x)+-1//2*d*b^2*x^-1*sinh(c+d*x)+-1//12*d*a^2*x^-3*sinh(c+d*x)+-1//24*a^2*d^2*x^-2*cosh(c+d*x)+-1//24*a^2*d^3*x^-1*sinh(c+d*x)+1//24*a^2*d^4*cosh(c)*coshintegral(d*x)+1//24*a^2*d^4*sinh(c)*sinhintegral(d*x)+-1//3*a*b*d*x^-2*sinh(c+d*x)+-1//3*a*b*d^2*x^-1*cosh(c+d*x)+1//3*a*b*d^3*cosh(c)*sinhintegral(d*x)+1//3*a*b*d^3*coshintegral(d*x)*sinh(c))
@test integrate(x^4*(a+b*x)^-1*cosh(c+d*x), x) == :(-6*b^-1*d^-4*cosh(c+d*x)+a^4*b^-5*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+a^4*b^-5*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+b^-1*d^-1*x^3*sinh(c+d*x)+-1*a^2*b^-3*d^-2*cosh(c+d*x)+-1*a^3*b^-4*d^-1*sinh(c+d*x)+-3*b^-1*d^-2*x^2*cosh(c+d*x)+-2*a*b^-2*d^-3*sinh(c+d*x)+6*x*b^-1*d^-3*sinh(c+d*x)+x*a^2*b^-3*d^-1*sinh(c+d*x)+-1*a*b^-2*d^-1*x^2*sinh(c+d*x)+2*a*x*b^-2*d^-2*cosh(c+d*x))
@test integrate(x^3*(a+b*x)^-1*cosh(c+d*x), x) == :(2*b^-1*d^-3*sinh(c+d*x)+a*b^-2*d^-2*cosh(c+d*x)+a^2*b^-3*d^-1*sinh(c+d*x)+b^-1*d^-1*x^2*sinh(c+d*x)+-1*a^3*b^-4*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a^3*b^-4*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-2*x*b^-1*d^-2*cosh(c+d*x)+-1*a*x*b^-2*d^-1*sinh(c+d*x))
@test integrate(x^2*(a+b*x)^-1*cosh(c+d*x), x) == :(-1*b^-1*d^-2*cosh(c+d*x)+x*b^-1*d^-1*sinh(c+d*x)+a^2*b^-3*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+a^2*b^-3*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*a*b^-2*d^-1*sinh(c+d*x))
@test integrate(x*(a+b*x)^-1*cosh(c+d*x), x) == :(b^-1*d^-1*sinh(c+d*x)+-1*a*b^-2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a*b^-2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate((a+b*x)^-1*cosh(c+d*x), x) == :(b^-1*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+b^-1*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^-1*(a+b*x)^-1*cosh(c+d*x), x) == :(a^-1*cosh(c)*coshintegral(d*x)+a^-1*sinh(c)*sinhintegral(d*x)+-1*a^-1*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a^-1*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^-2*(a+b*x)^-1*cosh(c+d*x), x) == :(-1*a^-1*x^-1*cosh(c+d*x)+b*a^-2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+b*a^-2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*a^-1*cosh(c)*sinhintegral(d*x)+d*a^-1*coshintegral(d*x)*sinh(c)+-1*b*a^-2*cosh(c)*coshintegral(d*x)+-1*b*a^-2*sinh(c)*sinhintegral(d*x))
@test integrate(x^-3*(a+b*x)^-1*cosh(c+d*x), x) == :(-1//2*a^-1*x^-2*cosh(c+d*x)+b*a^-2*x^-1*cosh(c+d*x)+a^-3*b^2*cosh(c)*coshintegral(d*x)+a^-3*b^2*sinh(c)*sinhintegral(d*x)+(1/2)*a^-1*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^-1*d^2*sinh(c)*sinhintegral(d*x)+-1*a^-3*b^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a^-3*b^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1//2*d*a^-1*x^-1*sinh(c+d*x)+-1*b*d*a^-2*cosh(c)*sinhintegral(d*x)+-1*b*d*a^-2*coshintegral(d*x)*sinh(c))
@test integrate(x^4*(a+b*x)^-2*cosh(c+d*x), x) == :(2*b^-2*d^-3*sinh(c+d*x)+b^-2*d^-1*x^2*sinh(c+d*x)+-1*a^4*b^-5*(a+b*x)^-1*cosh(c+d*x)+-4*a^3*b^-5*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-4*a^3*b^-5*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-2*x*b^-2*d^-2*cosh(c+d*x)+2*a*b^-3*d^-2*cosh(c+d*x)+3*a^2*b^-4*d^-1*sinh(c+d*x)+d*a^4*b^-6*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*a^4*b^-6*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+-2*a*x*b^-3*d^-1*sinh(c+d*x))
@test integrate(x^3*(a+b*x)^-2*cosh(c+d*x), x) == :(-1*b^-2*d^-2*cosh(c+d*x)+x*b^-2*d^-1*sinh(c+d*x)+a^3*b^-4*(a+b*x)^-1*cosh(c+d*x)+-2*a*b^-3*d^-1*sinh(c+d*x)+3*a^2*b^-4*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+3*a^2*b^-4*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*d*a^3*b^-5*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*d*a^3*b^-5*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate(x^2*(a+b*x)^-2*cosh(c+d*x), x) == :(b^-2*d^-1*sinh(c+d*x)+-1*a^2*b^-3*(a+b*x)^-1*cosh(c+d*x)+-2*a*b^-3*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-2*a*b^-3*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*a^2*b^-4*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*a^2*b^-4*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate(x*(a+b*x)^-2*cosh(c+d*x), x) == :(b^-2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+b^-2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+a*b^-2*(a+b*x)^-1*cosh(c+d*x)+-1*a*d*b^-3*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*a*d*b^-3*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate((a+b*x)^-2*cosh(c+d*x), x) == :(-1*b^-1*(a+b*x)^-1*cosh(c+d*x)+d*b^-2*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*b^-2*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate(x^-1*(a+b*x)^-2*cosh(c+d*x), x) == :(a^-1*(a+b*x)^-1*cosh(c+d*x)+a^-2*cosh(c)*coshintegral(d*x)+a^-2*sinh(c)*sinhintegral(d*x)+-1*a^-2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a^-2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*d*a^-1*b^-1*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*d*a^-1*b^-1*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate(x^-2*(a+b*x)^-2*cosh(c+d*x), x) == :(-1*a^-2*x^-1*cosh(c+d*x)+d*a^-2*cosh(c)*sinhintegral(d*x)+d*a^-2*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*a^-2*coshintegral(d*x)*sinh(c)+d*a^-2*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+-1*b*a^-2*(a+b*x)^-1*cosh(c+d*x)+-2*b*a^-3*cosh(c)*coshintegral(d*x)+-2*b*a^-3*sinh(c)*sinhintegral(d*x)+2*b*a^-3*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+2*b*a^-3*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^3*(a+b*x)^-3*cosh(c+d*x), x) == :(b^-3*d^-1*sinh(c+d*x)+(1/2)*a^3*b^-4*(a+b*x)^-2*cosh(c+d*x)+-3*a*b^-4*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-3*a*b^-4*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-3*a^2*b^-4*(a+b*x)^-1*cosh(c+d*x)+(1/2)*d*a^3*b^-5*(a+b*x)^-1*sinh(c+d*x)+3*d*a^2*b^-5*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+3*d*a^2*b^-5*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+-1//2*a^3*b^-6*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1//2*a^3*b^-6*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^2*(a+b*x)^-3*cosh(c+d*x), x) == :(b^-3*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+b^-3*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+2*a*b^-3*(a+b*x)^-1*cosh(c+d*x)+-1//2*a^2*b^-3*(a+b*x)^-2*cosh(c+d*x)+(1/2)*a^2*b^-5*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+(1/2)*a^2*b^-5*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-2*a*d*b^-4*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-2*a*d*b^-4*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+-1//2*d*a^2*b^-4*(a+b*x)^-1*sinh(c+d*x))
@test integrate(x*(a+b*x)^-3*cosh(c+d*x), x) == :(-1*b^-2*(a+b*x)^-1*cosh(c+d*x)+d*b^-3*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+d*b^-3*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+(1/2)*a*b^-2*(a+b*x)^-2*cosh(c+d*x)+(1/2)*a*d*b^-3*(a+b*x)^-1*sinh(c+d*x)+-1//2*a*b^-4*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1//2*a*b^-4*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate((a+b*x)^-3*cosh(c+d*x), x) == :(-1//2*b^-1*(a+b*x)^-2*cosh(c+d*x)+(1/2)*b^-3*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+(1/2)*b^-3*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1//2*d*b^-2*(a+b*x)^-1*sinh(c+d*x))
@test integrate(x^-1*(a+b*x)^-3*cosh(c+d*x), x) == :(a^-3*cosh(c)*coshintegral(d*x)+a^-3*sinh(c)*sinhintegral(d*x)+a^-2*(a+b*x)^-1*cosh(c+d*x)+(1/2)*a^-1*(a+b*x)^-2*cosh(c+d*x)+-1*a^-3*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1*a^-3*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+(1/2)*d*a^-1*b^-1*(a+b*x)^-1*sinh(c+d*x)+-1*d*a^-2*b^-1*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1*d*a^-2*b^-1*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+-1//2*a^-1*b^-2*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1//2*a^-1*b^-2*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^-2*(a+b*x)^-3*cosh(c+d*x), x) == :(-1*a^-3*x^-1*cosh(c+d*x)+d*a^-3*cosh(c)*sinhintegral(d*x)+d*a^-3*coshintegral(d*x)*sinh(c)+-3*b*a^-4*cosh(c)*coshintegral(d*x)+-3*b*a^-4*sinh(c)*sinhintegral(d*x)+-2*b*a^-3*(a+b*x)^-1*cosh(c+d*x)+2*d*a^-3*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+2*d*a^-3*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1)+3*b*a^-4*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+3*b*a^-4*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-1//2*b*a^-2*(a+b*x)^-2*cosh(c+d*x)+-1//2*d*a^-2*(a+b*x)^-1*sinh(c+d*x)+(1/2)*a^-2*b^-1*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+(1/2)*a^-2*b^-1*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1))
@test integrate(x^-3*(a+b*x)^-3*cosh(c+d*x), x) == :(-1//2*a^-3*x^-2*cosh(c+d*x)+(1/2)*a^-3*b^2*(a+b*x)^-2*cosh(c+d*x)+(1/2)*a^-3*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^-3*d^2*sinh(c)*sinhintegral(d*x)+-6*a^-5*b^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-6*a^-5*b^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+3*b*a^-4*x^-1*cosh(c+d*x)+3*a^-4*b^2*(a+b*x)^-1*cosh(c+d*x)+6*a^-5*b^2*cosh(c)*coshintegral(d*x)+6*a^-5*b^2*sinh(c)*sinhintegral(d*x)+-1//2*d*a^-3*x^-1*sinh(c+d*x)+-1//2*a^-3*d^2*cosh(c+-1*a*d*b^-1)*coshintegral(d*x+a*d*b^-1)+-1//2*a^-3*d^2*sinh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+(1/2)*b*d*a^-3*(a+b*x)^-1*sinh(c+d*x)+-3*b*d*a^-4*cosh(c)*sinhintegral(d*x)+-3*b*d*a^-4*cosh(c+-1*a*d*b^-1)*sinhintegral(d*x+a*d*b^-1)+-3*b*d*a^-4*coshintegral(d*x)*sinh(c)+-3*b*d*a^-4*coshintegral(d*x+a*d*b^-1)*sinh(c+-1*a*d*b^-1))
@test integrate(x^3*(a+b*x^2)*cosh(c+d*x), x) == :(-120*b*d^-6*cosh(c+d*x)+-6*a*d^-4*cosh(c+d*x)+a*d^-1*x^3*sinh(c+d*x)+b*d^-1*x^5*sinh(c+d*x)+-60*b*d^-4*x^2*cosh(c+d*x)+-5*b*d^-2*x^4*cosh(c+d*x)+-3*a*d^-2*x^2*cosh(c+d*x)+6*a*x*d^-3*sinh(c+d*x)+20*b*d^-3*x^3*sinh(c+d*x)+120*b*x*d^-5*sinh(c+d*x))
@test integrate(x^2*(a+b*x^2)*cosh(c+d*x), x) == :(2*a*d^-3*sinh(c+d*x)+24*b*d^-5*sinh(c+d*x)+a*d^-1*x^2*sinh(c+d*x)+b*d^-1*x^4*sinh(c+d*x)+-24*b*x*d^-4*cosh(c+d*x)+-4*b*d^-2*x^3*cosh(c+d*x)+-2*a*x*d^-2*cosh(c+d*x)+12*b*d^-3*x^2*sinh(c+d*x))
@test integrate(x*(a+b*x^2)*cosh(c+d*x), x) == :(-1*a*d^-2*cosh(c+d*x)+-6*b*d^-4*cosh(c+d*x)+a*x*d^-1*sinh(c+d*x)+b*d^-1*x^3*sinh(c+d*x)+-3*b*d^-2*x^2*cosh(c+d*x)+6*b*x*d^-3*sinh(c+d*x))
@test integrate((a+b*x^2)*cosh(c+d*x), x) == :(a*d^-1*sinh(c+d*x)+2*b*d^-3*sinh(c+d*x)+b*d^-1*x^2*sinh(c+d*x)+-2*b*x*d^-2*cosh(c+d*x))
@test integrate(x^-1*(a+b*x^2)*cosh(c+d*x), x) == :(a*cosh(c)*coshintegral(d*x)+a*sinh(c)*sinhintegral(d*x)+-1*b*d^-2*cosh(c+d*x)+b*x*d^-1*sinh(c+d*x))
@test integrate(x^-2*(a+b*x^2)*cosh(c+d*x), x) == :(b*d^-1*sinh(c+d*x)+-1*a*x^-1*cosh(c+d*x)+a*d*cosh(c)*sinhintegral(d*x)+a*d*coshintegral(d*x)*sinh(c))
@test integrate(x^-3*(a+b*x^2)*cosh(c+d*x), x) == :(b*cosh(c)*coshintegral(d*x)+b*sinh(c)*sinhintegral(d*x)+-1//2*a*x^-2*cosh(c+d*x)+(1/2)*a*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a*d^2*sinh(c)*sinhintegral(d*x)+-1//2*a*d*x^-1*sinh(c+d*x))
@test integrate(x^-4*(a+b*x^2)*cosh(c+d*x), x) == :(-1*b*x^-1*cosh(c+d*x)+-1//3*a*x^-3*cosh(c+d*x)+b*d*cosh(c)*sinhintegral(d*x)+b*d*coshintegral(d*x)*sinh(c)+-1//6*a*d*x^-2*sinh(c+d*x)+-1//6*a*d^2*x^-1*cosh(c+d*x)+1//6*a*d^3*cosh(c)*sinhintegral(d*x)+1//6*a*d^3*coshintegral(d*x)*sinh(c))
@test integrate(x^-5*(a+b*x^2)*cosh(c+d*x), x) == :(-1//2*b*x^-2*cosh(c+d*x)+-1//4*a*x^-4*cosh(c+d*x)+(1/2)*b*d^2*cosh(c)*coshintegral(d*x)+(1/2)*b*d^2*sinh(c)*sinhintegral(d*x)+-1//2*b*d*x^-1*sinh(c+d*x)+-1//12*a*d*x^-3*sinh(c+d*x)+-1//24*a*d^2*x^-2*cosh(c+d*x)+-1//24*a*d^3*x^-1*sinh(c+d*x)+1//24*a*d^4*cosh(c)*coshintegral(d*x)+1//24*a*d^4*sinh(c)*sinhintegral(d*x))
@test integrate(x^2*(a+b*x^2)^2*cosh(c+d*x), x) == :(2*a^2*d^-3*sinh(c+d*x)+720*b^2*d^-7*sinh(c+d*x)+a^2*d^-1*x^2*sinh(c+d*x)+b^2*d^-1*x^6*sinh(c+d*x)+-720*x*b^2*d^-6*cosh(c+d*x)+-120*b^2*d^-4*x^3*cosh(c+d*x)+-6*b^2*d^-2*x^5*cosh(c+d*x)+-2*x*a^2*d^-2*cosh(c+d*x)+30*b^2*d^-3*x^4*sinh(c+d*x)+48*a*b*d^-5*sinh(c+d*x)+360*b^2*d^-5*x^2*sinh(c+d*x)+-48*a*b*x*d^-4*cosh(c+d*x)+-8*a*b*d^-2*x^3*cosh(c+d*x)+2*a*b*d^-1*x^4*sinh(c+d*x)+24*a*b*d^-3*x^2*sinh(c+d*x))
@test integrate(x*(a+b*x^2)^2*cosh(c+d*x), x) == :(-1*a^2*d^-2*cosh(c+d*x)+-120*b^2*d^-6*cosh(c+d*x)+x*a^2*d^-1*sinh(c+d*x)+b^2*d^-1*x^5*sinh(c+d*x)+-60*b^2*d^-4*x^2*cosh(c+d*x)+-12*a*b*d^-4*cosh(c+d*x)+-5*b^2*d^-2*x^4*cosh(c+d*x)+20*b^2*d^-3*x^3*sinh(c+d*x)+120*x*b^2*d^-5*sinh(c+d*x)+-6*a*b*d^-2*x^2*cosh(c+d*x)+2*a*b*d^-1*x^3*sinh(c+d*x)+12*a*b*x*d^-3*sinh(c+d*x))
@test integrate((a+b*x^2)^2*cosh(c+d*x), x) == :(a^2*d^-1*sinh(c+d*x)+24*b^2*d^-5*sinh(c+d*x)+b^2*d^-1*x^4*sinh(c+d*x)+-24*x*b^2*d^-4*cosh(c+d*x)+-4*b^2*d^-2*x^3*cosh(c+d*x)+4*a*b*d^-3*sinh(c+d*x)+12*b^2*d^-3*x^2*sinh(c+d*x)+-4*a*b*x*d^-2*cosh(c+d*x)+2*a*b*d^-1*x^2*sinh(c+d*x))
@test integrate(x^-1*(a+b*x^2)^2*cosh(c+d*x), x) == :(a^2*cosh(c)*coshintegral(d*x)+a^2*sinh(c)*sinhintegral(d*x)+-6*b^2*d^-4*cosh(c+d*x)+b^2*d^-1*x^3*sinh(c+d*x)+-3*b^2*d^-2*x^2*cosh(c+d*x)+-2*a*b*d^-2*cosh(c+d*x)+6*x*b^2*d^-3*sinh(c+d*x)+2*a*b*x*d^-1*sinh(c+d*x))
@test integrate(x^-2*(a+b*x^2)^2*cosh(c+d*x), x) == :(-1*a^2*x^-1*cosh(c+d*x)+2*b^2*d^-3*sinh(c+d*x)+d*a^2*cosh(c)*sinhintegral(d*x)+d*a^2*coshintegral(d*x)*sinh(c)+b^2*d^-1*x^2*sinh(c+d*x)+-2*x*b^2*d^-2*cosh(c+d*x)+2*a*b*d^-1*sinh(c+d*x))
@test integrate(x^-3*(a+b*x^2)^2*cosh(c+d*x), x) == :(-1*b^2*d^-2*cosh(c+d*x)+-1//2*a^2*x^-2*cosh(c+d*x)+x*b^2*d^-1*sinh(c+d*x)+(1/2)*a^2*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^2*d^2*sinh(c)*sinhintegral(d*x)+2*a*b*cosh(c)*coshintegral(d*x)+2*a*b*sinh(c)*sinhintegral(d*x)+-1//2*d*a^2*x^-1*sinh(c+d*x))
@test integrate(x^-4*(a+b*x^2)^2*cosh(c+d*x), x) == :(b^2*d^-1*sinh(c+d*x)+-1//3*a^2*x^-3*cosh(c+d*x)+-2*a*b*x^-1*cosh(c+d*x)+-1//6*d*a^2*x^-2*sinh(c+d*x)+-1//6*a^2*d^2*x^-1*cosh(c+d*x)+1//6*a^2*d^3*cosh(c)*sinhintegral(d*x)+1//6*a^2*d^3*coshintegral(d*x)*sinh(c)+2*a*b*d*cosh(c)*sinhintegral(d*x)+2*a*b*d*coshintegral(d*x)*sinh(c))
@test integrate(x^-5*(a+b*x^2)^2*cosh(c+d*x), x) == :(b^2*cosh(c)*coshintegral(d*x)+b^2*sinh(c)*sinhintegral(d*x)+-1//4*a^2*x^-4*cosh(c+d*x)+-1*a*b*x^-2*cosh(c+d*x)+-1//12*d*a^2*x^-3*sinh(c+d*x)+-1//24*a^2*d^2*x^-2*cosh(c+d*x)+-1//24*a^2*d^3*x^-1*sinh(c+d*x)+1//24*a^2*d^4*cosh(c)*coshintegral(d*x)+1//24*a^2*d^4*sinh(c)*sinhintegral(d*x)+a*b*d^2*cosh(c)*coshintegral(d*x)+a*b*d^2*sinh(c)*sinhintegral(d*x)+-1*a*b*d*x^-1*sinh(c+d*x))
@test integrate(x^4*(a+b*x^2)^-1*cosh(c+d*x), x) == :(2*b^-1*d^-3*sinh(c+d*x)+b^-1*d^-1*x^2*sinh(c+d*x)+(1/2)*b^-5//2*(-1a)^3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1*a*b^-2*d^-1*sinh(c+d*x)+-2*x*b^-1*d^-2*cosh(c+d*x)+-1//2*b^-5//2*(-1a)^3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-5//2*(-1a)^3//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-5//2*(-1a)^3//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^3*(a+b*x^2)^-1*cosh(c+d*x), x) == :(-1*b^-1*d^-2*cosh(c+d*x)+x*b^-1*d^-1*sinh(c+d*x)+(1/2)*a*b^-2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a*b^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a*b^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a*b^-2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^2*(a+b*x^2)^-1*cosh(c+d*x), x) == :(b^-1*d^-1*sinh(c+d*x)+(1/2)*b^-3//2*(-1a)^(1/2)*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-3//2*(-1a)^(1/2)*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-3//2*(-1a)^(1/2)*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-3//2*(-1a)^(1/2)*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x*(a+b*x^2)^-1*cosh(c+d*x), x) == :((1/2)*b^-1*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b^-1*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b^-1*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate((a+b*x^2)^-1*cosh(c+d*x), x) == :((1/2)*b^-1//2*(-1a)^-1//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1//2*(-1a)^-1//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1//2*(-1a)^-1//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1//2*(-1a)^-1//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-1*(a+b*x^2)^-1*cosh(c+d*x), x) == :(a^-1*cosh(c)*coshintegral(d*x)+a^-1*sinh(c)*sinhintegral(d*x)+(1/2)*a^-1*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-1*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-1*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-1*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-2*(a+b*x^2)^-1*cosh(c+d*x), x) == :(-1*a^-1*x^-1*cosh(c+d*x)+d*a^-1*cosh(c)*sinhintegral(d*x)+d*a^-1*coshintegral(d*x)*sinh(c)+(1/2)*b^(1/2)*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^(1/2)*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^(1/2)*(-1a)^-3//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^(1/2)*(-1a)^-3//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-3*(a+b*x^2)^-1*cosh(c+d*x), x) == :(-1//2*a^-1*x^-2*cosh(c+d*x)+(1/2)*b*a^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b*a^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b*a^-2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*a^-1*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^-1*d^2*sinh(c)*sinhintegral(d*x)+-1*b*a^-2*cosh(c)*coshintegral(d*x)+-1*b*a^-2*sinh(c)*sinhintegral(d*x)+-1//2*b*a^-2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*d*a^-1*x^-1*sinh(c+d*x))
@test integrate(x^4*(a+b*x^2)^-2*cosh(c+d*x), x) == :(b^-2*d^-1*sinh(c+d*x)+(1/2)*x*b^-2*cosh(c+d*x)+-3//4*b^-5//2*(-1a)^(1/2)*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-3//4*b^-5//2*(-1a)^(1/2)*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-3//4*b^-5//2*(-1a)^(1/2)*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1*x^3*(a+b*x^2)^-1*cosh(c+d*x)+3//4*b^-5//2*(-1a)^(1/2)*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*a*d*b^-3*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*a*d*b^-3*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+-1//4*a*d*b^-3*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+1//4*a*d*b^-3*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^3*(a+b*x^2)^-2*cosh(c+d*x), x) == :((1/2)*b^-2*cosh(c+d*x)+(1/2)*b^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*b^-2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*b^-1*x^2*(a+b*x^2)^-1*cosh(c+d*x)+-1//4*d*b^-5//2*(-1a)^(1/2)*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-5//2*(-1a)^(1/2)*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-5//2*(-1a)^(1/2)*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-5//2*(-1a)^(1/2)*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^2*(a+b*x^2)^-2*cosh(c+d*x), x) == :(-1//2*x*b^-1*(a+b*x^2)^-1*cosh(c+d*x)+-1//4*d*b^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*b^-3//2*(-1a)^-1//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*b^-3//2*(-1a)^-1//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*b^-3//2*(-1a)^-1//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+1//4*b^-3//2*(-1a)^-1//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x*(a+b*x^2)^-2*cosh(c+d*x), x) == :(-1//2*b^-1*(a+b*x^2)^-1*cosh(c+d*x)+-1//4*d*b^-3//2*(-1a)^-1//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-3//2*(-1a)^-1//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-3//2*(-1a)^-1//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-3//2*(-1a)^-1//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2)))
@test integrate((a+b*x^2)^-2*cosh(c+d*x), x) == :(-1//4*a^-1*b^-1//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*cosh(c+d*x)+-1//4*b^-1//2*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//4*a^-1*b^-1//2*((-1a)^(1/2)+x*b^(1/2))^-1*cosh(c+d*x)+1//4*b^-1//2*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//4*b^-1//2*(-1a)^-3//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//4*b^-1//2*(-1a)^-3//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*a^-1*b^-1*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*a^-1*b^-1*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+-1//4*d*a^-1*b^-1*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+1//4*d*a^-1*b^-1*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-1*(a+b*x^2)^-2*cosh(c+d*x), x) == :(a^-2*cosh(c)*coshintegral(d*x)+a^-2*sinh(c)*sinhintegral(d*x)+(1/2)*a^-1*(a+b*x^2)^-1*cosh(c+d*x)+(1/2)*a^-2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-1//2*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-1//2*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*b^-1//2*(-1a)^-3//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//4*d*b^-1//2*(-1a)^-3//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-2*(a+b*x^2)^-2*cosh(c+d*x), x) == :(-1*a^-2*x^-1*cosh(c+d*x)+d*a^-2*cosh(c)*sinhintegral(d*x)+d*a^-2*coshintegral(d*x)*sinh(c)+-3//4*b^(1/2)*(-1a)^-5//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*d*a^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//4*a^-2*b^(1/2)*((-1a)^(1/2)+x*b^(1/2))^-1*cosh(c+d*x)+1//4*d*a^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//4*d*a^-2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//4*d*a^-2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+1//4*a^-2*b^(1/2)*((-1a)^(1/2)+-1*x*b^(1/2))^-1*cosh(c+d*x)+3//4*b^(1/2)*(-1a)^-5//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+3//4*b^(1/2)*(-1a)^-5//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+3//4*b^(1/2)*(-1a)^-5//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^3*(a+b*x^2)^-3*cosh(c+d*x), x) == :(-1//4*b^-2*(a+b*x^2)^-1*cosh(c+d*x)+-1//4*b^-1*x^2*(a+b*x^2)^-2*cosh(c+d*x)+-1//16*b^-3*d^2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-3*d^2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-3*d^2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-3*d^2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*d*b^-5//2*(-1a)^-1//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*d*b^-5//2*(-1a)^-1//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*d*b^-5//2*(-1a)^-1//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+-1//8*d*x*b^-2*(a+b*x^2)^-1*sinh(c+d*x)+3//16*d*b^-5//2*(-1a)^-1//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^2*(a+b*x^2)^-3*cosh(c+d*x), x) == :(-1//4*x*b^-1*(a+b*x^2)^-2*cosh(c+d*x)+-1//8*d*b^-2*(a+b*x^2)^-1*sinh(c+d*x)+-1//16*a^-1*b^-3//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*cosh(c+d*x)+-1//16*b^-3//2*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*a^-1*b^-3//2*((-1a)^(1/2)+x*b^(1/2))^-1*cosh(c+d*x)+1//16*b^-3//2*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-3//2*(-1a)^-3//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-3//2*(-1a)^-3//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*d*a^-1*b^-2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*d*a^-1*b^-2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+-1//16*d*a^-1*b^-2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-5//2*d^2*(-1a)^-1//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-5//2*d^2*(-1a)^-1//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-5//2*d^2*(-1a)^-1//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*a^-1*b^-2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-5//2*d^2*(-1a)^-1//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x*(a+b*x^2)^-3*cosh(c+d*x), x) == :(-1//4*b^-1*(a+b*x^2)^-2*cosh(c+d*x)+-1//16*d*a^-1*b^-3//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*sinh(c+d*x)+-1//16*d*b^-3//2*(-1a)^-3//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+-1//16*a^-1*b^-2*d^2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*a^-1*b^-2*d^2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*a^-1*b^-2*d^2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*a^-1*b^-3//2*((-1a)^(1/2)+x*b^(1/2))^-1*sinh(c+d*x)+1//16*d*b^-3//2*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*b^-3//2*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*b^-3//2*(-1a)^-3//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+1//16*a^-1*b^-2*d^2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate((a+b*x^2)^-3*cosh(c+d*x), x) == :(-3//16*a^-2*b^-1//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*cosh(c+d*x)+-3//16*b^-1//2*(-1a)^-5//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*b^-1//2*(-1a)^-5//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*b^-1//2*(-1a)^-5//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-1//2*(-1a)^-3//2*((-1a)^(1/2)+-1*x*b^(1/2))^-2*cosh(c+d*x)+1//16*b^-1//2*(-1a)^-3//2*((-1a)^(1/2)+x*b^(1/2))^-2*cosh(c+d*x)+3//16*a^-2*b^-1//2*((-1a)^(1/2)+x*b^(1/2))^-1*cosh(c+d*x)+3//16*b^-1//2*(-1a)^-5//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*d*a^-2*b^-1*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-3//16*d*a^-2*b^-1*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+-3//16*d*a^-2*b^-1*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-3//2*d^2*(-1a)^-3//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-3//2*d^2*(-1a)^-3//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-3//2*d^2*(-1a)^-3//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*b^-1*(-1a)^-3//2*((-1a)^(1/2)+x*b^(1/2))^-1*sinh(c+d*x)+1//16*d*b^-1*(-1a)^-3//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*sinh(c+d*x)+1//16*b^-3//2*d^2*(-1a)^-3//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+3//16*d*a^-2*b^-1*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-1*(a+b*x^2)^-3*cosh(c+d*x), x) == :(a^-3*cosh(c)*coshintegral(d*x)+a^-3*sinh(c)*sinhintegral(d*x)+(1/2)*a^-3*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+(1/2)*a^-2*(a+b*x^2)^-1*cosh(c+d*x)+-1//2*a^-3*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-3*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*a^-3*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//4*a^-1*(a+b*x^2)^-2*cosh(c+d*x)+-5//16*d*b^-1//2*(-1a)^-5//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+-1//16*d*a^-2*b^-1//2*((-1a)^(1/2)+x*b^(1/2))^-1*sinh(c+d*x)+-1//16*a^-2*b^-1*d^2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*d*a^-2*b^-1//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*sinh(c+d*x)+1//16*a^-2*b^-1*d^2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+1//16*a^-2*b^-1*d^2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*a^-2*b^-1*d^2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+5//16*d*b^-1//2*(-1a)^-5//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+5//16*d*b^-1//2*(-1a)^-5//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+5//16*d*b^-1//2*(-1a)^-5//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-2*(a+b*x^2)^-3*cosh(c+d*x), x) == :(-1*a^-3*x^-1*cosh(c+d*x)+d*a^-3*cosh(c)*sinhintegral(d*x)+d*a^-3*coshintegral(d*x)*sinh(c)+-15//16*b^(1/2)*(-1a)^-7//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-15//16*b^(1/2)*(-1a)^-7//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-15//16*b^(1/2)*(-1a)^-7//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-7//16*d*a^-3*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-7//16*a^-3*b^(1/2)*((-1a)^(1/2)+x*b^(1/2))^-1*cosh(c+d*x)+-1//16*b^(1/2)*(-1a)^-5//2*((-1a)^(1/2)+-1*x*b^(1/2))^-2*cosh(c+d*x)+1//16*d*(-1a)^-5//2*((-1a)^(1/2)+x*b^(1/2))^-1*sinh(c+d*x)+1//16*d*(-1a)^-5//2*((-1a)^(1/2)+-1*x*b^(1/2))^-1*sinh(c+d*x)+1//16*b^(1/2)*(-1a)^-5//2*((-1a)^(1/2)+x*b^(1/2))^-2*cosh(c+d*x)+7//16*d*a^-3*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+7//16*d*a^-3*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))+7//16*d*a^-3*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+7//16*a^-3*b^(1/2)*((-1a)^(1/2)+-1*x*b^(1/2))^-1*cosh(c+d*x)+15//16*b^(1/2)*(-1a)^-7//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-1//2*d^2*(-1a)^-5//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-1//2*d^2*(-1a)^-5//2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*b^-1//2*d^2*(-1a)^-5//2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*b^-1//2*d^2*(-1a)^-5//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^-3*(a+b*x^2)^-3*cosh(c+d*x), x) == :(-1//2*a^-3*x^-2*cosh(c+d*x)+(1/2)*a^-3*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^-3*d^2*sinh(c)*sinhintegral(d*x)+-1*b*a^-3*(a+b*x^2)^-1*cosh(c+d*x)+-3*b*a^-4*cosh(c)*coshintegral(d*x)+-3*b*a^-4*sinh(c)*sinhintegral(d*x)+-3//2*b*a^-4*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//2*d*a^-3*x^-1*sinh(c+d*x)+-1//4*b*a^-2*(a+b*x^2)^-2*cosh(c+d*x)+-1//16*a^-3*d^2*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*a^-3*d^2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-1//16*a^-3*d^2*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+1//16*a^-3*d^2*sinh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+3//2*b*a^-4*cosh(c+d*b^-1//2*(-1a)^(1/2))*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+3//2*b*a^-4*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))+3//2*b*a^-4*sinh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+-9//16*d*b^(1/2)*(-1a)^-7//2*coshintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+d*b^-1//2*(-1a)^(1/2))+-1//16*d*a^-3*b^(1/2)*((-1a)^(1/2)+-1*x*b^(1/2))^-1*sinh(c+d*x)+1//16*d*a^-3*b^(1/2)*((-1a)^(1/2)+x*b^(1/2))^-1*sinh(c+d*x)+9//16*d*b^(1/2)*(-1a)^-7//2*cosh(c+d*b^-1//2*(-1a)^(1/2))*sinhintegral(-1*d*x+d*b^-1//2*(-1a)^(1/2))+9//16*d*b^(1/2)*(-1a)^-7//2*cosh(c+-1*d*b^-1//2*(-1a)^(1/2))*sinhintegral(d*x+d*b^-1//2*(-1a)^(1/2))+9//16*d*b^(1/2)*(-1a)^-7//2*coshintegral(d*x+d*b^-1//2*(-1a)^(1/2))*sinh(c+-1*d*b^-1//2*(-1a)^(1/2)))
@test integrate(x^3*(a+b*x^3)*cosh(c+d*x), x) == :(-6*a*d^-4*cosh(c+d*x)+720*b*d^-7*sinh(c+d*x)+a*d^-1*x^3*sinh(c+d*x)+b*d^-1*x^6*sinh(c+d*x)+-720*b*x*d^-6*cosh(c+d*x)+-120*b*d^-4*x^3*cosh(c+d*x)+-6*b*d^-2*x^5*cosh(c+d*x)+-3*a*d^-2*x^2*cosh(c+d*x)+6*a*x*d^-3*sinh(c+d*x)+30*b*d^-3*x^4*sinh(c+d*x)+360*b*d^-5*x^2*sinh(c+d*x))
@test integrate(x^2*(a+b*x^3)*cosh(c+d*x), x) == :(-120*b*d^-6*cosh(c+d*x)+2*a*d^-3*sinh(c+d*x)+a*d^-1*x^2*sinh(c+d*x)+b*d^-1*x^5*sinh(c+d*x)+-60*b*d^-4*x^2*cosh(c+d*x)+-5*b*d^-2*x^4*cosh(c+d*x)+-2*a*x*d^-2*cosh(c+d*x)+20*b*d^-3*x^3*sinh(c+d*x)+120*b*x*d^-5*sinh(c+d*x))
@test integrate(x*(a+b*x^3)*cosh(c+d*x), x) == :(-1*a*d^-2*cosh(c+d*x)+24*b*d^-5*sinh(c+d*x)+a*x*d^-1*sinh(c+d*x)+b*d^-1*x^4*sinh(c+d*x)+-24*b*x*d^-4*cosh(c+d*x)+-4*b*d^-2*x^3*cosh(c+d*x)+12*b*d^-3*x^2*sinh(c+d*x))
@test integrate((a+b*x^3)*cosh(c+d*x), x) == :(a*d^-1*sinh(c+d*x)+-6*b*d^-4*cosh(c+d*x)+b*d^-1*x^3*sinh(c+d*x)+-3*b*d^-2*x^2*cosh(c+d*x)+6*b*x*d^-3*sinh(c+d*x))
@test integrate(x^-1*(a+b*x^3)*cosh(c+d*x), x) == :(a*cosh(c)*coshintegral(d*x)+a*sinh(c)*sinhintegral(d*x)+2*b*d^-3*sinh(c+d*x)+b*d^-1*x^2*sinh(c+d*x)+-2*b*x*d^-2*cosh(c+d*x))
@test integrate(x^-2*(a+b*x^3)*cosh(c+d*x), x) == :(-1*a*x^-1*cosh(c+d*x)+-1*b*d^-2*cosh(c+d*x)+a*d*cosh(c)*sinhintegral(d*x)+a*d*coshintegral(d*x)*sinh(c)+b*x*d^-1*sinh(c+d*x))
@test integrate(x^-3*(a+b*x^3)*cosh(c+d*x), x) == :(b*d^-1*sinh(c+d*x)+-1//2*a*x^-2*cosh(c+d*x)+(1/2)*a*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a*d^2*sinh(c)*sinhintegral(d*x)+-1//2*a*d*x^-1*sinh(c+d*x))
@test integrate(x^-4*(a+b*x^3)*cosh(c+d*x), x) == :(b*cosh(c)*coshintegral(d*x)+b*sinh(c)*sinhintegral(d*x)+-1//3*a*x^-3*cosh(c+d*x)+-1//6*a*d*x^-2*sinh(c+d*x)+-1//6*a*d^2*x^-1*cosh(c+d*x)+1//6*a*d^3*cosh(c)*sinhintegral(d*x)+1//6*a*d^3*coshintegral(d*x)*sinh(c))
@test integrate(x*(a+b*x^3)^2*cosh(c+d*x), x) == :(-1*a^2*d^-2*cosh(c+d*x)+-5040*b^2*d^-8*cosh(c+d*x)+x*a^2*d^-1*sinh(c+d*x)+b^2*d^-1*x^7*sinh(c+d*x)+-2520*b^2*d^-6*x^2*cosh(c+d*x)+-210*b^2*d^-4*x^4*cosh(c+d*x)+-7*b^2*d^-2*x^6*cosh(c+d*x)+42*b^2*d^-3*x^5*sinh(c+d*x)+48*a*b*d^-5*sinh(c+d*x)+840*b^2*d^-5*x^3*sinh(c+d*x)+5040*x*b^2*d^-7*sinh(c+d*x)+-48*a*b*x*d^-4*cosh(c+d*x)+-8*a*b*d^-2*x^3*cosh(c+d*x)+2*a*b*d^-1*x^4*sinh(c+d*x)+24*a*b*d^-3*x^2*sinh(c+d*x))
@test integrate((a+b*x^3)^2*cosh(c+d*x), x) == :(a^2*d^-1*sinh(c+d*x)+720*b^2*d^-7*sinh(c+d*x)+b^2*d^-1*x^6*sinh(c+d*x)+-720*x*b^2*d^-6*cosh(c+d*x)+-120*b^2*d^-4*x^3*cosh(c+d*x)+-12*a*b*d^-4*cosh(c+d*x)+-6*b^2*d^-2*x^5*cosh(c+d*x)+30*b^2*d^-3*x^4*sinh(c+d*x)+360*b^2*d^-5*x^2*sinh(c+d*x)+-6*a*b*d^-2*x^2*cosh(c+d*x)+2*a*b*d^-1*x^3*sinh(c+d*x)+12*a*b*x*d^-3*sinh(c+d*x))
@test integrate(x^-1*(a+b*x^3)^2*cosh(c+d*x), x) == :(a^2*cosh(c)*coshintegral(d*x)+a^2*sinh(c)*sinhintegral(d*x)+-120*b^2*d^-6*cosh(c+d*x)+b^2*d^-1*x^5*sinh(c+d*x)+-60*b^2*d^-4*x^2*cosh(c+d*x)+-5*b^2*d^-2*x^4*cosh(c+d*x)+4*a*b*d^-3*sinh(c+d*x)+20*b^2*d^-3*x^3*sinh(c+d*x)+120*x*b^2*d^-5*sinh(c+d*x)+-4*a*b*x*d^-2*cosh(c+d*x)+2*a*b*d^-1*x^2*sinh(c+d*x))
@test integrate(x^-2*(a+b*x^3)^2*cosh(c+d*x), x) == :(-1*a^2*x^-1*cosh(c+d*x)+24*b^2*d^-5*sinh(c+d*x)+d*a^2*cosh(c)*sinhintegral(d*x)+d*a^2*coshintegral(d*x)*sinh(c)+b^2*d^-1*x^4*sinh(c+d*x)+-24*x*b^2*d^-4*cosh(c+d*x)+-4*b^2*d^-2*x^3*cosh(c+d*x)+-2*a*b*d^-2*cosh(c+d*x)+12*b^2*d^-3*x^2*sinh(c+d*x)+2*a*b*x*d^-1*sinh(c+d*x))
@test integrate(x^-3*(a+b*x^3)^2*cosh(c+d*x), x) == :(-6*b^2*d^-4*cosh(c+d*x)+-1//2*a^2*x^-2*cosh(c+d*x)+b^2*d^-1*x^3*sinh(c+d*x)+(1/2)*a^2*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^2*d^2*sinh(c)*sinhintegral(d*x)+-3*b^2*d^-2*x^2*cosh(c+d*x)+2*a*b*d^-1*sinh(c+d*x)+6*x*b^2*d^-3*sinh(c+d*x)+-1//2*d*a^2*x^-1*sinh(c+d*x))
@test integrate(x^-4*(a+b*x^3)^2*cosh(c+d*x), x) == :(2*b^2*d^-3*sinh(c+d*x)+-1//3*a^2*x^-3*cosh(c+d*x)+b^2*d^-1*x^2*sinh(c+d*x)+-2*x*b^2*d^-2*cosh(c+d*x)+2*a*b*cosh(c)*coshintegral(d*x)+2*a*b*sinh(c)*sinhintegral(d*x)+-1//6*d*a^2*x^-2*sinh(c+d*x)+-1//6*a^2*d^2*x^-1*cosh(c+d*x)+1//6*a^2*d^3*cosh(c)*sinhintegral(d*x)+1//6*a^2*d^3*coshintegral(d*x)*sinh(c))
@test integrate(x^-5*(a+b*x^3)^2*cosh(c+d*x), x) == :(-1*b^2*d^-2*cosh(c+d*x)+-1//4*a^2*x^-4*cosh(c+d*x)+x*b^2*d^-1*sinh(c+d*x)+-2*a*b*x^-1*cosh(c+d*x)+-1//12*d*a^2*x^-3*sinh(c+d*x)+-1//24*a^2*d^2*x^-2*cosh(c+d*x)+-1//24*a^2*d^3*x^-1*sinh(c+d*x)+1//24*a^2*d^4*cosh(c)*coshintegral(d*x)+1//24*a^2*d^4*sinh(c)*sinhintegral(d*x)+2*a*b*d*cosh(c)*sinhintegral(d*x)+2*a*b*d*coshintegral(d*x)*sinh(c))
@test integrate(x^4*(a+b*x^3)^-1*cosh(c+d*x), x) == :(-1*b^-1*d^-2*cosh(c+d*x)+x*b^-1*d^-1*sinh(c+d*x)+1//3*a^2//3*b^-5//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//3*a^2//3*b^-5//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^2//3*b^-5//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^2//3*b^-5//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^2//3*b^-5//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*(-1)^2//3*a^2//3*b^-5//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^3*(a+b*x^3)^-1*cosh(c+d*x), x) == :(b^-1*d^-1*sinh(c+d*x)+-1//3*a^1//3*b^-4//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^1//3*b^-4//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^1//3*b^-4//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^1//3*b^-4//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^1//3*b^-4//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//3*(-1)^1//3*a^1//3*b^-4//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^2*(a+b*x^3)^-1*cosh(c+d*x), x) == :(-1//3*b^-1*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*b^-1*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//3*b^-1*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*b^-1*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//3*b^-1*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//3*b^-1*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3))
@test integrate(x*(a+b*x^3)^-1*cosh(c+d*x), x) == :(-1//3*a^-1//3*b^-2//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-1//3*b^-2//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^-1//3*b^-2//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*(-1)^1//3*a^-1//3*b^-2//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//3*(-1)^1//3*a^-1//3*b^-2//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//3*(-1)^2//3*a^-1//3*b^-2//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate((a+b*x^3)^-1*cosh(c+d*x), x) == :(1//3*a^-2//3*b^-1//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//3*a^-2//3*b^-1//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^-2//3*b^-1//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*(-1)^1//3*a^-2//3*b^-1//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*(-1)^2//3*a^-2//3*b^-1//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//3*(-1)^2//3*a^-2//3*b^-1//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3))
@test integrate(x^-1*(a+b*x^3)^-1*cosh(c+d*x), x) == :(a^-1*cosh(c)*coshintegral(d*x)+a^-1*sinh(c)*sinhintegral(d*x)+-1//3*a^-1*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-1*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//3*a^-1*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*a^-1*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-1*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//3*a^-1*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^-2*(a+b*x^3)^-1*cosh(c+d*x), x) == :(-1*a^-1*x^-1*cosh(c+d*x)+d*a^-1*cosh(c)*sinhintegral(d*x)+d*a^-1*coshintegral(d*x)*sinh(c)+1//3*a^-4//3*b^1//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//3*a^-4//3*b^1//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^-4//3*b^1//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^-4//3*b^1//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^-4//3*b^1//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//3*(-1)^2//3*a^-4//3*b^1//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^-3*(a+b*x^3)^-1*cosh(c+d*x), x) == :(-1//2*a^-1*x^-2*cosh(c+d*x)+(1/2)*a^-1*d^2*cosh(c)*coshintegral(d*x)+(1/2)*a^-1*d^2*sinh(c)*sinhintegral(d*x)+-1//2*d*a^-1*x^-1*sinh(c+d*x)+-1//3*a^-5//3*b^2//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-5//3*b^2//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*(-1)^1//3*a^-5//3*b^2//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^-5//3*b^2//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*(-1)^2//3*a^-5//3*b^2//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//3*(-1)^1//3*a^-5//3*b^2//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^3*(a+b*x^3)^-2*cosh(c+d*x), x) == :(-1//3*x*b^-1*(a+b*x^3)^-1*cosh(c+d*x)+1//9*a^-2//3*b^-4//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//9*a^-2//3*b^-4//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//9*d*a^-1//3*b^-5//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//9*d*a^-1//3*b^-5//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-1//9*(-1)^1//3*a^-2//3*b^-4//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*(-1)^1//3*a^-2//3*b^-4//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*(-1)^2//3*a^-2//3*b^-4//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//9*(-1)^2//3*a^-2//3*b^-4//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*(-1)^2//3*a^-1//3*b^-5//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*(-1)^1//3*a^-1//3*b^-5//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//9*d*(-1)^1//3*a^-1//3*b^-5//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//9*d*(-1)^2//3*a^-1//3*b^-5//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^2*(a+b*x^3)^-2*cosh(c+d*x), x) == :(-1//3*b^-1*(a+b*x^3)^-1*cosh(c+d*x)+1//9*d*a^-2//3*b^-4//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//9*d*a^-2//3*b^-4//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-1//9*d*(-1)^1//3*a^-2//3*b^-4//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*(-1)^1//3*a^-2//3*b^-4//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*(-1)^2//3*a^-2//3*b^-4//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//9*d*(-1)^2//3*a^-2//3*b^-4//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3))
@test integrate(x*(a+b*x^3)^-2*cosh(c+d*x), x) == :(-1//3*b^-1*x^-1*(a+b*x^3)^-1*cosh(c+d*x)+-1//9*a^-4//3*b^-2//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//9*a^-4//3*b^-2//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//3*a^-1*b^-1*x^-1*cosh(c+d*x)+-1//9*d*a^-1*b^-1*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//9*d*a^-1*b^-1*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*a^-1*b^-1*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-1//9*d*a^-1*b^-1*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+-1//9*d*a^-1*b^-1*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*(-1)^2//3*a^-4//3*b^-2//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*a^-1*b^-1*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*(-1)^1//3*a^-4//3*b^-2//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//9*(-1)^1//3*a^-4//3*b^-2//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//9*(-1)^2//3*a^-4//3*b^-2//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate((a+b*x^3)^-2*cosh(c+d*x), x) == :(-1//3*b^-1*x^-2*(a+b*x^3)^-1*cosh(c+d*x)+1//3*a^-1*b^-1*x^-2*cosh(c+d*x)+2//9*a^-5//3*b^-1//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+2//9*a^-5//3*b^-1//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-2//9*(-1)^1//3*a^-5//3*b^-1//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*a^-4//3*b^-2//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//9*d*a^-4//3*b^-2//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+2//9*(-1)^1//3*a^-5//3*b^-1//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+2//9*(-1)^2//3*a^-5//3*b^-1//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+2//9*(-1)^2//3*a^-5//3*b^-1//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*(-1)^1//3*a^-4//3*b^-2//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*(-1)^1//3*a^-4//3*b^-2//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*(-1)^2//3*a^-4//3*b^-2//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//9*d*(-1)^2//3*a^-4//3*b^-2//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^-1*(a+b*x^3)^-2*cosh(c+d*x), x) == :(a^-2*cosh(c)*coshintegral(d*x)+a^-2*sinh(c)*sinhintegral(d*x)+-1//3*a^-2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//3*a^-2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//3*a^-2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//3*a^-2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//3*a^-2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//3*b^-1*x^-3*(a+b*x^3)^-1*cosh(c+d*x)+1//3*a^-1*b^-1*x^-3*cosh(c+d*x)+-1//9*d*a^-5//3*b^-1//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//9*d*a^-5//3*b^-1//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-1//9*d*(-1)^1//3*a^-5//3*b^-1//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//9*d*(-1)^2//3*a^-5//3*b^-1//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//9*d*(-1)^2//3*a^-5//3*b^-1//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//9*d*(-1)^1//3*a^-5//3*b^-1//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^5*(a+b*x^3)^-3*cosh(c+d*x), x) == :(-1//6*b^-2*(a+b*x^3)^-1*cosh(c+d*x)+-1//6*b^-1*x^3*(a+b*x^3)^-2*cosh(c+d*x)+-1//18*d*x*b^-2*(a+b*x^3)^-1*sinh(c+d*x)+-1//54*a^-1//3*b^-8//3*d^2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//54*a^-1//3*b^-8//3*d^2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+2//27*d*a^-2//3*b^-7//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+2//27*d*a^-2//3*b^-7//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-2//27*d*(-1)^1//3*a^-2//3*b^-7//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*(-1)^2//3*a^-1//3*b^-8//3*d^2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//54*(-1)^1//3*a^-1//3*b^-8//3*d^2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//54*(-1)^1//3*a^-1//3*b^-8//3*d^2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//54*(-1)^2//3*a^-1//3*b^-8//3*d^2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+2//27*d*(-1)^1//3*a^-2//3*b^-7//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+2//27*d*(-1)^2//3*a^-2//3*b^-7//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+2//27*d*(-1)^2//3*a^-2//3*b^-7//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3))
@test integrate(x^4*(a+b*x^3)^-3*cosh(c+d*x), x) == :(-1//6*b^-1*x^2*(a+b*x^3)^-2*cosh(c+d*x)+-1//9*b^-2*x^-1*(a+b*x^3)^-1*cosh(c+d*x)+-1//18*d*b^-2*(a+b*x^3)^-1*sinh(c+d*x)+-1//27*a^-4//3*b^-5//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//27*a^-4//3*b^-5//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//9*a^-1*b^-2*x^-1*cosh(c+d*x)+-1//27*d*a^-1*b^-2*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//27*d*a^-1*b^-2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//27*d*a^-1*b^-2*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-1//27*d*a^-1*b^-2*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+-1//27*d*a^-1*b^-2*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//27*(-1)^2//3*a^-4//3*b^-5//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//27*d*a^-1*b^-2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//27*(-1)^1//3*a^-4//3*b^-5//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//27*(-1)^1//3*a^-4//3*b^-5//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//27*(-1)^2//3*a^-4//3*b^-5//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//54*a^-2//3*b^-7//3*d^2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//54*a^-2//3*b^-7//3*d^2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//54*(-1)^1//3*a^-2//3*b^-7//3*d^2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//54*(-1)^1//3*a^-2//3*b^-7//3*d^2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//54*(-1)^2//3*a^-2//3*b^-7//3*d^2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//54*(-1)^2//3*a^-2//3*b^-7//3*d^2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3))
@test integrate(x^3*(a+b*x^3)^-3*cosh(c+d*x), x) == :(-1//6*x*b^-1*(a+b*x^3)^-2*cosh(c+d*x)+-1//18*b^-2*x^-2*(a+b*x^3)^-1*cosh(c+d*x)+1//18*a^-1*b^-2*x^-2*cosh(c+d*x)+1//27*a^-5//3*b^-4//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//27*a^-5//3*b^-4//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//18*d*b^-2*x^-1*(a+b*x^3)^-1*sinh(c+d*x)+-1//27*(-1)^1//3*a^-5//3*b^-4//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*a^-1*b^-2*d^2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//54*a^-1*b^-2*d^2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*a^-1*b^-2*d^2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//54*a^-1*b^-2*d^2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//54*a^-1*b^-2*d^2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//18*d*a^-1*b^-2*x^-1*sinh(c+d*x)+1//27*(-1)^1//3*a^-5//3*b^-4//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//27*(-1)^2//3*a^-5//3*b^-4//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//27*(-1)^2//3*a^-5//3*b^-4//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//54*a^-1*b^-2*d^2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x^2*(a+b*x^3)^-3*cosh(c+d*x), x) == :(-1//6*b^-1*(a+b*x^3)^-2*cosh(c+d*x)+-1//18*d*b^-2*x^-2*(a+b*x^3)^-1*sinh(c+d*x)+1//18*d*a^-1*b^-2*x^-2*sinh(c+d*x)+1//27*d*a^-5//3*b^-4//3*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//27*d*a^-5//3*b^-4//3*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+1//54*a^-4//3*b^-5//3*d^2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+1//54*a^-4//3*b^-5//3*d^2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//27*d*(-1)^1//3*a^-5//3*b^-4//3*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*(-1)^1//3*a^-4//3*b^-5//3*d^2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//54*(-1)^1//3*a^-4//3*b^-5//3*d^2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-1//54*(-1)^2//3*a^-4//3*b^-5//3*d^2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//27*d*(-1)^1//3*a^-5//3*b^-4//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+1//27*d*(-1)^2//3*a^-5//3*b^-4//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//27*d*(-1)^2//3*a^-5//3*b^-4//3*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+1//54*(-1)^2//3*a^-4//3*b^-5//3*d^2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))
@test integrate(x*(a+b*x^3)^-3*cosh(c+d*x), x) == :(-2//27*a^-7//3*b^-2//3*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-2//27*a^-7//3*b^-2//3*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-1//6*b^-1*x^-1*(a+b*x^3)^-2*cosh(c+d*x)+-1//18*a^-1*b^-2*x^-4*cosh(c+d*x)+1//18*b^-2*x^-4*(a+b*x^3)^-1*cosh(c+d*x)+2//9*a^-2*b^-1*x^-1*cosh(c+d*x)+-2//27*d*a^-2*b^-1*cosh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+-2//27*d*a^-2*b^-1*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+-2//27*d*a^-2*b^-1*coshintegral(d*x+d*a^1//3*b^-1//3)*sinh(c+-1*d*a^1//3*b^-1//3)+-2//27*d*a^-2*b^-1*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)+-2//27*d*a^-2*b^-1*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-2//27*(-1)^2//3*a^-7//3*b^-2//3*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//18*d*b^-2*x^-3*(a+b*x^3)^-1*sinh(c+d*x)+-1//54*a^-5//3*b^-4//3*d^2*cosh(c+-1*d*a^1//3*b^-1//3)*coshintegral(d*x+d*a^1//3*b^-1//3)+-1//54*a^-5//3*b^-4//3*d^2*sinh(c+-1*d*a^1//3*b^-1//3)*sinhintegral(d*x+d*a^1//3*b^-1//3)+1//18*d*a^-1*b^-2*x^-3*sinh(c+d*x)+2//27*d*a^-2*b^-1*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+2//27*(-1)^1//3*a^-7//3*b^-2//3*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+2//27*(-1)^1//3*a^-7//3*b^-2//3*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+2//27*(-1)^2//3*a^-7//3*b^-2//3*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*(-1)^1//3*a^-5//3*b^-4//3*d^2*sinh(c+d*(-1)^1//3*a^1//3*b^-1//3)*sinhintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3)+-1//54*(-1)^2//3*a^-5//3*b^-4//3*d^2*cosh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+-1*d*(-1)^2//3*a^1//3*b^-1//3)+-1//54*(-1)^2//3*a^-5//3*b^-4//3*d^2*sinh(c+-1*d*(-1)^2//3*a^1//3*b^-1//3)*sinhintegral(d*x+d*(-1)^2//3*a^1//3*b^-1//3)+1//54*(-1)^1//3*a^-5//3*b^-4//3*d^2*cosh(c+d*(-1)^1//3*a^1//3*b^-1//3)*coshintegral(-1*d*x+d*(-1)^1//3*a^1//3*b^-1//3))

max_stars_repo_path: test/6 Hyperbolic functions/6.2 Hyperbolic cosine/6.2.2 (e x)^m (a+b x^n)^p cosh.jl


text:
"DataType for program registers."
type Reg
    op::Op
    name::Symbol
    args::Vector{Symbol}
    cond::Expr
    argv::Vector{Int}
    plist::Dict{Symbol,Any}
    out; out0; dif; dif0; tmp;
end

Reg(op::Op,name::Symbol,args::Vector{Symbol},cond::Expr)=
    Reg(op,name,args,cond,Int[],Dict{Symbol,Any}(),
        nothing,nothing,nothing,nothing,nothing)

# Stack entries will be triples consisting of:
# 1. the :forw flag, indicating whether the operation was performed
# 2. the argv array indicating which inputs were used
# 3. the output array, if :save was set
# Both :forw and argv may change based on runtime conditions, and
# the stack has to record these for back which does not have access
# to runtime conditions.

"DataType for stack entries."
type StackEntry
    forw::Bool
    argv::Vector{Int}
    out
end

"DataType for a compiled network."
type Net
    reg::Vector{Reg}
    stack::Vector{StackEntry}
    sp::Int
    lastforw
    lastback
    Net(reg::Vector{Reg})=new(reg, Any[], 0)
end

import Base: length, get, eltype, pop!, push!

regs(f::Net)=f.reg
length(f::Net)=length(f.reg)
reg(f::Net,i)=f.reg[i]          # i could be an array or any other type of index expression
params(f::Net)=filter(x->isa(x.op,Par),f.reg)
ninputs(f::Net)=count(x->(isa(x.op,Input) && getp(x,:forw)),f.reg)
eltype(f::Net)=(r=f.reg[1];!isvoid(r,:out0)?eltype(r.out0):error("Uninitialized Net"))

function reg(f::Net,k::Symbol)
    i = findlast(f.reg) do p
        getp(p,:forw) && p.name==k
    end
    return i==0 ? nothing : f.reg[i]
end

get(f::Net,k)=(r=reg(f,k); r==nothing ? r : r.out) # to_host(r.out))
dif(f::Net,k)=(r=reg(f,k); r==nothing ? r : r.dif)

inputregs(f::Net,p::Reg)=f.reg[p.argv]

# map too slow?
# inputs(f::Net,p::Reg)=map(x->x.out, inputregs(f,p))
inputs(f::Net,p::Reg)=outs(inputregs(f,p))

function outs(pp::Vector{Reg})
    n = length(pp)
    a = cell(n)
    @inbounds for i=1:n; a[i]=pp[i].out; end
    return a
end

function difs(pp::Vector{Reg})
    n = length(pp)
    a = cell(n)
    @inbounds for i=1:n
        r = pp[i]
        a[i]=(!getp(r,:grad) ? nothing :
              getp(r,:incr) ? r.tmp :
              r.dif0)
    end
    return a
end

getp(p::Reg,k::Symbol,v=false)=get(p.plist,k,v)
incp(p::Reg,k::Symbol)=setp(p,k,1+getp(p,k,0))
setp(p::Reg,k::Symbol,v)=(p.plist[k]=v)
setp(p::Reg; o...)=(for (k,v) in o; setp(p,k,v); end)
setp(f::Net; o...)=(for p in regs(f); setp(p; o...); end)

function setp(f::Net,k; o...)
    r=reg(f,k)
    if isa(r,Reg)
        setp(r;o...)
    elseif isa(r,Array)
        for p in r; setp(p;o...); end
    end
end

### Cleanup at the beginning/end of sequence

function reset!(f::Net; keepstate=false)
    f.sp = 0
    for p in regs(f)
        p.dif = nothing
        getp(p,:incr) && !isvoid(p,:dif0) && fillsync!(p.dif0, 0)
        if keepstate
            p.out = p.out0
            push!(f,p)
        else
            p.out = nothing
        end
    end
end

function push!(f::Net,p::Reg)
    if length(f.stack) < f.sp
        error("Stack error")
    elseif length(f.stack) == f.sp
        push!(f.stack, StackEntry(false, Int[], nothing))
    end
    s = f.stack[f.sp+=1]
    s.forw = getp(p,:forw)
    if s.forw
        s.argv = (issimilar(s.argv,p.argv) ?
                  copy!(s.argv,p.argv) :
                  copy(p.argv))
        s.out = (!getp(p,:save) ? s.out : # won't be used so keep the storage
                 p.out == nothing ?      # nothing represents zero array
                 (s.out!=nothing && Base.warn_once("Writing nothing over array"); nothing) :
                 ispersistent(p) ? p.out : # no need to copy Par or Arr, they won't change during forw/back
                 issimilar(s.out, p.out) ?
                 copysync!(s.out, p.out) :
                 copysync!(similar(p.out), p.out)) # this is the only allocation
    end
end

stack_length(f::Net)=f.sp
stack_empty!(f::Net)=(f.sp=0)
stack_isempty(f::Net)=(f.sp==0)

function update!(m::Net; gclip=0, gscale=1, o...) # TODO: implement callbacks
    if gclip > 0
        g = gnorm(m)
        gscale *= (g > gclip ? gclip/g : 1)
    end
    for p in params(m)
        isvoid(p,:dif) && continue # may happen when a conditional part of the model never runs
        update!(p; o..., gscale=gscale)
    end
end

vnorm(x)=(x==nothing ? 0 : vecnorm(x))
wnorm(m::Net,w=0)=(for p in params(m); w += vnorm(p.out); end; w)           # t:317
gnorm(m::Net,g=0)=(for p in params(m); g += vnorm(p.dif); end; g)           # t:332

function Base.isequal(a::Union{Net,Reg,StackEntry}, b::Union{Net,Reg,StackEntry})
    for n in fieldnames(a)
        if isdefined(a,n) && isdefined(b,n)
            isequal(a.(n), b.(n)) || return false
        elseif isdefined(a,n) || isdefined(b,n)
            return false
        end
    end
    return true
end

### File I/O

using JLD

function clean(net::Net)
    a = Array(Reg, length(net))
    for i=1:length(net)
        r = net.reg[i]
        a[i] = Reg(r.op, r.name, r.args, r.cond, r.argv, r.plist,
                   ispersistent(r) ? r.out : nothing,
                   ispersistent(r) ? r.out0 : nothing,
                   nothing, nothing, nothing)
    end
    return Net(a)
end

### DEBUGGING

Base.writemime(io::IO, ::MIME"text/plain", f::Net)=netprint(f)

function netprint(f::Net)
    # vecnorm1(x,n)=(!isdefined(x,n)? Inf : x.(n)==nothing ? NaN : vecnorm(x.(n)))
    for i=1:length(f)
        r=reg(f,i)
        @printf("%d %s%s name=>%s", i, typeof(r.op), tuple(r.argv...), r.name)
        !isempty(r.args) && @printf(",args=>(%s)", join(r.args,","))
        !isvoid(r,:out0) && @printf(",dims=>%s", size(r.out0))
        !isvoid(r,:out) && @printf(",norm=>%g", vecnorm(r.out))
        !isvoid(r,:dif) && @printf(",norm=>%g", vecnorm(r.dif))
        !isempty(r.cond.args) && @printf(",cond=>%s", r.cond.args)
        for (k,v) in r.plist; @printf(",%s=>%s", string(k), v); end
        println()
    end
end

ptr16(x)=hex(x==nothing ? 0 : hash(pointer(x)) % 0xffff, 4)
ptr8(x)=hex(x==nothing ? 0 : hash(pointer(x)) % 0xff, 2)
idx1(x)=(x==nothing ? -1 : atype(x)==CudaArray ? to_host(x)[1] : atype(x)==Array ? x[1] : error("$(typeof(x))"))

vecnorm0(x,y...)=map(vecnorm0,(x,y...))
vecnorm0(x::Vector)=map(vecnorm0,x)
vecnorm0(x::Tuple)=map(vecnorm0,x)
vecnorm0(x::Par)= ((!isvoid(x,:out)? vecnorm0(x.out) : 0),
                   (!isvoid(x,:dif)? vecnorm0(x.dif) : 0))
vecnorm0(::Void)=0
vecnorm0(x)=(@sprintf("%.8f",vecnorm(x))) #floor(1e6*vecnorm(x))/1e6

### DEAD CODE

    # isempty(f.stack) || (warn("Stack not empty"); empty!(f.stack))
    # isempty(f.sdict) || (warn("Sdict not empty"); empty!(f.sdict))

# function push!(f::Net,a)
#     push!(f.stack,a)
#     if a!=nothing
#         isa(a,NTuple{3}) || error("Expected NTuple{3} got $a")
#         (y, xsave, ysave) = a
#         ysave == nothing || (f.sdict[ysave]=true)
#         xsave == nothing || (for x in xsave; f.sdict[x]=true; end)
#     end
# end

# function pop!(f::Net)
#     a = pop!(f.stack)
#     if isempty(f.stack)
#         f.sfree = collect(keys(f.sdict))
#         empty!(f.sdict)
#     end
#     return a
# end

# Too expensive:

# function pop!(f::Net)
#     a = pop!(f.stack)
#     if a!=nothing
#         isa(a,NTuple{3}) || error("Expected NTuple{3} got $a")
#         (y, xsave, ysave) = a
#         ysave == nothing || dec!(f.sdict,ysave)
#         xsave == nothing || (for x in xsave; dec!(f.sdict,x); end)
#     end
#     return a
# end

# inc!(p::ObjectIdDict,k)=(p[k]=1+getp(p,k,0))

# function dec!(p::ObjectIdDict,k)
#     haskey(p,k) || (warn("Object not in dict"); return)
#     n = getp(p,k,0)
#     if n > 1
#         p[k] = n-1
#     elseif n == 1
#         delete!(p,k)
#     else
#         warn("Bad count for object: $n")
#         delete!(p,k)
#     end
# end

# op(f::Net,n::Int)=f.reg[n].op
# inputs(f::Net,n::Int)=f.reg[n].inputs
# output(f::Net,n::Int)=f.reg[n].output
# forwref(f::Net,n::Int)=any(i->in(output(f,n),inputs(f,i)), 1:n-1)

# regs(f::Net)=values(f.reg)
# output_register(f::Net,p::Ins)=reg(f.reg,p.output,nothing)
# inputregs(f::Net,p::Ins)=map(s->reg(f.reg,s,nothing), p.inputs)
# input_arrays(f::Net,p::Ins)=map(s->(haskey(f.reg,s) ? f.reg[s].out : nothing), p.inputs)

# nops(f::Net)=length(f.reg)

# getprop(p::Ins,k,d=false)=get(p.plist,k,d)
# setprop!(p::Ins,k,v=true)=(p.plist[k]=v)
# set!(p::Ins,k,v=true)=setprop!(p,k,v)

# getprop(p::Reg,k,d=false)=get(p.plist,k,d)
# setprop!(p::Reg,k,v=true)=(p.plist[k]=v)
# set!(p::Reg,k,v=true)=setprop!(p,k,v)
# inc!(p::Reg,k)=set!(p,k,1+get(p,k))

# getreg(f::Net,k::Symbol)=reg(f.reg,k,nothing)
# getdif(f::Net,k::Symbol)=(haskey(f.reg,k) ? f.reg[k].dif : nothing)
# getout(f::Net,k::Symbol)=(haskey(f.reg,k) ? f.reg[k].out : nothing)
# getreg(f::Net,p::Ins)=getreg(f,p.output)
# getdif(f::Net,p::Ins)=getdif(f,p.output)
# getout(f::Net,p::Ins)=getout(f,p.output)

# Base.reg(f::Net,k)=getout(f,k)
# Base.get(p::Ins,k,d=false)=getprop(p,k,d)
# Base.get(p::Reg,k,d=false)=getprop(p,k,d)

# Base.copysync!(r::Reg,x)=(r.out=copysync!(r.out0,x))

# type Ins
#     output::Symbol
#     op::Op
#     inputs::Vector{Symbol}
#     cond::Expr
#     plist::Dict
#     out; out0; dif; dif0; tmp
#     function Ins(output::Symbol,op::Op,inputs::Vector{Symbol},cond::Expr)
#         new(output,op,inputs,cond,Dict(),nothing,nothing,nothing,nothing,nothing)
#     end
# end

# type Net
#     op::Vector{Ins}
#     sp::Int
#     stack::Vector
# end

# """
# tosave(op, inputs) returns tosave[n] which is true if the result of
# op[n] would be needed for back calculation.  We find this out using
# back_reads_x and back_reads_y on each op.  Note that Par registers
# are persistent and do not need to be saved.
# """
# function tosave(op, inputs)
#     N = length(op)
#     tosave = falses(N)
#     for n=1:length(op)
#         back_reads_y(op[n]) && (tosave[n] = true)
#         if back_reads_x(op[n])
#             for i in inputs[n]
#                 if !isa(op[i], Par)
#                     tosave[i] = true
#                 end
#             end
#         end
#     end
#     return tosave
# end

# """
# outputs(inputs) returns an array of output indices for each register.
# Note that the final register is the network output, so it could be
# read externally even if outputs[N] is empty.
# """
# function outputs(inputs)
#     N = length(inputs)
#     outputs = [ Int[] for n=1:N ]
#     for n=1:N
#         for i in inputs[n]
#             push!(outputs[i], n)
#         end
#     end
#     push!(outputs[N], 0)        # for network output
#     return outputs
# end

# """
# Net(::Expr) compiles a quoted block of net language to a Net object
# """
# function Net(a::Expr)
#     (op, inputs) = netcomp(a)
#     N = length(op)
#     Net(op, inputs, outputs(inputs),
#         count(x->isa(x,Input), op),
#         filter(x->isa(x,Par), op),
#         tosave(op, inputs),
#         falses(N), # toback: depends on dx
#         falses(N), # toincr: depends on seq
#         falses(N), # sparse: depends on input
#         cell(N), cell(N), cell(N), cell(N), cell(N),
#         Any[], 0)
# end

# """
# netcomp(::Expr) compiles Expr and returns (ops, opinputs)
# where inputs are represented as integer indices.
# """
# function netcomp(a::Expr)
#     (op,innames,outname) = netcomp1(a)
#     dict = Dict{Symbol,Int}()
#     for n=1:length(outname)
#         dict[outname[n]] = n
#     end
#     inputidx = Array(Vector{Int}, length(innames))
#     for n=1:length(innames)
#         inputidx[n] = map(x->dict[x], innames[n])
#     end
#     (op, inputidx)
# end

# """
# netcomp1(::Expr) compiles Expr and returns (ops, inputs, output)
# where inputs and outputs are gensyms
# """
# function netcomp1(block::Expr)
#     @assert block.head == :block
#     dict = Dict{Symbol,Symbol}()
#     ops = Op[]
#     inputs = Vector{Symbol}[]
#     output = Symbol[]
#     for stmt in block.args
#         isa(stmt, LineNumberNode) && continue
#         @assert isa(stmt, Expr)
#         (opoutput, func, opinputs, params) = netstmt(stmt, dict)
#         ev = eval(current_module(), Expr(:call, func, params...))
#         if isa(ev, Op)
#             @assert length(opinputs) == ninputs(ev)
#             push!(ops, ev)
#             push!(inputs, opinputs)
#             push!(output, opoutput)
#         elseif isa(ev, Expr)
#             (subops, subinputs, suboutput) = subcomp(ev, opinputs, opoutput)
#             append!(ops, subops)
#             append!(inputs, subinputs)
#             append!(output, suboutput)
#         else
#             error("Compiler error: $ev, $func, $params")
#         end
#     end
#     (ops, inputs, output)
# end

# """
# subcomp(::Expr, netinputs, netoutput): compiles a subroutine with
# input/output symbols given by the caller.
# """
# function subcomp(block::Expr, netinputs, netoutput)
#     (ops, inputs, output) = netcomp1(block)
#     @assert length(netinputs) == count(op->isa(op,Input), ops)
#     substitute = Dict{Symbol,Symbol}()
#     nextinput = 0
#     for i=1:length(ops)
#         isa(ops[i], Input) || continue
#         substitute[output[i]] = netinputs[nextinput += 1]
#     end
#     substitute[output[end]] = netoutput
#     newops = Any[]
#     newinputs = Any[]
#     newoutput = Any[]
#     for i=1:length(ops)
#         isa(ops[i], Input) && continue                          # input ops can be dropped, inputs are now caller symbols
#         push!(newops, ops[i])
#         push!(newinputs, map(x->get(substitute,x,x), inputs[i]))
#         push!(newoutput, get(substitute, output[i], output[i]))
#     end
#     (newops, newinputs, newoutput)
# end

# """
# netstmt(::Expr,::Dict): parses a single assignment statement converting
# variables to gensyms.  Returns (target, func, args, pars).
# """
# function netstmt(stmt::Expr, dict::Dict{Symbol,Symbol})
#     @assert stmt.head == :(=)
#     @assert length(stmt.args) == 2
#     (target, expr) = stmt.args
#     @assert isa(target, Symbol)
#     target = get!(dict, target) do
#         gensym(target)
#     end
#     @assert expr.head == :call
#     func = expr.args[1]
#     args = Any[]
#     pars = Any[]
#     for a in expr.args[2:end]
#         isa(a, Symbol) ?
#         push!(args, a) :
#         push!(pars, a)
#     end
#     for i=1:length(args)
#         args[i] = get!(dict, args[i]) do
#             gensym(args[i])
#         end
#     end
#     (target, func, args, pars)
# end

# """
# multi(op, inputs) returns a bool vector which is true if op[n] has
# fanout > 1, in which case its dif should be incrementally updated.
# """
# function multi(op, inputs)
#     N = length(op)
#     nout = zeros(Int, N)
#     nout[N] = 1  # count network output as a read
#     for n=1:N
#         for i in inputs[n]
#             nout[i] += 1
#         end
#     end
#     return (nout .> 1)
# end

# """
# Neural network compiler.
# """
# type Net0
#     op::Vector{Op}
#     inputs::Vector{Vector{Int}}
#     outputs::Vector{Vector{Int}}
#     netinputs::Int
#     params::Vector{Par}
#     tosave::Vector{Bool}        # result of op[n] needed for back calculation.
#     toback::Vector{Bool}        # dif[n] should be calculated during back calculation
#     toincr::Vector{Bool}        # dif[n] should be incrementally updated: multiple outputs or Par in a sequence model
#     sparse::Vector              # a parameter dotted with sparse input
#     out::Vector
#     dif::Vector
#     out0::Vector
#     dif0::Vector
#     tmp::Vector
#     stack::Vector
#     sp::Int
#     Net0()=new()
# end

# function Net(f::Function; ninputs=1, o...)
#     x = [ gensym("x") for i=1:ninputs ]
#     y = gensym("y")
#     p = f(x..., y; o...)
#     b = Expr(:block)
#     for i in x; push!(b.args, :($i = input())); end
#     append!(b.args, p.args)
#     Net(b)
# end

# function Net(b::Expr)
#     net = Net()
#     reg = _knet(b)
#     net.op = map(first, reg)
#     N = length(reg)
#     dict = Dict{Symbol,Int}()
#     for i=1:N; dict[last(reg[i])] = i; end
#     net.inputs = [ Int[] for i=1:N ]
#     for i=1:N; for j=2:length(reg[i])-1; push!(net.inputs[i], dict[reg[i][j]]); end; end
#     net.outputs = outputs(net.inputs)
#     net.netinputs = count(x->isa(x,Input), net.op)
#     net.params = filter(x->isa(x,Par), net.op)
#     net.tosave = tosave(net.op, net.inputs)     # todo: does this not depend on dx as well?
#     net.toback = falses(N) # toback: depends on dx
#     net.toincr = falses(N) # toincr: depends on seq
#     net.sparse = nothings(N) # sparse: depends on input
#     for f in (:out,:dif,:out0,:dif0,:tmp); net.(f) = nothings(N); end
#     net.stack = Any[]
#     net.sp = 0
#     return net
# end

# No longer true, we are switching to user controlled register based sharing:
# Two registers may share their out0 arrays but not dif0 or vice-versa
# So each symbol should correspond to a unique register, sharing
# optimization can be done at the array level, not the register level.

# "DataType for regram registers."
# type Reg
#     size #::Dims prevents us from using nothing during size inference, TODO; use empty tuple instead, TODO: should we put these into plist?
#     eltype::DataType
#     outtype::DataType
#     diftype::DataType
#     tmptype::DataType
#     Reg()=(r=new();r.plist=Dict();r.saved=false;r)
# end

# # TODO: retire savenet and loadnet, we just need clean.

# function savenet(fname::AbstractString, net::Net; o...)
#     a = Array(Reg, length(net))
#     for i=1:length(net)
#         r = net.reg[i]
#         a[i] = Reg(r.op, r.name, r.args, r.cond, r.argv, r.plist,
#                    ispersistent(r) ? r.out : nothing,
#                    ispersistent(r) ? r.out0 : nothing,
#                    nothing, nothing, nothing)
#     end
#     save(fname, "knetmodel", Net(a); o...)
# end

# loadnet(fname::AbstractString)=load(fname, "knetmodel")

ext: jl


text:
const de3 = Diagonal(ones(3))
const de2 = Diagonal(ones(2))
const dr3 = Diagonal(randn(3))

@test_throws DimensionMismatch MixedModels.downdate!(dr3,de2,de3)
MixedModels.downdate!(dr3,de3,de3)
const sp10 = sprand(10,3,0.2)
const r3 = rand(3,3)
MixedModels.downdate!(rand(3,3),sp10,sp10)
MixedModels.downdate!(rand(3,3),sp10)

max_stars_repo_name: werbac/jlib

max_issues_repo_name: werbac/jlib

max_forks_repo_name: werbac/jlib


text:
using PyPlot
using Polynomials

# Compute PSD for a two-component Lorentzian with
# both complex coefficients.  Check that PSD is positive
# and plot it.

#psd_check(x)
x = rand(8)
# x=[ar1,ai1,br1,bi1,ar2,ai2,br2,bi2]

ar1=x[1]
ai1=x[2]
br1=x[3]
bi1=x[4]
ar2=x[5]
ai2=x[6]
br2=x[7]
bi2=x[8]
# Compute d=0 case 10% of time:
if rand() < 0.1
  bi2 = (ar1*br1+ar2*br2-ai1*bi1)/ai2
end

d = ar1*br1 - ai1*bi1 + ar2*br2 - ai2*bi2

a = (2(br2^2-bi2^2)*(ar1*br1-ai1*bi1)+2(br1^2-bi1^2)*(ar2*br2-ai2*bi2)
 +(bi1^2+br1^2)*(ai1*bi1+ar1*br1)+(bi2^2+br2^2)*(ai2*bi2+ar2*br2))

b = (2(br2^2-bi2^2)*(bi1^2+br1^2)*(ai1*bi1+ar1*br1)
+2(br1^2-bi1^2)*(bi2^2+br2^2)*(ai2*bi2+ar2*br2)
+(bi2^2+br2^2)^2*(ar1*br1-ai1*bi1)
+(bi1^2+br1^2)^2*(ar2*br2-ai2*bi2))

c = ((bi2^2+br2^2)^2*(bi1^2+br1^2)*(ai1*bi1+ar1*br1)
+(bi1^2+br1^2)^2*(bi2^2+br2^2)*(ai2*bi2+ar2*br2))

if abs(d) < eps()
  d = 0.0
  println("Reached quadratic test")
  disc = b^2-4a*c
  if disc < 0
# there is no z_max, so set it to a negative value:
    zmax = -1.0
  else
    if a > 0
      zmax = (-b+sqrt(disc))/(2*a)
    else
      zmax = (-b-sqrt(disc))/(2*a)
    end
  end
else

  a /= d
  b /= d
  c /= d

  delta = 18a*b*c-4a^3*c+a^2*b^2-4b^3-27c^2

  if delta >= 0
    disc = sqrt(a^2-3b)
    theta = acos(0.5*(2a^3-9a*b+27c)/disc^3)
    zmax = -2/3*disc*cos((mod((theta+pi),2pi)+pi)/3)-a/3
  else
    r = (2a^3-9a*b+27c)/54
    q = (a^2-3b)/9
    aa = -(abs(r)+sqrt(r^2-q^3))^(1/3)
    if r < 0
      aa = -aa
    end
    if aa == 0
      bb = 0
    else
      bb = q/aa
    end
    zmax = aa+bb-a/3
  end
end

if zmax < 0
  println("Positive definite spectrum.  Maximum omega^2: ",zmax)
else
  println("Negative spectrum.  Maximum omega^2: ",zmax)
end

omega = linspace(0,20,100000)

psd = sqrt(2/pi)*((omega.^2.*(ar1*br1-ai1*bi1)+(ai1*bi1+ar1*br1)*(bi1^2+br1^2))./(omega.^4+2(br1^2-bi1^2).*omega.^2 + (bi1^2+br1^2)^2)
+(omega.^2.*(ar2*br2-ai2*bi2)+(ai2*bi2+ar2*br2)*(bi2^2+br2^2))./(omega.^4+2(br2^2-bi2^2).*omega.^2 + (bi2^2+br2^2)^2))

fig,axes = subplots(2,1)
ax = axes[1]
ax[:plot](omega,psd)
if zmax > 0
  ax[:scatter](sqrt(zmax),0)
end
# Now plot ACF:

tau = linspace(0,10,100000)
acf = (exp(-br1.*tau).*(ar1.*cos(bi1.*tau)+ai1.*sin(bi1.*tau))
+ exp(-br2.*tau).*(ar2.*cos(bi2.*tau)+ai2.*sin(bi2.*tau)))

ax = axes[2]
ax[:plot](tau,acf)

println(minimum(psd))

# Now, try Sturm's approach:

f0 = Poly([c,b,a,1])
f1 = polyder(f0)
f2 = -rem(f0,f1)
f3 = -rem(f1,f2)
#f4 = -rem(f2,f3)

f_of_0 = [f0(0),f1(0),f2(0),f3(0)]
f_of_inf = [f0[3],f1[2],f2[1],f3[0]]
sig_0 = 0
for i=1:3
  if f_of_0[i+1]*f_of_0[i] < 0
    sig_0 +=1
  end
end
sig_inf = 0
for i=1:3
  if f_of_inf[i+1]*f_of_inf[i] < 0
    sig_inf +=1
  end
end
println("Number of positive roots: ",sig_0-sig_inf)

max_stars_repo_name: dfm/ess

max_issues_repo_name: dfm/ess

max_forks_repo_name: dfm/ess


text:
#unum-continuous.jl
#functions that make continuous testing possible

include("../../unum.jl")
using unum

function continuous_test_on_float(f)
  #runs a continuous test on the function f, which takes a random floating point
  #and outputs a true/false depending on the value.
  while (true)
    #random, normal generation of a floating point.
    value = randn()
    try
      res = f(value)
      if (res == false)
        println("function $f fails for float $res ($(bits(value)))")
        bits(value)
      end
    catch
      println("$value failed on function $f due to thrown error:")
      bt = catch_backtrace()
      s = sprint(io->Base.show_backtrace(io, bt))
      println("$s")
      fails += 1
    end
  end
end

max_stars_repo_name: REX-Computing/unumjl

max_issues_repo_name: REX-Computing/unumjl

max_forks_repo_name: REX-Computing/unumjl


text:
#=
Filename: aiyagari_household.jl
Author: Victoria Gregory
Date: 8/29/2016

This file defines the Household type (and its constructor)
for setting up an Aiyagari household problem.
=#

using QuantEcon

"""
Stores all the parameters that define the household's
problem.

##### Fields

- `r::Float64` : interest rate
- `w::Float64` : wage
- `beta::Float64` : discount factor
- `z_chain::MarkovChain` : MarkovChain for income
- `a_min::Float64` : minimum on asset grid
- `a_max::Float64` : maximum on asset grid
- `a_size::Int64` : number of points on asset grid
- `z_size::Int64` : number of points on income grid
- `n::Int64` : number of points in state space: (a, z)
- `s_vals::Array{Float64}` : stores all the possible (a, z) combinations
- `s_i_vals::Array{Int64}` : stores indices of all the possible (a, z) combinations
- `R::Array{Float64}` : reward array
- `Q::Array{Float64}` : transition probability array
"""
type Household
    r::Float64
    w::Float64
    beta::Float64
    z_chain::MarkovChain{Float64,Array{Float64,2},Array{Float64,1}}
    a_min::Float64
    a_max::Float64
    a_size::Int64
    a_vals::Vector{Float64}
    z_size::Int64
    n::Int64
    s_vals::Array{Float64}
    s_i_vals::Array{Int64}
    R::Array{Float64}
    Q::Array{Float64}
end

"""
Constructor for `Household`

##### Arguments
- `r::Float64(0.01)` : interest rate
- `w::Float64(1.0)` : wage
- `beta::Float64(0.96)` : discount factor
- `z_chain::MarkovChain` : MarkovChain for income
- `a_min::Float64(1e-10)` : minimum on asset grid
- `a_max::Float64(18.0)` : maximum on asset grid
- `a_size::Int64(200)` : number of points on asset grid

"""
function Household(;r::Float64=0.01, w::Float64=1.0, beta::Float64=0.96,
                   z_chain::MarkovChain{Float64,Array{Float64,2},Array{Float64,1}}
                   =MarkovChain([0.9 0.1; 0.1 0.9], [0.1; 1.0]), a_min::Float64=1e-10,
                   a_max::Float64=18.0, a_size::Int64=200)

    # set up grids
    a_vals = linspace(a_min, a_max, a_size)
    z_size = length(z_chain.state_values)
    n = a_size*z_size
    s_vals = gridmake(a_vals, z_chain.state_values)
    s_i_vals = gridmake(1:a_size, 1:z_size)

    # set up Q
    Q = zeros(Float64, n, a_size, n)
    for next_s_i in 1:n
        for a_i in 1:a_size
            for s_i in 1:n
                z_i = s_i_vals[s_i, 2]
                next_z_i = s_i_vals[next_s_i, 2]
                next_a_i = s_i_vals[next_s_i, 1]
                if next_a_i == a_i
                    Q[s_i, a_i, next_s_i] = z_chain.p[z_i, next_z_i]
                end
            end
        end
    end

    # placeholder for R
    R = fill(-Inf, n, a_size)
    h = Household(r, w, beta, z_chain, a_min, a_max, a_size,
                  a_vals, z_size, n, s_vals, s_i_vals, R, Q)

    setup_R!(h, r, w)

    return h

end

"""
Update the reward array of a Household object, given
a new interest rate and wage.

##### Arguments
- `h::Household` : instance of Household type
- `r::Float64(0.01)` : interest rate
- `w::Float64(1.0)` : wage
"""
function setup_R!(h::Household, r::Float64, w::Float64)

    # set up R
    R = h.R
    for new_a_i in 1:h.a_size
        a_new = h.a_vals[new_a_i]
        for s_i in 1:h.n
            a = h.s_vals[s_i, 1]
            z = h.s_vals[s_i, 2]
            c = w * z + (1 + r) * a - a_new
            if c > 0
                R[s_i, new_a_i] = log(c)
            end
        end
    end

    h.r = r
    h.w = w
    h.R = R
    h

end

max_stars_repo_name: mwhchen/quantecon

max_issues_repo_name: mwhchen/quantecon

max_forks_repo_name: mwhchen/quantecon


text:
# This file was generated, do not modify it. # hide
Xhp = DataFrame([hp.^i for i in 1:10])

cases = [[Symbol("x$j") for j in 1:i] for i in 1:10]
r = range(LinMod, :(feature_selector.features), values=cases)

tm = TunedModel(model=LinMod, ranges=r, resampling=CV(nfolds=10), measure=rms)


text:
export Dataset, loaddataset, obsparts, colparts, colpartcols, nobs, ncols, tonumerical, buildtransform,
    transform, invert, shufflesplit, shufflestratifiedsplit

using CSV
using DataFrames
using DataStructures: counter, DefaultDict, OrderedDict
import MLDataUtils: shuffleobs, splitobs, stratifiedobs
import MLDataPattern
import MLDataPattern: nobs, getobs
using Random
using RDatasets

import Base: show

import ..Transforms: tonumerical, ColTrans, toposort, transform, invert, outids
import ..MLGoodies: dview, ncols

deps(path...) = joinpath(@__DIR__, "deps", path...)

"""
    Dataset

`Dataset` encapsulates any data partitioned along both observations (e.g. train, validation, test) and
columns/features (e.g. inputs, targets).

Each column is identified by a `Symbol` and a description can be included.
"""
struct Dataset
    data
    cols::AbstractVector{Symbol}
    desc::AbstractString
    obspartitions::OrderedDict{Symbol,Any}
    colpartitions::OrderedDict{Symbol,Any}
    function Dataset(data, cols, desc, obspartitions, colpartitions)
        op = OrderedDict{Symbol,Any}(obspartitions)
        cp = OrderedDict{Symbol,Any}(colpartitions)
        for (k, v) in cp
            length(v) == 0 && error("empty column partition: $k")
            if  !(Int <: eltype(v))
                idxs =  map(x -> findfirst(e -> e == x, cols), v)
                # @show k, eltype(v), idxs
                if collect(idxs[1]:idxs[end]) == idxs # convert to range if possible
                    idxs = idxs[1]:idxs[end]
                end
                cp[k] = idxs
            end
        end

        new(data, cols, desc, op, cp)
    end
end

"""
    Dataset(data::AbstractDataFrame, desc, obspartitions, colpartitions = nothing)

Create a dataset from `data` described by `desc`. Both `obspartitions` and `colpartitions` must be in
a format convertible to `OrderedDict{Symbol,Any}`. If no `colpartitions` are given, two partitions are created
by default: `:X` which contain all but last column and `:T` containing only the last column.
"""
function Dataset(data::AbstractDataFrame, desc, obspartitions, colpartitions = nothing)
    if isnothing(colpartitions)
        colpartitions = [:X => 1:size(data, 2) - 1, :T => [size(data, 2)]]
    end
    Dataset(data, names(data), desc, obspartitions, colpartitions)
end

"""
    Base.getindex(dataset::Dataset, obspartition = Colon(), colpartition = Colon())

Address the `Dataset` by observation and column partition ids (`Symbol`s). Use `:` to include all partitions.
"""
function Base.getindex(dataset::Dataset, obspartition = Colon(), colpartition = Colon())
    o = obspartition isa Colon ? obspartition : dataset.obspartitions[obspartition]
    c = colpartition isa Colon ? colpartition : dataset.colpartitions[colpartition]
    dview(dataset.data, o, c)
end

"""
    obsparts(d::Dataset)

Return all observation partition ids.
"""
obsparts(d::Dataset) = keys(d.obspartitions)

"""
    colparts(d::Dataset)

Return all column, i.e., feature partition ids.
"""
colparts(d::Dataset) = keys(d.colpartitions)

"""
    colpartcols(d::Dataset, p::Symbol)

Give all column names associated to the the column partition `p`.
"""
colpartcols(d::Dataset, p::Symbol) = d.cols[d.colpartitions[p]]

"""
    MLDataPattern.nobs(d::Dataset, p::Symbol)

Number of observations in partition `p`.
"""
MLDataPattern.nobs(d::Dataset, p::Symbol) = length(d.obspartitions[p])

"""
    MLDataPattern.nobs(d::Dataset)

A sum observation numbers in all partitions.
"""
MLDataPattern.nobs(d::Dataset) = sum(nobs(d, p) for p in obsparts(d))

"""
    MLDataPattern.ncols(d::Dataset, p::Symbol)

Number of columns in partition `p`.
"""
ncols(d::Dataset, p::Symbol) = length(d.colpartitions[p])

"""
    MLDataPattern.ncols(d::Dataset, p::Symbol)

A sum of column numbers in all partitions.
"""
ncols(d::Dataset) = sum(ncols(d, p) for p in colparts(d))

MLDataPattern.nobs(g::GroupedDataFrame{DataFrame}) = length(g)
MLDataPattern.getobs(g::GroupedDataFrame{DataFrame}, r) = g[r]

function Base.show(io::IO, mime::MIME"text/html", d::Dataset)
    write(io, "Observations:
")
    write(io, """

partition	size

""")
    for (k, v) in d.obspartitions
        write(io, """
$(string(k))	$(length(v))
""")
    end
    write(io, """
""")

    write(io, "Columns:
")
    write(io, """

partition	columns

""")
    for (k, v) in d.colpartitions
        cols = join(["$(string(c))	" for c in d.cols[d.colpartitions[k]]])
        write(io, """
$(string(k))	$cols
""")
    end
    write(io, """
""")

    # """

	sex	length	diameter	height	whole_weight	shucked_weight	viscera_weight	shell_weight	rings

	String	Float64	Float64	Float64	Float64	Float64	Float64	Float64	Int64

2 rows × 9 columns

1	M	0.455	0.365	0.095	0.514	0.2245	0.101	0.15	15

2	M	0.35	0.265	0.09	0.2255	0.0995	0.0485	0.07	7

"""
    show(io, mime, d.data)
end

function _load_UCI(uciname, cols, obspartitions, colpartitions; cvsopts...)
    dir = deps(uciname)
    mkpath(dir)
    for fname in ["$uciname.data", "$uciname.names"]
        if !isfile(joinpath(dir, fname))
            download("https://archive.ics.uci.edu/ml/machine-learning-databases/$uciname/$fname", joinpath(dir, fname))
        end
    end
    df = CSV.read(joinpath(dir, "$uciname.data"); header = cols, copycols = true, cvsopts...)
    if obspartitions isa Function
        idxs = obspartitions(df)
        df = df[vcat(last.(idxs)...),:] #TODO make memory efficient
        off = 1
        obs = Pair{Symbol,UnitRange{Int}}[]
        for (p, is) in idxs
            push!(obs,  p => off:off + length(is) - 1)
            off += length(is)
        end
        obspartitions = obs
    end
    desc = read(joinpath(dir, "$uciname.names"), String)
    Dataset(df, desc, obspartitions, colpartitions)
end

"""
    loaddataset(name::Symbol)

Load a dataset identified by the `name`.

Available datasets are: `abalone`, `ecoli`, `housing` and `iris`.
"""
function loaddataset(name::Symbol)
    eval(Symbol("_load_$(string(name))"))()
end

function shufflesplit(df::AbstractDataFrame, obsparts::Vector{Symbol}, fractions; seed = 1)
    Random.seed!(seed)
    Pair.(obsparts, first.(parentindices.(splitobs(shuffleobs(df), fractions))))
end

function shufflestratifiedsplit(f, df::AbstractDataFrame, obsparts::Vector{Symbol}, fractions; seed = 1)
    Random.seed!(seed)
    Pair.(obsparts, first.(parentindices.(stratifiedobs(f, df, fractions))))
end

function _load_abalone()
    cols = [:sex, :length, :diameter, :height, :whole_weight, :shucked_weight, :viscera_weight, :shell_weight, :rings]
    _load_UCI("abalone", cols, df->shufflestratifiedsplit(row->row[:rings], df, [:train, :test], 0.75),
                                    [:X => 1:length(cols) - 1, :T => [length(cols)]])
end

function _load_ecoli()
    cols = [:sequence_name, :mcg, :gvh, :lip, :chg, :aac, :alm1, :alm2, :class]
    targets = [:class]
    _load_UCI("ecoli", cols, df->shufflestratifiedsplit(row->row[:class], df, [:train, :test], 0.5),
            [:X => 1:length(cols) - 1, :T => [length(cols)]];
            delim = " ", ignorerepeated = true)
end

function _load_housing()
    cols = [:crim, :zn, :indus, :chas, :nox, :rm, :age, :dis, :rad, :tax, :ptratio, :b, :lstat, :medv]
    _load_UCI("housing", cols, df->shufflesplit(df, [:train, :test], 0.8), [:X => 1:length(cols) - 1, :T => [length(cols)]];
        delim = " ", ignorerepeated = true)
end

function _load_iris()
    cols = [:sepal_length, :sepal_width,  :petal_length, :petal_width, :class]
    targets = [:class]
    _load_UCI("iris", cols, df->shufflestratifiedsplit(row->row[:class], df, [:train, :test], 0.8),
            [:X => 1:length(cols) - 1, :T => [length(cols)]]; limit = 150)
end

# ----- Transforms --------
# -------------------------

struct DatasetTransform
    trns::OrderedDict{Symbol,ColTrans}
end

"""
    tonumerical(dataset::Dataset,  obspart::Union{Symbol,Colon}, colpartopts::Pair{Symbol,<:AbstractDict}...)

DOCUMENT!
"""
function tonumerical(dataset::Dataset,  obspart::Union{Symbol,Colon}, colpartopts::Pair{Symbol,<:AbstractDict}...)
    #TODO remove use buildtransform instead?
    cpsetup = DefaultDict{Symbol,Any,Any}(Dict(:nominal => nothing, :standardize => true))
    foreach(e->(cpsetup[first(e)] = last(e)), colpartopts)
    DatasetTransform(OrderedDict(cp => tonumerical(dataset[obspart,cp]; cpsetup[cp]...) for cp in colparts(dataset)))
end

function buildtransform(dataset::Dataset, obspart::Union{Symbol,Colon}, colpartfuncs::Pair{Symbol,<:Function}...)
    cpfs = OrderedDict(colpartfuncs)
    DatasetTransform(OrderedDict(cp => cpfs[cp](dataset[obspart,cp]) for cp in keys(cpfs)))
end

function invert(dt::DatasetTransform, dataset::Dataset)
    trns = OrderedDict(cp => invert(trn, ) for (cp, trn) in dt.trns)
end

function _transformhelper(dt::DatasetTransform)
    colpartitions = OrderedDict{Symbol,UnitRange{Int}}()
    cols = Symbol[]
    off = 1
    for cp in keys(dt.trns)
        cnames = outids(dt.trns[cp])
        colpartitions[cp] = off:off + length(cnames) - 1
        off += length(cnames)
        cols = [cols..., cnames...]
    end
    cols, colpartitions
end

function transform(d::Dataset, dt::DatasetTransform, type::Type{<:AbstractDataFrame}; sid = :default)
    data = hcat([transform(dt.trns[col], Dict(sid => d[:,col]), type) for col in keys(dt.trns)]...)
    cols, colpartitions = _transformhelper(dt)
    Dataset(data, d.desc, copy(d.obspartitions), colpartitions)
end

function transform(d::Dataset, dt::DatasetTransform, type::Type{<:Matrix}; sid = :default)
    data = vcat([transform(dt.trns[col], Dict(sid => d[:,col]), type) for col in keys(dt.trns)]...)
    cols, colpartitions = _transformhelper(dt)
    Dataset(data, cols, d.desc, copy(d.obspartitions), colpartitions)
end

Base.getindex(dataset::DatasetTransform, idx) = dataset.trns[idx]

function Base.show(io::IO, dtrn::DatasetTransform)
    for (i, (cp, trn)) in enumerate(dtrn.trns)
        ts = toposort(trn)
        println(io, "Column partition: $cp")
        for e in ts
            println(io, e)
        end
        i < length(dtrn.trns) && println(io)
    end
end

max_stars_repo_name: dhonza/MLGoodies


text:
module MessageRequest

using URIs
import ..Headers
using ..Messages

export messagelayer

"""
    messagelayer(method, ::URI, headers, body) -> HTTP.Response

Construct a [`Request`](@ref) object.
"""
function messagelayer(handler)
    return function(method::String, url::URI, headers::Headers, body; response_stream=nothing, http_version=v"1.1", kw...)
        req = Request(method, resource(url), headers, body; url=url, version=http_version, responsebody=response_stream)
        return handler(req; response_stream=response_stream, kw...)
    end
end

end # module MessageRequest