public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Elliptic integral and function
  2001-12-19 13:20 Elliptic integral and function Liam Healy
@ 2001-12-08 10:51 ` Liam Healy
  2001-12-17  8:52 ` Liam Healy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-08 10:51 UTC (permalink / raw)
  To: gsl-discuss

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 524 bytes --]

My understanding is that the Jacobi elliptic function is the inverse
of the elliptic function.  That is, 
  sn(K(k),k) = 1
  cn(K(k),k) = 0
  dn(K(k),k) = sqrt(1-k^2)
see http://mathworld.wolfram.com/JacobiEllipticFunctions.html

but when I try this I get e.g.
gsltest 0.5
k=  0.50000000000000 K(k)=  1.68575035481260
sn=  0.99289175131682 cn=  0.11902088122262 dn=  0.71209759519570
all three of these seem wrong.  My driver program is attached.

What is wrong here?  Thank you for any light you can shed on this. 

Liam 


[-- Attachment #2: C source code to drive elliptic integrals and functions. --]
[-- Type: text/plain, Size: 962 bytes --]

/* ******************************************************** */
/*  file:        gsltest.c                                  */
/*  description: Test the GSL                               */
/*  date:        Mon Dec 17 2001 - 10:09                    */
/*  author:      Liam Healy <Liam.Healy@nrl.navy.mil>       */
/*  modified:    Mon Dec 17 2001 - 11:45 */
/* ******************************************************** */

/* Compile with:
   gcc gsltest.c -lgslcblas -lgsl -o gsltest 
   Run:
     source ~/bin/libpath /usr/local/lib/
     gsltest
*/


#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_sf_ellint.h>
#include <gsl/gsl_sf_elljac.h>

int main(int argc, char *argv[]) {
  double k, kk;
  double sn, cn, dn;
  int ret;

  k = atof(argv[1]);
  kk = gsl_sf_ellint_Kcomp (k, GSL_PREC_DOUBLE);
  ret = gsl_sf_elljac_e (kk, k, &sn, &cn, &dn); 

  printf("k=%18.14f K(k)=%18.14f\n",k,kk);
  printf("sn=%18.14f cn=%18.14f dn=%18.14f\n",sn,cn,dn);
}

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20 ` Brian Gough
@ 2001-12-12 16:16   ` Brian Gough
  2001-12-19  6:18   ` Brian Gough
  2001-12-19 13:20   ` Liam Healy
  2 siblings, 0 replies; 10+ messages in thread
From: Brian Gough @ 2001-12-12 16:16 UTC (permalink / raw)
  To: Liam Healy; +Cc: gsl-discuss

Liam Healy writes:
 > My understanding is that the Jacobi elliptic function is the inverse
 > of the elliptic function.  That is, 
 >   sn(K(k),k) = 1
 >   cn(K(k),k) = 0
 >   dn(K(k),k) = sqrt(1-k^2)
 > see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
 > 

Hi,
Using the conventions in the GSL manual the relation is,

 sn(K(k),k^2) = 1
 cn(K(k),k^2) = 0
 dn(K(k),k^2) = sqrt(1-k^2)

which should work correctly. I think there is a note about the
different notations used by Carlson and Abramowitz&Stegun somewhere in
the chapter there.

regards

-- 
Brian Gough

----------------------------------------------------------------------
Network Theory Ltd            Phone: +44 (0)117 3179309
15 Royal Park                   WWW: http://www.network-theory.co.uk/
Clifton                       Email: bjg@network-theory.co.uk    
Bristol BS8 3AL
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20   ` Liam Healy
@ 2001-12-13  1:01     ` Liam Healy
  2001-12-19 12:12     ` Liam Healy
  1 sibling, 0 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-13  1:01 UTC (permalink / raw)
  To: Brian Gough; +Cc: Liam Healy, gsl-discuss

>>>>> "Brian" == Brian Gough <bjg@network-theory.co.uk> writes:

    Brian> Liam Healy writes:
    >> My understanding is that the Jacobi elliptic function is the inverse
    >> of the elliptic function.  That is, 
    >> sn(K(k),k) = 1
    >> cn(K(k),k) = 0
    >> dn(K(k),k) = sqrt(1-k^2)
    >> see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
    >> 

    Brian> Hi,
    Brian> Using the conventions in the GSL manual the relation is,

    Brian>  sn(K(k),k^2) = 1
    Brian>  cn(K(k),k^2) = 0
    Brian>  dn(K(k),k^2) = sqrt(1-k^2)

    Brian> which should work correctly. I think there is a note about the
    Brian> different notations used by Carlson and Abramowitz&Stegun somewhere in
    Brian> the chapter there.

You're absolutely right, I had overlooked the m (where m=k^2).  And it
is documented, if a bit obscurely, "The Jacobian Elliptic functions are
defined in Abramowitz & Stegun, Chapter 16." so one has to hunt down
A&S for the definition and see how they've defined the arguments.

Thank you for solving this mystery.

Liam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Elliptic integral and function
  2001-12-19 13:20 Elliptic integral and function Liam Healy
  2001-12-08 10:51 ` Liam Healy
@ 2001-12-17  8:52 ` Liam Healy
  2001-12-19 13:20 ` Liam Healy
  2001-12-19 13:20 ` Brian Gough
  3 siblings, 0 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-17  8:52 UTC (permalink / raw)
  To: gsl-discuss

My understanding is that the Jacobi elliptic function is the inverse
of the elliptic function.  That is, 
  sn(K(k),k) = 1
  cn(K(k),k) = 0
  dn(K(k),k) = sqrt(1-k^2)
see http://mathworld.wolfram.com/JacobiEllipticFunctions.html

but when I try this I get e.g.
gsltest 0.5
k=  0.50000000000000 K(k)=  1.68575035481260
sn=  0.99289175131682 cn=  0.11902088122262 dn=  0.71209759519570
all three of these seem wrong.  My driver program is attached.

What is wrong here?  Thank you for any light you can shed on this. 

Liam 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20 ` Brian Gough
  2001-12-12 16:16   ` Brian Gough
@ 2001-12-19  6:18   ` Brian Gough
  2001-12-19 13:20   ` Liam Healy
  2 siblings, 0 replies; 10+ messages in thread
From: Brian Gough @ 2001-12-19  6:18 UTC (permalink / raw)
  To: Liam Healy; +Cc: gsl-discuss

Liam Healy writes:
 > My understanding is that the Jacobi elliptic function is the inverse
 > of the elliptic function.  That is, 
 >   sn(K(k),k) = 1
 >   cn(K(k),k) = 0
 >   dn(K(k),k) = sqrt(1-k^2)
 > see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
 > 

Hi,
Using the conventions in the GSL manual the relation is,

 sn(K(k),k^2) = 1
 cn(K(k),k^2) = 0
 dn(K(k),k^2) = sqrt(1-k^2)

which should work correctly. I think there is a note about the
different notations used by Carlson and Abramowitz&Stegun somewhere in
the chapter there.

regards

-- 
Brian Gough

----------------------------------------------------------------------
Network Theory Ltd            Phone: +44 (0)117 3179309
15 Royal Park                   WWW: http://www.network-theory.co.uk/
Clifton                       Email: bjg@network-theory.co.uk    
Bristol BS8 3AL
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20   ` Liam Healy
  2001-12-13  1:01     ` Liam Healy
@ 2001-12-19 12:12     ` Liam Healy
  1 sibling, 0 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-19 12:12 UTC (permalink / raw)
  To: Brian Gough; +Cc: Liam Healy, gsl-discuss

>>>>> "Brian" == Brian Gough <bjg@network-theory.co.uk> writes:

    Brian> Liam Healy writes:
    >> My understanding is that the Jacobi elliptic function is the inverse
    >> of the elliptic function.  That is, 
    >> sn(K(k),k) = 1
    >> cn(K(k),k) = 0
    >> dn(K(k),k) = sqrt(1-k^2)
    >> see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
    >> 

    Brian> Hi,
    Brian> Using the conventions in the GSL manual the relation is,

    Brian>  sn(K(k),k^2) = 1
    Brian>  cn(K(k),k^2) = 0
    Brian>  dn(K(k),k^2) = sqrt(1-k^2)

    Brian> which should work correctly. I think there is a note about the
    Brian> different notations used by Carlson and Abramowitz&Stegun somewhere in
    Brian> the chapter there.

You're absolutely right, I had overlooked the m (where m=k^2).  And it
is documented, if a bit obscurely, "The Jacobian Elliptic functions are
defined in Abramowitz & Stegun, Chapter 16." so one has to hunt down
A&S for the definition and see how they've defined the arguments.

Thank you for solving this mystery.

Liam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20 Elliptic integral and function Liam Healy
                   ` (2 preceding siblings ...)
  2001-12-19 13:20 ` Liam Healy
@ 2001-12-19 13:20 ` Brian Gough
  2001-12-12 16:16   ` Brian Gough
                     ` (2 more replies)
  3 siblings, 3 replies; 10+ messages in thread
From: Brian Gough @ 2001-12-19 13:20 UTC (permalink / raw)
  To: Liam Healy; +Cc: gsl-discuss

Liam Healy writes:
 > My understanding is that the Jacobi elliptic function is the inverse
 > of the elliptic function.  That is, 
 >   sn(K(k),k) = 1
 >   cn(K(k),k) = 0
 >   dn(K(k),k) = sqrt(1-k^2)
 > see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
 > 

Hi,
Using the conventions in the GSL manual the relation is,

 sn(K(k),k^2) = 1
 cn(K(k),k^2) = 0
 dn(K(k),k^2) = sqrt(1-k^2)

which should work correctly. I think there is a note about the
different notations used by Carlson and Abramowitz&Stegun somewhere in
the chapter there.

regards

-- 
Brian Gough

----------------------------------------------------------------------
Network Theory Ltd            Phone: +44 (0)117 3179309
15 Royal Park                   WWW: http://www.network-theory.co.uk/
Clifton                       Email: bjg@network-theory.co.uk    
Bristol BS8 3AL
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Elliptic integral and function
  2001-12-19 13:20 ` Brian Gough
  2001-12-12 16:16   ` Brian Gough
  2001-12-19  6:18   ` Brian Gough
@ 2001-12-19 13:20   ` Liam Healy
  2001-12-13  1:01     ` Liam Healy
  2001-12-19 12:12     ` Liam Healy
  2 siblings, 2 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-19 13:20 UTC (permalink / raw)
  To: Brian Gough; +Cc: Liam Healy, gsl-discuss

>>>>> "Brian" == Brian Gough <bjg@network-theory.co.uk> writes:

    Brian> Liam Healy writes:
    >> My understanding is that the Jacobi elliptic function is the inverse
    >> of the elliptic function.  That is, 
    >> sn(K(k),k) = 1
    >> cn(K(k),k) = 0
    >> dn(K(k),k) = sqrt(1-k^2)
    >> see http://mathworld.wolfram.com/JacobiEllipticFunctions.html
    >> 

    Brian> Hi,
    Brian> Using the conventions in the GSL manual the relation is,

    Brian>  sn(K(k),k^2) = 1
    Brian>  cn(K(k),k^2) = 0
    Brian>  dn(K(k),k^2) = sqrt(1-k^2)

    Brian> which should work correctly. I think there is a note about the
    Brian> different notations used by Carlson and Abramowitz&Stegun somewhere in
    Brian> the chapter there.

You're absolutely right, I had overlooked the m (where m=k^2).  And it
is documented, if a bit obscurely, "The Jacobian Elliptic functions are
defined in Abramowitz & Stegun, Chapter 16." so one has to hunt down
A&S for the definition and see how they've defined the arguments.

Thank you for solving this mystery.

Liam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Elliptic integral and function
@ 2001-12-19 13:20 Liam Healy
  2001-12-08 10:51 ` Liam Healy
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-19 13:20 UTC (permalink / raw)
  To: gsl-discuss

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 524 bytes --]

