Mathematica - 如何在绘图上显示两个函数的交集?
Mathematica - How do I show of intersections of two functions on plot?
我定义了两个函数:
f[x_] := 40*1.04^x
g[x_] := 150*0.9^x
然后我正在绘制它们:
Plot[{f[x], g[x]}, {x, 0, 20}]
但是如何显示这两个函数的交集?
f[x_] := 40*1.04^x
g[x_] := 150*0.9^x
sol = Quiet[Solve[f[x] == g[x], x]];
xpts = x /. sol;
ypts = f /@ xpts;
Plot[{f[x], g[x]}, {x, 0, 20},
Epilog -> {PointSize[0.02], Orange,
Map[Point, Transpose[{xpts, ypts}]]}]
我定义了两个函数:
f[x_] := 40*1.04^x
g[x_] := 150*0.9^x
然后我正在绘制它们:
Plot[{f[x], g[x]}, {x, 0, 20}]
但是如何显示这两个函数的交集?
f[x_] := 40*1.04^x
g[x_] := 150*0.9^x
sol = Quiet[Solve[f[x] == g[x], x]];
xpts = x /. sol;
ypts = f /@ xpts;
Plot[{f[x], g[x]}, {x, 0, 20},
Epilog -> {PointSize[0.02], Orange,
Map[Point, Transpose[{xpts, ypts}]]}]