Re: intersection point from listplots
- To: mathgroup at smc.vnet.net
- Subject: [mg55632] Re: intersection point from listplots
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 31 Mar 2005 01:25:38 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 3/30/05 at 3:21 AM, TMA at nus.edu.sg (Tun Myint Aung) wrote:
>I have two sets of lists for two curves. I can plot using ListPlot.
>What I want to know is how to get the intersection point in
>Mathematica. Any idea!
One approach would be to use Interpolation to create an interpolating function for each list then use FindRoot
For example,
g = Interpolation[Table[x^2, {x, -5, 5}]];
f = Interpolation[Table[(x + 2)^2, {x, -5, 5}]];
FindRoot[f[x] == g[x], {x, 4}]
{x -> 5.}
Or if the list is n X 2
g = Interpolation[Table[{x, x^2},{x, -5, 5}]];
f = Interpolation[Table[{x, (x + 2)^2},{x, -5, 5}]];
FindRoot[f[x] == g[x], {x, 0}]
{x -> -1.}
--
To reply via email subtract one hundred and four