In trying to graph the intersection of 3^x and x^3, I was shrinking the domain to properly show one of the intersections. However, once I reduce the domain, I get either Dimension too large, or TeX Capacity Exceeded.
Furthermore, there appears to be at least 6 intersection points (when there should only be one), and the intersection point appears to be in the wrong spot compared to manually pin pointing the intersection. Is this just a round-off issue?.
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{intersections}
\begin{document}
%% Uncommenting these two results in TeX Capacity exceeded
%\newcommand*{\XAxisMin}{2.47805}%
%\newcommand*{\XAxisMax}{2.47810}%
% These two settings produce a graph
\providecommand*{\XAxisMin}{2.47500}%
\providecommand*{\XAxisMax}{2.48000}%
\pgfmathdeclarefunction{GivenF}{1}{\pgfmathparse{(#1)^(3)}}
\pgfmathdeclarefunction{GivenG}{1}{\pgfmathparse{(3)^(#1)}}
\newcommand*{\ShowIntersection}[3]{
\fill
[name intersections={of=#1 and #2, name=i, total=\t}]
[brown, opacity=1, every node/.style={black, opacity=1}]
\foreach \s in {1,...,\t}{(i-\s) circle (3pt)
node [above left, blue] {#3}};
}
\begin{tikzpicture}
\begin{axis}[xmin=\XAxisMin, xmax=\XAxisMax, ymin=15.16, ymax=15.26]
\addplot[domain=\XAxisMin:\XAxisMax, samples=400,
smooth,ultra thick,blue,name path global=GraphF]
{GivenF(x)} node [below left, xshift=-1.0em] {$y=x^3$};
\addplot[domain=\XAxisMax:\XAxisMin, samples=400,
smooth,ultra thick,red,name path global=GraphG]
{GivenG(x)} node [above right, yshift=5.0ex] {$y=3^x$};
% Manually mark where I think the intersection should be
\addplot [mark=*] coordinates{(2.478053,15.2171)}%
node [left] {$(2.478053,15.2171)$};%
% Results in at least 6 intersection points
\ShowIntersection{GraphF}{GraphG}{$(2.478053,15.2171)$}
\end{axis}
\end{tikzpicture}
\end{document}
The \ShowIntersections is from Intersections in PGFplots.