Wolfram Research

Function Repository Resource:

CurveIntersection (1.0.0) current version: 2.0.0 »

Source Notebook

Find the points of intersection of two curves

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["CurveIntersection"][{expr1,expr2},{x,y}]

returns the intersections of implicit curves expr1 and expr2 as points in the xy-plane.

ResourceFunction["CurveIntersection"][{expr1,expr2},{x,y},dom]

returns the intersections of expr1 and expr2 as points in the xy-plane, considered over the domain dom.

ResourceFunction["CurveIntersection"][{expr1,expr2},{x,y},dom,type]

returns the intersections with format type.

Details and Options

The domain dom may be Reals, Complexes or Integers and defaults to Complexes.
The argument type may be Grid, List, Values or "Indexed" and defaults to List.
ResourceFunction["CurveIntersection"] accepts the option "Constraints" which can specify constraints on the input variables.

Examples

Basic Examples (2) 

Obtain the points of intersection of x+1 and 2x2:

In[1]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == x + 1, y == 2 x^2}, {x, y}]
Out[1]=

Find the intersections of implicitly defined curves:

In[2]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == x + 1, x^2 + y^2 == 1}, {x, y}]
Out[2]=

Scope (3) 

Find the integer-valued intersections of two implicitly defined curves:

In[3]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == 1/2 x + 1, x^2 + y^2 == 1}, {x, y}, Integers]
Out[3]=

If there is no intersection, CurveIntersection returns unevaluated:

In[4]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == x + 3, x^2 + y^2 == 1}, {x, y}, Reals]
Out[4]=

The fourth argument changes the format of the output:

In[5]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == 1/2 x + 1, x^2 + y^2 == 1}, {x, y}, Reals, "Indexed"]
Out[5]=

Options (1) 

Find the intersections of two curves given some constraints:

In[6]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == x, y == x^2}, {x, y}, Reals, "Constraints" -> 0 < x < 2]
Out[6]=
In[7]:=
ResourceFunction["CurveIntersection"][{Sin[x], Cos[x]}, x, Reals, "Constraints" -> 0 < x < 3 Pi]
Out[7]=

Possible Issues (1) 

For curves that intersect infinitely many times, a subset of the points of intersection will be returned:

In[8]:=
ResourceFunction["CurveIntersection", ResourceVersion->"1.0.0"][{y == Sin[1/x], y == x}, {x, y}, Reals, "Constraints" -> 0 < x < 1]
Out[8]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 01 April 2020

Related Resources

License Information