elliptic.py 761 B

12345678910111213141516171819202122232425262728293031
  1. """
  2. Copyright 2011 Mario Mulansky
  3. Copyright 2012 Karsten Ahnert
  4. Stochastic euler stepper example and Ornstein-Uhlenbeck process
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE_1_0.txt or
  7. copy at http://www.boost.org/LICENSE_1_0.txt)
  8. """
  9. from pylab import *
  10. from scipy import special
  11. data1 = loadtxt("elliptic1.dat")
  12. data2 = loadtxt("elliptic2.dat")
  13. data3 = loadtxt("elliptic3.dat")
  14. sn1,cn1,dn1,phi1 = special.ellipj( data1[:,0] , 0.51 )
  15. sn2,cn2,dn2,phi2 = special.ellipj( data2[:,0] , 0.51 )
  16. sn3,cn3,dn3,phi3 = special.ellipj( data3[:,0] , 0.51 )
  17. semilogy( data1[:,0] , abs(data1[:,1]-sn1) )
  18. semilogy( data2[:,0] , abs(data2[:,1]-sn2) , 'ro' )
  19. semilogy( data3[:,0] , abs(data3[:,1]-sn3) , '--' )
  20. show()