1

I need help figuring out how to generate the two graphs of

𝑓(𝑥, 𝑦)=𝑎*𝑠𝑖𝑛(𝑥)𝑒−𝑦^2+ 𝑏𝑐𝑜𝑠(𝑦)*𝑒^−x^2

and

𝑓(𝑥, 𝑦)=𝑎*𝑐𝑜𝑠(sqrt(𝑥^2 + 𝑦^2))+𝑒^−sqrt(𝑥^2+𝑦^2).

4

2 Answers 2

3

Here is a Asymptote figure for the second 3D graph, with a=2, b=3.

PS: The reason I give an answer to the above non-MWE question is twofold. First, that is for welcoming a beginner. Second, I think that function is a nice example in teaching limit of 2 variables functions. At infinity, the function tends to zero, in all direction but x and y axes. After all, the figure is eye-caching with high and low mountains along axes. Happy Lunar New Year!

enter image description here

// http://asymptote.ualberta.ca/
usepackage("amsmath");
unitsize(1cm);
size(8cm);
import graph3;
currentprojection=orthographic(4,2,2,zoom=.9);
real a=2,b=3;
real g(pair M) {real x=M.x, y=M.y;  
return a*sin(x)*exp(-y^2)+b*cos(y)*exp(-x^2);
}
real t=15;
pair A=(-t,-t), B=(t,t);
surface sg = surface(g,A,B,nx=30,Spline);
draw(sg,surfacepen=yellow,meshpen=purple);
label("$z=ae^{-y^2}\sin x+be^{-x^2}\cos y$",(a+b+10)*Z);
draw(Label("$x$",EndPoint,align=S),O--(t+5)*X,Arrow3);
draw(Label("$y$",EndPoint),O--(t+5)*Y,Arrow3);
draw(Label("$z$",EndPoint),O--(a+b+5)*Z,Arrow3);
1

I will assume that in the first function, a and b are equal to 1. Here is an example for the first function:

\documentclass{article}
 \usepackage{pgfplots}
 \begin{document}
 
\begin{tikzpicture}
    \begin{axis}
        \addplot3[surf, ]{sin(x)*exp(-y^2)+cos(y)*exp(-x^2)};
    \end{axis}
\end{tikzpicture}
 
\end{document}

The result of the code above

For the second one: just change the addplot3 to:

\addplot3[surf,]{cos(sqrt(x^2+y^2))+exp(-sqrt(x^2+y^2)};

second one

1
  • Thank you please help me with 2 function Jan 28, 2022 at 21:48

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