g.fun {elliptic}R Documentation

Calculates the invariants g2 and g3

Description

Calculates the invariants g2 and g3 using any of a number of methods

Usage

g.fun(b, ...)
g2.fun(b, use.first=TRUE, ...)
g3.fun(b, use.first=TRUE, ...)
g2.fun.lambert(b, nmax=50, tol=1e-10, strict=TRUE)
g3.fun.lambert(b, nmax=50, tol=1e-10, strict=TRUE)
g2.fun.direct(b, nmax=50, tol=1e-10)
g3.fun.direct(b, nmax=50, tol=1e-10)
g2.fun.fixed(b, nmax=50, give=FALSE)
g3.fun.fixed(b, nmax=50, tol=1e-10, give=FALSE)
g2.fun.vectorized(b, nmax=50, tol=1e-10, give=FALSE)
g3.fun.vectorized(b, nmax=50, tol=1e-10, give=FALSE)

Arguments

b Half periods. NB: the arguments are the half periods as per AMS55! In these functions, argument b is interpreted as per p1.tau().
nmax Maximum number of terms to sum. See details section for more discussion.
tol Numerical tolerance for stopping: summation stops when adding an additional term makes les
strict Boolean, with default (where taken) TRUE meaning to stop() if convergence is not achieved in nmax terms. Setting to FALSE returns the partial sum and a warning.
give Boolean, with default (where taken) TRUE meaning to return the partial sums. See examples section for an example of this argument in use.
... In functions g.fun(), g2.fun() and g3.fun(), extra arguments passed to theta1() and friends.
use.first In function g2.fun() and g3.fun(), Boolean with default TRUE meaning to use Wolfram's first formula (remember to cite this) and FALSE meaning to use the second.

Details

Functions g2.fun() and g3.fun() use theta functions which converge very quickly. These functions are the best in most circumstances. These functions include a loop that continues to add terms until the partial sum is unaltered by addition of the next term. Note that summation continues until all elements of the argument are properly summed, so performance is limited by the single worst-case element.

The following functions are provided for interest only, although there is a remote possibility that some weird circumstances may exist in which they are faster than the theta function approach.

Functions g2.fun.divisor() and g3.fun.divisor() use Chandrasekharan's formula on page 83. This is generally slower than the theta function approach

Functions g2.fun.lambert() and g3.fun.lambet() use a Lambert series to accelerate Chandrasekharan's formula. In general, it is a little better than the divisor form.

Functions g2.fun.fixed() and g2.fun.fixed() are vectorized in the sense that the function body uses only vector operations. These functions take only a single argument. They are called “fixed” because the number of terms used is fixed in advance (unlike g2.fun() and g3.fun()).

Functions g2.fun.vectorized() and g3.fun.vectorized() are fully vectorized in that they take a vector of periods or period ratios. However, this can lead to loss of precision in some cases (specifically when the periods give rise to widely varying values of g2 and g3).

Summation terms go as nmax^2 in g2.fun.direct() and g3.fun.direct(). In general, the divisor function forms (that is, g2.fun() and g3.fun()), converge much faster; and the “default” functions g2.fun() and g3.fun(), which use Lambert series, converge faster still.

Author(s)

Robin K. S. Hankin

Examples

## Example 4, p664, LHS:
omega <- c(10,11i)
(g2 <- g2.fun(omega))
(g3 <- g3.fun(omega))
e1e2e3(Re(c(g2,g3)))

## Example 4, p664, RHS:
omega2 <- 10
omega2dash <- 11i
omega1 <- (omega2-omega2dash)/2   ## From figure 18.1, p630
(g2 <- g2.fun(c(omega1,omega2)))
(g3 <- g3.fun(c(omega1,omega2)))
e1e2e3(Re(c(g2,g3)))

  

[Package elliptic version 0.4-14 Index]