"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/functions/elliptic.py" between
mpmath-0.19.tar.gz and mpmath-1.0.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

elliptic.py  (mpmath-0.19):elliptic.py  (mpmath-1.0.0)
skipping to change at line 36 skipping to change at line 36
satisfy `\mathrm{Im}[\tau] > 0`. satisfy `\mathrm{Im}[\tau] > 0`.
These quantities can be expressed in terms of each other These quantities can be expressed in terms of each other
using the following relations: using the following relations:
.. math :: .. math ::
m = k^2 m = k^2
.. math :: .. math ::
\tau = -i \frac{K(1-m)}{K(m)} \tau = i \frac{K(1-m)}{K(m)}
.. math :: .. math ::
q = e^{i \pi \tau} q = e^{i \pi \tau}
.. math :: .. math ::
k = \frac{\vartheta_2^4(q)}{\vartheta_3^4(q)} k = \frac{\vartheta_2^4(q)}{\vartheta_3^4(q)}
In addition, an alternative definition is used for the nome in In addition, an alternative definition is used for the nome in
skipping to change at line 898 skipping to change at line 898
... ...
>>> nprint(mpf(fp.quad(f, [0,fp.pi], [0,2*fp.pi])/(4*fp.pi)), 13) >>> nprint(mpf(fp.quad(f, [0,fp.pi], [0,2*fp.pi])/(4*fp.pi)), 13)
1.725503028069 1.725503028069
>>> nprint(elliprg(x,y,z), 13) >>> nprint(elliprg(x,y,z), 13)
1.725503028069 1.725503028069
""" """
x = ctx.convert(x) x = ctx.convert(x)
y = ctx.convert(y) y = ctx.convert(y)
z = ctx.convert(z) z = ctx.convert(z)
if not z: x, z = z, x zeros = (not x) + (not y) + (not z)
if not z: y, z = x, y if zeros == 3:
if not z: return ctx.inf return (x+y+z)*0
if zeros == 2:
if x: return 0.5*ctx.sqrt(x)
if y: return 0.5*ctx.sqrt(y)
return 0.5*ctx.sqrt(z)
if zeros == 1:
if not z:
x, z = z, x
def terms(): def terms():
T1 = 0.5*z*ctx.elliprf(x,y,z) T1 = 0.5*z*ctx.elliprf(x,y,z)
T2 = -0.5*(x-z)*(y-z)*ctx.elliprd(x,y,z)/3 T2 = -0.5*(x-z)*(y-z)*ctx.elliprd(x,y,z)/3
T3 = 0.5*ctx.sqrt(x*y/z) T3 = 0.5*ctx.sqrt(x)*ctx.sqrt(y)/ctx.sqrt(z)
return T1,T2,T3 return T1,T2,T3
return ctx.sum_accurately(terms) return ctx.sum_accurately(terms)
@defun_wrapped @defun_wrapped
def ellipf(ctx, phi, m): def ellipf(ctx, phi, m):
r""" r"""
Evaluates the Legendre incomplete elliptic integral of the first kind Evaluates the Legendre incomplete elliptic integral of the first kind
.. math :: .. math ::
 End of changes. 3 change blocks. 
5 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)