Building an implicit function

I am trying to build the following implicit formula in R:

1 = x ^ 2 + 4 * (y ^ 2) + x * y

which should be an ellipse. I would like to randomly select the x values ​​and then generate a graph based on these.

Here is a related thread, but the solutions there seem to be specific to the 3D case. This question was more resistant to Googling, which I would have expected, so perhaps the R language calls the implicit formulas something else.

Thanks in advance!

+7
source share
1 answer

Two things you cannot understand. When building implicit functions using this technology, you need to move all the members to the RHS functions so that your implicit function becomes the following:

0 = -1+ x^2 + 4*(y^2) + x*y 

Then using the value of the zero loop will make sense:

 x<-seq(-1.1,1.1,length=1000) y<-seq(-1,1,length=1000) z<-outer(x,y,function(x,y) 4*y^2+x^2+x*y -1 ) contour(x,y,z,levels=0) 

In the first version, I was wrong. @mnels' was right.

enter image description here

+11
source

All Articles