2
$\begingroup$

I have two curves (drawn from points) in a plane, one is drawn with ListLinePlot and the other drawn with ParametricPlot. How can I determine the intersection between both curves? I cannot use (don't know how to) interpolation directly, since the curves are not graphs.

Let's say we have

 r[ϕ_] = 1 + 1/20 Sin[20 ϕ]; 
 tb = Table[{r[ϕ] Cos[ϕ], r[ϕ] Sin[ϕ]}, {ϕ, 0, 2 π, 0.1}];
 ListLinePlot[tb] 

and we interpolate data stored in tb. E.g. at x = 0.95 there are 4 (or 5) different values for y. How can I plot interpolating function? I am sure I am missing something. Theoretically, I could use interpolation across segments of points on a curve but this is something I want to avoid.

Any ideas?

$\endgroup$
9
  • 2
    $\begingroup$ Interpolation should work. Could you post two example curves to work with? $\endgroup$
    – Szabolcs
    Commented Feb 2, 2013 at 18:06
  • $\begingroup$ Hi, Szabolcs. Thank you for your response. Let's say we have r[[Phi]_] = 1 + 1/20 Sin[20 [Phi]]; tb = Table[{r[[Phi]] Cos[[Phi]], r[[Phi]] Sin[[Phi]]}, {[Phi], 0, 2 [Pi], 0.1}]; ListLinePlot[tb] and we interpolate data stored in tb. E.g. at x = 0.95 there are 4 (or 5) different values for y. How can I plot interpolating function? I am sure I am missing something. $\endgroup$
    – DeeDee
    Commented Feb 3, 2013 at 1:50
  • 2
    $\begingroup$ Please don't post additional information concerning your question as a comment. Please add the info to your original question by making an edit. $\endgroup$
    – m_goldberg
    Commented Feb 3, 2013 at 5:24
  • $\begingroup$ you mean ListPolarPlot? (there isn't any built-in function named PolarParametricPlot) $\endgroup$
    – kglr
    Commented Feb 3, 2013 at 12:35
  • 1
    $\begingroup$ Generically, if two curves are given by $(x,y) = f(s)$ and $(x,y)=g(t)$, you solve $f(s)=g(t)$ for parameter values $s$, $t$. Just how to set that up in Mathematica might depend on how the particular curves $f$ and $g$ are defined. (Which is why you're being asked for more information.) You might use FindRoot or NSolve for instance. $\endgroup$
    – Michael E2
    Commented Feb 3, 2013 at 15:16

1 Answer 1

3
$\begingroup$

I'm not sure that I fully understand your question.

If you interpolate the data stored in table tb, you will get a function of x instead of φ.

Maybe this could work for you:

tb2 = Table[{φ, r[φ Cos[φ], 
r[φ] Sin[φ]}, {φ, 0, 2 φ, 0.1}]; (* just added φ to the list *)
intb = Interpolation[tb2[[;;, 1 ;; 3 ;; 2]]]; (* interpolation of y[φ] *)
inta = Interpolation[tb2[[;;, 1 ;; 2]]]; (* interpolation of x[φ] *)
ParametricPlot[{inta[φ], intb[φ]}, {φ, 0, 2 π}]

Perhaps someone could provide a much more elegant solution but this one is easy and it should work!

$\endgroup$
1
  • $\begingroup$ @ Gregory Rut Thanks. $\endgroup$
    – DeeDee
    Commented Feb 3, 2013 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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