Skip to content

Instantly share code, notes, and snippets.

@xenomancer
Created May 3, 2022 16:57
Show Gist options
  • Save xenomancer/6686a537cc8060cb57a1a54bcbd4bd49 to your computer and use it in GitHub Desktop.
Save xenomancer/6686a537cc8060cb57a1a54bcbd4bd49 to your computer and use it in GitHub Desktop.
Header only definition of additional trigonometric, hyperbolic, and respective inverse functions for the secant (sec), cosecant (csc), cotangent (cot), chord (crd), versed sine (versin), coversed sine (coversin), versed cosine (vercos), coversed cosine (covercos), half versed sine (haversin), half coversed sine (hacoversin), half versed cosine (…
// Copyright © Craig D. Mansfield, 2022, no rights reserved.
// This software is free and open source with no limitations, restrictions, or liability.
// Use it at your own risk.
// If you like this software then you can buy me a beer if we meet in the future.
#pragma once
#include <cmath>
#include <complex>
using namespace std;
// float
inline float secf(float x) { return (1 / cosf(x)); }
inline float cscf(float x) { return (1 / sinf(x)); }
inline float cotf(float x) { return (1 / tanf(x)); }
inline float crdf(float x) { return (2 * sinf(x / 2)); }
inline float versinf(float x) { return (1 - cosf(x)); }
inline float coversinf(float x) { return (1 - sinf(x)); }
inline float vercosf(float x) { return (1 + cosf(x)); }
inline float covercosf(float x) { return (1 + sinf(x)); }
inline float haversinf(float x) { return ((1 - cosf(x)) / 2); }
inline float hacoversinf(float x) { return ((1 - sinf(x)) / 2); }
inline float havercosf(float x) { return ((1 + cosf(x)) / 2); }
inline float hacovercosf(float x) { return ((1 + sinf(x)) / 2); }
inline float exsecf(float x) { return (secf(x) - 1); }
inline float excscf(float x) { return (cscf(x) - 1); }
inline float asecf(float x) { return acosf(1 / x); }
inline float acscf(float x) { return asinf(1 / x); }
inline float acotf(float x) { return atanf(1 / x); }
inline float acrdf(float x) { return (2 * asinf(x / 2)); }
inline float aversinf(float x) { return acosf(1 - x); }
inline float acoversinf(float x) { return asinf(1 - x); }
inline float avercosf(float x) { return acosf(x - 1); }
inline float acovercosf(float x) { return asinf(x - 1); }
inline float ahaversinf(float x) { return acosf(1 - 2 * x); }
inline float ahacoversinf(float x) { return asinf(1 - 2 * x); }
inline float ahavercosf(float x) { return acosf(2 * x - 1); }
inline float ahacovercosf(float x) { return asinf(2 * x - 1); }
inline float aexsecf(float x) { return asecf(x + 1); }
inline float aexcscf(float x) { return acscf(x + 1); }
inline float sechf(float x) { return (1 / coshf(x)); }
inline float cschf(float x) { return (1 / sinhf(x)); }
inline float cothf(float x) { return (1 / tanhf(x)); }
inline float crdhf(float x) { return (2 * sinhf(x / 2)); }
inline float versinhf(float x) { return (1 - coshf(x)); }
inline float coversinhf(float x) { return (1 - sinhf(x)); }
inline float vercoshf(float x) { return (1 + coshf(x)); }
inline float covercoshf(float x) { return (1 + sinhf(x)); }
inline float haversinhf(float x) { return ((1 - coshf(x)) / 2); }
inline float hacoversinhf(float x) { return ((1 - sinhf(x)) / 2); }
inline float havercoshf(float x) { return ((1 + coshf(x)) / 2); }
inline float hacovercoshf(float x) { return ((1 + sinhf(x)) / 2); }
inline float exsechf(float x) { return (sechf(x) - 1); }
inline float excschf(float x) { return (cschf(x) - 1); }
inline float asechf(float x) { return acoshf(1 / x); }
inline float acschf(float x) { return asinhf(1 / x); }
inline float acothf(float x) { return atanhf(1 / x); }
inline float acrdhf(float x) { return (2 * asinhf(x / 2)); }
inline float aversinhf(float x) { return acoshf(1 - x); }
inline float acoversinhf(float x) { return asinhf(1 - x); }
inline float avercoshf(float x) { return acoshf(x - 1); }
inline float acovercoshf(float x) { return asinhf(x - 1); }
inline float ahaversinhf(float x) { return acoshf(1 - 2 * x); }
inline float ahacoversinhf(float x) { return asinhf(1 - 2 * x); }
inline float ahavercoshf(float x) { return acoshf(2 * x - 1); }
inline float ahacovercoshf(float x) { return asinhf(2 * x - 1); }
inline float aexsechf(float x) { return asechf(x + 1); }
inline float aexcschf(float x) { return acschf(x + 1); }
// double
inline double sec(double x) { return (1 / cos(x)); }
inline double csc(double x) { return (1 / sin(x)); }
inline double cot(double x) { return (1 / tan(x)); }
inline double crd(double x) { return (2 * sin(x / 2)); }
inline double versin(double x) { return (1 - cos(x)); }
inline double coversin(double x) { return (1 - sin(x)); }
inline double vercos(double x) { return (1 + cos(x)); }
inline double covercos(double x) { return (1 + sin(x)); }
inline double haversin(double x) { return ((1 - cos(x)) / 2); }
inline double hacoversin(double x) { return ((1 - sin(x)) / 2); }
inline double havercos(double x) { return ((1 + cos(x)) / 2); }
inline double hacovercos(double x) { return ((1 + sin(x)) / 2); }
inline double exsec(double x) { return (sec(x) - 1); }
inline double excsc(double x) { return (csc(x) - 1); }
inline double asec(double x) { return acos(1 / x); }
inline double acsc(double x) { return asin(1 / x); }
inline double acot(double x) { return atan(1 / x); }
inline double acrd(double x) { return (2 * asin(x / 2)); }
inline double aversin(double x) { return acos(1 - x); }
inline double acoversin(double x) { return asin(1 - x); }
inline double avercos(double x) { return acos(x - 1); }
inline double acovercos(double x) { return asin(x - 1); }
inline double ahaversin(double x) { return acos(1 - 2 * x); }
inline double ahacoversin(double x) { return asin(1 - 2 * x); }
inline double ahavercos(double x) { return acos(2 * x - 1); }
inline double ahacovercos(double x) { return asin(2 * x - 1); }
inline double aexsec(double x) { return asec(x + 1); }
inline double aexcsc(double x) { return acsc(x + 1); }
inline double sech(double x) { return (1 / cosh(x)); }
inline double csch(double x) { return (1 / sinh(x)); }
inline double coth(double x) { return (1 / tanh(x)); }
inline double crdh(double x) { return (2 * sinh(x / 2)); }
inline double versinh(double x) { return (1 - cosh(x)); }
inline double coversinh(double x) { return (1 - sinh(x)); }
inline double vercosh(double x) { return (1 + cosh(x)); }
inline double covercosh(double x) { return (1 + sinh(x)); }
inline double haversinh(double x) { return ((1 - cosh(x)) / 2); }
inline double hacoversinh(double x) { return ((1 - sinh(x)) / 2); }
inline double havercosh(double x) { return ((1 + cosh(x)) / 2); }
inline double hacovercosh(double x) { return ((1 + sinh(x)) / 2); }
inline double exsech(double x) { return (sech(x) - 1); }
inline double excsch(double x) { return (csch(x) - 1); }
inline double asech(double x) { return acosh(1 / x); }
inline double acsch(double x) { return asinh(1 / x); }
inline double acoth(double x) { return atanh(1 / x); }
inline double acrdh(double x) { return (2 * asinh(x / 2)); }
inline double aversinh(double x) { return acosh(1 - x); }
inline double acoversinh(double x) { return asinh(1 - x); }
inline double avercosh(double x) { return acosh(x - 1); }
inline double acovercosh(double x) { return asinh(x - 1); }
inline double ahaversinh(double x) { return acosh(1 - 2 * x); }
inline double ahacoversinh(double x) { return asinh(1 - 2 * x); }
inline double ahavercosh(double x) { return acosh(2 * x - 1); }
inline double ahacovercosh(double x) { return asinh(2 * x - 1); }
inline double aexsech(double x) { return asech(x + 1); }
inline double aexcsch(double x) { return acsch(x + 1); }
// long double
inline long double secl(long double x) { return (1 / cosl(x)); }
inline long double cscl(long double x) { return (1 / sinl(x)); }
inline long double cotl(long double x) { return (1 / tanl(x)); }
inline long double crdl(long double x) { return (2 * sinl(x / 2)); }
inline long double versinl(long double x) { return (1 - cosl(x)); }
inline long double coversinl(long double x) { return (1 - sinl(x)); }
inline long double vercosl(long double x) { return (1 + cosl(x)); }
inline long double covercosl(long double x) { return (1 + sinl(x)); }
inline long double haversinl(long double x) { return ((1 - cosl(x)) / 2); }
inline long double hacoversinl(long double x) { return ((1 - sinl(x)) / 2); }
inline long double havercosl(long double x) { return ((1 + cosl(x)) / 2); }
inline long double hacovercosl(long double x) { return ((1 + sinl(x)) / 2); }
inline long double exsecl(long double x) { return (secl(x) - 1); }
inline long double excscl(long double x) { return (cscl(x) - 1); }
inline long double asecl(long double x) { return acosl(1 / x); }
inline long double acscl(long double x) { return asinl(1 / x); }
inline long double acotl(long double x) { return atanl(1 / x); }
inline long double acrdl(long double x) { return (2 * asinl(x / 2)); }
inline long double aversinl(long double x) { return acosl(1 - x); }
inline long double acoversinl(long double x) { return asinl(1 - x); }
inline long double avercosl(long double x) { return acosl(x - 1); }
inline long double acovercosl(long double x) { return asinl(x - 1); }
inline long double ahaversinl(long double x) { return acosl(1 - 2 * x); }
inline long double ahacoversinl(long double x) { return asinl(1 - 2 * x); }
inline long double ahavercosl(long double x) { return acosl(2 * x - 1); }
inline long double ahacovercosl(long double x) { return asinl(2 * x - 1); }
inline long double aexsecl(long double x) { return asecl(x + 1); }
inline long double aexcscl(long double x) { return acscl(x + 1); }
inline long double sechl(long double x) { return (1 / coshl(x)); }
inline long double cschl(long double x) { return (1 / sinhl(x)); }
inline long double cothl(long double x) { return (1 / tanhl(x)); }
inline long double crdhl(long double x) { return (2 * sinhl(x / 2)); }
inline long double versinhl(long double x) { return (1 - coshl(x)); }
inline long double coversinhl(long double x) { return (1 - sinhl(x)); }
inline long double vercoshl(long double x) { return (1 + coshl(x)); }
inline long double covercoshl(long double x) { return (1 + sinhl(x)); }
inline long double haversinhl(long double x) { return ((1 - coshl(x)) / 2); }
inline long double hacoversinhl(long double x) { return ((1 - sinhl(x)) / 2); }
inline long double havercoshl(long double x) { return ((1 + coshl(x)) / 2); }
inline long double hacovercoshl(long double x) { return ((1 + sinhl(x)) / 2); }
inline long double exsechl(long double x) { return (sechl(x) - 1); }
inline long double excschl(long double x) { return (cschl(x) - 1); }
inline long double asechl(long double x) { return acoshl(1 / x); }
inline long double acschl(long double x) { return asinhl(1 / x); }
inline long double acothl(long double x) { return atanhl(1 / x); }
inline long double acrdhl(long double x) { return (2 * asinhl(x / 2)); }
inline long double aversinhl(long double x) { return acoshl(1 - x); }
inline long double acoversinhl(long double x) { return asinhl(1 - x); }
inline long double avercoshl(long double x) { return acoshl(x - 1); }
inline long double acovercoshl(long double x) { return asinhl(x - 1); }
inline long double ahaversinhl(long double x) { return acoshl(1 - 2 * x); }
inline long double ahacoversinhl(long double x) { return asinhl(1 - 2 * x); }
inline long double ahavercoshl(long double x) { return acoshl(2 * x - 1); }
inline long double ahacovercoshl(long double x) { return asinhl(2 * x - 1); }
inline long double aexsechl(long double x) { return asechl(x + 1); }
inline long double aexcschl(long double x) { return acschl(x + 1); }
// complex<float>
inline complex<float> sec(complex<float> x) { return (1 / cos(x)); }
inline complex<float> csc(complex<float> x) { return (1 / sin(x)); }
inline complex<float> cot(complex<float> x) { return (1 / tan(x)); }
inline complex<float> crd(complex<float> x) { return (2 * sin(x / 2)); }
inline complex<float> versin(complex<float> x) { return (1 - cos(x)); }
inline complex<float> coversin(complex<float> x) { return (1 - sin(x)); }
inline complex<float> vercos(complex<float> x) { return (1 + cos(x)); }
inline complex<float> covercos(complex<float> x) { return (1 + sin(x)); }
inline complex<float> haversin(complex<float> x) { return ((1 - cos(x)) / 2); }
inline complex<float> hacoversin(complex<float> x) { return ((1 - sin(x)) / 2); }
inline complex<float> havercos(complex<float> x) { return ((1 + cos(x)) / 2); }
inline complex<float> hacovercos(complex<float> x) { return ((1 + sin(x)) / 2); }
inline complex<float> exsec(complex<float> x) { return (sec(x) - 1); }
inline complex<float> excsc(complex<float> x) { return (csc(x) - 1); }
inline complex<float> asec(complex<float> x) { return acos(1 / x); }
inline complex<float> acsc(complex<float> x) { return asin(1 / x); }
inline complex<float> acot(complex<float> x) { return atan(1 / x); }
inline complex<float> acrd(complex<float> x) { return (2 * asin(x / 2)); }
inline complex<float> aversin(complex<float> x) { return acos(1 - x); }
inline complex<float> acoversin(complex<float> x) { return asin(1 - x); }
inline complex<float> avercos(complex<float> x) { return acos(x - 1); }
inline complex<float> acovercos(complex<float> x) { return asin(x - 1); }
inline complex<float> ahaversin(complex<float> x) { return acos(1 - 2 * x); }
inline complex<float> ahacoversin(complex<float> x) { return asin(1 - 2 * x); }
inline complex<float> ahavercos(complex<float> x) { return acos(2 * x - 1); }
inline complex<float> ahacovercos(complex<float> x) { return asin(2 * x - 1); }
inline complex<float> aexsec(complex<float> x) { return asec(x + 1); }
inline complex<float> aexcsc(complex<float> x) { return acsc(x + 1); }
inline complex<float> sech(complex<float> x) { return (1 / cosh(x)); }
inline complex<float> csch(complex<float> x) { return (1 / sinh(x)); }
inline complex<float> coth(complex<float> x) { return (1 / tanh(x)); }
inline complex<float> crdh(complex<float> x) { return (2 * sinh(x / 2)); }
inline complex<float> versinh(complex<float> x) { return (1 - cosh(x)); }
inline complex<float> coversinh(complex<float> x) { return (1 - sinh(x)); }
inline complex<float> vercosh(complex<float> x) { return (1 + cosh(x)); }
inline complex<float> covercosh(complex<float> x) { return (1 + sinh(x)); }
inline complex<float> haversinh(complex<float> x) { return ((1 - cosh(x)) / 2); }
inline complex<float> hacoversinh(complex<float> x) { return ((1 - sinh(x)) / 2); }
inline complex<float> havercosh(complex<float> x) { return ((1 + cosh(x)) / 2); }
inline complex<float> hacovercosh(complex<float> x) { return ((1 + sinh(x)) / 2); }
inline complex<float> exsech(complex<float> x) { return (sech(x) - 1); }
inline complex<float> excsch(complex<float> x) { return (csch(x) - 1); }
inline complex<float> asech(complex<float> x) { return acosh(1 / x); }
inline complex<float> acsch(complex<float> x) { return asinh(1 / x); }
inline complex<float> acoth(complex<float> x) { return atanh(1 / x); }
inline complex<float> acrdh(complex<float> x) { return (2 * asinh(x / 2)); }
inline complex<float> aversinh(complex<float> x) { return acosh(1 - x); }
inline complex<float> acoversinh(complex<float> x) { return asinh(1 - x); }
inline complex<float> avercosh(complex<float> x) { return acosh(x - 1); }
inline complex<float> acovercosh(complex<float> x) { return asinh(x - 1); }
inline complex<float> ahaversinh(complex<float> x) { return acosh(1 - 2 * x); }
inline complex<float> ahacoversinh(complex<float> x) { return asinh(1 - 2 * x); }
inline complex<float> ahavercosh(complex<float> x) { return acosh(2 * x - 1); }
inline complex<float> ahacovercosh(complex<float> x) { return asinh(2 * x - 1); }
inline complex<float> aexsech(complex<float> x) { return asech(x + 1); }
inline complex<float> aexcsch(complex<float> x) { return acsch(x + 1); }
// complex<double>
inline complex<double> sec(complex<double> x) { return (1 / cos(x)); }
inline complex<double> csc(complex<double> x) { return (1 / sin(x)); }
inline complex<double> cot(complex<double> x) { return (1 / tan(x)); }
inline complex<double> crd(complex<double> x) { return (2 * sin(x / 2)); }
inline complex<double> versin(complex<double> x) { return (1 - cos(x)); }
inline complex<double> coversin(complex<double> x) { return (1 - sin(x)); }
inline complex<double> vercos(complex<double> x) { return (1 + cos(x)); }
inline complex<double> covercos(complex<double> x) { return (1 + sin(x)); }
inline complex<double> haversin(complex<double> x) { return ((1 - cos(x)) / 2); }
inline complex<double> hacoversin(complex<double> x) { return ((1 - sin(x)) / 2); }
inline complex<double> havercos(complex<double> x) { return ((1 + cos(x)) / 2); }
inline complex<double> hacovercos(complex<double> x) { return ((1 + sin(x)) / 2); }
inline complex<double> exsec(complex<double> x) { return (sec(x) - 1); }
inline complex<double> excsc(complex<double> x) { return (csc(x) - 1); }
inline complex<double> asec(complex<double> x) { return acos(1 / x); }
inline complex<double> acsc(complex<double> x) { return asin(1 / x); }
inline complex<double> acot(complex<double> x) { return atan(1 / x); }
inline complex<double> acrd(complex<double> x) { return (2 * asin(x / 2)); }
inline complex<double> aversin(complex<double> x) { return acos(1 - x); }
inline complex<double> acoversin(complex<double> x) { return asin(1 - x); }
inline complex<double> avercos(complex<double> x) { return acos(x - 1); }
inline complex<double> acovercos(complex<double> x) { return asin(x - 1); }
inline complex<double> ahaversin(complex<double> x) { return acos(1 - 2 * x); }
inline complex<double> ahacoversin(complex<double> x) { return asin(1 - 2 * x); }
inline complex<double> ahavercos(complex<double> x) { return acos(2 * x - 1); }
inline complex<double> ahacovercos(complex<double> x) { return asin(2 * x - 1); }
inline complex<double> aexsec(complex<double> x) { return asec(x + 1); }
inline complex<double> aexcsc(complex<double> x) { return acsc(x + 1); }
inline complex<double> sech(complex<double> x) { return (1 / cosh(x)); }
inline complex<double> csch(complex<double> x) { return (1 / sinh(x)); }
inline complex<double> coth(complex<double> x) { return (1 / tanh(x)); }
inline complex<double> crdh(complex<double> x) { return (2 * sinh(x / 2)); }
inline complex<double> versinh(complex<double> x) { return (1 - cosh(x)); }
inline complex<double> coversinh(complex<double> x) { return (1 - sinh(x)); }
inline complex<double> vercosh(complex<double> x) { return (1 + cosh(x)); }
inline complex<double> covercosh(complex<double> x) { return (1 + sinh(x)); }
inline complex<double> haversinh(complex<double> x) { return ((1 - cosh(x)) / 2); }
inline complex<double> hacoversinh(complex<double> x) { return ((1 - sinh(x)) / 2); }
inline complex<double> havercosh(complex<double> x) { return ((1 + cosh(x)) / 2); }
inline complex<double> hacovercosh(complex<double> x) { return ((1 + sinh(x)) / 2); }
inline complex<double> exsech(complex<double> x) { return (sech(x) - 1); }
inline complex<double> excsch(complex<double> x) { return (csch(x) - 1); }
inline complex<double> asech(complex<double> x) { return acosh(1 / x); }
inline complex<double> acsch(complex<double> x) { return asinh(1 / x); }
inline complex<double> acoth(complex<double> x) { return atanh(1 / x); }
inline complex<double> acrdh(complex<double> x) { return (2 * asinh(x / 2)); }
inline complex<double> aversinh(complex<double> x) { return acosh(1 - x); }
inline complex<double> acoversinh(complex<double> x) { return asinh(1 - x); }
inline complex<double> avercosh(complex<double> x) { return acosh(x - 1); }
inline complex<double> acovercosh(complex<double> x) { return asinh(x - 1); }
inline complex<double> ahaversinh(complex<double> x) { return acosh(1 - 2 * x); }
inline complex<double> ahacoversinh(complex<double> x) { return asinh(1 - 2 * x); }
inline complex<double> ahavercosh(complex<double> x) { return acosh(2 * x - 1); }
inline complex<double> ahacovercosh(complex<double> x) { return asinh(2 * x - 1); }
inline complex<double> aexsech(complex<double> x) { return asech(x + 1); }
inline complex<double> aexcsch(complex<double> x) { return acsch(x + 1); }
// complex<long double>
inline complex<long double> sec(complex<long double> x) { return (1 / cos(x)); }
inline complex<long double> csc(complex<long double> x) { return (1 / sin(x)); }
inline complex<long double> cot(complex<long double> x) { return (1 / tan(x)); }
inline complex<long double> crd(complex<long double> x) { return (2 * sin(x / 2)); }
inline complex<long double> versin(complex<long double> x) { return (1 - cos(x)); }
inline complex<long double> coversin(complex<long double> x) { return (1 - sin(x)); }
inline complex<long double> vercos(complex<long double> x) { return (1 + cos(x)); }
inline complex<long double> covercos(complex<long double> x) { return (1 + sin(x)); }
inline complex<long double> haversin(complex<long double> x) { return ((1 - cos(x)) / 2); }
inline complex<long double> hacoversin(complex<long double> x) { return ((1 - sin(x)) / 2); }
inline complex<long double> havercos(complex<long double> x) { return ((1 + cos(x)) / 2); }
inline complex<long double> hacovercos(complex<long double> x) { return ((1 + sin(x)) / 2); }
inline complex<long double> exsec(complex<long double> x) { return (sec(x) - 1); }
inline complex<long double> excsc(complex<long double> x) { return (csc(x) - 1); }
inline complex<long double> asec(complex<long double> x) { return acos(1 / x); }
inline complex<long double> acsc(complex<long double> x) { return asin(1 / x); }
inline complex<long double> acot(complex<long double> x) { return atan(1 / x); }
inline complex<long double> acrd(complex<long double> x) { return (2 * asin(x / 2)); }
inline complex<long double> aversin(complex<long double> x) { return acos(1 - x); }
inline complex<long double> acoversin(complex<long double> x) { return asin(1 - x); }
inline complex<long double> avercos(complex<long double> x) { return acos(x - 1); }
inline complex<long double> acovercos(complex<long double> x) { return asin(x - 1); }
inline complex<long double> ahaversin(complex<long double> x) { return acos(1 - 2 * x); }
inline complex<long double> ahacoversin(complex<long double> x) { return asin(1 - 2 * x); }
inline complex<long double> ahavercos(complex<long double> x) { return acos(2 * x - 1); }
inline complex<long double> ahacovercos(complex<long double> x) { return asin(2 * x - 1); }
inline complex<long double> aexsec(complex<long double> x) { return asec(x + 1); }
inline complex<long double> aexcsc(complex<long double> x) { return acsc(x + 1); }
inline complex<long double> sech(complex<long double> x) { return (1 / cosh(x)); }
inline complex<long double> csch(complex<long double> x) { return (1 / sinh(x)); }
inline complex<long double> coth(complex<long double> x) { return (1 / tanh(x)); }
inline complex<long double> crdh(complex<long double> x) { return (2 * sinh(x / 2)); }
inline complex<long double> versinh(complex<long double> x) { return (1 - cosh(x)); }
inline complex<long double> coversinh(complex<long double> x) { return (1 - sinh(x)); }
inline complex<long double> vercosh(complex<long double> x) { return (1 + cosh(x)); }
inline complex<long double> covercosh(complex<long double> x) { return (1 + sinh(x)); }
inline complex<long double> haversinh(complex<long double> x) { return ((1 - cosh(x)) / 2); }
inline complex<long double> hacoversinh(complex<long double> x) { return ((1 - sinh(x)) / 2); }
inline complex<long double> havercosh(complex<long double> x) { return ((1 + cosh(x)) / 2); }
inline complex<long double> hacovercosh(complex<long double> x) { return ((1 + sinh(x)) / 2); }
inline complex<long double> exsech(complex<long double> x) { return (sech(x) - 1); }
inline complex<long double> excsch(complex<long double> x) { return (csch(x) - 1); }
inline complex<long double> asech(complex<long double> x) { return acosh(1 / x); }
inline complex<long double> acsch(complex<long double> x) { return asinh(1 / x); }
inline complex<long double> acoth(complex<long double> x) { return atanh(1 / x); }
inline complex<long double> acrdh(complex<long double> x) { return (2 * asinh(x / 2)); }
inline complex<long double> aversinh(complex<long double> x) { return acosh(1 - x); }
inline complex<long double> acoversinh(complex<long double> x) { return asinh(1 - x); }
inline complex<long double> avercosh(complex<long double> x) { return acosh(x - 1); }
inline complex<long double> acovercosh(complex<long double> x) { return asinh(x - 1); }
inline complex<long double> ahaversinh(complex<long double> x) { return acosh(1 - 2 * x); }
inline complex<long double> ahacoversinh(complex<long double> x) { return asinh(1 - 2 * x); }
inline complex<long double> ahavercosh(complex<long double> x) { return acosh(2 * x - 1); }
inline complex<long double> ahacovercosh(complex<long double> x) { return asinh(2 * x - 1); }
inline complex<long double> aexsech(complex<long double> x) { return asech(x + 1); }
inline complex<long double> aexcsch(complex<long double> x) { return acsch(x + 1); }
// complex<T>
template <typename T> complex<T> sec(const complex<T>& x) { return (T(1) / cos(x)); }
template <typename T> complex<T> csc(const complex<T>& x) { return (T(1) / sin(x)); }
template <typename T> complex<T> cot(const complex<T>& x) { return (T(1) / tan(x)); }
template <typename T> complex<T> crd(const complex<T>& x) { return (T(2) * sin(x / T(2))); }
template <typename T> complex<T> versin(const complex<T>& x) { return (T(1) - cos(x)); }
template <typename T> complex<T> coversin(const complex<T>& x) { return (T(1) - sin(x)); }
template <typename T> complex<T> vercos(const complex<T>& x) { return (T(1) + cos(x)); }
template <typename T> complex<T> covercos(const complex<T>& x) { return (T(1) + sin(x)); }
template <typename T> complex<T> haversin(const complex<T>& x) { return ((T(1) - cos(x)) / T(2)); }
template <typename T> complex<T> hacoversin(const complex<T>& x) { return ((T(1) - sin(x)) / T(2)); }
template <typename T> complex<T> havercos(const complex<T>& x) { return ((T(1) + cos(x)) / T(2)); }
template <typename T> complex<T> hacovercos(const complex<T>& x) { return ((T(1) + sin(x)) / T(2)); }
template <typename T> complex<T> exsec(const complex<T>& x) { return (sec(x) - T(1)); }
template <typename T> complex<T> excsc(const complex<T>& x) { return (csc(x) - T(1)); }
template <typename T> complex<T> asec(const complex<T>& x) { return acos(T(1) / x); }
template <typename T> complex<T> acsc(const complex<T>& x) { return asin(T(1) / x); }
template <typename T> complex<T> acot(const complex<T>& x) { return atan(T(1) / x); }
template <typename T> complex<T> acrd(const complex<T>& x) { return (T(2) * asin(x / T(2))); }
template <typename T> complex<T> aversin(const complex<T>& x) { return acos(T(1) - x); }
template <typename T> complex<T> acoversin(const complex<T>& x) { return asin(T(1) - x); }
template <typename T> complex<T> avercos(const complex<T>& x) { return acos(x - T(1)); }
template <typename T> complex<T> acovercos(const complex<T>& x) { return asin(x - T(1)); }
template <typename T> complex<T> ahaversin(const complex<T>& x) { return acos(T(1) - T(2) * x); }
template <typename T> complex<T> ahacoversin(const complex<T>& x) { return asin(T(1) - T(2) * x); }
template <typename T> complex<T> ahavercos(const complex<T>& x) { return acos(T(2) * x - T(1)); }
template <typename T> complex<T> ahacovercos(const complex<T>& x) { return asin(T(2) * x - T(1)); }
template <typename T> complex<T> aexsec(const complex<T>& x) { return asec(x + T(1)); }
template <typename T> complex<T> aexcsc(const complex<T>& x) { return acsc(x + T(1)); }
template <typename T> complex<T> sech(const complex<T>& x) { return (T(1) / cosh(x)); }
template <typename T> complex<T> csch(const complex<T>& x) { return (T(1) / sinh(x)); }
template <typename T> complex<T> coth(const complex<T>& x) { return (T(1) / tanh(x)); }
template <typename T> complex<T> crdh(const complex<T>& x) { return (T(2) * sinh(x / T(2))); }
template <typename T> complex<T> versinh(const complex<T>& x) { return (T(1) - cosh(x)); }
template <typename T> complex<T> coversinh(const complex<T>& x) { return (T(1) - sinh(x)); }
template <typename T> complex<T> vercosh(const complex<T>& x) { return (T(1) + cosh(x)); }
template <typename T> complex<T> covercosh(const complex<T>& x) { return (T(1) + sinh(x)); }
template <typename T> complex<T> haversinh(const complex<T>& x) { return ((T(1) - cosh(x)) / T(2)); }
template <typename T> complex<T> hacoversinh(const complex<T>& x) { return ((T(1) - sinh(x)) / T(2)); }
template <typename T> complex<T> havercosh(const complex<T>& x) { return ((T(1) + cosh(x)) / T(2)); }
template <typename T> complex<T> hacovercosh(const complex<T>& x) { return ((T(1) + sinh(x)) / T(2)); }
template <typename T> complex<T> exsech(const complex<T>& x) { return (sech(x) - T(1)); }
template <typename T> complex<T> excsch(const complex<T>& x) { return (csch(x) - T(1)); }
template <typename T> complex<T> asech(const complex<T>& x) { return acosh(T(1) / x); }
template <typename T> complex<T> acsch(const complex<T>& x) { return asinh(T(1) / x); }
template <typename T> complex<T> acoth(const complex<T>& x) { return atanh(T(1) / x); }
template <typename T> complex<T> acrdh(const complex<T>& x) { return (T(2) * asinh(x / T(2))); }
template <typename T> complex<T> aversinh(const complex<T>& x) { return acosh(T(1) - x); }
template <typename T> complex<T> acoversinh(const complex<T>& x) { return asinh(T(1) - x); }
template <typename T> complex<T> avercosh(const complex<T>& x) { return acosh(x - T(1)); }
template <typename T> complex<T> acovercosh(const complex<T>& x) { return asinh(x - T(1)); }
template <typename T> complex<T> ahaversinh(const complex<T>& x) { return acosh(T(1) - T(2) * x); }
template <typename T> complex<T> ahacoversinh(const complex<T>& x) { return asinh(T(1) - T(2) * x); }
template <typename T> complex<T> ahavercosh(const complex<T>& x) { return acosh(T(2) * x - T(1)); }
template <typename T> complex<T> ahacovercosh(const complex<T>& x) { return asinh(T(2) * x - T(1)); }
template <typename T> complex<T> aexsech(const complex<T>& x) { return asech(x + T(1)); }
template <typename T> complex<T> aexcsch(const complex<T>& x) { return acsch(x + T(1)); }
// T
template <typename T> T sec(const T& x) { return (T(1) / cos(x)); }
template <typename T> T csc(const T& x) { return (T(1) / sin(x)); }
template <typename T> T cot(const T& x) { return (T(1) / tan(x)); }
template <typename T> T crd(const T& x) { return (T(2) * sin(x / T(2))); }
template <typename T> T versin(const T& x) { return (T(1) - cos(x)); }
template <typename T> T coversin(const T& x) { return (T(1) - sin(x)); }
template <typename T> T vercos(const T& x) { return (T(1) + cos(x)); }
template <typename T> T covercos(const T& x) { return (T(1) + sin(x)); }
template <typename T> T haversin(const T& x) { return ((T(1) - cos(x)) / T(2)); }
template <typename T> T hacoversin(const T& x) { return ((T(1) - sin(x)) / T(2)); }
template <typename T> T havercos(const T& x) { return ((T(1) + cos(x)) / T(2)); }
template <typename T> T hacovercos(const T& x) { return ((T(1) + sin(x)) / T(2)); }
template <typename T> T exsec(const T& x) { return (sec(x) - T(1)); }
template <typename T> T excsc(const T& x) { return (csc(x) - T(1)); }
template <typename T> T asec(const T& x) { return acos(T(1) / x); }
template <typename T> T acsc(const T& x) { return asin(T(1) / x); }
template <typename T> T acot(const T& x) { return atan(T(1) / x); }
template <typename T> T acrd(const T& x) { return (T(2) * asin(x / T(2))); }
template <typename T> T aversin(const T& x) { return acos(T(1) - x); }
template <typename T> T acoversin(const T& x) { return asin(T(1) - x); }
template <typename T> T avercos(const T& x) { return acos(x - T(1)); }
template <typename T> T acovercos(const T& x) { return asin(x - T(1)); }
template <typename T> T ahaversin(const T& x) { return acos(T(1) - T(2) * x); }
template <typename T> T ahacoversin(const T& x) { return asin(T(1) - T(2) * x); }
template <typename T> T ahavercos(const T& x) { return acos(T(2) * x - T(1)); }
template <typename T> T ahacovercos(const T& x) { return asin(T(2) * x - T(1)); }
template <typename T> T aexsec(const T& x) { return asec(x + T(1)); }
template <typename T> T aexcsc(const T& x) { return acsc(x + T(1)); }
template <typename T> T sech(const T& x) { return (T(1) / cosh(x)); }
template <typename T> T csch(const T& x) { return (T(1) / sinh(x)); }
template <typename T> T coth(const T& x) { return (T(1) / tanh(x)); }
template <typename T> T crdh(const T& x) { return (T(2) * sinh(x / T(2))); }
template <typename T> T versinh(const T& x) { return (T(1) - cosh(x)); }
template <typename T> T coversinh(const T& x) { return (T(1) - sinh(x)); }
template <typename T> T vercosh(const T& x) { return (T(1) + cosh(x)); }
template <typename T> T covercosh(const T& x) { return (T(1) + sinh(x)); }
template <typename T> T haversinh(const T& x) { return ((T(1) - cosh(x)) / T(2)); }
template <typename T> T hacoversinh(const T& x) { return ((T(1) - sinh(x)) / T(2)); }
template <typename T> T havercosh(const T& x) { return ((T(1) + cosh(x)) / T(2)); }
template <typename T> T hacovercosh(const T& x) { return ((T(1) + sinh(x)) / T(2)); }
template <typename T> T exsech(const T& x) { return (sech(x) - T(1)); }
template <typename T> T excsch(const T& x) { return (csch(x) - T(1)); }
template <typename T> T asech(const T& x) { return acosh(T(1) / x); }
template <typename T> T acsch(const T& x) { return asinh(T(1) / x); }
template <typename T> T acoth(const T& x) { return atanh(T(1) / x); }
template <typename T> T acrdh(const T& x) { return (T(2) * asinh(x / T(2))); }
template <typename T> T aversinh(const T& x) { return acosh(T(1) - x); }
template <typename T> T acoversinh(const T& x) { return asinh(T(1) - x); }
template <typename T> T avercosh(const T& x) { return acosh(x - T(1)); }
template <typename T> T acovercosh(const T& x) { return asinh(x - T(1)); }
template <typename T> T ahaversinh(const T& x) { return acosh(T(1) - T(2) * x); }
template <typename T> T ahacoversinh(const T& x) { return asinh(T(1) - T(2) * x); }
template <typename T> T ahavercosh(const T& x) { return acosh(T(2) * x - T(1)); }
template <typename T> T ahacovercosh(const T& x) { return asinh(T(2) * x - T(1)); }
template <typename T> T aexsech(const T& x) { return asech(x + T(1)); }
template <typename T> T aexcsch(const T& x) { return acsch(x + T(1)); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment