I have a problem using the TikZ/pgfplots package in LaTeX. I need to graph a function like this:
$y=-\log_{10} (0.5\cdot (-x+\sqrt{x^2+4 \cdot 10^{-14}})$
And I have been using this code without results:
\documentclass{article}
\usepackage{pgfplots}
\pgfmathdeclarefunction{a}{1}{\pgfmathparse{(0.1*(#1-50)/(50+#1))}}
\pgfmathdeclarefunction{c}{1}{\pgfmathparse{-log10(0.5*(-#1+(#1^2+4*10^(-14))^0.5))}}
\pgfplotsset{compat=newest,
width=150mm,
height=100mm}
\begin{document}
\begin{center}
\Large $y=-\log_{10} (0.5\cdot (-x+\sqrt{x^2+4 \cdot 10^{-14}})$
\igskip
\begin{tikzpicture}
\begin{axis} [
xlabel = {$V$},
ylabel = {$pH$},
clip=false,
ymin=0,
ymax=14,
xmin=0,
xmax=100,
]
\def\a{}
\addplot[
domain=0:100,
samples=200,
unbounded coords=discard
]
{ c(a(x)) };
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
The graph is cut near x=50, almost when the slope became vertical.
What could be the problem?

10^{-14}precision. Whena(x)becomes negative (x>50, your image doesn't seem to match the code) you're taking the log of something which is\approx 0(the4e-14isn't enough to guarantee the square-root is larger thanxwithin pgfmath). As logged (NOTE: coordinate (1Y5.025e1],3Y0.0e0]) has been dropped because it is unbounded (in y). (see also unbounded coords=jump).) these values are then getting dropped. – Dai Bowen Apr 19 '23 at 18:06