From 36ad0dc069d6f9cf4d8287cda74a20b413801ca5 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Thu, 23 Feb 2023 23:47:16 +0100 Subject: [PATCH 1/2] Add documentation --- README.md | 10 ++++++++-- src/Tau.jl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a8b4965..842a841 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Irrational{:twoπ} Note: to input the τ character, type `\tau` then press Tab. -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) @@ -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 diff --git a/src/Tau.jl b/src/Tau.jl index af91e98..010b415 100644 --- a/src/Tau.jl +++ b/src/Tau.jl @@ -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 + +""" + 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 From c0eb0216f8740cadc7ee9e80617e3b12da592879 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 26 Feb 2023 03:11:43 +0100 Subject: [PATCH 2/2] Fix docstrings --- src/Tau.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tau.jl b/src/Tau.jl index 010b415..edc20fc 100644 --- a/src/Tau.jl +++ b/src/Tau.jl @@ -61,7 +61,7 @@ Compute ``\\sin(\\tau x)`` more accurately than `sin(tau*x)`, especially for lar See also: `costau`, `sincostau`. """ -function sintau end +function sinτ end """ cosτ(x) @@ -71,7 +71,7 @@ Compute ``\\cos(\\tau x)`` more accurately than `cos(tau*x)`, especially for lar See also: `sintau`, `sincostau`. """ -function costau end +function cosτ end """ sincosτ(x) @@ -82,7 +82,7 @@ where `x` is in radians), returning a tuple `(sine, cosine)`. See also: `sintau`, `costau`. """ -function sincostau end +function sincosτ end """ @@ -93,6 +93,6 @@ Compute ``\\exp(\\tau i x)`` more accurately than `cis(tau*x)`, especially for l See also: `cis`, `sincostau`. """ -function cistau end +function cisτ end end