1

I want to graph a part of y = e^{\sqrt{x}} for x up to 10^5. I wrote down the following:

\begin{tikzpicture}[scale=0.8, samples=200]
\draw [thick, <->] (0,5) -- (0,0) -- (8,0);
\node [below right] at (7,0) {$x$};
\node [left] at (0,5) {$y$};
\draw[smooth, thick, domain=0:7] plot (\x, {exp((sqrt(\x)))});

However, even though I look for scaling problems over here, somehow I could not find a way to do it. How can I fix the problem?

5
  • Hello and welcome ! What is the point of plotting such large numbers ? What is your objective ?
    – BambOo
    Apr 23, 2020 at 14:20
  • You might try creating a new function using \pgfmathparseFPU, but even if the numbers are calculated accurately, I'm not sure TikZ can handle them. Apr 23, 2020 at 15:13
  • @BambOo, I want to intersect my function with another function and they intersect when x =~500 so that is why. My bad.
    – Ninja
    Apr 23, 2020 at 15:33
  • What is the second function ?
    – BambOo
    Apr 23, 2020 at 15:38
  • I simplifed the exp. function so let us say that it is just the line x = 3500.
    – Ninja
    Apr 23, 2020 at 15:49

1 Answer 1

3

Here is a starting point, based on your comments. Note that these large numbers may lead to some numerical problems using latex even with floating point calculations.

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{tikzpicture}
\begin{axis}
    \pgfkeys{/pgf/fpu=true}
    \addplot[domain=3400:3600] {exp(sqrt(\x))};
    \addplot coordinates {(3500, 0) (3500,1e26)};
    \pgfkeys{/pgf/fpu=false}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

EDIT taking into account additional style demands

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{tikzpicture}
\begin{axis}[xlabel={$x$},ylabel={$y$},xtick=\empty,ytick=\empty,axis x line=bottom, axis y line=left,
    ylabel style={rotate=-90,at={(ticklabel cs:1)}},xlabel style={at={(ticklabel cs:0.875)}}]
    \pgfkeys{/pgf/fpu=true}
    \addplot[color=black,domain=3400:3600] {exp(sqrt(\x))};
    \addplot[color=black] coordinates {(3500, 0) (3500,1e26)};
    \pgfkeys{/pgf/fpu=false}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1
  • Thanks, but do not want the values at the bottom and on the left. I need coordinate axes as in my code
    – Ninja
    Apr 23, 2020 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.