1

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.

Cauchy
  • 53
  • 4

1 Answers1

3

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.
m_goldberg
  • 107,779
  • 16
  • 103
  • 257