void verifyExistenceOfPeriodicOrbit(IPoincareMap& pm, IVector X, int period) { IVector center = midVector(X); interval returnTime; // Center is 2-dimensional. Embed it into Poincare section, i.e. add first coordinate x=0. // Define a tripleton representation of the center of X. C0HOTripletonSet s1({interval(0.),center[0],center[1]}); // Compute iteration of Poincare map at the center (3-dim object is returned). IVector y = pm(s1,returnTime,period); // Project it onto 2-dim Poincare section, first coordinate is ignored. IVector imCenter(2,y.begin()+1); // Derivative of PM on the set X. // Define doubleton representation of the first order variational equations. C1HORect2Set s2({interval(0.),X[0],X[1]}); // The matrix monodromyMatrix will store derivatives of the FLOW not Poincare map. IMatrix monodromyMatrix(3,3); y = pm(s2,monodromyMatrix,returnTime,period); // This member function recomputes derivatives of the flow into derivatives of Poincare map IMatrix DP = pm.computeDP(y,monodromyMatrix); // We extract a 2x2 slice from 3x3 DP matrix and subtract identity. IMatrix DP_Minus_Id(2,2); DP_Minus_Id[0][0] = DP[1][1] - 1.; DP_Minus_Id[0][1] = DP[1][2]; DP_Minus_Id[1][0] = DP[2][1]; DP_Minus_Id[1][1] = DP[2][2] - 1.; // Compute interval Newton operator. IVector N = center - capd::matrixAlgorithms::gauss(DP_Minus_Id,imCenter-center); // Verification if N is a subset of X cout << "\n---------------------------------------------------\n\nN = " << N << endl; cout << "X = " << X << endl; cout << "Return time: " << returnTime << endl; if(subsetInterior(N,X)) cout << "the existence of period " << period << " orbit verified\n"; else { cout << "N is not a subset of X\n\n"; cout << "diam(N)=" << diam(N) << endl; cout << "diam(X)=" << diam(X) << endl; cout << "N-X" << N-X << endl; } }
static auto prepare_it(IIterator ifirst, IIterator ilast, EIterator efirst, EIterator elast, IVector& ivec, EVector& evec) { std::copy(ifirst, ilast, std::back_inserter(ivec)); auto input_first = ivec.begin(); auto input_last = ivec.end(); if (Denoising) { std::copy(efirst, elast, std::back_inserter(evec)); auto expected_first = evec.begin(); auto expected_last = evec.end(); return std::make_tuple(input_first, input_last, expected_first, expected_last); } else { return std::make_tuple(input_first, input_last, input_first, input_last); } }