Mombu the Science Forum sponsored links

Go Back   Mombu the Science Forum > Science > Intersection of 2 curves
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 16th November 13:05
External User
 
Posts: 1
Default Intersection of 2 curves



I am trying to locate a numerical technique to find the intersection of
2 curves. These are defined by tables of data rather than equations.
The data can be fitted with a 2nd degree polynomial, and only intersect
at one point. Both curves have positive slopes, though one has a
larger slope than the other.


Appreciate any suggestions or references.

dan
  Reply With Quote


  sponsored links


2 16th November 13:05
john2
External User
 
Posts: 1
Default Intersection of 2 curves



curve a(x) is a0 + a1.x + a2.x^2
curve b(x) is b0 + b1.x + b2.x^2

Where they cross, a(x) = b(x)
So solving the quadratic
(a0-b0) + (a1-b1).x + (a2-b2).x^2 = 0

should do the trick

john2
  Reply With Quote


  sponsored links


3 16th November 13:05
External User
 
Posts: 1
Default Intersection of 2 curves


I am trying to locate a numerical technique to find the intersection of
2 curves. These are defined by tables of data rather than equations.
The data can be fitted with a 2nd degree polynomial, and only intersect
at one point. Both curves have positive slopes, though one has a
larger slope than the other.


Appreciate any suggestions or references.

dan
  Reply With Quote
4 16th November 13:06
julian v. noble
External User
 
Posts: 1
Default Intersection of 2 curves


Here's how I would do it in a programming language:

1. Define functions f(x) and g(x) with the tables built-in
(either directly or by direct reference to an array),
using your favorite interpolation method--Newton, Lagrange,
whatever--to evaluate the tabulated function at any x in
the range.

2. Then solve the equation f(x)-g(x) = 0 using any of the
umpty-bazillion 1-dimensional root-finders in circulation.
My favorite happens to be the hybrid regula falsi/binary
search, but any will do (except Newton--you don't want to
have to calculate derivatives!).

3. Solve. Be happy.

Any standard programming language will do. You can probably even use
(ugh!) Maple's limited programming capability. (I do when I have
to.)

--
Julian V. Noble
Professor Emeritus of Physics

http://galileo.phys.virginia.edu/~jvn/

"For there was never yet philosopher that could endure the
toothache patiently."

-- Wm. Shakespeare, Much Ado about Nothing. Act v. Sc. 1.
  Reply With Quote
5 16th November 13:06
spellucci
External User
 
Posts: 1
Default Intersection of 2 curves


In article <1142249770.527787.102430@v46g2000cwv.googlegroups .com>,
dtshedd@yahoo.com writes:


you could do two independent least squares fits and then the intersection.
but in order to have only one intersection point the leading coefficients must
be equal, otherwise you get a quadratic equation for the intersection point,
which with one real solution must also have a second one.
hth
peter
  Reply With Quote
6 16th November 13:06
israel
External User
 
Posts: 1
Default Intersection of 2 curves


If dan's words are to be taken literally, the leading coefficients
must be 0 (otherwise the curves can't always have positive slopes).
But presumably what he means is that for x in the interval covered by
the data, the curves have positive slopes and one intersection point.
Then the leading coefficients need not be equal.

So least-squares fit the two curves to quadratics, take the difference and
solve the quadratic equation, taking the root that is in the correct
interval. Or if the x values for the two curves are the same, you could
just do a single least-squares fit for the difference.

Robert Israel israel@math.ubc.ca
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada
  Reply With Quote
7 16th November 13:06
zzzjon
External User
 
Posts: 1
Default Intersection of 2 curves


If the y values of each curve are all tabulated at the same x values,
just tabulate the differences. The curves intersect where the
difference changes sign. You could then interpolate between the
differences either side of zero to get a better estimate. If your
curves only have a small quadratic term, a linear interpolation might
be OK; if not, 2nd degree polynomial.

Jon
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666