2
$\begingroup$

I have the two equations

$x^2 + 2y^2 + z^2 = 1$ and

$xz -y^2 = 0$

I want to plot the roots in 3D. i.e the coordinates $x,y$ znd $z$

$\endgroup$

1 Answer 1

4
$\begingroup$

I assume by roots you mean where the 2 surfaces intersect? Using example from help that shows the intersection of 2 surfaces, first we get an idea of the intersection

h = x^2 + y^2 + z^2 - 2;
g = x z - y^2;

s=ContourPlot3D[{h == 0, g == 0}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
 MeshFunctions -> {Function[{x, y, z, f}, h - g]}, 
 MeshStyle -> {{Thick, Blue}}, Mesh -> {{0}}, 
 ContourStyle -> 
  Directive[Orange, Opacity[0.5], Specularity[White, 30]], 
 AxesLabel -> {x, y, z}, BaseStyle -> 14]

Mathematica graphics

Mathematica graphics

so it looks like all points at 2 circles some distance from origin:

 Reduce[h == g, {x, y, z}]

Mathematica graphics

So, all points that meet the above conditions are your "roots". For example:

 FindInstance[h == g, {x, y, z}]

Mathematica graphics

 Show[s, Graphics3D[{Red, PointSize[.05], Point[{-1, 0, 0}]}]]

Mathematica graphics

$\endgroup$
4
  • $\begingroup$ Hi, thanks for your answer. Yes, this is exactly what I mean. But I\m not sure how you got those. The equations above are those from the examples. When I use my equations I get errors. $\endgroup$
    – user27616
    Commented Apr 9, 2015 at 9:16
  • $\begingroup$ @user27616 here is screen shot from my notebook !Mathematica graphics make sure you type your equations as shown in the screen shot and above, not like you had them $\endgroup$
    – Nasser
    Commented Apr 9, 2015 at 9:20
  • $\begingroup$ Thanks a lot! Do you maybe know if this can be done for more than 3 variables? Assume we have only one function f. We want to find the contours. f is a function of {a,b,c,d,e,f,}. We are only interested a section of the variety f==0, {a,-1,1},{b,-1,1}, {c,-1,1}. Can this be done? $\endgroup$
    – user27616
    Commented Apr 9, 2015 at 10:05
  • $\begingroup$ @user27616 I am not following you exactly, but there are lots of Contour related functions in Mathematica, and also options to control what they show and how. If you have problem or question with specific implementation or how to use it, it would be better to post that as separate question. $\endgroup$
    – Nasser
    Commented Apr 9, 2015 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.