kyosu v0.1.0
Complex Without Complexes
 
Loading...
Searching...
No Matches

◆ cosh

kyosu::cosh = eve::functor<cosh_t>
inlineconstexpr

Computes the hyperbolic cosine of the argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
template<eve::floating_ordered_value T> constexpr T cosh(T z) noexcept; //1
template<kyosu::concepts::complex T> constexpr T cosh(T z) noexcept; //2
template<kyosu::concepts::cayley_dickson T> constexpr T cosh(T z) noexcept; //3
}
constexpr auto cosh
Computes the hyperbolic cosine of the argument.
Definition: cosh.hpp:109
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  1. returns eve::cosh(z)
  2. Returns elementwise the complex value of the hyperbolic cosine of the input.
    • for every z: cosh(conj(z)) == conj(cosh(z))
    • for every z: cosh(-z) == cosh(z)
    • If z is \(0\), the result is \(1\)
    • If z is \(i \infty\), the result is \(\textrm{NaN}\)
    • If z is \(i \textrm{NaN}\), the result is \(\textrm{NaN}\)
    • If z is \(x+i \infty\) (for any finite non-zero x), the result is \(\textrm{NaN}+i \textrm{NaN}\)
    • If z is \(x+i \textrm{NaN}\) (for any finite non-zero x), the result is \(\textrm{NaN}+i \textrm{NaN}\)
    • If z is \(\infty+i 0\), the result is \(\infty+i 0\)
    • If z is \(\infty,y\) (for any finite non-zero y), the result is \(\infty e^{iy}\)
    • If z is \(\infty+i \infty\), the result is \(\pm \infty+i \textrm{NaN}\) (the sign of the real part is unspecified)
    • If z is \(\infty+i \textrm{NaN}\), the result is \(\infty+i \textrm{NaN}\)
    • If z is \(\textrm{NaN}\), the result is \(\textrm{NaN}\)
    • If z is \(\textrm{NaN}+i y\) (for any finite non-zero y), the result is \(\textrm{NaN}+i \textrm{NaN}\)
    • If z is \(\textrm{NaN}+i \textrm{NaN}\), the result is \(\textrm{NaN}+i \textrm{NaN}\)
  3. Is semantically equivalent to (exp(z)+exp(-z))/2.

External references

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::cos;
using e_t = float;
using we_t = eve::wide<e_t, eve::fixed<2>>;
using wc_t = eve::wide<c_t, eve::fixed<2>>;
using wq_t = eve::wide<q_t, eve::fixed<2>>;
std::cout << "Real: \n";
e_t e(2.9f);
we_t we = we_t(e);
std::cout << e << " -> " << cos(e) << "\n";
std::cout << we << " -> " << cos(we) << "\n";
std::cout << cos(c_t(e))<< "\n";
std::cout << cos(q_t(e))<< "\n";
std::cout << cos(wc_t(e))<< "\n";
std::cout << cos(wq_t(e))<< "\n";
std::cout << "Complex: \n";
c_t c(3.5f,-2.9f);
wc_t wc = wc_t(c);
std::cout << c << " -> " << cos(c) << "\n";
std::cout << wc << " -> " << cos(wc) << "\n";
std::cout << cos(q_t(c))<< "\n";
std::cout << cos(wq_t(c))<< "\n";
std::cout << "Quaternion: \n";
q_t q(3.5f,-2.9f, 2.1f, 3.2f);
wq_t wq = wq_t(q);
std::cout << q << " -> " << cos(q) << "\n";
std::cout << wq << " -> " << cos(wq) << "\n";
return 0;
}
constexpr auto cos
Computes the cosine of the argument.
Definition: cos.hpp:77
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:24
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27