"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/tests/test_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.

test_elliptic.py  (mpmath-0.19):test_elliptic.py  (mpmath-1.0.0)
skipping to change at line 594 skipping to change at line 594
def test_elliptic_integrals(): def test_elliptic_integrals():
# Test cases from Carlson's paper # Test cases from Carlson's paper
mp.dps = 15 mp.dps = 15
assert elliprd(0,2,1).ae(1.7972103521033883112) assert elliprd(0,2,1).ae(1.7972103521033883112)
assert elliprd(2,3,4).ae(0.16510527294261053349) assert elliprd(2,3,4).ae(0.16510527294261053349)
assert elliprd(j,-j,2).ae(0.65933854154219768919) assert elliprd(j,-j,2).ae(0.65933854154219768919)
assert elliprd(0,j,-j).ae(1.2708196271909686299 + 2.7811120159520578777j) assert elliprd(0,j,-j).ae(1.2708196271909686299 + 2.7811120159520578777j)
assert elliprd(0,j-1,j).ae(-1.8577235439239060056 - 0.96193450888838559989j) assert elliprd(0,j-1,j).ae(-1.8577235439239060056 - 0.96193450888838559989j)
assert elliprd(-2-j,-j,-1+j).ae(1.8249027393703805305 - 1.221847578482703585 5j) assert elliprd(-2-j,-j,-1+j).ae(1.8249027393703805305 - 1.221847578482703585 5j)
# extra test cases
assert elliprg(0,0,0) == 0
assert elliprg(0,0,16).ae(2)
assert elliprg(0,16,0).ae(2)
assert elliprg(16,0,0).ae(2)
assert elliprg(1,4,0).ae(1.2110560275684595248036)
assert elliprg(1,0,4).ae(1.2110560275684595248036)
assert elliprg(0,4,1).ae(1.2110560275684595248036)
# should be symmetric -- fixes a bug present in the paper
x,y,z = 1,1j,-1+1j
assert elliprg(x,y,z).ae(0.64139146875812627545 + 0.58085463774808290907j)
assert elliprg(x,z,y).ae(0.64139146875812627545 + 0.58085463774808290907j)
assert elliprg(y,x,z).ae(0.64139146875812627545 + 0.58085463774808290907j)
assert elliprg(y,z,x).ae(0.64139146875812627545 + 0.58085463774808290907j)
assert elliprg(z,x,y).ae(0.64139146875812627545 + 0.58085463774808290907j)
assert elliprg(z,y,x).ae(0.64139146875812627545 + 0.58085463774808290907j)
for n in [5, 15, 30, 60, 100]: for n in [5, 15, 30, 60, 100]:
mp.dps = n mp.dps = n
assert elliprf(1,2,0).ae('1.31102877714605990523241979494555970684137747 57158115814084108519003952935352071251151477664807145467230678763') assert elliprf(1,2,0).ae('1.31102877714605990523241979494555970684137747 57158115814084108519003952935352071251151477664807145467230678763')
assert elliprf(0.5,1,0).ae('1.854074677301371918433850347195260046217598 823521766905585928045056021776838119978357271861650371897277771871') assert elliprf(0.5,1,0).ae('1.854074677301371918433850347195260046217598 823521766905585928045056021776838119978357271861650371897277771871')
assert elliprf(j,-j,0).ae('1.8540746773013719184338503471952600462175988 23521766905585928045056021776838119978357271861650371897277771871') assert elliprf(j,-j,0).ae('1.8540746773013719184338503471952600462175988 23521766905585928045056021776838119978357271861650371897277771871')
assert elliprf(j-1,j,0).ae(mpc('0.79612586584233913293056938229563057846 592264089185680214929401744498956943287031832657642790719940442165621412', assert elliprf(j-1,j,0).ae(mpc('0.79612586584233913293056938229563057846 592264089185680214929401744498956943287031832657642790719940442165621412',
'-1.2138566698364959864300942567386038975419875860741507618279563735 753073152507112254567291141460317931258599889')) '-1.2138566698364959864300942567386038975419875860741507618279563735 753073152507112254567291141460317931258599889'))
assert elliprf(2,3,4).ae('0.58408284167715170669284916892566789240351359 699303216166309375305508295130412919665541330837704050454472379308') assert elliprf(2,3,4).ae('0.58408284167715170669284916892566789240351359 699303216166309375305508295130412919665541330837704050454472379308')
assert elliprf(j,-j,2).ae('1.0441445654064360931078658361850779139591660 747973017593275012615517220315993723776182276555339288363064476126') assert elliprf(j,-j,2).ae('1.0441445654064360931078658361850779139591660 747973017593275012615517220315993723776182276555339288363064476126')
assert elliprf(j-1,j,1-j).ae(mpc('0.939120502186193711966246171697811411 61485651998254431830645241993282941057500174238125105410055253623847335313', assert elliprf(j-1,j,1-j).ae(mpc('0.939120502186193711966246171697811411 61485651998254431830645241993282941057500174238125105410055253623847335313',
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added

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