# FindRoot and two Parametric Functions

Posted 9 years ago
7436 Views
|
5 Replies
|
1 Total Likes
|
 I am trying to find the three intersection points of r1[t] = {2 Cos[t], 2 Sin[t]} and r2[t] = {3 Cos[t], Sin[t] - 1} using FindRoot but keep getting various error messages no matter what I do. Any help is appreciated. Also, I would like to designate them both as the same variable but give them different colors using PlotStyle. Currently I am only able to do so by designating them as two separate variables. I am new to mathematica so please be as basic as possible. Code is attached. Attachments:
5 Replies
Sort By:
Posted 9 years ago
 Thanks guys!
Posted 9 years ago
 I suppose we're confirming the stereotypes put forth on "The Big Bang Theory" about physicists.
Posted 9 years ago
 Since we want the intersection of the curves, we do not require t to be the same for each at the intersections. And the equality is really 2 equations, in x and y, so we need 2 independent variables. (Although Reduce or FindInstance would find the point where intersection occurs at t1 = t2.) r1[t_] = {2 Cos[t], 2 Sin[t]}; r2[t_] = {3 Cos[t], Sin[t] - 1}; (* there are 2 independent variables *) (* C[_]\[Rule]0 chhoses the principal solutions *) sol = Solve[r1[t1] == r2[t2] // Evaluate, {t1, t2}] /. C[_] -> 0 (* {{t1\[Rule]-(\[Pi]/2),t2\[Rule]-(\[Pi]/2)},{t1\[Rule]-ArcTan[1/(3 \ Sqrt[7])],t2\[Rule]ArcTan[3/Sqrt[7]]},{t1\[Rule]-\[Pi]+ArcTan[1/(3 \ Sqrt[7])],t2\[Rule]\[Pi]-ArcTan[3/Sqrt[7]]}} *) (* solution points *) points = Point /@ {r1[t1], r2[t2]} /. sol // Flatten; (* plot with solutions *) parplot2 = ParametricPlot[{r1[t], r2[t]}, {t, 0, 2 \[Pi]}, PlotStyle -> {{Red, Thick}, {Blue, Thick}}, Epilog -> {PointSize[.02], points}] 
Posted 9 years ago
 The value of t in r1 is not the same as the value of t in r2 when the curves intersect. Here's one way to find the intersections: In[1]:= r1[t_] = {2 Cos[t], 2 Sin[t]}; In[2]:= r2[t_] = {3 Cos[t], Sin[t] - 1}; In[17]:= r = Reduce[{r1[t1] == r2[t2], 0 <= t1 <= 2 \[Pi], 0 <= t2 <= 2 \[Pi]}, {t1, t2}] Out[17]= (t1 == (3 \[Pi])/2 && t2 == (3 \[Pi])/2) || (t1 == 2 \[Pi] - 2 ArcTan[8 - 3 Sqrt[7]] && t2 == 2 ArcTan[(-53 + 20 Sqrt[7])/(3 (-8 + 3 Sqrt[7]))]) || (t1 == 2 \[Pi] - 2 ArcTan[8 + 3 Sqrt[7]] && t2 == 2 ArcTan[(53 + 20 Sqrt[7])/(3 (8 + 3 Sqrt[7]))]) In[23]:= r1[t1] /. {ToRules[r]} Out[23]= {{0, -2}, {2 Cos[2 ArcTan[8 - 3 Sqrt[7]]], -2 Sin[ 2 ArcTan[8 - 3 Sqrt[7]]]}, {2 Cos[ 2 ArcTan[8 + 3 Sqrt[7]]], -2 Sin[2 ArcTan[8 + 3 Sqrt[7]]]}} In[24]:= N[%] Out[24]= {{0., -2.}, {1.98431, -0.25}, {-1.98431, -0.25}} 
Posted 9 years ago
 Apparently neither one of us has much to do on a Friday night. ;-)