I'm pretty new to Mathematica. I'd like to show the intersection points in my graphic. These are my inputs:
f[y_] := -10 x^2 + 4000 x;
NSolve[f[y] == 144000, x];
Plot[{f[y], 144000}, {x, 0, 400}, PlotRange -> {0, 400000}]
I'm pretty new to Mathematica. I'd like to show the intersection points in my graphic. These are my inputs:
f[y_] := -10 x^2 + 4000 x;
NSolve[f[y] == 144000, x];
Plot[{f[y], 144000}, {x, 0, 400}, PlotRange -> {0, 400000}]
Or, hitting this tiny nail with a sledge-hammer,
f[x_] := -10 x^2 + 4000 x;
Plot[{f[x], 144000}, {x, 0, 400}, PlotRange -> {0, 400000},
MeshFunctions -> {f[#] - 144000 &}, Mesh -> {{0.}}, MeshStyle -> {Red, PointSize[0.02]}]
See the documentation page for MeshFunctions
. It's the third example.
Plot[]
, without the need for an explicit equation-solving detour.
$\endgroup$
Commented
Dec 12, 2015 at 9:33
f[y_] := -10 y^2 + 4000 y;
sol = NSolve[f[x] == 144000, x];
Plot[{f[x], 144000}, {x, 0, 400}, PlotRange -> {0, 400000},
Epilog -> {PointSize[Large], (Point[{x, f[x]}] /. sol)}]
With an adjustable threshold level using Manipulate
. The Tooltip
shows the exact values.
f[y_] := -10 y^2 + 4000 y;
Manipulate[
Column[{
(pts = Simplify[{x, f[x]} /. Solve[f[x] == t, x]]) // N,
Plot[{f[x], t}, {x, 0, 400},
Epilog -> {Red, PointSize[Large],
Tooltip[Point[#], #] & /@ pts},
ImageSize -> 360]}],
{{t, 144000, "Threshold"}, 0, 400000, 2000,
Appearance -> "Labeled"}]
R1 = ParametricRegion[{x, -10 x^2 + 4000 x}, {{x, 0, 400}}];
R2 = ParametricRegion[{x, 144000}, {{x, 0, 400}}];
sol = Point[x /. Solve[x \[Element] R1 && x \[Element] R2, x]]
Point[{{40, 144000}, {360, 144000}}]
RegionPlot[{R1, R2},
PlotRange -> {{0, 400}, {0, 400000}},
Epilog -> {Red, PointSize[0.02], sol},
AspectRatio -> 1/GoldenRatio]