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 1 commit
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 sintau end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we cannot find documentation for sinτ.

help?> sintau
search: sintau sincostau isinteractive

  sinτ(x)
  sintau(x)

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

  See also: costau, sincostau.

help?> sinτ
"sinτ" can be typed by sin\tau<tab>

search: sinτ sincosτ sinh sind sinc sin sinpi sincos sintau sincosd sincospi sincostau using isinf asinh asind asin isinteger isinteractive thisind sign signed Signed signbit significand islink isfinite occursin Unsigned unsigned missing Missing lastindex MissingException VERSION versioninfo

  No documentation found.

  Tau.sinτ is a Function.

I think sinτ should be removed (#49), so removing sinτ in the docstring would be better.

Suggested change
"""
sinτ(x)
sintau(x)
Compute ``\\sin(\\tau x)`` more accurately than `sin(tau*x)`, especially for large `x`.
See also: `costau`, `sincostau`.
"""
function sintau end
"""
sintau(x)
Compute ``\\sin(\\tau x)`` more accurately than `sin(tau*x)`, especially for large `x`.
See also: `costau`, `sincostau`.
"""
function sintau end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as expected with the latest commit (c0eb021), apparently one has to add the docstring to the "original" function, not its alias.


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

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

See also: `sintau`, `sincostau`.
"""
function costau 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 sincostau 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 cistau end

end