# Phase plane diagrams in latex [closed]

Is there any method to construct phase plane diagrams directly in latex? I want to sketch plots like these based on eigenvalues of a matrix.

For e.g., if both the eigenvalues of a 2-by-2 matrix are real, distinct, and negative, this plot should result (which I have drawn in MATLAB).

• I have voted to close because the comment below the answer of marmot shows, that this is rather a (interesting) math question. Mar 8, 2019 at 7:27
• If your question is about solving and plotting ord. diff. equations (ODEs) with LaTeX, PSTricks package pst-ode could be of help. See, for instance, tex.stackexchange.com/a/373955 . Mar 8, 2019 at 7:41
• @Alex: Yes. Something similar to that. Okay, I will explore pst-ode. Thank you. Mar 8, 2019 at 9:34

This question has IMHO two aspects:

1. How can one add bent arrows to a path?
2. How can one guess the parametrizations of the curves (RG flows?) you show.

As for 1., I am using these styles, and as for 2., I quickly guessed something that looks similar.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,bending,decorations.markings}
% from https://tex.stackexchange.com/a/430239/121799
\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
arc arrow/.style args={%
to pos #1 with length #2 and options #3}{
decoration={
markings,
mark=at position 0 with {\pgfextra{%
\pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
\xdef\tmpArrowTime{\tmpArrowTime}}},
mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
mark=at position {#1} with {\coordinate(@4);
\draw[-{Stealth[length=#2,bend,#3]}]
(@1) .. controls (@2) and (@3) .. (@4);},
},
postaction=decorate,
}
}

\begin{document}
\begin{tikzpicture}[thick,
curved arrow/.style={arc arrow={to pos #1 with length 2mm and options {}}},
reversed curved arrow/.style={arc arrow={to pos #1 with length 2mm and options reversed}}]
\begin{scope}
\draw (-3,0) -- (3,0) node[below] {$x_1$};
\draw (0,-3) -- (0,3) node[left] {$x_2$};
\foreach \X in {2,2.5}
{\draw[rotate=45,curved arrow=0.25] circle (\X cm and 0.4*\X cm);}
\end{scope}
\begin{scope}[xshift=7cm]
\draw (-3,0) -- (3,0) node[below] {$x_1$};
\draw (0,-3) -- (0,3) node[left] {$x_2$};
\draw (-120:pi) -- (60:pi) node[pos=0.9,left]{$v_2$};
\draw[rotate=-20,reversed curved arrow=0.2,curved arrow=0.8]
plot[variable=\x,domain=-1.8:1.8,samples=101] (\x,-\x^3+2*\x);
\draw[rotate=-10,reversed curved arrow=0.2,curved arrow=0.8]
plot[variable=\x,domain=-1.8:1.8,samples=101] (1.5*\x,-\x^3+2*\x);
\end{scope}
\end{tikzpicture}
\end{document}


• Thank you very much for the help. I guess you have provided a particular function in the code. In general, we do not know the nature of the curve (hence the function to draw), but we only know the eigenvalues of the matrix. So, is there something that on the basis of eigenvalues, I get a plot? see for example, the image I just added. Mar 8, 2019 at 6:25
• @Abhinav Sinha I think, that your question is now a pure math question and has no connection to LaTeX anymore. LaTeX is not a versatile math software and I would advise you to use another way to get your equation. Once you have the equation and understand what you are doing mathematically, you can use LaTeX to present the diagram. Mar 8, 2019 at 7:08
• @AbhinavSinha If you want to solve a differential equation with the packages the question is tagged with, you can do that using e.g. tex.stackexchange.com/a/139141/121799 or tex.stackexchange.com/a/471743/121799. (Notice that, even though I used pstricks for many many years and was really happy with it, I could not go back to use pst-ode or something of that sort, but this is only a personal opinion.) In any case, one can only solve an ODE if one has it, or diagonalize a matrix if one has it. You do not provide any of those.
– user121799
Mar 8, 2019 at 17:11
• Thank you everyone. This discussion has been quite helpful. Mar 9, 2019 at 17:54