1

I'm trying to plot a parameterized function:

\begin{tikzpicture}

\def\pa{1.0*10^-8};
\def\pb{9.3*10^-8};
\def\pc{1.92};
\def\pd{4052};
\def\pe{0.000318};

\begin{axis}
[xmin=0, xmax=60000
,ymin=0,ymax=150
,scaled x ticks=base 10:-3]

    \addplot [
    ,domain=0:60000
    ,restrict y to domain=0:150] 
    {
        (900*\pc + 30*\pe*pi*x + \pb*pi^2*x^2) / (30*\pa*\pd*pi*x)
    }; 
\end{axis}
\end{tikzpicture}

Unfortunately, I get the message "Number too big", and I can't seem to find a solution.

I'm not sure how to use \pgfkeys{/pgf/fpu} in this case and whether it is going to help at all.

How can I configure pgfplots to actually plot my function?

  • Can you reduce the number of everything (domain, numbers, etc.)? It seems that TikZ cannot parse such big numbers. – manooooh Oct 30 '18 at 21:53
  • Do you mean reducing the x range by a factor of 1000 and adopting the parameters? – DPF Oct 30 '18 at 22:22
  • Sorry, I am not familiar with big numbers. i mean if you could work with lowest numbers, such that \def\pa{1.0*10^-4}; or something like that. It was an idea, do not put it into practice and read the excellent answers! – manooooh Oct 30 '18 at 22:31
1

Welcome to TeX.SE! It helps to divide the numerator and denominator by \pa since then there won't be the product \pa*\pb any more.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}

\def\pa{1.0*10^-8};
\def\pb{9.3*10^-8};
\def\pc{1.92};
\def\pd{4052};
\def\pe{0.000318};

\begin{axis}
[xmin=0, xmax=60000
,ymin=0,ymax=150
,scaled x ticks=base 10:-3]

    \addplot [
    ,domain=0:60000
    ,restrict y to domain=0:150] 
    {
        (900*(\pc/\pa) + 30*(\pe/\pa)*pi*x + (\pb/\pa)*pi^2*x^2) / (30*\pd*pi*x)
    }; 
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

  • It seems that (900*\pc + 30*\pe*pi*x + \pb*pi^2*x^2) / (30*\pa*\pd*pi*x) is not equal to (900*(\pc/\pa) + 30*(\pe/\pa)*pi*x + (\pb/\pa)*pi^2*x^2) / (30*\pd*pi*x) but I am sure that you keep the same formula. Are they equal? – manooooh Oct 30 '18 at 22:29
  • 1
    @manooooh I divide both numerator and denominator by \pa, why should that not be valid? Or is there a typo? – user121799 Oct 30 '18 at 22:31
  • 1
    Forgot that, your expressions are indeed the same! – manooooh Oct 30 '18 at 22:33

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.