0

I would like to show the graph of $f(x,y)=4-x^{2}-y^{2}$ for $x^{2}+y^{2}\leq1,y\geq0$.

I want to draw it using spherical coordinates in Tikz. However I've not found any simple answer for this. Could someone help me?

1 Answer 1

2

Something like that?

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[declare function={f(\x,\y)=4-\x^2-\y^2;}]
 \begin{axis}[view={45}{-45},xlabel={$x$},ylabel={$y$},zlabel={$f(x,y)$}]
  \addplot3[surf,shader=interp,domain=0:1,domain y=0:180]
   ({x*cos(y)},{x*sin(y)},{f(x*cos(y),x*sin(y))});
 \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .