# Inverse of the standard map

I'm trying to plot the homoclinic tangle that can be observed following the evolution of the unstable and stable manifolds of the standard map. The map I am using is defined as:$$\begin{cases}p_{n+1}=p_{n}+k\cdot \sin\big(\theta_{n}\big) \\ \theta_{n+1}=\big(\theta_{n}+p_{n+1}\big)\mod(2\pi) \end{cases}$$

Generating a given number of initial conditions in a neighbourhood of the point $$(\pi,0)$$ I am able to follow the evolution of the stable manifold (I suppose that it is the stable one, given the fact that I iterate the map forward in time),as it approximates the starting point, but eventually explodes as it became closer to it.

I am instead unable to plot the evolution backward in time of the set of initial conditions, which should be controlled by the inverse of the map. I tried to calculate the inverse of the map by insulating the term $$p_n$$ and $$\theta_n$$ in the previous definition, but I found the same behavior of the direct map. Where I am wrong? I was unable to find a definition for the inverse map online, and if it is possible to use the direct form of the map for the backward evolution.

A possible error in the calculation of the inverse map is to miss that $$\theta_{n+1}$$ is being defined not in terms of $$p_{n}$$, but of $$p_{n+1}$$: the latter should therefore first be expanded in terms of $$\theta_{n}$$ and $$p_n$$, before an attempt to invert the map.