plot - Highlighting intersection points of 2 functions (Mathematica) -
given 2 functions, need find intersection points , show them on graph. particular problem, functions are: f(x) = - (x - 2) ^ 2, g(x) = x/(x+1).
so far, have following:
plot[{-(x - 2)^2 + 4, x/(x + 1)}, {x, 0, 4}, filling -> {1 -> {{2}, {white, lightblue}}}]
nsolve[-(x - 2)^2 + 4 == x/(x + 1), {x, y}]
but have no idea how show points on graph. how do that?
you can use epilog
option add graphics primitives plot:
intersections = {x, y} /. nsolve[y == -(x - 2)^2 + 4 && y == x/(x + 1), {x, y}]; plot[{-(x - 2)^2 + 4, x/(x + 1)}, {x, 0, 4}, filling -> {1 -> {{2}, {white, lightblue}}}, epilog -> {red, point[intersections]}]
Comments
Post a Comment