I am trying to use the code below to plot intersections on the graph between the two functions, but I receive an error regarding stating it must be a pure function or list of pure functions. I am using the code directly from the manual, I am just not sure what I am missing. Also plotting the values with the points would be excellent.

{j, k} = {{x^3 – 4 x}, {2 x + 6}}

Plot[{j, k}, {x, -10, 10}, MeshFunctions -> {(f – g)/.x->#&},

Mesh -> {{0}}, MeshStyle -> PointSize[Large]]

=================

=================

1 Answer

1

=================

First, you will often find it easier to deal with Mathematica when you define and work with functions, not expressions. That is certainly the case here.

j[x_] := x^3 – 4 x

k[x_] := 2 x + 6

Second, when following examples form the Documentation Center, be careful to pay attention to the smallest details. It is a good idea to also read what is discussed under Details in the documentation article. Since j and k have been defined as functions, it is much easier to adapt the example.

Plot[{j[x], k[x]}, {x, -10, 10},

MeshFunctions -> {j[#] – k[#] &},

Mesh -> {{0}},

MeshStyle -> PointSize[Large]]