Point Of intersection between two plotted functions

Terry Reedy tjreedy at udel.edu
Fri Jun 13 23:51:14 CEST 2008

<arslanburney at gmail.com> wrote in message 
news:2fd19881-27f8-48f3-bfa9-2d8a26f31920 at 26g2000hsk.googlegroups.com...
| Is there anyway one could find ot the point of intersection between
| any two plotted functions

Assume you have sequence xi, yi, zi, where yi and zi are function values
corresponding to xi.  In general, you will never have exact intersection
with yi==zi.  So in addition, look for successive triples xi,yi,zi and
x(i+1), y(i+1), z(i+1) such that yi<zi and y(i+1)>z(i+1) or the other way
around.  In other words, zi-yi and z(i+1)-y(i+1) have opposite signs.  You
might want to also consider abs(zi-yi) < some very small number as possibly 
indicating touching without crossing (as with tangents).

More information about the Python-list mailing list