I'm trying to draw a titration curve using pgfplot. Based off this paper, there is an equation for the titration curve:

I've attempted to implement this within pgfplots, and I get a very strange result:

I have no idea why this would occur; even attempting to recreate the exact formula I used within desmos did not work.
For reference, here is the code, and also a link to an overleaf project.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfkeys{
/pgf/declare function={
arcsinh(\x) = ln(\x + sqrt(\x^2+1));
},
/pgf/declare function={
Va = 0.025;
Ma = 0.1;
Mb = 0.1;
V(\x) = \x / 1000;
Kw = 1*10^(-14);
p(\o) = -ln(\o)/ln(10);
}
}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
xlabel = {Solution Added (mL)},
ylabel = {pH},
ymin=0,
ymax=14,
ytick distance=7,
xtick distance=10,
]
\addplot[%
samples=100,
color=red,
domain=0:50,
]{%
7 + 1/ln(10) * arcsinh( 1/(2sqrt(Kw)) (MbV(x) - MaVa) / (Va + V(x)) )
};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
endnote: if there's a way I can have variables e.g. V_a within the pgfplot function, that'd be much nicer than having constants throughout. thanks Torjorn

declare functionfor the variables as well. – Torbjørn T. Sep 02 '20 at 14:08ln(10)int the definition ofarcsinh, it's just been shifted from outside to inside (if you look at the reference function it's outside). I don't think it makes any difference, and I've tried having it both ways. It just makes it easier to read imo, even if it's not strictly an arcsinh function anymore. – IllustriousMagenta Sep 02 '20 at 14:33NOTE: coordinate (1Y9.999739e1],3Y0.0e0]) has been dropped because it is unboun ded (in y). (see also unbounded coords=jump).– IllustriousMagenta Sep 03 '20 at 03:44