Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Jan 24, 2025
1 parent 81a44bb commit 41e341a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions build/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,9 @@ function ellipticNome( m ) {

}

// Jacobi theta functions grow very quickly in imaginary direction
// evaluating elliptic functions without reduction fails accordingly

function fundamentalParallelogram( x, p1, p2 ) {

// x = m p1 + n p2, solve for m, n
Expand Down Expand Up @@ -1178,7 +1181,7 @@ function sn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(3,0,q), jacobiTheta(2,0,q) ),
div( jacobiTheta(1,t,q), jacobiTheta(4,t,q) ) );
Expand Down Expand Up @@ -1217,7 +1220,7 @@ function cn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(4,0,q), jacobiTheta(2,0,q) ),
div( jacobiTheta(2,t,q), jacobiTheta(4,t,q) ) );
Expand Down Expand Up @@ -1256,7 +1259,7 @@ function dn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(4,0,q), jacobiTheta(3,0,q) ),
div( jacobiTheta(3,t,q), jacobiTheta(4,t,q) ) );
Expand Down
9 changes: 6 additions & 3 deletions src/functions/elliptic-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ function ellipticNome( m ) {

}

// Jacobi theta functions grow very quickly in imaginary direction
// evaluating elliptic functions without reduction fails accordingly

function fundamentalParallelogram( x, p1, p2 ) {

// x = m p1 + n p2, solve for m, n
Expand Down Expand Up @@ -222,7 +225,7 @@ function sn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(3,0,q), jacobiTheta(2,0,q) ),
div( jacobiTheta(1,t,q), jacobiTheta(4,t,q) ) );
Expand Down Expand Up @@ -261,7 +264,7 @@ function cn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(4,0,q), jacobiTheta(2,0,q) ),
div( jacobiTheta(2,t,q), jacobiTheta(4,t,q) ) );
Expand Down Expand Up @@ -300,7 +303,7 @@ function dn( x, m ) {
x = fundamentalParallelogram( x, p1, p2 );

var q = ellipticNome(m);
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) );
var t = div( x, pow( jacobiTheta(3,0,q), 2 ) ); // theta3**2 = 2K/pi

return mul( div( jacobiTheta(4,0,q), jacobiTheta(3,0,q) ),
div( jacobiTheta(3,t,q), jacobiTheta(4,t,q) ) );
Expand Down

0 comments on commit 41e341a

Please sign in to comment.