Mathematica Asked on June 10, 2021
Clear[y, z, x, eq1, eq2]
eq1 = (x^2/400) + (y^2/256) == 1
eq2 = (x^2/144) + (-(y^2/289)) == 1
ContourPlot[Evaluate[{eq1, eq2}], {x, -60, 60}, {y, -60, 60},
AspectRatio -> Automatic]
Im trying too plot them and find the intersection btwn these two functions(i need to mark the intersection by a dot)
My teacher does this by zooming in on the graph, but i find this way too difficult. From zooming in how can you extract the exact values of the intersection?
Graphics`Mesh`FindIntersections
cp = ContourPlot[Evaluate[{eq1, eq2}], {x, -60, 60}, {y, -60, 60}];
intersections = Graphics`Mesh`FindIntersections[cp, Graphics`Mesh`AllPoints -> False]
{{-14.3143, -11.0858}, {-14.3143, 11.0858}, {14.3143, -11.0858}, {14.3143, 11.0858}}
Show[cp, Graphics[{Red, PointSize[Large], Point @ intersections}]]
MeshFunctions
+ Mesh
+ MeshStyle
ContourPlot[Evaluate[{eq1, eq2}], {x, -60, 60}, {y, -60, 60},
MeshFunctions -> Function[{x, y}, Evaluate[eq1[[1]] - eq2[[1]]]],
Mesh -> {{0}}, MeshStyle -> Directive[Red, PointSize[Large]]]
ImplicitRegion
+ Region
+ Show
{ir1, ir2, ir12} = ImplicitRegion[#, {{x, -60, 60}, {y, -60, 60}}] & /@
{eq1, eq2, And[eq1, eq2]};
Show[MapThread[Region[#, BaseStyle -> #2] &][{{ir1, ir2, ir12},
{Blue, Orange, Directive[Red, PointSize[Large]]}}],
Frame -> True, AspectRatio -> 1]
ImplicitRegion
+ RegionPlot
RegionPlot[{ir1, ir2, ir12}, BaseStyle -> PointSize[Large]] /. p_Point :> {Red, p}
Correct answer by kglr on June 10, 2021
Why not Solve
for the intersections explicitly?
intersections = {x, y} /. Solve[{eq1, eq2}, {x, y}]
(* {{-60 Sqrt[545/9529],-(1088/Sqrt[9529])},{-60
Sqrt[545/9529],1088/Sqrt[9529]},{60
Sqrt[545/9529],-(1088/Sqrt[9529])},{60
Sqrt[545/9529],1088/Sqrt[9529]}} *)
ContourPlot[
Evaluate[{eq1, eq2}], {x, -60, 60}, {y, -60, 60},
AspectRatio -> Full,
Epilog -> {Red, PointSize[Large], Point[intersections]}]
Answered by Natas on June 10, 2021
You are almost there. Do the following. This:
eq1 = (x^2/400) + (y^2/256) == 1;
eq2 = (x^2/144) - (y^2/289) == 1;
sl = Solve[{eq1, eq2}, {x, y}]
(* {{x -> -60 Sqrt[545/9529],
y -> -(1088/Sqrt[9529])}, {x -> -60 Sqrt[545/9529],
y -> 1088/Sqrt[9529]}, {x -> 60 Sqrt[545/9529],
y -> -(1088/Sqrt[9529])}, {x -> 60 Sqrt[545/9529],
y -> 1088/Sqrt[9529]}} *)
gives you the solution. Then this:
Show[{
ContourPlot[Evaluate[{eq1, eq2}], {x, -60, 60}, {y, -60, 60}],
Graphics[{Red, PointSize[0.015], Point[{x, y}]}] /. sl
}]
plots it together with the intersection points. It returns the following:
Have fun!
Answered by Alexei Boulbitch on June 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP