std::asin(std::complex)(3)
okay bestie, you're on the std::asin(std::complex)(3) page from the C++ Standard Libary β yes, that's the manual name right there, and yes the header really says βLibaryβ, not me π. This is the complex-arc-sine lore. π
π NAME
std::asin(std::complex) β std::asin(std::complex).
β¨ SYNOPSIS β¨
Defined in header <complex>:
template< class T > (since C++11)
std::complex<T> asin( const std::complex<T>& z );
Computes complex arc sine of a complex value z. Branch cut exists outside the interval [β1, +1] along the real axis.
π«Ά PARAMETERS
zβ complex value.
π RETURN VALUE π
If no errors occur, complex arc sine of z is returned, in the range of a strip unbounded along the imaginary axis and in the interval [βΟ/2, +Ο/2] along the real axis.
Errors and special cases are handled as if the operation is implemented by -i * std::asinh(i * z), where i is the imaginary unit.
π§ NOTES π§
Inverse sine (or arc sine) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventionally placed at the line segments (-β,-1) and (1,β) of the real axis.
The mathematical definition of the principal value of arc sine is:
\(\small \arcsin z = -{\rm i}\ln({\rm i}z+\sqrt{1-z^2})\)arcsin z = -iln(iz + β 1-z2 ).
For any z:
\(\small{ \arcsin(z) = \arccos(-z) - \frac{\pi}{2} }\)asin(z) = acos(-z) - Ο/2 .
π EXAMPLE π
// Run this code β go off, bestie:
#include <cmath>
#include <complex>
#include <iostream>
int main()
{
std::cout << std::fixed;
std::complex<double> z1(-2.0, 0.0);
std::cout << "asin" << z1 << " = " << std::asin(z1) << '\n';
std::complex<double> z2(-2.0, -0.0);
std::cout << "asin" << z2 << " (the other side of the cut) = "
<< std::asin(z2) << '\n';
// for any z, asin(z) = acos(βz) β pi / 2
const double pi = std::acos(-1);
std::complex<double> z3 = std::acos(z2) - pi / 2;
std::cout << "sin(acos" << z2 << " - pi / 2) = " << std::sin(z3) <<
'\n';
}
π OUTPUT π
asin(-2.000000,0.000000) = (-1.570796,1.316958)
asin(-2.000000,-0.000000) (the other side of the cut) =
(-1.570796,-1.316958)
sin(acos(-2.000000,-0.000000) - pi / 2) = (2.000000,0.000000)
π SEE ALSO π
acos(std::complex)β computes arc cosine of a complex number(C++11)(\({\small\arccos{z}}\)arccos(z)) (function template).atan(std::complex)β computes arc tangent of a complex number(C++11)(\({\small\arctan{z}}\)arctan(z)) (function template).sin(std::complex)β computes sine of a complex number (\({\small\sin{z}}\)sin(z)) (function template).asin,asinf,asinlβ computes arc sine (\({\small\arcsin{x}}\)arcsin(x)) (function)(C++11)(C++11).asin(std::valarray)β applies the functionstd::asinto each element ofvalarray(function template).- C documentation for
casin.
That's the whole page, bestie. Source: http://cppreference.com; version/date: 2024.06.10; page: std::asin(std::complex)(3). π«Άπβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms