Skip to content

Add documentation #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Irrational{:twoπ}

Note: to input the τ character, type `\tau` then press <kbd>Tab</kbd>.

The tau variants of `sinpi`, `cospi`, and `mod2pi` are also defined:
The tau variants of `sinpi`, `cospi`, `sincospi`, `cispi`, and `mod2pi` are also defined:

```julia
julia> sintau(1//4)
Expand All @@ -38,11 +38,17 @@ julia> sintau(1//4)
julia> costau(1//2)
-1.0

julia> sincostau(1//2)
(0.0, -1.0)

julia> cistau(1//2)
-1.0 + 0.0im

julia> modtau(9*pi/4)
0.7853981633974481
```

Alternatively, one can use the Unicode aliases `sinτ`, `cosτ`, and `modτ`.
Alternatively, one can use the Unicode aliases `sinτ`, `cosτ`, `sincosτ`, `cisτ`, and `modτ`.

## The tau != 2pi inequality

Expand Down
45 changes: 45 additions & 0 deletions src/Tau.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,54 @@ function cisτ(x::Integer)
return complex(one(y), zero(y))
end

# Aliases
const sintau = sinτ
const costau = cosτ
const sincostau = sincosτ
const cistau = cisτ

# Documentation

"""
sinτ(x)
sintau(x)

Compute ``\\sin(\\tau x)`` more accurately than `sin(tau*x)`, especially for large `x`.

See also: `costau`, `sincostau`.
"""
function sinτ end

"""
cosτ(x)
costau(x)

Compute ``\\cos(\\tau x)`` more accurately than `cos(tau*x)`, especially for large `x`.

See also: `sintau`, `sincostau`.
"""
function cosτ end

"""
sincosτ(x)
costau(x)

Simultaneously compute `sintau(x)` and `costau(x)` (the sine and cosine of `tau*x`,
where `x` is in radians), returning a tuple `(sine, cosine)`.

See also: `sintau`, `costau`.
"""
function sincosτ end


"""
cisτ(x)
cistau(x)

Compute ``\\exp(\\tau i x)`` more accurately than `cis(tau*x)`, especially for large `x`.

See also: `cis`, `sincostau`.
"""
function cisτ end

end