Skip to content

Commit

Permalink
nome
Browse files Browse the repository at this point in the history
stla committed Nov 9, 2023
1 parent 4d9d603 commit 281a770
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ export(ljtheta1)
export(ljtheta2)
export(ljtheta3)
export(ljtheta4)
export(nome)
export(sl)
export(slh)
export(sm)
20 changes: 20 additions & 0 deletions R/nome.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' @title Nome
#' @description The nome in function of the parameter \eqn{m}.
#'
#' @param m the parameter, square of elliptic modulus
#'
#' @return A complex number.
#' @export
#' @importFrom Carlson elliptic_F
#'
#' @examples
#' nome(-2)
nome <- function(m) {
if(m == 0) {
return(as.complex(0))
}
if(m == 1) {
return(as.complex(1))
}
exp(-pi * elliptic_F(pi/2, 1-m) / elliptic_F(pi/2, m))
}
20 changes: 20 additions & 0 deletions man/nome.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/testthat/test-nome.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_that("Some value of the nome", {
expect_equal(nome(-2), as.complex(-0.06823783), tolerance = 1e-6)
expect_equal(nome(0.5), as.complex(exp(-pi)))
expect_equal(nome(5/16), as.complex(0.02340125), tolerance = 1e-6)
})

0 comments on commit 281a770

Please sign in to comment.