TransWikia.com

Need help finding intersection of a hyperbola and a circle

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?

3 Answers

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}]]

enter image description here

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]]]

enter image description here

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]

enter image description here

ImplicitRegion + RegionPlot

RegionPlot[{ir1, ir2, ir12}, BaseStyle -> PointSize[Large]] /. p_Point :> {Red, p}

enter image description here

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]}]

Intersections highlighted

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:

enter image description here

Have fun!

Answered by Alexei Boulbitch on June 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP