Esempio n. 1
0
def plotTresserPairs(osc, bounds, bordersEq, ps, pathToDir, imageName):
    eqList = sf.findEquilibria(osc.getRestriction, osc.getRestrictionJac, bounds, bordersEq,
                               sf.ShgoEqFinder(300, 30, 1e-10),ps)
    gfe = sf.getTresserPairs(eqList, osc, ps)

    xs = ys = np.linspace(0, +2 * np.pi, 1001)
    res = np.zeros([len(xs), len(xs)])
    for i, y in enumerate(ys):
        for j, x in enumerate(xs):
            res[i][j] = np.log10(np.dot(osc.getRestriction([x, y]), osc.getRestriction([x, y])) + 1e-10)

    matplotlib.rcParams['figure.figsize'] = 10, 10

    plt.pcolormesh(xs, ys, res, cmap=plt.cm.get_cmap('RdBu'))
    plt.xlim([0, +2 * np.pi])
    plt.ylim([0, +2 * np.pi])
    plt.xlabel('$\gamma_3$')
    plt.ylabel('$\gamma_4$')
    plt.axes().set_aspect('equal', adjustable='box')
    for pair in gfe:
        saddle, sadfoc = pair
        p1 = plt.scatter(saddle.coordinates[0], saddle.coordinates[1], c='green', s=40)
        p2 = plt.scatter(sadfoc.coordinates[0], sadfoc.coordinates[1], c='red', s=40)
    plt.legend([p1, p2], ["Седло", "Седло-фокус"])
    fullOutputName = os.path.join(pathToDir, imageName + '.png')
    plt.savefig(fullOutputName)
def workerChectTargHet(params):
    (i, a), (j, b) = params
    ud = [0.5, a, b, 1]
    osc = sys.FourBiharmonicPhaseOscillators(ud[0], ud[1], ud[2], ud[3])
    eqf = sf.ShgoEqFinder(300, 30, 1e-10)
    result = fth.checkTargetHeteroclinic(osc, bordersEq, bounds, eqf,
                                         sf.STD_PRECISION, sf.STD_PROXIMITY,
                                         1000.)
    return i, j, a, b, result
def workerCheckTarget(params, paramR, events, pset: sf.PrecisionSettings,
                      proxs: sf.ProximitySettings):
    (i, a), (j, b) = params
    ud = [0.5, a, b, paramR]
    osc = a4d.FourBiharmonicPhaseOscillators(ud[0], ud[1], ud[2], ud[3])
    eqf = sf.ShgoEqFinder(300, 30, 1e-10)
    result = fth.checkTargetHeteroclinic(osc, bordersEq, bounds, eqf, pset,
                                         proxs, 1000., events)
    return i, j, a, b, result
Esempio n. 4
0
def workerStartPts(params, pset: sf.PrecisionSettings):
    (i, a), (j, b) = params
    ud = [0.5, a, b, 1]
    osc = a4d.FourBiharmonicPhaseOscillators(ud[0], ud[1], ud[2], ud[3])
    eqf = sf.ShgoEqFinder(300, 30, 1e-10)
    result = fth.getStartPtsForLyapVals(osc,
                                        bordersEq,
                                        bounds,
                                        eqf,
                                        pset,
                                        OnlySadFoci=False)
    return i, j, a, b, result
Esempio n. 5
0
 def test_FindEqInSinglePoint3(self, stdPS):
     ud = [-1.5, 0.5, 0, 0]
     rhsCurrent = lambda X: self.rhs(X, ud)
     rhsJacCurrent = lambda X: self.rhsJac(X, ud)
     res = sf.findEquilibria(rhsCurrent, rhsJacCurrent,
                             self.bounds, self.borders,
                             sf.ShgoEqFinder(300, 10, 4e-14), stdPS)
     data = []
     for eq in res:
         data.append(eq.getEqType(stdPS)[0:3])
     describe = sf.describePortrType(data)
     assert describe == self.analyticFind(ud)
Esempio n. 6
0
import time

#Задаем область поиска локальных минимумов для численного метода, а также более точную область поиска.

bounds = [(-0.1, +2 * np.pi + 0.1), (-0.1, +2 * np.pi + 0.1)]
bordersEq = [(-1e-15, +2 * np.pi + 1e-15), (-1e-15, +2 * np.pi + 1e-15)]

# Разбиваем значения параметров на сетку

N = 7  # Количество разбиений параметра альфа
M = 7  # Количество разбиений параметра бета

alphas = np.linspace(0, 2 * np.pi, N)
betas = np.linspace(0, 2 * np.pi, M)

ps = sf.STD_PRECISION

start = time.time()

for i, a in enumerate(alphas):
    for j, b in enumerate(betas):
        # Устанавливаем значения параметров системы
        ud = [0.5, a, b, 1]
        osc = a4d.FourBiharmonicPhaseOscillators(ud[0], ud[1], ud[2], ud[3])
        eqf = sf.ShgoEqFinder(300, 30, 1e-10)
        ret = fth.checkTargetHeteroclinic(osc, bordersEq, bounds, eqf,
                                          sf.STD_PRECISION, sf.STD_PROXIMITY,
                                          1000.)

end = time.time()
print("Took {}s".format(end - start))