def test_check_undefined_variable(self): x = symbols("x") SDE = jitcsde_jump( IJI, amp, [y(0)], [x] ) with self.assertRaises(ValueError): SDE.check()
def test_check_index_too_high(self): SDE = jitcsde_jump( IJI, amp, [y(0)], [y(1)] ) with self.assertRaises(ValueError): SDE.check()
def test_check_index_negative(self): SDE = jitcsde_jump( IJI, amp, [y(0)], [y(-1)] ) with self.assertRaises(ValueError): SDE.check()
def testError(self): with self.assertRaises(NotImplementedError): SDE = jitcsde_jump( IJI, amp, f, g, ito=False )
def setUp(self): self.R = np.random.RandomState(42) IJI = lambda t,y: self.R.exponential( 1/λ ) amp = lambda t,y: self.R.normal( 0.0, 1+1/(1+y**2), (1,) ) self.SDE = jitcsde_jump( IJI, amp, f, g )
p = 0.1 f = [ σ * (y(1)-y(0)), y(0)*(ρ-y(2)) - y(1), y(0)*y(1) - β*y(2) ] g = [ p*y(i) for i in range(3) ] def IJI(time,state): return numpy.random.exponential(1.0) def jump(time,state): return numpy.array([ 0.0, 0.0, numpy.random.normal(0.0,abs(state[2])) ]) SDE = jitcsde_jump(IJI,jump,f,g) initial_state = numpy.random.random(3) SDE.set_initial_value(initial_state,0.0) data = [] for time in numpy.arange(0.0, 100.0, 0.01): data.append( SDE.integrate(time) ) numpy.savetxt("timeseries.dat", data)