...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
There are twelve Jacobi Elliptic functions, of which the three copolar functions sn, cn and dn are the most important as the other nine can be computed from these three ^{[2]} ^{[3]} ^{[4]}.
These functions each take two arguments: a parameter, and a variable as described below.
Like all elliptic functions these can be parameterised in a number of ways:
In our implementation, these functions all take the elliptic modulus k as the parameter.
In addition the variable u is sometimes expressed as an amplitude φ, in our implementation we always use u.
Finally note that our functions all take the elliptic modulus k as the first argument - this is for alignment with the Elliptic Integrals (but is different from other implementations, for example Mathworks).
A simple example comparing use of Wolfram Alpha with Boost.Math (including much higher precision using Boost.Multiprecision) is jacobi_zeta_example.cpp.
There are twelve functions for computing the twelve individual Jacobi elliptic functions: jacobi_cd, jacobi_cn, jacobi_cs, jacobi_dc, jacobi_dn, jacobi_ds, jacobi_nc, jacobi_nd, jacobi_ns, jacobi_sc, jacobi_sd and jacobi_sn.
They are all called as for example:
jacobi_cs(k, u);
Note however that these individual functions are all really thin wrappers around the function jacobi_elliptic which calculates the three copolar functions sn, cn and dn in a single function call.
Tip | |
---|---|
If you need more than one of these functions for a given set of arguments, it's most efficient to use jacobi_elliptic. |