Custom ODEs

Demonstrating usage of deeptime.data.custom_ode().

One is able to define ODEs of the form

dXt=F(Xt)\mathrm{d}X_t = F(X_t)

for XtRdX_t\in\mathbb{R}^d, d{1,2,3,4,5}d\in\{1,2,3,4,5\}.

plot custom ode
15 import matplotlib.pyplot as plt
16 import numpy as np
17
18 from deeptime.data import custom_ode
19
20 h = 1e-1
21 n_steps = 2
22 n_evals = 50
23
24 final_time = h * n_steps * (n_evals-1)
25
26 ode = custom_ode(dim=1, rhs=lambda x: [-.5 * x[0]], h=h, n_steps=n_steps)
27 traj = ode.trajectory(x0=1., length=n_evals)
28
29 xs = np.linspace(0, final_time, num=n_evals)
30 plt.plot(xs, traj, 'x')
31
32 plt.plot(xs, np.exp(-.5 * xs))

Total running time of the script: ( 0 minutes 0.313 seconds)

Estimated memory usage: 8 MB