ellipk

Hi,

I am trying to calculate a function with a complete elliptic integral
of the 1st kind

I have defined

Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))

where

a_mpc = 4.0

p = a_mpc * (1 - e**2.)

and I have of course done this

#!/usr/bin/env python
from pylab import *

But when calling the script, I get:

NameError: name 'ellipk' is not defined

What am I doing wrong? Any help will be very much appreciated.

Thanks a lot,

Pau

hey pau,

ellipk is in scipy.special:

#!/usr/bin/env python
from pylab import *
from scipy.special import ellipk

e=1.
a_mpc = 4.0
p = a_mpc * (1 - e**2.)
Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))

greetings,
sebastian.

Hi,

didn't work...

ImportError: No module named scipy.special

this is fedora13...

thanks!

Pau

2010/10/8, Sebastian Busch <webmaster@...2599...>:

hey pau,

ellipk is in scipy.special:

#!/usr/bin/env python
from pylab import *
from scipy.special import ellipk

e=1.
a_mpc = 4.0
p = a_mpc * (1 - e**2.)
Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))

greetings,
sebastian.

2010/10/8, Sebastian Busch <webmaster@...2599...>:

···

hey pau,

ellipk is in scipy.special:

#!/usr/bin/env python
from pylab import *
from scipy.special import ellipk

e=1.
a_mpc = 4.0
p = a_mpc * (1 - e**2.)
Phase = 4.*sqrt(p/(p -6. - 2.*e)) * ellipk(-4.*e/(p - 6. -2.*e))

greetings,
sebastian.

hey pau!

...
ImportError: No module named scipy.special
...

do you have scipy installed? i.e. does

import scipy

work? if so, what is

scipy.__version__

? here, it's 0.7.0...

if scipy is not installed, i think you need to install it in order to
access ellipk.

good luck :slight_smile:
sebastian.

···

On 10/09/2010 08:04 AM, Pau wrote: