1
$\begingroup$

1) How do I find the intersection of f[c_] := y^2 - 2 x^2 (x + 3) == c ((y + 1)^2 (y + 9) - x^2) between the plots of f[0] and f[2]

I tried plugging-in numbers. But I can't seem to find the intersections

2) Also how do I graph this http://i.imgur.com/MjwmLCC.jpg ?

I figured out the equation to be y=x^2-9 but I don't know what to do next.

$\endgroup$
  • $\begingroup$ How about trying to identify the mathematical function that you know? x^2 and Sqrt[x] might help. In the end you might have that $\endgroup$ – Öskå May 18 '14 at 20:42
3
$\begingroup$

I am uncertain exactly what is wanted. If it is visualization you can use ContourPlot:

fun1[_][x_, y_] := y^2 - 2 x^2 (x + 3);
fun2[c_][x_, y_] := c ((y + 1)^2 (y + 9) - x^2);
cp = ContourPlot[
  Evaluate[(fun1[#][x, y] == fun2[#][x, y]) & /@ {0, 2}], {x, -10, 
   10}, {y, -10, 10}, MeshFunctions -> (fun2[2][#, #2] &), 
  Mesh -> {{0.}}, MeshStyle -> {PointSize[0.015], Red}, 
  ContourStyle -> {Green, Purple}, PlotLegends -> "Expressions"]

enter image description here

The mesh function exploits when c=0 the second function is 0.

If an approximation of the points of intersection is desired you can extract them from graphic: e.g.

ind = Cases[cp, Point[x__] :> x, Infinity];
ans = cp[[1, 1, 1]][[First@ind]]

yielding:

{{2.63803, -8.8862}, {0.441098, -1.15861}, {0.335547, -0.880514}, \
{-0.376551, -0.864387}, {-0.539491, -1.19441}, {-2.71652, -2.02988}, \
{-2.9964, -0.00107654}, {2.64087, -8.88768}, {-2.7232, -2.03298}, \
{-2.99633, -0.00098642}, {-0.369225, -0.870458}, {0.327706, \
-0.882296}, {0.439565, -1.15777}, {-0.513967, -1.18753}}

I re-stress approximates.

If you want to "find":

red = N@Reduce[(fun1[#][x, y] == fun2[#][x, y]) & /@ {0, 2}, {x, y}]

yields:

(x == -3. || x == -2.72156 || x == -0.537205 || x == -0.378744 || 
   x == 0.340628 || x == 0.441236 || x == 2.64504 || 
   x == -2.8947 - 2.63671 I || x == -2.8947 + 2.63671 I) && 
 y == 2.99448*10^-8 (-1.65309*10^7 + 162. x - 1.00263*10^8 x^2 - 
     3.40627*10^7 x^3 + 6.49485*10^6 x^4 + 4.1719*10^6 x^5 + 
     638632. x^6 - 19352. x^7 - 3200. x^8)

A way to extract this result (real solutions):

xval = Cases[red, x == r_ :> r, Infinity];
yval[u_] := First[Cases[red, y == r_ :> r]] /. x -> u;
calc = {#, yval@#} & /@ Cases[xval, _Real]

yielding:

{{-3., 0.}, {-2.72156, -2.03094}, {-0.537205, -1.19225}, {-0.378744, \
-0.867192}, {0.340628, -0.88046}, {0.441236, -1.15756}, {2.64504, \
-8.88754}}

Comparing with the approximations the original plot and the above real solutions are overlayed with an "x":

cp2 = Show[cp, ListPlot[calc, PlotMarkers -> {"\[Times]", 20}]]

enter image description here

If this is not what is desired, my apologies.

$\endgroup$
1
$\begingroup$

For finding the intersections, never discount the simplest way to do it,

pts = {x, y} /. NSolve[{f[0], f[2]}, {x, y}, Reals]
(* {{2.64504, -8.88754}, {-3., 
  0.}, {0.441236, -1.15756}, {0.340628, -0.88046}, {-0.537205,
-1.19225}, {-0.378744, -0.867192}, {-2.72156, -2.03094}} *)

And you can see that you got the points correctly by plotting,

Show[ContourPlot[Evaluate[{f[0], f[2]}], {x, -5, 5}, {y, -10, 10}],
 ListPlot[pts, PlotStyle -> Directive[PointSize[Large], Red]]
 ]

enter image description here

And that other plot, you can do something like this

func = #^2 - 9 &;
ParametricPlot[{
  {x, func[x]},
  {x, -func[x]},
  {func[x], x},
  {-func[x], x},
  {Sqrt[-x^2 + 9], x},
  {-Sqrt[-x^2 + 9], x}
  }
 , {x, -10, 10},
 PlotRange -> {{-10, 10}, {-10, 10}}]

enter image description here

$\endgroup$

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