# Error when graphing exponential function in pgfplots: Package PGF Math Error: Could not parse input '' as a floating point number

I'm attempting to graph the following function:

y = 0.00001096897 + 0.0003330018 * e ^ (−2.521376 * x)

However, I keep getting the error message:

 Package PGF Math Error: Could not parse input '' as a floating point number, sorry. The unreadable part was near ''. (in '0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)').


Below is my MWE:

\documentclass[12pt]{article}

\usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{tikz} \usepackage{graphicx} \usepackage{siunitx}

\begin{document}

\begin{figure}[h!] \centering \begin{tikzpicture} \begin{axis}[
width=\textwidth,
height = 20em,
draw = none]
\addplot[blue, smooth]{0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)}; \end{axis} \end{tikzpicture} \label{fig:repeatgraph} \end{figure}

\end{document}


Any help would be appreciated.

• You have nonstandard characters in your code.
– user121799
Jul 2, 2019 at 5:21
• The minus in front of 2.521376 is not a standard minus. Replace it by a real minus. You can also use 0.00001096897 + 0.0003330018 * exp (-2.521376 * x). Copy this literally, without replacing the minus by a nonstandard character.
– user121799
Jul 2, 2019 at 5:24
• In laymans terms, use ascii chars for this. The minus is probably a unicode char which is not handled by the pgf math engine Jul 2, 2019 at 5:56
• @Raaja a lot of people does not know what "nonstandard characters" mean. Just see all those examples with invisible unicode chars that no-one knows where came from Jul 2, 2019 at 7:53
• @Raaja try looking up the unicode char greek question mark, then consider all the programming languages that uses the similar ascii char. Jul 2, 2019 at 9:31

Finding the non-ascii characters is the hard part. If you have them, you can (re)define them using DeclareUnicodeCharacter:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{siunitx}

\DeclareUnicodeCharacter{2212}{-}

\begin{document}

\begin{figure}[h!]
\centering
\begin{tikzpicture} \begin{axis}[
width=\textwidth,
height = 20em,
draw = none]
\addplot[blue, smooth]{0.00001096897 + 0.0003330018 * 2.718 ^ (−2.521376 * x)}; \end{axis} \end{tikzpicture} \label{fig:repeatgraph}
\end{figure}

\end{document}