My understanding is that the Jacobi elliptic function is the inverse
of the elliptic function.  That is, 
  sn(K(k),k) = 1
  cn(K(k),k) = 0
  dn(K(k),k) = sqrt(1-k^2)
see http://mathworld.wolfram.com/JacobiEllipticFunctions.html

but when I try this I get e.g.
gsltest 0.5
k=  0.50000000000000 K(k)=  1.68575035481260
sn=  0.99289175131682 cn=  0.11902088122262 dn=  0.71209759519570
all three of these seem wrong.  My driver program is attached.

What is wrong here?  Thank you for any light you can shed on this. 

Liam 


[-- Attachment #2: C source code to drive elliptic integrals and functions. --]
[-- Type: text/plain, Size: 962 bytes --]

/* ******************************************************** */
/*  file:        gsltest.c                                  */
/*  description: Test the GSL                               */
/*  date:        Mon Dec 17 2001 - 10:09                    */
/*  author:      Liam Healy <Liam.Healy@nrl.navy.mil>       */
/*  modified:    Mon Dec 17 2001 - 11:45 */
/* ******************************************************** */

/* Compile with:
   gcc gsltest.c -lgslcblas -lgsl -o gsltest 
   Run:
     source ~/bin/libpath /usr/local/lib/
     gsltest
*/


#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_sf_ellint.h>
#include <gsl/gsl_sf_elljac.h>

int main(int argc, char *argv[]) {
  double k, kk;
  double sn, cn, dn;
  int ret;

  k = atof(argv[1]);
  kk = gsl_sf_ellint_Kcomp (k, GSL_PREC_DOUBLE);
  ret = gsl_sf_elljac_e (kk, k, &sn, &cn, &dn); 

  printf("k=%18.14f K(k)=%18.14f\n",k,kk);
  printf("sn=%18.14f cn=%18.14f dn=%18.14f\n",sn,cn,dn);
}

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Elliptic integral and function
  2001-12-19 13:20 Elliptic integral and function Liam Healy
  2001-12-08 10:51 ` Liam Healy
  2001-12-17  8:52 ` Liam Healy
@ 2001-12-19 13:20 ` Liam Healy
  2001-12-19 13:20 ` Brian Gough
  3 siblings, 0 replies; 10+ messages in thread
From: Liam Healy @ 2001-12-19 13:20 UTC (permalink / raw)
  To: gsl-discuss

My understanding is that the Jacobi elliptic function is the inverse
of the elliptic function.  That is, 
  sn(K(k),k) = 1
  cn(K(k),k) = 0
  dn(K(k),k) = sqrt(1-k^2)
see http://mathworld.wolfram.com/JacobiEllipticFunctions.html

but when I try this I get e.g.
gsltest 0.5
k=  0.50000000000000 K(k)=  1.68575035481260
sn=  0.99289175131682 cn=  0.11902088122262 dn=  0.71209759519570
all three of these seem wrong.  My driver program is attached.

What is wrong here?  Thank you for any light you can shed on this. 

Liam 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-12-19 20:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-19 13:20 Elliptic integral and function Liam Healy
2001-12-08 10:51 ` Liam Healy
2001-12-17  8:52 ` Liam Healy
2001-12-19 13:20 ` Liam Healy
2001-12-19 13:20 ` Brian Gough
2001-12-12 16:16   ` Brian Gough
2001-12-19  6:18   ` Brian Gough
2001-12-19 13:20   ` Liam Healy
2001-12-13  1:01     ` Liam Healy
2001-12-19 12:12     ` Liam Healy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).