I am working on a 3d figure using pgfplots. Since I need to operate on some pre-defined functions which are y(x) = - 1 - x and zed(x,y) = - x^2 - y^2.
I want to place points using these functions so I define the variables \xA=0, \yA=y(\xA) and \zA=zed(\xA,yA). The logical result is that the coordinates are (0,-1,-1). However, the result that I am getting is (0,-1,1), which is obviously wrong. For some reason, the "z" value is being returned with the opposite sign.
I have even tried loading the tikz math package but the result is the same...
Here is the MWE
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}[
declare function={
y(\x) = {-1 - \x };
zed(\x,\y) = {-\x^2 - \y^2};
}
]
\begin{axis}
\addplot3[surf,domain=-1:1,y domain=-1:1,
] {zed(x,y)};
\tikzmath{
\x1 = 0;
\y1 = y(\x1);
\z1 = zed(\x1,\y1);
}
\pgfmathsetmacro\xA{0}
\pgfmathsetmacro\yA{y(0)}
\pgfmathsetmacro\zA{zed(\xA,\yA)}
\node at (\xA,\yA,\zA) {(\xA,\yA,\zA)};
\node at (\x1,\y1,\z1) {(\x1,\y1,\z1)};
\end{axis}
\end{tikzpicture}
\end{document}
which gives the following figure
What am I doing wrong?

zed(\x,\y) = {-(\x)^2 - (\y)^2}(there is a duplicate somewhere. Unary-and exponentiation have strange precedences in some part of the expressions...) – Rmano Feb 15 '24 at 16:14-1*\x^2-1*\y^2, the result is the same if I apply-0.2*\x^2-0.3*\y^2for example. – Meclassic Feb 15 '24 at 16:18\xis-1, what TeX sees of-\x^2is- -1 ^2. Which if interpreted- (-1)^2gives a value, otherwise if interpreted as-(-(1^2))gives other. I suspect that the interpretation is not uniform in various part of the code... – Rmano Feb 15 '24 at 16:21