1
$\begingroup$

I seem to be unable to find intersection points between following functions, and plot both functions and points on the same plot:

a[x_, y_] := Cos[x^2 + y^2];

d[x_, y_] := Evaluate[Series[Cos[x^2 + y^2], {x, 0, 4}, {y, 0, 4}] // Normal];

This is what I've tried so far

ContourPlot3D[{a == 0, d == 0}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, MeshFunctions -> {Function[{x, y, z, f}, a - d]}, MeshStyle -> {{Thick, Black}}, Mesh -> {{0}}, 
ContourStyle -> Directive[Orange, Opacity[0.5], Specularity[White, 30]]]

Plotting them with Plot3D:

Plot3D[{a[x, y], d[x, y]}, {x, -Pi, Pi}, {y, -Pi, Pi}]

seems to give rather different results.

$\endgroup$

closed as unclear what you're asking by Michael E2, MarcoB, rhermans, bbgodfrey, garej May 31 '17 at 19:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What are a and d? $\endgroup$ – Michael E2 May 23 '17 at 15:17
  • 1
    $\begingroup$ Have you seen this? $\endgroup$ – J. M. is away May 23 '17 at 15:18
  • $\begingroup$ OK, but should that be a[x, y] == 0, etc., in the contour plot, then? And should b and g be changed to a and d? $\endgroup$ – Michael E2 May 23 '17 at 15:25
  • 1
    $\begingroup$ So, you want the curves of intersection and not points? Have you seen this? $\endgroup$ – J. M. is away May 23 '17 at 16:49
  • 1
    $\begingroup$ @J.M. You keep beating me to the question I want to link! :) $\endgroup$ – Michael E2 May 23 '17 at 16:52
3
$\begingroup$

Here is a brute force approach.

a[x_, y_] := Cos[x^2 + y^2]
d[x_, y_] = Series[Cos[x^2 + y^2], {x, 0, 4}, {y, 0, 4}] // Normal;

Plot3D[{a[x, y], d[x, y]}, {x, -Pi, Pi}, {y, -Pi, Pi},
  PlotRange -> 2,
  ClippingStyle -> None]

plot

mesh = Catenate[CoordinateBoundingBoxArray[{{-π, -π}, {π, π}}, .0025]];
xyPts = Select[mesh, Norm[#] > .75 && Abs[a @@ # - d @@ #] < .01 &];
xyzPts = {Sequence @@ #, a @@ #} & /@ xyPts;
ListPointPlot3D[xyzPts, PlotRange -> All]

intersections

Notes

  • The evaluation of the expression for xyPts is rather slow.
  • The excluded the points having a norm less than .75 to speed up the plotting. The empty circle in the center of the plot would otherwise be filled.
$\endgroup$

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