Tangent
Base.tan
— Functiontan(x)
Compute tangent of x
, where x
is in radians.
tan(A::AbstractMatrix)
Compute the matrix tangent of a square matrix A
.
If A
is symmetric or Hermitian, its eigendecomposition (eigen
) is used to compute the tangent. Otherwise, the tangent is determined by calling exp
.
Examples
julia> tan(fill(1.0, (2,2)))
2×2 Matrix{Float64}:
-1.09252 -1.09252
-1.09252 -1.09252
Base.Math.tand
— Functiontand(x)
Compute tangent of x
, where x
is in degrees. If x
is a matrix, x
needs to be a square matrix.
Matrix arguments require Julia 1.7 or later.
Base.Math.tanpi
— Functiontanpi(x)
Compute $\tan(\pi x)$ more accurately than tan(pi*x)
, especially for large x
.
This function requires at least Julia 1.10.
Base.tanh
— Functiontanh(x)
Compute hyperbolic tangent of x
.
Examples
julia> tanh.(-3:3f0) # Here 3f0 isa Float32
7-element Vector{Float32}:
-0.9950548
-0.9640276
-0.7615942
0.0
0.7615942
0.9640276
0.9950548
julia> tan.(im .* (1:3))
3-element Vector{ComplexF64}:
0.0 + 0.7615941559557649im
0.0 + 0.9640275800758169im
0.0 + 0.9950547536867306im
tanh(A::AbstractMatrix)
Compute the matrix hyperbolic tangent of a square matrix A
.
Base.atan
— Functionatan(y)
atan(y, x)
Compute the inverse tangent of y
or y/x
, respectively.
For one real argument, this is the angle in radians between the positive x-axis and the point (1, y), returning a value in the interval $[-\pi/2, \pi/2]$.
For two arguments, this is the angle in radians between the positive x-axis and the point (x, y), returning a value in the interval $[-\pi, \pi]$. This corresponds to a standard atan2
function. Note that by convention atan(0.0,x)
is defined as $\pi$ and atan(-0.0,x)
is defined as $-\pi$ when x < 0
.
See also atand
for degrees.
Examples
julia> rad2deg(atan(-1/√3))
-30.000000000000004
julia> rad2deg(atan(-1, √3))
-30.000000000000004
julia> rad2deg(atan(1, -√3))
150.0
atan(A::AbstractMatrix)
Compute the inverse matrix tangent of a square matrix A
.
If A
is symmetric or Hermitian, its eigendecomposition (eigen
) is used to compute the inverse tangent. Otherwise, the inverse tangent is determined by using log
. For the theory and logarithmic formulas used to compute this function, see [AH16_3].
Examples
julia> atan(tan([0.5 0.1; -0.2 0.3]))
2×2 Matrix{ComplexF64}:
0.5+1.38778e-17im 0.1-2.77556e-17im
-0.2+6.93889e-17im 0.3-4.16334e-17im
Base.Math.atand
— Functionatand(y)
atand(y,x)
Compute the inverse tangent of y
or y/x
, respectively, where the output is in degrees.
The one-argument method supports square matrix arguments as of Julia 1.7.
Base.atanh
— Functionatanh(x)
Compute the inverse hyperbolic tangent of x
.
atanh(A::AbstractMatrix)
Compute the inverse hyperbolic matrix tangent of a square matrix A
. For the theory and logarithmic formulas used to compute this function, see [AH16_6].
- AH16_3Mary Aprahamian and Nicholas J. Higham, "Matrix Inverse Trigonometric and Inverse Hyperbolic Functions: Theory and Algorithms", MIMS EPrint: 2016.4. https://doi.org/10.1137/16M1057577
- AH16_6Mary Aprahamian and Nicholas J. Higham, "Matrix Inverse Trigonometric and Inverse Hyperbolic Functions: Theory and Algorithms", MIMS EPrint: 2016.4. https://doi.org/10.1137/16M1057577