CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
asinh.hpp
Go to the documentation of this file.
1 # ifndef CPPAD_CORE_ASINH_HPP
2 # define CPPAD_CORE_ASINH_HPP
3 
4 /* --------------------------------------------------------------------------
5 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
6 
7 CppAD is distributed under multiple licenses. This distribution is under
8 the terms of the
9  Eclipse Public License Version 1.0.
10 
11 A copy of this license is included in the COPYING file of this distribution.
12 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
13 -------------------------------------------------------------------------- */
14 
15 /*
16 -------------------------------------------------------------------------------
17 
18 $begin asinh$$
19 $spell
20  asinh
21  const
22  Vec
23  std
24  cmath
25  CppAD
26 $$
27 $section The Inverse Hyperbolic Sine Function: asinh$$
28 
29 $head Syntax$$
30 $icode%y% = asinh(%x%)%$$
31 
32 $head Description$$
33 The inverse hyperbolic sine function is defined by
34 $icode%x% == sinh(%y%)%$$.
35 
36 $head x, y$$
37 See the $cref/possible types/unary_standard_math/Possible Types/$$
38 for a unary standard math function.
39 
40 $head CPPAD_USE_CPLUSPLUS_2011$$
41 
42 $subhead true$$
43 If this preprocessor symbol is true ($code 1$$),
44 and $icode x$$ is an AD type,
45 this is an $cref/atomic operation/glossary/Operation/Atomic/$$.
46 
47 $subhead false$$
48 If this preprocessor symbol is false ($code 0$$),
49 CppAD uses the representation
50 $latex \[
51 \R{asinh} (x) = \log \left( x + \sqrt{ 1 + x^2 } \right)
52 \] $$
53 to compute this function.
54 
55 $head Example$$
56 $children%
57  example/general/asinh.cpp
58 %$$
59 The file
60 $cref asinh.cpp$$
61 contains an example and test of this function.
62 It returns true if it succeeds and false otherwise.
63 
64 $end
65 -------------------------------------------------------------------------------
66 */
67 # include <cppad/configure.hpp>
68 # if ! CPPAD_USE_CPLUSPLUS_2011
69 
70 // BEGIN CppAD namespace
71 namespace CppAD {
72 
73 template <class Type>
74 Type asinh_template(const Type &x)
75 { return CppAD::log( x + CppAD::sqrt( Type(1) + x * x ) );
76 }
77 
78 inline float asinh(const float &x)
79 { return asinh_template(x); }
80 
81 inline double asinh(const double &x)
82 { return asinh_template(x); }
83 
84 template <class Base>
85 inline AD<Base> asinh(const AD<Base> &x)
86 { return asinh_template(x); }
87 
88 template <class Base>
89 inline AD<Base> asinh(const VecAD_reference<Base> &x)
90 { return asinh_template( x.ADBase() ); }
91 
92 
93 } // END CppAD namespace
94 
95 # endif // CPPAD_USE_CPLUSPLUS_2011
96 # endif // CPPAD_ASINH_INCLUDED
AD< Base > log(const AD< Base > &x)
std::complex< double > asinh(const std::complex< double > &x)
AD< Base > sqrt(const AD< Base > &x)