1
$\begingroup$

How to find individual root parameters pair ( t, T) to find curve intersections using FindInstance? Hopefully it would output two, instead of 6 pairs in the following:

ParametricPlot[{{2 t + 1, 2 - t^2}  , {   t^3 , t^2 - 4}} , {t, -2.3, 
  2}, PlotStyle -> {{Thick, Red}, {Thick, Blue}}, 
 GridLines -> Automatic]
NSolve[{2 t + 1, 2 - T^2}  == {t^3 , T^2 - 4}  , {t, T}]

Like e.g., given by J.M. and Chris in recent:

Points of Intersection

or may be required to use Reduce?

EDIT1:

How do we selectively choose solution sets from among the roots of NSolve?

$\endgroup$
2
$\begingroup$

The problem lies in the location of t and T as variables .

To see this, note that we have two parametric curves:

f1[t_] := {2 t + 1, 2 - t^2};
f2[t_] := {t^3, t^2 - 4};

We know the intersections must occur for some values t and T such that f1[t]==f2[T].

NSolve[f1[t] == f2[T], {t, T}]

or more explicitly (note the different positioning of t and T)

NSolve[{2 t + 1, 2 - t^2} == {T^3, T^2 - 4}, {t, T}]

This gives six solutions (Mathematica output omitted). To get the two real solutions seen in the parametric plot, use the additional argument Reals.

intersect=NSolve[{2 t + 1, 2 - t^2} == {T^3, T^2 - 4}, {t, T},Reals]
(* {{t -> -1.98369, T -> -1.437}, {t -> 1.79866, T -> 1.66278}} *)

These two solutions correspond to the points

f1[t]/.intersect[[1]]
f2[T]/.intersect[[1]]
(* {-2.96738, -1.93502} *)
(* {-2.96738, -1.93502} *)

and

f1[t]/.intersect[[2]]
f2[T]/.intersect[[2]]
(* {4.59731,-1.23516} *)
(* {4.59731,-1.23516} *)

which indeed appear to be the intersections in the parametric plot.

Alternate method using FindInstance

It is also possible to solve this problem using

intersect2 = FindInstance[2 t + 1 == T^3 && 2 - t^2 == T^2 - 4, {t, T}, Reals, 2] // N
(* {{t -> -1.98369, T -> -1.437}, {t -> 1.79866, T -> 1.66278}} *)

This gives the same solution as above, although the NSolve method appears to be slightly faster.

AbsoluteTiming[intersect = NSolve[{2 t + 1, 2 - t^2} == {T^3, T^2 - 4}, {t,T}, Reals]]
AbsoluteTiming[intersect2 = FindInstance[2 t + 1 == T^3 && 2 - t^2 == T^2 - 4, {t, T}, Reals, 2] // N]
(* 0.005154, ... *)
(* 0.016175, ... *)
| improve this answer | |
$\endgroup$
1
$\begingroup$

Edit: Using FindInstance

a = 2 t + 1; b = 2 - t^2; c = t^3; d = t^2 - 4;
eq1 = Eliminate[{x == a, y == b}, t]

7 - 4 y == -2 x + x^2

eq2 = Eliminate[{x == c, y == d}, {t}]

64 + 48 y + 12 y^2 + y^3 == x^2

fi = FindInstance[Evaluate@eq1 && Evaluate@eq2, {x, y}, Reals, 2] // N

{{x -> -2.96738, y -> -1.93502}, {x -> 4.59731, y -> -1.23516}}

ContourPlot[{Evaluate@eq1, Evaluate@eq2}, {x, -10, 10}, {y, -5, 5}, 
 Epilog -> {Red, PointSize[Large], Point[{x, y}] /. fi}]

enter image description here


f1[t_] := {2 t + 1, 2 - t^2}

IntersectionRules = NSolve[{2 t + 1, 2 - t^2} == {T^3, T^2 - 4}, {t, T}, Reals]

{*
{t -> -1.98369, T -> -1.437}, {t -> 1.79866, T -> 1.66278}
*}

IntersectionPoints = {f1[t]} /. IntersectionRules

{*
{{-2.96738, -1.93502}}, {{4.59731, -1.23516}}
*}

ParametricPlot[{{2 t + 1, 2 - t^2}, {t^3, t^2 - 4}}, {t, -5, 5}, 
 PlotRange -> 9, Epilog -> {Red, PointSize[Large], Point /@ IntersectionPoints}]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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