Do you want to work on this issue?
You can request for a bounty in order to promote it!
Inconsistent autoscroll (jumps) in preview mode #2568
mahdikooshkbaghi posted onGitHub
Current behavior
When I add some text at the end of my markdown file and hit enter the preview will jump to somewhere in the middle of the text. Scrolling back to the end of the preview window is working as expected, however, hitting enter will bring the preview again to the wrong position. I have put my Markdown text at the end of this issue as well.
Environment
- Version : Boostnote 0.11.10
- OS Version and name : Linux Mint 18.1
My markdown file
Kuramoto Model
The model is consist of $N$ coupled oscillators, $\theta_i(t)$, with natural frequencies $\omega_i$ deduced from the distribution $g(\omega)$. $$\frac{d\theta_i}{dt}=\omega_i+\Sigma_{j=1}^N K_{ij}\sin(\theta_i-\theta_j)$$ Each oscillator tries to run independently at its own frequency while the coupling tends to synchronize it to all the others. By making a suitable choice of a rotating frame, $$\theta_i \rightarrow \theta_i-\Omega t$$ in which $\Omega$ is the first moment of $g(\omega)$, we can transform the system to system of phase oscillators whose natural frequencies have zero mean. Many different models for the coupling matrix $K_{ij}$ have been considered such as nearest-neighbor coupling, hierarchical coupling, random long-range coupling or even state dependent interactions.
Kuramoto model with mean-field coupling
For this model, synchronization is conveniently measured by an order parameter. In the limit of infinitely many oscillators, $N = \infty$, the modulus of the order parameter vanishes if the oscillators are out of synchrony, and it is positive in synchronized states.
The original analysis of synchronization by Kuramoto consider mean-field coupling, $K_{ij}=K/N>0$, where $K$ is coupling constant.
def Kuramoto_orig(t, theta, arg):
omega, K, N = arg
theta_t = theta[:,None]
delta_theta = theta-theta_t
dtheta = omega + (K/N)*np.sum(np.sin(delta_theta), axis=1)
return dtheta
The complex valued order parameter can be defined as: $$re^{i\psi}=\frac{1}{N}\Sigma_{j=1}^N e^{i\theta_j}$$
- $0 \leq r(t) \leq 1$ is the phase coherence.
- $\psi(t)$ is the average pahse.
Then the equation becomes, $$\frac{d\theta_i}{dt}=\omega_i+Kr\sin (\psi-\theta_i)$$def order_parameter(theta): theta = theta.T z = sum(np.exp(theta*1j))/len(theta) return np.array([np.absolute(z), np.angle(z)])
For $N=500, K=6$:
For $N=500, K=1$
# Original Kuramoto
# Fix random init state
np.random.seed(123)
# Network parameters
N = 500
K = 6
# time interval
t0 = 0
dt = 1e-3
tf = 5000*dt
# initial condition
theta_0 = np.random.uniform(0, 2.*np.pi, N)
# Natural frequency
omega = np.random.uniform(-np.pi, np.pi, N)
arg = [omega, K, N]
solver = ode(Kuramoto_orig)
solver.set_integrator('vode',
atol = 1e-8,
rtol = 1e-6)
solver.set_f_params(arg)
solver.set_initial_value(theta_0,t0)
tvals = []
x = []
i = 0
while solver.successful() and solver.t < tf:
solver.integrate(solver.t+dt)
tvals.append(solver.t)
x.append(solver.y)
i += 1
x = np.asarray(x)
R, psi = order_parameter(x)