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]]

closed as off-topic by m_goldberg, Oleksandr R., MarcoB, C. E., dr.blochwave Oct 1 '15 at 7:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Oleksandr R., MarcoB, C. E., dr.blochwave
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ 1) f and g are not defined, replace these with j, and k. 2) Remove the inner brakets from your definitions of j and k so that {j,k} = {x^3-4*x, 2*x+6}. Should work fine. $\endgroup$ – N.J.Evans Sep 30 '15 at 21:24
  • 2
    $\begingroup$ Seems you're copying examples from the docs.;If you modify one thing at a time you'll at the very least be sure where your problem is $\endgroup$ – Dr. belisarius Sep 30 '15 at 22:09

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]]



Not the answer you're looking for? Browse other questions tagged or ask your own question.