2
$\begingroup$

I'm following a course of Math and I would like to have a Plot of a 3D function defined over a CountorPlot. I used the command of 'Plot3D' to define the domain of a function but the region where the function f is defined is a differential manifold. There is an example:

f:3 x^2 - 2 y

manifold: x^3 - 3 x^2 y + y^2 - 1 == 0

I tried to visualize the intersection between the graphs using this code:

  aaa = ContourPlot3D[
  x^3 - 3 x^2 y + y^2 - 1 == 0, {x, -10, 10}, {y, -10, 10}, {z, -10, 
  10}, PlotPoints -> 100]

  bbb = Plot3D[ 3 x^2 - 2 y, {x, -10, 10}, {y, -10, 10}, 
  PlotPoints -> 100]

  Show[aaa, bbb]
$\endgroup$
3
$\begingroup$

use Mesh and MeshFunctions tricks.

f = 3 x^2 - 2 y;
g = x^3 - 3 x^2 y + y^2 - 1;
Plot3D[f, {x, -10, 10}, {y, -10, 10}, PlotPoints -> 100, 
 MeshFunctions -> Function[{x, y, z}, g], Mesh -> {{0}}, 
 MeshStyle -> Directive[Thickness[Large], Red], PlotStyle -> None]

enter image description here

| improve this answer | |
$\endgroup$
2
$\begingroup$

Combining your original approach with that of cvgmt

Clear["Global`*"]

f = 3 x^2 - 2 y;
g = x^3 - 3 x^2 y + y^2 - 1;

Legended[
 Show[
  ContourPlot3D[g == 0,
   {x, -10, 10}, {y, -10, 10}, {z, -10, 10},
   PlotPoints -> 100,
   ContourStyle -> Opacity[0.5, Blue]],
  Plot3D[f,
   {x, -10, 10}, {y, -10, 10},
   PlotPoints -> 100,
   PlotStyle -> Opacity[0.5, Green],
   MeshFunctions ->
    Function[{x, y, z}, g],
   Mesh -> {{0}},
   MeshStyle -> {Red, Thick}]],
 SwatchLegend[
  {Opacity[0.5, Green], Opacity[0.5, Blue], Red},
  {"f", "g==0", "Intersection"}]]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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