In [1]:
%matplotlib inline
In [2]:
import sys
import os.path
import itertools
import numpy as np
import matplotlib.pyplot as plt
In [3]:
sys.path.append(os.path.abspath(".."))
import continuate
In [4]:
import logging
logging.disable(logging.INFO)
$f_\mu(x, y) = (x^2 - \mu, y)$, $x_0 = (1, 0), \mu_0 = 1$
In [5]:
f = lambda x, mu: np.array([x[0]**2 - mu, x[1]])
x0 = np.array([1.0, 0.0])
m0 = 1.0
In [6]:
opt = continuate.get_default_options()
G = continuate.single_parameter.continuation(f, x0, m0 ,-0.1, **opt)
ms = []
x0s = []
for x, m, _ in itertools.islice(G, 30):
ms.append(m)
x0s.append(x[0])
In [7]:
plt.plot(ms, x0s, "*", label="continuation")
y = np.array(x0s) ** 2
plt.plot(y, x0s, label="exact")
# plt.axis("tight")
plt.legend(loc=2)
plt.xlabel(r"$\mu$")
plt.ylabel("x0")
Out[7]: