std::atan(std::complex)(3)
π NAME π
std::atan(std::complex) - std::atan(std::complex).
Okay so this is the complex arc tangent situation from the C++ Standard Libary, and bestie, it's giving main character energy. π No cap, fr fr.
β¨ Synopsis β¨
Defined in header <complex>:
template< class T > (since C++11)
complex<T> atan( const complex<T>& z );
This computes the complex arc tangent of a complex value z. Branch cut exists outside the interval [βi, +i] along the imaginary axis. iykyk π¦
π Parameters π
zβ complex value. That's the input, bestie, and it's literally a complex value. Vibe check: passed. π¦
πΈ Return value πΈ
If no errors occur, the complex arc tangent 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. Highkey slay. β¨
Errors and special cases are handled as if the operation is implemented by -i * std::atanh(i * z), where i is the imaginary unit. Periodt.
π§ Notes π§
Inverse tangent (or arc tangent) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventionally placed at the line segments (-βi,-i) and (+i,+βi) of the imaginary axis. Don't @ me, that's the convention β lowkey iconic. π
The mathematical definition of the principal value of inverse tangent is literally atan z = -1/2 i [ln(1 - iz) - ln (1 + iz)]. Math ate, no crumbs β I'm obsessed. π
π₯ Example π₯
Not me running this exact code to watch the output do its thing:
// Run this code
#include <cmath>
#include <complex>
#include <iostream>
int main()
{
std::cout << std::fixed;
std::complex<double> z1(0.0, 2.0);
std::cout << "atan" << z1 << " = " << std::atan(z1) << '\n';
std::complex<double> z2(-0.0, 2.0);
std::cout << "atan" << z2 << " (the other side of the cut) = "
<< std::atan(z2) << '\n';
std::complex<double> z3(0.0, INFINITY);
std::cout << "2 * atan" << z3 << " = " << 2.0 * std::atan(z3) <<
'\n';
}
π Output π
atan(0.000000,2.000000) = (1.570796,0.549306)
atan(-0.000000,2.000000) (the other side of the cut) =
(-1.570796,0.549306)
2 * atan(0.000000,inf) = (3.141593,0.000000)
π See also π
asin(std::complex)β computes arc sine of a complex number (C++11) (({\small\arcsin{z}})arcsin(z)) (function template).acos(std::complex)β computes arc cosine of a complex number (C++11) (({\small\arccos{z}})arccos(z)) (function template).tan(std::complex)β computes tangent of a complex number (({\small\tan{z}})tan(z)) (function template).atan,atanf,atanlβ computes arc tangent (({\small\arctan{x}})arctan(x)) (function) (C++11) (C++11).atan(std::valarray)β applies the functionstd::atanto each element of valarray (function template).- C documentation for
catan.
Made with π from http://cppreference.com, version 2024.06.10, page std::atan(std::complex)(3). Bye bestie, go compute some complex arc tangents and slay. π«Άβ¨
π¦ 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