Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ContourPlot[ (x^2 + y^2 - 4) *( y - x^2 + 2 x - 1) == 0, {x, -4, 4}, {y, -4, 4} , ContourStyle -> {Thick, Magenta},
- GridLines -> Automatic]
- fi = FindInstance[(x^2 + y^2 - 4) == 0 && (y - x^2 + 2 x - 1) ==
- 0, {x, y}, Reals, 2] // N
- {*
- {x -> -0.399864, y -> 1.95962}, {x -> 1.85894, y -> 0.737785}
- *}
- ContourPlot[(x^2 + y^2 - 4)*(y - x^2 + 2 x - 1) == 0, {x, -4,
- 4}, {y, -4, 4}, ContourStyle -> {Thick, Blue},
- GridLines -> Automatic,
- Epilog -> {Red, PointSize[Large], Point[{x, y}] /. fi}]
- nsol = NSolve[{(x^2 + y^2 - 4) == 0, (y - x^2 + 2 x - 1) == 0}, {x,
- y}, Reals]
- {*
- {x -> -0.399864, y -> 1.95962}, {x -> 1.85894, y -> 0.737785}
- *}
- fi == nsol
- (*
- True
- *)
- f[x_, y_] := (x^2 + y^2 - 4)
- g[x_, y_] := (y - x^2 + 2 x - 1)
- pts = FindAllCrossings2D[{f[x, y], g[x, y]}, {x, -7/2, 4}, {y, -9/5,
- 21/5}, Method -> {"Newton", "StepControl" -> "LineSearch"},
- PlotPoints -> 85, WorkingPrecision -> 20] // Chop;
- pl=ContourPlot[{f[x, y], g[x, y]}, {x, -7/2, 4}, {y, -9/5, 21/5},
- Contours -> {0}, ContourShading -> False,
- Epilog -> {AbsolutePointSize[6], Red, Point /@ pts}]
- NSolve[{(x^2 + y^2 - 4) == 0, (y - x^2 + 2 x - 1) == 0}, {x,y}, Reals]
- Show[pl,
- Graphics[{AbsolutePointSize[12], Purple,
- Point[{x, y}] /.
- NSolve[{(x^2 + y^2 - 4) == 0, (y - x^2 + 2 x - 1) == 0}, {x, y}, Reals]}]]
- f[x_, y_] := (x^2 + y^2 - 4)
- g[x_, y_] := (y - x^2 + 2 x - 1)
- ContourPlot[{f[x, y], g[x, y]}, {x, -7/2, 4}, {y, -9/5, 21/5},
- Contours -> {0}, ContourShading -> False, BaseStyle -> Thick,
- MeshFunctions -> {g[#, #2] - f[#, #2] &},
- Mesh -> {{{0, Directive[Red, PointSize[Large]]}}}]
- Graphics`Mesh`MeshInit[];
- cp = ContourPlot[{f[x, y], g[x, y]}, {x, -7/2, 4}, {y, -9/5, 21/5},
- Contours -> {0}, ContourShading -> False, BaseStyle -> Thick];
- Show[cp, Epilog -> {Red, PointSize[.03],
- Point[Graphics`Mesh`FindIntersections[Normal @ cp]]}]
Add Comment
Please, Sign In to add comment