Given a pair of basic periods, returns a primitive pair and (optionally) the unimodular transformation used.

1 2 | ```
as.primitive(p, n = 3, tol = 1e-05, give.answers = FALSE)
is.primitive(p, n = 3, tol = 1e-05)
``` |

`p` |
Two element vector containing the two basic periods |

`n` |
Maximum magnitude of matrix entries considered |

`tol` |
Numerical tolerance used to determine reality of period ratios |

`give.answers` |
Boolean, with |

Primitive periods are not unique. This function follows
Chandrasekharan and others (but not, of course, Abramowitz and Stegun)
in demanding that the real part of `p1`

, and the
imaginary part of `p2`

, are nonnegative.

If `give.answers`

is `TRUE`

, return a list with components

`M` |
The unimodular matrix used |

`p` |
The pair of primitive periods |

`mags` |
The magnitudes of the primitive periods |

Here, “unimodular” includes the case of determinant minus one.

Robin K. S. Hankin

K. Chandrasekharan 1985. *Elliptic functions*, Springer-Verlag

1 2 3 4 5 6 7 8 | ```
as.primitive(c(3+5i,2+3i))
as.primitive(c(3+5i,2+3i),n=5)
##Rounding error:
is.primitive(c(1,1i))
## Try
is.primitive(c(1,1.001i))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.