Plot function: $f(x,y)$

138 Views Asked by At

At first: sorry if I describe something wrong, I dont really know english mathematics. I want to draw a linear map.

$f:\Bbb R^2 \rightarrow \Bbb R$

$\vec{x} \mapsto |\vec{a}-\vec{x}|$

$\vec{a}=(2,2)$

Using Gnuplot I get this image:

enter image description here

But I think its wrong, because on the image for $f(x,2)=0$. But for example for $f(0,2)=\sqrt{(2-0)^2+(2-2)^2}=\sqrt{4}=2\neq 0$

So what is my mistake and how can I draw the function properly?

Edit: This is the correct graph

enter image description here

3

There are 3 best solutions below

1
On BEST ANSWER

You are correct. The GnuPlot result is wrong. The result should be a cone with its tip at the point $(2,2)$.

I think GnuPlot is not interpreting your input function correctly. It is interpreting $\text{abs}(((2,2)-(x,y)))$ as $\text{abs}(2-y)$.

To make things easier for GnuPlot, maybe you could give the formula in a simpler way. For example, you could give $f(x,y) = \sqrt{ (x-2)^2 + (y-2)^2 }$.

1
On

I've never used Gnuplot. However, the "abs" function doesn't seem to be the right choice here. What you need is not the absolute value of $a-x$ (which does not make sense to me), but the norm of it. Try to write the right formula for the norm of $a-x$. I'm almost sure you will get the right answer. The usual norm on this space is $|(x,y)|=\sqrt{x^2+y^2}$.

6
On

As others, I am not familiar with that tool but it is clear that it is indeed a cone as below:

enter image description here