Double Tangents

Surprisingly hard to find!

This is another technical graph.  How do you find all tangent lines on an arbitrary function f(x) that are tangent to multiple points?

Short answer: Not easily.  It's really hard!

Long answer: Desmos regressions, solution space, fitness functions, and other dark magic!

This graph uses a set of several rules to evaluate whether a pair of two x values should be considered a double tangent or not.  These are then summed together and fed into a regression solver to try and find the best fitting pair.  These are easy to summarize in English:

  • The slope at both points should the same.
  • The tangent line should not match any we already know of.
  • Tangent lines along straight sections of the graph are boring and should be avoided.
  • Ignore half of the solutions since they're duplicates.
  • Don't look near points we've already found to be on a double tangent.

Of course if only it were actually that easy.  Desmos regressions are really good, but they're not all-knowing enough to find tiny point solutions in a sea of infinite possibilites.  So what do we do?

The answer, as with most things in life, is that things are never black and white, and that the gray areas should not be neglected.  So in the actual graph, these rules have simply been revised into continuously differentiable versions of themselves.  This results in a more continuous solution space.

Desmos does a lot better with this.  It still needs an occasional push to stop it from getting stuck in local minima, but it does well enough to find most of the solutions within a reasonable time.

Wait, are we still talking about Desmos?  Why am I describing myself?!