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

◆ acos

auto kyosu::acos = eve::functor<acos_t>
inlineconstexpr

Computes the arc cosine of the argument.

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace kyosu
{
// regular call
constexpr auto acos(cayley_dickson_like z) noexcept;
constexpr auto acos(cayley_dickson_like z, eve::value k) noexcept;
// semantic modifyers
constexpr Z acos[real_only](Real z) noexcept;
constexpr auto acos[radpi](cayley_dickson_like z) noexcept;
constexpr auto acos[rad](cayley_dickson_like z) noexcept;
}
constexpr auto k
Computes the complex number k i.e. quaternion(0, 0, 0, 1) in the chosen type.
Definition k.hpp:74
constexpr auto acos
Computes the arc cosine of the argument.
Definition acos.hpp:109
Main KYOSU namespace.
Definition cinf.hpp:13

Parameters

  • z: Value to process.

Return value

  • A real typed input z is treated as if complex(z) was entered unless the option real_only is used in which case the parameter must be a floating_value and the result will the same as a call to eve::acos, implying a Nan result if the theoretical result is not real.
  • For complex input, returns elementwise the complex principal value of the arc cosine of the input. Branch cuts exist outside the interval \([-1, +1]\) along the real axis.
    • for every z: acos(conj(z)) == conj(acos(z))
    • If z is \(\pm0\), the result is \(\pi/2\)
    • If z is \(i \textrm{NaN}\), the result is \(\pi/2+ i \textrm{NaN}\)
    • If z is \(x+i\infty\) (for any finite x), the result is \(\pi/2-i\infty\)
    • If z is \(x+i \textrm{NaN}\) (for any nonzero finite x), the result is \(\textrm{NaN}+i \textrm{NaN}\).
    • If z is \(-\infty+i y\) (for any positive finite y), the result is \(\pi-i\infty\)
    • If z is \(+\infty+i y\) (for any positive finite y), the result is \(+0-i\infty\)
    • If z is \(-\infty+i +\infty\), the result is \(3\pi/4-i\infty\)
    • If z is \(\infty+i +\infty\), the result is \(\pi/4-i\infty\)
    • If z is \(\pm\infty+i \textrm{NaN}\), the result is \(\textrm{NaN} \pm i\infty\) (the sign of the imaginary part is unspecified)
    • If z is \(\textrm{NaN}+i y\) (for any finite y), the result is \(\textrm{NaN}+i \textrm{NaN}\)
    • If z is \(\textrm{NaN}+i\infty\), the result is \(\textrm{NaN}-i\infty\)
    • If z is \(\textrm{NaN}+i \textrm{NaN}\), the result is \(\textrm{NaN}+i \textrm{NaN}\)
  • For general cayley_dickson input, returns \(I_z \mathrm{acosh}(z)\) where \(I_z = \frac{\underline{z}}{|\underline{z}|}\) and \(\underline{z}\) is the pure part of \(z\).
  • For two parameters returns the kth branch of acos. If k is not a flint it is truncated before use.
  • The radpi option provides a result expressed in \(\pi\) multiples.

External references

Example

#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
using wide_ft = eve::wide<float, eve::fixed<4>>;
wide_ft ref1 = {3.0f, 2.0f, 1.0f, 0.5f};
wide_ft imf1 = {2.0f, -1.0, -5.0, 0.0};
wide_ft ref2 = {0.0, 1.0, 2.0, 3.0};
auto zc = kyosu::complex_t<wide_ft>(ref1, imf1);
std::cout << "---- simd" << std::endl
<< "<- zc = " << zc << std::endl
<< "-> acos(zc) = " << kyosu::acos(zc) << std::endl
<< "-> acos(ref2) = " << kyosu::acos(ref2) << std::endl
<< "-> acos[radpi](ref2) = " << kyosu::acos[kyosu::radpi](ref2) << std::endl;
return 0;
}
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition complex.hpp:27