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

◆ exp

kyosu::exp = eve::functor<exp_t>
inlineconstexpr

Computes the exponential of the argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

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

Parameters

  • z: Value to process.

Return value

  1. Returns the exponential of the argument, calling eve::exp.
  2. Returns the exponential of the complex input following IEEE standards:
    • for every z: exp(conj(z)) == conj(exp(z))
    • If z is \(\pm0\), the result is \(1\)
    • If z is \(x+i \infty\) (for any finite x), the result is \(\textrm{NaN}+i \textrm{NaN}\).
    • If z is \(x+i \textrm{NaN}\) (for any finite x), the result is \(\textrm{NaN}+i \textrm{NaN}\).
    • If z is \(+\infty+i 0\), the result is \(+\infty\)
    • If z is \(-\infty+i y\) (for any finite y), the result is \(+0 e^{iy}\).
    • If z is \(+\infty+i y\) (for any finite nonzero y), the result is \(+\infty e^{iy}\).
    • If z is \(-\infty+i \infty\), the result is \(\pm 0+i \pm 0\) (signs are unspecified)
    • If z is \(+\infty+i \pm\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 \(\pm 0+i \pm 0\) (signs are unspecified).
    • If z is \(\pm\infty+i \textrm{NaN}\), the result is \(\pm \infty+i \textrm{NaN}\) (the sign of the real part is unspecified).
    • If z is \(\textrm{NaN}\), the result is \(\textrm{NaN}\).
    • If z is \(\textrm{NaN}+i y\) (for any nonzero 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. Returns \(e^{z_0}(\cos|\underline{z}|+\underline{z}\; \mathop{sinc}|\underline{z}|)\)

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::exp;
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 << " -> " << exp(e) << "\n";
std::cout << we << " -> " << exp(we) << "\n";
std::cout << exp(c_t(e))<< "\n";
std::cout << exp(q_t(e))<< "\n";
std::cout << exp(wc_t(e))<< "\n";
std::cout << exp(wq_t(e))<< "\n";
std::cout << "Complex: \n";
c_t c(3.5f,-2.9f);
wc_t wc = wc_t(c);
std::cout << c << " -> " << exp(c) << "\n";
std::cout << wc << " -> " << exp(wc) << "\n";
std::cout << exp(q_t(c))<< "\n";
std::cout << exp(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 << " -> " << exp(q) << "\n";
std::cout << wq << " -> " << exp(wq) << "\n";
return 0;
}
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