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

@test integrate(x^4*arccosh(a*x), x) == :(1//5*x^5*arccosh(a*x)+-8//75*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-4//75*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-1//25*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^3*arccosh(a*x), x) == :(-3//32*a^-4*arccosh(a*x)+1//4*x^4*arccosh(a*x)+-3//32*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-1//16*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^2*arccosh(a*x), x) == :(1//3*x^3*arccosh(a*x)+-2//9*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-1//9*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x*arccosh(a*x), x) == :((1/2)*x^2*arccosh(a*x)+-1//4*a^-2*arccosh(a*x)+-1//4*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(arccosh(a*x), x) == :(x*arccosh(a*x)+-1*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^-1*arccosh(a*x), x) == :((1/2)*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))+-1//2*arccosh(a*x)^2+arccosh(a*x)*log(1+exp(2*arccosh(a*x))))
@test integrate(x^-2*arccosh(a*x), x) == :(a*arctan((1+a*x)^(1/2)*(-1+a*x)^(1/2))+-1*x^-1*arccosh(a*x))
@test integrate(x^-3*arccosh(a*x), x) == :(-1//2*x^-2*arccosh(a*x)+(1/2)*a*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^-4*arccosh(a*x), x) == :(-1//3*x^-3*arccosh(a*x)+1//6*a^3*arctan((1+a*x)^(1/2)*(-1+a*x)^(1/2))+1//6*a*x^-2*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^-5*arccosh(a*x), x) == :(-1//4*x^-4*arccosh(a*x)+1//6*a^3*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+1//12*a*x^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^-6*arccosh(a*x), x) == :(-1//5*x^-5*arccosh(a*x)+3//40*a^5*arctan((1+a*x)^(1/2)*(-1+a*x)^(1/2))+1//20*a*x^-4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+3//40*a^3*x^-2*(1+a*x)^(1/2)*(-1+a*x)^(1/2))
@test integrate(x^4*arccosh(a*x)^2, x) == :(2//125*x^5+1//5*x^5*arccosh(a*x)^2+8//225*a^-2*x^3+16//75*x*a^-4+-16//75*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-8//75*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-2//25*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^3*arccosh(a*x)^2, x) == :(1//32*x^4+-3//32*a^-4*arccosh(a*x)^2+1//4*x^4*arccosh(a*x)^2+3//32*a^-2*x^2+-3//16*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-1//8*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^2*arccosh(a*x)^2, x) == :(2//27*x^3+1//3*x^3*arccosh(a*x)^2+4//9*x*a^-2+-4//9*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-2//9*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x*arccosh(a*x)^2, x) == :(1//4*x^2+(1/2)*x^2*arccosh(a*x)^2+-1//4*a^-2*arccosh(a*x)^2+-1//2*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(arccosh(a*x)^2, x) == :(2x+x*arccosh(a*x)^2+-2*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^-1*arccosh(a*x)^2, x) == :(-1//2*Polylogarithms.polylog(3,-1*exp(2*arccosh(a*x)))+-1//3*arccosh(a*x)^3+arccosh(a*x)^2*log(1+exp(2*arccosh(a*x)))+Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))*arccosh(a*x))
@test integrate(x^-2*arccosh(a*x)^2, x) == :(-1*x^-1*arccosh(a*x)^2+-2*im*a*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))+2*im*a*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))+4*a*arccosh(a*x)*arctan(exp(arccosh(a*x))))
@test integrate(x^-3*arccosh(a*x)^2, x) == :(-1*a^2*log(x)+-1//2*x^-2*arccosh(a*x)^2+a*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^-4*arccosh(a*x)^2, x) == :(-1//3*x^-3*arccosh(a*x)^2+1//3*a^2*x^-1+-1//3*im*a^3*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))+1//3*im*a^3*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))+2//3*a^3*arccosh(a*x)*arctan(exp(arccosh(a*x)))+1//3*a*x^-2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^-5*arccosh(a*x)^2, x) == :(-1//3*a^4*log(x)+-1//4*x^-4*arccosh(a*x)^2+1//12*a^2*x^-2+1//3*a^3*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+1//6*a*x^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^4*arccosh(a*x)^3, x) == :(1//5*x^5*arccosh(a*x)^3+6//125*x^5*arccosh(a*x)+-4144//5625*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+8//75*a^-2*x^3*arccosh(a*x)+16//25*x*a^-4*arccosh(a*x)+-272//5625*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-8//25*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2+-6//625*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-4//25*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2+-3//25*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^3*arccosh(a*x)^3, x) == :(-45//256*a^-4*arccosh(a*x)+-3//32*a^-4*arccosh(a*x)^3+1//4*x^4*arccosh(a*x)^3+3//32*x^4*arccosh(a*x)+9//32*a^-2*x^2*arccosh(a*x)+-45//256*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-3//128*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-9//32*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2+-3//16*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^2*arccosh(a*x)^3, x) == :(1//3*x^3*arccosh(a*x)^3+2//9*x^3*arccosh(a*x)+-40//27*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+4//3*x*a^-2*arccosh(a*x)+-2//3*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2+-2//27*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-1//3*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x*arccosh(a*x)^3, x) == :((1/2)*x^2*arccosh(a*x)^3+-3//8*a^-2*arccosh(a*x)+-1//4*a^-2*arccosh(a*x)^3+3//4*x^2*arccosh(a*x)+-3//8*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-3//4*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(arccosh(a*x)^3, x) == :(x*arccosh(a*x)^3+6*x*arccosh(a*x)+-6*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+-3*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^-1*arccosh(a*x)^3, x) == :(-1//4*arccosh(a*x)^4+3//4*Polylogarithms.polylog(4,-1*exp(2*arccosh(a*x)))+arccosh(a*x)^3*log(1+exp(2*arccosh(a*x)))+-3//2*Polylogarithms.polylog(3,-1*exp(2*arccosh(a*x)))*arccosh(a*x)+3//2*arccosh(a*x)^2*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x))))
@test integrate(x^-2*arccosh(a*x)^3, x) == :(-1*x^-1*arccosh(a*x)^3+-6*im*a*Polylogarithms.polylog(3,im*exp(arccosh(a*x)))+6*im*a*Polylogarithms.polylog(3,-1*im*exp(arccosh(a*x)))+6*a*arccosh(a*x)^2*arctan(exp(arccosh(a*x)))+-6*im*a*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))*arccosh(a*x)+6*im*a*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))*arccosh(a*x))
@test integrate(x^-3*arccosh(a*x)^3, x) == :(-3//2*a^2*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))+-1//2*x^-2*arccosh(a*x)^3+3//2*a^2*arccosh(a*x)^2+-3*a^2*arccosh(a*x)*log(1+exp(2*arccosh(a*x)))+3//2*a*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^-4*arccosh(a*x)^3, x) == :(-1*a^3*arctan((1+a*x)^(1/2)*(-1+a*x)^(1/2))+-1//3*x^-3*arccosh(a*x)^3+im*a^3*Polylogarithms.polylog(3,-1*im*exp(arccosh(a*x)))+a^2*x^-1*arccosh(a*x)+a^3*arccosh(a*x)^2*arctan(exp(arccosh(a*x)))+-1*im*a^3*Polylogarithms.polylog(3,im*exp(arccosh(a*x)))+im*a^3*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))*arccosh(a*x)+-1*im*a^3*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))*arccosh(a*x)+(1/2)*a*x^-2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^-5*arccosh(a*x)^3, x) == :((1/2)*a^4*arccosh(a*x)^2+-1//2*a^4*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))+-1//4*x^-4*arccosh(a*x)^3+-1*a^4*arccosh(a*x)*log(1+exp(2*arccosh(a*x)))+1//4*a^2*x^-2*arccosh(a*x)+-1//4*a^3*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)+(1/2)*a^3*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2+1//4*a*x^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^2)
@test integrate(x^5*arccosh(a*x)^4, x) == :(1//324*x^6+-245//1152*a^-6*arccosh(a*x)^2+-5//96*a^-6*arccosh(a*x)^4+1//6*x^6*arccosh(a*x)^4+1//18*x^6*arccosh(a*x)^2+65//3456*a^-2*x^4+245//1152*a^-4*x^2+5//16*a^-4*x^2*arccosh(a*x)^2+5//48*a^-2*x^4*arccosh(a*x)^2+-245//576*x*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-65//864*a^-3*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-5//24*x*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-5//36*a^-3*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-1//9*a^-1*x^5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-1//54*a^-1*x^5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(x^4*arccosh(a*x)^4, x) == :(24//3125*x^5+1//5*x^5*arccosh(a*x)^4+12//125*x^5*arccosh(a*x)^2+1088//16875*a^-2*x^3+16576//5625*x*a^-4+16//75*a^-2*x^3*arccosh(a*x)^2+32//25*x*a^-4*arccosh(a*x)^2+-16576//5625*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-32//75*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-1088//5625*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-24//625*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-16//75*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-4//25*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x^3*arccosh(a*x)^4, x) == :(3//128*x^4+-45//128*a^-4*arccosh(a*x)^2+-3//32*a^-4*arccosh(a*x)^4+1//4*x^4*arccosh(a*x)^4+3//16*x^4*arccosh(a*x)^2+45//128*a^-2*x^2+9//16*a^-2*x^2*arccosh(a*x)^2+-45//64*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-3//8*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-3//32*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-1//4*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x^2*arccosh(a*x)^4, x) == :(8//81*x^3+1//3*x^3*arccosh(a*x)^4+4//9*x^3*arccosh(a*x)^2+160//27*x*a^-2+8//3*x*a^-2*arccosh(a*x)^2+-160//27*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-8//9*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-8//27*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-4//9*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x*arccosh(a*x)^4, x) == :(3//4*x^2+(1/2)*x^2*arccosh(a*x)^4+-3//4*a^-2*arccosh(a*x)^2+-1//4*a^-2*arccosh(a*x)^4+3//2*x^2*arccosh(a*x)^2+-1*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3+-3//2*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x))
@test integrate(arccosh(a*x)^4, x) == :(24x+x*arccosh(a*x)^4+12*x*arccosh(a*x)^2+-24*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)+-4*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x^-1*arccosh(a*x)^4, x) == :(-3//2*Polylogarithms.polylog(5,-1*exp(2*arccosh(a*x)))+-1//5*arccosh(a*x)^5+arccosh(a*x)^4*log(1+exp(2*arccosh(a*x)))+-3*arccosh(a*x)^2*Polylogarithms.polylog(3,-1*exp(2*arccosh(a*x)))+2*arccosh(a*x)^3*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))+3*Polylogarithms.polylog(4,-1*exp(2*arccosh(a*x)))*arccosh(a*x))
@test integrate(x^-2*arccosh(a*x)^4, x) == :(-1*x^-1*arccosh(a*x)^4+-24*im*a*Polylogarithms.polylog(4,-1*im*exp(arccosh(a*x)))+8*a*arccosh(a*x)^3*arctan(exp(arccosh(a*x)))+24*im*a*Polylogarithms.polylog(4,im*exp(arccosh(a*x)))+-24*im*a*Polylogarithms.polylog(3,im*exp(arccosh(a*x)))*arccosh(a*x)+-12*im*a*arccosh(a*x)^2*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))+12*im*a*arccosh(a*x)^2*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))+24*im*a*Polylogarithms.polylog(3,-1*im*exp(arccosh(a*x)))*arccosh(a*x))
@test integrate(x^-3*arccosh(a*x)^4, x) == :(2*a^2*arccosh(a*x)^3+3*a^2*Polylogarithms.polylog(3,-1*exp(2*arccosh(a*x)))+-1//2*x^-2*arccosh(a*x)^4+-6*a^2*arccosh(a*x)^2*log(1+exp(2*arccosh(a*x)))+-6*a^2*Polylogarithms.polylog(2,-1*exp(2*arccosh(a*x)))*arccosh(a*x)+2*a*x^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x^-4*arccosh(a*x)^4, x) == :(-1//3*x^-3*arccosh(a*x)^4+-8*a^3*arccosh(a*x)*arctan(exp(arccosh(a*x)))+-4*im*a^3*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))+-4*im*a^3*Polylogarithms.polylog(4,-1*im*exp(arccosh(a*x)))+2*a^2*x^-1*arccosh(a*x)^2+4*im*a^3*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))+4*im*a^3*Polylogarithms.polylog(4,im*exp(arccosh(a*x)))+4//3*a^3*arccosh(a*x)^3*arctan(exp(arccosh(a*x)))+-4*im*a^3*Polylogarithms.polylog(3,im*exp(arccosh(a*x)))*arccosh(a*x)+-2*im*a^3*arccosh(a*x)^2*Polylogarithms.polylog(2,-1*im*exp(arccosh(a*x)))+2*im*a^3*arccosh(a*x)^2*Polylogarithms.polylog(2,im*exp(arccosh(a*x)))+4*im*a^3*Polylogarithms.polylog(3,-1*im*exp(arccosh(a*x)))*arccosh(a*x)+2//3*a*x^-2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3)
@test integrate(x^6*arccosh(a*x)^-1, x) == :(1//64*a^-7*sinhintegral(7*arccosh(a*x))+5//64*a^-7*sinhintegral(5*arccosh(a*x))+5//64*a^-7*sinhintegral(arccosh(a*x))+9//64*a^-7*sinhintegral(3*arccosh(a*x)))
@test integrate(x^5*arccosh(a*x)^-1, x) == :(1//8*a^-6*sinhintegral(4*arccosh(a*x))+1//32*a^-6*sinhintegral(6*arccosh(a*x))+5//32*a^-6*sinhintegral(2*arccosh(a*x)))
@test integrate(x^4*arccosh(a*x)^-1, x) == :(1//8*a^-5*sinhintegral(arccosh(a*x))+1//16*a^-5*sinhintegral(5*arccosh(a*x))+3//16*a^-5*sinhintegral(3*arccosh(a*x)))
@test integrate(x^3*arccosh(a*x)^-1, x) == :(1//4*a^-4*sinhintegral(2*arccosh(a*x))+1//8*a^-4*sinhintegral(4*arccosh(a*x)))
@test integrate(x^2*arccosh(a*x)^-1, x) == :(1//4*a^-3*sinhintegral(3*arccosh(a*x))+1//4*a^-3*sinhintegral(arccosh(a*x)))
@test integrate(x*arccosh(a*x)^-1, x) == :((1/2)*a^-2*sinhintegral(2*arccosh(a*x)))
@test integrate(arccosh(a*x)^-1, x) == :(a^-1*sinhintegral(arccosh(a*x)))
@test integrate(x^4*arccosh(a*x)^-2, x) == :(1//8*a^-5*coshintegral(arccosh(a*x))+5//16*a^-5*coshintegral(5*arccosh(a*x))+9//16*a^-5*coshintegral(3*arccosh(a*x))+-1*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(x^3*arccosh(a*x)^-2, x) == :((1/2)*a^-4*coshintegral(2*arccosh(a*x))+(1/2)*a^-4*coshintegral(4*arccosh(a*x))+-1*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(x^2*arccosh(a*x)^-2, x) == :(1//4*a^-3*coshintegral(arccosh(a*x))+3//4*a^-3*coshintegral(3*arccosh(a*x))+-1*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(x*arccosh(a*x)^-2, x) == :(a^-2*coshintegral(2*arccosh(a*x))+-1*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(arccosh(a*x)^-2, x) == :(a^-1*coshintegral(arccosh(a*x))+-1*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(x^4*arccosh(a*x)^-3, x) == :(-5//2*x^5*arccosh(a*x)^-1+1//16*a^-5*sinhintegral(arccosh(a*x))+25//32*a^-5*sinhintegral(5*arccosh(a*x))+27//32*a^-5*sinhintegral(3*arccosh(a*x))+2*a^-2*x^3*arccosh(a*x)^-1+-1//2*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-2)
@test integrate(x^3*arccosh(a*x)^-3, x) == :(a^-4*sinhintegral(4*arccosh(a*x))+(1/2)*a^-4*sinhintegral(2*arccosh(a*x))+-2*x^4*arccosh(a*x)^-1+3//2*a^-2*x^2*arccosh(a*x)^-1+-1//2*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-2)
@test integrate(x^2*arccosh(a*x)^-3, x) == :(-3//2*x^3*arccosh(a*x)^-1+1//8*a^-3*sinhintegral(arccosh(a*x))+9//8*a^-3*sinhintegral(3*arccosh(a*x))+x*a^-2*arccosh(a*x)^-1+-1//2*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-2)
@test integrate(x*arccosh(a*x)^-3, x) == :(a^-2*sinhintegral(2*arccosh(a*x))+(1/2)*a^-2*arccosh(a*x)^-1+-1*x^2*arccosh(a*x)^-1+-1//2*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-2)
@test integrate(arccosh(a*x)^-3, x) == :((1/2)*a^-1*sinhintegral(arccosh(a*x))+-1//2*x*arccosh(a*x)^-1+-1//2*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-2)
@test integrate(x^4*arccosh(a*x)^-4, x) == :(-5//6*x^5*arccosh(a*x)^-2+1//48*a^-5*coshintegral(arccosh(a*x))+27//32*a^-5*coshintegral(3*arccosh(a*x))+125//96*a^-5*coshintegral(5*arccosh(a*x))+2//3*a^-2*x^3*arccosh(a*x)^-2+2*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-25//6*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-1//3*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3)
@test integrate(x^3*arccosh(a*x)^-4, x) == :(-2//3*x^4*arccosh(a*x)^-2+1//3*a^-4*coshintegral(2*arccosh(a*x))+4//3*a^-4*coshintegral(4*arccosh(a*x))+(1/2)*a^-2*x^2*arccosh(a*x)^-2+x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-8//3*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-1//3*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3)
@test integrate(x^2*arccosh(a*x)^-4, x) == :(-1//2*x^3*arccosh(a*x)^-2+1//24*a^-3*coshintegral(arccosh(a*x))+9//8*a^-3*coshintegral(3*arccosh(a*x))+1//3*x*a^-2*arccosh(a*x)^-2+1//3*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-3//2*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-1//3*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3)
@test integrate(x*arccosh(a*x)^-4, x) == :(-1//3*x^2*arccosh(a*x)^-2+1//6*a^-2*arccosh(a*x)^-2+2//3*a^-2*coshintegral(2*arccosh(a*x))+-2//3*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1+-1//3*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3)
@test integrate(arccosh(a*x)^-4, x) == :(-1//6*x*arccosh(a*x)^-2+1//6*a^-1*coshintegral(arccosh(a*x))+-1//3*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3+-1//6*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1)
@test integrate(x^4*arccosh(a*x)^(1/2), x) == :(1//5*x^5*arccosh(a*x)^(1/2)+-1//32*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+-1//32*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+-1//192*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+-1//192*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-1//1600*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+-1//1600*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x^3*arccosh(a*x)^(1/2), x) == :(-3//32*a^-4*arccosh(a*x)^(1/2)+1//4*x^4*arccosh(a*x)^(1/2)+-1//256*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+-1//256*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+-1//64*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+-1//64*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x^2*arccosh(a*x)^(1/2), x) == :(1//3*x^3*arccosh(a*x)^(1/2)+-1//16*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+-1//16*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+-1//144*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+-1//144*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x*arccosh(a*x)^(1/2), x) == :((1/2)*x^2*arccosh(a*x)^(1/2)+-1//4*a^-2*arccosh(a*x)^(1/2)+-1//32*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+-1//32*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(arccosh(a*x)^(1/2), x) == :(x*arccosh(a*x)^(1/2)+-1//4*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+-1//4*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2)))
@test integrate(x^4*arccosh(a*x)^3//2, x) == :(1//5*x^5*arccosh(a*x)^3//2+-3//64*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+3//64*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+-4//25*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2)+-3//16000*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+-1//384*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+1//384*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+3//16000*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2))+-3//50*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2)+-2//25*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2))
@test integrate(x^3*arccosh(a*x)^3//2, x) == :(-3//32*a^-4*arccosh(a*x)^3//2+1//4*x^4*arccosh(a*x)^3//2+-3//2048*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+3//2048*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+-3//256*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+3//256*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-9//64*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2)+-3//32*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2))
@test integrate(x^2*arccosh(a*x)^3//2, x) == :(1//3*x^3*arccosh(a*x)^3//2+-3//32*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+3//32*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+-1//3*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2)+-1//288*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+1//288*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-1//6*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2))
@test integrate(x*arccosh(a*x)^3//2, x) == :((1/2)*x^2*arccosh(a*x)^3//2+-1//4*a^-2*arccosh(a*x)^3//2+-3//128*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+3//128*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-3//8*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2))
@test integrate(arccosh(a*x)^3//2, x) == :(x*arccosh(a*x)^3//2+-3//8*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+3//8*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-3//2*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^(1/2))
@test integrate(x^4*arccosh(a*x)^5//2, x) == :(1//5*x^5*arccosh(a*x)^5//2+3//100*x^5*arccosh(a*x)^(1/2)+-15//128*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+-15//128*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+1//15*a^-2*x^3*arccosh(a*x)^(1/2)+2//5*x*a^-4*arccosh(a*x)^(1/2)+-5//2304*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+-5//2304*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-4//15*a^-5*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2+-3//32000*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+-3//32000*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2))+-2//15*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2+-1//10*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2)
@test integrate(x^3*arccosh(a*x)^5//2, x) == :(-225//2048*a^-4*arccosh(a*x)^(1/2)+-3//32*a^-4*arccosh(a*x)^5//2+1//4*x^4*arccosh(a*x)^5//2+15//256*x^4*arccosh(a*x)^(1/2)+-15//16384*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+-15//16384*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+45//256*a^-2*x^2*arccosh(a*x)^(1/2)+-15//1024*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+-15//1024*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-15//64*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2+-5//32*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2)
@test integrate(x^2*arccosh(a*x)^5//2, x) == :(1//3*x^3*arccosh(a*x)^5//2+5//36*x^3*arccosh(a*x)^(1/2)+-15//64*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+-15//64*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+5//6*x*a^-2*arccosh(a*x)^(1/2)+-5//9*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2+-5//1728*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+-5//1728*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-5//18*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2)
@test integrate(x*arccosh(a*x)^5//2, x) == :((1/2)*x^2*arccosh(a*x)^5//2+-15//64*a^-2*arccosh(a*x)^(1/2)+-1//4*a^-2*arccosh(a*x)^5//2+15//32*x^2*arccosh(a*x)^(1/2)+-15//512*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+-15//512*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-5//8*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2)
@test integrate(arccosh(a*x)^5//2, x) == :(x*arccosh(a*x)^5//2+15//4*x*arccosh(a*x)^(1/2)+-15//16*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+-15//16*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-5//2*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^3//2)
@test integrate(x^4*arccosh(a*x)^-1//2, x) == :(-1//16*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+1//16*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+-1//32*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+-1//160*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+1//32*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+1//160*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x^3*arccosh(a*x)^-1//2, x) == :(-1//32*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+1//32*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+-1//16*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+1//16*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x^2*arccosh(a*x)^-1//2, x) == :(-1//8*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+1//8*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+-1//24*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+1//24*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(x*arccosh(a*x)^-1//2, x) == :(-1//8*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+1//8*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2)))
@test integrate(arccosh(a*x)^-1//2, x) == :((1/2)*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-1//2*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2)))
@test integrate(x^4*arccosh(a*x)^-3//2, x) == :(1//8*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+1//8*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+1//16*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+1//16*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2))+3//16*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+3//16*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-2*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x^3*arccosh(a*x)^-3//2, x) == :(1//4*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+1//4*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+1//4*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+1//4*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-2*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x^2*arccosh(a*x)^-3//2, x) == :(1//4*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+1//4*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+1//4*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+1//4*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-2*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x*arccosh(a*x)^-3//2, x) == :((1/2)*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+(1/2)*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-2*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(arccosh(a*x)^-3//2, x) == :(pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-2*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x^4*arccosh(a*x)^-5//2, x) == :(-20//3*x^5*arccosh(a*x)^-1//2+-1//12*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+1//12*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+16//3*a^-2*x^3*arccosh(a*x)^-1//2+-5//24*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+-3//8*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+3//8*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+5//24*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2))+-2//3*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3//2)
@test integrate(x^3*arccosh(a*x)^-5//2, x) == :(-16//3*x^4*arccosh(a*x)^-1//2+4*a^-2*x^2*arccosh(a*x)^-1//2+-2//3*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+2//3*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+-1//3*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+1//3*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-2//3*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3//2)
@test integrate(x^2*arccosh(a*x)^-5//2, x) == :(-4*x^3*arccosh(a*x)^-1//2+-1//6*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+1//6*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+8//3*x*a^-2*arccosh(a*x)^-1//2+(1/2)*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-1//2*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+-2//3*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3//2)
@test integrate(x*arccosh(a*x)^-5//2, x) == :(-8//3*x^2*arccosh(a*x)^-1//2+4//3*a^-2*arccosh(a*x)^-1//2+-2//3*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+2//3*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-2//3*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3//2)
@test integrate(arccosh(a*x)^-5//2, x) == :(-4//3*x*arccosh(a*x)^-1//2+-2//3*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+2//3*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-2//3*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-3//2)
@test integrate(x^4*arccosh(a*x)^-7//2, x) == :(-4//3*x^5*arccosh(a*x)^-3//2+1//30*pi^(1/2)*a^-5*erf(arccosh(a*x)^(1/2))+1//30*pi^(1/2)*a^-5*erfi(arccosh(a*x)^(1/2))+16//15*a^-2*x^3*arccosh(a*x)^-3//2+5//12*5^(1/2)*pi^(1/2)*a^-5*erf(5^(1/2)*arccosh(a*x)^(1/2))+5//12*5^(1/2)*pi^(1/2)*a^-5*erfi(5^(1/2)*arccosh(a*x)^(1/2))+9//20*3^(1/2)*pi^(1/2)*a^-5*erf(3^(1/2)*arccosh(a*x)^(1/2))+9//20*3^(1/2)*pi^(1/2)*a^-5*erfi(3^(1/2)*arccosh(a*x)^(1/2))+-40//3*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-2//5*a^-1*x^4*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-5//2+32//5*a^-3*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x^3*arccosh(a*x)^-7//2, x) == :(-16//15*x^4*arccosh(a*x)^-3//2+4//5*a^-2*x^2*arccosh(a*x)^-3//2+16//15*pi^(1/2)*a^-4*erf(2*arccosh(a*x)^(1/2))+16//15*pi^(1/2)*a^-4*erfi(2*arccosh(a*x)^(1/2))+4//15*2^(1/2)*pi^(1/2)*a^-4*erf(2^(1/2)*arccosh(a*x)^(1/2))+4//15*2^(1/2)*pi^(1/2)*a^-4*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-128//15*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-2//5*a^-1*x^3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-5//2+16//5*x*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2)
@test integrate(x^2*arccosh(a*x)^-7//2, x) == :(-4//5*x^3*arccosh(a*x)^-3//2+1//15*pi^(1/2)*a^-3*erf(arccosh(a*x)^(1/2))+1//15*pi^(1/2)*a^-3*erfi(arccosh(a*x)^(1/2))+8//15*x*a^-2*arccosh(a*x)^-3//2+3//5*3^(1/2)*pi^(1/2)*a^-3*erf(3^(1/2)*arccosh(a*x)^(1/2))+3//5*3^(1/2)*pi^(1/2)*a^-3*erfi(3^(1/2)*arccosh(a*x)^(1/2))+16//15*a^-3*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-24//5*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-2//5*a^-1*x^2*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-5//2)
@test integrate(x*arccosh(a*x)^-7//2, x) == :(-8//15*x^2*arccosh(a*x)^-3//2+4//15*a^-2*arccosh(a*x)^-3//2+8//15*2^(1/2)*pi^(1/2)*a^-2*erf(2^(1/2)*arccosh(a*x)^(1/2))+8//15*2^(1/2)*pi^(1/2)*a^-2*erfi(2^(1/2)*arccosh(a*x)^(1/2))+-32//15*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-2//5*x*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-5//2)
@test integrate(arccosh(a*x)^-7//2, x) == :(-4//15*x*arccosh(a*x)^-3//2+4//15*pi^(1/2)*a^-1*erf(arccosh(a*x)^(1/2))+4//15*pi^(1/2)*a^-1*erfi(arccosh(a*x)^(1/2))+-8//15*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-1//2+-2//5*a^-1*(1+a*x)^(1/2)*(-1+a*x)^(1/2)*arccosh(a*x)^-5//2)
@test integrate(x^4*arccosh(a*x)^n, x) == :(1//16*a^-5*SpecialFunctions.gamma(1+n,arccosh(a*x))+1//32*3^(-1n)*a^-5*SpecialFunctions.gamma(1+n,3*arccosh(a*x))+1//32*5^(-1+-1n)*a^-5*SpecialFunctions.gamma(1+n,5*arccosh(a*x))+1//16*a^-5*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-1*arccosh(a*x))+1//32*3^(-1n)*a^-5*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-3*arccosh(a*x))+1//32*5^(-1+-1n)*a^-5*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-5*arccosh(a*x)))
@test integrate(x^3*arccosh(a*x)^n, x) == :(2^(-6+-2n)*a^-4*SpecialFunctions.gamma(1+n,4*arccosh(a*x))+2^(-4+-1n)*a^-4*SpecialFunctions.gamma(1+n,2*arccosh(a*x))+2^(-6+-2n)*a^-4*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-4*arccosh(a*x))+2^(-4+-1n)*a^-4*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-2*arccosh(a*x)))
@test integrate(x^2*arccosh(a*x)^n, x) == :(1//8*a^-3*SpecialFunctions.gamma(1+n,arccosh(a*x))+1//8*3^(-1+-1n)*a^-3*SpecialFunctions.gamma(1+n,3*arccosh(a*x))+1//8*a^-3*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-1*arccosh(a*x))+1//8*3^(-1+-1n)*a^-3*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-3*arccosh(a*x)))
@test integrate(x*arccosh(a*x)^n, x) == :(2^(-3+-1n)*a^-2*SpecialFunctions.gamma(1+n,2*arccosh(a*x))+2^(-3+-1n)*a^-2*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-2*arccosh(a*x)))
@test integrate(arccosh(a*x)^n, x) == :((1/2)*a^-1*SpecialFunctions.gamma(1+n,arccosh(a*x))+(1/2)*a^-1*(-1*arccosh(a*x))^(-1n)*arccosh(a*x)^n*SpecialFunctions.gamma(1+n,-1*arccosh(a*x)))
@test integrate(x^3*(a+b*arccosh(c*x)), x) == :(1//4*x^4*(a+b*arccosh(c*x))+-3//32*b*c^-4*arccosh(c*x)+-3//32*b*x*c^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2)+-1//16*b*c^-1*x^3*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x^2*(a+b*arccosh(c*x)), x) == :(1//3*x^3*(a+b*arccosh(c*x))+-2//9*b*c^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2)+-1//9*b*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x*(a+b*arccosh(c*x)), x) == :((1/2)*x^2*(a+b*arccosh(c*x))+-1//4*b*c^-2*arccosh(c*x)+-1//4*b*x*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(a+b*arccosh(c*x), x) == :(a*x+b*x*arccosh(c*x)+-1*b*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x^-1*(a+b*arccosh(c*x)), x) == :((a+b*arccosh(c*x))*log(1+exp(2*arccosh(c*x)))+(1/2)*b*Polylogarithms.polylog(2,-1*exp(2*arccosh(c*x)))+-1//2*b^-1*(a+b*arccosh(c*x))^2)
@test integrate(x^-2*(a+b*arccosh(c*x)), x) == :(-1*x^-1*(a+b*arccosh(c*x))+b*c*arctan((1+c*x)^(1/2)*(-1+c*x)^(1/2)))
@test integrate(x^-3*(a+b*arccosh(c*x)), x) == :(-1//2*x^-2*(a+b*arccosh(c*x))+(1/2)*b*c*x^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x^-4*(a+b*arccosh(c*x)), x) == :(-1//3*x^-3*(a+b*arccosh(c*x))+1//6*b*c^3*arctan((1+c*x)^(1/2)*(-1+c*x)^(1/2))+1//6*b*c*x^-2*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x^-5*(a+b*arccosh(c*x)), x) == :(-1//4*x^-4*(a+b*arccosh(c*x))+1//6*b*c^3*x^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)+1//12*b*c*x^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2))
@test integrate(x^2*(a+b*arccosh(c*x))^(1/2), x) == :(1//3*x^3*(a+b*arccosh(c*x))^(1/2)+-1//16*pi^(1/2)*b^(1/2)*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-1//16*pi^(1/2)*b^(1/2)*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-1//144*3^(1/2)*pi^(1/2)*b^(1/2)*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+-1//144*3^(1/2)*pi^(1/2)*b^(1/2)*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^(1/2), x) == :((1/2)*x^2*(a+b*arccosh(c*x))^(1/2)+-1//4*c^-2*(a+b*arccosh(c*x))^(1/2)+-1//32*2^(1/2)*pi^(1/2)*b^(1/2)*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+-1//32*2^(1/2)*pi^(1/2)*b^(1/2)*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1))
@test integrate((a+b*arccosh(c*x))^(1/2), x) == :(x*(a+b*arccosh(c*x))^(1/2)+-1//4*pi^(1/2)*b^(1/2)*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-1//4*pi^(1/2)*b^(1/2)*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1))
@test integrate(x^2*(a+b*arccosh(c*x))^3//2, x) == :(1//3*x^3*(a+b*arccosh(c*x))^3//2+-3//32*pi^(1/2)*b^3//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-1//3*b*c^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^(1/2)+3//32*pi^(1/2)*b^3//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-1//6*b*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^(1/2)+-1//288*3^(1/2)*pi^(1/2)*b^3//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+1//288*3^(1/2)*pi^(1/2)*b^3//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^3//2, x) == :((1/2)*x^2*(a+b*arccosh(c*x))^3//2+-1//4*c^-2*(a+b*arccosh(c*x))^3//2+-3//8*b*x*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^(1/2)+-3//128*2^(1/2)*pi^(1/2)*b^3//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+3//128*2^(1/2)*pi^(1/2)*b^3//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1))
@test integrate((a+b*arccosh(c*x))^3//2, x) == :(x*(a+b*arccosh(c*x))^3//2+-3//2*b*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^(1/2)+-3//8*pi^(1/2)*b^3//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+3//8*pi^(1/2)*b^3//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1))
@test integrate(x^2*(a+b*arccosh(c*x))^5//2, x) == :(1//3*x^3*(a+b*arccosh(c*x))^5//2+5//36*b^2*x^3*(a+b*arccosh(c*x))^(1/2)+5//6*x*b^2*c^-2*(a+b*arccosh(c*x))^(1/2)+-15//64*pi^(1/2)*b^5//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-15//64*pi^(1/2)*b^5//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-5//9*b*c^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^3//2+-5//18*b*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^3//2+-5//1728*3^(1/2)*pi^(1/2)*b^5//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+-5//1728*3^(1/2)*pi^(1/2)*b^5//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^5//2, x) == :((1/2)*x^2*(a+b*arccosh(c*x))^5//2+-1//4*c^-2*(a+b*arccosh(c*x))^5//2+-15//64*b^2*c^-2*(a+b*arccosh(c*x))^(1/2)+15//32*b^2*x^2*(a+b*arccosh(c*x))^(1/2)+-15//512*2^(1/2)*pi^(1/2)*b^5//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+-15//512*2^(1/2)*pi^(1/2)*b^5//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1)+-5//8*b*x*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^3//2)
@test integrate((a+b*arccosh(c*x))^5//2, x) == :(x*(a+b*arccosh(c*x))^5//2+15//4*x*b^2*(a+b*arccosh(c*x))^(1/2)+-15//16*pi^(1/2)*b^5//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-15//16*pi^(1/2)*b^5//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-5//2*b*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^3//2)
@test integrate(x^2*(a+b*arccosh(c*x))^-1//2, x) == :(-1//8*pi^(1/2)*b^-1//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+1//8*pi^(1/2)*b^-1//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-1//24*3^(1/2)*pi^(1/2)*b^-1//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+1//24*3^(1/2)*pi^(1/2)*b^-1//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^-1//2, x) == :(-1//8*2^(1/2)*pi^(1/2)*b^-1//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+1//8*2^(1/2)*pi^(1/2)*b^-1//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1))
@test integrate((a+b*arccosh(c*x))^-1//2, x) == :((1/2)*pi^(1/2)*b^-1//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-1//2*pi^(1/2)*b^-1//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1))
@test integrate(x^2*(a+b*arccosh(c*x))^-3//2, x) == :(1//4*pi^(1/2)*b^-3//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+1//4*pi^(1/2)*b^-3//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-2*b^-1*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2+1//4*3^(1/2)*pi^(1/2)*b^-3//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+1//4*3^(1/2)*pi^(1/2)*b^-3//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^-3//2, x) == :((1/2)*2^(1/2)*pi^(1/2)*b^-3//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+(1/2)*2^(1/2)*pi^(1/2)*b^-3//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1)+-2*x*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2)
@test integrate((a+b*arccosh(c*x))^-3//2, x) == :(pi^(1/2)*b^-3//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+pi^(1/2)*b^-3//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+-2*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2)
@test integrate(x^2*(a+b*arccosh(c*x))^-5//2, x) == :(-4*b^-2*x^3*(a+b*arccosh(c*x))^-1//2+8//3*x*b^-2*c^-2*(a+b*arccosh(c*x))^-1//2+-1//6*pi^(1/2)*b^-5//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+1//6*pi^(1/2)*b^-5//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+(1/2)*3^(1/2)*pi^(1/2)*b^-5//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1)+-2//3*b^-1*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-3//2+-1//2*3^(1/2)*pi^(1/2)*b^-5//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^-5//2, x) == :(-8//3*b^-2*x^2*(a+b*arccosh(c*x))^-1//2+4//3*b^-2*c^-2*(a+b*arccosh(c*x))^-1//2+-2//3*x*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-3//2+-2//3*2^(1/2)*pi^(1/2)*b^-5//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+2//3*2^(1/2)*pi^(1/2)*b^-5//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1))
@test integrate((a+b*arccosh(c*x))^-5//2, x) == :(-4//3*x*b^-2*(a+b*arccosh(c*x))^-1//2+-2//3*pi^(1/2)*b^-5//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+-2//3*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-3//2+2//3*pi^(1/2)*b^-5//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1))
@test integrate(x^2*(a+b*arccosh(c*x))^-7//2, x) == :(-4//5*b^-2*x^3*(a+b*arccosh(c*x))^-3//2+8//15*x*b^-2*c^-2*(a+b*arccosh(c*x))^-3//2+1//15*pi^(1/2)*b^-7//2*c^-3*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+1//15*pi^(1/2)*b^-7//2*c^-3*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1)+16//15*b^-3*c^-3*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2+-24//5*b^-3*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2+-2//5*b^-1*c^-1*x^2*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-5//2+3//5*3^(1/2)*pi^(1/2)*b^-7//2*c^-3*erf(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(3*a*b^-1)+3//5*3^(1/2)*pi^(1/2)*b^-7//2*c^-3*erfi(3^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-3*a*b^-1))
@test integrate(x*(a+b*arccosh(c*x))^-7//2, x) == :(-8//15*b^-2*x^2*(a+b*arccosh(c*x))^-3//2+4//15*b^-2*c^-2*(a+b*arccosh(c*x))^-3//2+-32//15*x*b^-3*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2+-2//5*x*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-5//2+8//15*2^(1/2)*pi^(1/2)*b^-7//2*c^-2*erf(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(2*a*b^-1)+8//15*2^(1/2)*pi^(1/2)*b^-7//2*c^-2*erfi(2^(1/2)*b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-2*a*b^-1))
@test integrate((a+b*arccosh(c*x))^-7//2, x) == :(-4//15*x*b^-2*(a+b*arccosh(c*x))^-3//2+-8//15*b^-3*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-1//2+-2//5*b^-1*c^-1*(1+c*x)^(1/2)*(-1+c*x)^(1/2)*(a+b*arccosh(c*x))^-5//2+4//15*pi^(1/2)*b^-7//2*c^-1*erf(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(a*b^-1)+4//15*pi^(1/2)*b^-7//2*c^-1*erfi(b^-1//2*(a+b*arccosh(c*x))^(1/2))*exp(-1*a*b^-1))

max_stars_repo_path: test/7 Inverse hyperbolic functions/7.2 Inverse hyperbolic cosine/7.2.2 (d x)^m (a+b arccosh(c x))^n.jl


text:
# Defining new Python types from Julia (ugly simulation of C headers)

################################################################
# Python expects the PyMethodDef and similar strings to be constants,
# so we define anonymous globals to hold them, returning the pointer
const prevent_gc = Any[]
function gstring_ptr(name::AbstractString, s::AbstractString)
    g = bytestring(s)
    push!(prevent_gc, g)
    unsafe_convert(Ptr{UInt8}, g)
end

################################################################
# mirror of Python API types and constants from methodobject.h

immutable PyMethodDef
    ml_name::Ptr{UInt8}
    ml_meth::Ptr{Void}
    ml_flags::Cint
    ml_doc::Ptr{UInt8} # may be NULL
end

# A PyCFunction is a C function of the form
#     PyObject *func(PyObject *self, PyObject *args)
# or
#     PyObject *func(PyObject *self, PyObject *args, PyObject *kwargs)
# The first parameter is the "self" function for method, or
# for module functions it is the module object.  The second
# parameter is either a tuple of args (for METH_VARARGS),
# a single arg (for METH_O), or NULL (for METH_NOARGS).  func
# must return non-NULL (Py_None is okay) unless there was an
# error, in which case an exception must have been set.

# ml_flags should be one of:
const METH_VARARGS = 0x0001 # args are a tuple of arguments
const METH_KEYWORDS = 0x0002  # two arguments: the varargs and the kwargs
const METH_NOARGS = 0x0004  # no arguments (NULL argument pointer)
const METH_O = 0x0008       # single argument (not wrapped in tuple)

# not sure when these are needed:
const METH_CLASS = 0x0010 # for class methods
const METH_STATIC = 0x0020 # for static methods

const NULL_UInt8_Ptr = convert(Ptr{UInt8}, C_NULL)
function PyMethodDef(name::AbstractString, meth::Function, flags::Integer, doc::AbstractString="")
    PyMethodDef(gstring_ptr(name, name),
                ((flags & METH_KEYWORDS) == 0 ?
                 cfunction(meth, PyPtr, (PyPtr,PyPtr)) :
                 cfunction(meth, PyPtr, (PyPtr,PyPtr,PyPtr))),
                convert(Cint, flags),
                isempty(doc) ? NULL_UInt8_Ptr : gstring_ptr(name, doc))
end

# used as sentinel value to end method arrays:
PyMethodDef() = PyMethodDef(NULL_UInt8_Ptr, C_NULL,
                            convert(Cint, 0), NULL_UInt8_Ptr)

################################################################
# mirror of Python API types and constants from descrobject.h

immutable PyGetSetDef
    name::Ptr{UInt8}
    get::Ptr{Void}
    set::Ptr{Void} # may be NULL for read-only members
    doc::Ptr{UInt8} # may be NULL
    closure::Ptr{Void} # pass-through thunk, may be NULL
end

function PyGetSetDef(name::AbstractString, get::Function,set::Function, doc::AbstractString="")
    PyGetSetDef(gstring_ptr(name, name),
                cfunction(get, PyPtr, (PyPtr,Ptr{Void})),
                cfunction(set, Int, (PyPtr,PyPtr,Ptr{Void})),
                isempty(doc) ? NULL_UInt8_Ptr : gstring_ptr(name, doc),
                C_NULL)
end

function PyGetSetDef(name::AbstractString, get::Function, doc::AbstractString="")
    PyGetSetDef(gstring_ptr(name, name),
                cfunction(get, PyPtr, (PyPtr,Ptr{Void})),
                C_NULL,
                isempty(doc) ? NULL_UInt8_Ptr : gstring_ptr(name, doc),
                C_NULL)
end

# used as sentinel value to end attribute arrays:
PyGetSetDef() = PyGetSetDef(NULL_UInt8_Ptr, C_NULL, C_NULL, NULL_UInt8_Ptr, C_NULL)

################################################################
# from Python structmember.h:

# declare immutable because we need a C-like array of these
immutable PyMemberDef
    name::Ptr{UInt8}
    typ::Cint
    offset::Int # warning: was Cint for Python <= 2.4
    flags::Cint
    doc::Ptr{UInt8}
    PyMemberDef(name,typ,offset,flags,doc) =
        new(unsafe_convert(Ptr{UInt8},name),
            convert(Cint,typ),
            convert(Int,offset),
            convert(Cint,flags),
            unsafe_convert(Ptr{UInt8},doc))
end

# types:
const T_SHORT        =0
const T_INT          =1
const T_LONG         =2
const T_FLOAT        =3
const T_DOUBLE       =4
const T_STRING       =5
const T_OBJECT       =6
const T_CHAR         =7
const T_BYTE         =8
const T_UBYTE        =9
const T_USHORT       =10
const T_UINT         =11
const T_ULONG        =12
const T_STRING_INPLACE       =13
const T_BOOL         =14
const T_OBJECT_EX    =16
const T_LONGLONG     =17 # added in Python 2.5
const T_ULONGLONG    =18 # added in Python 2.5
const T_PYSSIZET     =19 # added in Python 2.6
const T_NONE         =20 # added in Python 3.0

# flags:
const READONLY = 1
const READ_RESTRICTED = 2
const PY_WRITE_RESTRICTED = 4
const RESTRICTED = (READ_RESTRICTED | PY_WRITE_RESTRICTED)

################################################################
# type-flag constants, from Python object.h:

# Python 2.7
const Py_TPFLAGS_HAVE_GETCHARBUFFER  = (0x00000001<<0)
const Py_TPFLAGS_HAVE_SEQUENCE_IN = (0x00000001<<1)
const Py_TPFLAGS_GC = 0 # was sometimes (0x00000001<<2) in Python <= 2.1
const Py_TPFLAGS_HAVE_INPLACEOPS = (0x00000001<<3)
const Py_TPFLAGS_CHECKTYPES = (0x00000001<<4)
const Py_TPFLAGS_HAVE_RICHCOMPARE = (0x00000001<<5)
const Py_TPFLAGS_HAVE_WEAKREFS = (0x00000001<<6)
const Py_TPFLAGS_HAVE_ITER = (0x00000001<<7)
const Py_TPFLAGS_HAVE_CLASS = (0x00000001<<8)
const Py_TPFLAGS_HAVE_INDEX = (0x00000001<<17)
const Py_TPFLAGS_HAVE_NEWBUFFER = (0x00000001<<21)
const Py_TPFLAGS_STRING_SUBCLASS       = (0x00000001<<27)

# Python 3.0+ has only these:
const Py_TPFLAGS_HEAPTYPE = (0x00000001<<9)
const Py_TPFLAGS_BASETYPE = (0x00000001<<10)
const Py_TPFLAGS_READY = (0x00000001<<12)
const Py_TPFLAGS_READYING = (0x00000001<<13)
const Py_TPFLAGS_HAVE_GC = (0x00000001<<14)
const Py_TPFLAGS_HAVE_VERSION_TAG   = (0x00000001<<18)
const Py_TPFLAGS_VALID_VERSION_TAG  = (0x00000001<<19)
const Py_TPFLAGS_IS_ABSTRACT = (0x00000001<<20)
const Py_TPFLAGS_INT_SUBCLASS         = (0x00000001<<23)
const Py_TPFLAGS_LONG_SUBCLASS        = (0x00000001<<24)
const Py_TPFLAGS_LIST_SUBCLASS        = (0x00000001<<25)
const Py_TPFLAGS_TUPLE_SUBCLASS       = (0x00000001<<26)
const Py_TPFLAGS_BYTES_SUBCLASS       = (0x00000001<<27)
const Py_TPFLAGS_UNICODE_SUBCLASS     = (0x00000001<<28)
const Py_TPFLAGS_DICT_SUBCLASS        = (0x00000001<<29)
const Py_TPFLAGS_BASE_EXC_SUBCLASS    = (0x00000001<<30)
const Py_TPFLAGS_TYPE_SUBCLASS        = (0x00000001<<31)

# only use this if we have the stackless extension
const Py_TPFLAGS_HAVE_STACKLESS_EXTENSION_ = (0x00000003<<15)

################################################################
# Mirror of PyTypeObject in Python object.h
#  -- assumes non-debugging Python build (no Py_TRACE_REFS)
#  -- most fields can default to 0 except where noted

const sizeof_PyObject_HEAD = sizeof(Int) + sizeof(PyPtr)

type PyTypeObject
    # PyObject_HEAD (for non-Py_TRACE_REFS build):
    ob_refcnt::Int
    ob_type::PyPtr
    ob_size::Int # PyObject_VAR_HEAD

    # PyTypeObject fields:
    tp_name::Ptr{UInt8} # required, should be in format "<module>.<name>"

    # warning: these two were Cint for Python <= 2.4
    tp_basicsize::Int # required, = sizeof(instance)
    tp_itemsize::Int

    tp_dealloc::Ptr{Void}
    tp_print::Ptr{Void}
    tp_getattr::Ptr{Void}
    tp_setattr::Ptr{Void}
    tp_compare::Ptr{Void}
    tp_repr::Ptr{Void}

    tp_as_number::Ptr{Void}
    tp_as_sequence::Ptr{Void}
    tp_as_mapping::Ptr{Void}

    tp_hash::Ptr{Void}
    tp_call::Ptr{Void}
    tp_str::Ptr{Void}
    tp_getattro::Ptr{Void}
    tp_setattro::Ptr{Void}

    tp_as_buffer::Ptr{Void}

    tp_flags::Clong # Required, should default to Py_TPFLAGS_DEFAULT

    tp_doc::Ptr{UInt8} # normally set in example code, but may be NULL

    tp_traverse::Ptr{Void}

    tp_clear::Ptr{Void}

    tp_richcompare::Ptr{Void}

    tp_weaklistoffset::Int

    # added in Python 2.2:
    tp_iter::Ptr{Void}
    tp_iternext::Ptr{Void}

    tp_methods::Ptr{PyMethodDef}
    tp_members::Ptr{PyMemberDef}
    tp_getset::Ptr{PyGetSetDef}
    tp_base::Ptr{Void}

    tp_dict::PyPtr
    tp_descr_get::Ptr{Void}
    tp_descr_set::Ptr{Void}
    tp_dictoffset::Int

    tp_init::Ptr{Void}
    tp_alloc::Ptr{Void}
    tp_new::Ptr{Void}
    tp_free::Ptr{Void}
    tp_is_gc::Ptr{Void}

    tp_bases::PyPtr
    tp_mro::PyPtr
    tp_cache::PyPtr
    tp_subclasses::PyPtr
    tp_weaklist::PyPtr
    tp_del::Ptr{Void}

    # added in Python 2.6:
    tp_version_tag::Cuint

    # only used for COUNT_ALLOCS builds of Python
    tp_allocs::Int
    tp_frees::Int
    tp_maxalloc::Int
    tp_prev::Ptr{Void}
    tp_next::Ptr{Void}

    # Julia-specific fields, after the end of the Python structure:

    # save the tp_name Julia string so that it is not garbage-collected
    tp_name_save # This is a gc slot that is never read from

    function PyTypeObject()
        new(0,C_NULL,0,
            C_NULL,
            0, 0,
            C_NULL,C_NULL,C_NULL,C_NULL,C_NULL,C_NULL, # tp_dealloc ...
            C_NULL,C_NULL,C_NULL, # tp_as_number...
            C_NULL,C_NULL,C_NULL,C_NULL,C_NULL, # tp_hash ...
            C_NULL, # tp_as_buffer
            0,
            C_NULL, # tp_doc
            C_NULL, # tp_traverse,
            C_NULL, # tp_clear
            C_NULL, # tp_richcompare
            0, # tp_weaklistoffset
            C_NULL,C_NULL, # tp_iter, tp_iternext
            C_NULL,C_NULL,C_NULL,C_NULL, # tp_methods...
            C_NULL,C_NULL,C_NULL,0, # tp_dict...
            C_NULL,C_NULL,C_NULL,C_NULL,C_NULL, # tp_init ...
            C_NULL,C_NULL,C_NULL,C_NULL,C_NULL,C_NULL, # tp_bases...
            0, # tp_version_tag
            0,0,0,C_NULL,C_NULL, # tp_allocs...
            "")
    end
    PyTypeObject(name::AbstractString, basicsize::Integer, init::Function) =
        PyTypeObject!(PyTypeObject(), name, basicsize, init)
end

# Often, PyTypeObject instances are global constants, which we initialize
# to 0 via PyTypeObject() and then initialize at runtime via PyTypeObject!
function PyTypeObject!(t::PyTypeObject, name::AbstractString, basicsize::Integer, init::Function)
    t.tp_basicsize = convert(Int, basicsize)

    # figure out Py_TPFLAGS_DEFAULT, depending on Python version
    t.tp_flags = # Py_TPFLAGS_DEFAULT =
      pyversion_build.major >= 3 ?
        (Py_TPFLAGS_HAVE_STACKLESS_EXTENSION[] |
         Py_TPFLAGS_HAVE_VERSION_TAG) :
        (Py_TPFLAGS_HAVE_GETCHARBUFFER |
         Py_TPFLAGS_HAVE_SEQUENCE_IN |
         Py_TPFLAGS_HAVE_INPLACEOPS |
         Py_TPFLAGS_HAVE_RICHCOMPARE |
         Py_TPFLAGS_HAVE_WEAKREFS |
         Py_TPFLAGS_HAVE_ITER |
         Py_TPFLAGS_HAVE_CLASS |
         Py_TPFLAGS_HAVE_STACKLESS_EXTENSION[] |
         Py_TPFLAGS_HAVE_INDEX)

    # Emulate the rooting behavior of a ccall:
    name_save = Base.cconvert(Ptr{UInt8}, name)
    t.tp_name_save = name_save
    t.tp_name = unsafe_convert(Ptr{UInt8}, name_save)

    init(t) # initialize any other fields as needed
    if t.tp_new == C_NULL
        t.tp_new = @pyglobal :PyType_GenericNew
    end
    @pycheckz ccall((@pysym :PyType_Ready), Cint, (Ptr{PyTypeObject},), &t)
    ccall((@pysym :Py_IncRef), Void, (Ptr{PyTypeObject},), &t)
    return t
end

################################################################
# Wrap a Python type around a Julia Any object

immutable Py_jlWrap
    # PyObject_HEAD (for non-Py_TRACE_REFS build):
    ob_refcnt::Int
    ob_type::PyPtr

    jl_value::Any
end

# destructor for jlwrap instance, assuming it was created with pyjlwrap_new
function pyjlwrap_dealloc(o::PyPtr)
    delete!(pycall_gc, o)
    return nothing
end

unsafe_pyjlwrap_to_objref(o::PyPtr) =
  unsafe_pointer_to_objref(unsafe_load(convert(Ptr{Ptr{Void}}, o), 3))

pyjlwrap_repr(o::PyPtr) =
    pystealref!(PyObject(try string("<PyCall.jlwrap ",unsafe_pyjlwrap_to_objref(o),">")
                         catch; "<PyCall.jlwrap NULL>"; end))

function pyjlwrap_hash(o::PyPtr)
    h = hash(unsafe_pyjlwrap_to_objref(o))
    # Python hashes are not permitted to return -1!!
    return h == reinterpret(UInt, -1) ? pysalt::UInt : h::UInt
end

# 32-bit hash on 64-bit machines, needed for Python < 3.2 with Windows
const pysalt32 = 0xb592cd9b # hash("PyCall") % UInt32
function pyjlwrap_hash32(o::PyPtr)
    h = ccall(:int64to32hash, UInt32, (UInt64,),
              hash(unsafe_pyjlwrap_to_objref(o)))
    # Python hashes are not permitted to return -1!!
    return h == reinterpret(UInt32, Int32(-1)) ? pysalt32 : h::UInt32
end

# constant strings (must not be gc'ed) for pyjlwrap_members
const pyjlwrap_membername = "jl_value"
const pyjlwrap_doc = "Julia jl_value_t* (Any object)"
# other pointer-containing constants that need to be initialized at runtime
const pyjlwrap_members = PyMemberDef[]
const jlWrapType = PyTypeObject()
const jl_FunctionType = PyTypeObject()
const Py_TPFLAGS_HAVE_STACKLESS_EXTENSION = Ref(0x00000000)

# called in __init__
function pyjlwrap_init()
    # PyMemberDef stores explicit pointers, hence must be initialized at runtime
    push!(pyjlwrap_members, PyMemberDef(pyjlwrap_membername,
                                        T_PYSSIZET, sizeof_PyObject_HEAD, READONLY,
                                        pyjlwrap_doc),
                            PyMemberDef(C_NULL,0,0,0,C_NULL))

    # all cfunctions must be compiled at runtime
    pyjlwrap_dealloc_ptr = cfunction(pyjlwrap_dealloc, Void, (PyPtr,))
    pyjlwrap_repr_ptr = cfunction(pyjlwrap_repr, PyPtr, (PyPtr,))
    pyjlwrap_hash_ptr = cfunction(pyjlwrap_hash, UInt, (PyPtr,))
    pyjlwrap_hash32_ptr = cfunction(pyjlwrap_hash32, UInt32, (PyPtr,))
    jl_Function_call_ptr = cfunction(jl_Function_call, PyPtr, (PyPtr,PyPtr,PyPtr))

    # detect at runtime whether we are using Stackless Python
    try
        pyimport("stackless")
        Py_TPFLAGS_HAVE_STACKLESS_EXTENSION[] = Py_TPFLAGS_HAVE_STACKLESS_EXTENSION_
    end

    PyTypeObject!(jlWrapType, "PyCall.jlwrap", sizeof(Py_jlWrap),
                  t::PyTypeObject -> begin
                     t.tp_flags |= Py_TPFLAGS_BASETYPE
                     t.tp_members = pointer(pyjlwrap_members);
                     t.tp_dealloc = pyjlwrap_dealloc_ptr
                     t.tp_repr = pyjlwrap_repr_ptr
                     t.tp_hash = sizeof(Py_hash_t) < sizeof(Int) ?
                     pyjlwrap_hash32_ptr : pyjlwrap_hash_ptr
                  end)

    pyjlwrap_type!(jl_FunctionType, "PyCall.jl_Function",
                   t -> t.tp_call = jl_Function_call_ptr)
end

# use this to create a new jlwrap type, with init to set up custom members
function pyjlwrap_type!(to::PyTypeObject, name::AbstractString, init::Function)
    PyTypeObject!(to, name, sizeof(Py_jlWrap) + sizeof(PyPtr), # must be > base type
                  t::PyTypeObject -> begin
                     t.tp_base = ccall(:jl_value_ptr, Ptr{Void},
                                       (Ptr{PyTypeObject},),
                                       &jlWrapType)
                     ccall((@pysym :Py_IncRef), Void, (Ptr{PyTypeObject},), &jlWrapType)
                     init(t)
                  end)
end

pyjlwrap_type(name::AbstractString, init::Function) =
    pyjlwrap_type!(PyTypeObject(), name, init)

# Given a jlwrap type, create a new instance (and save value for gc)
# (Careful: not sure if this works if value is an isbits type,
#  since, the jl_value_t* may be to a temporary copy.  But don't need
#  to wrap isbits types in Python objects anyway.)
function pyjlwrap_new(pyT::PyTypeObject, value::Any)
    o = PyObject(@pycheckn ccall((@pysym :_PyObject_New),
                                 PyPtr, (Ptr{PyTypeObject},), &pyT))
    pycall_gc[o.o] = value
    p = convert(Ptr{Ptr{Void}}, o.o)
    unsafe_store!(p, ccall(:jl_value_ptr, Ptr{Void}, (Any,), value), 3)
    return o
end

function pyjlwrap_new(x::Any)
    pyjlwrap_new(jlWrapType, x)
end

is_pyjlwrap(o::PyObject) = jlWrapType.tp_new != C_NULL && ccall((@pysym :PyObject_IsInstance), Cint, (PyPtr,Ptr{PyTypeObject}), o, &jlWrapType) == 1

################################################################
# Fallback conversion: if we don't have a better conversion function,
# just wrap the Julia object in a Python object

PyObject(x::Any) = pyjlwrap_new(x)

ext: jl


text:
"""
    c2ibpn(date1, date2, rbpn)

Form the celestial-to-intermediate matrix for a given date given
the bias-precession-nutation matrix.  IAU 2000.

### Given ###

- `date1`, `date2`: TT as a 2-part Julian Date (Note 1)
- `rbpn`: Celestial-to-true matrix (Note 2)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 3)

### Notes ###

1. The TT date date1+date2 is a Julian Date, apportioned in any
   convenient way between the two arguments.  For example,
   JD(TT)=2450123.7 could be expressed in any of these ways,
   among others:

   | `date1`   |     `date2` |                    |
   |:----------|:------------|:-------------------|
   | 2450123.7 |         0.0 | JD method          |
   | 2451545.0 |     -1421.3 | J2000 method       |
   | 2400000.5 |     50123.2 | MJD method         |
   | 2450123.5 |         0.2 | date & time method |

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution
   is acceptable.  The J2000 method is best matched to the way
   the argument is handled internally and will deliver the
   optimum resolution.  The MJD method and the date & time methods
   are both good compromises between resolution and convenience.

2. The matrix rbpn transforms vectors from GCRS to true equator (and
   CIO or equinox) of date.  Only the CIP (bottom row) is used.

3. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]

            = RC2T * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

4. Although its name does not include "00", This function is in fact
   specific to the IAU 2000 models.

### Called ###

- `eraBpn2xy`: extract CIP X,Y coordinates from NPB matrix
- `eraC2ixy`: celestial-to-intermediate matrix, given X,Y

### References ###

- "Expressions for the Celestial Intermediate Pole and Celestial
    Ephemeris Origin consistent with the IAU 2000A precession-
    nutation model", Astron.Astrophys. 400, 1145-1154 (2003)

- n.b. The celestial ephemeris origin (CEO) was renamed "celestial
    intermediate origin" (CIO) by IAU 2006 Resolution 2.

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
function c2ibpn(date1, date2, rbpn)
    rc2i = zeros((3, 3))
    ccall((:eraC2ibpn, liberfa), Cvoid,
          (Cdouble, Cdouble, Ptr{Cdouble}, Ptr{Cdouble}),
          date1, date2, rbpn, rc2i)
    rc2i
end

"""
    c2s(p)

P-vector to spherical coordinates.

### Given ###

- `p`: P-vector

### Returned ###

- `theta`: Longitude angle (radians)
- `phi`: Latitude angle (radians)

### Notes ###

1. The vector p can have any magnitude; only its direction is used.

2. If p is null, zero theta and phi are returned.

3. At either pole, zero theta is returned.
"""
function c2s(p)
    theta = Ref(0.0)
    phi = Ref(0.0)
    ccall((:eraC2s, liberfa), Cvoid,
          (Ptr{Cdouble}, Ref{Cdouble}, Ref{Cdouble}),
          p, theta, phi)
    theta[], phi[]
end

"""
    cal2jd(iy, imo, id)

Gregorian Calendar to Julian Date.

### Given ###

- `iy`, `im`, `id`: Year, month, day in Gregorian calendar (Note 1)

### Returned ###

- `djm0`: MJD zero-point: always 2400000.5
- `djm`: Modified Julian Date for 0 hrs

### Notes ###

1. The algorithm used is valid from -4800 March 1, but this
   implementation rejects dates before -4799 January 1.

2. The Julian Date is returned in two pieces, in the usual ERFA
   manner, which is designed to preserve time resolution.  The
   Julian Date is available as a single number by adding djm0 and
   djm.

3. In early eras the conversion is from the "Proleptic Gregorian
   Calendar";  no account is taken of the date(s) of adoption of
   the Gregorian Calendar, nor is the AD/BC numbering convention
   observed.

### Reference ###

- Explanatory Supplement to the Astronomical Almanac,
    P. Kenneth Seidelmann (ed), University Science Books (1992),
    Section 12.92 (p604).
"""
function cal2jd(iy, imo, id)
    r1 = Ref(0.0)
    r2 = Ref(0.0)
    i = ccall((:eraCal2jd, liberfa), Cint,
              (Cint, Cint, Cint, Ref{Cdouble}, Ref{Cdouble}),
              iy, imo, id, r1, r2)
    if i == -1
        throw(ERFAException("bad year"))
    elseif i == -2
        throw(ERFAException("bad month"))
    elseif i == -3
        throw(ERFAException("bad day"))
    end
    r1[], r2[]
end

"""
    c2tcio(rc2i, era, rpom)

Assemble the celestial to terrestrial matrix from CIO-based
components (the celestial-to-intermediate matrix, the Earth Rotation
Angle and the polar motion matrix).

### Given ###

- `rc2i`: Celestial-to-intermediate matrix
- `era`: Earth rotation angle (radians)
- `rpom`: Polar-motion matrix

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix

### Notes ###

1. This function constructs the rotation matrix that transforms
   vectors in the celestial system into vectors in the terrestrial
   system.  It does so starting from precomputed components, namely
   the matrix which rotates from celestial coordinates to the
   intermediate frame, the Earth rotation angle and the polar motion
   matrix.  One use of the present function is when generating a
   series of celestial-to-terrestrial matrices where only the Earth
   Rotation Angle changes, avoiding the considerable overhead of
   recomputing the precession-nutation more often than necessary to
   achieve given accuracy objectives.

2. The relationship between the arguments is as follows:

      [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003).

### Called ###

- `eraCr`: copy r-matrix
- `eraRz`: rotate around Z-axis
- `eraRxr`: product of two r-matrices

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
    IERS Technical Note No. 32, BKG
"""
c2tcio

"""
    c2teqx(rc2i, era, rpom)

Assemble the celestial to terrestrial matrix from equinox-based
components (the celestial-to-true matrix, the Greenwich Apparent
Sidereal Time and the polar motion matrix).

### Given ###

- `rbpn`: Celestial-to-true matrix
- `gst`: Greenwich (apparent) Sidereal Time (radians)
- `rpom`: Polar-motion matrix

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 2)

### Notes ###

1. This function constructs the rotation matrix that transforms
   vectors in the celestial system into vectors in the terrestrial
   system.  It does so starting from precomputed components, namely
   the matrix which rotates from celestial coordinates to the
   true equator and equinox of date, the Greenwich Apparent Sidereal
   Time and the polar motion matrix.  One use of the present function
   is when generating a series of celestial-to-terrestrial matrices
   where only the Sidereal Time changes, avoiding the considerable
   overhead of recomputing the precession-nutation more often than
   necessary to achieve given accuracy objectives.

2. The relationship between the arguments is as follows:

      [TRS] = rpom * R_3(gst) * rbpn * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003).

### Called ###

- `eraCr`: copy r-matrix
- `eraRz`: rotate around Z-axis
- `eraRxr`: product of two r-matrices

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2teqx

for name in ("c2tcio",
             "c2teqx")
    f = Symbol(name)
    fc = "era" * uppercasefirst(name)
    @eval begin
        function ($f)(rc2i, era, rpom)
            rc2t = zeros((3, 3))
            ccall(($fc, liberfa), Cvoid,
                  (Ptr{Cdouble}, Cdouble, Ptr{Cdouble}, Ptr{Cdouble}),
                  rc2i, era, rpom, rc2t)
            rc2t
        end
    end
end

"""
    c2t00a(tta, ttb, uta, utb, xp, yp)

Form the celestial to terrestrial matrix given the date, the UT1 and
the polar motion, using the IAU 2000A nutation model.

### Given ###

- `tta`, `ttb`: TT as a 2-part Julian Date (Note 1)
- `uta`, `utb`: UT1 as a 2-part Julian Date (Note 1)
- `xp`, `yp`: Coordinates of the pole (radians, Note 2)

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 3)

### Notes ###

1. The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
   apportioned in any convenient way between the arguments uta and
   utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
   these ways, among others:

           uta            utb

       2450123.7           0.0       (JD method)
       2451545.0       -1421.3       (J2000 method)
       2400000.5       50123.2       (MJD method)
       2450123.5           0.2       (date & time method)

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution is
   acceptable.  The J2000 and MJD methods are good compromises
   between resolution and convenience.  In the case of uta,utb, the
   date & time method is best matched to the Earth rotation angle
   algorithm used:  maximum precision is delivered when the uta
   argument is for 0hrs UT1 on the day in question and the utb
   argument lies in the range 0 to 1, or vice versa.

2. The arguments xp and yp are the coordinates (in radians) of the
   Celestial Intermediate Pole with respect to the International
   Terrestrial Reference System (see IERS Conventions 2003),
   measured along the meridians to 0 and 90 deg west respectively.

3. The matrix rc2t transforms from celestial to terrestrial
   coordinates:

      [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), RC2I is the
   celestial-to-intermediate matrix, ERA is the Earth rotation
   angle and RPOM is the polar motion matrix.

4. A faster, but slightly less accurate result (about 1 mas), can
   be obtained by using instead the eraC2t00b function.

### Called ###

- `eraC2i00a`: celestial-to-intermediate matrix, IAU 2000A
- `eraEra00`: Earth rotation angle, IAU 2000
- `eraSp00`: the TIO locator s', IERS 2000
- `eraPom00`: polar motion matrix
- `eraC2tcio`: form CIO-based celestial-to-terrestrial matrix

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2t00a

"""
    c2t00b(tta, ttb, uta, utb, xp, yp)

Form the celestial to terrestrial matrix given the date, the UT1 and
the polar motion, using the IAU 2000B nutation model.

### Given ###

- `tta`, `ttb`: TT as a 2-part Julian Date (Note 1)
- `uta`, `utb`: UT1 as a 2-part Julian Date (Note 1)
- `xp`, `yp`: Coordinates of the pole (radians, Note 2)

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 3)

### Notes ###

1. The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
   apportioned in any convenient way between the arguments uta and
   utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
   these ways, among others:

           uta            utb

       2450123.7           0.0       (JD method)
       2451545.0       -1421.3       (J2000 method)
       2400000.5       50123.2       (MJD method)
       2450123.5           0.2       (date & time method)

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution is
   acceptable.  The J2000 and MJD methods are good compromises
   between resolution and convenience.  In the case of uta,utb, the
   date & time method is best matched to the Earth rotation angle
   algorithm used:  maximum precision is delivered when the uta
   argument is for 0hrs UT1 on the day in question and the utb
   argument lies in the range 0 to 1, or vice versa.

2. The arguments xp and yp are the coordinates (in radians) of the
   Celestial Intermediate Pole with respect to the International
   Terrestrial Reference System (see IERS Conventions 2003),
   measured along the meridians to 0 and 90 deg west respectively.

3. The matrix rc2t transforms from celestial to terrestrial
   coordinates:

      [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), RC2I is the
   celestial-to-intermediate matrix, ERA is the Earth rotation
   angle and RPOM is the polar motion matrix.

4. The present function is faster, but slightly less accurate (about
   1 mas), than the eraC2t00a function.

### Called ###

- `eraC2i00b`: celestial-to-intermediate matrix, IAU 2000B
- `eraEra00`: Earth rotation angle, IAU 2000
- `eraPom00`: polar motion matrix
- `eraC2tcio`: form CIO-based celestial-to-terrestrial matrix

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2t00b

"""
    c2t06a(tta, ttb, uta, utb, xp, yp)

Form the celestial to terrestrial matrix given the date, the UT1 and
the polar motion, using the IAU 2006 precession and IAU 2000A
nutation models.

### Given ###

- `tta`, `ttb`: TT as a 2-part Julian Date (Note 1)
- `uta`, `utb`: UT1 as a 2-part Julian Date (Note 1)
- `xp`, `yp`: Coordinates of the pole (radians, Note 2)

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 3)

### Notes ###

1. The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
   apportioned in any convenient way between the arguments uta and
   utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
   these ways, among others:

           uta            utb

       2450123.7           0.0       (JD method)
       2451545.0       -1421.3       (J2000 method)
       2400000.5       50123.2       (MJD method)
       2450123.5           0.2       (date & time method)

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution is
   acceptable.  The J2000 and MJD methods are good compromises
   between resolution and convenience.  In the case of uta,utb, the
   date & time method is best matched to the Earth rotation angle
   algorithm used:  maximum precision is delivered when the uta
   argument is for 0hrs UT1 on the day in question and the utb
   argument lies in the range 0 to 1, or vice versa.

2. The arguments xp and yp are the coordinates (in radians) of the
   Celestial Intermediate Pole with respect to the International
   Terrestrial Reference System (see IERS Conventions 2003),
   measured along the meridians to 0 and 90 deg west respectively.

3. The matrix rc2t transforms from celestial to terrestrial
   coordinates:

      [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), RC2I is the
   celestial-to-intermediate matrix, ERA is the Earth rotation
   angle and RPOM is the polar motion matrix.

### Called ###

- `eraC2i06a`: celestial-to-intermediate matrix, IAU 2006/2000A
- `eraEra00`: Earth rotation angle, IAU 2000
- `eraSp00`: the TIO locator s', IERS 2000
- `eraPom00`: polar motion matrix
- `eraC2tcio`: form CIO-based celestial-to-terrestrial matrix

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
    IERS Technical Note No. 32, BKG
"""
c2t06a

for name in ("c2t00a",
             "c2t00b",
             "c2t06a")
    f = Symbol(name)
    fc = "era" * uppercasefirst(name)
    @eval begin
        function ($f)(tta, ttb, uta, utb, xp, yp)
            rc2t = zeros((3, 3))
            ccall(($fc, liberfa), Cvoid,
                  (Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Ptr{Cdouble}),
                  tta, ttb, uta, utb, xp, yp, rc2t)
            rc2t
        end
    end
end

"""
    c2tpe(tta, ttb, uta, utb, x, y, xp, yp)

Form the celestial to terrestrial matrix given the date, the UT1,
the nutation and the polar motion.  IAU 2000.

### Given ###

- `tta`, `ttb`: TT as a 2-part Julian Date (Note 1)
- `uta`, `utb`: UT1 as a 2-part Julian Date (Note 1)
- `dpsi`, `deps`: Nutation (Note 2)
- `xp`, `yp`: Coordinates of the pole (radians, Note 3)

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 4)

### Notes ###

1. The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
   apportioned in any convenient way between the arguments uta and
   utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
   these ways, among others:

           uta            utb

       2450123.7           0.0       (JD method)
       2451545.0       -1421.3       (J2000 method)
       2400000.5       50123.2       (MJD method)
       2450123.5           0.2       (date & time method)

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution is
   acceptable.  The J2000 and MJD methods are good compromises
   between resolution and convenience.  In the case of uta,utb, the
   date & time method is best matched to the Earth rotation angle
   algorithm used:  maximum precision is delivered when the uta
   argument is for 0hrs UT1 on the day in question and the utb
   argument lies in the range 0 to 1, or vice versa.

2. The caller is responsible for providing the nutation components;
   they are in longitude and obliquity, in radians and are with
   respect to the equinox and ecliptic of date.  For high-accuracy
   applications, free core nutation should be included as well as
   any other relevant corrections to the position of the CIP.

3. The arguments xp and yp are the coordinates (in radians) of the
   Celestial Intermediate Pole with respect to the International
   Terrestrial Reference System (see IERS Conventions 2003),
   measured along the meridians to 0 and 90 deg west respectively.

4. The matrix rc2t transforms from celestial to terrestrial
   coordinates:

      [TRS] = RPOM * R_3(GST) * RBPN * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), RBPN is the
   bias-precession-nutation matrix, GST is the Greenwich (apparent)
   Sidereal Time and RPOM is the polar motion matrix.

5. Although its name does not include "00", This function is in fact
   specific to the IAU 2000 models.

### Called ###

- `eraPn00`: bias/precession/nutation results, IAU 2000
- `eraGmst00`: Greenwich mean sidereal time, IAU 2000
- `eraSp00`: the TIO locator s', IERS 2000
- `eraEe00`: equation of the equinoxes, IAU 2000
- `eraPom00`: polar motion matrix
- `eraC2teqx`: form equinox-based celestial-to-terrestrial matrix

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2tpe

"""
    c2txy(tta, ttb, uta, utb, x, y, xp, yp)

Form the celestial to terrestrial matrix given the date, the UT1,
the CIP coordinates and the polar motion.  IAU 2000.

### Given ###

- `tta`, `ttb`: TT as a 2-part Julian Date (Note 1)
- `uta`, `utb`: UT1 as a 2-part Julian Date (Note 1)
- `x`, `y`: Celestial Intermediate Pole (Note 2)
- `xp`, `yp`: Coordinates of the pole (radians, Note 3)

### Returned ###

- `rc2t`: Celestial-to-terrestrial matrix (Note 4)

### Notes ###

1. The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
   apportioned in any convenient way between the arguments uta and
   utb.  For example, JD(UT1)=2450123.7 could be expressed in any o
   these ways, among others:

           uta            utb

       2450123.7           0.0       (JD method)
       2451545.0       -1421.3       (J2000 method)
       2400000.5       50123.2       (MJD method)
       2450123.5           0.2       (date & time method)

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution is
   acceptable.  The J2000 and MJD methods are good compromises
   between resolution and convenience.  In the case of uta,utb, the
   date & time method is best matched to the Earth rotation angle
   algorithm used:  maximum precision is delivered when the uta
   argument is for 0hrs UT1 on the day in question and the utb
   argument lies in the range 0 to 1, or vice versa.

2. The Celestial Intermediate Pole coordinates are the x,y
   components of the unit vector in the Geocentric Celestial
   Reference System.

3. The arguments xp and yp are the coordinates (in radians) of the
   Celestial Intermediate Pole with respect to the International
   Terrestrial Reference System (see IERS Conventions 2003),
   measured along the meridians to 0 and 90 deg west respectively.

4. The matrix rc2t transforms from celestial to terrestrial
   coordinates:

      [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]

            = rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

5. Although its name does not include "00", This function is in fact
   specific to the IAU 2000 models.

### Called ###

- `eraC2ixy`: celestial-to-intermediate matrix, given X,Y
- `eraEra00`: Earth rotation angle, IAU 2000
- `eraSp00`: the TIO locator s', IERS 2000
- `eraPom00`: polar motion matrix
- `eraC2tcio`: form CIO-based celestial-to-terrestrial matrix

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2txy

for name in ("c2tpe",
             "c2txy")
    f = Symbol(name)
    fc = "era" * uppercasefirst(name)
    @eval begin
        function ($f)(tta, ttb, uta, utb, x, y, xp, yp)
            rc2t = zeros((3, 3))
            ccall(($fc, liberfa), Cvoid,
                  (Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Cdouble, Ptr{Cdouble}),
                  tta, ttb, uta, utb, x, y, xp, yp, rc2t)
            rc2t
        end
    end
end

"""
    c2i00a(a, b)

Form the celestial-to-intermediate matrix for a given date using the
IAU 2000A precession-nutation model.

### Given ###

- `date1`, `date2`: TT as a 2-part Julian Date (Note 1)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 2)

### Notes ###

1. The TT date date1+date2 is a Julian Date, apportioned in any
   convenient way between the two arguments.  For example,
   JD(TT)=2450123.7 could be expressed in any of these ways,
   among others:

   | `date1`   |     `date2` |                    |
   |:----------|:------------|:-------------------|
   | 2450123.7 |         0.0 | JD method          |
   | 2451545.0 |     -1421.3 | J2000 method       |
   | 2400000.5 |     50123.2 | MJD method         |
   | 2450123.5 |         0.2 | date & time method |

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution
   is acceptable.  The J2000 method is best matched to the way
   the argument is handled internally and will deliver the
   optimum resolution.  The MJD method and the date & time methods
   are both good compromises between resolution and convenience.

2. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]

             =  rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

3. A faster, but slightly less accurate result (about 1 mas), can be
   obtained by using instead the eraC2i00b function.

### Called ###

- `eraPnm00a`: classical NPB matrix, IAU 2000A
- `eraC2ibpn`: celestial-to-intermediate matrix, given NPB matrix

### References ###

- "Expressions for the Celestial Intermediate Pole and Celestial
    Ephemeris Origin consistent with the IAU 2000A precession-
    nutation model", Astron.Astrophys. 400, 1145-1154
    (2003)

- n.b. The celestial ephemeris origin (CEO) was renamed "celestial
    intermediate origin" (CIO) by IAU 2006 Resolution 2.

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2i00a

"""
    c2i00b(a, b)

Form the celestial-to-intermediate matrix for a given date using the
IAU 2000B precession-nutation model.

### Given ###

- `date1`, `date2`: TT as a 2-part Julian Date (Note 1)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 2)

### Notes ###

1. The TT date date1+date2 is a Julian Date, apportioned in any
   convenient way between the two arguments.  For example,
   JD(TT)=2450123.7 could be expressed in any of these ways,
   among others:

   | `date1`   |     `date2` |                    |
   |:----------|:------------|:-------------------|
   | 2450123.7 |         0.0 | JD method          |
   | 2451545.0 |     -1421.3 | J2000 method       |
   | 2400000.5 |     50123.2 | MJD method         |
   | 2450123.5 |         0.2 | date & time method |

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution
   is acceptable.  The J2000 method is best matched to the way
   the argument is handled internally and will deliver the
   optimum resolution.  The MJD method and the date & time methods
   are both good compromises between resolution and convenience.

2. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]

             =  rc2t * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

3. The present function is faster, but slightly less accurate (about
   1 mas), than the eraC2i00a function.

### Called ###

- `eraPnm00b`: classical NPB matrix, IAU 2000B
- `eraC2ibpn`: celestial-to-intermediate matrix, given NPB matrix

### References ###

- "Expressions for the Celestial Intermediate Pole and Celestial
    Ephemeris Origin consistent with the IAU 2000A precession-
    nutation model", Astron.Astrophys. 400, 1145-1154
    (2003)

- n.b. The celestial ephemeris origin (CEO) was renamed "celestial
    intermediate origin" (CIO) by IAU 2006 Resolution 2.

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
c2i00b

"""
    c2i06a(a, b)

Form the celestial-to-intermediate matrix for a given date using the
IAU 2006 precession and IAU 2000A nutation models.

### Given ###

- `date1`, `date2`: TT as a 2-part Julian Date (Note 1)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 2)

### Notes ###

1. The TT date date1+date2 is a Julian Date, apportioned in any
   convenient way between the two arguments.  For example,
   JD(TT)=2450123.7 could be expressed in any of these ways,
   among others:

   | `date1`   |     `date2` |                    |
   |:----------|:------------|:-------------------|
   | 2450123.7 |         0.0 | JD method          |
   | 2451545.0 |     -1421.3 | J2000 method       |
   | 2400000.5 |     50123.2 | MJD method         |
   | 2450123.5 |         0.2 | date & time method |

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution
   is acceptable.  The J2000 method is best matched to the way
   the argument is handled internally and will deliver the
   optimum resolution.  The MJD method and the date & time methods
   are both good compromises between resolution and convenience.

2. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]

             =  RC2T * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

### Called ###

- `eraPnm06a`: classical NPB matrix, IAU 2006/2000A
- `eraBpn2xy`: extract CIP X,Y coordinates from NPB matrix
- `eraS06`: the CIO locator s, given X,Y, IAU 2006
- `eraC2ixys`: celestial-to-intermediate matrix, given X,Y and s

### References ###

- McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
    IERS Technical Note No. 32, BKG
"""
c2i06a

for name in ("c2i00a",
             "c2i00b",
             "c2i06a")
    f = Symbol(name)
    fc = "era" * uppercasefirst(name)
    @eval begin
        function ($f)(a, b)
            r = zeros((3, 3))
            ccall(($fc, liberfa), Cvoid,
                  (Cdouble, Cdouble, Ptr{Cdouble}),
                  a, b, r)
            r
        end
    end
end

"""
    c2ixy(x, y, s, t)

Form the celestial to intermediate-frame-of-date matrix for a given
date when the CIP X,Y coordinates are known.  IAU 2000.

### Given ###

- `date1`, `date2`: TT as a 2-part Julian Date (Note 1)
- `x`, `y`: Celestial Intermediate Pole (Note 2)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 3)

### Notes ###

1. The TT date date1+date2 is a Julian Date, apportioned in any
   convenient way between the two arguments.  For example,
   JD(TT)=2450123.7 could be expressed in any of these ways,
   among others:

   | `date1`   |     `date2` |                    |
   |:----------|:------------|:-------------------|
   | 2450123.7 |         0.0 | JD method          |
   | 2451545.0 |     -1421.3 | J2000 method       |
   | 2400000.5 |     50123.2 | MJD method         |
   | 2450123.5 |         0.2 | date & time method |

   The JD method is the most natural and convenient to use in
   cases where the loss of several decimal digits of resolution
   is acceptable.  The J2000 method is best matched to the way
   the argument is handled internally and will deliver the
   optimum resolution.  The MJD method and the date & time methods
   are both good compromises between resolution and convenience.

2. The Celestial Intermediate Pole coordinates are the x,y components
   of the unit vector in the Geocentric Celestial Reference System.

3. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]

            = RC2T * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

4. Although its name does not include "00", This function is in fact
   specific to the IAU 2000 models.

### Called ###

- `eraC2ixys`: celestial-to-intermediate matrix, given X,Y and s
- `eraS00`: the CIO locator s, given X,Y, IAU 2000A

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
function c2ixy(x, y, s, t)
    r = zeros((3, 3))
    ccall((:eraC2ixy, liberfa), Cvoid,
            (Cdouble, Cdouble, Cdouble, Cdouble, Ptr{Cdouble}),
            x, y, s, t, r)
    r
end

"""
    c2ixys(x, y, s)

Form the celestial to intermediate-frame-of-date matrix given the CIP
X,Y and the CIO locator s.

### Given ###

- `x`, `y`: Celestial Intermediate Pole (Note 1)
- `s`: The CIO locator s (Note 2)

### Returned ###

- `rc2i`: Celestial-to-intermediate matrix (Note 3)

### Notes ###

1. The Celestial Intermediate Pole coordinates are the x,y
   components of the unit vector in the Geocentric Celestial
   Reference System.

2. The CIO locator s (in radians) positions the Celestial
   Intermediate Origin on the equator of the CIP.

3. The matrix rc2i is the first stage in the transformation from
   celestial to terrestrial coordinates:

      [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]

            = RC2T * [CRS]

   where [CRS] is a vector in the Geocentric Celestial Reference
   System and [TRS] is a vector in the International Terrestrial
   Reference System (see IERS Conventions 2003), ERA is the Earth
   Rotation Angle and RPOM is the polar motion matrix.

### Called ###

- `eraIr`: initialize r-matrix to identity
- `eraRz`: rotate around Z-axis
- `eraRy`: rotate around Y-axis

### Reference ###

- McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
    IERS Technical Note No. 32, BKG (2004)
"""
function c2ixys(x, y, s)
    r = zeros((3, 3))
    ccall((:eraC2ixys, liberfa), Cvoid,
            (Cdouble, Cdouble, Cdouble, Ptr{Cdouble}),
            x, y, s, r)
    r
end


text:
# Autogenerated wrapper script for VOLK_jll for x86_64-linux-gnu-cxx11
export libvolk, list_cpu_features, volk_config_info, volk_profile

using boost_jll
JLLWrappers.@generate_wrapper_header("VOLK")
JLLWrappers.@declare_library_product(libvolk, "libvolk.so.2.5")
JLLWrappers.@declare_executable_product(list_cpu_features)
JLLWrappers.@declare_executable_product(volk_config_info)
JLLWrappers.@declare_executable_product(volk_profile)
function __init__()
    JLLWrappers.@generate_init_header(boost_jll)
    JLLWrappers.@init_library_product(
        libvolk,
        "lib/libvolk.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@init_executable_product(
        list_cpu_features,
        "bin/list_cpu_features",
    )

    JLLWrappers.@init_executable_product(
        volk_config_info,
        "bin/volk-config-info",
    )

    JLLWrappers.@init_executable_product(
        volk_profile,
        "bin/volk_profile",
    )

    JLLWrappers.@generate_init_footer()
end  # __init__()