dx1 = i2 - sinf(x1) + alpha * (i1 - sinf(x0)) + (alpha * a1 + a2) * cosf(omega * t + phi0); """ ns_map = {0: ['ns0', 0], 1: [0, 'ns0']} period_map = { 0: sde.PeriodInfo(period=2.0 * math.pi, freq=1), 1: sde.PeriodInfo(period=2.0 * math.pi, freq=1) } sdei = sde.SDE(code, sim_params, num_vars=2, num_noises=2, const_pars=const_pars, noise_map=ns_map, period_map=period_map, local_vars=local_vars) output = { 'path': { 'main': [sde.OutputDecl(func=sde.avg_moments, vars=[0, 1])], }, 'summary': { 'main': [sde.OutputDecl(func=sde.drift_velocity, vars=[0, 1])], # 'abs': [sde.OutputDecl(func=sde.abs_drift_velocity, vars=[0, 1])], } } sdei.prepare(sde.SRK2, init_vector, freq_var='omega') sdei.simulate(output)
dx0 = x1; dx1 = -psd * sinf(x0) - gamma_ * x1 + force; """ noise_map = {1: ['ns']} period_map = {0: sde.PeriodInfo(period=2.0 * numpy.pi, freq=1)} sde_ = sde.SDE(code, params, num_vars=2, num_noises=1, noise_map=noise_map, period_map=period_map, local_vars=local_vars) output = { 'summary': { 'main': [sde.OutputDecl(func=sde.diffusion_coefficient, vars=[0])], }, 'path': { 'main': [ sde.OutputDecl(func=diffusion_coefficient, vars=[0]), sde.OutputDecl(func=max_min, vars=[0]) ], 'vhist': [sde.OutputDecl(func=myhist, vars=[1])], } } sde_.prepare(sde.SRK2, init_vector) sde_.simulate(output)