发布网友 发布时间:2024-01-29 03:23
共1个回答
热心网友 时间:2024-11-30 00:27
Plotting the intersection of two equations is not as straightforward as plotting a single implicit equation. But there are some tricky to make it possible.
First off, I illustrate a joint point of two equations with regards to x and y, then I will show you how to highlight the intersection of two surfaces by contourPlot3d in mathematica.
2d code
--------------------------
eqs = {2 x + y - 1 == 0, x - y + 2 == 0}
sol = {x, y} /. Solve[eqs, {x, y}]
Show[ListPlot[sol, PlotStyle -> PointSize -> .02], ContourPlot[Evaluate[eqs], {x, -5, 5}, {y, -5, 5}]]
--------------------------
3d code
---------------------------
h = 13 x^2 + 8 y^2 + 4 z^2 + 2 x y - 8 x z - x + y + z - 1
g = x - y - z
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[.5], Specularity[White, 30]], PlotPoints -> 60, SphericalRegion -> True]
---------------------------