Message Boards Message Boards

Find all pairs of common tangents to a curve?

Posted 7 years ago
POSTED BY: Deb Chicago
5 Replies

Solve and NSolve attempt to find all solutions, but they are mainly concerned with polynomial or analytical functions. I doubt they work with interpolation functions. Here is an attempt at automation of the graphical part, that works, although slowly, in the Sin case:

fo[x] = Sin[x];
firstEq = Cases[ContourPlot[fo'[x2] == (fo[x1] - fo[x2])/(x1 - x2),
      {x1, 0, 16}, {x2, 0, 8}][[1]] // Normal, _Line, All];
secondEq = Cases[ContourPlot[fo'[x1] == fo'[x2],
      {x1, 0, 16}, {x2, 0, 8}][[1]] // Normal, _Line, All];
Complement[Flatten@Outer[RegionIntersection, firstEq, secondEq],
 {EmptyRegion[2]}]

It converts the ContourPlots of the two equations into Line object, and then finds the RegionIntersection of the couples of lines. After that you can start FindRoot from the points you have found. I don't know if this solution is practical in your situation.

POSTED BY: Gianluca Gorni
POSTED BY: Gianluca Gorni
Posted 7 years ago

Thanks for explaining your code to me. I used the same code (FindRoot) earlier. However, this only gives one solution. Also, I want to sort of automate the process that is my code should be able to find all common tangent pairs for a general curve. The reason for doing so is I will be looking at many curves (free energy curves) and checking it manually is something I can ill-afford.

POSTED BY: Deb Chicago

I cannot see common tangents in your plot, unless they are very close together near 0 or near 1. The common tangents should appear as crossings in the following plot:

ContourPlot[{fo'[x1] == fo'[x2], 
  fo'[x2] == (fo[x1] - fo[x2])/(x1 - x2)}, {x1, 0.01, 0.99}, {x2, 
  0.01, 0.99}]
POSTED BY: Gianluca Gorni
Posted 7 years ago

Slightly modified the list given in the question. Your solution gives me the following. enter image description here

Could you please help me understand what is going on in this plot ?

POSTED BY: Deb Chicago
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract