Find root of implicit function in Mathematica
I have an implicit function, for example:
f(x,y) = x^3 + x*y + y^2 - 36
I want to find the root, ie solutions to the equation f(x,y) = 0
Drawing the solution is easy:
ContourPlot[x^3 + x*y + y^2 - 36 == 0, {x, -2 Pi, 2 Pi}, {y, -3 Pi, 3 Pi}]
however I would like to have the data that is in the plot and not only the visual plot. So how do I find the data of the plot?
I would encourage you to explore the documentation on equation solving and particularly the Solve and NSolve functions.
EDIT
Copy and paste the bit you need.
Alternatively, and in my view a better solution to your actual problem.
You might need some options to get the right solution.
I'm not sure if I am interpreting your second question properly, but assuming you require a list of (x,y) points from the generated ContourPlot, one way of doing this might be the following:
To obtain a list of points
'Take a look' with ListPlot
giving
Edit
Nasser has correctly pointed out that this question has been addressed before. Here is one link to essentially the same question and this answer by Szabolcs is relevant.
As regards the answer given above, this method is probably more direct:
Finally, I should acknowledge " LunchTime Playground. Fun with Mathematica: How to extract points from a plot", see here, which gives both methods suggested above (and which I now use routinely).
Edit 2
This method is an improvement on method 1 above, as the points are obtained as a list of {x,y} values (list-of-lists) without any extraneous { }.
An article by Paul Abbott in the Mathematica Journal Vol 7, No 2, pp 108-112, 1998, Finding Roots in an Interval, gives a lot of useful information and is available here
He points out the the following also work
and(!)
I have made reference in the comments to the question by FreshApple where a (slight variant) of the following method may be found:
The following evaluates to
True
Edit 3
Just or fun ...
gives
A $.02 contribution on Verbeia's answer:
Remember to check both x(y) and y(x) solutions as one of them could be cleaner than the other.
In your example: