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